123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- const util = require('../../../utils/util.js')
- const app = getApp()
- Page({
- data: {
- info: {},
- phone: '',
- id: ''
- },
- onLoad: function (options) {
- this.setData({ id: options.id })
- this.getInfo()
- },
- inputChange(e) {
- this.setData({ phone: e.detail.value })
- },
- getInfo() {//现金券领取详情
- let that = this;
- util.ajax({
- func: "v2/voucher/receiveStatus",
- data: { "id": that.data.id },
- load: false
- }, function (res) {
- if (res.code == 0) {
- that.setData({ info: res.data })
- } else {
- util.showTips(res.reason);
- }
- });
- },
- submit() {//成长卡领取
- let that = this;
- if (util.isPhone(this.data.phone)) {
- util.showTips("请输入正确的手机号");
- return false
- }
- util.ajax({
- func: "v2/voucher/receive",
- data: { "phone": that.data.phone, "id": that.data.id },
- }, function (res) {
- if (res.code == 0) {
- wx.navigateTo({
- url: '/pages/account/safe/result?status=' + res.data.status + '&vid=' + res.data.vid + '&articleType=' + that.data.info.articleType
- })
- } else {
- util.showTips(res.reason);
- }
- });
- },
- seeCard() {
- if (app.globalData.userInfo) {
- wx.navigateTo({
- url: '/pages/account/safe/index'
- })
- } else {
- // 静默登录
- util.silentLogin().then(res => {
- wx.navigateTo({
- url: '/pages/account/safe/index'
- })
- })
- }
- }
- })
|