123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191 |
- // pages/exchange/exchange.js
- import { documentList } from "../../api/document"
- import { userEntityRecharge } from '../../api/charge'
- import { appGetConfigImg } from '../../api/index'
- const app = getApp()
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- cardNo: '',
- cardSecret: '',
- imgUrl: '',
- overlayShow: false,
- chargestatus: 0,
- chargetext: ''
- },
- 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
- var that = this
- console.log(cardNo, cardSecret);
- if (cardNo == '') {
- wx.showToast({
- title: '请输入卡号',
- icon: 'error'
- })
- return
- } else if (cardSecret == '') {
- wx.showToast({
- title: '请输入卡密',
- icon: 'error'
- })
- return
- } else {
- var data = {
- // CARD202010221647 GBISYX
- cardNo: cardNo,
- cardSecret: cardSecret
- }
- wx.showLoading({
- title: '充值中...',
- mask: true
- })
- userEntityRecharge(data).then(res => {
- wx.hideLoading()
- that.setData({
- overlayShow: true,
- chargestatus: 0,
- chargetext: res.msg
- })
- }).catch(e => {
- console.log('é',e)
- wx.hideLoading()
- that.setData({
- chargestatus: 1,
- chargetext: e,
- overlayShow: true
- })
- })
- }
- },
- bindCardNo(e) {
- this.setData({
- cardNo: e.detail.value
- })
- },
- bindCardPwd(e) {
- this.setData({
- cardSecret: e.detail.value
- })
- },
- /**
- * 生命周期函数--监听页面卸载
- */
- handleCancle() {
- wx.navigateBack()
- },
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- reInput() {
- this.setData({
- overlayShow: false
- })
- },
- // 立即预约
- handleAppointment () {
- this.setData({
- overlayShow: false
- })
- if (app.globalData.hasAppointment) {
- wx.showModal({
- content: '您预约的健康筛查还未体验,请先体验',
- cancelColor: '#666',
- cancelText: '取消',
- confirmText: '我的预约',
- confirmColor: '#333',
- success (res) {
- if (res.confirm) {
- wx.navigateTo({
- url: '/pages/myAppointment/myAppointment',
- })
- }
- }
- })
- } else {
- this.getDocumentList()
- }
- },
- // 获取用户档案信息
- getDocumentList () {
- var that = this
- wx.showLoading({
- title: '加载中...',
- mask: true
- })
- documentList({
- currentPage: 1
- }).then(res => {
- wx.hideLoading()
- const response = res.data.vos || []
- if (response.length == 0) {
- wx.showModal({
- content: '预约用户前需要先添加检测人员信息',
- cancelColor: '#666',
- confirmColor: '#333',
- success (res) {
- if (res.confirm) {
- wx.navigateTo({
- url: '/pages/createFile/createFile?from=index'
- })
- }
- }
- })
- } else {
- wx.navigateTo({
- url: '/pages/appointment/appointment'
- })
- }
- }).catch(e => {
- wx.hideLoading()
- wx.showModal({
- content: e,
- confirmColor: '#333',
- showCancel: false
- })
- })
- },
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom() {
- },
- /**
- * 用户点击右上角分享
- */
- onShareAppMessage() {
- }
- })
|