Commit 26b73d9b95362fa64471449745c26d32f3d00f5c
Merge branch 'dev' of http://git.vipzhuang.cn/wxd/MShopWeApp into dev
Showing
9 changed files
with
105 additions
and
33 deletions
pages/cart/cart/cart.js
... | ... | @@ -551,7 +551,7 @@ Page({ |
551 | 551 | |
552 | 552 | }else{ |
553 | 553 | //未找到商品的活动 |
554 | - is_flag = 0; | |
554 | + isok = 0; | |
555 | 555 | } |
556 | 556 | }) |
557 | 557 | if (!isok){ |
... | ... | @@ -597,10 +597,7 @@ Page({ |
597 | 597 | item.prom_type=3; |
598 | 598 | item.prom_id=r_data.promGoodsLists[0].prom_id; |
599 | 599 | }else if(r_data.ladderLists){ |
600 | - var url = '/api/weshop/cart/update'; | |
601 | - getApp().request.put(url, { | |
602 | - data:{id:item.id,store_id:oo.stoid,prom_type:10,prom_id:r_data.ladderLists[0].form_id} | |
603 | - }); | |
600 | + | |
604 | 601 | item.prom_type=10; |
605 | 602 | item.prom_id=r_data.ladderLists[0].form_id; |
606 | 603 | |
... | ... | @@ -644,24 +641,29 @@ Page({ |
644 | 641 | if (!isok){ |
645 | 642 | item.prom_type=0; |
646 | 643 | item.prom_id=0; |
647 | - continue; | |
644 | + }else{ | |
645 | + var url = '/api/weshop/cart/update'; | |
646 | + getApp().request.put(url, { | |
647 | + data:{id:item.id,store_id:oo.stoid,prom_type:10,prom_id:act.id} | |
648 | + }); | |
648 | 649 | |
649 | - } | |
650 | - th.data.ladder_map[item.prom_id]=act; | |
651 | - //-- 获取阶梯规则 -- | |
652 | - var url1 = "/api/weshop/prom/ladderList/list"; | |
653 | - var req_data = { | |
654 | - store_id: os.stoid, | |
655 | - form_id: item.prom_id, | |
656 | - } | |
657 | - await getApp().request.promiseGet(url1, { | |
658 | - data: req_data | |
659 | - }).then(rs1 => { | |
660 | - if (rs1.data.code==0 && rs1.data.data) { | |
661 | - var gdlist = rs1.data.data; | |
662 | - th.data.ladder_map[item.prom_id].ladder_list=gdlist; | |
650 | + th.data.ladder_map[item.prom_id]=act; | |
651 | + //-- 获取阶梯规则 -- | |
652 | + var url1 = "/api/weshop/prom/ladderList/list"; | |
653 | + var req_data = { | |
654 | + store_id: os.stoid, | |
655 | + form_id: item.prom_id, | |
663 | 656 | } |
664 | - }) | |
657 | + await getApp().request.promiseGet(url1, { | |
658 | + data: req_data | |
659 | + }).then(rs1 => { | |
660 | + if (rs1.data.code==0 && rs1.data.data) { | |
661 | + var gdlist = rs1.data.data; | |
662 | + th.data.ladder_map[item.prom_id].ladder_list=gdlist; | |
663 | + } | |
664 | + }) | |
665 | + } | |
666 | + | |
665 | 667 | } |
666 | 668 | //直接把活动赋值给元素 |
667 | 669 | if(th.data.ladder_map[item.prom_id] && th.data.ladder_map[item.prom_id]!=-1 ){ | ... | ... |
pages/cart/cart2/cart2.js
... | ... | @@ -126,6 +126,7 @@ Page({ |
126 | 126 | in_zhact_gdmap:{}, //不同门店参与同一活动的限购 |
127 | 127 | hid_inp:1, |
128 | 128 | user_note:{}, |
129 | + zhhe_act_map:{}, //组合活动的map表 | |
129 | 130 | zuhe_map_good:{}, //组合购的map表 |
130 | 131 | ladder_map:{}, //阶梯促销的map表 |
131 | 132 | |
... | ... | @@ -484,6 +485,7 @@ Page({ |
484 | 485 | isok = 0; |
485 | 486 | } |
486 | 487 | item1.act = res.data.data; |
488 | + th.data.zhhe_act_map[item1.prom_id] = res.data.data; | |
487 | 489 | } else { |
488 | 490 | //未找到商品的活动 |
489 | 491 | is_flag = 0; |
... | ... | @@ -517,6 +519,10 @@ Page({ |
517 | 519 | } |
518 | 520 | }) |
519 | 521 | } |
522 | + else | |
523 | + { | |
524 | + item1.act = th.data.zhhe_act_map[item1.prom_id]; | |
525 | + } | |
520 | 526 | } |
521 | 527 | if(item1.prom_type==10){ |
522 | 528 | if(!th.data.ladder_map[item1.prom_id]){ |
... | ... | @@ -1455,8 +1461,8 @@ Page({ |
1455 | 1461 | if(item[j].prom_type!=7 && item[j].prom_type!=10 ) is_no_zh=1; |
1456 | 1462 | |
1457 | 1463 | //组合购的商品,且有订单优惠的叠加,is_orderyh就是优惠叠加 |
1458 | - if(item[j].prom_type==7 && zh_prom_goods && zh_prom_goods[item[j].prom_id] | |
1459 | - && zh_prom_goods[item[j].prom_id].act.is_orderyh ) | |
1464 | + if(item[j].prom_type==7 && th.data.zhhe_act_map && th.data.zhhe_act_map[item[j].prom_id] | |
1465 | + && th.data.zhhe_act_map[item[j].prom_id].is_orderyh ) | |
1460 | 1466 | { |
1461 | 1467 | is_no_zh=1; |
1462 | 1468 | } |
... | ... | @@ -2586,7 +2592,10 @@ Page({ |
2586 | 2592 | goods.offline_cut = (g_item.goods_price - g_item.offline_price).toFixed(2); |
2587 | 2593 | goods.pricing_type = g_item.pricing_type; |
2588 | 2594 | } |
2589 | - | |
2595 | + if(g_item.quan_num){ | |
2596 | + goods.quan_num=g_item.quan_num; | |
2597 | + goods.quan_no=g_item.quan_no; | |
2598 | + } | |
2590 | 2599 | //--判断活动的类型-- |
2591 | 2600 | switch (g_item.prom_type) { |
2592 | 2601 | case 1: |
... | ... | @@ -3633,6 +3642,16 @@ Page({ |
3633 | 3642 | } |
3634 | 3643 | } |
3635 | 3644 | |
3645 | + var prom_pt_json= ep.prom_pt_json; | |
3646 | + if(prom_pt_json){ | |
3647 | + for(let oj in prom_pt_json){ | |
3648 | + let item_j=prom_pt_json[oj]; | |
3649 | + if(item_j.ladder_prom_id){ | |
3650 | + cut_price += parseFloat(item_j.dis); | |
3651 | + } | |
3652 | + } | |
3653 | + } | |
3654 | + | |
3636 | 3655 | arr[ind].ckeck_quan_price = ckeck_quan_price - cut_price; |
3637 | 3656 | arr[ind].check_quan_ware_list = check_quan_ware_list; |
3638 | 3657 | arr[ind].check_quan_price_list = check_quan_price_list; |
... | ... | @@ -4054,7 +4073,7 @@ Page({ |
4054 | 4073 | |
4055 | 4074 | //进行对商品的平摊g_item是单个商品,you_item是这个商品分多少优惠券的钱,goods是商品列表 |
4056 | 4075 | split_set_goods_quanprice:async function (you_item,t_item) { |
4057 | - var coupon_price=t_item.coupon_price; | |
4076 | + var coupon_price=you_item.WareCashSum; | |
4058 | 4077 | var goods=t_item.goods; |
4059 | 4078 | var arr=[]; |
4060 | 4079 | //判断是不是有goods_id重复 | ... | ... |
pages/cart/cart2/zh_calculate.js
... | ... | @@ -15,6 +15,7 @@ module.exports = { |
15 | 15 | let act_item = zh_prom_goods[i]; |
16 | 16 | let act_goos = act_item.gdlist; |
17 | 17 | let act = act_item.act; |
18 | + if(!act) continue; | |
18 | 19 | |
19 | 20 | let all_num = 0; //商品数量之和 |
20 | 21 | let all_price0 = 0; //商品数量之和 |
... | ... | @@ -103,7 +104,7 @@ module.exports = { |
103 | 104 | } |
104 | 105 | |
105 | 106 | //当满足组合的要求:总数要满足,起购数要满足 |
106 | - if (all_num >= act.zhbuyqty && !need_to_buy) { | |
107 | + if (act && all_num >= act.zhbuyqty && !need_to_buy) { | |
107 | 108 | |
108 | 109 | //商品的列表 |
109 | 110 | for (var u in act_goos) { | ... | ... |
pages/giftpack/giftpacklist/giftpacklist.js
pages/goods/goodsInfo/goodsInfo.js
... | ... | @@ -3708,7 +3708,16 @@ Page({ |
3708 | 3708 | //如果是秒杀的时候 |
3709 | 3709 | if(th.data.prom_type==0 && gd.prom_type == 1 ){ |
3710 | 3710 | gd.prom_type= 0; |
3711 | - } | |
3711 | + } | |
3712 | + //如果全场优惠,商品做了秒杀 | |
3713 | + if(th.data.prom_type==3 && gd.prom_type == 1 ){ | |
3714 | + gd.prom_type= 0; | |
3715 | + } | |
3716 | + //如果全场阶梯优惠,商品做了秒杀 | |
3717 | + if(th.data.prom_type==10 && gd.prom_type == 1 ){ | |
3718 | + gd.prom_type= 0; | |
3719 | + } | |
3720 | + | |
3712 | 3721 | |
3713 | 3722 | if (!th.data.is_normal && ( gd.prom_type == 1 || gd.prom_type == 2 || gd.prom_type == 4 || gd.prom_type == 6)) { |
3714 | 3723 | //----获取活动购买数---- | ... | ... |
pages/goods/goodsList/goodsList.js
... | ... | @@ -22,7 +22,8 @@ Page({ |
22 | 22 | is_hot:0, |
23 | 23 | prom_goods_list:null, |
24 | 24 | rq_data:null, |
25 | - isToggle: false, //切换商品视图控制符 | |
25 | + isToggle: false, //切换商品视图控制符 | |
26 | + show_all:1, //判断显示 | |
26 | 27 | }, |
27 | 28 | |
28 | 29 | onLoad: function(t) { |
... | ... | @@ -115,6 +116,21 @@ Page({ |
115 | 116 | }).then(res=>{ |
116 | 117 | if(res.data.code==0 && res.data.data){ |
117 | 118 | var arr= res.data.data; |
119 | + | |
120 | + if(arr.is_end==1){ | |
121 | + th.setData({show_all:0,err_txt:'活动已结束'}); | |
122 | + return false; | |
123 | + } | |
124 | + if(arr.start_time>ut.gettimestamp()){ | |
125 | + th.setData({show_all:0,err_txt:'活动还未开始'}); | |
126 | + return false; | |
127 | + } | |
128 | + if(arr.end_time<ut.gettimestamp()){ | |
129 | + th.setData({show_all:0}); | |
130 | + th.setData({show_all:0,err_txt:'活动已结束'}); | |
131 | + return false; | |
132 | + } | |
133 | + | |
118 | 134 | var url1="/api/weshop/prom/ladderList/list?store_id="+oo.stoid+"&form_id="+arr.id; |
119 | 135 | getApp().request.promiseGet(url1, {}).then(rs=>{ |
120 | 136 | if(rs.data.code==0 && rs.data.data && rs.data.data.length) { |
... | ... | @@ -131,9 +147,14 @@ Page({ |
131 | 147 | } |
132 | 148 | }) |
133 | 149 | } |
150 | + else{ | |
151 | + th.setData({show_all:0,err_txt:'未找到活动或者身份不符'}); | |
152 | + } | |
134 | 153 | }) |
135 | 154 | } |
136 | 155 | |
156 | + | |
157 | + | |
137 | 158 | this.requestGoodsList(url); |
138 | 159 | getApp().getConfig2(function(rs){ |
139 | 160 | //计算等级价相关 |
... | ... | @@ -417,4 +438,10 @@ Page({ |
417 | 438 | }, |
418 | 439 | |
419 | 440 | |
441 | + go_url:function (e) { | |
442 | + var url=e.currentTarget.dataset.url; | |
443 | + getApp().goto(url); | |
444 | + } | |
445 | + | |
446 | + | |
420 | 447 | }); |
421 | 448 | \ No newline at end of file | ... | ... |
pages/goods/goodsList/goodsList.wxml
1 | 1 | <wxs module="g_filter" src="g_filter.wxs"></wxs> |
2 | -<view class="container"> | |
2 | +<view class="container" wx:if="{{show_all}}"> | |
3 | 3 | <view> |
4 | 4 | <block wx:for="{{prom_goods_list}}"> |
5 | 5 | <view class="fs30 ellipsis-1" style="padding: 20rpx 30rpx"> |
... | ... | @@ -292,10 +292,10 @@ |
292 | 292 | <view class="no-data" wx:if="{{(!requestData||requestData.length==0) && is_go}}"> |
293 | 293 | <image class="cart-image" src="{{iurl}}/miniapp/images/cart-null.png"></image> |
294 | 294 | <view class="no-data-title">暂无相关商品</view> |
295 | - <navigator class="lookat" url="/pages/index/index/index">回到首页</navigator> | |
295 | + <navigator bindtap="go_url" class="lookat" data-url="/pages/index/index/index">回到首页</navigator> | |
296 | 296 | </view> |
297 | 297 | </view> |
298 | - <view hidden="{{!openFilterModal}}"> | |
298 | +<view hidden="{{!openFilterModal}}"> | |
299 | 299 | <view bindtap="closeFilterModal" class="cover-layer"></view> |
300 | 300 | <view class="filter-modal"> |
301 | 301 | <icon bindtap="closeFilterModal" class="modal-close" color="gray" size="22" type="cancel"></icon> |
... | ... | @@ -332,4 +332,11 @@ |
332 | 332 | </view> |
333 | 333 | </view> |
334 | 334 | |
335 | -<share_box id="share"></share_box> | |
336 | 335 | \ No newline at end of file |
336 | +<share_box id="share"></share_box> | |
337 | +<view class="t-c fs32" wx:if="{{err_txt}}"> | |
338 | + <view class="no-data"> | |
339 | + <image class="cart-image" src="{{iurl}}/miniapp/images/cart-null.png"></image> | |
340 | + <view class="no-data-title">{{err_txt}}</view> | |
341 | + <navigator bindtap="go_url" class="lookat" data-url="/pages/index/index/index">回到首页</navigator> | |
342 | + </view> | |
343 | +</view> | |
337 | 344 | \ No newline at end of file | ... | ... |
pages/goods/search/search.js
pages/goods/search/search.wxml
... | ... | @@ -120,7 +120,7 @@ |
120 | 120 | <view class="no-data" wx:if="{{!requestData||requestData.length==0}}"> |
121 | 121 | <image class="cart-image" src="{{url}}/miniapp/images/cart-null.png"></image> |
122 | 122 | <view class="no-data-title">没有相关的数据</view> |
123 | - <navigator class="lookat" url="/pages/index/index/index"> 去逛逛 </navigator> | |
123 | + <navigator bindtap="go_url" class="lookat" data-url="/pages/index/index/index"> 去逛逛 </navigator> | |
124 | 124 | </view> |
125 | 125 | </view> |
126 | 126 | <view hidden="{{!openFilterModal}}"> | ... | ... |