// #ifdef H5 import weixin from "jweixin-module"; class Wechath5 { // 支付 wxPay(opt) { return new Promise((reslove, reject) => { weixin.ready(() => { weixin.chooseWXPay({ timestamp: opt.timeStamp, // 支付签名时间戳,注意微信jssdk中的所有使用timestamp字段均为小写。但最新版的支付后台生成签名使用的timeStamp字段名需大写其中的S字符 nonceStr: opt.nonceStr, // 支付签名随机串,不长于 32 位 package: opt.package, // 统一支付接口返回的prepay_id参数值,提交格式如:prepay_id=***) signType: opt.signType, // 签名方式,默认为'SHA1',使用新版支付需传入'MD5' paySign: opt.paySign, // 支付签名 success: (res) => { reslove('success') }, cancel: (res) => { reslove('fail') }, fail: (res) => { reslove('fail') }, }); }); }) } } export default new Wechath5() // #endif