123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100 |
- // pages/user/walletDetails/walletDetails.js
- import Date from '../../../utils/util.js'
- import APIClient from '../../../utils/APIClient.js'
- Page({
- data: {
- buyBtnText: '立即激活',
- price: '29',
- originPrice: '99',
- productId: 0,
- modalType: 'image',
- isModalShow: false,
- isCloseShow: false,
- modalText: [],
- closeCallBack: false
- },
- onLoad: function (options) {
- if (options.title) {
- wx.setNavigationBarTitle({
- title: '激活码激活'
- });
- }
- },
- activeVIP() {
- console.log(11111, this.data.code)
- APIClient.postActiveCode(this.data.code).success(res => {
- switch (res.data.code) {
- case 200:
- this.setData({
- isModalShow: true,
- modalText: [{
- text: '激活成功!',
- type: 'bigOrange'
- },
- {
- text: '您已获得一年VIP权限',
- type: 'bigOrange'
- }
- ],
- closeCallBack: 'index'
- })
- break;
- case 531:
- // 激活码已经用过了
- this.setData({
- isModalShow: true,
- modalText: [{
- text: '激活失败!',
- type: 'bigOrange'
- },
- {
- text: '验证码已经使用过了',
- type: 'bigOrange'
- }
- ]
- })
- break;
- case 404:
- //激活码不存在
- this.setData({
- isModalShow: true,
- modalText: [{
- text: '激活失败!',
- type: 'bigOrange'
- },
- {
- text: '验证码错误',
- type: 'bigOrange'
- }
- ]
- })
- break;
- default:
- break;
- }
- }).fail(err => {
- console.log(err);
- });
- },
- saveValue(e) {
- console.log(e)
- this.setData({
- code: e.detail.value
- });
- },
- modalConfirmHandler() {
- this.setData({
- isModalShow: false
- })
- if (this.data.closeCallBack === 'index') {
- wx.redirectTo({
- url: `/pages/index/index`
- })
- }
- },
- })
|