Commit 09f6c6f4690c9f9438deb079d71867969a5ff380
1 parent
f1754d6f
OA 单 优惠券跳转对应商品、购物车失效商品、订单记录删除
Showing
15 changed files
with
775 additions
and
106 deletions
packageD/pages/user/coupons/coupons.js
@@ -11,10 +11,10 @@ const { | @@ -11,10 +11,10 @@ const { | ||
11 | qrcode | 11 | qrcode |
12 | } = require('../../../../utils/index.js'); | 12 | } = require('../../../../utils/index.js'); |
13 | let _this = null; | 13 | let _this = null; |
14 | - | 14 | + |
15 | Page({ | 15 | Page({ |
16 | data: { | 16 | data: { |
17 | - | 17 | + iurl: getApp().globalData.setting.imghost, |
18 | val:false, | 18 | val:false, |
19 | datet: "", | 19 | datet: "", |
20 | dates: "", | 20 | dates: "", |
@@ -96,9 +96,45 @@ Page({ | @@ -96,9 +96,45 @@ Page({ | ||
96 | 96 | ||
97 | 97 | ||
98 | }, | 98 | }, |
99 | - | 99 | + //跳转商品 |
100 | + nvShop(){ | ||
101 | + let url= '/pages/goods/goodsList/goodsList' | ||
102 | + getApp().goto(url) | ||
103 | + }, | ||
104 | + //跳转商品详情 | ||
105 | + nvShopInfo(e){ | ||
106 | + let useobjectid = e.currentTarget.dataset.useobjectid; | ||
107 | + //------------------------------------------------ | ||
108 | + getApp().request.get('/api/weshop/goods/list', { | ||
109 | + data: { | ||
110 | + store_id: os.stoid, | ||
111 | + erpwareid: useobjectid, | ||
112 | + }, | ||
113 | + success(res) { | ||
114 | + if (ut.ajax_ok2(res)) { | ||
115 | + let good = res.data.data; | ||
116 | + if (good.length>0) { | ||
117 | + let item = good[0] | ||
118 | + let url = `/pages/goods/goodsInfo/goodsInfo?goods_id=${item.goods_id}&prom_type=${item.prom_type}&prom_id=${item.prom_id}` | ||
119 | + getApp().goto(url) | ||
120 | + } | ||
121 | + } | ||
122 | + } | ||
123 | + }) | ||
100 | 124 | ||
101 | - | 125 | + |
126 | + | ||
127 | + // wx.reLaunch({ | ||
128 | + // url: '/pages/goods/goodsInfo/goodsInfo', | ||
129 | + // }) | ||
130 | + | ||
131 | + | ||
132 | + | ||
133 | + | ||
134 | + | ||
135 | + | ||
136 | + //------------------------------------------------ | ||
137 | + }, | ||
102 | 138 | ||
103 | // 点击选中二维码 | 139 | // 点击选中二维码 |
104 | click: function (e) { | 140 | click: function (e) { |
packageD/pages/user/coupons/coupons.wxml
@@ -20,11 +20,15 @@ | @@ -20,11 +20,15 @@ | ||
20 | <view class="fs28 ellipsis-1x">包邮券</view> | 20 | <view class="fs28 ellipsis-1x">包邮券</view> |
21 | <view class="fs24 c-7b pdt4 ellipsis-1x">微券来源: 微信商城</view> | 21 | <view class="fs24 c-7b pdt4 ellipsis-1x">微券来源: 微信商城</view> |
22 | </view> | 22 | </view> |
23 | - <view class="shrink0"><text class="btn {{currentIndex != 0 ? 'gray':''}}" bindtap="{{currentIndex == 0 ? 'clickUse':''}}" data-index="{{idx}}" data-cashrepno="{{detail.no}}">{{filter.showBtnText(currentIndex)}}</text></view> | 23 | + <view class="shrink0"><text class="btn {{currentIndex != 0 ? 'gray':''}}" bindtap="{{currentIndex == 0 ? 'nvShop':''}}" data-index="{{idx}}" data-cashrepno="{{detail.no}}">{{filter.showBtnText(currentIndex)}}</text></view> |
24 | </view> | 24 | </view> |
25 | - <view class="c-time"> | 25 | + <view class="flex jc_sb ai_c c-time"> |
26 | <text class="ellipsis-1x" wx:if="{{detail.use_end_time!=null}}">有效期:{{detail.use_start_time==null?" " : time.format_time(detail.use_start_time)}} 至 {{time.format_time(detail.use_end_time)}}</text> | 26 | <text class="ellipsis-1x" wx:if="{{detail.use_end_time!=null}}">有效期:{{detail.use_start_time==null?" " : time.format_time(detail.use_start_time)}} 至 {{time.format_time(detail.use_end_time)}}</text> |
27 | <text wx:else>有效期:不限</text> | 27 | <text wx:else>有效期:不限</text> |
28 | + <!-- <image bindtap="clickUse" data-index="{{idx}}" data-cashrepno="{{detail.no}}" style="height: 42rpx ;width: 42rpx;border: 2px solid #fe9db5;background: #fe9db5;" src="{{iurl}}/miniapp/images/qrcode1.png"></image> --> | ||
29 | + <image bindtap="clickUse" data-index="{{idx}}" data-cashrepno="{{detail.no}}" style="height: 52rpx ;width: 52rpx;" src="{{iurl}}/miniapp/images/qrcode_img.png"></image> | ||
30 | + <!-- <text class="iconfont icon-erweima" bindtap="clickUse" style="color: black;" data-index="{{idx}}" data-cashrepno="{{detail.no}}" ></text> --> | ||
31 | + | ||
28 | </view> | 32 | </view> |
29 | </view> | 33 | </view> |
30 | </view> | 34 | </view> |
@@ -46,15 +50,17 @@ | @@ -46,15 +50,17 @@ | ||
46 | <view class="fs24 c-7b pdt4 ellipsis-1x">微券来源: {{detail.SendMan==null?'线下发放':detail.SendMan==''?"线下发放":detail.SendMan}}</view> | 50 | <view class="fs24 c-7b pdt4 ellipsis-1x">微券来源: {{detail.SendMan==null?'线下发放':detail.SendMan==''?"线下发放":detail.SendMan}}</view> |
47 | </view> | 51 | </view> |
48 | <view class="shrink0"> | 52 | <view class="shrink0"> |
49 | - <text class="btn {{currentIndex != 0 ? 'gray':''}}" bindtap="{{currentIndex == 0 ? 'clickUse':''}}" data-index="{{idx}}" data-cashrepno="{{detail.CashRepNo}}">{{filter.showBtnText(currentIndex)}}</text> | 53 | + <text class="btn {{currentIndex != 0 ? 'gray':''}}" bindtap="{{currentIndex == 0 ? ( detail.UseObjectID==null || detail.UseObjectID== '' ? 'nvShop' : (detail.UseObjectType==20 ? 'nvShopInfo' :'clickUse') ):''}}" data-index="{{idx}}" data-cashrepno="{{detail.CashRepNo}}" data-useobjectid="{{detail.UseObjectID}}">{{filter.showBtnText(currentIndex)}}</text> |
50 | </view> | 54 | </view> |
51 | </view> | 55 | </view> |
52 | - <view class="c-time"> | 56 | + <view class="c-time flex jc_sb ai_c"> |
53 | <text wx:if="{{detail.ValidDate}}" class="ellipsis-1x">有效期:{{detail.BeginDate==null ? " " : time.replace_time2(detail.BeginDate)}} 至 {{time.replace_time2(detail.ValidDate)}}</text> | 57 | <text wx:if="{{detail.ValidDate}}" class="ellipsis-1x">有效期:{{detail.BeginDate==null ? " " : time.replace_time2(detail.BeginDate)}} 至 {{time.replace_time2(detail.ValidDate)}}</text> |
54 | <text wx:else>有效期:不限</text> | 58 | <text wx:else>有效期:不限</text> |
59 | + <!-- <image wx:if="{{detail.UseObjectID==null || detail.UseObjectID=='' || detail.UseObjectType==20}}" bindtap="{{currentIndex == 0 ? 'clickUse':''}}" data-index="{{idx}}" data-cashrepno="{{detail.CashRepNo}}" style="height: 42rpx ;width: 42rpx;border: 2px solid #fe9db5;background: #fe9db5;" src="{{iurl}}/miniapp/images/qrcode1.png"></image> --> | ||
60 | + <image wx:if="{{detail.UseObjectID==null || detail.UseObjectID=='' || detail.UseObjectType==20}}" bindtap="{{currentIndex == 0 ? 'clickUse':''}}" data-index="{{idx}}" data-cashrepno="{{detail.CashRepNo}}" style="height: 52rpx ;width: 52rpx;" src="{{iurl}}/miniapp/images/qrcode_img.png"></image> | ||
55 | </view> | 61 | </view> |
56 | </view> | 62 | </view> |
57 | - </view> | 63 | + </view> |
58 | </view> | 64 | </view> |
59 | <view class="c-info arrow-down {{detail.isShowDetails ? 'active':''}}" bindtap="clickDetails" data-index="{{idx}}"> | 65 | <view class="c-info arrow-down {{detail.isShowDetails ? 'active':''}}" bindtap="clickDetails" data-index="{{idx}}"> |
60 | <view class="{{detail.isShowDetails ? '':'ellipsis-1x'}}" wx:if="{{detail.Remark1!=''}}"><text style="margin-right: 15rpx">使用说明:</text>{{filter.getNum(detail.Sum)}}元优惠券,{{(detail.UseObjectID==null || detail.UseObjectID=='')?"全场通用":"仅限"+(detail.UseObjectName)+"使用"}},满 {{detail.BuySum==null || detail.BuySum==''?filter.getNum(0):filter.getNum(detail.BuySum)}}元使用 {{detail.region_list_name==null || detail.region_list_name==''?"":",不包邮地区:"+region_list_name}};{{detail.Remark1}};活动名称:{{detail.ActName}}、活动编号:{{detail.ActNo}}</view> | 66 | <view class="{{detail.isShowDetails ? '':'ellipsis-1x'}}" wx:if="{{detail.Remark1!=''}}"><text style="margin-right: 15rpx">使用说明:</text>{{filter.getNum(detail.Sum)}}元优惠券,{{(detail.UseObjectID==null || detail.UseObjectID=='')?"全场通用":"仅限"+(detail.UseObjectName)+"使用"}},满 {{detail.BuySum==null || detail.BuySum==''?filter.getNum(0):filter.getNum(detail.BuySum)}}元使用 {{detail.region_list_name==null || detail.region_list_name==''?"":",不包邮地区:"+region_list_name}};{{detail.Remark1}};活动名称:{{detail.ActName}}、活动编号:{{detail.ActNo}}</view> |
pages/cart/cart/cart.js
@@ -28,6 +28,7 @@ Page({ | @@ -28,6 +28,7 @@ Page({ | ||
28 | up_dating: 0, //更新中 | 28 | up_dating: 0, //更新中 |
29 | isreduce: 0, //商品数量是否可减 | 29 | isreduce: 0, //商品数量是否可减 |
30 | isadd: 0, //是否可以加商品数量 | 30 | isadd: 0, //是否可以加商品数量 |
31 | + invalidList:[], //失效商品列表 | ||
31 | 32 | ||
32 | card_field:"", | 33 | card_field:"", |
33 | bconf:null, | 34 | bconf:null, |
@@ -65,7 +66,9 @@ Page({ | @@ -65,7 +66,9 @@ Page({ | ||
65 | onShow: function () { | 66 | onShow: function () { |
66 | //每次显示都清空 | 67 | //每次显示都清空 |
67 | this.data.in_zhact_gdmap = {}; | 68 | this.data.in_zhact_gdmap = {}; |
68 | - | 69 | + this.setData({ |
70 | + invalidList:[] | ||
71 | + }); | ||
69 | 72 | ||
70 | if (typeof this.getTabBar === 'function' && this.getTabBar()) { | 73 | if (typeof this.getTabBar === 'function' && this.getTabBar()) { |
71 | var index = getApp().getPageIndex(this); | 74 | var index = getApp().getPageIndex(this); |
@@ -164,9 +167,39 @@ Page({ | @@ -164,9 +167,39 @@ Page({ | ||
164 | onUnLoad() { | 167 | onUnLoad() { |
165 | getApp().globalData.cart_zh_act = null; | 168 | getApp().globalData.cart_zh_act = null; |
166 | }, | 169 | }, |
170 | + | ||
171 | + //失效商品处理 | ||
172 | + // invType 表示失效的原因,classType 表示类别 0 表示商品,1表示服务 | ||
173 | + disInvalid(item,invType=0,classType=0){ | ||
174 | + let invalidList = this.data.invalidList; | ||
175 | + let off = true; | ||
176 | + console.log('失效商品-----1') | ||
177 | + console.log(item) | ||
178 | + console.log('失效商品-----2') | ||
179 | + invalidList.map(ite=>{ | ||
180 | + if(classType ==0 && ite.goods_id == item.goods_id){ //判断该商品是否存在于失效列表中 | ||
181 | + off = false; | ||
182 | + } | ||
183 | + if(classType ==1 && ite.service_id == item.service_id){ //判断该商品是否存在于失效列表中 | ||
184 | + off = false; | ||
185 | + } | ||
186 | + }); | ||
187 | + if(off){ | ||
188 | + if(invType==0){ | ||
189 | + item.invalid = '商品活动变动'; | ||
190 | + }else if(invType ==1){ | ||
191 | + item.invalid = '商品已下架'; | ||
192 | + }else{ | ||
193 | + item.invalid ="商品超出限购" | ||
194 | + } | ||
195 | + item.classType = classType | ||
196 | + invalidList.push(item); | ||
197 | + this.setData({invalidList}); | ||
198 | + } | ||
199 | + }, | ||
167 | //-------------获取购物车列表,要安装门店进行分类订单----------- | 200 | //-------------获取购物车列表,要安装门店进行分类订单----------- |
168 | getCardList: function () { | 201 | getCardList: function () { |
169 | - | 202 | + this.setData({invalidList:[]}); //重置失效商品 |
170 | var th = this; | 203 | var th = this; |
171 | 204 | ||
172 | //要获取会员是不是等级会员 | 205 | //要获取会员是不是等级会员 |
@@ -218,6 +251,156 @@ Page({ | @@ -218,6 +251,156 @@ Page({ | ||
218 | }, 800) | 251 | }, 800) |
219 | } | 252 | } |
220 | }, | 253 | }, |
254 | + //失效单选 | ||
255 | + inCheck_th_item: async function(e){ | ||
256 | + console.log('失效单选'); | ||
257 | + console.log(e); | ||
258 | + let i = e.currentTarget.dataset.item; | ||
259 | + let invalidList = this.data.invalidList; | ||
260 | + console.log(i) | ||
261 | + console.log(invalidList[i]) | ||
262 | + invalidList[i].selected = invalidList[i].selected == 1 ? 0 : 1; | ||
263 | + console.log(invalidList); | ||
264 | + this.setData({invalidList}); | ||
265 | + console.log(this.data.invalidList); | ||
266 | + // this.doCheckAll(); | ||
267 | + | ||
268 | + }, | ||
269 | + //清空失效宝贝 | ||
270 | + delInva(obj=null){ | ||
271 | + let ainvalid=''; | ||
272 | + let binvalid=''; | ||
273 | + var user_id = getApp().globalData.user_id; | ||
274 | + var th = this; | ||
275 | + let ab = 0; //选中 | ||
276 | + let abc = 0; // | ||
277 | + let arr = obj.id ? [obj] : this.data.invalidList | ||
278 | + console.log('失效-----') | ||
279 | + console.log(arr); | ||
280 | + arr.map(item=>{ | ||
281 | + if (item.classType ==0 ) { | ||
282 | + ainvalid+=item.id + ','; | ||
283 | + ab = 1; | ||
284 | + } | ||
285 | + if (item.classType ==1 ) { | ||
286 | + binvalid+=item.id + ','; | ||
287 | + abc = 1; | ||
288 | + } | ||
289 | + }); | ||
290 | + | ||
291 | + | ||
292 | + if (ab == 0 && abc == 0 ) { | ||
293 | + t.my_warnning('没有需要清空的失效宝贝', 0, th); | ||
294 | + return false; | ||
295 | + } | ||
296 | + if (ab) { | ||
297 | + ainvalid = ainvalid.substring(0, ainvalid.length - 1); | ||
298 | + //要删除购物车中的商品 | ||
299 | + var url = '/api/weshop/cart/delIds/' + oo.stoid + '/' + user_id + '/' + ainvalid; | ||
300 | + getApp().request.delete(url, { | ||
301 | + success: function (t) { | ||
302 | + th.getCardList(); | ||
303 | + getApp().requestCardNum(th); | ||
304 | + } | ||
305 | + }); | ||
306 | + } | ||
307 | + if (abc) { | ||
308 | + binvalid = binvalid.substring(0, binvalid.length - 1); | ||
309 | + //要删除购物车中的商品 | ||
310 | + var url = '/api/weshop/cartService/delIds/' + oo.stoid + '/' + user_id + '/' + binvalid; | ||
311 | + getApp().request.delete(url, { | ||
312 | + success: function (t) { | ||
313 | + th.getCardList(); | ||
314 | + getApp().requestCardNum(th); | ||
315 | + } | ||
316 | + }); | ||
317 | + } | ||
318 | + }, | ||
319 | + | ||
320 | + //---------点击收藏------------ | ||
321 | + collectGoods: async function () { | ||
322 | + | ||
323 | + let t = this | ||
324 | + let timestamp = Date.parse(new Date()); | ||
325 | + timestamp = timestamp / 1000; | ||
326 | + let d = { | ||
327 | + // goods_id: t.data.data.goods_id, | ||
328 | + user_id: app.globalData.user_id, | ||
329 | + store_id: oo.stoid, | ||
330 | + add_time: timestamp, | ||
331 | + }; | ||
332 | + //加入收藏夹就是导购的ID | ||
333 | + if (getApp().globalData.guide_id) { | ||
334 | + d.guide_id = getApp().globalData.guide_id; | ||
335 | + d.guide_type = 2; | ||
336 | + } | ||
337 | + let off = false | ||
338 | + let errOff = false | ||
339 | + var invalidList= [...this.data.invalidList] | ||
340 | + var arr=[] | ||
341 | + invalidList.map(async (item,index)=>{ | ||
342 | + if (item.selected) { | ||
343 | + off = true | ||
344 | + if(item.classType ==1 ){ | ||
345 | + d.goods_id = item.service_id | ||
346 | + d.type = 1 | ||
347 | + }else{ | ||
348 | + d.goods_id = item.goods_id | ||
349 | + d.type =0 | ||
350 | + } | ||
351 | + let is_collect = 0 | ||
352 | + //------是否收藏---------- | ||
353 | + await getApp().request.promiseGet("/api/weshop/goodscollect/page", { | ||
354 | + data: { | ||
355 | + store_id: oo.stoid, | ||
356 | + goods_id: d.goods_id, | ||
357 | + user_id: app.globalData.user_id, | ||
358 | + } | ||
359 | + }).then(res => { | ||
360 | + let t = res; | ||
361 | + let data = t.data.data.pageData; | ||
362 | + if (data && data.length > 0) { | ||
363 | + is_collect =1 | ||
364 | + } | ||
365 | + }) | ||
366 | + if (is_collect) { | ||
367 | + t.delInva(item) | ||
368 | + return | ||
369 | + } | ||
370 | + await getApp().request.post("/api/weshop/goodscollect/save", { //添加收藏 | ||
371 | + data: d, | ||
372 | + success: function (e) { | ||
373 | + t.data.is_collect_load = 0; | ||
374 | + if (e.data.code == 0) { | ||
375 | + t.delInva(item) | ||
376 | + }else{ | ||
377 | + errOff = true | ||
378 | + arr.push(item) | ||
379 | + } | ||
380 | + } | ||
381 | + }); | ||
382 | + }else{ | ||
383 | + arr.push(item) | ||
384 | + } | ||
385 | + }); | ||
386 | + if (off) { | ||
387 | + t.setData({ | ||
388 | + invalidList:arr | ||
389 | + }) | ||
390 | + if (errOff) { | ||
391 | + getApp().my_warnning('移到收藏夹错误', 0, t); | ||
392 | + }else{ | ||
393 | + wx.showToast({ | ||
394 | + title: "收藏成功", | ||
395 | + icon: 'none', | ||
396 | + duration: 2000 | ||
397 | + }) | ||
398 | + } | ||
399 | + console.log('移动成功') | ||
400 | + }else{ | ||
401 | + getApp().my_warnning('请先选择失效宝贝', 0, t); | ||
402 | + } | ||
403 | + }, | ||
221 | 404 | ||
222 | //-----真的获取购物车-------- | 405 | //-----真的获取购物车-------- |
223 | get_cart: function () { | 406 | get_cart: function () { |
@@ -287,10 +470,11 @@ Page({ | @@ -287,10 +470,11 @@ Page({ | ||
287 | var tt = ut.gettimestamp(); | 470 | var tt = ut.gettimestamp(); |
288 | //如果商品下架了,或者商品是赠品,一开始都要清除 | 471 | //如果商品下架了,或者商品是赠品,一开始都要清除 |
289 | if ((good.down_time > 0 && good.down_time < tt) || good.is_on_sale == 0) { | 472 | if ((good.down_time > 0 && good.down_time < tt) || good.is_on_sale == 0) { |
290 | - var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id; | ||
291 | - getApp().request.delete(url, { | ||
292 | - success: function (t) {} | ||
293 | - }); | 473 | + // var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id; |
474 | + // getApp().request.delete(url, { | ||
475 | + // success: function (t) {} | ||
476 | + // }); | ||
477 | + th.disInvalid(item,1); | ||
294 | //商品已经下架 | 478 | //商品已经下架 |
295 | continue; | 479 | continue; |
296 | } | 480 | } |
@@ -307,8 +491,9 @@ Page({ | @@ -307,8 +491,9 @@ Page({ | ||
307 | if (item.goods_num + goodsbuynum > limit && limit > 0) { | 491 | if (item.goods_num + goodsbuynum > limit && limit > 0) { |
308 | var cbuy = limit - goodsbuynum; | 492 | var cbuy = limit - goodsbuynum; |
309 | if (cbuy <= 0) { | 493 | if (cbuy <= 0) { |
310 | - var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id; | ||
311 | - a.delete(url, {}); | 494 | + // var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id; |
495 | + // a.delete(url, {}); | ||
496 | + th.disInvalid(item,2); | ||
312 | continue; | 497 | continue; |
313 | } | 498 | } |
314 | //-- 购物车更新 -- | 499 | //-- 购物车更新 -- |
@@ -323,23 +508,72 @@ Page({ | @@ -323,23 +508,72 @@ Page({ | ||
323 | }) | 508 | }) |
324 | item.goods_num = cbuy; | 509 | item.goods_num = cbuy; |
325 | } | 510 | } |
326 | - | 511 | + //判断如果是普通商品,后面参加活动了,变成失效商品 |
512 | + if (item.prom_type == 0) { | ||
513 | + var prom = null; | ||
514 | + var now = ut.gettimestamp(); | ||
515 | + await getApp().request.promiseGet(`/api/weshop/activitylist/listGoodActInfo2`, { | ||
516 | + data:{ | ||
517 | + "store_id": oo.stoid, | ||
518 | + "goods_id": item.goods_id, | ||
519 | + "user_id": user_id, | ||
520 | + } | ||
521 | + }).then(res => { | ||
522 | + if (res.data.code == 0) { | ||
523 | + prom = res.data.data | ||
524 | + } | ||
525 | + }) | ||
526 | + let prom_true = 0 | ||
527 | + let prom_id=0 | ||
528 | + if (prom) { | ||
529 | + prom.map(item=>{ | ||
530 | + if (item.prom_type==3 || item.prom_type==7) { | ||
531 | + prom_true = item.prom_type | ||
532 | + prom_id = item.act_id | ||
533 | + } | ||
534 | + }) | ||
535 | + } | ||
536 | + if (prom_true) { | ||
537 | + //-- 购物车更新 -- | ||
538 | + var updata1 = { | ||
539 | + id: item.id, | ||
540 | + prom_type: prom_true, | ||
541 | + prom_id, | ||
542 | + store_id: os.stoid, | ||
543 | + user_id: getApp().globalData.userInfo.user_id | ||
544 | + }; | ||
545 | + item.prom_id = prom_id | ||
546 | + item.prom_type = prom_true | ||
547 | + getApp().request.put("/api/weshop/cart/update", { | ||
548 | + data: updata1, | ||
549 | + }) | ||
550 | + | ||
551 | + }else{ | ||
552 | + if(prom && !item.is_integral_normal && !item.is_pd_normal){ | ||
553 | + th.disInvalid(item); | ||
554 | + continue; | ||
555 | + } | ||
556 | + } | ||
557 | + } | ||
327 | //如果秒杀活动都去掉了,或者结束了,那么这个商品也没有必要留着 | 558 | //如果秒杀活动都去掉了,或者结束了,那么这个商品也没有必要留着 |
328 | if (item.prom_type == 1) { | 559 | if (item.prom_type == 1) { |
329 | var prom = null; | 560 | var prom = null; |
330 | var now = ut.gettimestamp(); | 561 | var now = ut.gettimestamp(); |
331 | await getApp().request.promiseGet("/api/ms/flash_sale/getNew/" + os.stoid + '/' + user_id + "/" + item.prom_id, {}).then(res => { | 562 | await getApp().request.promiseGet("/api/ms/flash_sale/getNew/" + os.stoid + '/' + user_id + "/" + item.prom_id, {}).then(res => { |
332 | - if (res.data.code == 0) { | 563 | + console.log('活动情况----------------') |
564 | + console.log(res) | ||
565 | + if (res.data.code == 0) { | ||
333 | prom = res.data.data; | 566 | prom = res.data.data; |
334 | prom.price = prom.user_price; | 567 | prom.price = prom.user_price; |
335 | } | 568 | } |
336 | }) | 569 | }) |
337 | //---如果互动都已经过期,或者还未开始,或者无活动 | 570 | //---如果互动都已经过期,或者还未开始,或者无活动 |
338 | if (!prom || prom.is_end == 1 || prom.end_time < now || prom.start_time > now) { | 571 | if (!prom || prom.is_end == 1 || prom.end_time < now || prom.start_time > now) { |
339 | - var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id; | ||
340 | - a.delete(url, { | ||
341 | - success: function (t) {} | ||
342 | - }); | 572 | + // var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id; |
573 | + // a.delete(url, { | ||
574 | + // success: function (t) {} | ||
575 | + // }); | ||
576 | + th.disInvalid(item); | ||
343 | //商品已经下架 | 577 | //商品已经下架 |
344 | continue; | 578 | continue; |
345 | } | 579 | } |
@@ -348,8 +582,9 @@ Page({ | @@ -348,8 +582,9 @@ Page({ | ||
348 | if (item.goods_num + promgoodsbuynum > prom.buy_limit && prom.buy_limit > 0) { | 582 | if (item.goods_num + promgoodsbuynum > prom.buy_limit && prom.buy_limit > 0) { |
349 | var cbuy = prom.buy_limit - promgoodsbuynum; | 583 | var cbuy = prom.buy_limit - promgoodsbuynum; |
350 | if (cbuy <= 0) { | 584 | if (cbuy <= 0) { |
351 | - var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id; | ||
352 | - a.delete(url, {}); | 585 | + // var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id; |
586 | + // a.delete(url, {}); | ||
587 | + th.disInvalid(item,2); | ||
353 | continue; | 588 | continue; |
354 | } | 589 | } |
355 | //-- 购物车更新 -- | 590 | //-- 购物车更新 -- |
@@ -380,6 +615,30 @@ Page({ | @@ -380,6 +615,30 @@ Page({ | ||
380 | }) | 615 | }) |
381 | } | 616 | } |
382 | } | 617 | } |
618 | + // 判断团购活动都去掉了,或者结束了,那么这个商品也没有必要留着 | ||
619 | + else if(item.prom_type ==2){ | ||
620 | + var prom = null; | ||
621 | + var now = ut.gettimestamp(); | ||
622 | + await getApp().request.promiseGet('/api/weshop/goods/groupBuy/getActInfo/' + item.goods_id + '/' + user_id + '/' + item.prom_id, {}).then(res => { | ||
623 | + if (res.data.code == 0) { | ||
624 | + prom = res.data.data; | ||
625 | + prom.price = prom.user_price; | ||
626 | + } | ||
627 | + }); | ||
628 | + //---如果互动都已经过期,或者还未开始,或者无活动 | ||
629 | + if (!prom || prom.is_end == 1 || prom.end_time < now || prom.start_time > now) { | ||
630 | + // var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id; | ||
631 | + // a.delete(url, { | ||
632 | + // success: function (t) {} | ||
633 | + // }); | ||
634 | + console.log('团购活动-----'); | ||
635 | + th.disInvalid(item); | ||
636 | + //商品已经下架 | ||
637 | + continue; | ||
638 | + } | ||
639 | + | ||
640 | + | ||
641 | + } | ||
383 | //--判断优惠活动有没有过期,-- | 642 | //--判断优惠活动有没有过期,-- |
384 | else if (item.prom_type == 3) { | 643 | else if (item.prom_type == 3) { |
385 | var isok = 1,is_g_prom=0; | 644 | var isok = 1,is_g_prom=0; |
@@ -405,23 +664,26 @@ Page({ | @@ -405,23 +664,26 @@ Page({ | ||
405 | if (res.data.code == 0) { | 664 | if (res.data.code == 0) { |
406 | var r_data = res.data.data; | 665 | var r_data = res.data.data; |
407 | if (!r_data.promGoodsLists) { | 666 | if (!r_data.promGoodsLists) { |
408 | - var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id; | ||
409 | - getApp().request.delete(url, {}); | 667 | + // var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id; |
668 | + // getApp().request.delete(url, {}); | ||
669 | + th.disInvalid(item); | ||
410 | //商品已经无活动 | 670 | //商品已经无活动 |
411 | isok = 0; | 671 | isok = 0; |
412 | } else { | 672 | } else { |
413 | //如果活动的ID不一样,说明原先的活动已经没有参与了或者过期了 | 673 | //如果活动的ID不一样,说明原先的活动已经没有参与了或者过期了 |
414 | if (item.prom_id != r_data.promGoodsLists[0].prom_id) { | 674 | if (item.prom_id != r_data.promGoodsLists[0].prom_id) { |
415 | - var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id; | ||
416 | - getApp().request.delete(url, {}); | 675 | + // var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id; |
676 | + // getApp().request.delete(url, {}); | ||
677 | + th.disInvalid(item); | ||
417 | //商品已经下架 | 678 | //商品已经下架 |
418 | isok = 0; | 679 | isok = 0; |
419 | } | 680 | } |
420 | } | 681 | } |
421 | 682 | ||
422 | } else { | 683 | } else { |
423 | - var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id; | ||
424 | - getApp().request.delete(url, {}); | 684 | + // var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id; |
685 | + // getApp().request.delete(url, {}); | ||
686 | + th.disInvalid(item); | ||
425 | //商品已经下架 | 687 | //商品已经下架 |
426 | isok = 0; | 688 | isok = 0; |
427 | } | 689 | } |
@@ -432,23 +694,26 @@ Page({ | @@ -432,23 +694,26 @@ Page({ | ||
432 | if (res.data.code == 0) { | 694 | if (res.data.code == 0) { |
433 | var r_data = res.data.data; | 695 | var r_data = res.data.data; |
434 | if (!r_data.promGoodsLists) { | 696 | if (!r_data.promGoodsLists) { |
435 | - var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id; | ||
436 | - getApp().request.delete(url, {}); | 697 | + // var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id; |
698 | + // getApp().request.delete(url, {}); | ||
699 | + th.disInvalid(item); | ||
437 | //商品已经无活动 | 700 | //商品已经无活动 |
438 | isok = 0; | 701 | isok = 0; |
439 | } else { | 702 | } else { |
440 | //如果活动的ID不一样,说明原先的活动已经没有参与了或者过期了 | 703 | //如果活动的ID不一样,说明原先的活动已经没有参与了或者过期了 |
441 | if (item.prom_id != r_data.promGoodsLists[0].prom_id) { | 704 | if (item.prom_id != r_data.promGoodsLists[0].prom_id) { |
442 | - var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id; | ||
443 | - getApp().request.delete(url, {}); | 705 | + // var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id; |
706 | + // getApp().request.delete(url, {}); | ||
707 | + th.disInvalid(item); | ||
444 | //商品已经下架 | 708 | //商品已经下架 |
445 | isok = 0; | 709 | isok = 0; |
446 | } | 710 | } |
447 | } | 711 | } |
448 | 712 | ||
449 | } else { | 713 | } else { |
450 | - var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id; | ||
451 | - getApp().request.delete(url, {}); | 714 | + // var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id; |
715 | + // getApp().request.delete(url, {}); | ||
716 | + th.disInvalid(item,1); | ||
452 | //商品已经下架 | 717 | //商品已经下架 |
453 | isok = 0; | 718 | isok = 0; |
454 | } | 719 | } |
@@ -492,8 +757,9 @@ Page({ | @@ -492,8 +757,9 @@ Page({ | ||
492 | } | 757 | } |
493 | }) | 758 | }) |
494 | if (!isok) { | 759 | if (!isok) { |
495 | - var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id; | ||
496 | - getApp().request.delete(url, {}); | 760 | + // var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id; |
761 | + // getApp().request.delete(url, {}); | ||
762 | + th.disInvalid(item); | ||
497 | th.data.zuhe_map[item.prom_id] = -1; | 763 | th.data.zuhe_map[item.prom_id] = -1; |
498 | continue; | 764 | continue; |
499 | } | 765 | } |
@@ -530,8 +796,9 @@ Page({ | @@ -530,8 +796,9 @@ Page({ | ||
530 | return ele.goods_id == item.goods_id | 796 | return ele.goods_id == item.goods_id |
531 | }) | 797 | }) |
532 | if (!t_item) { | 798 | if (!t_item) { |
533 | - var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id; | ||
534 | - getApp().request.delete(url, {}); | 799 | + // var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id; |
800 | + // getApp().request.delete(url, {}); | ||
801 | + th.disInvalid(item,1); | ||
535 | th.data.zuhe_map[item.prom_id] = -1; | 802 | th.data.zuhe_map[item.prom_id] = -1; |
536 | continue; | 803 | continue; |
537 | } | 804 | } |
@@ -578,8 +845,9 @@ Page({ | @@ -578,8 +845,9 @@ Page({ | ||
578 | } | 845 | } |
579 | }) | 846 | }) |
580 | if (!isok){ | 847 | if (!isok){ |
581 | - var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id; | ||
582 | - getApp().request.delete(url, {}); | 848 | + // var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id; |
849 | + // getApp().request.delete(url, {}); | ||
850 | + th.disInvalid(item,1); | ||
583 | th.data.ladder_map[item.prom_id]=-1; | 851 | th.data.ladder_map[item.prom_id]=-1; |
584 | continue; | 852 | continue; |
585 | } | 853 | } |
@@ -818,6 +1086,7 @@ Page({ | @@ -818,6 +1086,7 @@ Page({ | ||
818 | //-----真的获取购物车-------- | 1086 | //-----真的获取购物车-------- |
819 | get_ser_cart: function () { | 1087 | get_ser_cart: function () { |
820 | var th = this; | 1088 | var th = this; |
1089 | + var user_id = getApp().globalData.user_id; | ||
821 | var rd = Math.random().toString(36).substr(2, 15); | 1090 | var rd = Math.random().toString(36).substr(2, 15); |
822 | getApp().request.get("/api/weshop/cartService/page", { | 1091 | getApp().request.get("/api/weshop/cartService/page", { |
823 | data: { | 1092 | data: { |
@@ -841,23 +1110,101 @@ Page({ | @@ -841,23 +1110,101 @@ Page({ | ||
841 | good = res.data.data; | 1110 | good = res.data.data; |
842 | }) | 1111 | }) |
843 | if (!good) { | 1112 | if (!good) { |
844 | - var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id; | ||
845 | - getApp().request.delete(url, { | ||
846 | - success: function (t) {} | ||
847 | - }); | 1113 | + // var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id; |
1114 | + // getApp().request.delete(url, { | ||
1115 | + // success: function (t) {} | ||
1116 | + // }); | ||
1117 | + th.disInvalid({ | ||
1118 | + ...item, | ||
1119 | + original_img: good.imgUrl | ||
1120 | + },1,1); | ||
848 | continue; | 1121 | continue; |
849 | } | 1122 | } |
850 | - | 1123 | + |
851 | //如果商品下架了,或者商品是赠品,一开始都要清除 | 1124 | //如果商品下架了,或者商品是赠品,一开始都要清除 |
852 | if (good.is_show == 0) { | 1125 | if (good.is_show == 0) { |
853 | - var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id; | ||
854 | - getApp().request.delete(url, { | ||
855 | - success: function (t) {} | ||
856 | - }); | 1126 | + // var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id; |
1127 | + // getApp().request.delete(url, { | ||
1128 | + // success: function (t) {} | ||
1129 | + // }); | ||
1130 | + th.disInvalid({ | ||
1131 | + ...item, | ||
1132 | + original_img: good.imgUrl | ||
1133 | + },1,1); | ||
857 | //商品已经下架 | 1134 | //商品已经下架 |
858 | continue; | 1135 | continue; |
859 | } | 1136 | } |
860 | 1137 | ||
1138 | + if(item.prom_type ==0){ | ||
1139 | + var prom = null; | ||
1140 | + var now = ut.gettimestamp(); | ||
1141 | + await getApp().request.promiseGet(`/api/weshop/activitylist/listGoodActInfo2`, { | ||
1142 | + data:{ | ||
1143 | + store_id: oo.stoid, | ||
1144 | + goods_id: item.service_id, | ||
1145 | + user_id: user_id, | ||
1146 | + goods_type: 1, | ||
1147 | + } | ||
1148 | + }).then(res => { | ||
1149 | + console.log('服务卡活动信息') | ||
1150 | + console.log(res) | ||
1151 | + console.log('服务卡活动信息-------------') | ||
1152 | + if (res.data.code == 0) { | ||
1153 | + prom = res.data.data | ||
1154 | + } | ||
1155 | + }) | ||
1156 | + if(prom){ | ||
1157 | + th.disInvalid({ | ||
1158 | + ...item, | ||
1159 | + original_img: good.imgUrl | ||
1160 | + },2,1) | ||
1161 | + continue; | ||
1162 | + } | ||
1163 | + } | ||
1164 | + | ||
1165 | + if (item.prom_type == 1) { | ||
1166 | + var prom = null; | ||
1167 | + var now = ut.gettimestamp(); | ||
1168 | + await getApp().request.promiseGet('/api/ms/flash_sale/getNew/' + os.stoid + '/' + user_id + '/' + item.prom_id, {}).then(res => { | ||
1169 | + if (res.data.code == 0) { | ||
1170 | + prom = res.data.data; | ||
1171 | + prom.price = prom.user_price; | ||
1172 | + } | ||
1173 | + }); | ||
1174 | + console.log('服务的秒杀信息') | ||
1175 | + console.log(prom) | ||
1176 | + //---如果互动都已经过期,或者还未开始,或者无活动 | ||
1177 | + if (!prom || prom.is_end == 1 || prom.end_time < now || prom.start_time > now) { | ||
1178 | + th.disInvalid({ | ||
1179 | + ...item, | ||
1180 | + original_img: good.imgUrl | ||
1181 | + },0,1); | ||
1182 | + continue; | ||
1183 | + } | ||
1184 | + //判断秒杀的限购 | ||
1185 | + var msNum=0 | ||
1186 | + await getApp().request.promiseGet("/api/weshop/rechargeServicelist/getUserBuyGoodsNum", { | ||
1187 | + data: { | ||
1188 | + store_id: os.stoid, | ||
1189 | + user_id: user_id, | ||
1190 | + card_id: prom.goods_id, | ||
1191 | + } | ||
1192 | + }).then(res=>{ | ||
1193 | + if (res.data.code==0) { | ||
1194 | + msNum = res.data.data.cardbuynum | ||
1195 | + console.log('秒杀限购:'+msNum) | ||
1196 | + } | ||
1197 | + }) | ||
1198 | + } | ||
1199 | + if (msNum && (msNum >= prom.buy_limit) ) { | ||
1200 | + console.log('秒杀限购') | ||
1201 | + th.disInvalid({ | ||
1202 | + ...item, | ||
1203 | + original_img: good.imgUrl | ||
1204 | + },2,1) | ||
1205 | + continue; | ||
1206 | + } | ||
1207 | + | ||
861 | all_num += item.goods_num; | 1208 | all_num += item.goods_num; |
862 | item.img_url = oo.imghost + good.imgUrl; | 1209 | item.img_url = oo.imghost + good.imgUrl; |
863 | item.selected = 0; | 1210 | item.selected = 0; |
@@ -912,6 +1259,7 @@ Page({ | @@ -912,6 +1259,7 @@ Page({ | ||
912 | }, | 1259 | }, |
913 | 1260 | ||
914 | 1261 | ||
1262 | + | ||
915 | //设置莫个门店的所有线下价格 | 1263 | //设置莫个门店的所有线下价格 |
916 | async set_offline(list) { | 1264 | async set_offline(list) { |
917 | var th = this; | 1265 | var th = this; |
@@ -1625,6 +1973,11 @@ Page({ | @@ -1625,6 +1973,11 @@ Page({ | ||
1625 | } else { | 1973 | } else { |
1626 | if(item[c].prom_type==7){ | 1974 | if(item[c].prom_type==7){ |
1627 | //先把商品放入组合计算的专用的区域 | 1975 | //先把商品放入组合计算的专用的区域 |
1976 | + console.log('是组合商品---') | ||
1977 | + console.log(car); | ||
1978 | + console.log(a) | ||
1979 | + console.log(obj) | ||
1980 | + console.log('......................') | ||
1628 | zh_calc.add_zhprom(car,a,obj); | 1981 | zh_calc.add_zhprom(car,a,obj); |
1629 | }else if(item[c].prom_type==10){ | 1982 | }else if(item[c].prom_type==10){ |
1630 | ladder_calc.add_ladder_prom(car,a,obj); | 1983 | ladder_calc.add_ladder_prom(car,a,obj); |
@@ -1644,6 +1997,8 @@ Page({ | @@ -1644,6 +1997,8 @@ Page({ | ||
1644 | 1997 | ||
1645 | //总的价格,把组合商品的价格拿出来 | 1998 | //总的价格,把组合商品的价格拿出来 |
1646 | var zh_calc_res=zh_calc.calculate_zh(car,a,th); | 1999 | var zh_calc_res=zh_calc.calculate_zh(car,a,th); |
2000 | + console.log('.组合价-----------') | ||
2001 | + console.log(zh_calc_res) | ||
1647 | //总的价格,把阶梯促销商品的价格拿出来 | 2002 | //总的价格,把阶梯促销商品的价格拿出来 |
1648 | var ladder_calc_res=ladder_calc.calculate_ladder(car,a,th); | 2003 | var ladder_calc_res=ladder_calc.calculate_ladder(car,a,th); |
1649 | 2004 | ||
@@ -2536,6 +2891,23 @@ Page({ | @@ -2536,6 +2891,23 @@ Page({ | ||
2536 | } | 2891 | } |
2537 | } | 2892 | } |
2538 | } | 2893 | } |
2894 | + | ||
2895 | + //排除失效商品结算 | ||
2896 | + this.data.invalidList.map(item=>{ | ||
2897 | + if(item.selected && item.classType==0){ | ||
2898 | + rq.put('/api/weshop/cart/update', { | ||
2899 | + data: { | ||
2900 | + id: item.id, | ||
2901 | + selected: 0, | ||
2902 | + store_id: oo.stoid | ||
2903 | + }, | ||
2904 | + success: function (ee) { | ||
2905 | + console.log(ee); | ||
2906 | + } | ||
2907 | + }); | ||
2908 | + } | ||
2909 | + }) | ||
2910 | + | ||
2539 | if (ab == 0) { | 2911 | if (ab == 0) { |
2540 | t.my_warnning("未选择商品", 0, th); | 2912 | t.my_warnning("未选择商品", 0, th); |
2541 | wx.hideLoading(); | 2913 | wx.hideLoading(); |
@@ -2715,6 +3087,18 @@ Page({ | @@ -2715,6 +3087,18 @@ Page({ | ||
2715 | }); | 3087 | }); |
2716 | } | 3088 | } |
2717 | } | 3089 | } |
3090 | + //排除失效服务结算 | ||
3091 | + this.data.invalidList.map(item=>{ | ||
3092 | + if(item.selected && item.classType==1){ | ||
3093 | + rq.promisePut('/api/weshop/cartService/update', { | ||
3094 | + data: { | ||
3095 | + id: item.id, | ||
3096 | + selected: 0, | ||
3097 | + store_id: oo.stoid | ||
3098 | + } | ||
3099 | + }); | ||
3100 | + } | ||
3101 | + }) | ||
2718 | wx.hideLoading(); | 3102 | wx.hideLoading(); |
2719 | getApp().goto("/packageA/pages/cart2_ser/cart2_ser?is_cart=1"); | 3103 | getApp().goto("/packageA/pages/cart2_ser/cart2_ser?is_cart=1"); |
2720 | } | 3104 | } |
@@ -2923,8 +3307,9 @@ Page({ | @@ -2923,8 +3307,9 @@ Page({ | ||
2923 | var item = list.goods[ii]; | 3307 | var item = list.goods[ii]; |
2924 | list.goods.splice(ii, 1); | 3308 | list.goods.splice(ii, 1); |
2925 | if (item.prom_id == p_item[0] && item.prom_type == 3) { | 3309 | if (item.prom_id == p_item[0] && item.prom_type == 3) { |
2926 | - var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id; | ||
2927 | - getApp().request.delete(url, {}); | 3310 | + // var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id; |
3311 | + // getApp().request.delete(url, {}); | ||
3312 | + th.disInvalid(item); | ||
2928 | } | 3313 | } |
2929 | } | 3314 | } |
2930 | continue; | 3315 | continue; |
@@ -3227,8 +3612,9 @@ Page({ | @@ -3227,8 +3612,9 @@ Page({ | ||
3227 | var item = list.goods[ii]; | 3612 | var item = list.goods[ii]; |
3228 | list.goods.splice(ii, 1); | 3613 | list.goods.splice(ii, 1); |
3229 | if (item.prom_id == p_item[0] && item.prom_type == 3) { | 3614 | if (item.prom_id == p_item[0] && item.prom_type == 3) { |
3230 | - var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id; | ||
3231 | - getApp().request.delete(url, {}); | 3615 | + // var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id; |
3616 | + // getApp().request.delete(url, {}); | ||
3617 | + th.disInvalid(item); | ||
3232 | } | 3618 | } |
3233 | } | 3619 | } |
3234 | continue; | 3620 | continue; |
pages/cart/cart/cart.wxml
@@ -238,8 +238,42 @@ | @@ -238,8 +238,42 @@ | ||
238 | 238 | ||
239 | 239 | ||
240 | </block> | 240 | </block> |
241 | - </block> | ||
242 | - | 241 | + </block> |
242 | + <!-- 失效商品 --> | ||
243 | + <block wx:if="{{invalidList && invalidList.length > 0}}"> | ||
244 | + <view class="store" style="border-top: 20rpx solid rgb(245, 245, 245);"> | ||
245 | + <view class="shmd_m flex-equality"> | ||
246 | + <view class="shmd fs30" >失效宝贝{{invalidList.length}}件</view> | ||
247 | + <view class="flex fs26 ctb"> | ||
248 | + <view bindtap="collectGoods">移到收藏夹</view> | ||
249 | + <view class="mgl20" bindtap="delInva">清空失效宝贝</view> | ||
250 | + </view> | ||
251 | + </view> | ||
252 | + <view class="order-item" style="border: none;" data-item="{{idx}}" wx:for="{{invalidList}}" wx:for-item="items" wx:for-index="idx" wx:key="{{index}}"> | ||
253 | + <block > | ||
254 | + <view bindtap="inCheck_th_item" class="order-raido flex-vertical " data-check="{{items.selected}}" data-item="{{idx}}" data-pitems="{{pidx}}"> | ||
255 | + <icon wx:if="{{items.selected}}" color="red" size="20" type="success"></icon> | ||
256 | + <text wx:else class="icon_no_sele"></text> | ||
257 | + </view> | ||
258 | + </block> | ||
259 | + <view class="goods-img rel" data-gd="{{items.goods_id}}"> | ||
260 | + <image class="wh100" src="{{imgUrl + items.original_img}}" binderror="bind_bnerr2" data-errorimg="requestData[{{pidx}}].goods[{{idx}}].original_img" data-url="{{items.original_img}}"></image> | ||
261 | + </view> | ||
262 | + <view class="goods-cont"> | ||
263 | + <view class="goods-name"> | ||
264 | + <view class="ellipsis-2 fs30" data-gd="{{items.goods_id}}" style="color: #a5a5a5;">{{items.goods_name || items.service_name}}</view> | ||
265 | + </view> | ||
266 | + <block> | ||
267 | + <view class="flex alend jc_sb"> | ||
268 | + <view class="goods-price baseline ellipsis-1"> | ||
269 | + <view class="fs28">{{items.invalid}}</view> | ||
270 | + </view> | ||
271 | + </view> | ||
272 | + </block> | ||
273 | + </view> | ||
274 | + </view> | ||
275 | + </view> | ||
276 | + </block> | ||
243 | 277 | ||
244 | </view> | 278 | </view> |
245 | <view class="pay-for flex-vertical-between"> | 279 | <view class="pay-for flex-vertical-between"> |
pages/cart/cart/cart.wxss
@@ -222,7 +222,7 @@ radio { | @@ -222,7 +222,7 @@ radio { | ||
222 | } | 222 | } |
223 | 223 | ||
224 | .store { | 224 | .store { |
225 | - border-bottom: 7rpx solid rgb(245, 245, 245); | 225 | + /* border-bottom: 7rpx solid rgb(245, 245, 245); */ |
226 | } | 226 | } |
227 | .login-in { | 227 | .login-in { |
228 | position: relative; | 228 | position: relative; |
pages/goods/goodsInfo/goodsInfo.js
@@ -286,13 +286,16 @@ Page({ | @@ -286,13 +286,16 @@ Page({ | ||
286 | 286 | ||
287 | if (json_str) { | 287 | if (json_str) { |
288 | var json_data = JSON.parse(json_str); | 288 | var json_data = JSON.parse(json_str); |
289 | + console.log('自定义海报参数-------'); | ||
290 | + console.log(json_data); | ||
289 | if (json_data.bg_img) { | 291 | if (json_data.bg_img) { |
290 | - | 292 | + |
291 | //-- 把图片那到本地 -- | 293 | //-- 把图片那到本地 -- |
292 | wx.getImageInfo({ | 294 | wx.getImageInfo({ |
293 | src: json_data.bg_img, | 295 | src: json_data.bg_img, |
294 | success: function (res) { | 296 | success: function (res) { |
295 | var path = res.path; | 297 | var path = res.path; |
298 | + | ||
296 | th.setData({share_b_img: path}) | 299 | th.setData({share_b_img: path}) |
297 | }, | 300 | }, |
298 | fail: function (res) { | 301 | fail: function (res) { |
@@ -5044,7 +5047,8 @@ Page({ | @@ -5044,7 +5047,8 @@ Page({ | ||
5044 | 5047 | ||
5045 | 5048 | ||
5046 | if (this.data.prom_act && this.data.prom_act.kttype == 3) type = 3; | 5049 | if (this.data.prom_act && this.data.prom_act.kttype == 3) type = 3; |
5047 | - | 5050 | + console.log('商品类型。。。。。'); |
5051 | + console.log(type); | ||
5048 | wx.showLoading({title: '生成中...',}) | 5052 | wx.showLoading({title: '生成中...',}) |
5049 | var that = this, th = that; | 5053 | var that = this, th = that; |
5050 | //设置画板显示,才能开始绘图 | 5054 | //设置画板显示,才能开始绘图 |
@@ -5094,17 +5098,21 @@ Page({ | @@ -5094,17 +5098,21 @@ Page({ | ||
5094 | // context.drawImage(pg_path, 0, 0, 554 * unit, 899 * unit); | 5098 | // context.drawImage(pg_path, 0, 0, 554 * unit, 899 * unit); |
5095 | 5099 | ||
5096 | 5100 | ||
5097 | - if (type == 0 || type == 1 || type == 2 || type == 3) { // 如果是普通商品,绘制新海报 | 5101 | + if ( !th.data.share_b_img && (type == 0 || type == 1 || type == 2 || type == 3)){ // 如果是普通商品,绘制新海报 |
5098 | th.drawPoster(context, unit, th.data.share_goods_img, vpath, type); | 5102 | th.drawPoster(context, unit, th.data.share_goods_img, vpath, type); |
5099 | } else { | 5103 | } else { |
5100 | context.drawImage(pg_path, 0, 0, 554 * unit, 899 * unit); | 5104 | context.drawImage(pg_path, 0, 0, 554 * unit, 899 * unit); |
5105 | + // var erm_x = parseFloat(th.data.poster.ewm_x) * 2; | ||
5106 | + // var erm_y = parseFloat(th.data.poster.ewm_y) * 2; | ||
5107 | + // context.drawImage(vpath, erm_x * unit, erm_y * unit, 136 * unit, 136 * unit); | ||
5108 | + // th.drawPoster(context, unit, th.data.share_goods_img, vpath); | ||
5101 | }; | 5109 | }; |
5102 | - | 5110 | + |
5103 | // th.drawPoster(context, unit, th.data.share_goods_img, vpath); | 5111 | // th.drawPoster(context, unit, th.data.share_goods_img, vpath); |
5104 | 5112 | ||
5105 | 5113 | ||
5106 | //-- 是自定义海报的情况下 -- | 5114 | //-- 是自定义海报的情况下 -- |
5107 | - if (type != 0 && type != 1 && type != 2 && type != 3) { | 5115 | + if (th.data.share_b_img || (type != 0 && type != 1 && type != 2 && type != 3)) { |
5108 | 5116 | ||
5109 | if (th.data.poster && parseInt(th.data.poster.style) == 2) { | 5117 | if (th.data.poster && parseInt(th.data.poster.style) == 2) { |
5110 | //在线上分享人的情况下 | 5118 | //在线上分享人的情况下 |
@@ -5158,7 +5166,7 @@ Page({ | @@ -5158,7 +5166,7 @@ Page({ | ||
5158 | 5166 | ||
5159 | //---产品名称--- | 5167 | //---产品名称--- |
5160 | //文本换行 参数:1、canvas对象,2、文本 3、距离左侧的距离 4、距离顶部的距离 5、6、文本的宽度 | 5168 | //文本换行 参数:1、canvas对象,2、文本 3、距离左侧的距离 4、距离顶部的距离 5、6、文本的宽度 |
5161 | - if (type != 4 && type != 0 && type != 1 && type != 2 && type != 3) { | 5169 | + if (th.data.share_b_img || (type != 4 && type != 0 && type != 1 && type != 2 && type != 3)) { |
5162 | context.setFillStyle("black"); | 5170 | context.setFillStyle("black"); |
5163 | context.setFontSize(21.3 * unit) | 5171 | context.setFontSize(21.3 * unit) |
5164 | getApp().draw_Text(context, share_title, | 5172 | getApp().draw_Text(context, share_title, |
@@ -5195,7 +5203,7 @@ Page({ | @@ -5195,7 +5203,7 @@ Page({ | ||
5195 | context.lineTo(wd2 + ut.measureText(pri0, 22 * unit) + 5, 206 * unit); | 5203 | context.lineTo(wd2 + ut.measureText(pri0, 22 * unit) + 5, 206 * unit); |
5196 | context.stroke();--*/ | 5204 | context.stroke();--*/ |
5197 | 5205 | ||
5198 | - } else if (type == 4 && type != 0 && type != 1 && type != 2 && type != 3) { | 5206 | + } else if ( ( type == 4 && type != 0 && type != 1 && type != 2 && type != 3)) { |
5199 | context.setFillStyle("black"); | 5207 | context.setFillStyle("black"); |
5200 | context.setFontSize(21.3 * unit) | 5208 | context.setFontSize(21.3 * unit) |
5201 | getApp().draw_Text(context, share_title, | 5209 | getApp().draw_Text(context, share_title, |
@@ -5223,18 +5231,56 @@ Page({ | @@ -5223,18 +5231,56 @@ Page({ | ||
5223 | } | 5231 | } |
5224 | 5232 | ||
5225 | //---中间大图--- | 5233 | //---中间大图--- |
5226 | - if (type != 0 && type != 1 && type != 2 && type != 3) { | 5234 | + if ( th.data.share_b_img || (type != 0 && type != 1 && type != 2 && type != 3)) { |
5227 | context.drawImage(th.data.share_goods_img, 70 * unit, 250 * unit, 408 * unit, 408 * unit); | 5235 | context.drawImage(th.data.share_goods_img, 70 * unit, 250 * unit, 408 * unit, 408 * unit); |
5228 | } | 5236 | } |
5229 | ; | 5237 | ; |
5238 | + | ||
5239 | + //---自定义海报 产品质量保证 | ||
5240 | + if(th.data.share_b_img && th.data.poster.show_quality==1 && type==0){ | ||
5241 | + var g_path = "../../../images/share/s_gou.png"; | ||
5242 | + context.drawImage(g_path, 56 * unit, 670 * unit, 22 * unit, 22 * unit); | ||
5243 | + context.setFillStyle("red") | ||
5244 | + context.setFontSize(18 * unit) | ||
5245 | + context.fillText("正品保证", 84 * unit, 690 * unit); | ||
5246 | + | ||
5247 | + context.drawImage(g_path, 218 * unit, 670 * unit, 22 * unit, 22 * unit); | ||
5248 | + context.setFillStyle("red") | ||
5249 | + context.setFontSize(18 * unit) | ||
5250 | + context.fillText("纯实体店", 246 * unit, 690 * unit); | ||
5251 | + | ||
5252 | + context.drawImage(g_path, 388 * unit, 670 * unit, 22 * unit, 22 * unit); | ||
5253 | + context.setFillStyle("red") | ||
5254 | + context.setFontSize(18 * unit) | ||
5255 | + context.fillText("官方验证", 420 * unit, 690 * unit); | ||
5230 | 5256 | ||
5231 | - | ||
5232 | - //-------大图后面就不一样了----------- | 5257 | + } |
5258 | + //-------大图后面就不一样了----------- | ||
5233 | switch (type) { | 5259 | switch (type) { |
5234 | case 0: | 5260 | case 0: |
5261 | + if(!th.data.share_b_img){ | ||
5262 | + break | ||
5263 | + } | ||
5264 | + //---画线--- | ||
5265 | + context.setLineWidth(1 * unit) | ||
5266 | + context.moveTo(32 * unit, 710 * unit) | ||
5267 | + context.lineTo(520 * unit, 710 * unit) | ||
5268 | + context.stroke(); | ||
5269 | + //---文字--- | ||
5270 | + context.setFillStyle("black") | ||
5271 | + context.setFontSize(22 * unit) | ||
5272 | + // 原来start ---> | ||
5273 | + context.fillText("优惠乐翻天,精彩就在你身边", 40 * unit, 776 * unit); | ||
5274 | + context.fillText("长按识别二维码,立即开始抢购", 40 * unit, 826 * unit); | ||
5275 | + // <--- 原来end | ||
5276 | + // context.fillText("优惠乐翻天,精彩就在你身边", 40 * unit, 816 * unit); | ||
5277 | + // context.setFontSize(18 * unit) | ||
5278 | + // context.fillText("长按识别二维码,立即开始抢购", 40 * unit, 850 * unit); | ||
5279 | + //---二维吗图--- | ||
5280 | + context.drawImage(vpath, 380 * unit, 736 * unit, 120 * unit, 120 * unit); | ||
5235 | break;//普通商品的展示 | 5281 | break;//普通商品的展示 |
5236 | case 4: | 5282 | case 4: |
5237 | - //中间的几个字 | 5283 | + // 中间的几个字 |
5238 | if (th.data.poster && parseInt(th.data.poster.style) == 2) { | 5284 | if (th.data.poster && parseInt(th.data.poster.style) == 2) { |
5239 | if (parseInt(th.data.poster.show_quality)) { | 5285 | if (parseInt(th.data.poster.show_quality)) { |
5240 | var g_path = "../../../images/share/s_gou.png"; | 5286 | var g_path = "../../../images/share/s_gou.png"; |
@@ -5303,7 +5349,7 @@ Page({ | @@ -5303,7 +5349,7 @@ Page({ | ||
5303 | 5349 | ||
5304 | //---二维吗图--- | 5350 | //---二维吗图--- |
5305 | //-- 自定义海报 -- | 5351 | //-- 自定义海报 -- |
5306 | - if (th.data.poster) { | 5352 | + if (th.data.share_b_img || th.data.poster) { |
5307 | var erm_x = parseFloat(th.data.poster.ewm_x) * 2; | 5353 | var erm_x = parseFloat(th.data.poster.ewm_x) * 2; |
5308 | var erm_y = parseFloat(th.data.poster.ewm_y) * 2; | 5354 | var erm_y = parseFloat(th.data.poster.ewm_y) * 2; |
5309 | context.drawImage(vpath, erm_x * unit, erm_y * unit, 136 * unit, 136 * unit); | 5355 | context.drawImage(vpath, erm_x * unit, erm_y * unit, 136 * unit, 136 * unit); |
@@ -5314,7 +5360,10 @@ Page({ | @@ -5314,7 +5360,10 @@ Page({ | ||
5314 | ; | 5360 | ; |
5315 | 5361 | ||
5316 | break; | 5362 | break; |
5317 | - case -12: //秒杀商品的展示 | 5363 | + case 1: //秒杀商品的展示 |
5364 | + if(!th.data.share_b_img){ | ||
5365 | + break | ||
5366 | + } | ||
5318 | //---画线--- | 5367 | //---画线--- |
5319 | context.setLineWidth(1 * unit) | 5368 | context.setLineWidth(1 * unit) |
5320 | context.moveTo(32 * unit, 670 * unit) | 5369 | context.moveTo(32 * unit, 670 * unit) |
@@ -5337,7 +5386,7 @@ Page({ | @@ -5337,7 +5386,7 @@ Page({ | ||
5337 | 5386 | ||
5338 | //---二维吗图--- | 5387 | //---二维吗图--- |
5339 | //-- 自定义海报 -- | 5388 | //-- 自定义海报 -- |
5340 | - if (th.data.poster) { | 5389 | + if (th.data.share_b_img || th.data.poster) { |
5341 | var erm_x = parseFloat(th.data.poster.ewm_x) * 2; | 5390 | var erm_x = parseFloat(th.data.poster.ewm_x) * 2; |
5342 | var erm_y = parseFloat(th.data.poster.ewm_y) * 2; | 5391 | var erm_y = parseFloat(th.data.poster.ewm_y) * 2; |
5343 | context.drawImage(vpath, erm_x * unit, erm_y * unit, 135 * unit, 135 * unit); | 5392 | context.drawImage(vpath, erm_x * unit, erm_y * unit, 135 * unit, 135 * unit); |
@@ -5347,7 +5396,10 @@ Page({ | @@ -5347,7 +5396,10 @@ Page({ | ||
5347 | } | 5396 | } |
5348 | break; | 5397 | break; |
5349 | 5398 | ||
5350 | - case -2: //会员团和商家团的展示 | 5399 | + case 2: //会员团和商家团的展示 |
5400 | + if(!th.data.share_b_img){ | ||
5401 | + break | ||
5402 | + } | ||
5351 | //---画线--- | 5403 | //---画线--- |
5352 | context.setLineWidth(1 * unit) | 5404 | context.setLineWidth(1 * unit) |
5353 | context.moveTo(32 * unit, 670 * unit) | 5405 | context.moveTo(32 * unit, 670 * unit) |
@@ -5383,7 +5435,7 @@ Page({ | @@ -5383,7 +5435,7 @@ Page({ | ||
5383 | 5435 | ||
5384 | //---二维吗图--- | 5436 | //---二维吗图--- |
5385 | //-- 自定义海报 -- | 5437 | //-- 自定义海报 -- |
5386 | - if (th.data.poster) { | 5438 | + if (th.data.share_b_img || th.data.poster) { |
5387 | var erm_x = parseFloat(th.data.poster.ewm_x) * 2; | 5439 | var erm_x = parseFloat(th.data.poster.ewm_x) * 2; |
5388 | var erm_y = parseFloat(th.data.poster.ewm_y) * 2; | 5440 | var erm_y = parseFloat(th.data.poster.ewm_y) * 2; |
5389 | context.drawImage(vpath, erm_x * unit, erm_y * unit, 136 * unit, 136 * unit); | 5441 | context.drawImage(vpath, erm_x * unit, erm_y * unit, 136 * unit, 136 * unit); |
@@ -5392,7 +5444,10 @@ Page({ | @@ -5392,7 +5444,10 @@ Page({ | ||
5392 | context.drawImage(vpath, 390 * unit, 726 * unit, 136 * unit, 136 * unit); | 5444 | context.drawImage(vpath, 390 * unit, 726 * unit, 136 * unit, 136 * unit); |
5393 | } | 5445 | } |
5394 | break | 5446 | break |
5395 | - case -3: //阶梯团的展示 | 5447 | + case 3: //阶梯团的展示 |
5448 | + if(!th.data.share_b_img){ | ||
5449 | + break | ||
5450 | + } | ||
5396 | //---画线--- | 5451 | //---画线--- |
5397 | context.setLineWidth(1 * unit) | 5452 | context.setLineWidth(1 * unit) |
5398 | context.moveTo(32 * unit, 670 * unit) | 5453 | context.moveTo(32 * unit, 670 * unit) |
@@ -5428,7 +5483,7 @@ Page({ | @@ -5428,7 +5483,7 @@ Page({ | ||
5428 | 5483 | ||
5429 | 5484 | ||
5430 | //-- 自定义海报 -- | 5485 | //-- 自定义海报 -- |
5431 | - if (th.data.poster) { | 5486 | + if (th.data.share_b_img || th.data.poster) { |
5432 | var erm_x = parseFloat(th.data.poster.ewm_x) * 2; | 5487 | var erm_x = parseFloat(th.data.poster.ewm_x) * 2; |
5433 | var erm_y = parseFloat(th.data.poster.ewm_y) * 2; | 5488 | var erm_y = parseFloat(th.data.poster.ewm_y) * 2; |
5434 | context.drawImage(vpath, erm_x * unit, erm_y * unit, 136 * unit, 136 * unit); | 5489 | context.drawImage(vpath, erm_x * unit, erm_y * unit, 136 * unit, 136 * unit); |
@@ -5459,7 +5514,7 @@ Page({ | @@ -5459,7 +5514,7 @@ Page({ | ||
5459 | 5514 | ||
5460 | //---二维吗图--- | 5515 | //---二维吗图--- |
5461 | //-- 自定义海报 -- | 5516 | //-- 自定义海报 -- |
5462 | - if (th.data.poster) { | 5517 | + if (th.data.share_b_img || th.data.poster) { |
5463 | var erm_x = parseFloat(th.data.poster.ewm_x) * 2; | 5518 | var erm_x = parseFloat(th.data.poster.ewm_x) * 2; |
5464 | var erm_y = parseFloat(th.data.poster.ewm_y) * 2; | 5519 | var erm_y = parseFloat(th.data.poster.ewm_y) * 2; |
5465 | context.drawImage(vpath, erm_x * unit, erm_y * unit, 135 * unit, 135 * unit); | 5520 | context.drawImage(vpath, erm_x * unit, erm_y * unit, 135 * unit, 135 * unit); |
@@ -5474,7 +5529,7 @@ Page({ | @@ -5474,7 +5529,7 @@ Page({ | ||
5474 | 5529 | ||
5475 | 5530 | ||
5476 | //--- 如果是自定义海报的时候 --- | 5531 | //--- 如果是自定义海报的时候 --- |
5477 | - if (type != 0 && type != 1 && type != 2 && type != 3) { | 5532 | + if ( th.data.share_b_img || (type != 0 && type != 1 && type != 2 && type != 3)) { |
5478 | 5533 | ||
5479 | if (th.data.poster && parseInt(th.data.poster.style) == 2) { | 5534 | if (th.data.poster && parseInt(th.data.poster.style) == 2) { |
5480 | 5535 |
pages/index/index/index.js
@@ -14,7 +14,7 @@ var e = function (e) { | @@ -14,7 +14,7 @@ var e = function (e) { | ||
14 | var regeneratorRuntime = require('../../../utils/runtime.js'); | 14 | var regeneratorRuntime = require('../../../utils/runtime.js'); |
15 | var api = require('../../../api/api.js'); | 15 | var api = require('../../../api/api.js'); |
16 | var d = getApp().globalData; | 16 | var d = getApp().globalData; |
17 | - | 17 | + |
18 | var full_screen = require('full_screen.js'); | 18 | var full_screen = require('full_screen.js'); |
19 | 19 | ||
20 | 20 | ||
@@ -78,7 +78,7 @@ Page({ | @@ -78,7 +78,7 @@ Page({ | ||
78 | 78 | ||
79 | showHongbao: false, | 79 | showHongbao: false, |
80 | showHongbaoSmall: false, | 80 | showHongbaoSmall: false, |
81 | - | 81 | + goodsGroupArr:[], //商品模块列表 |
82 | is_full_screen_show: 0, //全屏显示 | 82 | is_full_screen_show: 0, //全屏显示 |
83 | sec_show: 3, //倒计时的秒数 | 83 | sec_show: 3, //倒计时的秒数 |
84 | full_ad: null, //全屏广告 | 84 | full_ad: null, //全屏广告 |
@@ -297,8 +297,34 @@ Page({ | @@ -297,8 +297,34 @@ Page({ | ||
297 | }); | 297 | }); |
298 | } | 298 | } |
299 | }) | 299 | }) |
300 | - }, | ||
301 | - | 300 | + }, |
301 | + onReady(){ | ||
302 | + console.log('渲染完成----') | ||
303 | + console.log(this.data.template_arr); | ||
304 | + console.log('....................'); | ||
305 | + }, | ||
306 | + | ||
307 | + //获取商品模块实例 | ||
308 | + newGoodsGroup(){ | ||
309 | + let arr=[] | ||
310 | + if (this.data.template_arr.length == 0) { | ||
311 | + return | ||
312 | + } | ||
313 | + this.data.template_arr.map((item,index)=>{ | ||
314 | + if (item.ename == 'goodsGroup') { | ||
315 | + arr.push(`goodsGroup${index}`) | ||
316 | + } | ||
317 | + }) | ||
318 | + if (arr.length > 0) { | ||
319 | + this.setData({ | ||
320 | + goodsGroupArr : arr | ||
321 | + }) | ||
322 | + arr.map(item=>{ | ||
323 | + let a = '.'+item | ||
324 | + this[item] = this.selectComponent(a); | ||
325 | + }) | ||
326 | + } | ||
327 | + }, | ||
302 | 328 | ||
303 | //关闭新用户领取广告 | 329 | //关闭新用户领取广告 |
304 | close_disgraceful: function () { | 330 | close_disgraceful: function () { |
@@ -523,13 +549,17 @@ Page({ | @@ -523,13 +549,17 @@ Page({ | ||
523 | if (data && data.length > 0) { | 549 | if (data && data.length > 0) { |
524 | var temp_data = data[0]; | 550 | var temp_data = data[0]; |
525 | var t_arr = JSON.parse(temp_data.json_str); | 551 | var t_arr = JSON.parse(temp_data.json_str); |
526 | - | 552 | + console.log('商品列表------------1') |
553 | + console.log(t_arr) | ||
554 | + console.log('商品列表------------2') | ||
527 | th.setData({ | 555 | th.setData({ |
528 | template_arr: t_arr, | 556 | template_arr: t_arr, |
529 | isTemplate: 1, | 557 | isTemplate: 1, |
530 | bgcolor_t: temp_data.bkcolor | 558 | bgcolor_t: temp_data.bkcolor |
531 | - }); | ||
532 | - | 559 | + }); |
560 | + setTimeout(()=>{ | ||
561 | + th.newGoodsGroup() | ||
562 | + },1000) | ||
533 | //---如果有设定顶部的颜色的时候-- | 563 | //---如果有设定顶部的颜色的时候-- |
534 | if (temp_data.top_color && temp_data.top_color != 'null') { | 564 | if (temp_data.top_color && temp_data.top_color != 'null') { |
535 | 565 | ||
@@ -723,6 +753,8 @@ Page({ | @@ -723,6 +753,8 @@ Page({ | ||
723 | }, | 753 | }, |
724 | //---加载更多是靠这个函数---- | 754 | //---加载更多是靠这个函数---- |
725 | onReachBottom: function () { | 755 | onReachBottom: function () { |
756 | + console.log('下拉加载2'); | ||
757 | + | ||
726 | var goods_list = this.selectComponent("#goods_list"); //组件的id | 758 | var goods_list = this.selectComponent("#goods_list"); //组件的id |
727 | if (goods_list) goods_list.get_list(); | 759 | if (goods_list) goods_list.get_list(); |
728 | 760 | ||
@@ -731,7 +763,17 @@ Page({ | @@ -731,7 +763,17 @@ Page({ | ||
731 | let item = getApp().globalData.func_list[i]; | 763 | let item = getApp().globalData.func_list[i]; |
732 | item.re_show(); | 764 | item.re_show(); |
733 | } | 765 | } |
734 | - } | 766 | + } |
767 | + | ||
768 | + | ||
769 | + //自定义时商品自动加载更多 | ||
770 | + let goodsGroupArr = this.data.goodsGroupArr | ||
771 | + if (this.data.isTemplate && goodsGroupArr.length >0) { | ||
772 | + goodsGroupArr.map(item=>{ | ||
773 | + this[item].automore() | ||
774 | + }) | ||
775 | + } | ||
776 | + | ||
735 | }, | 777 | }, |
736 | 778 | ||
737 | onPullDownRefresh: function (e) { | 779 | onPullDownRefresh: function (e) { |
@@ -1226,8 +1268,26 @@ Page({ | @@ -1226,8 +1268,26 @@ Page({ | ||
1226 | getApp().goto(url); | 1268 | getApp().goto(url); |
1227 | }, | 1269 | }, |
1228 | 1270 | ||
1229 | - | ||
1230 | - | 1271 | + //视频号跳转 |
1272 | + nv_void(){ | ||
1273 | + // getApp().openChannelsActivity() | ||
1274 | + wx.getChannelsLiveInfo({ | ||
1275 | + finderUserName:'sphYA5FuPCZxHaw', | ||
1276 | + success:(res)=>{ | ||
1277 | + console.log(res) | ||
1278 | + }, | ||
1279 | + fail:(error)=>{ | ||
1280 | + console.log(error) | ||
1281 | + } | ||
1282 | + }) | ||
1283 | + }, | ||
1284 | + getchir(){ | ||
1285 | + const child = this.selectComponent('.goodsg'); | ||
1286 | + console.log('子组件--------111111------') | ||
1287 | + console.log(child) | ||
1288 | + console.log('子组件----------2222----') | ||
1289 | + | ||
1290 | + }, | ||
1231 | 1291 | ||
1232 | 1292 | ||
1233 | }); | 1293 | }); |
pages/index/index/index.json
@@ -26,5 +26,6 @@ | @@ -26,5 +26,6 @@ | ||
26 | "mp-dialog": "weui-miniprogram/dialog/dialog", | 26 | "mp-dialog": "weui-miniprogram/dialog/dialog", |
27 | "mp-sticky": "/components/mp-sticky/mp-sticky" | 27 | "mp-sticky": "/components/mp-sticky/mp-sticky" |
28 | }, | 28 | }, |
29 | - "enablePullDownRefresh": false | 29 | + "enablePullDownRefresh": false, |
30 | + "onReachBottomDistance":300 | ||
30 | } | 31 | } |
31 | \ No newline at end of file | 32 | \ No newline at end of file |
pages/index/index/index.wxml
@@ -417,7 +417,7 @@ | @@ -417,7 +417,7 @@ | ||
417 | </block> | 417 | </block> |
418 | <!--商品分组--> | 418 | <!--商品分组--> |
419 | <block wx:if="{{item.ename=='goodsGroup'}}"> | 419 | <block wx:if="{{item.ename=='goodsGroup'}}"> |
420 | - <goodsGroup object="{{item.content}}" sticky="{{template_arr[0].content.is_top}}"></goodsGroup> | 420 | + <goodsGroup class="{{'goodsGroup' + index}}" object="{{item.content}}" sticky="{{template_arr[0].content.is_top}}" ></goodsGroup> |
421 | 421 | ||
422 | </block> | 422 | </block> |
423 | <!--通知--> | 423 | <!--通知--> |
pages/template/index.js
@@ -11,7 +11,8 @@ var t = getApp(), | @@ -11,7 +11,8 @@ var t = getApp(), | ||
11 | Page({ | 11 | Page({ |
12 | data: { | 12 | data: { |
13 | url: os.imghost, | 13 | url: os.imghost, |
14 | - temp_id:0, | 14 | + temp_id:0, |
15 | + goodsGroupArr:[] | ||
15 | }, | 16 | }, |
16 | 17 | ||
17 | onLoad: function(e) { | 18 | onLoad: function(e) { |
@@ -46,7 +47,27 @@ Page({ | @@ -46,7 +47,27 @@ Page({ | ||
46 | 47 | ||
47 | } | 48 | } |
48 | }, | 49 | }, |
49 | - | 50 | + //获取商品模块实例 |
51 | + newGoodsGroup(){ | ||
52 | + let arr=[] | ||
53 | + if (this.data.template_arr.length == 0) { | ||
54 | + return | ||
55 | + } | ||
56 | + this.data.template_arr.map((item,index)=>{ | ||
57 | + if (item.ename == 'goodsGroup') { | ||
58 | + arr.push(`goodsGroup${index}`) | ||
59 | + } | ||
60 | + }) | ||
61 | + if (arr.length > 0) { | ||
62 | + this.setData({ | ||
63 | + goodsGroupArr : arr | ||
64 | + }) | ||
65 | + arr.map(item=>{ | ||
66 | + let a = '.'+item | ||
67 | + this[item] = this.selectComponent(a); | ||
68 | + }) | ||
69 | + } | ||
70 | + }, | ||
50 | //当隐藏的时候就关闭计时器 | 71 | //当隐藏的时候就关闭计时器 |
51 | onHide: function() { | 72 | onHide: function() { |
52 | 73 | ||
@@ -70,6 +91,9 @@ Page({ | @@ -70,6 +91,9 @@ Page({ | ||
70 | isTemplate: 1, | 91 | isTemplate: 1, |
71 | bgcolor_t: temp_data.bkcolor | 92 | bgcolor_t: temp_data.bkcolor |
72 | }); | 93 | }); |
94 | + setTimeout(()=>{ | ||
95 | + th.newGoodsGroup() | ||
96 | + },1000) | ||
73 | 97 | ||
74 | //---如果有设定顶部的颜色的时候-- | 98 | //---如果有设定顶部的颜色的时候-- |
75 | if(temp_data.top_color && temp_data.top_color!='null' ){ | 99 | if(temp_data.top_color && temp_data.top_color!='null' ){ |
@@ -156,6 +180,14 @@ Page({ | @@ -156,6 +180,14 @@ Page({ | ||
156 | item.re_show(); | 180 | item.re_show(); |
157 | } | 181 | } |
158 | } | 182 | } |
183 | + | ||
184 | + //自定义时商品自动加载更多 | ||
185 | + let goodsGroupArr = this.data.goodsGroupArr | ||
186 | + if (this.data.isTemplate && goodsGroupArr.length >0) { | ||
187 | + goodsGroupArr.map(item=>{ | ||
188 | + this[item].automore() | ||
189 | + }) | ||
190 | + } | ||
159 | }, | 191 | }, |
160 | 192 | ||
161 | 193 |
pages/template/index.json
@@ -22,5 +22,6 @@ | @@ -22,5 +22,6 @@ | ||
22 | "scan": "/components/diy_scan/diy_scan", | 22 | "scan": "/components/diy_scan/diy_scan", |
23 | "presell": "/components/diy_pregoods/diy_pregoods" | 23 | "presell": "/components/diy_pregoods/diy_pregoods" |
24 | }, | 24 | }, |
25 | - "enablePullDownRefresh": false | 25 | + "enablePullDownRefresh": false, |
26 | + "onReachBottomDistance":300 | ||
26 | } | 27 | } |
27 | \ No newline at end of file | 28 | \ No newline at end of file |
pages/template/index.wxml
@@ -15,7 +15,7 @@ | @@ -15,7 +15,7 @@ | ||
15 | </block> | 15 | </block> |
16 | <!--商品分组--> | 16 | <!--商品分组--> |
17 | <block wx:if="{{item.ename=='goodsGroup'}}"> | 17 | <block wx:if="{{item.ename=='goodsGroup'}}"> |
18 | - <goodsGroup object="{{item.content}}"></goodsGroup> | 18 | + <goodsGroup class="{{'goodsGroup' + index}}" object="{{item.content}}"></goodsGroup> |
19 | </block> | 19 | </block> |
20 | <!--通知--> | 20 | <!--通知--> |
21 | <block wx:if="{{item.ename=='notice'}}"> | 21 | <block wx:if="{{item.ename=='notice'}}"> |
pages/user/order_list/order_list.js
@@ -10,7 +10,7 @@ var t = function(t) { | @@ -10,7 +10,7 @@ var t = function(t) { | ||
10 | oo = e.globalData, | 10 | oo = e.globalData, |
11 | r = e.request, | 11 | r = e.request, |
12 | rq = r, | 12 | rq = r, |
13 | - a = require("../../../utils/common.js"), | 13 | + a = require("../../../utils/common.js"), |
14 | s = new t.default(); | 14 | s = new t.default(); |
15 | var regeneratorRuntime = require('../../../utils/runtime.js'); | 15 | var regeneratorRuntime = require('../../../utils/runtime.js'); |
16 | var ut= require('../../../utils/util.js'); | 16 | var ut= require('../../../utils/util.js'); |
@@ -481,6 +481,45 @@ Page({ | @@ -481,6 +481,45 @@ Page({ | ||
481 | } | 481 | } |
482 | }); | 482 | }); |
483 | }, | 483 | }, |
484 | + //-----删除订单----- | ||
485 | + deleteSerOrderData: function(t) { | ||
486 | + var th = this; | ||
487 | + var order_id = t.currentTarget.dataset.orderid; | ||
488 | + let order_sn = t.currentTarget.dataset.ordersn; | ||
489 | + var index = t.currentTarget.dataset.index; | ||
490 | + // var up_data={order_id: order_id,isdel:1}; | ||
491 | + // var order=th.data.orderList[index]; | ||
492 | + // if(order.order_status!=6){ | ||
493 | + // up_data.order_status=5; | ||
494 | + // } | ||
495 | + wx.showModal({ | ||
496 | + title: "是否删除订单?", | ||
497 | + success: function(tt) { | ||
498 | + tt.confirm && rq.put("/api/weshop/recharge/update", { | ||
499 | + data: { | ||
500 | + store_id: os.stoid, | ||
501 | + order_id: order_id, | ||
502 | + order_sn: order_sn, | ||
503 | + order_status: 5, | ||
504 | + }, | ||
505 | + success: function(t) { | ||
506 | + let cardList = th.data.cardList | ||
507 | + cardList.splice(index,1) | ||
508 | + th.setData({ | ||
509 | + cardList | ||
510 | + }) | ||
511 | + // for (var e = 0; e < th.data.orderList.length; e++) | ||
512 | + // if (th.data.orderList[e].order_id == order_id) { | ||
513 | + // th.data.orderList.splice(e, 1), th.setData({ | ||
514 | + // orderList: th.data.orderList | ||
515 | + // }); | ||
516 | + // break; | ||
517 | + // } | ||
518 | + } | ||
519 | + }) | ||
520 | + } | ||
521 | + }); | ||
522 | + }, | ||
484 | 523 | ||
485 | deleteOrderData2: function(order_id) { | 524 | deleteOrderData2: function(order_id) { |
486 | var th = this; | 525 | var th = this; |
pages/user/order_list/order_list.wxml
@@ -73,8 +73,12 @@ | @@ -73,8 +73,12 @@ | ||
73 | <block wx:if="{{!(item.is_all_return_status==0 || item.is_all_return_status==1)}}"> | 73 | <block wx:if="{{!(item.is_all_return_status==0 || item.is_all_return_status==1)}}"> |
74 | <view wx:if="{{(item.order_status==1&&item.pay_status==1&&item.shipping_status==0)}}">待发货</view> | 74 | <view wx:if="{{(item.order_status==1&&item.pay_status==1&&item.shipping_status==0)}}">待发货</view> |
75 | <view wx:if="{{(item.order_status==1&&item.pay_status==1&&item.shipping_status==1)}}">待收货</view> | 75 | <view wx:if="{{(item.order_status==1&&item.pay_status==1&&item.shipping_status==1)}}">待收货</view> |
76 | - <view wx:if="{{(item.order_status==2)}}">待评价</view> | ||
77 | - <view wx:if="{{item.order_status==4}}">已评价</view> | 76 | + <view wx:if="{{(item.order_status==2)}}" class="flex-center">待评价<view class="lin"></view> |
77 | + <image src="{{iurl}}miniapp/images/trash.png" bindtap="deleteOrderData" data-index="{{index}}" data-order_id="{{item.order_id}}"></image> | ||
78 | + </view> | ||
79 | + <view wx:if="{{item.order_status==4}}" class="flex-center">已评价<view class="lin"></view> | ||
80 | + <image src="{{iurl}}miniapp/images/trash.png" bindtap="deleteOrderData" data-index="{{index}}" data-order_id="{{item.order_id}}"></image> | ||
81 | + </view> | ||
78 | <view wx:if="{{item.order_status==3 && item.pt_status!=6}}" class="flex-center" >已取消<view class="lin"></view> | 82 | <view wx:if="{{item.order_status==3 && item.pt_status!=6}}" class="flex-center" >已取消<view class="lin"></view> |
79 | <image src="{{iurl}}miniapp/images/trash.png" bindtap="deleteOrderData" data-index="{{index}}" data-order_id="{{item.order_id}}"></image> | 83 | <image src="{{iurl}}miniapp/images/trash.png" bindtap="deleteOrderData" data-index="{{index}}" data-order_id="{{item.order_id}}"></image> |
80 | </view> | 84 | </view> |
@@ -90,8 +94,12 @@ | @@ -90,8 +94,12 @@ | ||
90 | <view wx:if="{{(item.order_status==0&&item.pay_status==0)}}">未支付</view> | 94 | <view wx:if="{{(item.order_status==0&&item.pay_status==0)}}">未支付</view> |
91 | <view wx:if="{{(item.order_status==1&&item.pay_status==1&&item.shipping_status==0 && item.team_status == 2)}}">待发货</view> | 95 | <view wx:if="{{(item.order_status==1&&item.pay_status==1&&item.shipping_status==0 && item.team_status == 2)}}">待发货</view> |
92 | <view wx:if="{{(item.order_status==1&&item.pay_status==1&&item.shipping_status==1 && item.team_status == 2)}}">待收货</view> | 96 | <view wx:if="{{(item.order_status==1&&item.pay_status==1&&item.shipping_status==1 && item.team_status == 2)}}">待收货</view> |
93 | - <view wx:if="{{(item.order_status==2)}}">待评价</view> | ||
94 | - <view wx:if="{{item.order_status==4}}">已评价</view> | 97 | + <view wx:if="{{(item.order_status==2)}}" class="flex-center">待评价<view class="lin"></view> |
98 | + <image src="{{iurl}}miniapp/images/trash.png" bindtap="deleteOrderData" data-index="{{index}}" data-order_id="{{item.order_id}}"></image> | ||
99 | + </view> | ||
100 | + <view wx:if="{{item.order_status==4}}" class="flex-center">已评价<view class="lin"></view> | ||
101 | + <image src="{{iurl}}miniapp/images/trash.png" bindtap="deleteOrderData" data-index="{{index}}" data-order_id="{{item.order_id}}"></image> | ||
102 | + </view> | ||
95 | <view wx:if="{{item.pay_status == 0 && item.order_status==3 && item.pt_status!=6}}" class="flex-center" >已取消<view class="lin"></view> | 103 | <view wx:if="{{item.pay_status == 0 && item.order_status==3 && item.pt_status!=6}}" class="flex-center" >已取消<view class="lin"></view> |
96 | <image src="{{iurl}}miniapp/images/trash.png" bindtap="deleteOrderData" data-index="{{index}}" data-order_id="{{item.order_id}}"></image> | 104 | <image src="{{iurl}}miniapp/images/trash.png" bindtap="deleteOrderData" data-index="{{index}}" data-order_id="{{item.order_id}}"></image> |
97 | </view> | 105 | </view> |
@@ -103,8 +111,12 @@ | @@ -103,8 +111,12 @@ | ||
103 | <block wx:if="{{!(item.is_all_return_status==0 || item.is_all_return_status==1)}}"> | 111 | <block wx:if="{{!(item.is_all_return_status==0 || item.is_all_return_status==1)}}"> |
104 | <view wx:if="{{(item.order_status==1&&item.pay_status==1&&item.shipping_status==0)}}">待发货</view> | 112 | <view wx:if="{{(item.order_status==1&&item.pay_status==1&&item.shipping_status==0)}}">待发货</view> |
105 | <view wx:if="{{(item.order_status==1&&item.pay_status==1&&item.shipping_status==1)}}">待收货</view> | 113 | <view wx:if="{{(item.order_status==1&&item.pay_status==1&&item.shipping_status==1)}}">待收货</view> |
106 | - <view wx:if="{{(item.order_status==2)}}">待评价</view> | ||
107 | - <view wx:if="{{item.order_status==4}}">已评价</view> | 114 | + <view wx:if="{{(item.order_status==2)}}" class="flex-center">待评价<view class="lin"></view> |
115 | + <image src="{{iurl}}miniapp/images/trash.png" bindtap="deleteOrderData" data-index="{{index}}" data-order_id="{{item.order_id}}"></image> | ||
116 | + </view> | ||
117 | + <view wx:if="{{item.order_status==4}}" class="flex-center">已评价<view class="lin"></view> | ||
118 | + <image src="{{iurl}}miniapp/images/trash.png" bindtap="deleteOrderData" data-index="{{index}}" data-order_id="{{item.order_id}}"></image> | ||
119 | + </view> | ||
108 | <view wx:if="{{item.order_status==3 && item.pt_status!=6}}" class="flex-center" >已取消<view class="lin"></view> | 120 | <view wx:if="{{item.order_status==3 && item.pt_status!=6}}" class="flex-center" >已取消<view class="lin"></view> |
109 | <image src="{{iurl}}miniapp/images/trash.png" bindtap="deleteOrderData" data-index="{{index}}" data-order_id="{{item.order_id}}"></image> | 121 | <image src="{{iurl}}miniapp/images/trash.png" bindtap="deleteOrderData" data-index="{{index}}" data-order_id="{{item.order_id}}"></image> |
110 | </view> | 122 | </view> |
@@ -294,9 +306,15 @@ | @@ -294,9 +306,15 @@ | ||
294 | <!-- 订单状态 --> | 306 | <!-- 订单状态 --> |
295 | <view class="flex-center c-r"> | 307 | <view class="flex-center c-r"> |
296 | <view wx:if="{{item.order_status == 0}}">待支付</view> | 308 | <view wx:if="{{item.order_status == 0}}">待支付</view> |
297 | - <view wx:if="{{item.order_status == 1}}">待评价</view> | ||
298 | - <view wx:if="{{item.order_status == 2}}">已评价</view> | ||
299 | - <view wx:if="{{item.order_status == 3}}" class="c-a9">已取消</view> | 309 | + <view wx:if="{{item.order_status == 1}}" class="flex-center">待评价 <view class="lin"></view> |
310 | + <image src="{{iurl}}miniapp/images/trash.png" bindtap="deleteSerOrderData" data-index="{{index}}" data-orderid="{{item.order_id}}" data-ordersn="{{item.order_sn}}" ></image> | ||
311 | + </view> | ||
312 | + <view wx:if="{{item.order_status == 2}}" class="flex-center">已评价<view class="lin"></view> | ||
313 | + <image src="{{iurl}}miniapp/images/trash.png" bindtap="deleteSerOrderData" data-index="{{index}}" data-orderid="{{item.order_id}}" data-ordersn="{{item.order_sn}}" ></image> | ||
314 | + </view> | ||
315 | + <view wx:if="{{item.order_status == 3}}" class="c-a9" class="flex-center">已取消<view class="lin"></view> | ||
316 | + <image src="{{iurl}}miniapp/images/trash.png" bindtap="deleteSerOrderData" data-index="{{index}}" data-orderid="{{item.order_id}}" data-ordersn="{{item.order_sn}}" ></image> | ||
317 | + </view> | ||
300 | <view wx:if="{{item.order_status == 5}}">已作废</view> | 318 | <view wx:if="{{item.order_status == 5}}">已作废</view> |
301 | </view> | 319 | </view> |
302 | </view> | 320 | </view> |
@@ -367,7 +385,7 @@ | @@ -367,7 +385,7 @@ | ||
367 | <image wx:if="{{(item.order_status==1&&item.pay_status==1 && item.shipping_status==0 && item.exp_type==1 && !(item.order_goods[0].prom_type==9))}}" class="code" src="{{iurl}}miniapp/images/order/code.png" bindtap="code_show" data-order_sn="{{item.order_sn}}"></image> | 385 | <image wx:if="{{(item.order_status==1&&item.pay_status==1 && item.shipping_status==0 && item.exp_type==1 && !(item.order_goods[0].prom_type==9))}}" class="code" src="{{iurl}}miniapp/images/order/code.png" bindtap="code_show" data-order_sn="{{item.order_sn}}"></image> |
368 | <view bindtap="cancle" class="commodity_To_evaluate flex-level View_evaluation" data-id="{{tabIndex}}" data-orderid="{{item.order_id}}" data-ordersn="{{item.order_sn}}" wx:if="{{(item.order_status==0)}}" data-index="{{tabIndex}}">取消订单</view> | 386 | <view bindtap="cancle" class="commodity_To_evaluate flex-level View_evaluation" data-id="{{tabIndex}}" data-orderid="{{item.order_id}}" data-ordersn="{{item.order_sn}}" wx:if="{{(item.order_status==0)}}" data-index="{{tabIndex}}">取消订单</view> |
369 | 387 | ||
370 | - | 388 | + |
371 | <navigator class="commodity_To_evaluate flex-level View_evaluation" url="/packageA/pages/details_serviceCard/details_serviceCard?order_id={{item.order_id}}">订单详情</navigator> | 389 | <navigator class="commodity_To_evaluate flex-level View_evaluation" url="/packageA/pages/details_serviceCard/details_serviceCard?order_id={{item.order_id}}">订单详情</navigator> |
372 | 390 | ||
373 | 391 |
utils/wxParse/wxParse.wxss
@@ -178,6 +178,7 @@ view.wxParse view{ | @@ -178,6 +178,7 @@ view.wxParse view{ | ||
178 | .wxParse-li-text { | 178 | .wxParse-li-text { |
179 | align-items: center; | 179 | align-items: center; |
180 | line-height: 20px; | 180 | line-height: 20px; |
181 | + position: relative; | ||
181 | } | 182 | } |
182 | 183 | ||
183 | .wxParse-li-circle { | 184 | .wxParse-li-circle { |