feat 兑换优惠券添加验证登录

develop
GJW200011 4 years ago
parent 6562b0baab
commit 2800719615

@ -67,7 +67,7 @@
bindplay="bindPlayCallBack" id="video_{{index}}" /></block>
</block>
</scroll-view>
<view class="roll" bindtap="stage_click">查看更多</view>
<view class="roll" bindtap="stage_click" wx:if="{{!show_detail.wonderful_list.length<=0}}">查看更多</view>
</view>

@ -1,133 +1,136 @@
// pages/user/discount/discount_ex/discount_ex.js
import {
http
http,
login_check
} from '../../../../utils/util'
import {
host
} from '../../../../Gdata'
Page({
/**
* 页面的初始数据
*/
data: {
active: 0
},
ex(e) {
let token = getApp().globalData.token
let uid = getApp().globalData.uid
let url = ["/api/v1/coupon-exchange", "/api/v1/wenhui-exchange", "/api/v1/card-exchange"]
if(e.currentTarget.dataset.index == 2){
wx.request({
url: host + url[e.currentTarget.dataset.index],
data: {
card_sn: this.data.code
},
method: "post",
header: {
'token': token,
'uid': uid
},
success: res => {
if (200 == res.data.status) {
this.setData({code:null})
wx.showToast({
title: "兑换成功",
icon: "success",
duration: 2000
})
} else {
wx.showToast({
title: "兑换码错误",
icon: 'error',
duration: 2000
})
}
/**
* 页面的初始数据
*/
data: {
active: 0
},
ex(e) {
if (login_check(1)) {
let token = getApp().globalData.token
let uid = getApp().globalData.uid
let url = ["/api/v1/coupon-exchange", "/api/v1/wenhui-exchange", "/api/v1/card-exchange"]
if (e.currentTarget.dataset.index == 2) {
wx.request({
url: host + url[e.currentTarget.dataset.index],
data: {
card_sn: this.data.code
},
method: "post",
header: {
'token': token,
'uid': uid
},
success: res => {
if (200 == res.data.status) {
this.setData({ code: null })
wx.showToast({
title: "兑换成功",
icon: "success",
duration: 2000
})
} else {
wx.showToast({
title: "兑换码错误",
icon: 'error',
duration: 2000
})
}
})
}else{
wx.request({
url: host + url[e.currentTarget.dataset.index],
data: {
coupon_sn: this.data.code
},
method: "post",
header: {
'token': token,
'uid': uid
},
success: res => {
if (200 == res.data.status) {
this.setData({code:null})
wx.showToast({
title: "兑换成功",
icon: "success",
duration: 2000
})
} else {
wx.showToast({
title: "兑换码错误",
icon: 'error',
duration: 2000
})
}
}
})
} else {
wx.request({
url: host + url[e.currentTarget.dataset.index],
data: {
coupon_sn: this.data.code
},
method: "post",
header: {
'token': token,
'uid': uid
},
success: res => {
if (200 == res.data.status) {
this.setData({ code: null })
wx.showToast({
title: "兑换成功",
icon: "success",
duration: 2000
})
} else {
wx.showToast({
title: "兑换码错误",
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 () {
}
})
}
})

@ -6,7 +6,7 @@
"setting": {
"urlCheck": false,
"es6": true,
"enhance": false,
"enhance": true,
"postcss": true,
"preloadBackgroundData": false,
"minified": true,
@ -30,6 +30,7 @@
"outputPath": ""
},
"enableEngineNative": false,
"bundle": false,
"useIsolateContext": true,
"useCompilerModule": true,
"userConfirmedUseCompilerModuleSwitch": false,
@ -39,7 +40,7 @@
"minifyWXSS": true
},
"compileType": "miniprogram",
"libVersion": "2.20.0",
"libVersion": "2.21.0",
"appid": "wx35bc60d481961c1d",
"projectname": "miniprogram2",
"debugOptions": {

Loading…
Cancel
Save