【物理應用】基於matlab GUI三相配電網實時模擬【含Matlab原始碼 1047期】
阿新 • • 發佈:2021-06-21
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, }); }, }); }); }