From 2c1415e6c7bf6837cb24768770b10821853a6341 Mon Sep 17 00:00:00 2001
From: doum <doum>
Date: 星期三, 14 一月 2026 17:14:06 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

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

diff --git a/admin/src/components/business/OperaCouponGoodsWindow.vue b/admin/src/components/business/OperaCouponGoodsWindow.vue
new file mode 100644
index 0000000..fd5a9e3
--- /dev/null
+++ b/admin/src/components/business/OperaCouponGoodsWindow.vue
@@ -0,0 +1,264 @@
+<template>
+  <GlobalWindow
+    :title="title"
+    width="80%"
+    :visible.sync="visible"
+    @confirm="confirm"
+  >
+    <TableLayout :permissions="['business:goods:query']">
+      <!-- 鎼滅储琛ㄥ崟 -->
+      <el-form ref="searchForm" slot="search-form" :model="searchForm" label-width="100px" style="display: block;" >
+        <el-form-item label="" prop="name" label-width="5px" style="display: inline-block;margin-right: 30px;">
+          <el-input v-model="searchForm.name" style="width: 150px;" placeholder="鍟嗗搧鍚嶇О" clearable @keypress.enter.native="search"></el-input>
+        </el-form-item>
+        <el-form-item label="" prop="categoryId" label-width="5px" style="display: inline-block;margin-right: 30px;" >
+          <el-select v-model="searchForm.categoryId" placeholder="鎵�灞炲垎绫�"    clearable style="width: 150px;"  >
+            <el-option  v-for="item in labels"  :key="item.id" :value="item.id"  :label="item.name" ></el-option>
+          </el-select>
+        </el-form-item>
+        <el-form-item label="" prop="brandId" label-width="5px" style="display: inline-block">
+          <el-select  v-model="searchForm.brandId"  placeholder="鎵�灞炲搧鐗�"  style="width: 150px;"   >
+            <el-option  v-for="item in brands"   :key="item.id"   :value="item.id"  :label="item.name"    clearable ></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;'">
+          <div style="flex: 6;">
+            <ul class="toolbar">
+              <li><el-button type="primary"  icon="el-icon-plus"  @click="addAll()" :disabled="!(tableData.selectedRows &&  tableData.selectedRows.length)">鎵归噺娣诲姞</el-button></li>
+            </ul>
+          <el-table
+              ref="singleTable"
+              :height="tabelHeight-80"
+              v-loading="isWorking.search"
+              :data="tableData.list"
+              stripe
+              border
+              @selection-change="handleSelectionChange"
+          >
+            <el-table-column type="selection"  :selectable="checkSelectable" width="55"></el-table-column>
+            <el-table-column prop="imgurl" label="鍒楄〃鍥�" min-width="70px">
+              <template slot-scope="{row}">
+                <el-image style="width: 50px;height: 50px;" v-if="row.imgurl && row.imgurl!=''" :src="row.resourcePath+row.imgurl" :preview-src-list="[row.resourcePath+row.imgurl]"></el-image>
+              </template>
+            </el-table-column>
+            <el-table-column prop="id" label="鍟嗗搧ID"   ></el-table-column>
+            <el-table-column prop="name" label="鍟嗗搧鍚嶇О"   show-overflow-tooltip></el-table-column>
+            <el-table-column prop="categoryName" label="鎵�灞炲垎绫�"  ></el-table-column>
+            <el-table-column prop="brandName" label="鎵�灞炲搧鐗�"  ></el-table-column>
+            <el-table-column prop="price" label="灞曠ず浠锋牸"  ></el-table-column>
+            <el-table-column prop="skuPrice" label="闆跺敭浠�(鍏�)" ></el-table-column>
+            <el-table-column  label="鎿嶄綔"   align="center" min-width="80px"   fixed="right"  >
+              <template slot-scope="{ row }">
+                <el-button style="color: red"  v-if="row.tabStatus === 2" type="text" icon="el-icon-delete" @click="delItem(row)">绉婚櫎</el-button>
+                <el-button v-else type="text" icon="el-icon-plus" @click="add(row)">娣诲姞</el-button>
+              </template>
+            </el-table-column>
+          </el-table>
+          <pagination
+              @size-change="handleSizeChange"
+              @current-change="handlePageChange"
+              :pagination="tableData.pagination"
+          >
+          </pagination>
+          </div>
+          <div  style="flex: 2;margin-left: 20px;border: 1px solid #f2f2f2;padding: 10px;font-size: 12px;">
+              <div style="display: flex;">
+                <div style="flex: 6"> <span>宸查�夋嫨<i class="blue" style="margin: 0 10px">{{selectGoods.length||0}}</i>浠跺晢鍝�</span></div>
+                <div style="flex: 1;text-align: right"> <el-button size="mini" type="danger" class="blue" @click="cleanAll">娓呯┖</el-button></div>
+              </div>
+              <div :style="`display: flex;flex-direction: column;max-height: ${tabelHeight-80}px;overflow: auto`">
+                <div  v-for="(item,index) in selectGoods" style="display: flex;margin: 10px 0;" :key="'selGoods'+item.id">
+                  <div style="flex: 6">{{item.name}}<br><span class="red">锟{item.skuPrice || 0}}</span></div>
+                  <div style="flex: 1;text-align: right;">
+                    <el-button class="blue" style="border: none;color: red" icon="el-icon-delete" @click="del(item,index)"></el-button>
+                  </div>
+                </div>
+              </div>
+          </div>
+        </div>
+      </template>
+    </TableLayout>
+  </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'
+import { findAll as labelList } from '@/api/business/labels'
+export default {
+  name: 'OperaCouponGoodsWindow',
+  extends: BaseTable,
+  components: { GlobalWindow, TableLayout, Pagination },
+  data () {
+    return {
+      activeName: 'first',
+      title: '',
+      visible: false,
+      tabelHeight: null,
+      // 鎼滅储
+      searchForm: {
+        name: '',
+        categoryId: '',
+        brandId: '',
+        type: '0', // 骞冲彴鍟嗗搧
+        status: '',
+        isrec: '',
+        labels: ''
+      },
+      labels: [],
+      serials: [],
+      brands: [],
+      selectGoods: []
+    }
+  },
+  mounted() {
+    window.addEventListener('resize', this.handleResize);
+  },
+  beforeDestroy() {
+    window.removeEventListener('resize', this.handleResize);
+  },
+  created () {
+    this.config({
+      module: '鍟嗗搧淇℃伅琛�',
+      api: '/business/goods',
+      'field.id': 'id',
+      'field.main': 'id'
+    })
+    labelList({
+      type: 0 // 鍟嗗搧鍒嗙被
+    }).then(res => {
+      this.labels = res
+    })
+    labelList({
+      type: 1 // 鍟嗗搧鍝佺墝
+    })
+      .then(res => {
+        this.brands = res
+      })
+    this.handleResize()
+  },
+  methods: {
+    handleResize(){
+      this.tabelHeight = window.innerHeight - 300
+    },
+    checkSelectable (row) {
+      return row.tabStatus !== 2
+    },
+    addAll () {
+      if (this.tableData.selectedRows && this.tableData.selectedRows.length) {
+        this.tableData.selectedRows.forEach(item => {
+          this.add(item)
+        })
+        this.$nextTick(() => {
+          if (this.$refs.singleTable) {
+            this.$refs.singleTable.clearSelection()
+          }
+        })
+      }
+    },
+    cleanAll () {
+      this.selectGoods = []
+      this.tableData.list.forEach(item => {
+        item.tabStatus = 1
+      })
+      this.$nextTick(() => {
+        if (this.$refs.singleTable) {
+          this.$refs.singleTable.clearSelection()
+        }
+      })
+    },
+    add (row) {
+      var add = true
+      row.tabStatus = 2
+      console.log(this.tableData.list)
+      this.selectGoods.forEach(item => {
+        if (item.id === row.id) {
+          add = false
+        }
+      })
+      if (add) {
+        this.selectGoods.push(row)
+      }
+    },
+    del (row, index) {
+      this.selectGoods.splice(index, 1)
+      this.tableData.list.forEach(item => {
+        if (item.id === row.id) {
+          item.tabStatus = 1
+        }
+      })
+    },
+    delItem (delItem) {
+      this.selectGoods.forEach((item, index) => {
+        if (item.id === delItem.id) {
+          this.del(item, index)
+        }
+      })
+    },
+    confirm () {
+      this.$emit('success', this.selectGoods)
+      this.visible = false
+    },
+    open (title, goods) {
+      this.title = title
+      this.visible = true
+      this.cleanAll()
+      if (goods && goods.length) {
+        goods.forEach(item => {
+          this.selectGoods.push(item)
+        })
+      }
+      this.search()
+    },
+    handlePageChange (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 => {
+          this.tableData.list = data.records || []
+          this.tableData.pagination.total = data.total
+          this.tableData.list.forEach(item => {
+            item.tabStatus = 1
+            this.selectGoods.forEach(row => {
+              if (item.id === row.id) {
+                item.tabStatus = 2
+              }
+            })
+          })
+        })
+        .catch(e => {
+          this.$tip.apiFailed(e)
+        })
+        .finally(() => {
+          this.isWorking.search = false
+        })
+    },
+    goPriceSet (row) {
+
+    },
+    handleClick (val) {
+    }
+  }
+}
+</script>
+<style scoped>
+.table-pagination{
+  position: fixed !important;
+  bottom: 50px;
+}
+</style>

--
Gitblit v1.9.3