Răsfoiți Sursa

花材管理

shish 3 ani în urmă
părinte
comite
a8fa4cf0ad
1 a modificat fișierele cu 26 adăugiri și 3 ștergeri
  1. 26 3
      hdApp/src/admin/goods/detail.vue

+ 26 - 3
hdApp/src/admin/goods/detail.vue

@@ -24,7 +24,7 @@
         </tui-list-cell>
         <tui-list-cell class="line-cell" :hover="false">
           <view class="tui-title">库存</view>
-          <input v-model="form.stock" placeholder-class="phcolor" style="color:#CCCCCC;" class="tui-input" disabled="true" name="stock" placeholder="留空表示库存充足" maxlength="50" type="number" />
+          <input v-model="form.stock" placeholder-class="phcolor" class="tui-input" name="stock" placeholder="留空表示库存充足" maxlength="50" type="number" />
         </tui-list-cell>
         <tui-list-cell class="line-cell" :hover="false">
           <view class="tui-title">历史销量</view>
@@ -212,7 +212,8 @@ export default {
         inTurn:0
       },
       categoryData:[],
-      stockModel:0
+      stockModel:0,
+      categoryIds:[]
     };
   },
   onLoad() {
@@ -290,6 +291,11 @@ export default {
         getClass({flower:res.data.flower}).then(res => {
           if(res.code && res.code == 1){
             this.categoryData = res.data
+            if (!this.$util.isEmpty(this.categoryData)) {
+              for (const ele of this.categoryData) {
+                this.categoryIds.push(ele.id)
+              }
+            }
           }
         })
       })
@@ -322,11 +328,28 @@ export default {
         this.$msg("请选择分类")
         return false
       }
+
+      //过滤掉无效的id,历史bug ssh 20221210
+      let newIds = []
+      this.form.categoryIdList.forEach((id)=>{
+        let idx = this.categoryIds.findIndex(e => e == id);
+        if (idx == -1) {
+        } else {
+          newIds.push(id)
+        }
+      })
+      if (this.$util.isEmpty(newIds)) {
+        this.$msg("请选择分类")
+        return false
+      }
+      this.form.categoryIdList = newIds
+      //过滤掉无效的id,历史bug ssh 20221210
+
+
       if (this.$util.isEmpty(this.form.shopImg)) {
         this.$msg("请上传图片")
         return false
       }
-
       const product = this.selectList.map(ele => {
         let unitName = ele.bigUnit
         let unitType = 0