npm install weixin-js-sdk
第二步:新建一个js文件夹(这里用的是npm下载的包)
const wx = require('jweixin-module');
export const wexinPay = (data, oderid, type) => {
wx.config({
debug: false,
appId: data.appId,
timestamp: data.timeStamp,
nonceStr: data.nonceStr,
signature: data.paySign,
jsApiList: ['chooseWXPay']
});
wx.ready(function() {
wx.chooseWXPay({
timestamp: data.timeStamp,//这个字段是为字符串后端返回时需检查
nonceStr: data.nonceStr,
package: data.packageStr,
signType: 'RSA',
paySign: da