Browse Source

支付测试

dev_delivery
jiazhipeng 4 days ago
parent
commit
50c0d3efb7
  1. 94
      subPackages/order/orderPay.vue

94
subPackages/order/orderPay.vue

@ -223,46 +223,66 @@
title: '加载中'
})
if(this.payType == 1) {
// uni.request({
// method: 'POST',
// url: "/api/api/order/pay",
// header: {
// 'content-type': 'application/json',
// 'token': "35cda449-d338-46d8-b95a-20a19bd1e58f"
// },
// data: {
// order_id: "46022510201010554631",
// pay_method: "ICBC_WECHAT",
// pay_platform: "JSAPI",
// return_url: "https://m.cloud.sz-trip.com/OrderWaiting",
// token: "35cda449-d338-46d8-b95a-20a19bd1e58f"
// },
// success: (resTwo) => {
// let resObj = {}
// try {
// resObj = JSON.parse(resTwo)
// } catch(e) {}
// WeixinJSBridge.invoke('getBrandWCPayRequest', {
// "appId": resObj.appId || resObj.appid, //ID
// "timeStamp": resObj.timeStamp || resObj.timestamp, //1970
// "nonceStr": resObj.nonceStr || resObj.noncestr, //
// "package": resObj.package,
// "signType": resObj.signType, //
// "paySign": resObj.paySign|| resObj.sign, //
// },
// function(res) {
// console.log(res)
// });
// }
// })
// return
//
uni.request({
method: 'POST',
url: this.JDSZAPIURL + '/api/order/pay',
header: {
'content-type': 'application/json',
'token': this.token
},
data: {
order_id: this.id,
pay_method: "WEIXIN",
pay_platform: "MINI",
app_name: "WxXcxConfig"
},
success: res => {
uni.hideLoading()
if (res.data.code == 1) {
let data = JSON.parse(res.data.data)
uni.requestPayment({
nonceStr: data.nonceStr || data.noncestr,
package: data.package,
paySign: data.paySign || data.sign,
signType: data.signType,
timeStamp: "" + (data.timeStamp || data.timestamp),
complete: function(res) {
// setTimeout(() => {
// uni.redirectTo({
// url: '/subPackages/order/trades'
// })
// }, 1000)
}
});
} else {
uni.showToast({
title:res.data.msg,
icon:'none'
})
}
this.Post({
order_id: this.id,
code: "",
pay_method: "ICBC_WECHAT",
pay_platform: "JSAPI",
return_url: "https://" + window.location.host + "/OrderWaiting",
}, "/api/order/pay").then(resTwo => {
let resObj = {}
try {
resObj = JSON.parse(resTwo)
} catch(e) {}
WeixinJSBridge.invoke('getBrandWCPayRequest', {
"appId": resObj.appId || resObj.appid, //ID
"timeStamp": resObj.timeStamp || resObj.timestamp, //1970
"nonceStr": resObj.nonceStr || resObj.noncestr, //
"package": resObj.package,
"signType": resObj.signType, //
"paySign": resObj.paySign|| resObj.sign, //
},
function(res) {
// that.$router.push('/OrderWaiting')
});
})
}else if(this.payType == 2) {
//
uni.request({

Loading…
Cancel
Save