|
@@ -34,6 +34,9 @@ import {
|
|
|
OPENID
|
|
|
} from '@/config/cache';
|
|
|
import Cache from '@/utils/cache';
|
|
|
+import {
|
|
|
+ postJsapiPay
|
|
|
+} from '@/api/home.js';
|
|
|
import {
|
|
|
orderPay
|
|
|
} from '@/api/order.js';
|
|
@@ -133,35 +136,24 @@ export default {
|
|
|
complete: () => { }
|
|
|
});
|
|
|
}
|
|
|
- orderPay({
|
|
|
+ postJsapiPay({
|
|
|
openId: Cache.get(OPENID),
|
|
|
- orderId: that.order_id,
|
|
|
- client: "WX_MINI",
|
|
|
- paytype: paytype,
|
|
|
- type: that.friendPay ? 1 : 0,
|
|
|
- // #ifdef MP
|
|
|
- 'from': 'routine',
|
|
|
- // #endif
|
|
|
+ outTradeNo: that.order_id,
|
|
|
}).then(res => {
|
|
|
- let jsConfig = res.data.result.jsConfig;
|
|
|
switch (paytype) {
|
|
|
case 'weixin':
|
|
|
- if (res.data.result === undefined) return that.$util.Tips({
|
|
|
+ if (res.data === undefined) return that.$util.Tips({
|
|
|
title: that.$t(`缺少支付参数`)
|
|
|
});
|
|
|
// #ifdef MP
|
|
|
- let mp_pay_name = ''
|
|
|
- if (uni.requestOrderPayment) {
|
|
|
- mp_pay_name = 'requestOrderPayment'
|
|
|
- } else {
|
|
|
- mp_pay_name = 'requestPayment'
|
|
|
- }
|
|
|
+ let mp_pay_name = 'requestPayment'
|
|
|
uni[mp_pay_name]({
|
|
|
- timeStamp: jsConfig.timestamp,
|
|
|
- nonceStr: jsConfig.nonceStr,
|
|
|
- package: jsConfig.package,
|
|
|
- signType: jsConfig.signType,
|
|
|
- paySign: jsConfig.paySign,
|
|
|
+ provider: 'wxpay',
|
|
|
+ timeStamp: res.data.timestamp + '',
|
|
|
+ nonceStr: res.data.noncestr,
|
|
|
+ package: res.data.prepayid,
|
|
|
+ signType: 'MD5',
|
|
|
+ paySign: res.data.sign,
|
|
|
success: function (res) {
|
|
|
uni.hideLoading();
|
|
|
return that.$util.Tips({
|