Commit 1996d5b010dc9b1f3b6f28545918a868be99c5a2
1 parent
73ec3ff6
礼包详情和助力活动的bug修改
Showing
4 changed files
with
118 additions
and
41 deletions
pages/user/assistance/giftpacklist.js
... | ... | @@ -31,38 +31,117 @@ Page({ |
31 | 31 | receiveState: 0, //0未领取 1已领取 |
32 | 32 | completeid: "", |
33 | 33 | is_sub: 0, //判断是否重复提交 |
34 | + is_libao: 0, //0轮播查看活动 1领取礼包 2.查看礼包详情 | |
35 | + held_id: "", //活动id | |
36 | + taskId: "", //任务id | |
37 | + orderSn: "", //订单号 | |
34 | 38 | }, |
35 | 39 | onLoad: function(options) { |
36 | 40 | var th = this; |
37 | - th.setData({ | |
38 | - getGiftID: 100, // options.libao_id, | |
39 | - completeid: options.completeid, | |
40 | - orderSn: options.orderSn | |
41 | - }) | |
42 | 41 | if (options.is_libao == 0) { |
43 | - th.GetMyGiftList(); | |
44 | - } else { | |
42 | + th.setData({ | |
43 | + held_id: options.help_id, //options.help_id | |
44 | + taskId: options.taskId, //options.libao_id | |
45 | + }) | |
46 | + th.help(); | |
47 | + } | |
48 | + if (options.is_libao == 1) { | |
49 | + th.setData({ | |
50 | + taskId: options.libao_id, | |
51 | + held_id: options.held_id | |
52 | + }) | |
45 | 53 | th.GetBuyGiftList(); |
46 | 54 | } |
47 | - // th.setData({ | |
48 | - // giftRemark: th.data.giftRemark.replace(/<p><img/gi, "<p class='img'><img") | |
49 | - // }) | |
55 | + if (options.order_sn) { | |
56 | + th.setData({ | |
57 | + orderSn: options.orderSn | |
58 | + }) | |
59 | + th.GetMyGiftList(); | |
60 | + } | |
50 | 61 | th.close(); |
51 | 62 | }, |
52 | 63 | onShow: function() { |
53 | 64 | |
54 | 65 | }, |
66 | + //助力活动查看礼包详情调用 | |
67 | + help: function(e) { | |
68 | + var th = this; | |
69 | + var url = "/api/weshop/marketing/giftbag/help/get"; | |
70 | + getApp().request.promiseGet(url, { | |
71 | + isShowLoading: true, | |
72 | + data: { | |
73 | + helpId: th.data.held_id, | |
74 | + storeId: a.stoid, | |
75 | + taskId: th.data.taskId | |
76 | + } | |
77 | + }).then(res => { | |
78 | + if (res.data.code == 0) { | |
79 | + th.setData({ | |
80 | + giftImage: th.data.iurl + res.data.data.lbUrl, | |
81 | + giftTitle: res.data.data.giftTitle | |
82 | + }) | |
83 | + if (res.data.data.giftRemark == '') { | |
84 | + th.setData({ | |
85 | + giftRemark: '暂无详情......' | |
86 | + }) | |
87 | + } else { | |
88 | + th.setData({ | |
89 | + giftRemark: res.data.data.giftRemark.replace(/\<img/gi, '<img style="max-width:100%;height:auto;display:block"') | |
90 | + }) | |
91 | + } | |
92 | + | |
93 | + // //---获取日期的时间戳--- | |
94 | + // var t_endtime = res.data.data.endTime; | |
95 | + // t_endtime = t_endtime.replace(/-/g, '/'); | |
96 | + // var t_date = new Date(t_endtime) / 1000; | |
97 | + // var t_now = ut.gettimestamp(); | |
55 | 98 | |
99 | + // if (res.data.data.goodsUseState) th.setData({ | |
100 | + // c_state: 1 | |
101 | + // }) | |
102 | + // else if (t_date <= t_now) | |
103 | + // th.setData({ | |
104 | + // c_state: 2 | |
105 | + // }) | |
106 | + | |
107 | + th.setData({ | |
108 | + giftDate: res.data.data.endTime, | |
109 | + giftPosPrice: res.data.data.giftPosPrice, | |
110 | + giftQty: res.data.data.giftQty, | |
111 | + giftIntegral: res.data.data.payIntegral, | |
112 | + giftPrice: res.data.data.payMoney, | |
113 | + giftType: res.data.data.actType, | |
114 | + actTitle: res.data.data.actTitle, | |
115 | + wareCard: res.data.data.wareCard, | |
116 | + lbId: res.data.data.lbId | |
117 | + }) | |
118 | + //判断是否有礼包 | |
119 | + for (var i = 0; i < res.data.data.wareCard.length; i++) { | |
120 | + if (res.data.data.wareCard[i].lbType == 1) { | |
121 | + th.setData({ | |
122 | + is_lb: 1 | |
123 | + }) | |
124 | + break; | |
125 | + } | |
126 | + } | |
127 | + } else { | |
128 | + getApp().my_warnning(res.data.msg, 0, th); | |
129 | + return false; | |
130 | + } | |
131 | + | |
132 | + }) | |
133 | + }, | |
56 | 134 | GetMyGiftList: function() { |
57 | 135 | var _this = this; |
58 | 136 | var th = this; |
59 | 137 | getApp().request.get('/api/weshop/marketing/my/giftbag/detail/get', { |
138 | + isShowLoading: true, | |
60 | 139 | data: { |
61 | 140 | "storeId": a.stoid, //商家ID |
62 | 141 | "userId": d.user_id, //用户ID |
63 | 142 | "orderSn": th.data.orderSn |
64 | 143 | }, |
65 | - success: function success(res) { | |
144 | + success: function(res) { | |
66 | 145 | if (res.data.code == 0) { |
67 | 146 | th.setData({ |
68 | 147 | giftImage: th.data.iurl + res.data.data.lbUrl, |
... | ... | @@ -74,7 +153,7 @@ Page({ |
74 | 153 | }) |
75 | 154 | } else { |
76 | 155 | th.setData({ |
77 | - giftRemark: res.data.data.giftRemark | |
156 | + giftRemark: res.data.data.giftRemark.replace(/\<img/gi, '<img style="max-width:100%;height:auto;display:block"') | |
78 | 157 | }) |
79 | 158 | } |
80 | 159 | |
... | ... | @@ -132,7 +211,7 @@ Page({ |
132 | 211 | }) |
133 | 212 | var json = { |
134 | 213 | "actId": th.data.completeid, //活动Id |
135 | - "actType": 1, //活动类型 1:新人礼、2:评价有礼、3:节日营销、4:生日营销 | |
214 | + "actType": 5, //活动类型 1:新人礼、2:评价有礼、3:节日营销、4:生日营销 | |
136 | 215 | "giftBagId": th.data.giftID, //礼包Id |
137 | 216 | "storeId": a.stoid, //商家Id |
138 | 217 | "userId": d.user_id //用户ID |
... | ... | @@ -164,17 +243,14 @@ Page({ |
164 | 243 | GetBuyGiftList: function() { |
165 | 244 | var _this2 = this; |
166 | 245 | var th = this.data; |
167 | - wx.showLoading({ | |
168 | - title: '加载中' | |
169 | - }) | |
170 | 246 | getApp().request.get('/api/weshop/marketing/giftbag/detail/get', { |
247 | + isShowLoading: true, | |
171 | 248 | data: { |
172 | 249 | "storeId": a.stoid, //商家ID |
173 | 250 | "userId": d.user_id, //用户ID |
174 | - "giftBagId": th.getGiftID | |
251 | + "giftBagId": th.taskId | |
175 | 252 | }, |
176 | 253 | success: function(res) { |
177 | - wx.hideLoading(); | |
178 | 254 | if (res.data.code == 0) { |
179 | 255 | _this2.setData({ |
180 | 256 | giftImage: th.iurl + res.data.data.lbUrl, |
... | ... | @@ -187,10 +263,9 @@ Page({ |
187 | 263 | }) |
188 | 264 | } else { |
189 | 265 | _this2.setData({ |
190 | - giftRemark: res.data.data.giftRemark | |
266 | + giftRemark: res.data.data.giftRemark.replace(/\<img/gi, '<img style="max-width:100%;height:auto;display:block"') | |
191 | 267 | }) |
192 | 268 | } |
193 | - | |
194 | 269 | _this2.setData({ |
195 | 270 | giftDate: res.data.data.endTime, |
196 | 271 | giftPosPrice: res.data.data.giftPosPrice, |
... | ... | @@ -231,14 +306,8 @@ Page({ |
231 | 306 | }; |
232 | 307 | var data = JSON.stringify(json); |
233 | 308 | var url = th.data.url + "/api/weshop/marketing/gift/goods/verify/code/get"; //预约接口地址 |
234 | - wx.request({ | |
235 | - url: url, | |
236 | - data: data, | |
237 | - method: 'put', | |
238 | - header: { | |
239 | - 'content-type': 'application/json' | |
240 | - }, // 设置请求的 header | |
241 | - success: function(res) { | |
309 | + getApp().request.json_post(url, json, | |
310 | + function(res) { | |
242 | 311 | if (res.data.code == 0) { |
243 | 312 | th.setData({ |
244 | 313 | code: res.data.data |
... | ... | @@ -247,8 +316,15 @@ Page({ |
247 | 316 | } else { |
248 | 317 | getApp().my_warnning(res.data.msg, 0, th); |
249 | 318 | } |
250 | - } | |
251 | - }) | |
319 | + }, | |
320 | + function(res) { | |
321 | + | |
322 | + }, "put" | |
323 | + | |
324 | + ) | |
325 | + | |
326 | + | |
327 | + | |
252 | 328 | }, |
253 | 329 | //界面跳转 |
254 | 330 | goto: function(e) { | ... | ... |
pages/user/assistance/giftpacklist.wxml
... | ... | @@ -6,7 +6,7 @@ |
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"> | |
9 | + <view wx:if="{{giftDate}}" class="top_time data-v-3a5b7e36"> | |
10 | 10 | <text class="data-v-3a5b7e36">{{"兑换截至时间:"+giftDate}}</text> |
11 | 11 | </view> |
12 | 12 | <view class="top_price data-v-3a5b7e36"> |
... | ... | @@ -67,7 +67,7 @@ |
67 | 67 | </view> |
68 | 68 | <view class="box_ware_code data-v-3a5b7e36"> |
69 | 69 | <block wx:if="{{c_state==0}}"> |
70 | - <block wx:if="{{isBuy==0&item.lbType==1}}"> | |
70 | + <block wx:if="{{item.lbType==1}}"> | |
71 | 71 | <image src="{{iurl+'/miniapp/images/giftbag/gift06.png'}}" lazy-load="true" bindtap="getcode" class="data-v-3a5b7e36"></image> |
72 | 72 | </block> |
73 | 73 | </block> |
... | ... | @@ -76,13 +76,13 @@ |
76 | 76 | <image src="{{iurl+'/miniapp/images/giftbag/gift08.png'}}" lazy-load="true" class="data-v-3a5b7e36"></image> |
77 | 77 | </block> |
78 | 78 | </block> |
79 | - <block wx:if="{{isBuy==0&item.lbType==2}}"> | |
79 | + <block wx:if="{{item.lbType==2}}"> | |
80 | 80 | <image src="{{iurl+'/miniapp/images/giftbag/gift06.png'}}" class="data-v-3a5b7e36" lazy-load="true" data-url="/pages/user/coupons/coupons" bindtap="goto"></image> |
81 | 81 | </block> |
82 | - <block wx:if="{{isBuy==0&item.lbType==3}}"> | |
82 | + <block wx:if="{{item.lbType==3}}"> | |
83 | 83 | <image src="{{iurl+'/miniapp/images/giftbag/gift06.png'}}" class="data-v-3a5b7e36" lazy-load="true" data-url="/pages/user/my_service/i_service" bindtap="goto"></image> |
84 | 84 | </block> |
85 | - <block wx:if="{{isBuy==0&item.lbType>3}}"> | |
85 | + <block wx:if="{{item.lbType>3}}"> | |
86 | 86 | <text class="data-v-3a5b7e36">奖励已发放</text> |
87 | 87 | </block> |
88 | 88 | </view> |
... | ... | @@ -95,7 +95,7 @@ |
95 | 95 | <text class="data-v-3a5b7e36">活动说明</text> |
96 | 96 | </view> |
97 | 97 | <view class="foot_box_remark data-v-3a5b7e36"> |
98 | - <rich-text nodes="{{giftRemark}}"></rich-text> | |
98 | + <rich-text nodes="{{giftRemark}}" style="word-break:break-all;word-wrap:break-word"></rich-text> | |
99 | 99 | </view> |
100 | 100 | </view> |
101 | 101 | <view class="foot_empty data-v-3a5b7e36"></view> | ... | ... |
pages/user/assistance/task_assistance.js
... | ... | @@ -1039,9 +1039,10 @@ Page({ |
1039 | 1039 | }, |
1040 | 1040 | //礼包的详情 轮播图 |
1041 | 1041 | libao_details: function(e) { |
1042 | - var giftbagid = e.currentTarget.dataset.giftbagid; | |
1043 | - var help_id = this.data.help_id; | |
1044 | - getApp().goto("/pages/user/assistance/giftpacklist?libao_id=" + giftbagid + "&is_libao=" + 0+"help_id"); | |
1042 | + var th = this; | |
1043 | + var help_id = th.data.help_id;//活动id | |
1044 | + var taskId = th.data.taskid;//任务id | |
1045 | + getApp().goto("/pages/user/assistance/giftpacklist?help_id=" + help_id + "&is_libao=" + 0 + "&taskId=" + taskId); | |
1045 | 1046 | }, |
1046 | 1047 | //正在进行任务 |
1047 | 1048 | test: function(e) { | ... | ... |
pages/user/assistance/task_assistance.wxml
... | ... | @@ -17,7 +17,7 @@ |
17 | 17 | </view> |
18 | 18 | <swiper bindanimationfinish="changeGoodsSwip" current="{{sw_index}}" style='width:82.7%; height:100%' bindchange='onSli' indicator-dots="{{false}}" autoplay="{{false}}"> |
19 | 19 | <swiper-item wx:for="{{aitem}}" wx:for-item="aitem" wx:for-index="pidx"> |
20 | - <image class="xc-center-img"bindtap="libao_details" data-giftbagid="{{aitem.id}}" src="{{iurl+aitem.giftBagUrl}}"></image> | |
20 | + <image class="xc-center-img" bindtap="libao_details" src="{{iurl+aitem.giftBagUrl}}"></image> | |
21 | 21 | </swiper-item> |
22 | 22 | </swiper> |
23 | 23 | |
... | ... | @@ -76,7 +76,7 @@ |
76 | 76 | <view class="flex-center width state"> |
77 | 77 | <view class="ellipsis-1"> |
78 | 78 | <text wx:if="{{item.status==0}}">{{item.zlHelpNum}}/{{item.helpNum}}</text> |
79 | - <text wx:if="{{item.status==2}}"bindtap="select_libao" data-libaoid="{{item.helpListGiftBagId}}">查看礼包</text> | |
79 | + <text wx:if="{{item.status==2}}"bindtap="select_libao" data-libaoid="{{item.order_sn}}">查看礼包</text> | |
80 | 80 | <text wx:if="{{item.status==1}}"bindtap="get_libao"data-orderid="{{item.ordersn}}" data-libaoid="{{item.helpListGiftBagId}}" |
81 | 81 | data-completeid="{{item.id}}">领取礼包 </text> |
82 | 82 | </view> | ... | ... |