123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118 |
- // pages/exchange/exchange.js
- import { userEntityRecharge } from '../../api/charge'
- import { appGetConfigImg } from '../../api/index'
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- cardNo: '',
- cardSecret: '',
- imgUrl: ''
- },
- onShow () {
- this.appGetConfigImgFn()
- },
- appGetConfigImgFn () {
- const that = this
- wx.showNavigationBarLoading()
- appGetConfigImg({
- 'imgType': '4'
- }).then(configRes => {
- wx.hideNavigationBarLoading()
- console.log(configRes, 'configRes')
- that.setData({
- imgUrl: configRes.data[0].imgUrl
- })
- })
- },
- /**
- * 确认提交充值
- */
- handleComfirm() {
- var cardNo = this.data.cardNo
- var cardSecret = this.data.cardSecret
- console.log(cardNo, cardSecret);
- if (cardNo == '') {
- wx.showToast({
- title: '请输入卡号',
- icon: 'error'
- })
- return
- } else if (cardSecret == '') {
- wx.showToast({
- title: '请输入卡密',
- icon: 'error'
- })
- return
- } else {
- var data = {
- cardNo: cardNo,
- cardSecret: cardSecret
- }
- wx.showLoading({
- title: '充值中...',
- mask: true
- })
- userEntityRecharge(data).then(res => {
- wx.hideLoading()
- w.showToast({
- title: '充值成功',
- icon: 'success'
- })
- }).catch(e => {
- wx.hideLoading()
- wx.showModal({
- content: e,
- confirmColor: '#333',
- showCancel: false
- })
- })
- }
- },
- bindCardNo(e) {
- this.setData({
- cardNo: e.detail.value
- })
- },
- bindCardPwd(e) {
- this.setData({
- cardSecret: e.detail.value
- })
- },
- /**
- * 生命周期函数--监听页面卸载
- */
- handleCancle() {
- wx.navigateBack()
- },
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh() {
- },
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom() {
- },
- /**
- * 用户点击右上角分享
- */
- onShareAppMessage() {
- }
- })
|