Parcourir la source

Update shopList.vue

王新雷 il y a 4 ans
Parent
commit
ca6591258f
1 fichiers modifiés avec 35 ajouts et 4 suppressions
  1. 35 4
      src/views/businessManager/shopManager/shopList.vue

+ 35 - 4
src/views/businessManager/shopManager/shopList.vue

@@ -18,17 +18,17 @@
           <el-input v-model.trim="searchForm.search" placeholder="商品编号/货号/商品名称"></el-input>
         </el-form-item>
         <el-form-item>
-          <el-select v-model.trim="searchForm.type" placeholder="商品类型">
+          <el-select v-model.trim="searchForm.type" clearable placeholder="商品类型">
             <el-option v-for="(item, index) in goodsType" :key="index" :label="item.label" :value="item.value"></el-option>
           </el-select>
         </el-form-item>
         <el-form-item>
-          <el-select v-model.trim="searchForm.goodsCategoryId" placeholder="商品分类">
+          <el-select v-model.trim="searchForm.goodsCategoryId" clearable placeholder="商品分类">
             <el-option v-for="(item, index) in categoryList" :key="index" :label="item.label" :value="item.value"></el-option>
           </el-select>
         </el-form-item>
         <el-form-item>
-          <el-select v-model.trim="searchForm.groupGoods" placeholder="是否是组合商品">
+          <el-select v-model.trim="searchForm.groupGoods" clearable placeholder="是否是组合商品">
             <el-option label="是" value="1"></el-option>
             <el-option label="否" value="0"></el-option>
           </el-select>
@@ -77,8 +77,22 @@
             </template>
           </el-table-column>
           <el-table-column align='center' prop="stockCount" label="内部库存">
+            <template slot-scope="scope">
+              <!-- 先判断是否是组合商品 -->
+              <span v-if="scope.row.complementGoodsIdList">
+                {{ scope.row.stockCount ? scope.row.stockCount : '' }}
+              </span>
+              <span v-else>{{ scope.row.stockCount }}</span>
+            </template>
           </el-table-column>
           <el-table-column align='center' prop="taxStockCount" label="税务库存">
+            <template slot-scope="scope">
+              <!-- 先判断是否是组合商品 -->
+              <span v-if="scope.row.complementGoodsIdList">
+                {{ scope.row.taxStockCount ? scope.row.taxStockCount : '' }}
+              </span>
+              <span v-else>{{ scope.row.taxStockCount }}</span>
+            </template>
           </el-table-column>
           <el-table-column align='center' prop="stockType" label="库存类型">
             <template slot-scope="scope">
@@ -530,7 +544,8 @@
         goodsQuery({
           rows: 9999,
           page: 1,
-          groupGoods: 0
+          groupGoods: 0,
+          status: 1
         }).then(res => {
           if (res.code == 200 && res.data) {
             this.selectGoodsList = res.data.rows
@@ -570,12 +585,26 @@
           brief: null,
           desc: null
         }
+        this.onValidGoodsStatus()
         this.routeShopStatus = true
         this.isAdd = true
         if(this.$refs['ruleForm']) {
           this.$refs['ruleForm'].resetFields();
         }
       },
+      onValidGoodsStatus() { // 更新商品选择状态
+        let goodsList = this.form.goodsList
+        let tempIds = []
+        goodsList.forEach(item => {
+          tempIds.push(item.id)
+        })
+        this.selectGoodsList.forEach(item => {
+          item.disabled = false
+          if(tempIds.includes(item.id)) {
+            item.disabled = true
+          }
+        })
+      },
       onShopOperation(type, row) { // 添加或修改
         let params = {
           type: type
@@ -604,6 +633,8 @@
           })
           form.goodsList = goodsList
           form.id = row.id
+
+          this.onValidGoodsStatus()
         } else {
           this.$router.push({
             path: '/shopManager/shopOperation',