|
@@ -13,14 +13,21 @@ Page({
|
|
|
lock: false,
|
|
|
noResult: false,
|
|
|
noMore: false,
|
|
|
+ noCoupon: false,
|
|
|
+ noDetail: false,
|
|
|
+ noUtility: false,
|
|
|
isLogin: false,
|
|
|
- hidden1: false,
|
|
|
- hidden2: false,
|
|
|
+ hiddenCoupon: false,
|
|
|
+ hiddenDetail: false,
|
|
|
+ hiddenUtility: false,
|
|
|
mobileTop: 'TONY WU',
|
|
|
couponNum: 0,
|
|
|
productNum: 0,
|
|
|
activityId: 1,
|
|
|
- couponList: []
|
|
|
+ couponList: [],
|
|
|
+ detailList: [],
|
|
|
+ stateList: [],
|
|
|
+ notUseNum: 0
|
|
|
|
|
|
},
|
|
|
|
|
@@ -33,14 +40,22 @@ Page({
|
|
|
})
|
|
|
if(this.data.isLogin){
|
|
|
this.setData({
|
|
|
- hidden1: false,
|
|
|
- hidden2: true,
|
|
|
+ hiddenCoupon: false,
|
|
|
+ hiddenDetail: true,
|
|
|
+ hiddenUtility: true,
|
|
|
+ noCoupon: true,
|
|
|
+ noDetail: false,
|
|
|
+ noUtility: false,
|
|
|
})
|
|
|
this.getUserAwardCouponList();
|
|
|
+ this.getUserAwardCouponNum();
|
|
|
+ this.getUserSignInList();
|
|
|
+ this.getCouponStateList();
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
+ // 优惠券数据
|
|
|
getUserAwardCouponList: function() {
|
|
|
SignIn.getUserAwardCouponList({
|
|
|
page: this.data.page,
|
|
@@ -88,17 +103,191 @@ Page({
|
|
|
})
|
|
|
},
|
|
|
|
|
|
+ //未使用的券数量
|
|
|
+ getUserAwardCouponNum: function() {
|
|
|
+ SignIn.getUserAwardCouponNum({
|
|
|
+ page: this.data.page,
|
|
|
+ pageSize: this.data.pageSize,
|
|
|
+ mobile: "16602120168",
|
|
|
+ activityId: this.data.activityId
|
|
|
+ }).then(res => {
|
|
|
+ if (res.code == 200) {
|
|
|
+ this.setData({
|
|
|
+ notUseNum: res.data.notUseNum
|
|
|
+ })
|
|
|
+ }
|
|
|
+ this.data.lock = false
|
|
|
+ }).catch(_ => {
|
|
|
+ console.log(_)
|
|
|
+ this.data.lock = false
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
+ // 签到明细
|
|
|
+ getUserSignInList: function() {
|
|
|
+ SignIn.getUserSignInList({
|
|
|
+ page: this.data.page,
|
|
|
+ pageSize: this.data.pageSize,
|
|
|
+ mobile: "16602120168",
|
|
|
+ activityId: this.data.activityId
|
|
|
+ }).then(res => {
|
|
|
+ if (res.code == 200) {
|
|
|
+ this.userDetailListView(res.data)
|
|
|
+ }
|
|
|
+ this.data.lock = false
|
|
|
+ }).catch(_ => {
|
|
|
+ console.log(_)
|
|
|
+ this.data.lock = false
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
+ userDetailListView: function(data) {
|
|
|
+ if (!Array.isArray(data) || data.length == 0) {
|
|
|
+ console.log("获取明细数据为空");
|
|
|
+ if (this.data.page == 1) {
|
|
|
+ this.setData({
|
|
|
+ mobileTop:getMobileCache(),
|
|
|
+ noResult: true
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ this.setData({
|
|
|
+ mobileTop:getMobileCache(),
|
|
|
+ noMore: true
|
|
|
+ })
|
|
|
+ }
|
|
|
+ return
|
|
|
+ }
|
|
|
+ data.forEach(v => {
|
|
|
+ let crateTime = v.crateTime
|
|
|
+ v.crateTime = parseTime(crateTime, "{y}-{m}-{d} {h}:{i}")
|
|
|
+ })
|
|
|
+
|
|
|
+ this.data.detailList = this.data.detailList.concat(...data)
|
|
|
+ this.setData({
|
|
|
+ mobileTop:getMobileCache(),
|
|
|
+ detailList: this.data.detailList
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
+ // 使用失效
|
|
|
+ getCouponStateList: function() {
|
|
|
+ SignIn.getUserAwardCouponUseStateList({
|
|
|
+ page: this.data.page,
|
|
|
+ pageSize: this.data.pageSize,
|
|
|
+ mobile: "16602120168",
|
|
|
+ activityId: this.data.activityId
|
|
|
+ }).then(res => {
|
|
|
+ if (res.code == 200) {
|
|
|
+ this.userStateListView(res.data)
|
|
|
+ }
|
|
|
+ this.data.lock = false
|
|
|
+ }).catch(_ => {
|
|
|
+ console.log(_)
|
|
|
+ this.data.lock = false
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
+ userStateListView: function(data) {
|
|
|
+ if (!Array.isArray(data) || data.length == 0) {
|
|
|
+ console.log("使用失效数据为空");
|
|
|
+ if (this.data.page == 1) {
|
|
|
+ this.setData({
|
|
|
+ mobileTop:getMobileCache(),
|
|
|
+ noResult: true
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ this.setData({
|
|
|
+ mobileTop:getMobileCache(),
|
|
|
+ noMore: true
|
|
|
+ })
|
|
|
+ }
|
|
|
+ return
|
|
|
+ }
|
|
|
+ data.forEach(v => {
|
|
|
+ let crateTime = v.crateTime
|
|
|
+ v.crateTime = parseTime(crateTime, "{y}-{m}-{d} {h}:{i}")
|
|
|
+ })
|
|
|
+
|
|
|
+ this.data.stateList = this.data.stateList.concat(...data)
|
|
|
+ this.setData({
|
|
|
+ mobileTop:getMobileCache(),
|
|
|
+ stateList: this.data.stateList
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
// 授权手机号
|
|
|
getPhoneNumber(e) {
|
|
|
getPhoneNumberSync(e, _ => {
|
|
|
this.setData({
|
|
|
isLogin: true,
|
|
|
mobileTop: getMobileCache(),
|
|
|
- hidden1: false,
|
|
|
- hidden2: true,
|
|
|
+ // hidden1: false,
|
|
|
+ // hidden2: true,
|
|
|
})
|
|
|
- this.getUserAwardCouponList()
|
|
|
+ this.getUserAwardCouponList();
|
|
|
+ this.getUserAwardCouponNum();
|
|
|
+ this.getUserSignInList();
|
|
|
+ this.getCouponStateList();
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
+ // 优惠券
|
|
|
+ getCoupon(e) {
|
|
|
+ this.setData({
|
|
|
+ hiddenCoupon: false,
|
|
|
+ hiddenDetail: true,
|
|
|
+ hiddenUtility: true,
|
|
|
+ page: 1,
|
|
|
+ goodsType: 1,
|
|
|
+ noMore: false,
|
|
|
+ noResult: false,
|
|
|
+ noCoupon: true,
|
|
|
+ noDetail: false,
|
|
|
+ noUtility: false,
|
|
|
+ })
|
|
|
+ this.data.couponList= [],
|
|
|
+ this.data.detailList= [],
|
|
|
+ this.data.stateList= [],
|
|
|
+ this.getUserAwardCouponList()
|
|
|
+ },
|
|
|
+ //明细
|
|
|
+ getDetail(e) {
|
|
|
+ this.setData({
|
|
|
+ hiddenCoupon: true,
|
|
|
+ hiddenDetail: false,
|
|
|
+ hiddenUtility: true,
|
|
|
+ page: 1,
|
|
|
+ goodsType: 2,
|
|
|
+ noMore: false,
|
|
|
+ noResult: false,
|
|
|
+ noDetail: true,
|
|
|
+ noCoupon: false,
|
|
|
+ noUtility: false,
|
|
|
+ })
|
|
|
+ this.data.couponList= [],
|
|
|
+ this.data.detailList= [],
|
|
|
+ this.data.stateList= [],
|
|
|
+ this.getUserSignInList()
|
|
|
+
|
|
|
+ },
|
|
|
+ //使用失效
|
|
|
+ getUtility(e) {
|
|
|
+ this.setData({
|
|
|
+ hiddenCoupon: true,
|
|
|
+ hiddenDetail: true,
|
|
|
+ hiddenUtility: false,
|
|
|
+ page: 1,
|
|
|
+ goodsType: 2,
|
|
|
+ noMore: false,
|
|
|
+ noResult: false,
|
|
|
+ noUtility: true,
|
|
|
+ noCoupon: false,
|
|
|
+ noDetail: false,
|
|
|
})
|
|
|
+ this.data.couponList= [],
|
|
|
+ this.data.detailList= [],
|
|
|
+ this.data.stateList= [],
|
|
|
+ this.getCouponStateList()
|
|
|
},
|
|
|
|
|
|
/**
|