标签:llb return UNC rom toast param res function sign
export function chooseWXPay(params: wx.ChooseWXPayConfig) {
return new Promise<{
status: ‘success‘ | ‘error‘ | ‘cancel‘;
result?: string;
message?: string;
[key: string]: any;
}>((resolve, reject) => {
if (!store.state.jssdk || !store.state.jssdk.jssdkReady) {
Toast(`微信支付加载失败`);
return;
}
wx.chooseWXPay({
timestamp: params.timestamp,
nonceStr: params.nonceStr,
package: params.package,
signType: params.signType,
paySign: params.paySign,
// 支付成功后的回调函数
success: (res: WeixinJSSDKCallbackParams) => {
if (res.errMsg === ‘chooseWXPay:ok‘) {
resolve({ // 支付成功
status: ‘success‘,
});
} else if (res.errMsg === ‘chooseWXPay:cancel‘) {
resolve({ // 支付成功
status: ‘cancel‘,
});
} else {
resolve({
status: ‘error‘,
result: res.errMsg,
message: res.errMsg,
});
}
},
cancel: () => {
resolve({ // 支付成功
status: ‘cancel‘,
});
},
fail: (res: WeixinJSSDKCallbackParams) => {
resolve({
status: ‘error‘,
result: res.errMsg,
message: res.errMsg,
});
},
});
});
}
标签:llb return UNC rom toast param res function sign
原文地址:https://www.cnblogs.com/zhangly/p/14932109.html