From 808a4b37cae1fc87387d923cfc4166e9568209bd Mon Sep 17 00:00:00 2001 From: hupeng Date: Wed, 28 Oct 2020 19:43:02 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=A0=8D=E4=BB=B7=E7=A7=92?= =?UTF-8?q?=E6=9D=80=E6=8B=BC=E5=9B=A2=E6=95=B0=E5=80=BC=E4=B8=8D=E8=83=BD?= =?UTF-8?q?=E8=BF=9E=E7=BB=AD=E6=B7=BB=E5=8A=A0=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/activity/bargain/form.vue | 39 +++++++++++++++---------- src/views/activity/combination/form.vue | 19 +++++++----- src/views/activity/seckill/form.vue | 20 ++++++++----- 3 files changed, 47 insertions(+), 31 deletions(-) diff --git a/src/views/activity/bargain/form.vue b/src/views/activity/bargain/form.vue index ef89328..18f0e6f 100644 --- a/src/views/activity/bargain/form.vue +++ b/src/views/activity/bargain/form.vue @@ -3,7 +3,7 @@ - + @@ -121,6 +121,11 @@ export default { } }, form: { + //that.form.minPrice = 0 + //that.form.num = 1 + //that.form.bargainMaxPrice = 0 + //that.form.bargainMinPrice = 0 + //that.form.bargainNum = 1 id: '', productId: '', title: '', @@ -135,11 +140,11 @@ export default { stopTime: '', storeName: '', price: '', - minPrice: '', - num: '', - bargainMaxPrice: '', - bargainMinPrice: '', - bargainNum: '', + minPrice: 0, + num: 1, + bargainMaxPrice: 0, + bargainMinPrice: 0, + bargainNum: 1, status: 1, description: '', giveIntegral: '', @@ -164,12 +169,13 @@ export default { }, watch: { 'form.imageArr': function(val) { - if (val) { + if (val && Array.isArray(val)) { this.form.image = val.join(',') } }, 'form.sliderImageArr': function(val) { - if (val) { + console.log("aaa:"+val) + if (val && Array.isArray(val)) { this.form.images = val.join(',') } }, @@ -186,10 +192,13 @@ export default { let that = this; getInfo(id).then(async res => { let data = res.productInfo; - console.log('data:'+data) + console.info('data:'+JSON.stringify(data)) if(data){ let cate_id = parseInt(data.cate_id) || 0; - that.form = data; + //that.form = data; + Object.keys(that.form).forEach(key=>{ + if(data[key]) that.form[key] = data[key]; + }) that.form.productId = data.id that.form.cate_id = cate_id; that.form.title = data.store_name @@ -198,11 +207,11 @@ export default { that.form.imageArr = data.image that.form.sliderImageArr = data.slider_image that.form.status = 1 - that.form.minPrice = 0 - that.form.num = 1 - that.form.bargainMaxPrice = 0 - that.form.bargainMinPrice = 0 - that.form.bargainNum = 1 + //that.form.minPrice = 0 + //that.form.num = 1 + //that.form.bargainMaxPrice = 0 + //that.form.bargainMinPrice = 0 + //that.form.bargainNum = 1 } that.templateList = res.tempList; diff --git a/src/views/activity/combination/form.vue b/src/views/activity/combination/form.vue index 4e49356..b6462fb 100644 --- a/src/views/activity/combination/form.vue +++ b/src/views/activity/combination/form.vue @@ -69,7 +69,7 @@ - + @@ -258,10 +258,10 @@ export default { sliderImageArr: [], title: '', attr: '', - people: '1', + people: 1, info: '', price: '', - sort: '', + sort: 0, sales: '', stock: '', addTime: '', @@ -274,7 +274,7 @@ export default { description: '', startTime: '', stopTime: '', - effectiveTime: '', + effectiveTime: 1, cost: '', unitName: '', combination: 1, @@ -376,7 +376,7 @@ export default { // }, 'formValidate.slider_image': function(val) { - if (val) { + if (val && Array.isArray(val)) { this.formValidate.images = val.join(',') } }, @@ -510,15 +510,18 @@ export default { let data = res.productInfo; if(data){ that.attrs = data.items || []; - that.formValidate = data; + //that.formValidate = data; + Object.keys(that.formValidate).forEach(key=>{ + if(data[key]) that.formValidate[key] = data[key]; + }) that.formValidate.id = 0; that.formValidate.productId = id that.formValidate.title = data.store_name that.formValidate.info = data.store_info that.formValidate.unitName = data.unit_name that.formValidate.isShow = 1 - that.formValidate.people = 1 - that.formValidate.effectiveTime = 1 + // that.formValidate.people = 0 + // that.formValidate.effectiveTime = 0 that.oneFormValidate = [data.attr]; that.formValidate.header = []; that.generate(null); diff --git a/src/views/activity/seckill/form.vue b/src/views/activity/seckill/form.vue index 730b380..ce855ec 100644 --- a/src/views/activity/seckill/form.vue +++ b/src/views/activity/seckill/form.vue @@ -65,7 +65,7 @@ - + @@ -252,10 +252,11 @@ export default { } }, formValidate: { + slider_image: [], otPrice: '', giveIntegral: '', status: '', - num: '', + num: 1, id: 0, timeId: null, seckillId: 0, @@ -270,7 +271,7 @@ export default { people: '', info: '', price: '', - sort: '', + sort: 0, sales: '', stock: '', addTime: '', @@ -279,7 +280,7 @@ export default { isDel: 0, merUse: '', isPostage: '', - postage: '', + postage: 0, description: '', startTime: '', stopTime: '', @@ -377,7 +378,7 @@ export default { watch: { 'formValidate.slider_image': function(val) { - if (val) { + if (val && Array.isArray(val)) { this.formValidate.images = val.join(',') } }, @@ -515,7 +516,10 @@ export default { if(data){ let cate_id = parseInt(data.cate_id) || 0; that.attrs = data.items || []; - that.formValidate = data; + //that.formValidate = data; + Object.keys(that.formValidate).forEach(key=>{ + if(data[key]) that.formValidate[key] = data[key]; + }) that.formValidate.id = 0; that.formValidate.productId = id that.formValidate.cate_id = cate_id; @@ -523,9 +527,9 @@ export default { that.formValidate.title = data.store_name that.formValidate.info = data.store_info that.formValidate.unitName = data.unit_name - that.formValidate.sliderImageArr = data.slider_image + //that.formValidate.sliderImageArr = data.slider_image that.formValidate.status = 1 - that.formValidate.num = 1 + //that.formValidate.num = 1 that.formValidate.header = []; that.generate(null); that.manyFormValidate = data.attrs;