123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125 |
- // pages/joinFee/joinFee.js
- import userApi from '../../api/user'
- const app = getApp();
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- },
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad: async function (options) {
-
- },
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady: function () {
- },
- /**
- * 生命周期函数--监听页面显示
- */
- onShow: async function () {
-
- },
- /**
- * 生命周期函数--监听页面隐藏
- */
- onHide: function () {
- },
- /**
- * 生命周期函数--监听页面卸载
- */
- onUnload: function () {
- },
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh: function () {
- },
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom: function () {
- },
- bindMoney(e) {
- let money = e.detail.value
- this.setData({
- money
- })
- },
- async rechargeMoney(e) {
- const self = this
- let money = e.currentTarget.dataset.money
- console.log()
- if (!money) {
- money = self.data.money
- } else {
- self.setData({
- money
- })
- money = self.data.money
- }
- if (!money) {
- wx.showModal({
- content: '请选择充值的金额',
- title:'提示'
- })
- return
- }
- const confimObj = await wx.showModal({
- content: `您确定要充值${money}元?`,
- title:'提示'
- })
- //没同意
- if (!confimObj.confirm) {
- return
- }
- let data = {
- recharge: money
- }
- const rs = await userApi.recharge(data)
- let orderId = rs.orderId;
- wx.requestPayment({
- timeStamp: rs.timeStamp,
- nonceStr: rs.nonceStr,
- package: rs.package,
- signType: rs.signType,
- paySign: rs.paySign,
- success (res) {
- wx.showModal({
- content: `充值成功`,
- title:'提示'
- }).then(() => {
- wx.switchTab({
- url: '/pages/person/person',
- })
- })
- },
- fail (res) {
-
- }
- })
- }
- })
|