小程序支付:
**wxml**
<text class="submit" @click="payment">去付款</text>
**js**
payment: function(res) {
uni.requestPayment({
provider: 'wxpay', // 写死的
timeStamp: res.data.data.timestamp, // 后端给的
nonceStr: res.data.data.nonceStr, // 后端给的
package: res.data.data.package, // 后端给的
signType: 'MD5', // 写死的
paySign: res.data.data.paySign, // 后端给的
success: resPay => {
// 支付成功 跳页面
uni.reLaunch({
url: '../order/order?state=0'
});
},
fail: err => {
// 支付失败 跳页面
console.log(err);
uni.showToast({
title: res.data.msg,
icon: 'none',
success: function() {
uni.reLaunch({
url: '../order/order?state=0'
});
}
});
}
});
},
H5支付:
**wxml **
<view @cli