const $ = global; new $.Page({ onLoad() { }, toPay() { $.request('reward', 'POST', {}).then((res) => { const { timestamp, paySign, nonceStr } = res.msg; const pck = res.msg.package; wx.requestPayment({ timeStamp: timestamp + '', nonceStr, package: pck, signType: 'MD5', paySign, success(res) { $.wx.showToast({ title: '多谢打赏!' }); }, fail() { $.wx.showToast({ title: '打赏失败' }); } }); }); } });