comment 7.2
This commit is contained in:
@@ -205,9 +205,14 @@ export default {
|
||||
})
|
||||
},
|
||||
intermediate() {
|
||||
if(this.orderType == 2) this.withImmediate();
|
||||
if(this.orderType == 2) {
|
||||
this.withImmediate();
|
||||
} else if(this.orderType == 1) {
|
||||
this.sendOrder(0);
|
||||
}
|
||||
else this.sendOrder(1);
|
||||
},
|
||||
// @params {Number} ifcart 是否是购物车商品
|
||||
sendOrder(ifcart) {
|
||||
// 拼接后端需要的数据形式
|
||||
let id = [], temp = '';
|
||||
@@ -241,11 +246,11 @@ export default {
|
||||
cart_id: id,
|
||||
address_id: this.addressInfo.address_id,
|
||||
buy_city_id: this.addressInfo.city_id,
|
||||
voucher_id: coupon,
|
||||
}
|
||||
if(coupon.length) Object.assign(params, { voucher_id: coupon });
|
||||
if(this.orderType == 2) {
|
||||
Object.assign(params, { pintuan_id: this.orderInfo.pintuan_id })
|
||||
if(this.orderInfo.pintuangroup_id) Object.assign(params, { pintuangroup_id: this.orderInfo.pintuangroup_id })
|
||||
Object.assign(params, { pintuan_id: this.orderInfo.pintuan_id });
|
||||
if(this.orderInfo.pintuangroup_id) Object.assign(params, { pintuangroup_id: this.orderInfo.pintuangroup_id });
|
||||
}
|
||||
// console.log(params);
|
||||
this.$u.api.sendOrder(params).then(res => {
|
||||
|
||||
@@ -54,24 +54,10 @@ export default {
|
||||
// getProvider() {
|
||||
// uni.getProvider({service: 'payment'})
|
||||
// },
|
||||
// 支付宝支付
|
||||
payByAlipay (orderInfo) {
|
||||
payOrder(provider, orderInfo) {
|
||||
uni.requestPayment({
|
||||
provider: 'alipay',
|
||||
orderInfo: orderInfo, //支付宝订单数据
|
||||
success: function (res) {
|
||||
console.log('success:' + JSON.stringify(res));
|
||||
},
|
||||
fail: function (err) {
|
||||
console.log('fail:' + JSON.stringify(err));
|
||||
}
|
||||
});
|
||||
},
|
||||
// 微信支付
|
||||
payByWxpay (orderInfo) {
|
||||
uni.requestPayment({
|
||||
provider: 'wxpay',
|
||||
orderInfo: orderInfo, //微信订单数据
|
||||
provider: provider,
|
||||
orderInfo: orderInfo, //订单数据
|
||||
success: function (res) {
|
||||
console.log('success:' + JSON.stringify(res));
|
||||
},
|
||||
@@ -86,11 +72,15 @@ export default {
|
||||
payment_code: this.pay_way,
|
||||
}).then(res => {
|
||||
if(res.errCode == 0) {
|
||||
// this.$u.toast(res.message);
|
||||
// uni.navigateBack();
|
||||
const orderInfo = JSON.parse(res.data.content);
|
||||
console.log(orderInfo);
|
||||
this.pay_way == 'wxpay_app' ? this.payByWxpay(orderInfo) : this.payByAlipay(orderInfo);
|
||||
let orderInfo, provider;
|
||||
if(res.data.payment_code == 'wxpay_app') {
|
||||
provider = 'wxpay';
|
||||
orderInfo = JSON.parse(res.data.content);
|
||||
} else if(res.data.payment_code == 'alipay_app') {
|
||||
provider = 'alipay';
|
||||
orderInfo = res.data.content;
|
||||
}
|
||||
this.payOrder(provider, orderInfo);
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user