Commit 724cd2b8d5ffa258ce3a2c9ca112b04172f7809d
Merge branch 'test' into 'qa'
Test See merge request !994
Showing
8 changed files
with
327 additions
and
189 deletions
custom-tab-bar/index.js
@@ -12,7 +12,6 @@ Component({ | @@ -12,7 +12,6 @@ Component({ | ||
12 | 12 | ||
13 | lifetimes: { | 13 | lifetimes: { |
14 | attached: function() { | 14 | attached: function() { |
15 | - | ||
16 | var th=this; | 15 | var th=this; |
17 | getApp().promiseGet("/api/weshop/storeDistribut/get/"+os.stoid,{}).then(rs=>{ | 16 | getApp().promiseGet("/api/weshop/storeDistribut/get/"+os.stoid,{}).then(rs=>{ |
18 | var dis=rs.data.data; | 17 | var dis=rs.data.data; |
@@ -99,7 +98,7 @@ Component({ | @@ -99,7 +98,7 @@ Component({ | ||
99 | //设置自定义页面的列表 | 98 | //设置自定义页面的列表 |
100 | set_list:function(data){ | 99 | set_list:function(data){ |
101 | var itemList = data.data; | 100 | var itemList = data.data; |
102 | - itemList = JSON.parse(itemList); | 101 | + itemList = JSON.parse(itemList); |
103 | this.setData({ | 102 | this.setData({ |
104 | list:itemList, | 103 | list:itemList, |
105 | backgroundColor: data.bkcolor, | 104 | backgroundColor: data.bkcolor, |
pages/cart/cart2/cart2.js
@@ -3855,15 +3855,20 @@ Page({ | @@ -3855,15 +3855,20 @@ Page({ | ||
3855 | if (prom_pt_json) { | 3855 | if (prom_pt_json) { |
3856 | for (let oj in prom_pt_json) { | 3856 | for (let oj in prom_pt_json) { |
3857 | let item_j = prom_pt_json[oj]; | 3857 | let item_j = prom_pt_json[oj]; |
3858 | - | ||
3859 | //要对一下阶梯优惠促销的功能 | 3858 | //要对一下阶梯优惠促销的功能 |
3860 | if (item_j.ladder_prom_id) { | 3859 | if (item_j.ladder_prom_id) { |
3861 | - | ||
3862 | //看一下要不要限制使用优惠券 | 3860 | //看一下要不要限制使用优惠券 |
3863 | if (th.data.ladder_map[item_j.ladder_prom_id] && th.data.ladder_map[item_j.ladder_prom_id].is_usecoupon) { | 3861 | if (th.data.ladder_map[item_j.ladder_prom_id] && th.data.ladder_map[item_j.ladder_prom_id].is_usecoupon) { |
3864 | continue; | 3862 | continue; |
3865 | } | 3863 | } |
3866 | - | 3864 | + cut_price += parseFloat(item_j.dis); |
3865 | + } | ||
3866 | + //要对一下组合购促销的功能 | ||
3867 | + if (item_j.zhprom_id) { | ||
3868 | + //看一下要不要限制使用优惠券 | ||
3869 | + if (th.data.zhhe_act_map[item_j.zhprom_id] && th.data.zhhe_act_map[item_j.zhprom_id].is_xz_yh) { | ||
3870 | + continue; | ||
3871 | + } | ||
3867 | cut_price += parseFloat(item_j.dis); | 3872 | cut_price += parseFloat(item_j.dis); |
3868 | } | 3873 | } |
3869 | } | 3874 | } |
pages/goods/goodsInfo/goodsInfo.wxml
@@ -490,61 +490,8 @@ | @@ -490,61 +490,8 @@ | ||
490 | </view> | 490 | </view> |
491 | </view> | 491 | </view> |
492 | </block> | 492 | </block> |
493 | - <!-- 门店收货地址 --> | ||
494 | - <view class="xc-address_frame bdt16 flex-vertical xc-ash {{def_pick_store!=null?'sn_height':'on_height'}}"> | ||
495 | - <view class="address_frame" bindtap="choice_store" data-ind="0"> | ||
496 | - <view class="flex-vertical-between "> | ||
497 | - <view class="flex-vertical select_store_height"> | ||
498 | - <image class="stores-img" src="{{iurl}}/miniapp/images/stores.png"></image> | ||
499 | - <view class="fs30" style="color:black;">选择门店</view> | ||
500 | - </view> | ||
501 | - <view class="red_bb fs26">更多门店<text class="bg_jj"></text></view> | ||
502 | - </view> | ||
503 | - <view wx:if="{{def_pick_store && def_pick_store.pickup_name}}"> | ||
504 | - <view class="flex-space-between address ai_end pdv10"> | ||
505 | - <view> | ||
506 | - <text class="fs30 xc-black3 shop_name bold">{{def_pick_store.pickup_name}}</text> | ||
507 | - </view> | ||
508 | - <view class="distance fs24" wx:if="{{def_pick_store.distance!=null}}"> | ||
509 | - 距离:{{def_pick_store.distance>1000?filters.toFix(def_pick_store.distance/1000,2)+"km":filters.toFix(def_pick_store.distance,0)+"m"}} | ||
510 | - </view> | ||
511 | - </view> | ||
512 | - <view class="no_store" wx:if="{{only_pk && !only_pk.length}}">(库存不足)</view> | ||
513 | - <block wx:else> | ||
514 | - <view class="no_store" wx:if="{{def_pickpu_list && !def_pickpu_list.length}}"> | ||
515 | - (库存不足) | ||
516 | - </view> | ||
517 | - <block wx:else> | ||
518 | - <view class="no_store" wx:if="{{def_pick_store && def_pick_store.is_no_dis}}"> | ||
519 | - (配送不匹配) | ||
520 | - </view> | ||
521 | - <view class="no_store" wx:elif="{{def_pick_store && !def_pick_store.CanOutQty && sales_rules==2 && prom_type==0}}"> | ||
522 | - (库存不足) | ||
523 | - </view> | ||
524 | - </block> | ||
525 | - </block> | ||
526 | - <view class="fs24 xc-ash-9f">地址:{{def_pick_store.fulladdress}}</view> | ||
527 | - </view> | ||
528 | - </view> | ||
529 | - </view> | ||
530 | - <!-- 许程 7.24暂时注释 --> | ||
531 | - <view class="bdt16" wx:if="{{prom_type!=1&& prom_type!=1 && prom_act.kttype!=3&&prom_act.kttype!=2&&prom_act.kttype!=1 && is_closecoupon!=1}}"> | ||
532 | - <view class="cx-frame flex" style="position: relative" wx:if="{{fir_quan.length>0}}"> | ||
533 | - <view class="cx-sizs fs30">领券</view> | ||
534 | - <view class="flex ai_c f1 pdh20"> | ||
535 | - <view class="xc-coupon-fram" wx:for="{{fir_quan}}" wx:key="id"> | ||
536 | - <view class="circle xc-circular xc-one"></view> | ||
537 | - <view class="xc-coupon t-c four-level-word"> | ||
538 | - 满{{item.condition}}减{{item.money}} | ||
539 | - </view> | ||
540 | - <view class="circle xc-circular xc-two"></view> | ||
541 | - </view> | ||
542 | - </view> | ||
543 | - <view data-coupon="1" bindtap="switchCoupon" class="cx-obtain-coupon wsize"> | ||
544 | - <text class="bg_jj"></text> | ||
545 | - </view> | ||
546 | - </view> | ||
547 | - </view> | 493 | + |
494 | + | ||
548 | <!-- 要判断是不是有促销活动 --> | 495 | <!-- 要判断是不是有促销活动 --> |
549 | <block wx:if="{{prom_goods}}"> | 496 | <block wx:if="{{prom_goods}}"> |
550 | <view class="cx-frame flex" style="position: relative; height: auto" hidden="{{prom_type==4 || prom_type==6}}"> | 497 | <view class="cx-frame flex" style="position: relative; height: auto" hidden="{{prom_type==4 || prom_type==6}}"> |
@@ -601,7 +548,6 @@ | @@ -601,7 +548,6 @@ | ||
601 | </view> | 548 | </view> |
602 | </block> | 549 | </block> |
603 | 550 | ||
604 | - | ||
605 | <!-- 要判断是不是有订单优惠 --> | 551 | <!-- 要判断是不是有订单优惠 --> |
606 | <block wx:if="{{order_prom}}"> | 552 | <block wx:if="{{order_prom}}"> |
607 | <view class="cx-frame flex" style="position: relative; height: auto"> | 553 | <view class="cx-frame flex" style="position: relative; height: auto"> |
@@ -664,7 +610,61 @@ | @@ -664,7 +610,61 @@ | ||
664 | </view> | 610 | </view> |
665 | </block> | 611 | </block> |
666 | </block> | 612 | </block> |
667 | - | 613 | + <!-- 许程 7.24暂时注释 --> |
614 | + <view class="bdt16" wx:if="{{prom_type!=1&& prom_type!=1 && prom_act.kttype!=3&&prom_act.kttype!=2&&prom_act.kttype!=1 && is_closecoupon!=1}}"> | ||
615 | + <view class="cx-frame flex" style="position: relative" wx:if="{{fir_quan.length>0}}"> | ||
616 | + <view class="cx-sizs fs30">领券</view> | ||
617 | + <view class="flex ai_c f1 pdh20"> | ||
618 | + <view class="xc-coupon-fram" wx:for="{{fir_quan}}" wx:key="id"> | ||
619 | + <view class="circle xc-circular xc-one"></view> | ||
620 | + <view class="xc-coupon t-c four-level-word"> | ||
621 | + 满{{item.condition}}减{{item.money}} | ||
622 | + </view> | ||
623 | + <view class="circle xc-circular xc-two"></view> | ||
624 | + </view> | ||
625 | + </view> | ||
626 | + <view data-coupon="1" bindtap="switchCoupon" class="cx-obtain-coupon wsize"> | ||
627 | + <text class="bg_jj"></text> | ||
628 | + </view> | ||
629 | + </view> | ||
630 | + </view> | ||
631 | + <!-- 门店收货地址 --> | ||
632 | + <view class="xc-address_frame bdt16 flex-vertical xc-ash {{def_pick_store!=null?'sn_height':'on_height'}}"> | ||
633 | + <view class="address_frame" bindtap="choice_store" data-ind="0"> | ||
634 | + <view class="flex-vertical-between "> | ||
635 | + <view class="flex-vertical select_store_height"> | ||
636 | + <image class="stores-img" src="{{iurl}}/miniapp/images/stores.png"></image> | ||
637 | + <view class="fs30" style="color:black;">选择门店</view> | ||
638 | + </view> | ||
639 | + <view class="red_bb fs26">更多门店<text class="bg_jj"></text></view> | ||
640 | + </view> | ||
641 | + <view wx:if="{{def_pick_store && def_pick_store.pickup_name}}"> | ||
642 | + <view class="flex-space-between address ai_end pdv10"> | ||
643 | + <view> | ||
644 | + <text class="fs30 xc-black3 shop_name bold">{{def_pick_store.pickup_name}}</text> | ||
645 | + </view> | ||
646 | + <view class="distance fs24" wx:if="{{def_pick_store.distance!=null}}"> | ||
647 | + 距离:{{def_pick_store.distance>1000?filters.toFix(def_pick_store.distance/1000,2)+"km":filters.toFix(def_pick_store.distance,0)+"m"}} | ||
648 | + </view> | ||
649 | + </view> | ||
650 | + <view class="no_store" wx:if="{{only_pk && !only_pk.length}}">(库存不足)</view> | ||
651 | + <block wx:else> | ||
652 | + <view class="no_store" wx:if="{{def_pickpu_list && !def_pickpu_list.length}}"> | ||
653 | + (库存不足) | ||
654 | + </view> | ||
655 | + <block wx:else> | ||
656 | + <view class="no_store" wx:if="{{def_pick_store && def_pick_store.is_no_dis}}"> | ||
657 | + (配送不匹配) | ||
658 | + </view> | ||
659 | + <view class="no_store" wx:elif="{{def_pick_store && !def_pick_store.CanOutQty && sales_rules==2 && prom_type==0}}"> | ||
660 | + (库存不足) | ||
661 | + </view> | ||
662 | + </block> | ||
663 | + </block> | ||
664 | + <view class="fs24 xc-ash-9f">地址:{{def_pick_store.fulladdress}}</view> | ||
665 | + </view> | ||
666 | + </view> | ||
667 | + </view> | ||
668 | <!-- 保障服务 --> | 668 | <!-- 保障服务 --> |
669 | <view class="bz_view flex bdt16 ai_c" wx:if="{{bconfig.service_bz}}"> | 669 | <view class="bz_view flex bdt16 ai_c" wx:if="{{bconfig.service_bz}}"> |
670 | <image class="bzfu_img" src="{{iurl}}/miniapp/images/bzfu_w.png"></image> | 670 | <image class="bzfu_img" src="{{iurl}}/miniapp/images/bzfu_w.png"></image> |
@@ -676,7 +676,6 @@ | @@ -676,7 +676,6 @@ | ||
676 | </view> | 676 | </view> |
677 | </view> | 677 | </view> |
678 | </view> | 678 | </view> |
679 | - | ||
680 | <!-- - 搭配促销 -- --> | 679 | <!-- - 搭配促销 -- --> |
681 | <view class="dp_cx_view" wx:if="{{collocationGoods}}"> | 680 | <view class="dp_cx_view" wx:if="{{collocationGoods}}"> |
682 | <view class="bb_view"> | 681 | <view class="bb_view"> |
pages/goods/search/g_filter.wxs
1 | var g_filters = { | 1 | var g_filters = { |
2 | - //-- 判断是不是有等级价 -- | ||
3 | - is_has_rank:function(rank_switch,item){ | ||
4 | - if(!rank_switch) return false; | ||
5 | - if(item.cardprice1 || item.cardprice2 || item.cardprice3) {return true} | ||
6 | - return false; | ||
7 | - }, | ||
8 | - | ||
9 | - //-- 判断,不是等级会员时候,要显示的最低等级价和名称 -- | ||
10 | - get_card_price:function(goods,all_card,type){ | ||
11 | - var price1=parseFloat(goods['cardprice1']); | ||
12 | - var price2=parseFloat(goods['cardprice2']); | ||
13 | - var price3=parseFloat(goods['cardprice3']); | ||
14 | - if(!all_card){ | ||
15 | - if(type==0) return 0; | ||
16 | - return ""; | ||
17 | - } | ||
18 | - | ||
19 | - var arr=[]; | ||
20 | - var min_price= 0; | ||
21 | - var min_name=""; | ||
22 | - | ||
23 | - var min_price=null; | ||
24 | - var min_name=null; | ||
25 | - //---设置对应的价格名字---- | ||
26 | - for(var i=0;i<3;i++) { | ||
27 | - var vl=all_card[i]; | ||
28 | - if(!vl) continue; | ||
29 | - if(vl['CorrPrice']=="Price1" && price1>0) | ||
30 | - { | ||
31 | - if(min_price==null) { | ||
32 | - min_price=price1;min_name=vl['CardName']; | ||
33 | - } | ||
34 | - else if(price1<min_price) { | ||
35 | - min_price=price1;min_name=vl['CardName']; | ||
36 | - } | ||
37 | - } | ||
38 | - if(vl['CorrPrice']=="Price2" && price2>0) | ||
39 | - { | ||
40 | - if(min_price==null) { | ||
41 | - min_price=price2;min_name=vl['CardName']; | ||
42 | - } | ||
43 | - else if(price2<min_price) { | ||
44 | - min_price=price2;min_name=vl['CardName']; | ||
45 | - } | ||
46 | - } | ||
47 | - | ||
48 | - if(vl['CorrPrice']=="Price3" && price3>0) | ||
49 | - { | ||
50 | - if(min_price==null) { | ||
51 | - min_price=price3;min_name=vl['CardName']; | ||
52 | - } | ||
53 | - else if(price3<min_price) { | ||
54 | - min_price=price3;min_name=vl['CardName']; | ||
55 | - } | ||
56 | - } | ||
57 | - | ||
58 | - } | ||
59 | - if(min_price==null){ | ||
60 | - if(type==0) return 0; | ||
61 | - return ""; | ||
62 | - } | ||
63 | - | ||
64 | - //if(type==0) return arr.length; | ||
65 | - //--进行排序,升序--- | ||
66 | - /*--- | ||
67 | - arr.sort(function(a,b){ | ||
68 | - if (a.price < b.price) { | ||
69 | - return -1; | ||
70 | - } else if (a.fee == b.fee) { | ||
71 | - return 0; | ||
72 | - } else { | ||
73 | - return 1; | ||
74 | - } | ||
75 | - })--*/ | ||
76 | - //-- 获取最下价钱,和相应的卡的名称 -- | ||
77 | - //min_price=min.price; | ||
78 | - //min_name=min.name; | ||
79 | - if(type==0) return min_price.toFixed(2); | ||
80 | - if(min_name.length>7 ) min_name=min_name.substring(0, 8); | ||
81 | - return min_name; | ||
82 | - }, | 2 | + //-- 判断是不是有等级价 -- |
3 | + is_has_rank: function (rank_switch, item) { | ||
4 | + if (!rank_switch) return false; | ||
5 | + if (item.cardprice1 || item.cardprice2 || item.cardprice3) { return true } | ||
6 | + return false; | ||
7 | + }, | ||
83 | 8 | ||
9 | + //-- 判断,不是等级会员时候,要显示的最低等级价和名称 -- | ||
10 | + get_card_price: function (goods, all_card, type) { | ||
11 | + var price1 = parseFloat(goods['cardprice1']); | ||
12 | + var price2 = parseFloat(goods['cardprice2']); | ||
13 | + var price3 = parseFloat(goods['cardprice3']); | ||
14 | + if (!all_card) { | ||
15 | + if (type == 0) return 0; | ||
16 | + return ""; | ||
17 | + } | ||
84 | 18 | ||
85 | - get_goods_url:function(item){ | 19 | + var arr = []; |
20 | + var min_price = 0; | ||
21 | + var min_name = ""; | ||
86 | 22 | ||
87 | - var url1="/pages/goods/goodsInfo/goodsInfo?goods_id="+item.goods_id | ||
88 | - // 预售活动 | ||
89 | - if(item.prom_type==8){ | ||
90 | - url1="/packageC/pages/presell/goodsInfo/goodsInfo?goods_id="+item.goods_id+"&prom_id="+item.prom_id | ||
91 | - } | ||
92 | - // 如果是幸运购活动商品 | ||
93 | - if(item.prom_type == 9){ | ||
94 | - url1 = "/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo?goods_id=" + item.goods_id + "&group_id=" + item.prom_id | ||
95 | - } | ||
96 | - | ||
97 | - if(item.prom_type==1 && item.prom_id>0){ | ||
98 | - url1="/pages/goods/goodsInfo/goodsInfo?goods_id="+item.goods_id+"&prom_id="+item.prom_id+"&prom_type=1"; | ||
99 | - } | ||
100 | - return url1; | ||
101 | - } | 23 | + var min_price = null; |
24 | + var min_name = null; | ||
25 | + //---设置对应的价格名字---- | ||
26 | + for (var i = 0; i < 3; i++) { | ||
27 | + var vl = all_card[i]; | ||
28 | + if (!vl) continue; | ||
29 | + if (vl['CorrPrice'] == "Price1" && price1 > 0) { | ||
30 | + if (min_price == null) { | ||
31 | + min_price = price1; min_name = vl['CardName']; | ||
32 | + } | ||
33 | + else if (price1 < min_price) { | ||
34 | + min_price = price1; min_name = vl['CardName']; | ||
35 | + } | ||
36 | + } | ||
37 | + if (vl['CorrPrice'] == "Price2" && price2 > 0) { | ||
38 | + if (min_price == null) { | ||
39 | + min_price = price2; min_name = vl['CardName']; | ||
40 | + } | ||
41 | + else if (price2 < min_price) { | ||
42 | + min_price = price2; min_name = vl['CardName']; | ||
43 | + } | ||
44 | + } | ||
45 | + | ||
46 | + if (vl['CorrPrice'] == "Price3" && price3 > 0) { | ||
47 | + if (min_price == null) { | ||
48 | + min_price = price3; min_name = vl['CardName']; | ||
49 | + } | ||
50 | + else if (price3 < min_price) { | ||
51 | + min_price = price3; min_name = vl['CardName']; | ||
52 | + } | ||
53 | + } | ||
54 | + | ||
55 | + } | ||
56 | + if (min_price == null) { | ||
57 | + if (type == 0) return 0; | ||
58 | + return ""; | ||
59 | + } | ||
60 | + | ||
61 | + //if(type==0) return arr.length; | ||
62 | + //--进行排序,升序--- | ||
63 | + /*--- | ||
64 | + arr.sort(function(a,b){ | ||
65 | + if (a.price < b.price) { | ||
66 | + return -1; | ||
67 | + } else if (a.fee == b.fee) { | ||
68 | + return 0; | ||
69 | + } else { | ||
70 | + return 1; | ||
71 | + } | ||
72 | + })--*/ | ||
73 | + //-- 获取最下价钱,和相应的卡的名称 -- | ||
74 | + //min_price=min.price; | ||
75 | + //min_name=min.name; | ||
76 | + if (type == 0) return min_price.toFixed(2); | ||
77 | + if (min_name.length > 7) min_name = min_name.substring(0, 8); | ||
78 | + return min_name; | ||
79 | + }, | ||
80 | + | ||
81 | + | ||
82 | + get_goods_url: function (item) { | ||
83 | + | ||
84 | + var url1 = "/pages/goods/goodsInfo/goodsInfo?goods_id=" + item.goods_id | ||
85 | + // 预售活动 | ||
86 | + if (item.prom_type == 8) { | ||
87 | + url1 = "/packageC/pages/presell/goodsInfo/goodsInfo?goods_id=" + item.goods_id + "&prom_id=" + item.prom_id | ||
88 | + } | ||
89 | + // 如果是幸运购活动商品 | ||
90 | + if (item.prom_type == 9) { | ||
91 | + url1 = "/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo?goods_id=" + item.goods_id + "&group_id=" + item.prom_id | ||
92 | + } | ||
93 | + | ||
94 | + if (item.prom_type == 1 && item.prom_id > 0) { | ||
95 | + url1 = "/pages/goods/goodsInfo/goodsInfo?goods_id=" + item.goods_id + "&prom_id=" + item.prom_id + "&prom_type=1"; | ||
96 | + } | ||
97 | + return url1; | ||
98 | + } | ||
102 | } | 99 | } |
103 | 100 | ||
104 | module.exports = { | 101 | module.exports = { |
105 | - is_has_rank:g_filters.is_has_rank, | ||
106 | - get_card_price:g_filters.get_card_price, | ||
107 | - get_goods_url:g_filters.get_goods_url | 102 | + is_has_rank: g_filters.is_has_rank, |
103 | + get_card_price: g_filters.get_card_price, | ||
104 | + get_goods_url: g_filters.get_goods_url | ||
108 | } | 105 | } |
109 | \ No newline at end of file | 106 | \ No newline at end of file |
pages/index/index/index.js
pages/user/address_list/address_list.js
@@ -56,10 +56,8 @@ Page({ | @@ -56,10 +56,8 @@ Page({ | ||
56 | var arr1 = e.data.addresses; | 56 | var arr1 = e.data.addresses; |
57 | var arr2 = t.data.data.pageData; | 57 | var arr2 = t.data.data.pageData; |
58 | var arr3 = [...arr1, ...arr2]; | 58 | var arr3 = [...arr1, ...arr2]; |
59 | - | ||
60 | var ismore = 0; | 59 | var ismore = 0; |
61 | if (arr3.length == t.data.data.total) ismore = 1 | 60 | if (arr3.length == t.data.data.total) ismore = 1 |
62 | - | ||
63 | e.setData({ | 61 | e.setData({ |
64 | addresses: arr3, total: t.data.data.total, ismore: ismore, | 62 | addresses: arr3, total: t.data.data.total, ismore: ismore, |
65 | is_address_read:1 | 63 | is_address_read:1 |
pages/user/address_list/address_list.wxml
@@ -32,7 +32,7 @@ | @@ -32,7 +32,7 @@ | ||
32 | <view class="address-box"> | 32 | <view class="address-box"> |
33 | 33 | ||
34 | <!-- 单个收货地址框架 --> | 34 | <!-- 单个收货地址框架 --> |
35 | - <view class="address-user" wx:for="{{addresses}}" wx:key="{{index}}"> | 35 | + <view class="address-user" wx:for="{{addresses}}" wx:key="index"> |
36 | <!-- 选择icon | 36 | <!-- 选择icon |
37 | <view class="icon"> | 37 | <view class="icon"> |
38 | <icon type="success" color="red" size="33rpx" wx:if="{{item.is_pickup==1}}" bindtap="add_is_pickup" data-icon="{{index}}"></icon> | 38 | <icon type="success" color="red" size="33rpx" wx:if="{{item.is_pickup==1}}" bindtap="add_is_pickup" data-icon="{{index}}"></icon> |
pages/user/order_list/order_list.js
@@ -2224,35 +2224,176 @@ Page({ | @@ -2224,35 +2224,176 @@ Page({ | ||
2224 | }, | 2224 | }, |
2225 | 2225 | ||
2226 | // 卡项订单 - 立即支付 | 2226 | // 卡项订单 - 立即支付 |
2227 | - pay(e) { | 2227 | + pay: async function(e) { |
2228 | let index = e.currentTarget.dataset.index; | 2228 | let index = e.currentTarget.dataset.index; |
2229 | let item = this.data.cardList[index]; | 2229 | let item = this.data.cardList[index]; |
2230 | let order_sn = item.order_sn; | 2230 | let order_sn = item.order_sn; |
2231 | let order_id = item.order_id; | 2231 | let order_id = item.order_id; |
2232 | let store_id = app.globalData.setting.stoid; | 2232 | let store_id = app.globalData.setting.stoid; |
2233 | - // console.log('go1!!!!!!!!!!!!!!!!!!!!!!!!!',index,item,order_sn,store_id); | 2233 | + let user_id = oo.user_id; |
2234 | + let flag = true; | ||
2235 | + | ||
2236 | + | ||
2237 | + // 如果是普通购买或单独购买,不用判断 | ||
2238 | + // 如果是秒杀购买:1、判断活动是否变化;2、是否超出限购 | ||
2239 | + | ||
2240 | + let list = item.list; | ||
2241 | + for(const it of list) { | ||
2242 | + if(it.prom_type == 1) { | ||
2243 | + let act_details = null; | ||
2244 | + let redis_num = 0; | ||
2245 | + let promcardbuynum = 0; | ||
2246 | + let qty = it.qty; | ||
2247 | + | ||
2248 | + | ||
2249 | + await getApp().request.promiseGet('/api/ms/flash_sale/getNew/' + store_id + '/' + user_id + '/' + it.prom_id, {}).then(res => { | ||
2250 | + console.log('11111111====>>>'); | ||
2251 | + if(res.data.code == 0) { | ||
2252 | + console.log('当前的秒杀活动信息:', res.data.data); | ||
2253 | + act_details = res.data.data; | ||
2254 | + if(act_details.is_end == 1) { | ||
2255 | + wx.showModal({ | ||
2256 | + title: '提示', | ||
2257 | + content: '活动已结束,无法支付,请取消订单!', | ||
2258 | + showCancel: false, | ||
2259 | + }); | ||
2260 | + flag = false; | ||
2261 | + return false; | ||
2262 | + }; | ||
2263 | + if(act_details.id != it.prom_id) { | ||
2264 | + wx.showModal({ | ||
2265 | + title: '提示', | ||
2266 | + content: '活动发生了变化,无法支付,请取消订单,重新购买!', | ||
2267 | + showCancel: false, | ||
2268 | + }); | ||
2269 | + flag = false; | ||
2270 | + return false; | ||
2271 | + }; | ||
2272 | + }; | ||
2273 | + }); | ||
2274 | + | ||
2275 | + await getApp().request.promiseGet('/api/weshop/activitylist/getActLen/' + store_id + '/' + it.prom_type + '/' + it.prom_id, { | ||
2276 | + 1: 1 | ||
2277 | + }).then(res => { | ||
2278 | + console.log('222222222====>>>'); | ||
2279 | + if (res.data.code == 0) { | ||
2280 | + // 当前可以购买的数量 | ||
2281 | + console.log('redis当前可以购买的数量:', res.data.data); | ||
2282 | + redis_num = res.data.data; | ||
2283 | + // if(redis_num <=0) { | ||
2284 | + // wx.showModal({ | ||
2285 | + // title: '提示', | ||
2286 | + // content: '活动库存不足,无法支付,请取消订单!', | ||
2287 | + // showCancel: false, | ||
2288 | + // }); | ||
2289 | + // // flag = false; | ||
2290 | + // return true; | ||
2291 | + // }; | ||
2292 | + }; | ||
2293 | + }); | ||
2294 | + | ||
2295 | + await getApp().request.promiseGet("/api/weshop/rechargeServicelist/getUserBuyGoodsNum", { | ||
2296 | + data: { | ||
2297 | + store_id: store_id, | ||
2298 | + user_id: user_id, | ||
2299 | + card_id: it.card_id, | ||
2300 | + prom_type: it.prom_type, | ||
2301 | + prom_id: it.prom_id, | ||
2302 | + } | ||
2303 | + }).then(res => { | ||
2304 | + console.log('333333333====>>>'); | ||
2305 | + if (res.data.code == 0) { | ||
2306 | + console.log('已经购买的数量:', res.data.data); | ||
2307 | + promcardbuynum = res.data.data.promcardbuynum; | ||
2308 | + | ||
2309 | + | ||
2310 | + let limited = act_details.buy_limit; // 限购数量a | ||
2311 | + let buyedNum = promcardbuynum; // 自己已经购买的数量b | ||
2312 | + let canBuyNum = limited - buyedNum; // 自己还可购买的数量c | ||
2313 | + | ||
2314 | + | ||
2315 | + if(canBuyNum <= 0) { | ||
2316 | + wx.showModal({ | ||
2317 | + title: '提示', | ||
2318 | + content: '您已超出活动限购数量,无法支付,请取消订单!', | ||
2319 | + showCancel: false, | ||
2320 | + }); | ||
2321 | + flag = false; | ||
2322 | + return false; | ||
2323 | + }; | ||
2324 | + | ||
2325 | + if(limited > redis_num) { | ||
2326 | + if(canBuyNum <= redis_num) { | ||
2327 | + if(qty > canBuyNum) { | ||
2328 | + wx.showModal({ | ||
2329 | + title: '提示', | ||
2330 | + content: '您已超出活动限购数量,无法支付,请取消订单!', | ||
2331 | + showCancel: false, | ||
2332 | + }); | ||
2333 | + flag = false; | ||
2334 | + return false; | ||
2335 | + }; | ||
2336 | + | ||
2337 | + }; | ||
2338 | + | ||
2339 | + if(canBuyNum > redis_num) { | ||
2340 | + if(qty > redis_num) { | ||
2341 | + wx.showModal({ | ||
2342 | + title: '提示', | ||
2343 | + content: '活动库存不足,无法支付,请取消订单!', | ||
2344 | + showCancel: false, | ||
2345 | + }); | ||
2346 | + flag = false; | ||
2347 | + return false; | ||
2348 | + }; | ||
2349 | + | ||
2350 | + }; | ||
2351 | + }; | ||
2352 | + | ||
2353 | + if(limited <= redis_num) { | ||
2354 | + if(qty > canBuyNum) { | ||
2355 | + wx.showModal({ | ||
2356 | + title: '提示', | ||
2357 | + content: '您已超出活动限购数量,无法支付,请取消订单!', | ||
2358 | + showCancel: false, | ||
2359 | + }); | ||
2360 | + flag = false; | ||
2361 | + return false; | ||
2362 | + }; | ||
2363 | + }; | ||
2364 | + }; | ||
2365 | + }); | ||
2366 | + | ||
2367 | + }; | ||
2368 | + | ||
2369 | + }; | ||
2370 | + | ||
2234 | 2371 | ||
2235 | - app.request.post('/api/weshop/order/pay/createRechargeOrder', { | ||
2236 | - data: { | ||
2237 | - parentSn: order_sn, | ||
2238 | - store_id: store_id, | ||
2239 | - }, | 2372 | + if(flag) { |
2373 | + await app.request.promisePost('/api/weshop/order/pay/createRechargeOrder', { | ||
2374 | + data: { | ||
2375 | + parentSn: order_sn, | ||
2376 | + store_id: store_id, | ||
2377 | + }, | ||
2378 | + }).then(res => { | ||
2379 | + // success: function(res) { | ||
2380 | + var n = res.data.data; | ||
2381 | + self.weixinPay(n, function() { | ||
2382 | + app.showWarning('支付成功'); | ||
2383 | + | ||
2384 | + }, function() { | ||
2385 | + app.showWarning('支付失败'); | ||
2386 | + // setTimeout(function() { | ||
2387 | + // wx.reLaunch({ | ||
2388 | + // url: '/packageA/pages/cardList/cardList', | ||
2389 | + // }) | ||
2390 | + // }, 1000) | ||
2391 | + }); | ||
2392 | + // } | ||
2393 | + }); | ||
2394 | + }; | ||
2395 | + | ||
2240 | 2396 | ||
2241 | - success: function(res) { | ||
2242 | - var n = res.data.data; | ||
2243 | - self.weixinPay(n, function() { | ||
2244 | - app.showWarning('支付成功'); | ||
2245 | - | ||
2246 | - }, function() { | ||
2247 | - app.showWarning('支付失败'); | ||
2248 | - // setTimeout(function() { | ||
2249 | - // wx.reLaunch({ | ||
2250 | - // url: '/packageA/pages/cardList/cardList', | ||
2251 | - // }) | ||
2252 | - // }, 1000) | ||
2253 | - }); | ||
2254 | - } | ||
2255 | - }) | ||
2256 | }, | 2397 | }, |
2257 | 2398 | ||
2258 | //------调起支付框-------- | 2399 | //------调起支付框-------- |