uniapp/pages_rush/futures/payment.js

73 lines
1.5 KiB
JavaScript

export default {
data() {
return {
isIphoneX: false,
orderCreateData: {
buyer_message: '',
futures_id: '',
},
orderPaymentData: {},
isSub: false,
tempData: null,
canLocalDelicery: true,
// 选择自提、配送防重判断
judge:true,
goodsOpen: true,
min:1,
modifyFlag: false,
};
},
methods: {
// 订单创建
orderCreate() {
if (this.verify()) {
if (this.isSub) return;
this.isSub = true;
var data = this.$util.deepClone(this.orderCreateData);
let _this=this;
this.$api.sendRequest({
url: '/futures/api/ordercreate/create',
data,
success: res => {
uni.hideLoading();
if (res.code >= 0) {
uni.showModal({
title: '秒杀成功请及时付款',
content: res.message,
cancelText: '继续抢购',
confirmText: '去付款',
success: res => {
if (res.confirm) {
_this.$util.redirectTo('/pages_rush/futures/order', {status: 'all'});
}else{
_this.$util.redirectTo('/pages_rush/futures/seckill');
}
}
})
} else {
this.isSub = false;
this.$util.showToast({
title: res.message
});
}
},
fail: res => {
uni.hideLoading();
this.isSub = false;
}
})
}
},
// 订单验证
verify() {
return true;
}
},
filters: {
// 金额格式化输出
moneyFormat(money) {
return parseFloat(money).toFixed(2);
}
}
}