Commit c477155cae7830afc2676339eb717e3e4ac89b76
1 parent
52fb28a2
活动未开始的提示语优化
Showing
2 changed files
with
57 additions
and
15 deletions
packageA/pages/quan_pro/quan_pro.js
... | ... | @@ -2,7 +2,7 @@ var t = require("../../../utils/util.js"), ut = t, |
2 | 2 | e = require("../../../utils/common.js"), |
3 | 3 | oo = getApp().globalData, |
4 | 4 | os = getApp().globalData.setting; |
5 | - var utils = require('../../../utils/util.js'),ut=utils; | |
5 | + | |
6 | 6 | |
7 | 7 | Page({ |
8 | 8 | data: { |
... | ... | @@ -44,23 +44,59 @@ Page({ |
44 | 44 | }, |
45 | 45 | |
46 | 46 | //---展示,显示券的信息--- |
47 | - onShow: function() { | |
47 | + onShow:async function() { | |
48 | 48 | |
49 | 49 | //检查能不能分享 |
50 | 50 | getApp().check_can_share(); |
51 | - | |
52 | 51 | var th=this; |
53 | - var user_id=getApp().globalData.user_id; | |
54 | - getApp().request.promiseGet("/api/weshop/prom/coupon/pageCouponList", { | |
55 | - data:{store_id:os.stoid,type:1,id:th.data.id,user_id:user_id} | |
56 | - }).then(res => { | |
57 | - th.setData({is_get:1}); | |
58 | - if(res.data.code==0 && res.data.data && res.data.data.pageData && res.data.data.pageData.length){ | |
59 | - th.setData({q_data:res.data.data.pageData[0]}); | |
60 | - } | |
61 | - }); | |
62 | - | |
63 | 52 | th.setData({getcurday:ut.gettimestamp()}); |
53 | + | |
54 | + var rs=await getApp().request.promiseGet("/api/weshop/prom/coupon/get/"+th.data.id, {}) | |
55 | + if(!rs){ | |
56 | + th.setData({is_get:1}); | |
57 | + return false; | |
58 | + } | |
59 | + if(rs.data.code!=0){ | |
60 | + th.setData({is_get:1}); | |
61 | + return false; | |
62 | + } | |
63 | + var r_data=rs.data.data; | |
64 | + if(r_data.store_id!=os.stoid){ | |
65 | + th.setData({is_get:1}); | |
66 | + return false; | |
67 | + } | |
68 | + if(r_data.type!=1){ | |
69 | + th.setData({is_get:2}); | |
70 | + return false; | |
71 | + } | |
72 | + | |
73 | + var now=ut.gettimestamp(); | |
74 | + | |
75 | + if(r_data.send_start_time>now){ | |
76 | + th.setData({is_get:3}); | |
77 | + return false; | |
78 | + } | |
79 | + | |
80 | + if(r_data.send_end_time<now){ | |
81 | + th.setData({is_get:4}); | |
82 | + return false; | |
83 | + } | |
84 | + | |
85 | + th.setData({is_get:1}); | |
86 | + th.setData({ q_data:r_data }); | |
87 | + | |
88 | + | |
89 | + // var user_id=getApp().globalData.user_id; | |
90 | + // await getApp().request.promiseGet("/api/weshop/prom/coupon/pageCouponList", { | |
91 | + // data:{store_id:os.stoid,type:1,id:th.data.id,user_id:user_id} | |
92 | + // }).then(res => { | |
93 | + // th.setData({is_get:1}); | |
94 | + // if(res.data.code==0 && res.data.data && res.data.data.pageData && res.data.data.pageData.length){ | |
95 | + // th.setData({q_data:res.data.data.pageData[0]}); | |
96 | + // } | |
97 | + // }); | |
98 | + | |
99 | + | |
64 | 100 | }, |
65 | 101 | |
66 | 102 | onHide: function() { | ... | ... |
packageA/pages/quan_pro/quan_pro.wxml
... | ... | @@ -11,7 +11,10 @@ |
11 | 11 | <view> |
12 | 12 | <image style="width: 70rpx; height: 70rpx; vertical-align: middle; margin-right: 20rpx" src="{{iurl}}/miniapp/images/coupon_img/coupon_logo.png"></image> |
13 | 13 | <text wx:if="{{q_data}}">{{q_data.name}}</text> |
14 | - <text wx:elif="{{is_get}}" class="fs28">不存在此微券或数量已领取完</text> | |
14 | + <text wx:elif="{{is_get==1}}" class="fs28">不存在此微券或数量已领取完</text> | |
15 | + <text wx:elif="{{is_get==2}}" class="fs28">该优惠券不是免费发放类型</text> | |
16 | + <text wx:elif="{{is_get==3}}" class="fs28">活动未开始暂时无法发放优惠券</text> | |
17 | + <text wx:elif="{{is_get==4}}" class="fs28">优惠券已过期</text> | |
15 | 18 | </view> |
16 | 19 | <view class="fs30 flex" wx:if="{{q_data}}" style="height: 100rpx;justify-content: space-between;"> |
17 | 20 | <view class="flex ai-center"> |
... | ... | @@ -45,7 +48,10 @@ |
45 | 48 | </block> |
46 | 49 | |
47 | 50 | <view wx:elif="{{is_get}}" class="fs28" style="text-align: center;color: #999;position: absolute;bottom: 20rpx;"> |
48 | - 不存在此微券或数量已领取完 | |
51 | + <text wx:if="{{is_get==1}}">不存在此微券或数量已领取完</text> | |
52 | + <text wx:if="{{is_get==2}}">该优惠券不是免费发放类型</text> | |
53 | + <text wx:if="{{is_get==3}}">活动未开始暂时无法发放优惠券</text> | |
54 | + <text wx:if="{{is_get==4}}">优惠券已过期</text> | |
49 | 55 | </view> |
50 | 56 | |
51 | 57 | </view> | ... | ... |