|
|
@ -1,6 +1,7 @@
|
|
|
|
// pages/user/discount/discount_ex/discount_ex.js
|
|
|
|
// pages/user/discount/discount_ex/discount_ex.js
|
|
|
|
import {
|
|
|
|
import {
|
|
|
|
http
|
|
|
|
http,
|
|
|
|
|
|
|
|
login_check
|
|
|
|
} from '../../../../utils/util'
|
|
|
|
} from '../../../../utils/util'
|
|
|
|
import {
|
|
|
|
import {
|
|
|
|
host
|
|
|
|
host
|
|
|
@ -14,10 +15,11 @@ Page({
|
|
|
|
active: 0
|
|
|
|
active: 0
|
|
|
|
},
|
|
|
|
},
|
|
|
|
ex(e) {
|
|
|
|
ex(e) {
|
|
|
|
|
|
|
|
if (login_check(1)) {
|
|
|
|
let token = getApp().globalData.token
|
|
|
|
let token = getApp().globalData.token
|
|
|
|
let uid = getApp().globalData.uid
|
|
|
|
let uid = getApp().globalData.uid
|
|
|
|
let url = ["/api/v1/coupon-exchange", "/api/v1/wenhui-exchange", "/api/v1/card-exchange"]
|
|
|
|
let url = ["/api/v1/coupon-exchange", "/api/v1/wenhui-exchange", "/api/v1/card-exchange"]
|
|
|
|
if(e.currentTarget.dataset.index == 2){
|
|
|
|
if (e.currentTarget.dataset.index == 2) {
|
|
|
|
wx.request({
|
|
|
|
wx.request({
|
|
|
|
url: host + url[e.currentTarget.dataset.index],
|
|
|
|
url: host + url[e.currentTarget.dataset.index],
|
|
|
|
data: {
|
|
|
|
data: {
|
|
|
@ -30,7 +32,7 @@ Page({
|
|
|
|
},
|
|
|
|
},
|
|
|
|
success: res => {
|
|
|
|
success: res => {
|
|
|
|
if (200 == res.data.status) {
|
|
|
|
if (200 == res.data.status) {
|
|
|
|
this.setData({code:null})
|
|
|
|
this.setData({ code: null })
|
|
|
|
wx.showToast({
|
|
|
|
wx.showToast({
|
|
|
|
title: "兑换成功",
|
|
|
|
title: "兑换成功",
|
|
|
|
icon: "success",
|
|
|
|
icon: "success",
|
|
|
@ -45,7 +47,7 @@ Page({
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}else{
|
|
|
|
} else {
|
|
|
|
wx.request({
|
|
|
|
wx.request({
|
|
|
|
url: host + url[e.currentTarget.dataset.index],
|
|
|
|
url: host + url[e.currentTarget.dataset.index],
|
|
|
|
data: {
|
|
|
|
data: {
|
|
|
@ -58,7 +60,7 @@ Page({
|
|
|
|
},
|
|
|
|
},
|
|
|
|
success: res => {
|
|
|
|
success: res => {
|
|
|
|
if (200 == res.data.status) {
|
|
|
|
if (200 == res.data.status) {
|
|
|
|
this.setData({code:null})
|
|
|
|
this.setData({ code: null })
|
|
|
|
wx.showToast({
|
|
|
|
wx.showToast({
|
|
|
|
title: "兑换成功",
|
|
|
|
title: "兑换成功",
|
|
|
|
icon: "success",
|
|
|
|
icon: "success",
|
|
|
@ -74,6 +76,7 @@ Page({
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 生命周期函数--监听页面加载
|
|
|
|
* 生命周期函数--监听页面加载
|
|
|
@ -130,4 +133,4 @@ Page({
|
|
|
|
onShareAppMessage: function () {
|
|
|
|
onShareAppMessage: function () {
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
})
|