Authored by huangyi

gift完成picker对接

@@ -129,22 +129,7 @@ Component({ @@ -129,22 +129,7 @@ Component({
129 }, 129 },
130 130
131 bindPlus() { 131 bindPlus() {
132 - if (!this.data.colorSelected) {  
133 - if (this.data.pickerData.view.goodsList.length) {  
134 - this.data.pickerData.view.goodsList.map((value, index, array) => {  
135 - if (value.selected) {  
136 - this.setData({colorSelected: true})  
137 - }  
138 - })  
139 - } else {  
140 - this.triggerEvent('errorToast', {  
141 - title: '请选择颜色',  
142 - titleClassName: 'wetoast-title',  
143 - duration: 1000  
144 - })  
145 - return;  
146 - }  
147 - } 132 + this.checkColor();
148 133
149 if (!this.data.selectedSKU) { 134 if (!this.data.selectedSKU) {
150 this.triggerEvent('errorToast', { 135 this.triggerEvent('errorToast', {
@@ -184,13 +169,34 @@ Component({ @@ -184,13 +169,34 @@ Component({
184 this.setData({pickerData}); 169 this.setData({pickerData});
185 }, 170 },
186 goPayment() { 171 goPayment() {
  172 + this.checkColor();
187 this.triggerEvent('goPayment', this.data) 173 this.triggerEvent('goPayment', this.data)
188 }, 174 },
189 addShopCart() { 175 addShopCart() {
  176 + this.checkColor();
190 this.triggerEvent('addShopCart', this.data) 177 this.triggerEvent('addShopCart', this.data)
191 }, 178 },
192 chooseSizeColorCompleted() { 179 chooseSizeColorCompleted() {
  180 + this.checkColor();
193 this.triggerEvent('chooseSizeColorCompleted', this.data) 181 this.triggerEvent('chooseSizeColorCompleted', this.data)
  182 + },
  183 + checkColor() {
  184 + if (!this.data.colorSelected) {
  185 + if (this.data.pickerData.view.goodsList.length) {
  186 + this.data.pickerData.view.goodsList.map((value, index, array) => {
  187 + if (value.selected) {
  188 + this.setData({colorSelected: true})
  189 + }
  190 + })
  191 + } else {
  192 + this.triggerEvent('errorToast', {
  193 + title: '请选择颜色',
  194 + titleClassName: 'wetoast-title',
  195 + duration: 1000
  196 + })
  197 + return;
  198 + }
  199 + }
194 } 200 }
195 } 201 }
196 }) 202 })
@@ -220,7 +220,7 @@ Page(extend({}, Actionsheet, { @@ -220,7 +220,7 @@ Page(extend({}, Actionsheet, {
220 }, 220 },
221 221
222 onShareAppMessage: function (res) { 222 onShareAppMessage: function (res) {
223 - var that = this 223 + var that = this;
224 224
225 let param = { 225 let param = {
226 FROM: res.from, 226 FROM: res.from,
@@ -353,7 +353,6 @@ Page(extend({}, Actionsheet, { @@ -353,7 +353,6 @@ Page(extend({}, Actionsheet, {
353 353
354 // 立即支付 354 // 立即支付
355 goPayment: function (event) { 355 goPayment: function (event) {
356 - console.log(event.detail)  
357 this.setData(event.detail); 356 this.setData(event.detail);
358 // console.log('######') 357 // console.log('######')
359 if (this.data.isLimitBuy == true || this.data.is_deposit_advance == "Y" || this.data.is_secKill == "Y" || this.data.is_advance == "Y" || this.data.bundle_type == 2 || this.data.store_show_status === 3 || this.data.store_show_status === 4) { 358 if (this.data.isLimitBuy == true || this.data.is_deposit_advance == "Y" || this.data.is_secKill == "Y" || this.data.is_advance == "Y" || this.data.bundle_type == 2 || this.data.store_show_status === 3 || this.data.store_show_status === 4) {
@@ -415,7 +414,6 @@ Page(extend({}, Actionsheet, { @@ -415,7 +414,6 @@ Page(extend({}, Actionsheet, {
415 }, 414 },
416 415
417 goShoppingCart: function () { 416 goShoppingCart: function () {
418 - debugger  
419 tt.switchTab({ 417 tt.switchTab({
420 url: '/pages/shopCart/shopCart' 418 url: '/pages/shopCart/shopCart'
421 }) 419 })
@@ -435,7 +433,7 @@ Page(extend({}, Actionsheet, { @@ -435,7 +433,7 @@ Page(extend({}, Actionsheet, {
435 }; 433 };
436 434
437 that2.showLoadingToast() 435 that2.showLoadingToast()
438 - api.get({data: param}).then(function (data) { 436 + api.get({data: param}).then((data)=> {
439 that2.hideLoadingToast() 437 that2.hideLoadingToast()
440 this.setData({pickerShow: false}) 438 this.setData({pickerShow: false})
441 439