Commit 1996d5b010dc9b1f3b6f28545918a868be99c5a2

Authored by iceling
1 parent 73ec3ff6

礼包详情和助力活动的bug修改

pages/user/assistance/giftpacklist.js
@@ -31,38 +31,117 @@ Page({ @@ -31,38 +31,117 @@ Page({
31 receiveState: 0, //0未领取 1已领取 31 receiveState: 0, //0未领取 1已领取
32 completeid: "", 32 completeid: "",
33 is_sub: 0, //判断是否重复提交 33 is_sub: 0, //判断是否重复提交
  34 + is_libao: 0, //0轮播查看活动 1领取礼包 2.查看礼包详情
  35 + held_id: "", //活动id
  36 + taskId: "", //任务id
  37 + orderSn: "", //订单号
34 }, 38 },
35 onLoad: function(options) { 39 onLoad: function(options) {
36 var th = this; 40 var th = this;
37 - th.setData({  
38 - getGiftID: 100, // options.libao_id,  
39 - completeid: options.completeid,  
40 - orderSn: options.orderSn  
41 - })  
42 if (options.is_libao == 0) { 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 th.GetBuyGiftList(); 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 th.close(); 61 th.close();
51 }, 62 },
52 onShow: function() { 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 GetMyGiftList: function() { 134 GetMyGiftList: function() {
57 var _this = this; 135 var _this = this;
58 var th = this; 136 var th = this;
59 getApp().request.get('/api/weshop/marketing/my/giftbag/detail/get', { 137 getApp().request.get('/api/weshop/marketing/my/giftbag/detail/get', {
  138 + isShowLoading: true,
60 data: { 139 data: {
61 "storeId": a.stoid, //商家ID 140 "storeId": a.stoid, //商家ID
62 "userId": d.user_id, //用户ID 141 "userId": d.user_id, //用户ID
63 "orderSn": th.data.orderSn 142 "orderSn": th.data.orderSn
64 }, 143 },
65 - success: function success(res) { 144 + success: function(res) {
66 if (res.data.code == 0) { 145 if (res.data.code == 0) {
67 th.setData({ 146 th.setData({
68 giftImage: th.data.iurl + res.data.data.lbUrl, 147 giftImage: th.data.iurl + res.data.data.lbUrl,
@@ -74,7 +153,7 @@ Page({ @@ -74,7 +153,7 @@ Page({
74 }) 153 })
75 } else { 154 } else {
76 th.setData({ 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,7 +211,7 @@ Page({
132 }) 211 })
133 var json = { 212 var json = {
134 "actId": th.data.completeid, //活动Id 213 "actId": th.data.completeid, //活动Id
135 - "actType": 1, //活动类型 1:新人礼、2:评价有礼、3:节日营销、4:生日营销 214 + "actType": 5, //活动类型 1:新人礼、2:评价有礼、3:节日营销、4:生日营销
136 "giftBagId": th.data.giftID, //礼包Id 215 "giftBagId": th.data.giftID, //礼包Id
137 "storeId": a.stoid, //商家Id 216 "storeId": a.stoid, //商家Id
138 "userId": d.user_id //用户ID 217 "userId": d.user_id //用户ID
@@ -164,17 +243,14 @@ Page({ @@ -164,17 +243,14 @@ Page({
164 GetBuyGiftList: function() { 243 GetBuyGiftList: function() {
165 var _this2 = this; 244 var _this2 = this;
166 var th = this.data; 245 var th = this.data;
167 - wx.showLoading({  
168 - title: '加载中'  
169 - })  
170 getApp().request.get('/api/weshop/marketing/giftbag/detail/get', { 246 getApp().request.get('/api/weshop/marketing/giftbag/detail/get', {
  247 + isShowLoading: true,
171 data: { 248 data: {
172 "storeId": a.stoid, //商家ID 249 "storeId": a.stoid, //商家ID
173 "userId": d.user_id, //用户ID 250 "userId": d.user_id, //用户ID
174 - "giftBagId": th.getGiftID 251 + "giftBagId": th.taskId
175 }, 252 },
176 success: function(res) { 253 success: function(res) {
177 - wx.hideLoading();  
178 if (res.data.code == 0) { 254 if (res.data.code == 0) {
179 _this2.setData({ 255 _this2.setData({
180 giftImage: th.iurl + res.data.data.lbUrl, 256 giftImage: th.iurl + res.data.data.lbUrl,
@@ -187,10 +263,9 @@ Page({ @@ -187,10 +263,9 @@ Page({
187 }) 263 })
188 } else { 264 } else {
189 _this2.setData({ 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 _this2.setData({ 269 _this2.setData({
195 giftDate: res.data.data.endTime, 270 giftDate: res.data.data.endTime,
196 giftPosPrice: res.data.data.giftPosPrice, 271 giftPosPrice: res.data.data.giftPosPrice,
@@ -231,14 +306,8 @@ Page({ @@ -231,14 +306,8 @@ Page({
231 }; 306 };
232 var data = JSON.stringify(json); 307 var data = JSON.stringify(json);
233 var url = th.data.url + "/api/weshop/marketing/gift/goods/verify/code/get"; //预约接口地址 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 if (res.data.code == 0) { 311 if (res.data.code == 0) {
243 th.setData({ 312 th.setData({
244 code: res.data.data 313 code: res.data.data
@@ -247,8 +316,15 @@ Page({ @@ -247,8 +316,15 @@ Page({
247 } else { 316 } else {
248 getApp().my_warnning(res.data.msg, 0, th); 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 goto: function(e) { 330 goto: function(e) {
pages/user/assistance/giftpacklist.wxml
@@ -6,7 +6,7 @@ @@ -6,7 +6,7 @@
6 <view class="top_title data-v-3a5b7e36"> 6 <view class="top_title data-v-3a5b7e36">
7 <text class="data-v-3a5b7e36 ellipsis-2">{{giftTitle}}</text> 7 <text class="data-v-3a5b7e36 ellipsis-2">{{giftTitle}}</text>
8 </view> 8 </view>
9 - <view class="top_time data-v-3a5b7e36"> 9 + <view wx:if="{{giftDate}}" class="top_time data-v-3a5b7e36">
10 <text class="data-v-3a5b7e36">{{"兑换截至时间:"+giftDate}}</text> 10 <text class="data-v-3a5b7e36">{{"兑换截至时间:"+giftDate}}</text>
11 </view> 11 </view>
12 <view class="top_price data-v-3a5b7e36"> 12 <view class="top_price data-v-3a5b7e36">
@@ -67,7 +67,7 @@ @@ -67,7 +67,7 @@
67 </view> 67 </view>
68 <view class="box_ware_code data-v-3a5b7e36"> 68 <view class="box_ware_code data-v-3a5b7e36">
69 <block wx:if="{{c_state==0}}"> 69 <block wx:if="{{c_state==0}}">
70 - <block wx:if="{{isBuy==0&item.lbType==1}}"> 70 + <block wx:if="{{item.lbType==1}}">
71 <image src="{{iurl+'/miniapp/images/giftbag/gift06.png'}}" lazy-load="true" bindtap="getcode" class="data-v-3a5b7e36"></image> 71 <image src="{{iurl+'/miniapp/images/giftbag/gift06.png'}}" lazy-load="true" bindtap="getcode" class="data-v-3a5b7e36"></image>
72 </block> 72 </block>
73 </block> 73 </block>
@@ -76,13 +76,13 @@ @@ -76,13 +76,13 @@
76 <image src="{{iurl+'/miniapp/images/giftbag/gift08.png'}}" lazy-load="true" class="data-v-3a5b7e36"></image> 76 <image src="{{iurl+'/miniapp/images/giftbag/gift08.png'}}" lazy-load="true" class="data-v-3a5b7e36"></image>
77 </block> 77 </block>
78 </block> 78 </block>
79 - <block wx:if="{{isBuy==0&item.lbType==2}}"> 79 + <block wx:if="{{item.lbType==2}}">
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> 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 </block> 81 </block>
82 - <block wx:if="{{isBuy==0&item.lbType==3}}"> 82 + <block wx:if="{{item.lbType==3}}">
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> 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 </block> 84 </block>
85 - <block wx:if="{{isBuy==0&item.lbType>3}}"> 85 + <block wx:if="{{item.lbType>3}}">
86 <text class="data-v-3a5b7e36">奖励已发放</text> 86 <text class="data-v-3a5b7e36">奖励已发放</text>
87 </block> 87 </block>
88 </view> 88 </view>
@@ -95,7 +95,7 @@ @@ -95,7 +95,7 @@
95 <text class="data-v-3a5b7e36">活动说明</text> 95 <text class="data-v-3a5b7e36">活动说明</text>
96 </view> 96 </view>
97 <view class="foot_box_remark data-v-3a5b7e36"> 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 </view> 99 </view>
100 </view> 100 </view>
101 <view class="foot_empty data-v-3a5b7e36"></view> 101 <view class="foot_empty data-v-3a5b7e36"></view>
pages/user/assistance/task_assistance.js
@@ -1039,9 +1039,10 @@ Page({ @@ -1039,9 +1039,10 @@ Page({
1039 }, 1039 },
1040 //礼包的详情 轮播图 1040 //礼包的详情 轮播图
1041 libao_details: function(e) { 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 test: function(e) { 1048 test: function(e) {
pages/user/assistance/task_assistance.wxml
@@ -17,7 +17,7 @@ @@ -17,7 +17,7 @@
17 </view> 17 </view>
18 <swiper bindanimationfinish="changeGoodsSwip" current="{{sw_index}}" style='width:82.7%; height:100%' bindchange='onSli' indicator-dots="{{false}}" autoplay="{{false}}"> 18 <swiper bindanimationfinish="changeGoodsSwip" current="{{sw_index}}" style='width:82.7%; height:100%' bindchange='onSli' indicator-dots="{{false}}" autoplay="{{false}}">
19 <swiper-item wx:for="{{aitem}}" wx:for-item="aitem" wx:for-index="pidx"> 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 </swiper-item> 21 </swiper-item>
22 </swiper> 22 </swiper>
23 23
@@ -76,7 +76,7 @@ @@ -76,7 +76,7 @@
76 <view class="flex-center width state"> 76 <view class="flex-center width state">
77 <view class="ellipsis-1"> 77 <view class="ellipsis-1">
78 <text wx:if="{{item.status==0}}">{{item.zlHelpNum}}/{{item.helpNum}}</text> 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 <text wx:if="{{item.status==1}}"bindtap="get_libao"data-orderid="{{item.ordersn}}" data-libaoid="{{item.helpListGiftBagId}}" 80 <text wx:if="{{item.status==1}}"bindtap="get_libao"data-orderid="{{item.ordersn}}" data-libaoid="{{item.helpListGiftBagId}}"
81 data-completeid="{{item.id}}">领取礼包 </text> 81 data-completeid="{{item.id}}">领取礼包 </text>
82 </view> 82 </view>