Commit a8752f36c024e81a7ef0371c6c927f350af6c914
1 parent
6061ca54
oa单
Showing
7 changed files
with
185 additions
and
22 deletions
pages/giftpack/buygiftpack/giftpackbuy.wxml
... | ... | @@ -24,7 +24,7 @@ |
24 | 24 | <!--<block wx:for="{{wareCard}}" wx:if="{{now > filter.gettimestamp(items.starTime) || (items.is_show && now > items.show_time)}}" wx:for-item="items" wx:for-index="index" wx:key="index">--> |
25 | 25 | <block wx:for="{{wareCard}}" wx:for-item="items" wx:for-index="index" wx:key="index"> |
26 | 26 | <view class="content_box"> |
27 | - <view class="content_box_ware" bindtap="navigateTo" data-url="/pages/giftpack/giftpacklist/giftpacklist?isBuy=1&lbId={{items.lbId}}&orderSn=''"> | |
27 | + <view class="content_box_ware" bindtap="navigateTo" data-url="/pages/giftpack/giftpacklist/giftpacklist?isBuy=1&lbId={{items.lbId}}&cover_img={{items.cover_img}}&orderSn=''"> | |
28 | 28 | <view class="content_box_img"> |
29 | 29 | <image src="{{iurl+items.cover_img}}" lazy-load="true" binderror="bind_bnerr2" wx:if="{{items.cover_img}}" data-errorimg="wareCard[{{index}}].cover_img"></image> |
30 | 30 | <image src="{{iurl+items.lbUrl}}" lazy-load="true" binderror="bind_bnerr2" wx:else data-errorimg="wareCard[{{index}}].lbUrl"></image> | ... | ... |
pages/giftpack/giftpacklist/giftpacklist.js
... | ... | @@ -71,6 +71,7 @@ Page({ |
71 | 71 | |
72 | 72 | sto_sele_name_1: '', |
73 | 73 | share_goods_img:'', //礼包的分享图 |
74 | + giftImageCover:null, | |
74 | 75 | canvasHidden:true, |
75 | 76 | |
76 | 77 | screenWidth: 0 |
... | ... | @@ -251,8 +252,11 @@ Page({ |
251 | 252 | }, |
252 | 253 | success: function (res) { |
253 | 254 | if (res.data.code == 0) { |
255 | + console.log('商品------++') | |
256 | + console.log(res) | |
254 | 257 | th.setData({ |
255 | - giftImage: th.data.iurl + res.data.data.lbUrl, | |
258 | + giftImage: th.data.iurl + res.data.data.lbUrl, | |
259 | + giftImageCover: th.data.iurl + (th.data.params.cover_img ? th.data.params.cover_img: res.data.data.lbUrl), | |
256 | 260 | giftTitle: res.data.data.giftTitle, |
257 | 261 | default_color: res.data.data.bgcolor |
258 | 262 | }) |
... | ... | @@ -346,7 +350,8 @@ Page({ |
346 | 350 | success: function success(res) { |
347 | 351 | if (res.data.code == 0) { |
348 | 352 | _this2.setData({ |
349 | - giftImage: th.iurl + res.data.data.lbUrl, | |
353 | + giftImage: th.iurl + res.data.data.lbUrl, | |
354 | + giftImageCover: th.iurl + (_this2.data.params.cover_img ? _this2.data.params.cover_img: res.data.data.lbUrl), | |
350 | 355 | giftTitle: res.data.data.giftTitle, |
351 | 356 | default_color: res.data.data.bgcolor |
352 | 357 | }) |
... | ... | @@ -419,6 +424,7 @@ Page({ |
419 | 424 | if (res.data.code == 0) { |
420 | 425 | th.setData({ |
421 | 426 | giftImage: th.data.iurl + res.data.data.lbUrl, |
427 | + giftImageCover: th.data.iurl + (th.data.params.cover_img ? th.data.params.cover_img: res.data.data.lbUrl), | |
422 | 428 | giftTitle: res.data.data.lbTitle, |
423 | 429 | default_color: res.data.data.bgcolor |
424 | 430 | }) |
... | ... | @@ -964,6 +970,7 @@ Page({ |
964 | 970 | th.get_goods_temp(function () { |
965 | 971 | var vpath = res.path; |
966 | 972 | var context = wx.createCanvasContext('share'); |
973 | + // let share_goods_img = th.params.cover_img | |
967 | 974 | th.drawPoster(context, unit, th.data.share_goods_img, vpath, 0); |
968 | 975 | |
969 | 976 | //把画板内容绘制成图片,并回调 画板图片路径 |
... | ... | @@ -1116,7 +1123,7 @@ Page({ |
1116 | 1123 | tt(); |
1117 | 1124 | return false; |
1118 | 1125 | } |
1119 | - var img_url = ee.data.giftImage; | |
1126 | + var img_url = ee.data.giftImageCover ? ee.data.giftImageCover : ee.data.giftImage; | |
1120 | 1127 | //获取商品是分享图信息 |
1121 | 1128 | wx.getImageInfo({ |
1122 | 1129 | src: img_url, | ... | ... |
pages/giftpack/mygiftpack/mygiftpack.wxml
... | ... | @@ -23,7 +23,7 @@ |
23 | 23 | </view> |
24 | 24 | <block wx:for="{{wareCard}}" wx:for-item="item" wx:for-index="index" wx:key="index"> |
25 | 25 | <view class="content_box"> |
26 | - <view class="content_box_ware" bindtap="navigateTo" data-url="/pages/giftpack/giftpacklist/giftpacklist?isBuy=0&lbId={{item.lbId}}&orderSn={{item.orderSn}}"> | |
26 | + <view class="content_box_ware" bindtap="navigateTo" data-url="/pages/giftpack/giftpacklist/giftpacklist?isBuy=0&lbId={{item.lbId}}&cover_img={{item.cover_img}}&orderSn={{item.orderSn}}"> | |
27 | 27 | <view class="content_box_img"> |
28 | 28 | <!-- <image src="{{$GetInfo.imgHttp+item.$orig.lbUrl}}"></image> --> |
29 | 29 | <image wx:if="{{item.cover_img}}" src="{{iurl+item.cover_img}}" lazy-load="true" binderror="bind_bnerr2" data-errorimg="wareCard[{{index}}].cover_img"></image> |
... | ... | @@ -93,7 +93,7 @@ |
93 | 93 | |
94 | 94 | </view> |
95 | 95 | </view> |
96 | - <view class="content_box_button" bindtap="navigateTo" data-url="/pages/giftpack/giftpacklist/giftpacklist?isBuy=0&lbId={{item.lbId}}&orderSn={{item.orderSn}}"> | |
96 | + <view class="content_box_button" bindtap="navigateTo" data-url="/pages/giftpack/giftpacklist/giftpacklist?isBuy=0&lbId={{item.lbId}}&cover_img={{item.cover_img}}&orderSn={{item.orderSn}}"> | |
97 | 97 | <button>立即使用</button> |
98 | 98 | </view> |
99 | 99 | </view> | ... | ... |
pages/user/assistance/friend_assistance.js
... | ... | @@ -21,14 +21,16 @@ Page({ |
21 | 21 | userId: 0, //任务用户的ID |
22 | 22 | s_num: 0, //分享的人数 |
23 | 23 | taskId:0, //活动从表ID |
24 | - helpId:0, | |
24 | + helpId:0, | |
25 | + invalidTime:0, //任务失效时间戳 | |
25 | 26 | }, |
26 | 27 | |
27 | 28 | /** |
28 | 29 | * 生命周期函数--监听页面加载 |
29 | 30 | */ |
30 | 31 | onLoad: function(options) { |
31 | - | |
32 | + console.log('助力——————————————————————————————'); | |
33 | + console.log(options); | |
32 | 34 | var th = this; |
33 | 35 | |
34 | 36 | var nav_b = th.selectComponent("#nav_b"); //组件的id |
... | ... | @@ -38,7 +40,7 @@ Page({ |
38 | 40 | if (options.userId) this.data.userId = options.userId; |
39 | 41 | //任务是不是为空 |
40 | 42 | if (this.data.tasking == 0 || this.data.tasking == undefined) { |
41 | - this.data.tasking = decodeURIComponent(options.scene); | |
43 | + this.data.tasking = decodeURIComponent(options.scene); | |
42 | 44 | } |
43 | 45 | |
44 | 46 | }, |
... | ... | @@ -73,10 +75,19 @@ Page({ |
73 | 75 | storeId: os.stoid |
74 | 76 | } |
75 | 77 | }).then(res => { |
78 | + console.log('任务时间-------------------------'); | |
79 | + console.log(res); | |
76 | 80 | if (res.data.code == 0) { |
81 | + | |
77 | 82 | th.data.userId = res.data.data.userId; |
78 | 83 | th.data.taskId = res.data.data.helpTaskId; |
79 | - th.data.helpId=res.data.data.helpFormId; | |
84 | + th.data.helpId=res.data.data.helpFormId; | |
85 | + // th.invalidTime = res.data.data.invalidTime | |
86 | + // th.setData({ | |
87 | + // invalidTime:1662138310 | |
88 | + // }) | |
89 | + let openTime = res.data.data.openTime | |
90 | + th.getInvalidTime(openTime) | |
80 | 91 | //获取活动的时间 |
81 | 92 | return getApp().request.promiseGet("/api/weshop/marketing/help/help/act/get", { |
82 | 93 | data: { |
... | ... | @@ -110,9 +121,45 @@ Page({ |
110 | 121 | }) |
111 | 122 | |
112 | 123 | } |
113 | - }, | |
124 | + }, | |
125 | + getInvalidTime(openTime=0){ | |
126 | + let th = this | |
127 | + rq.get("/api/weshop/marketing/giftbag/helpinfo/get", { | |
128 | + data: { | |
129 | + storeId: os.stoid, | |
130 | + // userId: user_id, | |
131 | + taskId: th.data.taskId, | |
132 | + helpId:th.data.helpId | |
133 | + }, | |
134 | + success: function (res) { | |
135 | + console.log('获取失效时间------'); | |
136 | + console.log(res); | |
137 | + if (res.data.code == 0) { | |
138 | + let validTime=res.data.data.validTime | |
139 | + let invalidTime =0 | |
140 | + if (openTime && validTime > 0) { | |
141 | + invalidTime = openTime*1 + validTime*60*60 | |
142 | + } | |
143 | + th.setData({ | |
144 | + invalidTime | |
145 | + }); | |
146 | + } | |
147 | + } | |
148 | + }) | |
149 | + }, | |
114 | 150 | //点击开启礼盒 |
115 | 151 | cklie_button: function() { |
152 | + //判断任务是否失效 | |
153 | + let invalidTime = this.data.invalidTime | |
154 | + let nowTime = parseInt((new Date().getTime())/1000) | |
155 | + if (invalidTime > 0) { | |
156 | + let disTime = invalidTime - nowTime | |
157 | + if (disTime <=0) { | |
158 | + getApp().showWarning("该任务已失效"); | |
159 | + return | |
160 | + } | |
161 | + } | |
162 | + | |
116 | 163 | var th = this; |
117 | 164 | //--先判断会员状态-- |
118 | 165 | var user_info = getApp().globalData.userInfo; | ... | ... |
pages/user/assistance/task_assistance.js
... | ... | @@ -7,6 +7,7 @@ var e = getApp(), |
7 | 7 | s = e.globalData.setting, |
8 | 8 | os = s, |
9 | 9 | app_d = e.globalData; |
10 | + var invalidSetTime = null | |
10 | 11 | var regeneratorRuntime = require('../../../utils/runtime.js'); |
11 | 12 | Page({ |
12 | 13 | /** |
... | ... | @@ -65,7 +66,15 @@ Page({ |
65 | 66 | zltime: "", //助力时间 |
66 | 67 | djs: "", //定时器的显示 |
67 | 68 | //*********************************************end |
68 | - | |
69 | + //距离失效------ | |
70 | + invalidTime:0, | |
71 | + invalidState:true, | |
72 | + invalidObj:{ | |
73 | + h:'00', | |
74 | + m:'00', | |
75 | + s:'00' | |
76 | + }, | |
77 | + //-------------- | |
69 | 78 | // Hei: 0, |
70 | 79 | max_sw_height: 0, |
71 | 80 | |
... | ... | @@ -76,7 +85,7 @@ Page({ |
76 | 85 | font_color:'', |
77 | 86 | }, |
78 | 87 | |
79 | - /** | |
88 | + /** | |
80 | 89 | * 生命周期函数--监听页面加载 |
81 | 90 | */ |
82 | 91 | onLoad: function (options) { |
... | ... | @@ -443,6 +452,12 @@ Page({ |
443 | 452 | }, |
444 | 453 | //判断是否有领取任务 获取正在进行中的任务 |
445 | 454 | get_user_task: function () { |
455 | + invalidSetTime ? clearTimeout(invalidSetTime) :'' | |
456 | + this.setData({ | |
457 | + invalidObj:{ h:'00', m:'00',s:'00'}, | |
458 | + invalidState:true, | |
459 | + invalidTime:0 | |
460 | + }) | |
446 | 461 | var user_id = getApp().globalData.user_id; |
447 | 462 | var th = this; |
448 | 463 | var aitem = th.data.aitem; |
... | ... | @@ -452,18 +467,83 @@ Page({ |
452 | 467 | data: { |
453 | 468 | storeId: os.stoid, |
454 | 469 | userId: user_id, |
455 | - taskId: taskid | |
470 | + taskId: taskid | |
456 | 471 | }, |
457 | 472 | success: function (res) { |
473 | + console.log('任务---------------------------------------'); | |
474 | + console.log(res); | |
458 | 475 | if (res.data.code == 0) { |
459 | 476 | var is_usertask = res.data.data; |
460 | 477 | th.setData({ |
461 | - is_user_task: is_usertask | |
478 | + is_user_task: is_usertask, | |
462 | 479 | }); |
480 | + th.getInvalidTime(taskid) | |
463 | 481 | } |
464 | 482 | } |
465 | 483 | }) |
466 | 484 | }, |
485 | + //获取失效时间 | |
486 | + getInvalidTime(taskid){ | |
487 | + let th = this | |
488 | + rq.get("/api/weshop/marketing/giftbag/helpinfo/get", { | |
489 | + data: { | |
490 | + storeId: os.stoid, | |
491 | + // userId: user_id, | |
492 | + taskId: taskid, | |
493 | + helpId:th.data.help_id | |
494 | + }, | |
495 | + success: function (res) { | |
496 | + console.log('获取失效时间------'); | |
497 | + console.log(res); | |
498 | + if (res.data.code == 0) { | |
499 | + let openTime =th.data.is_user_task ? th.data.is_user_task.openTime : 0 | |
500 | + let validTime=res.data.data.validTime | |
501 | + let invalidTime =0 | |
502 | + if (openTime && validTime > 0) { | |
503 | + invalidTime = openTime*1 + validTime*60*60 | |
504 | + } | |
505 | + th.setData({ | |
506 | + invalidTime | |
507 | + }); | |
508 | + | |
509 | + th.invalid_count_down() //失效倒计时 | |
510 | + } | |
511 | + } | |
512 | + }) | |
513 | + }, | |
514 | + // 距离失效倒计时 | |
515 | + invalid_count_down(){ | |
516 | + | |
517 | + let invalidTime = this.data.invalidTime | |
518 | + let nowTime = parseInt((new Date().getTime())/1000) | |
519 | + if (invalidTime) { | |
520 | + let disTime = invalidTime - nowTime | |
521 | + if (disTime>0) { | |
522 | + let h = parseInt(disTime/(60*60)) | |
523 | + h = h*1 < 10 ? '0'+ h : h | |
524 | + let m= parseInt((disTime/60)%60) | |
525 | + m = m*1 < 10 ? '0' + m : m | |
526 | + let s = disTime % 60 | |
527 | + s = s*1 < 10 ? '0'+s : s | |
528 | + this.setData({ | |
529 | + 'invalidObj.h':h, | |
530 | + 'invalidObj.m':m, | |
531 | + 'invalidObj.s':s, | |
532 | + }) | |
533 | + invalidSetTime=setTimeout(this.invalid_count_down,1000) | |
534 | + }else{ | |
535 | + this.setData({ | |
536 | + invalidObj:{ h:'00', m:'00',s:'00'}, | |
537 | + invalidState:false | |
538 | + }) | |
539 | + } | |
540 | + }else{ | |
541 | + this.setData({ | |
542 | + invalidObj:{h:'00', m:'00',s:'00'} | |
543 | + }) | |
544 | + } | |
545 | + }, | |
546 | + | |
467 | 547 | //获取助力活动参与的人数 |
468 | 548 | get_user_task_num: function () { |
469 | 549 | var th = this; |
... | ... | @@ -686,11 +766,13 @@ Page({ |
686 | 766 | ///二微码 |
687 | 767 | var path3 = os.url + "/api/wx/open/app/user/getWeAppEwm/" + |
688 | 768 | os.stoid + "?sceneValue=" + scene + "&pageValue=pages/user/assistance/friend_assistance"; |
689 | - //读取文件成功则OK-- | |
769 | + console.log('二维码路径'); | |
770 | + console.log(path3); | |
771 | + //读取文件成功则OK-- | |
690 | 772 | wx.getImageInfo({ |
691 | 773 | src: path3, |
692 | 774 | success: function (res) { |
693 | - | |
775 | + | |
694 | 776 | var ewm_path = res.path; // |
695 | 777 | //var act_time="2019.06.26 - 2019.07.02"; //活动的时间 |
696 | 778 | var bg_time = ut.formar_no_full(th.data.dynamic.beginDate,'.'); |
... | ... | @@ -939,6 +1021,10 @@ Page({ |
939 | 1021 | |
940 | 1022 | //好友猜一猜 |
941 | 1023 | save_share: function (e) { |
1024 | + if (!this.data.invalidState) { | |
1025 | + getApp().showWarning("该任务已失效"); | |
1026 | + return | |
1027 | + } | |
942 | 1028 | var th = this; |
943 | 1029 | var aitem = this.data.aitem; //任务的数据集 |
944 | 1030 | var sw_index = this.data.sw_index; //轮播的下标 |
... | ... | @@ -987,7 +1073,7 @@ Page({ |
987 | 1073 | var block = th.data.block; |
988 | 1074 | if (images) { |
989 | 1075 | th.data.head_pic_arr.length = 0; |
990 | - for (var i in images) {s | |
1076 | + for (var i in images) { | |
991 | 1077 | var img_path = images[i].headPic; |
992 | 1078 | img_path=img_path.replace("http://thirdwx.qlogo.cn", "https://wx.qlogo.cn"); |
993 | 1079 | img_path=img_path.replace("https://thirdwx.qlogo.cn", "https://wx.qlogo.cn"); | ... | ... |
pages/user/assistance/task_assistance.wxml
... | ... | @@ -60,10 +60,11 @@ |
60 | 60 | 好友拆一拆 |
61 | 61 | </view> |
62 | 62 | <!-- 任务超时失效 --> |
63 | - <!-- <view wx:if="{{is_user_task!=null&&is_user_task.status==0}}"> | |
64 | - <text>距离失效</text> | |
65 | - <view><text>15</text>:<text>45</text>:<text>10</text></view> | |
66 | - </view> --> | |
63 | + <view class="invalid" wx:if="{{ is_user_task!=null && is_user_task.status==0 && invalidTime !=0}}"> | |
64 | + <text>距离失效:</text> | |
65 | + <view class="invalid_info" wx:if="{{invalidState}}"><text>{{invalidObj.h}}</text>:<text>{{invalidObj.m}}</text>:<text>{{invalidObj.s}}</text></view> | |
66 | + <view class="invalid_info" wx:else>该任务已失效</view> | |
67 | + </view> | |
67 | 68 | |
68 | 69 | <view wx:if="{{is_user_task!=null&&is_user_task.status==1}}" class="task_clike fs40 t-c flex-center" data-libaoid="{{is_user_task.helpListGiftBagId}}"data-taskingid="{{is_user_task.id}}" bindtap="redeem_now" |
69 | 70 | style="background-color:#{{btn_color ? btn_color:'fbda0e'}};color:{{font_color?('#'+font_color):'white'}};"> | ... | ... |
pages/user/assistance/task_assistance.wxss
... | ... | @@ -256,3 +256,25 @@ line-height: 48rpx; |
256 | 256 | image{ |
257 | 257 | -webkit-touch-callout:none |
258 | 258 | } |
259 | +.invalid{ | |
260 | + width: 100%; | |
261 | + height: 80rpx; | |
262 | + margin: 20rpx 0; | |
263 | + display: flex; | |
264 | + justify-content: center; | |
265 | + align-items: center; | |
266 | + color: #fff; | |
267 | + | |
268 | +} | |
269 | +.invalid_info{ | |
270 | + width: 180rpx; | |
271 | + padding: 10rpx; | |
272 | + color: #000; | |
273 | + background-color: #fff; | |
274 | + margin-left: 20rpx; | |
275 | + border: 1rpx solid #fff; | |
276 | + border-radius: 10rpx; | |
277 | + display: flex; | |
278 | + align-items: center; | |
279 | + justify-content: space-around; | |
280 | +} | |
259 | 281 | \ No newline at end of file | ... | ... |