Commit c9f02dcc5d835ee7f88424f799f12ef806d131e1
1 parent
f8f77f42
预售的bug优化, 在优惠券和优惠活动的时候
Showing
4 changed files
with
26 additions
and
188 deletions
packageC/pages/presell/cart/cart.js
@@ -654,6 +654,9 @@ Page({ | @@ -654,6 +654,9 @@ Page({ | ||
654 | quan_price = res.data.data[0].WareCashSum; | 654 | quan_price = res.data.data[0].WareCashSum; |
655 | } | 655 | } |
656 | }) | 656 | }) |
657 | + }else{ | ||
658 | + var txt="using_quan["+bn_pick+"]"; | ||
659 | + th.setData({[txt]:{}}); | ||
657 | } | 660 | } |
658 | 661 | ||
659 | if(quan_price>0){ | 662 | if(quan_price>0){ |
@@ -697,11 +700,13 @@ Page({ | @@ -697,11 +700,13 @@ Page({ | ||
697 | th.setData({[order_prom_txt1]: order_prom_id, [order_prom_txt2]: order_prom_amount}) | 700 | th.setData({[order_prom_txt1]: order_prom_id, [order_prom_txt2]: order_prom_amount}) |
698 | } | 701 | } |
699 | 702 | ||
700 | - o_condition1=parseFloat(o_condition1)-parseFloat(th.data.presell.presell_deposit); | ||
701 | - th.setData({ exp_price: 0, order_m: o_condition1 }) | 703 | + o_condition1=parseFloat(o_condition1)-parseFloat(th.data.presell.presell_deposit); |
704 | + if(o_condition1<0) o_condition1=0; | ||
705 | + th.setData({ exp_price: 0, order_m: o_condition1 }) | ||
702 | }) | 706 | }) |
703 | }else{ | 707 | }else{ |
704 | o_condition=parseFloat(o_condition)-parseFloat(th.data.presell.presell_deposit); | 708 | o_condition=parseFloat(o_condition)-parseFloat(th.data.presell.presell_deposit); |
709 | + if(o_condition<0) o_condition=0; | ||
705 | th.setData({ exp_price: 0, order_m: o_condition }) | 710 | th.setData({ exp_price: 0, order_m: o_condition }) |
706 | } | 711 | } |
707 | } | 712 | } |
@@ -742,168 +747,6 @@ Page({ | @@ -742,168 +747,6 @@ Page({ | ||
742 | }); | 747 | }); |
743 | }, | 748 | }, |
744 | 749 | ||
745 | - calc_per: async function (c_arr) { | ||
746 | - var th = this; | ||
747 | - //-- 循环处理 -- | ||
748 | - for (var i in c_arr) { | ||
749 | - var cart_item = c_arr[i]; //就是每一单的意思 | ||
750 | - var pickid = cart_item.pickup_id; | ||
751 | - var ord_goods = c_arr[i].goods; //就是每一单的从表的意思 | ||
752 | - var o_price = 0, q_conditin = 0; | ||
753 | - //--------循环计算总价----------- | ||
754 | - for (var j = 0; j < ord_goods.length; j++) { | ||
755 | - o_price += ord_goods[j].goods_price * ord_goods[j].goods_num; | ||
756 | - } | ||
757 | - | ||
758 | - //---如果该门店的相关活动,就要算一下减价-- | ||
759 | - if (th.data.prom_goods_map[pickid]) { | ||
760 | - var ob = th.data.prom_goods_map[pickid]; | ||
761 | - for (var ii in ob) { | ||
762 | - var item_map = ob[ii]; | ||
763 | - if (item_map.bs == undefined || item_map.bs == null) { | ||
764 | - //等待,获取一下优惠活动的信息 | ||
765 | - await getApp().request.promiseGet("/api/weshop/goods/getDiscount", { | ||
766 | - data: { | ||
767 | - price: item_map.price, prom_id: item_map.prom_id, | ||
768 | - goods_num: item_map.goods_num, user_id: getApp().globalData.user_id, | ||
769 | - is_bz: item_map.is_bz | ||
770 | - } | ||
771 | - }).then(res => { | ||
772 | - if (res.data.code == 0 && res.data.data.condition) { | ||
773 | - var get_data = res.data.data; | ||
774 | - item_map.is_bz = get_data.is_bz; //是不是倍增 | ||
775 | - item_map.bs = get_data.bs; //是不是倍数 | ||
776 | - item_map.is_past = get_data.is_past; //是不是包邮 | ||
777 | - item_map.prom_price = get_data.price >= 0 ? get_data.price : item_map.price; | ||
778 | - item_map.s_intValue = get_data.intValue; | ||
779 | - item_map.s_coupon_id = get_data.coupon_id; | ||
780 | - item_map.s_coupon_num = get_data.coupon_num; | ||
781 | - if (get_data.gift_id && get_data.goodsinfo) { | ||
782 | - item_map.gift_id = get_data.gift_id; | ||
783 | - item_map.gift_goods_id = get_data.goods_id; | ||
784 | - item_map.gift_goods_name = get_data.goods_name; | ||
785 | - item_map.gift_goods_color = get_data.goodsinfo.goods_color ? get_data.goodsinfo.goods_color : ''; | ||
786 | - item_map.gift_goods_spec = get_data.goodsinfo.goods_spec ? get_data.goodsinfo.goods_spec : ''; | ||
787 | - item_map.gift_original_img = get_data.goodsinfo.original_img; | ||
788 | - item_map.gift_limit_num = get_data.limit_num; | ||
789 | - item_map.gift_storecount = get_data.gift_storecount; | ||
790 | - item_map.gift_weight = get_data.goodsinfo.weight; | ||
791 | - item_map.gift_exp_sum_type = get_data.goodsinfo.exp_sum_type; | ||
792 | - item_map.uniform_exp_sum = get_data.goodsinfo.uniform_exp_sum; | ||
793 | - | ||
794 | - } | ||
795 | - item_map.s_libao = get_data.libao; | ||
796 | - item_map.s_lb_num = get_data.lb_num; | ||
797 | - } | ||
798 | - }) | ||
799 | - } | ||
800 | - | ||
801 | - //有活动,且优惠活动并没有限制使用优惠券,且有减价 | ||
802 | - //--看有没有减价-- | ||
803 | - //if(item_map.prom_price>=0 && item_map.price-item_map.prom_price){ | ||
804 | - if (item_map.price - item_map.prom_price && item_map.prom_price !== null) { | ||
805 | - if (cart_item.prom_pt_json) { | ||
806 | - cart_item.prom_pt_json.push({ | ||
807 | - "prom_id": item_map.prom_id, | ||
808 | - "dis": (item_map.price - item_map.prom_price).toFixed(2), | ||
809 | - "ispt": 0 | ||
810 | - }) | ||
811 | - } else { | ||
812 | - cart_item.prom_pt_json = [{ | ||
813 | - "prom_id": item_map.prom_id, | ||
814 | - "dis": (item_map.price - item_map.prom_price).toFixed(2), | ||
815 | - "ispt": 0 | ||
816 | - }]; | ||
817 | - } | ||
818 | - | ||
819 | - //-- 如果系统要平摊到单品 -- | ||
820 | - | ||
821 | - var pt_data = { | ||
822 | - 'prom_id': item_map.prom_id, | ||
823 | - 'dis': parseFloat((item_map.price - item_map.prom_price).toFixed(2)), | ||
824 | - 'goods': item_map.goods | ||
825 | - } | ||
826 | - | ||
827 | - var pt_res = null; | ||
828 | - await getApp().request.promisePost("/api/weshop/order/getGoodsSplit", { | ||
829 | - is_json: 1, | ||
830 | - data: pt_data | ||
831 | - }).then(res => { | ||
832 | - if (res.data.code == 0) { | ||
833 | - pt_res = res.data.data; | ||
834 | - } | ||
835 | - }) | ||
836 | - if (pt_res) { | ||
837 | - for (var io in item_map.goods) { | ||
838 | - //平摊赋值 | ||
839 | - item_map.goods[io].account_fir = th.arr_get_goods(item_map.goods[io].goods_id, pt_res).fisrt_account; | ||
840 | - item_map.goods[io].account_yu_fir = th.arr_get_goods(item_map.goods[io].goods_id, pt_res).fisrt_account_yu; | ||
841 | - if (!th.data.ispt_goods) { | ||
842 | - item_map.goods[io].account = item_map.goods[io].account_fir; | ||
843 | - item_map.goods[io].account_yu = item_map.goods[io].account_yu_fir; | ||
844 | - } | ||
845 | - } | ||
846 | - } | ||
847 | - | ||
848 | - | ||
849 | - o_price -= (item_map.price - item_map.prom_price); | ||
850 | - //如果有限制使用优惠券,就要减掉参与的活动商品的钱 | ||
851 | - if (!item_map.is_xz_yh) q_conditin = o_price; | ||
852 | - } | ||
853 | - | ||
854 | - //--------循环计算商品是不是包邮,是不是使用优惠券,此时循环是商品从表----------- | ||
855 | - for (var j = 0; j < ord_goods.length; j++) { | ||
856 | - if (ord_goods[j].is_gift) continue; | ||
857 | - if (ord_goods[j].prom_type == 3 && ord_goods[j].prom_id == item_map.prom_id) { | ||
858 | - ord_goods[j].is_xz_yh = item_map.is_xz_yh; | ||
859 | - ord_goods[j].is_past = item_map.is_past; | ||
860 | - ord_goods[j].account_fir = th.item_map_get_goods(ord_goods[j].goods_id, item_map).account_fir; | ||
861 | - ord_goods[j].account_yu_fir = th.item_map_get_goods(ord_goods[j].goods_id, item_map).account_yu_fir; | ||
862 | - ord_goods[j].account = th.item_map_get_goods(ord_goods[j].goods_id, item_map).account; | ||
863 | - ord_goods[j].account_yu = th.item_map_get_goods(ord_goods[j].goods_id, item_map).account_yu; | ||
864 | - } | ||
865 | - } | ||
866 | - | ||
867 | - | ||
868 | - //--优惠多少钱-- | ||
869 | - if (!cart_item.cut_price) cart_item.cut_price = 0; | ||
870 | - //-- -- | ||
871 | - if (item_map.price != undefined && item_map.price != null | ||
872 | - && item_map.prom_price != undefined && item_map.prom_price != null) | ||
873 | - cart_item.cut_price += (item_map.price - item_map.prom_price); | ||
874 | - //---如果有送积分--- | ||
875 | - if (item_map.s_intValue) { | ||
876 | - if (!cart_item.s_intValue) cart_item.s_intValue = 0; | ||
877 | - cart_item.s_intValue += item_map.s_intValue; | ||
878 | - } | ||
879 | - //-- 如果有送优惠券的情况 -- | ||
880 | - if (item_map.s_coupon_id) { | ||
881 | - if (!cart_item.s_coupon_id) { | ||
882 | - cart_item.s_coupon_id = item_map.s_coupon_id + ""; | ||
883 | - cart_item.g_coupon_num = [{'c_id': item_map.s_coupon_id, "num": item_map.s_coupon_num}]; | ||
884 | - } | ||
885 | - else { | ||
886 | - cart_item.s_coupon_id += "," + item_map.s_coupon_id; | ||
887 | - cart_item.g_coupon_num.push({'c_id': item_map.s_coupon_id, "num": item_map.s_coupon_num}) | ||
888 | - } | ||
889 | - } | ||
890 | - | ||
891 | - //-- 如果有送优包邮券的情况 -- | ||
892 | - if (item_map.s_libao) { | ||
893 | - if (!cart_item.s_libao) { | ||
894 | - cart_item.s_libao = item_map.s_libao + ""; | ||
895 | - cart_item.g_lb_num = [{'l_id': item_map.s_libao, "num": item_map.s_lb_num}]; | ||
896 | - } | ||
897 | - else { | ||
898 | - cart_item.s_libao += "," + item_map.s_libao; | ||
899 | - cart_item.g_lb_num.push({'l_id': item_map.s_libao, "num": item_map.s_lb_num}) | ||
900 | - } | ||
901 | - } | ||
902 | - } | ||
903 | - } | ||
904 | - } | ||
905 | - }, | ||
906 | - | ||
907 | set_can_num: function () { | 750 | set_can_num: function () { |
908 | var th = this; | 751 | var th = this; |
909 | //-- 这个地方,循环计算几张优惠券可用-- | 752 | //-- 这个地方,循环计算几张优惠券可用-- |
@@ -1257,20 +1100,13 @@ Page({ | @@ -1257,20 +1100,13 @@ Page({ | ||
1257 | var txt = ""; | 1100 | var txt = ""; |
1258 | var txt1 = ""; | 1101 | var txt1 = ""; |
1259 | var quan_item = null; | 1102 | var quan_item = null; |
1260 | - if (th.data.is_b_now) { | 1103 | + |
1261 | quan_item = this.data.get_by_quan_list[ind]; | 1104 | quan_item = this.data.get_by_quan_list[ind]; |
1262 | txt = "get_by_quan_list[" + ind + "].show_red"; | 1105 | txt = "get_by_quan_list[" + ind + "].show_red"; |
1263 | var obj = {}; | 1106 | var obj = {}; |
1264 | obj[txt] = 1; | 1107 | obj[txt] = 1; |
1265 | this.setData(obj); | 1108 | this.setData(obj); |
1266 | - } else { | ||
1267 | - txt = "by_quan_list_cart[" + ind + "].show_red"; | ||
1268 | - quan_item = th.data.by_quan_list_cart[ind]; | ||
1269 | - var obj = {}; | ||
1270 | - obj[txt] = 1; | ||
1271 | - this.setData(obj); | ||
1272 | - th.data.get_by_quan_list_cart[pickid] = JSON.parse(JSON.stringify(th.data.by_quan_list_cart)); //要把选中的弄回数组 | ||
1273 | - } | 1109 | + |
1274 | 1110 | ||
1275 | if (using_quan[th.data.selected_quan_pick]) { | 1111 | if (using_quan[th.data.selected_quan_pick]) { |
1276 | using_quan[th.data.selected_quan_pick].is_nouse_red = 0; | 1112 | using_quan[th.data.selected_quan_pick].is_nouse_red = 0; |
@@ -1905,7 +1741,7 @@ Page({ | @@ -1905,7 +1741,7 @@ Page({ | ||
1905 | //-----------当地址不为空,且是物流时,计算物流费用---------- | 1741 | //-----------当地址不为空,且是物流时,计算物流费用---------- |
1906 | if (th.data.user_addr != null && th.data.exp_type == 0 && good.is_free_shipping == 0) { | 1742 | if (th.data.user_addr != null && th.data.exp_type == 0 && good.is_free_shipping == 0) { |
1907 | //看是不是有调用过包邮券,如果活动可以使用优化券的情况下 | 1743 | //看是不是有调用过包邮券,如果活动可以使用优化券的情况下 |
1908 | - if (!th.data.isget_by_quan[bn_pick] && th.data.is_usecoupon) { | 1744 | + if (!th.data.isget_by_quan[bn_pick] && th.data.act.is_usecoupon) { |
1909 | var condition = allpice - quan_price; | 1745 | var condition = allpice - quan_price; |
1910 | //--判断要不要显示包邮券,链式调用接口,调取包邮券,已经是减了优惠的金额,见到优惠券的钱--- | 1746 | //--判断要不要显示包邮券,链式调用接口,调取包邮券,已经是减了优惠的金额,见到优惠券的钱--- |
1911 | getApp().request.promiseGet("/api/weshop/userfeemail/pageAndArea", { | 1747 | getApp().request.promiseGet("/api/weshop/userfeemail/pageAndArea", { |
@@ -2009,12 +1845,14 @@ Page({ | @@ -2009,12 +1845,14 @@ Page({ | ||
2009 | 1845 | ||
2010 | 1846 | ||
2011 | ord_price=parseFloat(ord_price)-parseFloat(th.data.presell.presell_deposit); | 1847 | ord_price=parseFloat(ord_price)-parseFloat(th.data.presell.presell_deposit); |
1848 | + if(ord_price<0) ord_price=0; | ||
2012 | th.setData({ exp_price: exp_price, order_m: ord_price +parseFloat(exp_price) }) | 1849 | th.setData({ exp_price: exp_price, order_m: ord_price +parseFloat(exp_price) }) |
2013 | 1850 | ||
2014 | }) | 1851 | }) |
2015 | }else{ | 1852 | }else{ |
2016 | 1853 | ||
2017 | - var o_condition1=parseFloat(o_condition)-parseFloat(th.data.presell.presell_deposit); | 1854 | + var o_condition1=parseFloat(o_condition)-parseFloat(th.data.presell.presell_deposit); |
1855 | + if(o_condition1<0) o_condition1=0; | ||
2018 | th.setData({ exp_price: exp_price, order_m: parseFloat(o_condition1)+parseFloat(exp_price) }) | 1856 | th.setData({ exp_price: exp_price, order_m: parseFloat(o_condition1)+parseFloat(exp_price) }) |
2019 | } | 1857 | } |
2020 | }, | 1858 | }, |
@@ -2221,7 +2059,6 @@ Page({ | @@ -2221,7 +2059,6 @@ Page({ | ||
2221 | this.calculatePrice2(); | 2059 | this.calculatePrice2(); |
2222 | }, | 2060 | }, |
2223 | 2061 | ||
2224 | - | ||
2225 | //--------立即支付---------- | 2062 | //--------立即支付---------- |
2226 | async jumpToCart4(e) { | 2063 | async jumpToCart4(e) { |
2227 | var th=this; | 2064 | var th=this; |
@@ -2598,7 +2435,6 @@ Page({ | @@ -2598,7 +2435,6 @@ Page({ | ||
2598 | 2435 | ||
2599 | }, | 2436 | }, |
2600 | 2437 | ||
2601 | - | ||
2602 | //--------取消订单--------- | 2438 | //--------取消订单--------- |
2603 | cancelOrder: function(e) { | 2439 | cancelOrder: function(e) { |
2604 | var t = this,th=t, ord_id = this.data.order.order_id,order=this.data.order; | 2440 | var t = this,th=t, ord_id = this.data.order.order_id,order=this.data.order; |
packageC/pages/presell/cart/cart.wxml
@@ -461,7 +461,7 @@ | @@ -461,7 +461,7 @@ | ||
461 | <include src="remark_part.wxml"/> | 461 | <include src="remark_part.wxml"/> |
462 | </view> | 462 | </view> |
463 | <!-- 包邮券的显示,立即购买 --> | 463 | <!-- 包邮券的显示,立即购买 --> |
464 | - <block wx:if="{{ is_b_now && bn_exp_type==0}}"> | 464 | + <block wx:if="{{exp_type==0}}"> |
465 | <view wx:for="{{get_by_quan_list}}" bindtap="sele_quan_item_by" wx:if="{{!item.is_using}}" | 465 | <view wx:for="{{get_by_quan_list}}" bindtap="sele_quan_item_by" wx:if="{{!item.is_using}}" |
466 | data-ind="{{byq_index}}" | 466 | data-ind="{{byq_index}}" |
467 | wx:for-item="item" wx:for-index="byq_index"> | 467 | wx:for-item="item" wx:for-index="byq_index"> |
@@ -472,9 +472,7 @@ | @@ -472,9 +472,7 @@ | ||
472 | <!-- 左边 --> | 472 | <!-- 左边 --> |
473 | <view class="coupon-left rel {{filter.setcolor(item.UseObjectType)}} flex-center"> | 473 | <view class="coupon-left rel {{filter.setcolor(item.UseObjectType)}} flex-center"> |
474 | <view class="white xc-money-frames"> | 474 | <view class="white xc-money-frames"> |
475 | - <view class="f_text"> | ||
476 | - <text class="xc-rmb-val">包邮券</text> | ||
477 | - </view> | 475 | + <view class="f_text"><text class="xc-rmb-val">包邮券</text></view> |
478 | <view class="coupon-explain t-c" wx:if="{{item.condition>0}}"> | 476 | <view class="coupon-explain t-c" wx:if="{{item.condition>0}}"> |
479 | 满{{item.condition}}元可用 | 477 | 满{{item.condition}}元可用 |
480 | </view> | 478 | </view> |
@@ -487,9 +485,7 @@ | @@ -487,9 +485,7 @@ | ||
487 | <view class="flex top-frame"> | 485 | <view class="flex top-frame"> |
488 | <view class="frame"> | 486 | <view class="frame"> |
489 | <view class="coupon-wode ib flex ellipsis-2 "> | 487 | <view class="coupon-wode ib flex ellipsis-2 "> |
490 | - <text class="xc-brand t-c ib white {{filter.setcolor(item.UseObjectType)}}"> | ||
491 | - {{filter.get_type_card(0)}} | ||
492 | - </text> | 488 | + <text class="xc-brand t-c ib white {{filter.setcolor(item.UseObjectType)}}">{{filter.get_type_card(0)}}</text> |
493 | <block>包邮券</block> | 489 | <block>包邮券</block> |
494 | </view> | 490 | </view> |
495 | <view class="coupon-time"> | 491 | <view class="coupon-time"> |
packageC/pages/presell/goodsInfo/goodsInfo.js
@@ -1139,9 +1139,13 @@ Page({ | @@ -1139,9 +1139,13 @@ Page({ | ||
1139 | }) | 1139 | }) |
1140 | 1140 | ||
1141 | app.set_b_now(e); | 1141 | app.set_b_now(e); |
1142 | - getApp().goto("/packageC/pages/presell/cart/cart2_pre"); | ||
1143 | - | ||
1144 | 1142 | ||
1143 | + //如果是全额付款的话 | ||
1144 | + if(this.data.presellForm.presell_type==1){ | ||
1145 | + getApp().goto("/packageC/pages/presell/cart/cart2") | ||
1146 | + }else{ | ||
1147 | + getApp().goto("/packageC/pages/presell/cart/cart2_pre"); | ||
1148 | + } | ||
1145 | }, | 1149 | }, |
1146 | 1150 | ||
1147 | //----------增加购买数量----------- | 1151 | //----------增加购买数量----------- |
packageC/pages/presell/goodsInfo/goodsInfo.wxml
@@ -116,12 +116,14 @@ | @@ -116,12 +116,14 @@ | ||
116 | <view class="goods-num"> | 116 | <view class="goods-num"> |
117 | <block wx:if="{{presellList.virtual_qty}}"> | 117 | <block wx:if="{{presellList.virtual_qty}}"> |
118 | <view class="stock">总数量:{{presellList.presell_sumqty+presellList.virtual_qty}}件</view> | 118 | <view class="stock">总数量:{{presellList.presell_sumqty+presellList.virtual_qty}}件</view> |
119 | - <view class="stock">限购:{{presellList.vip_butyqty}}件</view> | 119 | + <view class="stock" wx:if="{{presellList.vip_butyqty}}">限购:{{presellList.vip_butyqty}}件</view> |
120 | + <view class="stock" wx:else>限购:不限</view> | ||
120 | <view class="sales">已购:{{presellList.buy_goodnum+presellList.virtual_qty}}件</view> | 121 | <view class="sales">已购:{{presellList.buy_goodnum+presellList.virtual_qty}}件</view> |
121 | </block> | 122 | </block> |
122 | <block wx:else> | 123 | <block wx:else> |
123 | <view class="stock">总数量:{{presellList.presell_sumqty}}件</view> | 124 | <view class="stock">总数量:{{presellList.presell_sumqty}}件</view> |
124 | - <view class="stock">限购:{{presellList.vip_butyqty}}件</view> | 125 | + <view class="stock" wx:if="{{presellList.vip_butyqty}}">限购:{{presellList.vip_butyqty}}件</view> |
126 | + <view class="stock" wx:else>限购:不限</view> | ||
125 | <view class="sales">已购:{{presellList.buy_goodnum}}件</view> | 127 | <view class="sales">已购:{{presellList.buy_goodnum}}件</view> |
126 | </block> | 128 | </block> |
127 | </view> | 129 | </view> |