Commit d2a832fc5007bd21a8bfa8292bbd7da3f94d962f
1 parent
a4b53fb1
OA单
Showing
4 changed files
with
80 additions
and
58 deletions
packageA/pages/jfbuy/jfbuy.wxml
packageC/pages/presell/cart/cart.js
... | ... | @@ -684,17 +684,19 @@ Page({ |
684 | 684 | var o_condition1=0; |
685 | 685 | if (th.data.order_prom[bn_pick]) { |
686 | 686 | var ord_prom = th.data.order_prom[bn_pick]; |
687 | - order_prom_id = ord_prom['id']; | |
688 | - switch (ord_prom['type']) { | |
689 | - case 0: | |
690 | - var all_1=o_condition; | |
691 | - o_condition1 = Math.round(ord_price * ord_prom['expression']) / 100;//满额打折 | |
692 | - order_prom_amount = (all_1 - o_condition1).toFixed(2); | |
693 | - break; | |
694 | - case 1: | |
695 | - o_condition1 = ord_price - ord_prom['expression'];//满额优惠金额 | |
696 | - order_prom_amount = ord_prom['expression']; | |
697 | - break; | |
687 | + if(!ord_prom.is_xz_yh || quan_price<=0) { | |
688 | + order_prom_id = ord_prom['id']; | |
689 | + switch (ord_prom['type']) { | |
690 | + case 0: | |
691 | + var all_1 = o_condition; | |
692 | + o_condition1 = Math.round(ord_price * ord_prom['expression']) / 100;//满额打折 | |
693 | + order_prom_amount = (all_1 - o_condition1).toFixed(2); | |
694 | + break; | |
695 | + case 1: | |
696 | + o_condition1 = ord_price - ord_prom['expression'];//满额优惠金额 | |
697 | + order_prom_amount = ord_prom['expression']; | |
698 | + break; | |
699 | + } | |
698 | 700 | } |
699 | 701 | } |
700 | 702 | //--订单优惠的显示-- |
... | ... | @@ -2247,7 +2249,7 @@ Page({ |
2247 | 2249 | await getApp().request.promiseGet("/api/weshop/integralbuy/pageIntegralBuyGoodsList?stype=1&stypeup=1",{ |
2248 | 2250 | data:{store_id:os.stoid,goods_id:gg.goods_id} |
2249 | 2251 | }).then(res=>{ |
2250 | - if(res.data.code==0 && res.data.data && res.data.data.pageData){ | |
2252 | + if(res.data.code==0 && res.data.data && res.data.data.pageData && res.data.data.pageData.length){ | |
2251 | 2253 | prom=res.data.data.pageData[0]; |
2252 | 2254 | } |
2253 | 2255 | }) |
... | ... | @@ -2342,7 +2344,7 @@ Page({ |
2342 | 2344 | await getApp().request.promiseGet("/api/weshop/integralbuy/pageIntegralBuyGoodsList?stype=1&stypeup=1",{ |
2343 | 2345 | data:{store_id:os.stoid,goods_id:goodsinfo.goods_id} |
2344 | 2346 | }).then(res=>{ |
2345 | - if(res.data.code==0 && res.data.data && res.data.data.pageData){ | |
2347 | + if(res.data.code==0 && res.data.data && res.data.data.pageData && res.data.data.pageData.length){ | |
2346 | 2348 | prom=res.data.data.pageData[0]; |
2347 | 2349 | } |
2348 | 2350 | }) | ... | ... |
packageC/pages/presell/cart/cart2.js
... | ... | @@ -774,16 +774,18 @@ Page({ |
774 | 774 | var order_prom_id = 0; |
775 | 775 | if (th.data.order_prom[th.data.bn_pick]) { |
776 | 776 | var ord_prom = th.data.order_prom[th.data.bn_pick]; |
777 | - order_prom_id = ord_prom['id']; | |
778 | - switch (ord_prom['type']) { | |
779 | - case 0: | |
780 | - order_m = Math.round(o_condition * ord_prom['expression']) / 100;//满额打折 | |
781 | - order_prom_amount = (o_condition - order_m).toFixed(2); | |
782 | - break; | |
783 | - case 1: | |
784 | - order_m = o_condition - ord_prom['expression'];//满额优惠金额 | |
785 | - order_prom_amount = ord_prom['expression']; | |
786 | - break; | |
777 | + if(!ord_prom.is_xz_yh || quan_price<=0) { | |
778 | + order_prom_id = ord_prom['id']; | |
779 | + switch (ord_prom['type']) { | |
780 | + case 0: | |
781 | + order_m = Math.round(o_condition * ord_prom['expression']) / 100;//满额打折 | |
782 | + order_prom_amount = (o_condition - order_m).toFixed(2); | |
783 | + break; | |
784 | + case 1: | |
785 | + order_m = o_condition - ord_prom['expression'];//满额优惠金额 | |
786 | + order_prom_amount = ord_prom['expression']; | |
787 | + break; | |
788 | + } | |
787 | 789 | } |
788 | 790 | } |
789 | 791 | //--订单优惠的显示-- | ... | ... |
pages/cart/cart2/cart2.js
... | ... | @@ -525,7 +525,7 @@ Page({ |
525 | 525 | } |
526 | 526 | else |
527 | 527 | { |
528 | - item1.act = th.data.zhhe_act_map[item1.prom_id]; | |
528 | + item1.act = th.data.zhhe_act_map[item1.prom_id]; | |
529 | 529 | } |
530 | 530 | } |
531 | 531 | if(item1.prom_type==10){ |
... | ... | @@ -561,7 +561,7 @@ Page({ |
561 | 561 | } |
562 | 562 | }) |
563 | 563 | if (!isok){ |
564 | - var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id; | |
564 | + var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item1.id; | |
565 | 565 | getApp().request.delete(url, {}); |
566 | 566 | th.data.ladder_map[item1.prom_id]=-1; |
567 | 567 | continue; |
... | ... | @@ -625,7 +625,9 @@ Page({ |
625 | 625 | if (arr.length > 0) { |
626 | 626 | for (var j = 0; j < arr.length; j++) { |
627 | 627 | if (arr[j].pickup_id == pcid) { |
628 | - //if(item.is_gift!=1){ | |
628 | + | |
629 | + //赠品的配送方式要和优惠的主商品一样 | |
630 | + if(item.is_gift!=1){ | |
629 | 631 | //确定配送方式 |
630 | 632 | if (arr[j].distr_t == 0) { |
631 | 633 | arr[j].distr_t = car_item.distr_type; |
... | ... | @@ -646,7 +648,8 @@ Page({ |
646 | 648 | arr[j].exp_type = e_t; |
647 | 649 | if (e_t == 0) th.setData({is_all_zt: 0}); |
648 | 650 | else if(e_t==1) th.setData({is_all_zt: 1}); |
649 | - //} | |
651 | + } | |
652 | + | |
650 | 653 | |
651 | 654 | //-- 把等级卡会优惠多少钱装进去 -- |
652 | 655 | if (car_item.cut_price1) arr[j].card_cut_price += car_item.cut_price1; |
... | ... | @@ -689,6 +692,7 @@ Page({ |
689 | 692 | } |
690 | 693 | //如果是物流的话,全部自提的控制要弄成0 |
691 | 694 | if (e_t == 0) th.setData({is_all_zt: 0}); |
695 | + else if (e_t == 1) th.setData({is_all_zt: 1}); | |
692 | 696 | |
693 | 697 | var narr = new Array(); |
694 | 698 | narr.push(car_item); |
... | ... | @@ -1725,16 +1729,19 @@ Page({ |
1725 | 1729 | }).then(res => { |
1726 | 1730 | if (res.data.code == 0) { |
1727 | 1731 | var ord_prom = res.data.data; |
1728 | - order_prom_id = ord_prom['id']; | |
1729 | - switch (ord_prom['type']) { | |
1730 | - case 0: | |
1731 | - order_m = Math.round(o_condition * ord_prom['expression']) / 100;//满额打折 | |
1732 | - order_prom_amount = (o_condition - order_m).toFixed(2); | |
1733 | - break; | |
1734 | - case 1: | |
1735 | - //order_m = o_condition - ord_prom['expression'];//满额优惠金额 | |
1736 | - order_prom_amount = ord_prom['expression']; | |
1737 | - break; | |
1732 | + //如果订单没有勾选使用优惠券不参与此活动,或者没有用优惠券 | |
1733 | + if(!ord_prom.is_xz_yh || quan_price<=0) { | |
1734 | + order_prom_id = ord_prom['id']; | |
1735 | + switch (ord_prom['type']) { | |
1736 | + case 0: | |
1737 | + order_m = Math.round(o_condition * ord_prom['expression']) / 100;//满额打折 | |
1738 | + order_prom_amount = (o_condition - order_m).toFixed(2); | |
1739 | + break; | |
1740 | + case 1: | |
1741 | + //order_m = o_condition - ord_prom['expression'];//满额优惠金额 | |
1742 | + order_prom_amount = ord_prom['expression']; | |
1743 | + break; | |
1744 | + } | |
1738 | 1745 | } |
1739 | 1746 | } |
1740 | 1747 | }) |
... | ... | @@ -2080,16 +2087,20 @@ Page({ |
2080 | 2087 | var order_prom_id = 0; |
2081 | 2088 | if (th.data.order_prom[th.data.bn_pick]) { |
2082 | 2089 | var ord_prom = th.data.order_prom[th.data.bn_pick]; |
2083 | - order_prom_id = ord_prom['id']; | |
2084 | - switch (ord_prom['type']) { | |
2085 | - case 0: | |
2086 | - order_m = Math.round(o_condition * ord_prom['expression']) / 100;//满额打折 | |
2087 | - order_prom_amount = (o_condition - order_m).toFixed(2); | |
2088 | - break; | |
2089 | - case 1: | |
2090 | - order_m = o_condition - ord_prom['expression'];//满额优惠金额 | |
2091 | - order_prom_amount = ord_prom['expression']; | |
2092 | - break; | |
2090 | + //如果订单没有勾选使用优惠券不参与此活动 | |
2091 | + if(!ord_prom.is_xz_yh || quan_price<=0) { | |
2092 | + | |
2093 | + order_prom_id = ord_prom['id']; | |
2094 | + switch (ord_prom['type']) { | |
2095 | + case 0: | |
2096 | + order_m = Math.round(o_condition * ord_prom['expression']) / 100;//满额打折 | |
2097 | + order_prom_amount = (o_condition - order_m).toFixed(2); | |
2098 | + break; | |
2099 | + case 1: | |
2100 | + order_m = o_condition - ord_prom['expression'];//满额优惠金额 | |
2101 | + order_prom_amount = ord_prom['expression']; | |
2102 | + break; | |
2103 | + } | |
2093 | 2104 | } |
2094 | 2105 | } |
2095 | 2106 | //--订单优惠的显示-- |
... | ... | @@ -2525,6 +2536,7 @@ Page({ |
2525 | 2536 | if (t_item.coupon_price) { |
2526 | 2537 | item.coupon_price = t_item.coupon_price; |
2527 | 2538 | item.coupon_no = th.data.using_quan[t_item.pickup_id].coupon_no; |
2539 | + t_item.quan_no=item.coupon_no; | |
2528 | 2540 | } else if (t_item.quan_no) { |
2529 | 2541 | item.coupon_no = t_item.quan_no; |
2530 | 2542 | item.coupon_price = 0; |
... | ... | @@ -2593,15 +2605,16 @@ Page({ |
2593 | 2605 | |
2594 | 2606 | //房间号的ids |
2595 | 2607 | var room_ids = ""; |
2608 | + //-- 把券的钱,写入从表 --- | |
2609 | + if (t_item.quan_youhui_list && t_item.coupon_price) { | |
2596 | 2610 | |
2597 | - //-- 把券的钱,写入从表 --- | |
2598 | - if (t_item.quan_youhui_list && t_item.coupon_price) { | |
2599 | 2611 | for (var kk in t_item.quan_youhui_list) { |
2600 | 2612 | var you_item = t_item.quan_youhui_list[kk]; |
2601 | 2613 | //-- 对券的价格进行平摊 -- |
2602 | 2614 | await th.split_set_goods_quanprice(you_item,t_item); |
2603 | 2615 | } |
2604 | 2616 | } |
2617 | + | |
2605 | 2618 | //-------------让商品添加到商品列表-------------------- |
2606 | 2619 | for (var k = 0; k < t_item.goods.length; k++) { |
2607 | 2620 | var g_item = t_item.goods[k]; |
... | ... | @@ -2624,6 +2637,7 @@ Page({ |
2624 | 2637 | goods.offline_cut = (g_item.goods_price - g_item.offline_price).toFixed(2); |
2625 | 2638 | goods.pricing_type = g_item.pricing_type; |
2626 | 2639 | } |
2640 | + | |
2627 | 2641 | if(g_item.quan_num){ |
2628 | 2642 | goods.quan_num=g_item.quan_num; |
2629 | 2643 | goods.quan_no=g_item.quan_no; |
... | ... | @@ -2717,6 +2731,7 @@ Page({ |
2717 | 2731 | if (pdata.length == 0) return; |
2718 | 2732 | var str = JSON.stringify(pdata); |
2719 | 2733 | |
2734 | + | |
2720 | 2735 | wx.showLoading({title: "加载中"}); |
2721 | 2736 | wx.request({ |
2722 | 2737 | url: oo.url + '/api/weshop/order/createWxdOrder', |
... | ... | @@ -3654,7 +3669,7 @@ Page({ |
3654 | 3669 | var item_price = gd.goods_price * gd.goods_num; |
3655 | 3670 | //-- 如果有平摊下去,有实收价格的时候,就要用account来计算价格 -- |
3656 | 3671 | if (gd.account_fir != null && gd.account_fir != undefined) { |
3657 | - item_price = gd.account_fir * gd.goods_num; | |
3672 | + //item_price = gd.account_fir * gd.goods_num; | |
3658 | 3673 | } |
3659 | 3674 | ckeck_quan_price += item_price; |
3660 | 3675 | |
... | ... | @@ -3671,15 +3686,17 @@ Page({ |
3671 | 3686 | check_quan_ware_list = encodeURIComponent(gd['erpwareid']); |
3672 | 3687 | } |
3673 | 3688 | } |
3689 | + | |
3674 | 3690 | //优惠券优惠的金额要控制到优惠券的选择条件 |
3675 | 3691 | var cut_price = 0; |
3676 | 3692 | for (var i in th.data.prom_goods_map[pickup_id]) { |
3677 | 3693 | var obj = th.data.prom_goods_map[pickup_id][i]; |
3678 | - if (obj.coupon_sele) { | |
3694 | + if (obj.coupon_sele && obj.prom_price) { | |
3679 | 3695 | cut_price += obj.price - obj.prom_price; |
3680 | 3696 | } |
3681 | 3697 | } |
3682 | 3698 | |
3699 | + //阶梯优惠使用券 | |
3683 | 3700 | var prom_pt_json= ep.prom_pt_json; |
3684 | 3701 | if(prom_pt_json){ |
3685 | 3702 | for(let oj in prom_pt_json){ |
... | ... | @@ -3689,8 +3706,8 @@ Page({ |
3689 | 3706 | } |
3690 | 3707 | } |
3691 | 3708 | } |
3692 | - | |
3693 | - arr[ind].ckeck_quan_price = ckeck_quan_price - cut_price; | |
3709 | + | |
3710 | + arr[ind].ckeck_quan_price = ckeck_quan_price - (cut_price?cut_price:0); | |
3694 | 3711 | arr[ind].check_quan_ware_list = check_quan_ware_list; |
3695 | 3712 | arr[ind].check_quan_price_list = check_quan_price_list; |
3696 | 3713 | arr[ind].is_xz_yh = is_xz_yh; |
... | ... | @@ -3703,7 +3720,7 @@ Page({ |
3703 | 3720 | data: { |
3704 | 3721 | storeId: oo.stoid, |
3705 | 3722 | userId: app.globalData.user_id, |
3706 | - BuySum: arr[ind].ckeck_quan_price, | |
3723 | + BuySum: parseFloat(arr[ind].ckeck_quan_price?arr[ind].ckeck_quan_price:0).toFixed(2), | |
3707 | 3724 | WareIds: check_quan_ware_list, |
3708 | 3725 | pageSize: 100 |
3709 | 3726 | } |
... | ... | @@ -3752,7 +3769,7 @@ Page({ |
3752 | 3769 | data: { |
3753 | 3770 | storeId: oo.stoid, |
3754 | 3771 | userId: app.globalData.user_id, |
3755 | - BuySum: th.data.ckeck_quan_price, | |
3772 | + BuySum: parseFloat(th.data.ckeck_quan_price?th.data.ckeck_quan_price:0).toFixed(2), | |
3756 | 3773 | WareIds: encodeURIComponent(th.data.check_quan_ware_list), |
3757 | 3774 | pageSize: 100 |
3758 | 3775 | }, |
... | ... | @@ -4110,8 +4127,9 @@ Page({ |
4110 | 4127 | getApp().goto(url); |
4111 | 4128 | }, |
4112 | 4129 | |
4113 | - //进行对商品的平摊g_item是单个商品,you_item是这个商品分多少优惠券的钱,goods是商品列表 | |
4114 | - split_set_goods_quanprice:async function (you_item,t_item) { | |
4130 | + //进行对商品的平摊g_item是单个商品,you_item是这个商品分多少优惠券的钱,goods是商品列表 | |
4131 | + split_set_goods_quanprice:async function (you_item,t_item) { | |
4132 | + | |
4115 | 4133 | var coupon_price=you_item.WareCashSum; |
4116 | 4134 | var goods=t_item.goods; |
4117 | 4135 | var arr=[]; | ... | ... |