diff --git a/pages/product/addGood/addGood.vue b/pages/product/addGood/addGood.vue index 5dbee42..ded1b87 100644 --- a/pages/product/addGood/addGood.vue +++ b/pages/product/addGood/addGood.vue @@ -12,7 +12,7 @@ - + 上传时应注重真实性、清晰度 @@ -68,14 +68,16 @@ + placeholder="请输入零售价" type='number' v-model="formData.attrValue[0].price" + slot='right'> + placeholder="请输入批发价格" type='number' v-model="formData.attrValue[0].wholesale_price" + slot='right'> - @@ -194,20 +196,29 @@ "imageList": [ ], + attr: [{ + detail: [], + value: "" + }, ], "attrValue": [{ + detail: { + 规格名: 'attr[index]value', + }, "price": "", "unit_name": "", "wholesale_unit_name": "", "wholesale_price": '', "cost": "", "stock": "", + sku: '', "ot_price": "", "procure_price": "", "bar_code": "", "weight": "", - "volume": "", "extension_one": "", "extension_two": "", + uuid: "", + volume: "", "is_use": 0, }], "cate_name": "", @@ -218,10 +229,7 @@ ], "mer_cate_name": "", "spec_type": "0", - attr: [{ - detail: [], - value: "" - }, ], + "specifica": "", "delivery_way": [ @@ -263,12 +271,13 @@ maxLength: 30, showSex: false, rules: { - title: { - type: 'string', - required: true, - message: '请选择', - trigger: ['blur', 'change'] - } + "formData.imageList": [{ + validator: (rule, value, callback) => { + return this.formData.imageList.length >= 2 + }, + message: '请至少上传2张图片', + trigger: ['change', 'blur'], + }] }, }; @@ -418,7 +427,7 @@ }); }, - async submit() { + handAdd() { let data = uni.$u.deepClone(this.formData) data.image = data.imageList[0] data.slider_image = data.imageList.splice(0, 1) @@ -432,17 +441,25 @@ uni.$emit('importAttrValueOK', this.setFormData.import_id); uni.navigateBack(); } else uni.redirectTo({ - url: `/pages/product/goodsOnSale/index?mer_id=${this.mer_id}&type=6` + url: `/pages/product/list/index?mer_id=${this.mer_id}&type=6` }) }).catch(() => { uni.redirectTo({ - url: `/pages/nongKe/gather/select_warehouse?mer_id=${this.mer_id}&stype=2` + url: `/pages/product/list/index?mer_id=${this.mer_id}&type=2` }) }) }) .catch(rej => { // Toast(rej); }); + }, + async submit() { + this.$refs.formData.validate().then(res => { + this.handAdd() + }).catch(errors => { + uni.$u.toast(errors[0].message) + }) + } }, onLoad(option) { diff --git a/pages/product/addGoodDetail/addGoodDetail.vue b/pages/product/addGoodDetail/addGoodDetail.vue index 13c1809..efaba34 100644 --- a/pages/product/addGoodDetail/addGoodDetail.vue +++ b/pages/product/addGoodDetail/addGoodDetail.vue @@ -1,19 +1,21 @@