Authored by huangyi

跳转支付页面

... ... @@ -4,6 +4,10 @@ Component({
pickerData: {
type: Object,
value: null,
observer: function (value) {
if (!value.sourceType)
this.setData({pickerData: value})
}
},
isloadingForPayment: {
type: Boolean,
... ... @@ -17,10 +21,10 @@ Component({
}
}
},
data: {_show: false},
data: {_show: false, colorSelected: false, storageNumber: 0, selectedSKU: '', pickerData: null},
methods: {
colorTap(event) {
var that = this
var that = this;
var tempData = that.data.pickerData;
//先遍历将所有颜色、尺码置为未选中状态
// console.log('color')
... ... @@ -56,12 +60,12 @@ Component({
tempData.view.minusButtonEnable = false
//将购买数量设为初始状态
tempData.view.buyNumber = 1
this.triggerEvent('colorTap', {colorSelected, tempData})
tempData.view.buyNumber = 1;
this.setData({pickerData: tempData, colorSelected});
},
sizeTap(event) {
var that = this
var that = this;
var tempData = that.data.pickerData
//现遍历将所有尺码置为未选中状态
... ... @@ -89,35 +93,92 @@ Component({
tempData.view.buyButtonEnable = false
}
this.triggerEvent('sizeTap', {tempData, tempItem})
this.setData({
pickerData: tempData,
storageNumber: tempItem.storage_number,
selectedSKU: tempItem.storage_number > 0 ? tempItem.product_sku : 0
});
},
show() {
this.setData({_show: true});
this.triggerEvent('showChange')
this.triggerEvent('showChange');
},
hide(event) {
if (event.target.id === "picker-bg") {
this.setData({_show: true})
this.triggerEvent('showChange')
this.setData({_show: true});
this.triggerEvent('showChange');
}
},
bindMinus(event) {
this.triggerEvent('bindMinus', {pickerData: this.data.pickerData})
},
bindMinus() {
let pickerData = this.data.pickerData;
let buyNumber = parseInt(pickerData.view.buyNumber);
if (buyNumber > 1) {
buyNumber = buyNumber - 1;
}
pickerData.view.buyNumber = buyNumber;
bindPlus(event) {
this.triggerEvent('bindPlus', {pickerData: this.data.pickerData})
},
if (buyNumber === 1) {
pickerData.view.minusButtonEnable = false;
} else {
pickerData.view.minusButtonEnable = true;
}
goPayment() {
this.triggerEvent('goPayment')
if (buyNumber < this.data.storageNumber) {
pickerData.view.plusButtonEnable = true;
}
this.setData({pickerData});
},
catchtouchmove() {
this.triggerEvent('catchtouchmove')
bindPlus() {
if (!this.data.colorSelected) {
this.wetoast.toast({
title: '请选择颜色',
titleClassName: 'wetoast-title',
duration: 1000
});
return;
}
if (!this.data.selectedSKU) {
this.wetoast.toast({
title: '请选择尺码',
titleClassName: 'wetoast-title',
duration: 1000
});
return;
}
let pickerData = this.data.pickerData;
let buyNumber = pickerData.view.buyNumber;
if (buyNumber >= this.data.storageNumber) {
this.plusReachedMaxAction();
return;
}
if (buyNumber < this.data.storageNumber) {
pickerData.view.plusButtonEnable = true;
buyNumber = parseInt(buyNumber) + 1;
}
if (buyNumber >= this.data.storageNumber) {
pickerData.view.plusButtonEnable = false;
}
if (buyNumber > 1) {
pickerData.view.minusButtonEnable = true;
}
pickerData.view.buyNumber = buyNumber;
this.setData({pickerData});
},
goPayment() {
this.triggerEvent('goPayment', this.data)
},
addShopCart() {
this.triggerEvent('addShopCart')
this.triggerEvent('addShopCart', this.data)
}
}
})
\ No newline at end of file
... ...
... ... @@ -351,74 +351,6 @@ Page(extend({}, Actionsheet, {
}
},
//减少购买数量
bindMinus: function (event) {
let pickerData = event.detail.pickerData;
let buyNumber = parseInt(pickerData.view.buyNumber);
if (buyNumber > 1) {
buyNumber = buyNumber - 1;
}
pickerData.view.buyNumber = buyNumber;
if (buyNumber == 1) {
pickerData.view.minusButtonEnable = false;
} else {
pickerData.view.minusButtonEnable = true;
}
if (buyNumber < this.data.storageNumber) {
pickerData.view.plusButtonEnable = true;
}
this.setData({pickerData});
},
//增加购买数量
bindPlus: function (event) {
if (!this.data.colorSelected) {
this.wetoast.toast({
title: '请选择颜色',
titleClassName: 'wetoast-title',
duration: 1000
});
return;
}
if (!this.data.selectedSKU) {
this.wetoast.toast({
title: '请选择尺码',
titleClassName: 'wetoast-title',
duration: 1000
});
return;
}
let pickerData = event.detail.pickerData
let buyNumber = pickerData.view.buyNumber;
if (buyNumber >= this.data.storageNumber) {
this.plusReachedMaxAction();
return;
}
if (buyNumber < this.data.storageNumber) {
pickerData.view.plusButtonEnable = true;
buyNumber = parseInt(buyNumber) + 1;
}
if (buyNumber >= this.data.storageNumber) {
pickerData.view.plusButtonEnable = false;
}
if (buyNumber > 1) {
pickerData.view.minusButtonEnable = true;
}
pickerData.view.buyNumber = buyNumber;
this.setData({pickerData});
},
plusReachedMaxAction: function () {
this.wetoast.toast({
title: '对不起,没有更多库存了',
... ... @@ -429,6 +361,8 @@ Page(extend({}, Actionsheet, {
// 立即支付
goPayment: function (event) {
console.log(event.detail)
this.setData(event.detail);
// console.log('######')
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) {
this.wetoast.toast({
... ... @@ -581,33 +515,6 @@ Page(extend({}, Actionsheet, {
});
},
//点击背景,隐藏picker
pickerTap: function (event) {
if (event.target.id == "picker-bg") {
var that = this
this.setData({pickerShow: false})
}
},
//点击选择颜色
colorTap: function (event) {
//更新各个颜色的选中状态
let {tempData, colorSelected} = event.detail
this.setData({
colorSelected,
pickerData: tempData,
});
},
//点击选择尺码
sizeTap: function (event) {
let {tempData, tempItem} = event.detail
this.setData({
pickerData: tempData,
selectedSKU: tempItem.storage_number > 0 ? tempItem.product_sku : 0,
storageNumber: tempItem.storage_number,
});
},
//获取商品基本信息(包括颜色、尺码)
fetchGoodInfo: function () {
... ... @@ -939,9 +846,6 @@ Page(extend({}, Actionsheet, {
tt.hideToast()
},
catchtouchmove: function (event) {
},
hideModalTapped: function () {
hideModal(this);
... ...
... ... @@ -251,12 +251,7 @@
<picker id="picker"
pickerData="{{pickerData}}" isloadingForPayment="{{isloadingForPayment}}"
pickerShow="{{pickerShow}}"
bind:colorTap="colorTap"
bind:sizeTap="sizeTap"
bind:bindMinus="bindMinus"
bind:bindPlus="bindPlus"
bind:goPayment="goPayment"
bind:catchtouchmove="catchtouchmove"
bind:showChange="showChange"
></picker>
... ...