123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130 |
- // pages/welfareMall/exchangeCode/exchangeCode.js
- import WelfareMall from '../../../api/welfareMall'
- import {getMobileCache, getPhoneNumber as getPhoneNumberSync, getColor} from '../../../utils/user'
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- config: {},
- sn: '',
- querySn: '',
- hideWindowValue: false,
- },
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad(options) {
- },
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady() {
- },
- /**
- * 生命周期函数--监听页面显示
- */
- onShow: async function() {
- let info = await getColor();
- this.setData({
- config:info.config,
- })
- },
- /**
- * 生命周期函数--监听页面隐藏
- */
- onHide() {
- },
- /**
- * 生命周期函数--监听页面卸载
- */
- onUnload() {
- },
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh() {
- },
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom() {
- },
- /**
- * 用户点击右上角分享
- */
- onShareAppMessage() {
- },
- bindText: function (e) {
- var text = e.detail.value;
- this.setData({
- sn: text,
- })
- },
- /**
- * 弹框
- */
- hideWindow(){
- this.setData({
- hideWindowValue:true
- })
- },
- goPerson(){
- wx.switchTab({
- url: '../personal/personal'
- })
- },
- /**
- * 确认
- */
- toConfirm: function() {
- if(this.data.sn == null || this.data.sn == '' || this.data.sn == undefined){
- wx.showToast({
- title: '兑换码必填',
- icon: 'none',
- duration: 1500
- })
- return
- }
- WelfareMall.exchangeCoupon({
- mobile: getMobileCache(),
- sn: this.data.sn,
- }).then(res => {
- // if (res.code == 200) {
- // wx.showToast({
- // title: this.data.sn + '券码兑换成功',
- // icon: 'none',
- // duration: 1500
- // })
- // this.setData({
- // querySn: '',
- // })
- // }
- if (res.code == 200) {
- this.hideWindow()
- }
- }).catch(_ => {
- console.log(_)
- })
- },
- })
|