Commit 03a94c601bf8d7b10a92436870d48547e5a20807

Authored by 后端研发-苏泰源
1 parent 5415949c

商品详情点击促销中的专享礼包跳转到专享礼包详情页

pages/giftpack/giftpacklist/giftpacklist.js
... ... @@ -75,7 +75,7 @@ Page({
75 75 })
76 76 },
77 77 init(){
78   - let options = this.data?.params;
  78 + let options = this.data?.params; // this.data == null ? undefined:this.data.params
79 79 var th = this;
80 80 this.setData({
81 81 getUserID: d.user_id,
... ... @@ -85,6 +85,7 @@ Page({
85 85 isBuy: options.isBuy,
86 86 getGiftID: options.lbId,
87 87 orderSn: options.orderSn,
  88 + flag: options.flag, // 如果从商品详情页的促销处点击专享礼包跳转到此页,则flag为1
88 89 })
89 90 if (options.lbId) th.data.lbId = options.lbId;
90 91 //-- 获取分享人的ID --
... ... @@ -103,11 +104,17 @@ Page({
103 104 })
104 105 }
105 106 th.close();
106   - if (this.data.isBuy == 0) {
107   - this.GetMyGiftList();
108   - } else {
109   - this.GetBuyGiftList();
110   - }
  107 +
  108 +
  109 + if(this.data.flag == 1) {
  110 + this.getZxlbDetails();
  111 + } else {
  112 + if (this.data.isBuy == 0) {
  113 + this.GetMyGiftList();
  114 + } else if (this.data.isBuy == 1) {
  115 + this.GetBuyGiftList();
  116 + };
  117 + };
111 118 },
112 119  
113 120 onShow: function () {
... ... @@ -329,6 +336,84 @@ Page({
329 336 });
330 337  
331 338 },
  339 +
  340 + getZxlbDetails: function () {
  341 +
  342 + var th = this;
  343 + getApp().request.get('/api/weshop/marketing/giftbag/detail/getNew', {
  344 + isShowLoading: true,
  345 + data: {
  346 + "storeId": a.stoid, //商家ID
  347 + //"userId": d.user_id, //用户ID
  348 + "giftBagId": th.data.lbId
  349 + },
  350 + success: function (res) {
  351 + if (res.data.code == 0) {
  352 + th.setData({
  353 + giftImage: th.data.iurl + res.data.data.lbUrl,
  354 + giftTitle: res.data.data.lbTitle,
  355 + default_color: res.data.data.bgcolor
  356 + })
  357 + if (res.data.data.lbIntro == '') {
  358 + th.setData({
  359 + giftRemark: '暂无详情......'
  360 + })
  361 + } else {
  362 + th.setData({
  363 + giftRemark: res.data.data.lbIntro.replace(/\<img/gi, '<img style="max-width:100%;height:auto;display:block"')
  364 + })
  365 + }
  366 +
  367 + //---获取日期的时间戳---
  368 + let exchangeType = res.data.data.exchangeType;
  369 + let exchangeDay = res.data.data.exchangeDay;
  370 + let exchangeStartTime = res.data.data.exchangeStartTime;
  371 + let exchangeEndTime = res.data.data.exchangeEndTime;
  372 + // let t_endtime;
  373 +
  374 + if(exchangeType == 2) {
  375 + if(exchangeStartTime == 0 || !exchangeStartTime) {
  376 + exchangeStartTime = ut.gettimestamp();
  377 + };
  378 + exchangeStartTime = ut.formatTime(exchangeStartTime, 0);
  379 + exchangeEndTime = ut.formatTime(exchangeEndTime, 0);
  380 + }
  381 +
  382 +
  383 + th.setData({
  384 + // giftDate: t_endtime,
  385 + giftPosPrice: res.data.data.oldPrice,
  386 + giftQty: res.data.data.lbNum,
  387 + giftIntegral: res.data.data.exchangeIntegral,
  388 + giftPrice: res.data.data.lbPrice,
  389 + giftType: res.data.data.actType,
  390 + actTitle: res.data.data.actTitle,
  391 + wareCard: res.data.data.wareCard,
  392 + lbId: res.data.data.lbId,
  393 + exchangeType: exchangeType,
  394 + exchangeDay: exchangeDay,
  395 + exchangeStartTime: exchangeStartTime,
  396 + exchangeEndTime: exchangeEndTime,
  397 + })
  398 + //判断是否有礼包
  399 + for (var i = 0; i < res.data.data.wareCard.length; i++) {
  400 + if (res.data.data.wareCard[i].lbType == 1) {
  401 + th.setData({
  402 + is_lb: 1
  403 + })
  404 + break;
  405 + }
  406 + }
  407 + } else {
  408 + getApp().my_warnning(res.data.msg, 0, th);
  409 + return false;
  410 + }
  411 + }
  412 + });
  413 +
  414 + },
  415 +
  416 +
332 417 //显示核销码
333 418 code_show: function (e) {
334 419 var th = this;
... ...
pages/giftpack/giftpacklist/giftpacklist.wxml
... ... @@ -6,20 +6,28 @@
6 6 <view class="top_title data-v-3a5b7e36">
7 7 <text class="data-v-3a5b7e36 ellipsis-2">{{giftTitle}}</text>
8 8 </view>
9   - <view class="top_time data-v-3a5b7e36">
10   - <block wx:if="{{isBuy==1 && giftTitle && isStart!=1}}" >
11   - <text class="data-v-3a5b7e36">
12   - {{"活动开始时间:"+giftStart}}
13   - </text>
14   - </block>
15   - <block wx:else>
16   - <text class="data-v-3a5b7e36" wx:if="{{isBuy==0}}">{{"兑换结束时间:"+giftDate}}</text>
17   - <text class="data-v-3a5b7e36" wx:else>
18   - {{"活动结束时间:"+giftDate}}
19   - </text>
20   - </block>
21   -
  9 + <view class="top_time data-v-3a5b7e36" wx:if="{{!flag}}">
  10 + <block wx:if="{{isBuy==1 && giftTitle && isStart!=1}}" >
  11 + <text class="data-v-3a5b7e36">
  12 + {{"活动开始时间:"+giftStart}}
  13 + </text>
  14 + </block>
  15 + <block wx:else>
  16 + <text class="data-v-3a5b7e36" wx:if="{{isBuy==0}}">{{"兑换结束时间:"+giftDate}}</text>
  17 + <text class="data-v-3a5b7e36" wx:else>
  18 + {{"活动结束时间:"+giftDate}}
  19 + </text>
  20 + </block>
  21 + </view>
  22 + <view class="top_time data-v-3a5b7e36" wx:if="{{flag == 1}}">
  23 + <text class="data-v-3a5b7e36" wx:if="{{exchangeType == 1}}">
  24 + {{"兑换时间:领取后"+exchangeDay+"天内兑换"}}
  25 + </text>
  26 + <text class="data-v-3a5b7e36" wx:elif="{{exchangeType == 2}}">
  27 + {{"兑换时间:"+exchangeStartTime+"至"+exchangeEndTime}}
  28 + </text>
22 29 </view>
  30 +
23 31 <view class="top_price data-v-3a5b7e36">
24 32 <block wx:if="{{giftPrice>0}}">
25 33 <text class="data-v-3a5b7e36">{{"¥"+giftPrice}}</text>
... ... @@ -39,7 +47,8 @@
39 47 <text class="data-v-3a5b7e36">{{"零售价:"+giftPosPrice+"元"}}</text>
40 48 </view>
41 49 <view class="top_foot_qty data-v-3a5b7e36">
42   - <text class="data-v-3a5b7e36">{{"已售:"+giftQty+"件"}}</text>
  50 + <text class="data-v-3a5b7e36" wx:if="{{!flag}}">{{"已售:"+giftQty+"件"}}</text>
  51 + <text class="data-v-3a5b7e36" wx:elif="{{flag == 1 && giftQty > 0}}">{{"数量:"+giftQty+"件"}}</text>
43 52 </view>
44 53 </view>
45 54 </view>
... ... @@ -77,7 +86,7 @@
77 86 <text class="data-v-3a5b7e36 ellipsis-1">
78 87 {{"数量:"+item.num}}
79 88 </text>
80   - <block wx:if="{{isBuy==0}}">
  89 + <block wx:if="{{isBuy==0 && !flag}}">
81 90 <text style="margin-left:10rpx" wx:if="{{item.useState}}">
82 91 已核销
83 92 </text>
... ... @@ -86,7 +95,7 @@
86 95 </text>
87 96 </block>
88 97 </view>
89   - <view class="box_ware_code data-v-3a5b7e36">
  98 + <view class="box_ware_code data-v-3a5b7e36" wx:if="{{!flag}}">
90 99 <!-- <block wx:if="{{c_state==0}}"> -->
91 100 <block wx:if="{{isBuy==0&item.lbType==1}}">
92 101 <image src="{{iurl+'/miniapp/images/giftbag/gift06.png'}}" lazy-load="true" bindtap="getcode" data-codeId="{{item.Id}}" class="data-v-3a5b7e36"></image>
... ... @@ -121,68 +130,73 @@
121 130 <rich-text nodes="{{giftRemark}}" style="word-break:break-all;word-wrap:break-word"></rich-text>
122 131 </view>
123 132 </view>
124   - <view class="foot_empty data-v-3a5b7e36"></view>
125   - <block wx:if="{{isBuy==1 && giftTitle}}">
126   - <block wx:if="{{isStart==1}}">
127   - <view class="foot_button data-v-3a5b7e36">
128   - <block wx:if="{{giftPrice>0 && giftIntegral>0}}">
129   - <view class="foot_button_left data-v-3a5b7e36 " data-money="{{giftPrice}}" data-id="{{lbId}}" bindtap="GetBuyPrice">
130   - <text class="data-v-3a5b7e36 ">立即购买</text>
131   - </view>
132   - <view class="foot_button_right data-v-3a5b7e36 " bindtap="GetBuyIntegral" data-id="{{lbId}}">
133   - <text class="data-v-3a5b7e36">立即兑换</text>
134   - </view>
135   - </block>
136   - <block wx:if="{{giftPrice>0 && giftIntegral<=0}}">
137   - <view class="foot_button_buy data-v-3a5b7e36 " data-money="{{giftPrice}}" bindtap="GetBuyPrice" data-id="{{lbId}}">
138   - <text class="data-v-3a5b7e36">立即购买</text>
139   - </view>
140   - </block>
141   - <block wx:if="{{giftPrice<=0 && giftIntegral>0}}">
142   - <view class="foot_button_intalge data-v-3a5b7e36 " bindtap="GetBuyIntegral" data-id="{{lbId}}">
143   - <text class="data-v-3a5b7e36">立即兑换</text>
144   - </view>
145   - </block>
146   -
147   - <block wx:if="{{giftPrice<=0 && giftIntegral<=0}}">
148   - <view class="foot_button_intalge data-v-3a5b7e36 " bindtap="GetFree" data-id="{{lbId}}">
149   - <text class="data-v-3a5b7e36">免费领取</text>
150   - </view>
151   - </block>
152   -
153   -
154   - </view>
155   - </block>
156   - <block wx:else>
157   - <view class="foot_button data-v-3a5b7e36">
158   - <view class="foot_button_intalge data-v-3a5b7e36 gray ">
159   - <text class="data-v-3a5b7e36">活动还未开始</text>
160   - </view>
161   - </view>
162   - </block>
163   -
164   - </block>
165   - <block wx:if="{{isBuy==0}}">
166   - <view class="foot_button data-v-3a5b7e36">
167   - <block wx:if="{{is_lb!=1}}">
168   - <view class="foot_button_buy data-v-3a5b7e36 overdue">
169   - <text class="data-v-3a5b7e36">无核销商品</text>
170   - </view>
171   - </block>
172   - <block wx:else>
173   - <view wx:if="{{c_state==0}}" class="foot_button_buy data-v-3a5b7e36" bindtap="getcode">
174   - <text class="data-v-3a5b7e36">立即使用</text>
175   - </view>
176   - <view wx:if="{{c_state==1}}" class="foot_button_buy data-v-3a5b7e36 overdue" bindtap="getcode">
177   - <text class="data-v-3a5b7e36">商品已核销</text>
178   - </view>
179   - <view wx:if="{{c_state==2}}" class="foot_button_buy data-v-3a5b7e36 overdue">
180   - <text class="data-v-3a5b7e36">商品兑换时间已过</text>
181   - </view>
182   -
183   - </block>
184   - </view>
185   - </block>
  133 +
  134 +
  135 + <view class="foot_empty data-v-3a5b7e36"></view>
  136 +
  137 + <block wx:if="{{flag != 1}}">
  138 + <block wx:if="{{isBuy==1 && giftTitle}}">
  139 + <block wx:if="{{isStart==1}}">
  140 + <view class="foot_button data-v-3a5b7e36">
  141 + <block wx:if="{{giftPrice>0 && giftIntegral>0}}">
  142 + <view class="foot_button_left data-v-3a5b7e36 " data-money="{{giftPrice}}" data-id="{{lbId}}" bindtap="GetBuyPrice">
  143 + <text class="data-v-3a5b7e36 ">立即购买</text>
  144 + </view>
  145 + <view class="foot_button_right data-v-3a5b7e36 " bindtap="GetBuyIntegral" data-id="{{lbId}}">
  146 + <text class="data-v-3a5b7e36">立即兑换</text>
  147 + </view>
  148 + </block>
  149 + <block wx:if="{{giftPrice>0 && giftIntegral<=0}}">
  150 + <view class="foot_button_buy data-v-3a5b7e36 " data-money="{{giftPrice}}" bindtap="GetBuyPrice" data-id="{{lbId}}">
  151 + <text class="data-v-3a5b7e36">立即购买</text>
  152 + </view>
  153 + </block>
  154 + <block wx:if="{{giftPrice<=0 && giftIntegral>0}}">
  155 + <view class="foot_button_intalge data-v-3a5b7e36 " bindtap="GetBuyIntegral" data-id="{{lbId}}">
  156 + <text class="data-v-3a5b7e36">立即兑换</text>
  157 + </view>
  158 + </block>
  159 +
  160 + <block wx:if="{{giftPrice<=0 && giftIntegral<=0}}">
  161 + <view class="foot_button_intalge data-v-3a5b7e36 " bindtap="GetFree" data-id="{{lbId}}">
  162 + <text class="data-v-3a5b7e36">免费领取</text>
  163 + </view>
  164 + </block>
  165 +
  166 +
  167 + </view>
  168 + </block>
  169 + <block wx:else>
  170 + <view class="foot_button data-v-3a5b7e36">
  171 + <view class="foot_button_intalge data-v-3a5b7e36 gray ">
  172 + <text class="data-v-3a5b7e36">活动还未开始</text>
  173 + </view>
  174 + </view>
  175 + </block>
  176 +
  177 + </block>
  178 + <block wx:if="{{isBuy==0}}">
  179 + <view class="foot_button data-v-3a5b7e36">
  180 + <block wx:if="{{is_lb!=1}}">
  181 + <view class="foot_button_buy data-v-3a5b7e36 overdue">
  182 + <text class="data-v-3a5b7e36">无核销商品</text>
  183 + </view>
  184 + </block>
  185 + <block wx:else>
  186 + <view wx:if="{{c_state==0}}" class="foot_button_buy data-v-3a5b7e36" bindtap="getcode">
  187 + <text class="data-v-3a5b7e36">立即使用</text>
  188 + </view>
  189 + <view wx:if="{{c_state==1}}" class="foot_button_buy data-v-3a5b7e36 overdue" bindtap="getcode">
  190 + <text class="data-v-3a5b7e36">商品已核销</text>
  191 + </view>
  192 + <view wx:if="{{c_state==2}}" class="foot_button_buy data-v-3a5b7e36 overdue">
  193 + <text class="data-v-3a5b7e36">商品兑换时间已过</text>
  194 + </view>
  195 + </block>
  196 + </view>
  197 + </block>
  198 + </block>
  199 +
186 200 </view>
187 201 <!-- 引入提示组件 -->
188 202 <warn id="warn"></warn>
... ...