Showing
2 changed files
with
7 additions
and
36 deletions
@@ -3,16 +3,16 @@ Component({ | @@ -3,16 +3,16 @@ Component({ | ||
3 | show: { | 3 | show: { |
4 | type: Boolean, | 4 | type: Boolean, |
5 | value: false, | 5 | value: false, |
6 | - observer: '_show' | 6 | + // observer: '_show' |
7 | }, | 7 | }, |
8 | coupons: { | 8 | coupons: { |
9 | type: Array, | 9 | type: Array, |
10 | - value: [] | 10 | + value: [], |
11 | }, | 11 | }, |
12 | selectedCode: { | 12 | selectedCode: { |
13 | type: String, | 13 | type: String, |
14 | value: '', | 14 | value: '', |
15 | - observer: '_showselectedCode' | 15 | + |
16 | }, | 16 | }, |
17 | chosenIdx: { | 17 | chosenIdx: { |
18 | type: String, | 18 | type: String, |
@@ -28,7 +28,6 @@ Component({ | @@ -28,7 +28,6 @@ Component({ | ||
28 | let codeType = item && item.coupon_type|| ''; | 28 | let codeType = item && item.coupon_type|| ''; |
29 | let code = item && item.coupon_code || ''; | 29 | let code = item && item.coupon_code || ''; |
30 | let amount = item && item.coupon_value_str || ''; | 30 | let amount = item && item.coupon_value_str || ''; |
31 | - | ||
32 | this.triggerEvent('confirmselect', { code, amount, codeType}) | 31 | this.triggerEvent('confirmselect', { code, amount, codeType}) |
33 | }, | 32 | }, |
34 | cancel: function () { | 33 | cancel: function () { |
@@ -59,16 +58,11 @@ Component({ | @@ -59,16 +58,11 @@ Component({ | ||
59 | }); | 58 | }); |
60 | this.data.chosenIdx = ''; | 59 | this.data.chosenIdx = ''; |
61 | }, | 60 | }, |
62 | - _showselectedCode(selectedCode){ | ||
63 | - console.log(selectedCode) | ||
64 | - | ||
65 | - }, | ||
66 | _show: function (show) { | 61 | _show: function (show) { |
67 | - console.log('selectedCode') | ||
68 | if (show) { | 62 | if (show) { |
69 | if (this.data.selectedCode) { | 63 | if (this.data.selectedCode) { |
70 | this.data.coupons.forEach((item, index) => { | 64 | this.data.coupons.forEach((item, index) => { |
71 | - if (item.coupon_code === this.data.selectedCode) { | 65 | + if (item.selected === 'Y') { |
72 | this.setData({ | 66 | this.setData({ |
73 | [`coupons[${index}].isChosen`]: true | 67 | [`coupons[${index}].isChosen`]: true |
74 | }); | 68 | }); |
@@ -88,6 +82,7 @@ Component({ | @@ -88,6 +82,7 @@ Component({ | ||
88 | this.data.chosenIdx = ''; | 82 | this.data.chosenIdx = ''; |
89 | } | 83 | } |
90 | } | 84 | } |
85 | + console.log(this.data.coupons) | ||
91 | } | 86 | } |
92 | } | 87 | } |
93 | }); | 88 | }); |
@@ -68,20 +68,15 @@ Page({ | @@ -68,20 +68,15 @@ Page({ | ||
68 | }, | 68 | }, |
69 | 69 | ||
70 | showSelectCoupon: function () { | 70 | showSelectCoupon: function () { |
71 | - console.log('console.log(this.coupon)') | ||
72 | - console.log(this.data) | ||
73 | this.setData({ | 71 | this.setData({ |
74 | selectingCoupon: true | 72 | selectingCoupon: true |
75 | }); | 73 | }); |
76 | }, | 74 | }, |
77 | 75 | ||
78 | async confirmSelectCoupon({detail}) { | 76 | async confirmSelectCoupon({detail}) { |
79 | - console.log('detail') | ||
80 | 77 | ||
81 | let code = detail.code; | 78 | let code = detail.code; |
82 | let codeType = detail.codeType; | 79 | let codeType = detail.codeType; |
83 | - console.log(code) | ||
84 | - // let codeType = detail.coupon | ||
85 | let amount = detail.amount || ''; | 80 | let amount = detail.amount || ''; |
86 | 81 | ||
87 | this.setData({ | 82 | this.setData({ |
@@ -95,6 +90,7 @@ Page({ | @@ -95,6 +90,7 @@ Page({ | ||
95 | let info; | 90 | let info; |
96 | //如果选择了非运费券,促销不选择 | 91 | //如果选择了非运费券,促销不选择 |
97 | let promotion_id = this.data.promotionTips.promotionIds; | 92 | let promotion_id = this.data.promotionTips.promotionIds; |
93 | + //判断优惠劵的类型 | ||
98 | if (codeType !== 110){ | 94 | if (codeType !== 110){ |
99 | promotion_id = ''; | 95 | promotion_id = ''; |
100 | } | 96 | } |
@@ -120,13 +116,7 @@ Page({ | @@ -120,13 +116,7 @@ Page({ | ||
120 | }); | 116 | }); |
121 | } | 117 | } |
122 | 118 | ||
123 | -console.log('data==='); | ||
124 | -console.log(this.data) | ||
125 | - console.log('params') | ||
126 | - console.log(params) | ||
127 | info = await api.orderCompute(params, () => wx.hideLoading()); | 119 | info = await api.orderCompute(params, () => wx.hideLoading()); |
128 | - console.log('info') | ||
129 | - console.log(info) | ||
130 | } | 120 | } |
131 | } catch(e) {} | 121 | } catch(e) {} |
132 | 122 | ||
@@ -183,15 +173,7 @@ console.log(this.data) | @@ -183,15 +173,7 @@ console.log(this.data) | ||
183 | } | 173 | } |
184 | } | 174 | } |
185 | 175 | ||
186 | - console.log('data'); | ||
187 | - console.log(data); | ||
188 | - | ||
189 | - | ||
190 | // await api.orderSelectCoupon(this.data.skup, () => wx.hideLoading()).then(data => { | 176 | // await api.orderSelectCoupon(this.data.skup, () => wx.hideLoading()).then(data => { |
191 | - | ||
192 | - // let coupons = data || []; | ||
193 | - // console.log('===coupons===='); | ||
194 | - // console.log(coupons); | ||
195 | // this.setData(coupons) | 177 | // this.setData(coupons) |
196 | // }); | 178 | // }); |
197 | let that = this; | 179 | let that = this; |
@@ -202,17 +184,11 @@ console.log(this.data) | @@ -202,17 +184,11 @@ console.log(this.data) | ||
202 | let selected = item.selected; | 184 | let selected = item.selected; |
203 | if (selected === 'Y'){ | 185 | if (selected === 'Y'){ |
204 | item.isChosen = true; | 186 | item.isChosen = true; |
205 | - // selectCouponCode = item.code; | ||
206 | - // that.setData({ | ||
207 | - // selectCouponCode | ||
208 | - // }) | 187 | + data.selectCouponAmount = item.coupon_value_str; |
209 | }else { | 188 | }else { |
210 | item.isChosen = false; | 189 | item.isChosen = false; |
211 | } | 190 | } |
212 | - // coupons.push(item); | ||
213 | }); | 191 | }); |
214 | - // data.couponList = coupons; | ||
215 | - // data.selectCouponCode = selectCouponCode; | ||
216 | } | 192 | } |
217 | 193 | ||
218 | if (data.good && data.good.goodImg) { | 194 | if (data.good && data.good.goodImg) { |
-
Please register or login to post a comment