|
@@ -7,6 +7,37 @@ Page({
|
|
|
const { route } = e.currentTarget.dataset;
|
|
|
if (route) wx.navigateTo({ url: `/pages/${route}` });
|
|
|
},
|
|
|
+ // 重置
|
|
|
+ async toMoney() {
|
|
|
+ let obj = {
|
|
|
+ openid: 'oH0y05UqPfQYt7eBWGMzhkfDwMMA',
|
|
|
+ money: 0.1,
|
|
|
+ school_id: '6355f251cb0f85380e83520b',
|
|
|
+ student_id: '635629fecb0f85380e8354e5'
|
|
|
+ }
|
|
|
+ let res = await app.$post(`/payOrder/toCharge`, obj);
|
|
|
+ if (res.errcode == '0') {
|
|
|
+ // 调取支付窗口
|
|
|
+ let wxSign = res.data.wxSign;
|
|
|
+ console.log(wxSign);
|
|
|
+ wx.requestPayment({
|
|
|
+ timeStamp: wxSign.timestamp,
|
|
|
+ nonceStr: wxSign.nonceStr,
|
|
|
+ package: `prepay_id=${wxSign.prepay_id}`,
|
|
|
+ signType: wxSign.signType,
|
|
|
+ paySign: wxSign.paySign,
|
|
|
+ async success(payRes) {
|
|
|
+ console.log('充值成功');
|
|
|
+ },
|
|
|
+ async fail(payErr) {
|
|
|
+ console.log(payErr);
|
|
|
+ wx.showToast({ title: '充值不成功', icon: 'none' })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ wx.showToast({ title: res.errmsg, icon: 'none' })
|
|
|
+ }
|
|
|
+ },
|
|
|
/**
|
|
|
* 生命周期函数--监听页面加载
|
|
|
*/
|
|
@@ -17,7 +48,7 @@ Page({
|
|
|
wx.getStorage({
|
|
|
key: 'user',
|
|
|
success: async res => {
|
|
|
- if (res.data) wx.redirectTo({ url: '/pages/school/index' })
|
|
|
+ // if (res.data) wx.redirectTo({ url: '/pages/school/index' })
|
|
|
// /pages/school/index
|
|
|
// /pagesSchool/common/lessoninfo
|
|
|
// /pagesSchool/schAdmin/course/coachlist
|