From 4eac422e52a4d28fb651b75d0f054697c7a2c0fa Mon Sep 17 00:00:00 2001
From: MrShi <1878285526@qq.com>
Date: 星期一, 09 二月 2026 15:14:13 +0800
Subject: [PATCH] 优化

---
 admin/src/components/business/OperaShopGoodsWindow.vue |  217 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 217 insertions(+), 0 deletions(-)

diff --git a/admin/src/components/business/OperaShopGoodsWindow.vue b/admin/src/components/business/OperaShopGoodsWindow.vue
new file mode 100644
index 0000000..d8fdbb5
--- /dev/null
+++ b/admin/src/components/business/OperaShopGoodsWindow.vue
@@ -0,0 +1,217 @@
+<template>
+  <GlobalWindow
+    :title="title"
+    width="80%"
+    :visible.sync="visible"
+  >
+    <TableLayout >
+      <!-- 鎼滅储琛ㄥ崟 -->
+      <el-form ref="searchForm" slot="search-form" :model="searchForm"  label-width="10px" style="display: block;" >
+        <el-form-item label="" prop="name" style="display: inline-block;margin-right: 30px;">
+          <el-input v-model="searchForm.name" placeholder="璇疯緭鍏ュ悕绉�" @keypress.enter.native="search"></el-input>
+        </el-form-item>
+        <el-form-item label="" prop="code" style="display: inline-block;margin-right: 30px;">
+          <el-input v-model="searchForm.code" placeholder="璇疯緭鍏ラ棬搴桰D" @keypress.enter.native="search"></el-input>
+        </el-form-item>
+        <el-form-item label="" prop="saleType" style="display: inline-block;margin-right: 30px;">
+          <!-- 0姝e父 1绂佺敤 -->
+          <el-select     v-model="searchForm.saleType"  placeholder="閿�鍞ā寮�"  @change="search"  >
+            <el-option  :key="0" :value="0"  label="骞冲彴閾鸿揣"  ></el-option>
+            <el-option   :key="1" :value="1" label="鑷富閲囪喘"  ></el-option>
+          </el-select>
+        </el-form-item>
+        <el-form-item label="" prop="status" style="display: inline-block;margin-right: 30px;">
+          <!-- 0姝e父 1绂佺敤 -->
+          <el-select     v-model="searchForm.status"  placeholder="璇烽�夋嫨鐘舵��"    @change="search"   >
+            <el-option  :key="0" :value="0"  label="姝e父"  ></el-option>
+            <el-option   :key="1" :value="1" label="绂佺敤"  ></el-option>
+          </el-select>
+        </el-form-item>
+        <section>
+          <el-button type="primary" @click="search">鎼滅储</el-button>
+          <el-button @click="reset">閲嶇疆</el-button>
+        </section>
+      </el-form>
+      <!-- 琛ㄦ牸鍜屽垎椤� -->
+      <template v-slot:table-wrap>
+        <div :style="'display: flex;height:'+tabelHeight+'px;'">
+          <el-table
+              v-loading="isWorking.search"
+              :data="tableData.list"
+              stripe
+              border
+              @selection-change="handleSelectionChange"
+          >
+            <!-- <el-table-column type="selection" width="55"></el-table-column> -->
+            <el-table-column prop="name" label="鍚嶇О" fixed align="center" min-width="100px">  </el-table-column>
+            <el-table-column prop="code" label="闂ㄥ簵ID" align="center" min-width="100px"></el-table-column>
+            <el-table-column prop="bigAreaName" label="鎵�灞炲尯鍩�" align="center" min-width="100px"></el-table-column>
+            <el-table-column prop="areaFullName" label="鐪佸競鍖�" align="center" min-width="150px" show-overflow-tooltip>
+              <template slot-scope="{row}">
+                <span v-if="row.areas!=null">{{(row.areas.provinceName||'') + (row.areas.cityName||'') + (row.areas.name||'')}}</span>
+              </template>
+            </el-table-column>
+            <el-table-column prop="saleType"  label="閿�鍞ā寮�" align="center" min-width="150px">
+              <template slot-scope="{row}">
+                {{ row.saleType == 1?'鑷富閲囪喘':'骞冲彴閾鸿揣'}}
+              </template>
+            </el-table-column>
+            <el-table-column prop="status" label="鐘舵��" align="center" min-width="100px" fixed="right">
+              <template slot-scope="{row}">
+                {{ row.status == 1?'绂佺敤':'姝e父'}}
+              </template>
+            </el-table-column>
+            <el-table-column prop="price" label="閿�鍞环" align="center" min-width="100px" fixed="right">
+                {{ price}}
+            </el-table-column>
+            <el-table-column prop="goodsPrice" label="渚涜揣浠�" align="center" min-width="100px" fixed="right">
+              <template slot-scope="scope">
+                <el-input v-if="scope.row.isPriceSelected" v-model="scope.row.goodsPrice"
+                          @focus="focusEvent(scope.row,scope.$index,scope.column)"
+                          @blur="blurEvent(scope.row,scope.$index,scope.column)" v-focus></el-input>
+                <p style="cursor: pointer" class="blue" title="鐐瑰嚮缂栬緫" @click="cellClick(scope.row, scope.column)" v-else>{{scope.row.goodsPrice || '鏈缃�' }}</p>
+              </template>
+            </el-table-column>
+          </el-table>
+          <pagination
+              @size-change="handleSizeChange"
+              @current-change="handlePageChange"
+              :pagination="tableData.pagination"
+          >
+          </pagination>
+          </div>
+      </template>
+    </TableLayout>
+    <template  v-slot:footer>
+      <el-button @click="visible=false">杩斿洖</el-button>
+    </template>
+  </GlobalWindow>
+</template>
+
+<script>
+import GlobalWindow from '@/components/common/GlobalWindow'
+import BaseTable from '@/components/base/BaseTable'
+import TableLayout from '@/layouts/TableLayout'
+import Pagination from '@/components/common/Pagination'
+export default {
+  name: 'OperaShopGoodsWindow',
+  extends: BaseTable,
+  components: { GlobalWindow, TableLayout, Pagination },
+  data () {
+    return {
+      activeName: 'first',
+      title: '',
+      price : null,
+      visible: false,
+      tabelHeight: null,
+      // 鎼滅储
+      searchForm: {
+        name: '',
+        goodsId: null,
+        username: '',
+        status: '',
+        saleType: '',
+        isrec: ''
+      }
+    }
+  },
+  mounted () {
+    window.addEventListener('resize', this.handleResize)
+  },
+  beforeDestroy () {
+    window.removeEventListener('resize', this.handleResize)
+  },
+  created () {
+    this.config({
+      module: '鍟嗗搧淇℃伅琛�',
+      api: '/business/shop',
+      'field.id': 'id',
+      'field.main': 'id'
+    })
+    this.handleResize()
+  },
+  directives: {
+    focus: {
+      inserted: function (el) {
+        el.querySelector('input').focus()
+      }
+    }
+  },
+  methods: {
+    handleResize () {
+      this.tabelHeight = window.innerHeight - 300
+    },
+    open (title, goods) {
+      this.title = title
+      this.visible = true
+      this.price = goods.skuPrice
+      this.searchForm.goodsId = goods.id
+      this.search()
+    },
+    handlePageChange: function (pageIndex) {
+      this.__checkApi()
+      this.tableData.pagination.pageIndex = pageIndex || this.tableData.pagination.pageIndex
+      this.isWorking.search = true
+      this.api.fetchList({
+        page: this.tableData.pagination.pageIndex,
+        capacity: this.tableData.pagination.pageSize,
+        model: this.searchForm,
+        sorts: this.tableData.sorts
+      })
+        .then(data => {
+          (data.records|| []).forEach((item) => {
+            item.isPriceSelected = false
+          })
+          this.tableData.list = data.records || []
+          this.tableData.pagination.total = data.total
+          console.log(this.tableData.list)
+        })
+        .catch(e => {
+          this.$tip.apiFailed(e)
+        })
+        .finally(() => {
+          this.isWorking.search = false
+        })
+    },
+    cellClick (row, column) {
+      row.isPriceSelected = !row.isPriceSelected
+    },
+    focusEvent (row, index, column) {
+      row.oldGoodsPrice = row.goodsPrice
+    },
+    blurEvent (row, curIndex, column) {
+      if(this.price <= row.goodsPrice) {
+        this.$tip.error('渚涜揣浠蜂笉鑳藉ぇ浜庨攢鍞环')
+        row.isPriceSelected = !row.isPriceSelected
+        row.goodsPrice = row.oldGoodsPrice// 浠锋牸杩樺師
+        return
+      }
+      if( row.goodsPrice == row.oldGoodsPrice){
+        row.isPriceSelected = !row.isPriceSelected
+        return;
+      }
+      this.api.setGoodsPrice({
+        id: row.id,
+        goodsId: this.searchForm.goodsId,
+        goodsPrice: row.goodsPrice
+      }).then(res => {
+        row.oldGoodsPrice = row.goodsPrice
+        this.$tip.success('淇敼鎴愬姛')
+        this.$emit('success')
+      }).catch(e => {
+        row.goodsPrice = row.oldGoodsPrice// 浠锋牸杩樺師
+      }).finally(() => {
+        row.isPriceSelected = !row.isPriceSelected
+      })
+    },
+    handleClick (val) {
+    }
+  }
+}
+</script>
+<style scoped>
+.table-pagination{
+  position: fixed !important;
+  bottom: 50px;
+}
+</style>

--
Gitblit v1.9.3