Browse Source

必穿商品码

yuhongqi 2 days ago
parent
commit
4009c3cfd5
1 changed files with 24 additions and 5 deletions
  1. 24 5
      src/views/hisStore/storeProduct/indexZm.vue

+ 24 - 5
src/views/hisStore/storeProduct/indexZm.vue

@@ -697,7 +697,11 @@
                           <a @click="delAttrTable(scope.$index)" align="center">删除</a>
                         </div>
                         <div v-else align="center">
-                          <el-input  v-model="scope.row[scope.column.property]" align="center" />
+                          <el-input  
+                            v-model="scope.row[scope.column.property]" 
+                            align="center" 
+                            :placeholder="scope.column.property === 'barCode' ? '必填' : ''"
+                          />
                         </div>
                       </template>
                     </el-table-column>
@@ -744,7 +748,7 @@
                 </el-table-column>
                 <el-table-column prop="barCode" label="商品编号" width="130px" align="center">
                   <template slot-scope="scope">
-                    <el-input type="text" v-model="scope.row.barCode"/>
+                    <el-input type="text" v-model="scope.row.barCode" placeholder="必填" required/>
                   </template>
                 </el-table-column>
                 <el-table-column prop="barCode" label="组合编号" width="130px" align="center">
@@ -1751,12 +1755,27 @@ export default {
           if(this.form.specType ===0 ){
             this.form.items = [];
             this.form.values = this.oneFormValidate;
+            // 验证单规格商品编码必填
+            if (!this.oneFormValidate || this.oneFormValidate.length === 0) {
+              return this.$message.warning('请填写商品规格信息!');
+            }
+            for (let i = 0; i < this.oneFormValidate.length; i++) {
+              if (!this.oneFormValidate[i].barCode || this.oneFormValidate[i].barCode.trim() === '') {
+                return this.$message.warning('商品规格中的商品编号不能为空!');
+              }
+            }
           }else{
             this.form.items = this.attrs;
             this.form.values = this.manyFormValidate;
-          }
-          if(this.form.specType === 1 && this.manyFormValidate.length===0){
-            return this.$message.warning('请点击生成规格!');
+            // 验证多规格商品编码必填
+            if(this.manyFormValidate.length===0){
+              return this.$message.warning('请点击生成规格!');
+            }
+            for (let i = 0; i < this.manyFormValidate.length; i++) {
+              if (!this.manyFormValidate[i].barCode || this.manyFormValidate[i].barCode.trim() === '') {
+                return this.$message.warning('商品规格中的商品编号不能为空!');
+              }
+            }
           }
           // 组装companyIds
           if (this.form.companyIds != null && this.form.companyIds != undefined) {