Переглянути джерело

物料属性添加商品条码

hcf 1 рік тому
батько
коміт
561f5c3c3d

+ 7 - 1
src/views/audit/productManagement/index.vue

@@ -546,7 +546,7 @@
 					compConfig: {
 						attr: {
 							size: 'mini',
-							placeholder: ' '
+							placeholder: ' ',
 						},
 					}
 				},
@@ -1260,6 +1260,9 @@
 						if (!v.skuTitle) return this.$message.warning('物料标题必填');
 						if (!v.skuCode) return this.$message.warning('物料编码必填');
 						if (!v.barCode) return this.$message.warning('物料属性的商品条码需必填');
+						if (!/^\d{1,32}$/.test(v.barCode)){
+							return this.$message.warning('商品条码为数字,最大32位');
+						}
 						// if(v.weight&&v.weight!=0){
 						// 	v.weight = v.weight/1000
 						// }
@@ -1309,6 +1312,9 @@
 						if (!v.skuTitle) return this.$message.warning('物料属性的标题需必填');
 						if (!v.skuCode) return this.$message.warning('物料属性的物料编码需必填');
 						if (!v.barCode) return this.$message.warning('物料属性的商品条码需必填');
+						if (!/^\d{1,32}$/.test(v.barCode)){
+							return this.$message.warning('商品条码为数字,最大32位');
+						}
 						
 						// if(v.weight&&v.weight!=0){
 						// 	v.weight = v.weight/1000

+ 3 - 0
src/views/audit/sku/index.vue

@@ -456,6 +456,9 @@
 			if (!data[0].skuTitle) return this.$message.warning('物料标题不能为空');
 			if (!data[0].skuCode) return this.$message.warning('物料编号不能为空');
 			if (!data[0].barCode) return this.$message.warning('物料属性的商品条码需必填');
+			if (!/^\d{1,32}$/.test(data[0].barCode)){
+				return this.$message.warning('商品条码为数字,最大32位');
+			}
 			api.updateList(data[0], 'maindataMaterialSku').then((res : any) => {
 				if (res.code === 200) {
 					this.$message.success('编辑成功');