140 lines
2.3 KiB
JavaScript
140 lines
2.3 KiB
JavaScript
// pages/myWelfare/myWelfare.js
|
|
const app = getApp()
|
|
import {coupon} from "../../../api/personCenter"
|
|
Page({
|
|
|
|
/**
|
|
* 页面的初始数据
|
|
*/
|
|
data: {
|
|
isTriggered:false,
|
|
nouseList: [],
|
|
useList: [],
|
|
expireList: [],
|
|
user_coupon_status:0,
|
|
},
|
|
goIndex() {
|
|
wx.switchTab({
|
|
url: '/pages/index/index',
|
|
})
|
|
},
|
|
handleRefresher(){
|
|
this.setData({
|
|
nouseList: [],
|
|
useList: [],
|
|
expireList: [],
|
|
})
|
|
this.getcoupon();
|
|
},
|
|
getcoupon() {
|
|
let {user_coupon_status}=this.data;
|
|
coupon({
|
|
user_coupon_status
|
|
}).then(data => {
|
|
if (user_coupon_status == 0) {
|
|
this.setData({
|
|
isTriggered:false,
|
|
nouseList: data
|
|
})
|
|
} else if (user_coupon_status == 1) {
|
|
this.setData({
|
|
isTriggered:false,
|
|
useList: data
|
|
})
|
|
} else {
|
|
this.setData({
|
|
isTriggered:false,
|
|
expireList: data
|
|
})
|
|
}
|
|
|
|
})
|
|
},
|
|
/**
|
|
* 生命周期函数--监听页面加载
|
|
*/
|
|
onChange(event) {
|
|
let tabIndex = `${event.detail.index}`
|
|
if(tabIndex==2){
|
|
tabIndex=3
|
|
}
|
|
this.setData({
|
|
nouseList: [],
|
|
useList: [],
|
|
expireList: [],
|
|
user_coupon_status:tabIndex
|
|
})
|
|
this.getcoupon();
|
|
},
|
|
goBack() {
|
|
wx.navigateBack({
|
|
delta: 1,
|
|
})
|
|
},
|
|
onLoad(options) {
|
|
console.log('状态');
|
|
console.log(options.status)
|
|
if(options.status==0){
|
|
this.setData({
|
|
user_coupon_status:0
|
|
})
|
|
}else if(options.status==1){
|
|
this.setData({
|
|
user_coupon_status:1
|
|
})
|
|
}else if(options.status==3){
|
|
this.setData({
|
|
user_coupon_status:3
|
|
})
|
|
}
|
|
this.getcoupon();
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面初次渲染完成
|
|
*/
|
|
onReady() {
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面显示
|
|
*/
|
|
onShow() {
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面隐藏
|
|
*/
|
|
onHide() {
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面卸载
|
|
*/
|
|
onUnload() {
|
|
|
|
},
|
|
|
|
/**
|
|
* 页面相关事件处理函数--监听用户下拉动作
|
|
*/
|
|
onPullDownRefresh() {
|
|
|
|
},
|
|
|
|
/**
|
|
* 页面上拉触底事件的处理函数
|
|
*/
|
|
onReachBottom() {
|
|
|
|
},
|
|
|
|
/**
|
|
* 用户点击右上角分享
|
|
*/
|
|
|
|
}) |