parent
6562b0baab
commit
2800719615
@ -1,133 +1,136 @@
|
|||||||
// 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
|
||||||
} from '../../../../Gdata'
|
} from '../../../../Gdata'
|
||||||
Page({
|
Page({
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 页面的初始数据
|
* 页面的初始数据
|
||||||
*/
|
*/
|
||||||
data: {
|
data: {
|
||||||
active: 0
|
active: 0
|
||||||
},
|
},
|
||||||
ex(e) {
|
ex(e) {
|
||||||
let token = getApp().globalData.token
|
if (login_check(1)) {
|
||||||
let uid = getApp().globalData.uid
|
let token = getApp().globalData.token
|
||||||
let url = ["/api/v1/coupon-exchange", "/api/v1/wenhui-exchange", "/api/v1/card-exchange"]
|
let uid = getApp().globalData.uid
|
||||||
if(e.currentTarget.dataset.index == 2){
|
let url = ["/api/v1/coupon-exchange", "/api/v1/wenhui-exchange", "/api/v1/card-exchange"]
|
||||||
wx.request({
|
if (e.currentTarget.dataset.index == 2) {
|
||||||
url: host + url[e.currentTarget.dataset.index],
|
wx.request({
|
||||||
data: {
|
url: host + url[e.currentTarget.dataset.index],
|
||||||
card_sn: this.data.code
|
data: {
|
||||||
},
|
card_sn: this.data.code
|
||||||
method: "post",
|
},
|
||||||
header: {
|
method: "post",
|
||||||
'token': token,
|
header: {
|
||||||
'uid': uid
|
'token': token,
|
||||||
},
|
'uid': uid
|
||||||
success: res => {
|
},
|
||||||
if (200 == res.data.status) {
|
success: res => {
|
||||||
this.setData({code:null})
|
if (200 == res.data.status) {
|
||||||
wx.showToast({
|
this.setData({ code: null })
|
||||||
title: "兑换成功",
|
wx.showToast({
|
||||||
icon: "success",
|
title: "兑换成功",
|
||||||
duration: 2000
|
icon: "success",
|
||||||
})
|
duration: 2000
|
||||||
} else {
|
})
|
||||||
wx.showToast({
|
} else {
|
||||||
title: "兑换码错误",
|
wx.showToast({
|
||||||
icon: 'error',
|
title: "兑换码错误",
|
||||||
duration: 2000
|
icon: 'error',
|
||||||
})
|
duration: 2000
|
||||||
}
|
})
|
||||||
}
|
}
|
||||||
})
|
}
|
||||||
}else{
|
})
|
||||||
wx.request({
|
} else {
|
||||||
url: host + url[e.currentTarget.dataset.index],
|
wx.request({
|
||||||
data: {
|
url: host + url[e.currentTarget.dataset.index],
|
||||||
coupon_sn: this.data.code
|
data: {
|
||||||
},
|
coupon_sn: this.data.code
|
||||||
method: "post",
|
},
|
||||||
header: {
|
method: "post",
|
||||||
'token': token,
|
header: {
|
||||||
'uid': uid
|
'token': token,
|
||||||
},
|
'uid': uid
|
||||||
success: res => {
|
},
|
||||||
if (200 == res.data.status) {
|
success: res => {
|
||||||
this.setData({code:null})
|
if (200 == res.data.status) {
|
||||||
wx.showToast({
|
this.setData({ code: null })
|
||||||
title: "兑换成功",
|
wx.showToast({
|
||||||
icon: "success",
|
title: "兑换成功",
|
||||||
duration: 2000
|
icon: "success",
|
||||||
})
|
duration: 2000
|
||||||
} else {
|
})
|
||||||
wx.showToast({
|
} else {
|
||||||
title: "兑换码错误",
|
wx.showToast({
|
||||||
icon: 'error',
|
title: "兑换码错误",
|
||||||
duration: 2000
|
icon: 'error',
|
||||||
})
|
duration: 2000
|
||||||
}
|
})
|
||||||
}
|
}
|
||||||
})
|
}
|
||||||
}
|
})
|
||||||
},
|
}
|
||||||
/**
|
}
|
||||||
* 生命周期函数--监听页面加载
|
},
|
||||||
*/
|
/**
|
||||||
onLoad: function (options) {
|
* 生命周期函数--监听页面加载
|
||||||
|
*/
|
||||||
|
onLoad: function (options) {
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 生命周期函数--监听页面初次渲染完成
|
* 生命周期函数--监听页面初次渲染完成
|
||||||
*/
|
*/
|
||||||
onReady: function () {
|
onReady: function () {
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 生命周期函数--监听页面显示
|
* 生命周期函数--监听页面显示
|
||||||
*/
|
*/
|
||||||
onShow: function () {
|
onShow: function () {
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 生命周期函数--监听页面隐藏
|
* 生命周期函数--监听页面隐藏
|
||||||
*/
|
*/
|
||||||
onHide: function () {
|
onHide: function () {
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 生命周期函数--监听页面卸载
|
* 生命周期函数--监听页面卸载
|
||||||
*/
|
*/
|
||||||
onUnload: function () {
|
onUnload: function () {
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 页面相关事件处理函数--监听用户下拉动作
|
* 页面相关事件处理函数--监听用户下拉动作
|
||||||
*/
|
*/
|
||||||
onPullDownRefresh: function () {
|
onPullDownRefresh: function () {
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 页面上拉触底事件的处理函数
|
* 页面上拉触底事件的处理函数
|
||||||
*/
|
*/
|
||||||
onReachBottom: function () {
|
onReachBottom: function () {
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户点击右上角分享
|
* 用户点击右上角分享
|
||||||
*/
|
*/
|
||||||
onShareAppMessage: function () {
|
onShareAppMessage: function () {
|
||||||
|
|
||||||
}
|
}
|
||||||
})
|
})
|
Loading…
Reference in new issue