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,7 +551,7 @@ Page({ | ||
| 551 | 551 | ||
| 552 | }else{ | 552 | }else{ |
| 553 | //未找到商品的活动 | 553 | //未找到商品的活动 |
| 554 | - is_flag = 0; | 554 | + isok = 0; |
| 555 | } | 555 | } |
| 556 | }) | 556 | }) |
| 557 | if (!isok){ | 557 | if (!isok){ |
| @@ -597,10 +597,7 @@ Page({ | @@ -597,10 +597,7 @@ Page({ | ||
| 597 | item.prom_type=3; | 597 | item.prom_type=3; |
| 598 | item.prom_id=r_data.promGoodsLists[0].prom_id; | 598 | item.prom_id=r_data.promGoodsLists[0].prom_id; |
| 599 | }else if(r_data.ladderLists){ | 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 | item.prom_type=10; | 601 | item.prom_type=10; |
| 605 | item.prom_id=r_data.ladderLists[0].form_id; | 602 | item.prom_id=r_data.ladderLists[0].form_id; |
| 606 | 603 | ||
| @@ -644,24 +641,29 @@ Page({ | @@ -644,24 +641,29 @@ Page({ | ||
| 644 | if (!isok){ | 641 | if (!isok){ |
| 645 | item.prom_type=0; | 642 | item.prom_type=0; |
| 646 | item.prom_id=0; | 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 | if(th.data.ladder_map[item.prom_id] && th.data.ladder_map[item.prom_id]!=-1 ){ | 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,6 +126,7 @@ Page({ | ||
| 126 | in_zhact_gdmap:{}, //不同门店参与同一活动的限购 | 126 | in_zhact_gdmap:{}, //不同门店参与同一活动的限购 |
| 127 | hid_inp:1, | 127 | hid_inp:1, |
| 128 | user_note:{}, | 128 | user_note:{}, |
| 129 | + zhhe_act_map:{}, //组合活动的map表 | ||
| 129 | zuhe_map_good:{}, //组合购的map表 | 130 | zuhe_map_good:{}, //组合购的map表 |
| 130 | ladder_map:{}, //阶梯促销的map表 | 131 | ladder_map:{}, //阶梯促销的map表 |
| 131 | 132 | ||
| @@ -484,6 +485,7 @@ Page({ | @@ -484,6 +485,7 @@ Page({ | ||
| 484 | isok = 0; | 485 | isok = 0; |
| 485 | } | 486 | } |
| 486 | item1.act = res.data.data; | 487 | item1.act = res.data.data; |
| 488 | + th.data.zhhe_act_map[item1.prom_id] = res.data.data; | ||
| 487 | } else { | 489 | } else { |
| 488 | //未找到商品的活动 | 490 | //未找到商品的活动 |
| 489 | is_flag = 0; | 491 | is_flag = 0; |
| @@ -517,6 +519,10 @@ Page({ | @@ -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 | if(item1.prom_type==10){ | 527 | if(item1.prom_type==10){ |
| 522 | if(!th.data.ladder_map[item1.prom_id]){ | 528 | if(!th.data.ladder_map[item1.prom_id]){ |
| @@ -1455,8 +1461,8 @@ Page({ | @@ -1455,8 +1461,8 @@ Page({ | ||
| 1455 | if(item[j].prom_type!=7 && item[j].prom_type!=10 ) is_no_zh=1; | 1461 | if(item[j].prom_type!=7 && item[j].prom_type!=10 ) is_no_zh=1; |
| 1456 | 1462 | ||
| 1457 | //组合购的商品,且有订单优惠的叠加,is_orderyh就是优惠叠加 | 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 | is_no_zh=1; | 1467 | is_no_zh=1; |
| 1462 | } | 1468 | } |
| @@ -2586,7 +2592,10 @@ Page({ | @@ -2586,7 +2592,10 @@ Page({ | ||
| 2586 | goods.offline_cut = (g_item.goods_price - g_item.offline_price).toFixed(2); | 2592 | goods.offline_cut = (g_item.goods_price - g_item.offline_price).toFixed(2); |
| 2587 | goods.pricing_type = g_item.pricing_type; | 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 | switch (g_item.prom_type) { | 2600 | switch (g_item.prom_type) { |
| 2592 | case 1: | 2601 | case 1: |
| @@ -3633,6 +3642,16 @@ Page({ | @@ -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 | arr[ind].ckeck_quan_price = ckeck_quan_price - cut_price; | 3655 | arr[ind].ckeck_quan_price = ckeck_quan_price - cut_price; |
| 3637 | arr[ind].check_quan_ware_list = check_quan_ware_list; | 3656 | arr[ind].check_quan_ware_list = check_quan_ware_list; |
| 3638 | arr[ind].check_quan_price_list = check_quan_price_list; | 3657 | arr[ind].check_quan_price_list = check_quan_price_list; |
| @@ -4054,7 +4073,7 @@ Page({ | @@ -4054,7 +4073,7 @@ Page({ | ||
| 4054 | 4073 | ||
| 4055 | //进行对商品的平摊g_item是单个商品,you_item是这个商品分多少优惠券的钱,goods是商品列表 | 4074 | //进行对商品的平摊g_item是单个商品,you_item是这个商品分多少优惠券的钱,goods是商品列表 |
| 4056 | split_set_goods_quanprice:async function (you_item,t_item) { | 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 | var goods=t_item.goods; | 4077 | var goods=t_item.goods; |
| 4059 | var arr=[]; | 4078 | var arr=[]; |
| 4060 | //判断是不是有goods_id重复 | 4079 | //判断是不是有goods_id重复 |
pages/cart/cart2/zh_calculate.js
| @@ -15,6 +15,7 @@ module.exports = { | @@ -15,6 +15,7 @@ module.exports = { | ||
| 15 | let act_item = zh_prom_goods[i]; | 15 | let act_item = zh_prom_goods[i]; |
| 16 | let act_goos = act_item.gdlist; | 16 | let act_goos = act_item.gdlist; |
| 17 | let act = act_item.act; | 17 | let act = act_item.act; |
| 18 | + if(!act) continue; | ||
| 18 | 19 | ||
| 19 | let all_num = 0; //商品数量之和 | 20 | let all_num = 0; //商品数量之和 |
| 20 | let all_price0 = 0; //商品数量之和 | 21 | let all_price0 = 0; //商品数量之和 |
| @@ -103,7 +104,7 @@ module.exports = { | @@ -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 | for (var u in act_goos) { | 110 | for (var u in act_goos) { |
pages/giftpack/giftpacklist/giftpacklist.js
| @@ -39,6 +39,8 @@ Page({ | @@ -39,6 +39,8 @@ Page({ | ||
| 39 | orderSn: options.orderSn, | 39 | orderSn: options.orderSn, |
| 40 | getUserID: d.user_id, | 40 | getUserID: d.user_id, |
| 41 | }) | 41 | }) |
| 42 | + | ||
| 43 | + if(options.lbId) th.data.lbId=options.lbId; | ||
| 42 | //-- 获取分享人的ID -- | 44 | //-- 获取分享人的ID -- |
| 43 | var first_leader = options.first_leader || getApp().globalData.first_leader; | 45 | var first_leader = options.first_leader || getApp().globalData.first_leader; |
| 44 | if (first_leader) { | 46 | if (first_leader) { |
pages/goods/goodsInfo/goodsInfo.js
| @@ -3708,7 +3708,16 @@ Page({ | @@ -3708,7 +3708,16 @@ Page({ | ||
| 3708 | //如果是秒杀的时候 | 3708 | //如果是秒杀的时候 |
| 3709 | if(th.data.prom_type==0 && gd.prom_type == 1 ){ | 3709 | if(th.data.prom_type==0 && gd.prom_type == 1 ){ |
| 3710 | gd.prom_type= 0; | 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 | if (!th.data.is_normal && ( gd.prom_type == 1 || gd.prom_type == 2 || gd.prom_type == 4 || gd.prom_type == 6)) { | 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,7 +22,8 @@ Page({ | ||
| 22 | is_hot:0, | 22 | is_hot:0, |
| 23 | prom_goods_list:null, | 23 | prom_goods_list:null, |
| 24 | rq_data:null, | 24 | rq_data:null, |
| 25 | - isToggle: false, //切换商品视图控制符 | 25 | + isToggle: false, //切换商品视图控制符 |
| 26 | + show_all:1, //判断显示 | ||
| 26 | }, | 27 | }, |
| 27 | 28 | ||
| 28 | onLoad: function(t) { | 29 | onLoad: function(t) { |
| @@ -115,6 +116,21 @@ Page({ | @@ -115,6 +116,21 @@ Page({ | ||
| 115 | }).then(res=>{ | 116 | }).then(res=>{ |
| 116 | if(res.data.code==0 && res.data.data){ | 117 | if(res.data.code==0 && res.data.data){ |
| 117 | var arr= res.data.data; | 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 | var url1="/api/weshop/prom/ladderList/list?store_id="+oo.stoid+"&form_id="+arr.id; | 134 | var url1="/api/weshop/prom/ladderList/list?store_id="+oo.stoid+"&form_id="+arr.id; |
| 119 | getApp().request.promiseGet(url1, {}).then(rs=>{ | 135 | getApp().request.promiseGet(url1, {}).then(rs=>{ |
| 120 | if(rs.data.code==0 && rs.data.data && rs.data.data.length) { | 136 | if(rs.data.code==0 && rs.data.data && rs.data.data.length) { |
| @@ -131,9 +147,14 @@ Page({ | @@ -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 | this.requestGoodsList(url); | 158 | this.requestGoodsList(url); |
| 138 | getApp().getConfig2(function(rs){ | 159 | getApp().getConfig2(function(rs){ |
| 139 | //计算等级价相关 | 160 | //计算等级价相关 |
| @@ -417,4 +438,10 @@ Page({ | @@ -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 | \ No newline at end of file | 448 | \ No newline at end of file |
pages/goods/goodsList/goodsList.wxml
| 1 | <wxs module="g_filter" src="g_filter.wxs"></wxs> | 1 | <wxs module="g_filter" src="g_filter.wxs"></wxs> |
| 2 | -<view class="container"> | 2 | +<view class="container" wx:if="{{show_all}}"> |
| 3 | <view> | 3 | <view> |
| 4 | <block wx:for="{{prom_goods_list}}"> | 4 | <block wx:for="{{prom_goods_list}}"> |
| 5 | <view class="fs30 ellipsis-1" style="padding: 20rpx 30rpx"> | 5 | <view class="fs30 ellipsis-1" style="padding: 20rpx 30rpx"> |
| @@ -292,10 +292,10 @@ | @@ -292,10 +292,10 @@ | ||
| 292 | <view class="no-data" wx:if="{{(!requestData||requestData.length==0) && is_go}}"> | 292 | <view class="no-data" wx:if="{{(!requestData||requestData.length==0) && is_go}}"> |
| 293 | <image class="cart-image" src="{{iurl}}/miniapp/images/cart-null.png"></image> | 293 | <image class="cart-image" src="{{iurl}}/miniapp/images/cart-null.png"></image> |
| 294 | <view class="no-data-title">暂无相关商品</view> | 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 | </view> | 296 | </view> |
| 297 | </view> | 297 | </view> |
| 298 | - <view hidden="{{!openFilterModal}}"> | 298 | +<view hidden="{{!openFilterModal}}"> |
| 299 | <view bindtap="closeFilterModal" class="cover-layer"></view> | 299 | <view bindtap="closeFilterModal" class="cover-layer"></view> |
| 300 | <view class="filter-modal"> | 300 | <view class="filter-modal"> |
| 301 | <icon bindtap="closeFilterModal" class="modal-close" color="gray" size="22" type="cancel"></icon> | 301 | <icon bindtap="closeFilterModal" class="modal-close" color="gray" size="22" type="cancel"></icon> |
| @@ -332,4 +332,11 @@ | @@ -332,4 +332,11 @@ | ||
| 332 | </view> | 332 | </view> |
| 333 | </view> | 333 | </view> |
| 334 | 334 | ||
| 335 | -<share_box id="share"></share_box> | ||
| 336 | \ No newline at end of file | 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 | \ No newline at end of file | 344 | \ No newline at end of file |
pages/goods/search/search.js
| @@ -451,4 +451,9 @@ Page({ | @@ -451,4 +451,9 @@ Page({ | ||
| 451 | searchRecord: [] | 451 | searchRecord: [] |
| 452 | }); | 452 | }); |
| 453 | }, | 453 | }, |
| 454 | + | ||
| 455 | + go_url:function (e) { | ||
| 456 | + var url=e.currentTarget.dataset.url; | ||
| 457 | + getApp().goto(url); | ||
| 458 | + } | ||
| 454 | }); | 459 | }); |
| 455 | \ No newline at end of file | 460 | \ No newline at end of file |
pages/goods/search/search.wxml
| @@ -120,7 +120,7 @@ | @@ -120,7 +120,7 @@ | ||
| 120 | <view class="no-data" wx:if="{{!requestData||requestData.length==0}}"> | 120 | <view class="no-data" wx:if="{{!requestData||requestData.length==0}}"> |
| 121 | <image class="cart-image" src="{{url}}/miniapp/images/cart-null.png"></image> | 121 | <image class="cart-image" src="{{url}}/miniapp/images/cart-null.png"></image> |
| 122 | <view class="no-data-title">没有相关的数据</view> | 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 | </view> | 124 | </view> |
| 125 | </view> | 125 | </view> |
| 126 | <view hidden="{{!openFilterModal}}"> | 126 | <view hidden="{{!openFilterModal}}"> |