Showing
2 changed files
with
96 additions
and
47 deletions
| @@ -85,9 +85,8 @@ Page({ | @@ -85,9 +85,8 @@ Page({ | ||
| 85 | is_comments = marketing.is_comments?marketing.is_comments:''; | 85 | is_comments = marketing.is_comments?marketing.is_comments:''; |
| 86 | marketing.coupon_data_comments=(is_comments=='1' && marketing.is_comments_coupon=='1')?util.determine(marketing.coupon_data_comments):''; | 86 | marketing.coupon_data_comments=(is_comments=='1' && marketing.is_comments_coupon=='1')?util.determine(marketing.coupon_data_comments):''; |
| 87 | } | 87 | } |
| 88 | - | ||
| 89 | let coupon_data_comments=marketing.coupon_data_comments;//赠送优惠券的列表 | 88 | let coupon_data_comments=marketing.coupon_data_comments;//赠送优惠券的列表 |
| 90 | - let coupon=marketing.is_comments_coupon;//评价赠送优惠券 | 89 | + let coupon=(marketing && marketing.is_comments=='1' && marketing.is_comments_coupon=='1')?'1':'0';//评价赠送优惠券 |
| 91 | let couponId,price,use; | 90 | let couponId,price,use; |
| 92 | if(coupon && coupon_data_comments && coupon_data_comments.length>0){ | 91 | if(coupon && coupon_data_comments && coupon_data_comments.length>0){ |
| 93 | let obj=coupon_data_comments[0]; | 92 | let obj=coupon_data_comments[0]; |
| @@ -134,6 +133,7 @@ Page({ | @@ -134,6 +133,7 @@ Page({ | ||
| 134 | } | 133 | } |
| 135 | wx.showLoading({ | 134 | wx.showLoading({ |
| 136 | title: '提交中,请稍后!', | 135 | title: '提交中,请稍后!', |
| 136 | + mask: true, | ||
| 137 | }) | 137 | }) |
| 138 | let params = { | 138 | let params = { |
| 139 | sid: this.data.options.sellerid, | 139 | sid: this.data.options.sellerid, |
| @@ -149,36 +149,38 @@ Page({ | @@ -149,36 +149,38 @@ Page({ | ||
| 149 | ...params | 149 | ...params |
| 150 | }); | 150 | }); |
| 151 | App.User.SetComment(params).then(res => { | 151 | App.User.SetComment(params).then(res => { |
| 152 | - if (res.ret != 200) { | 152 | + if (res.ret== 200 && res.data) { |
| 153 | + let url = '' | ||
| 154 | + let options = this.data.options | ||
| 155 | + console.log('options',options); | ||
| 156 | + // 有券 | ||
| 157 | + if (this.data.coupon == '1') { | ||
| 158 | + url = util.http_build_query({ | ||
| 159 | + sellerName: options.sellerName, | ||
| 160 | + coupon: this.data.coupon, | ||
| 161 | + couponId: this.data.couponId, | ||
| 162 | + price: this.data.price, | ||
| 163 | + use: this.data.use, | ||
| 164 | + oid: options.oid, | ||
| 165 | + sellid: options.sellerid, | ||
| 166 | + }, './opinionSuccess') | ||
| 167 | + } else { //没券 | ||
| 168 | + url = util.http_build_query({ | ||
| 169 | + sellerName: options.sellerName, | ||
| 170 | + coupon: this.data.coupon, //1有券 2没有券 | ||
| 171 | + couponId: this.data.couponId || '', | ||
| 172 | + sellid: options.sellerid, | ||
| 173 | + }, './opinionSuccess') | ||
| 174 | + } | ||
| 175 | + wx.redirectTo({ | ||
| 176 | + url | ||
| 177 | + }) | ||
| 178 | + }else{ | ||
| 153 | return wx.showToast({ | 179 | return wx.showToast({ |
| 154 | icon: 'none', | 180 | icon: 'none', |
| 155 | title: res.msg, | 181 | title: res.msg, |
| 156 | }) | 182 | }) |
| 157 | } | 183 | } |
| 158 | - let url = '' | ||
| 159 | - let options = this.data.options | ||
| 160 | - // 有券 | ||
| 161 | - if (this.data.coupon == '1') { | ||
| 162 | - url = util.http_build_query({ | ||
| 163 | - sellerName: options.sellerName, | ||
| 164 | - coupon: this.data.coupon, | ||
| 165 | - couponId: this.data.couponId, | ||
| 166 | - price: this.data.price, | ||
| 167 | - use: this.data.use, | ||
| 168 | - oid: options.oid, | ||
| 169 | - sid: options.sellerid, | ||
| 170 | - }, './opinionSuccess') | ||
| 171 | - } else { //没券 | ||
| 172 | - url = util.http_build_query({ | ||
| 173 | - sellerName: options.sellerName, | ||
| 174 | - coupon: this.data.coupon, //1有券 2没有券 | ||
| 175 | - couponId: this.data.couponId || '', | ||
| 176 | - }, './opinionSuccess') | ||
| 177 | - } | ||
| 178 | - wx.hideLoading() | ||
| 179 | - wx.redirectTo({ | ||
| 180 | - url | ||
| 181 | - }) | ||
| 182 | }).catch(e => { | 184 | }).catch(e => { |
| 183 | wx.hideLoading() | 185 | wx.hideLoading() |
| 184 | console.log('catch', e); | 186 | console.log('catch', e); |
| @@ -7,7 +7,14 @@ Page({ | @@ -7,7 +7,14 @@ Page({ | ||
| 7 | * 页面的初始数据 | 7 | * 页面的初始数据 |
| 8 | */ | 8 | */ |
| 9 | data: { | 9 | data: { |
| 10 | - options: {} | 10 | + options: { |
| 11 | + coupon:'', | ||
| 12 | + couponId:'', | ||
| 13 | + price:'', | ||
| 14 | + use:'', | ||
| 15 | + sid:'', | ||
| 16 | + StyleType:'', | ||
| 17 | + } | ||
| 11 | }, | 18 | }, |
| 12 | 19 | ||
| 13 | /** | 20 | /** |
| @@ -18,25 +25,64 @@ Page({ | @@ -18,25 +25,64 @@ Page({ | ||
| 18 | this.setData({ | 25 | this.setData({ |
| 19 | options, | 26 | options, |
| 20 | }) | 27 | }) |
| 21 | - // 金额为0 直接领券后 | ||
| 22 | - if (options.coupon == '1' && options.price * 1 == 0) { | ||
| 23 | - App.Activity.CreateNewRechargeOrder({ | ||
| 24 | - recharge_id: options.couponId, | ||
| 25 | - sellerid: options.sid, | ||
| 26 | - number: '1', | ||
| 27 | - price: options.price, | ||
| 28 | - type: '1', | ||
| 29 | - }).then(res => { | ||
| 30 | - if (res.ret != '200') { | ||
| 31 | - wx.showToast({ | ||
| 32 | - title: '领券失败!', | ||
| 33 | - duration: 2000, | ||
| 34 | - mask: true | ||
| 35 | - }) | ||
| 36 | - } | ||
| 37 | - }) | ||
| 38 | - } | 28 | + this.getSellerTemplateConfFun(options.sellid) |
| 39 | }, | 29 | }, |
| 30 | + getSellerTemplateConfFun(sid) { | ||
| 31 | + console.log('sellid',sid); | ||
| 32 | + App.Seller.GetSellerTemplateConf({ | ||
| 33 | + sid | ||
| 34 | + }).then(res => { | ||
| 35 | + if(res.ret==200){ | ||
| 36 | + let data=res.data | ||
| 37 | + let marketing,is_comments; | ||
| 38 | + marketing = util.determine(data.marketing); | ||
| 39 | + if(marketing){ | ||
| 40 | + is_comments = marketing.is_comments?marketing.is_comments:''; | ||
| 41 | + marketing.coupon_data_comments=(is_comments=='1' && marketing.is_comments_coupon=='1')?util.determine(marketing.coupon_data_comments):''; | ||
| 42 | + } | ||
| 43 | + console.log('marketingmarketing',{...marketing}); | ||
| 44 | + let coupon_data_comments=marketing && marketing.coupon_data_comments?marketing.coupon_data_comments:[];//赠送优惠券的列表 | ||
| 45 | + let coupon=(marketing && marketing.is_comments=='1' && marketing.is_comments_coupon=='1')?'1':'0';//评价赠送优惠券 | ||
| 46 | + let couponId,price,use; | ||
| 47 | + if(coupon && coupon_data_comments && coupon_data_comments.length>0){ | ||
| 48 | + let obj=coupon_data_comments[0]; | ||
| 49 | + console.log('填写意见获取的券的信息',obj); | ||
| 50 | + couponId=obj.id; | ||
| 51 | + price=obj.price; | ||
| 52 | + use=JSON.stringify(obj.use) | ||
| 53 | + } | ||
| 54 | + this.setData({ | ||
| 55 | + 'options.price':price || '', | ||
| 56 | + 'options.use':use || '', | ||
| 57 | + 'options.coupon':coupon || '', | ||
| 58 | + 'options.couponId':couponId || '', | ||
| 59 | + StyleType:data.type | ||
| 60 | + }) | ||
| 61 | + setTimeout(() => { | ||
| 62 | + // 金额为0 直接领券后 | ||
| 63 | + if (this.data.options.coupon == '1' && this.data.options.price * 1 == 0) { | ||
| 64 | + App.Activity.CreateNewRechargeOrder({ | ||
| 65 | + recharge_id: this.data.options.couponId, | ||
| 66 | + sellerid: sid, | ||
| 67 | + number: '1', | ||
| 68 | + price: this.data.options.price, | ||
| 69 | + type: '1', | ||
| 70 | + }).then(res => { | ||
| 71 | + if (res.ret != '200') { | ||
| 72 | + wx.showToast({ | ||
| 73 | + title: '领券失败!', | ||
| 74 | + duration: 2000, | ||
| 75 | + mask: true | ||
| 76 | + }) | ||
| 77 | + } | ||
| 78 | + }) | ||
| 79 | + } | ||
| 80 | + }, 100); | ||
| 81 | + }else{ | ||
| 82 | + console.log('GetSellerTemplateConf请求失败'); | ||
| 83 | + } | ||
| 84 | + }) | ||
| 85 | + }, | ||
| 40 | seeCoupon() { | 86 | seeCoupon() { |
| 41 | wx.showLoading({ | 87 | wx.showLoading({ |
| 42 | title: '加载中', | 88 | title: '加载中', |
| @@ -48,8 +94,9 @@ Page({ | @@ -48,8 +94,9 @@ Page({ | ||
| 48 | id: options.couponId, | 94 | id: options.couponId, |
| 49 | name: options.sellerName, | 95 | name: options.sellerName, |
| 50 | oid: options.oid, | 96 | oid: options.oid, |
| 51 | - sid: options.sid, | 97 | + sid: options.sellid, |
| 52 | types: '1', | 98 | types: '1', |
| 99 | + StyleType:this.data.StyleType, | ||
| 53 | use: options.use ? JSON.stringify(options.use) : '', | 100 | use: options.use ? JSON.stringify(options.use) : '', |
| 54 | }, '/pack-activity/pack/buyCoupon') | 101 | }, '/pack-activity/pack/buyCoupon') |
| 55 | wx.hideLoading() | 102 | wx.hideLoading() |
-
Please register or login to post a comment