微信支付封装
/**
* timeStamp {Str} 时间戳
* nonceStr {Str} 随机字符串
* package {Str} 统一下单接口返回的 prepay_id 参数值
* signType {Str} 签名算法
* paySign {Str} 签名
* successFun {Fun} 成功回调
* failFun {Fun} 失败回调
* completeFun {Fun} 结束回调
* */
function wx_pay(timeStamp, nonceStr, pack, signType, paySign, sucfun=null, failfun = null, compfun = null) => {
uni.requestPayment({
provider: 'wxpay',
orderInfo: "orderInfo",
timeStamp: timeStamp,
nonceStr: nonceStr,
package: pack,
signType: signType,
paySign: paySign,
success(res) {
sucfun(res)
},
fail(err) {
if (failfun) {
failfun(err)
}
},
complete(result) {
if (compfun) {
compfun(result)
}
}
});
}
网友评论