Commit 8d8536990724013e66cef9068af10f54056d537c

Authored by 后端研发-苏明海
2 parents 131e9294 2aa5a2a2

Merge branch 'dev' into 'test'

Dev

See merge request !792
packageC/pages/presell/cart/cart.js
@@ -654,6 +654,13 @@ Page({ @@ -654,6 +654,13 @@ Page({
654 quan_price = res.data.data[0].WareCashSum; 654 quan_price = res.data.data[0].WareCashSum;
655 } 655 }
656 }) 656 })
  657 + }else{
  658 + th.setData({quan_price:0});
  659 + if(th.data.using_quan[bn_pick].isby==1){
  660 + var txt="using_quan["+bn_pick+"]";
  661 + th.setData({[txt]:{}});
  662 + }
  663 +
657 } 664 }
658 665
659 if(quan_price>0){ 666 if(quan_price>0){
@@ -697,11 +704,13 @@ Page({ @@ -697,11 +704,13 @@ Page({
697 th.setData({[order_prom_txt1]: order_prom_id, [order_prom_txt2]: order_prom_amount}) 704 th.setData({[order_prom_txt1]: order_prom_id, [order_prom_txt2]: order_prom_amount})
698 } 705 }
699 706
700 - o_condition1=parseFloat(o_condition1)-parseFloat(th.data.presell.presell_deposit);  
701 - th.setData({ exp_price: 0, order_m: o_condition1 }) 707 + o_condition1=parseFloat(o_condition1)-parseFloat(th.data.presell.presell_deposit);
  708 + if(o_condition1<0) o_condition1=0;
  709 + th.setData({ exp_price: 0, order_m: o_condition1 })
702 }) 710 })
703 }else{ 711 }else{
704 o_condition=parseFloat(o_condition)-parseFloat(th.data.presell.presell_deposit); 712 o_condition=parseFloat(o_condition)-parseFloat(th.data.presell.presell_deposit);
  713 + if(o_condition<0) o_condition=0;
705 th.setData({ exp_price: 0, order_m: o_condition }) 714 th.setData({ exp_price: 0, order_m: o_condition })
706 } 715 }
707 } 716 }
@@ -742,168 +751,6 @@ Page({ @@ -742,168 +751,6 @@ Page({
742 }); 751 });
743 }, 752 },
744 753
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 () { 754 set_can_num: function () {
908 var th = this; 755 var th = this;
909 //-- 这个地方,循环计算几张优惠券可用-- 756 //-- 这个地方,循环计算几张优惠券可用--
@@ -1257,20 +1104,13 @@ Page({ @@ -1257,20 +1104,13 @@ Page({
1257 var txt = ""; 1104 var txt = "";
1258 var txt1 = ""; 1105 var txt1 = "";
1259 var quan_item = null; 1106 var quan_item = null;
1260 - if (th.data.is_b_now) { 1107 +
1261 quan_item = this.data.get_by_quan_list[ind]; 1108 quan_item = this.data.get_by_quan_list[ind];
1262 txt = "get_by_quan_list[" + ind + "].show_red"; 1109 txt = "get_by_quan_list[" + ind + "].show_red";
1263 var obj = {}; 1110 var obj = {};
1264 obj[txt] = 1; 1111 obj[txt] = 1;
1265 this.setData(obj); 1112 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 - } 1113 +
1274 1114
1275 if (using_quan[th.data.selected_quan_pick]) { 1115 if (using_quan[th.data.selected_quan_pick]) {
1276 using_quan[th.data.selected_quan_pick].is_nouse_red = 0; 1116 using_quan[th.data.selected_quan_pick].is_nouse_red = 0;
@@ -1888,15 +1728,17 @@ Page({ @@ -1888,15 +1728,17 @@ Page({
1888 } 1728 }
1889 }) 1729 })
1890 1730
1891 - if(quan_price>0) {  
1892 - if (quan_price <th.data.tail_pay) th.setData({quan_price:quan_price}) 1731 + if (quan_price > 0) {
  1732 + if (quan_price < th.data.tail_pay) th.setData({quan_price: quan_price})
1893 else { 1733 else {
1894 - th.setData({quan_price: th.data.tail_pay})  
1895 - quan_price=th.data.tail_pay; 1734 + th.setData({quan_price: th.data.tail_pay})
  1735 + quan_price = th.data.tail_pay;
1896 } 1736 }
1897 - }else{ 1737 + } else {
1898 th.setData({quan_price: 0}) 1738 th.setData({quan_price: 0})
1899 } 1739 }
  1740 + }else{
  1741 + th.setData({quan_price: 0})
1900 } 1742 }
1901 }else{ 1743 }else{
1902 th.setData({quan_price: 0}) 1744 th.setData({quan_price: 0})
@@ -1905,7 +1747,7 @@ Page({ @@ -1905,7 +1747,7 @@ Page({
1905 //-----------当地址不为空,且是物流时,计算物流费用---------- 1747 //-----------当地址不为空,且是物流时,计算物流费用----------
1906 if (th.data.user_addr != null && th.data.exp_type == 0 && good.is_free_shipping == 0) { 1748 if (th.data.user_addr != null && th.data.exp_type == 0 && good.is_free_shipping == 0) {
1907 //看是不是有调用过包邮券,如果活动可以使用优化券的情况下 1749 //看是不是有调用过包邮券,如果活动可以使用优化券的情况下
1908 - if (!th.data.isget_by_quan[bn_pick] && th.data.is_usecoupon) { 1750 + if (!th.data.isget_by_quan[bn_pick] && th.data.act.is_usecoupon) {
1909 var condition = allpice - quan_price; 1751 var condition = allpice - quan_price;
1910 //--判断要不要显示包邮券,链式调用接口,调取包邮券,已经是减了优惠的金额,见到优惠券的钱--- 1752 //--判断要不要显示包邮券,链式调用接口,调取包邮券,已经是减了优惠的金额,见到优惠券的钱---
1911 getApp().request.promiseGet("/api/weshop/userfeemail/pageAndArea", { 1753 getApp().request.promiseGet("/api/weshop/userfeemail/pageAndArea", {
@@ -2009,12 +1851,14 @@ Page({ @@ -2009,12 +1851,14 @@ Page({
2009 1851
2010 1852
2011 ord_price=parseFloat(ord_price)-parseFloat(th.data.presell.presell_deposit); 1853 ord_price=parseFloat(ord_price)-parseFloat(th.data.presell.presell_deposit);
  1854 + if(ord_price<0) ord_price=0;
2012 th.setData({ exp_price: exp_price, order_m: ord_price +parseFloat(exp_price) }) 1855 th.setData({ exp_price: exp_price, order_m: ord_price +parseFloat(exp_price) })
2013 1856
2014 }) 1857 })
2015 }else{ 1858 }else{
2016 1859
2017 - var o_condition1=parseFloat(o_condition)-parseFloat(th.data.presell.presell_deposit); 1860 + var o_condition1=parseFloat(o_condition)-parseFloat(th.data.presell.presell_deposit);
  1861 + if(o_condition1<0) o_condition1=0;
2018 th.setData({ exp_price: exp_price, order_m: parseFloat(o_condition1)+parseFloat(exp_price) }) 1862 th.setData({ exp_price: exp_price, order_m: parseFloat(o_condition1)+parseFloat(exp_price) })
2019 } 1863 }
2020 }, 1864 },
@@ -2068,7 +1912,13 @@ Page({ @@ -2068,7 +1912,13 @@ Page({
2068 1912
2069 //显示支付选择 1913 //显示支付选择
2070 show_pay: function () { 1914 show_pay: function () {
2071 - this.setData({show_pay_type: 1}); 1915 + //不用钱直接支付
  1916 + if(this.data.order_m<=0){
  1917 + this.to_pay_type(1);
  1918 + }else{
  1919 + this.setData({show_pay_type: 1});
  1920 + }
  1921 +
2072 }, 1922 },
2073 //关闭支付 1923 //关闭支付
2074 close_show_pay: function () { 1924 close_show_pay: function () {
@@ -2221,7 +2071,6 @@ Page({ @@ -2221,7 +2071,6 @@ Page({
2221 this.calculatePrice2(); 2071 this.calculatePrice2();
2222 }, 2072 },
2223 2073
2224 -  
2225 //--------立即支付---------- 2074 //--------立即支付----------
2226 async jumpToCart4(e) { 2075 async jumpToCart4(e) {
2227 var th=this; 2076 var th=this;
@@ -2598,7 +2447,6 @@ Page({ @@ -2598,7 +2447,6 @@ Page({
2598 2447
2599 }, 2448 },
2600 2449
2601 -  
2602 //--------取消订单--------- 2450 //--------取消订单---------
2603 cancelOrder: function(e) { 2451 cancelOrder: function(e) {
2604 var t = this,th=t, ord_id = this.data.order.order_id,order=this.data.order; 2452 var t = this,th=t, ord_id = this.data.order.order_id,order=this.data.order;
packageC/pages/presell/cart/cart.wxml
@@ -340,8 +340,8 @@ @@ -340,8 +340,8 @@
340 <text class="co-red"> <text class="fs24">¥</text>{{filters.toFix(order_m,2)}}</text> 340 <text class="co-red"> <text class="fs24">¥</text>{{filters.toFix(order_m,2)}}</text>
341 </view> 341 </view>
342 </view> 342 </view>
343 - <button wx:if="{{no_start || is_end || is_complete}}" class="tips-btn gray">提交订单</button>  
344 - <button wx:else class="tips-btn" bindtap="show_pay">提交订单</button> 343 + <button wx:if="{{no_start || is_end || is_complete}}" class="tips-btn gray">支付尾款</button>
  344 + <button wx:else class="tips-btn" bindtap="show_pay">支付尾款</button>
345 <!-- 预售 --> 345 <!-- 预售 -->
346 <!-- <button class="tips-btn" formType="submit" id="submitOrder">立即支付</button> --> 346 <!-- <button class="tips-btn" formType="submit" id="submitOrder">立即支付</button> -->
347 </view> 347 </view>
@@ -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>