|
|
@@ -65,6 +65,7 @@ |
|
|
|
this.total = options.total; |
|
|
|
this.orderId = options.order_id; |
|
|
|
this.out_trade_no = options.out_trade_no; |
|
|
|
console.log(window.location.href) |
|
|
|
this.getPayType(); |
|
|
|
}, |
|
|
|
methods: { |
|
|
@@ -85,31 +86,31 @@ |
|
|
|
case 2: // 支付宝支付 |
|
|
|
|
|
|
|
break; |
|
|
|
// case 3: // 货到付款 |
|
|
|
// break; |
|
|
|
// case 3: // 货到付款 |
|
|
|
// break; |
|
|
|
} |
|
|
|
}, |
|
|
|
//确认支付 |
|
|
|
async confirm() { |
|
|
|
|
|
|
|
if (this.payType == 1) { |
|
|
|
// #ifdef H5 || APP-PLUS || MP-WEIXIN |
|
|
|
this.weixinPay(); |
|
|
|
// #endif |
|
|
|
} else if (this.payType == 2) { |
|
|
|
// 支付宝支付 |
|
|
|
this.alipay(); |
|
|
|
} |
|
|
|
// if (this.payType == 1) { |
|
|
|
// // #ifdef H5 || APP-PLUS || MP-WEIXIN |
|
|
|
// this.weixinPay(); |
|
|
|
// // #endif |
|
|
|
// } else if (this.payType == 2) { |
|
|
|
// // 支付宝支付 |
|
|
|
// this.alipay(); |
|
|
|
// } |
|
|
|
// else if (this.payType == 3) { |
|
|
|
// // 货到付款 |
|
|
|
// this.offlinePay(); |
|
|
|
this.offlinePay(); |
|
|
|
// } |
|
|
|
}, |
|
|
|
async alipay() { |
|
|
|
|
|
|
|
|
|
|
|
// #ifdef H5 |
|
|
|
window.open(this.$unishow + '/pay/alipay?order_id='+this.orderId); |
|
|
|
|
|
|
|
window.open(this.$unishow + '/pay/alipay?order_id=' + this.orderId); |
|
|
|
|
|
|
|
setTimeout(function() { |
|
|
|
uni.showModal({ |
|
|
|
title: 'Tip', |
|
|
@@ -133,29 +134,29 @@ |
|
|
|
// #endif |
|
|
|
|
|
|
|
// #ifdef APP-PLUS |
|
|
|
let orderInfo = await this.$api.request('/pay/alipay', 'POST',{ |
|
|
|
order_id : this.orderId |
|
|
|
let orderInfo = await this.$api.request('/pay/alipay', 'POST', { |
|
|
|
order_id: this.orderId |
|
|
|
}); |
|
|
|
if (orderInfo) { |
|
|
|
//console.log(orderInfo); |
|
|
|
uni.requestPayment({ |
|
|
|
provider: 'alipay', |
|
|
|
orderInfo: orderInfo, |
|
|
|
success: function (res) { |
|
|
|
success: function(res) { |
|
|
|
console.log('success:' + JSON.stringify(res)); |
|
|
|
uni.redirectTo({ |
|
|
|
url: '/pages/money/paySuccess' |
|
|
|
}) |
|
|
|
}, |
|
|
|
fail: function (err) { |
|
|
|
fail: function(err) { |
|
|
|
console.log('fail:' + JSON.stringify(err)); |
|
|
|
that.$api.msg('支付失败'); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// #endif |
|
|
|
|
|
|
|
|
|
|
|
}, |
|
|
|
async weixinPay() { |
|
|
|
let data = await this.$api.request('/pay/unify', 'GET', { |
|
|
@@ -184,8 +185,8 @@ |
|
|
|
uni.showModal({ |
|
|
|
title: 'Tip', |
|
|
|
content: 'Whether paid?', |
|
|
|
cancelText:'NO', |
|
|
|
confirmText:'Yes', |
|
|
|
cancelText: 'NO', |
|
|
|
confirmText: 'Yes', |
|
|
|
success: function(res) { |
|
|
|
if (res.confirm) { |
|
|
|
uni.redirectTo({ |
|
|
@@ -263,9 +264,7 @@ |
|
|
|
}, |
|
|
|
|
|
|
|
async offlinePay() { |
|
|
|
let data = await this.$api.request('/pay/offline', 'GET', { |
|
|
|
order_id: this.orderId |
|
|
|
}); |
|
|
|
let data = await this.$api.request('/order/addQRCode?url=' + encodeURIComponent(window.location.href), 'GET', ); |
|
|
|
if (data) { |
|
|
|
uni.redirectTo({ |
|
|
|
url: '/pages/money/paySuccess' |
|
|
|