Commit b6c8f4ba483540f066bb3564ecc901a194b30595
Merge branch 'dev' into 'test'
Dev See merge request !940
Showing
18 changed files
with
360 additions
and
203 deletions
components/diy_pingd_buy/diy_pingd_buy.js
... | ... | @@ -104,7 +104,11 @@ Component({ |
104 | 104 | var url= "/api/weshop/teamlist/pageteam/2?page=1&pageSize=9"; |
105 | 105 | getApp().request.promiseGet(url, { |
106 | 106 | data: { |
107 | - store_id: os.stoid,is_end: 0,is_show: 1, | |
107 | + store_id: | |
108 | + os.stoid, | |
109 | + is_end: 0, | |
110 | + is_show: 1, | |
111 | + user_id: getApp().globalData.user_id, | |
108 | 112 | } |
109 | 113 | }).then(res => { |
110 | 114 | if(res.data.code==0 && res.data.data.pageData && res.data.data.pageData.length>0){ |
... | ... | @@ -139,7 +143,7 @@ Component({ |
139 | 143 | //--三个三个一组--- |
140 | 144 | for(var i=0;i< all_array.length;i+=3){ |
141 | 145 | arr.push(all_array.slice(i,i+3)); |
142 | - } | |
146 | + } | |
143 | 147 | /*--熏染到前台--*/ |
144 | 148 | th.setData({goods_array:arr}); |
145 | 149 | var newTime = ut.gettimestamp(); | ... | ... |
packageA/pages/distribution/myteam/myteam.wxml
... | ... | @@ -12,7 +12,7 @@ |
12 | 12 | <view> |
13 | 13 | {{item.nickname}} |
14 | 14 | <view style="color: #FF6768;display:block;font-size:26rpx" wx:if="{{item.is_distribut == 1}}">分销会员</view> |
15 | - <view style="color: #FF6768;display:block;" wx:else>普通会员</view> | |
15 | + <view style="color: #FF6768;display:block;font-size:26rpx" wx:else>普通会员</view> | |
16 | 16 | </view> |
17 | 17 | <view class="fs24 c-a">{{filter.format_time(item.reg_time)}}</view> |
18 | 18 | </view> | ... | ... |
packageB/pages/zuhegou/index/index.js
... | ... | @@ -1972,15 +1972,8 @@ Page({ |
1972 | 1972 | if (this.data.act.is_bzyh && zhqty_bz.length > 0) { |
1973 | 1973 | if (zhqty_bz.length > 1) { |
1974 | 1974 | let zhqty_bz_arr = []; |
1975 | - let zhqty_bz_flag = zhqty_bz.every((item1, i) => { | |
1976 | - var bz_num = be * item1['zhqty']; //超量倍增 | |
1977 | - var num = item1['num'] - item1['zhqty']; //购买数量减去超量 | |
1978 | - if (bz_num > num) { | |
1979 | - zhqty_bz_arr.push(item1); | |
1980 | - zhqty_bz.splice(i, 1) | |
1981 | - } | |
1982 | - return bz_num <= num; | |
1983 | - }) | |
1975 | + let zhqty_bz_flag=this.zhqty_bz_fun(zhqty_bz,be,zhqty_bz_arr); | |
1976 | + | |
1984 | 1977 | if (zhqty_bz_flag) { |
1985 | 1978 | for (let i = 0; i < zhqty_bz.length; i++) { |
1986 | 1979 | var vv = zhqty_bz[i]; |
... | ... | @@ -1995,11 +1988,12 @@ Page({ |
1995 | 1988 | } |
1996 | 1989 | } |
1997 | 1990 | } else { |
1991 | + zhqty_len=1; | |
1998 | 1992 | let min_bz_num = Math.min.apply(Math, zhqty_bz_arr.map(function (o) { |
1999 | - return o['num'] | |
1993 | + return o['num']; | |
2000 | 1994 | })); |
2001 | 1995 | let new_arr = zhqty_bz_arr.filter(ii => { |
2002 | - return ii['num'] == min_bz_num | |
1996 | + return ii['num'] == min_bz_num; | |
2003 | 1997 | }) |
2004 | 1998 | var vv = new_arr[0]; |
2005 | 1999 | var bz_num = be * new_arr[0].zhqty; //超量倍增 |
... | ... | @@ -2018,16 +2012,20 @@ Page({ |
2018 | 2012 | } |
2019 | 2013 | bz_num_ok = be * vv.zhqty; |
2020 | 2014 | } |
2021 | - | |
2022 | - for (let j = 0; j < bz_num_ok; j++) { | |
2023 | - let index = no_in_arr.findIndex(i => { | |
2024 | - return vv.goods_id === i.goods_id | |
2025 | - }) | |
2026 | - if (index > -1) { | |
2027 | - delete_num++ | |
2028 | - no_in_arr.splice(index, 1) | |
2015 | + | |
2016 | + for(let i = 0; i < zhqty_bz.length; i++){ | |
2017 | + let item1=zhqty_bz[i]; | |
2018 | + for (let j = 0; j < be * item1['zhqty']; j++) { | |
2019 | + let index = no_in_arr.findIndex(i => { | |
2020 | + return item1.goods_id === i.goods_id | |
2021 | + }) | |
2022 | + if (index > -1) { | |
2023 | + // delete_num++ | |
2024 | + no_in_arr.splice(index, 1) | |
2025 | + } | |
2029 | 2026 | } |
2030 | 2027 | } |
2028 | + aprice += be * aprice; | |
2031 | 2029 | } |
2032 | 2030 | } else { |
2033 | 2031 | var vv = zhqty_bz[0]; |
... | ... | @@ -2258,6 +2256,20 @@ Page({ |
2258 | 2256 | } |
2259 | 2257 | if (func) func(list) |
2260 | 2258 | |
2261 | - } | |
2259 | + }, | |
2262 | 2260 | |
2261 | + zhqty_bz_fun(zhqty_bz,be,zhqty_bz_arr){ | |
2262 | + let zhqty_bz_flag =true; | |
2263 | + for(let i=0;i<zhqty_bz.length;i++){ | |
2264 | + let item=zhqty_bz[i]; | |
2265 | + let bz_num = be * item['zhqty']; //超量倍增 | |
2266 | + let num = item['num'] - item['zhqty']; //购买数量减去超量 | |
2267 | + if (bz_num > num) { | |
2268 | + zhqty_bz_flag=false; | |
2269 | + zhqty_bz_arr.push(item); | |
2270 | + // zhqty_bz.splice(i,1) | |
2271 | + } | |
2272 | + } | |
2273 | + return zhqty_bz_flag; | |
2274 | + } | |
2263 | 2275 | }) |
2264 | 2276 | \ No newline at end of file | ... | ... |
packageB/pages/zuhegou/list/list.wxml
... | ... | @@ -63,7 +63,7 @@ |
63 | 63 | </view> |
64 | 64 | |
65 | 65 | <view class="no-more" wx:if="{{goodlist.length==0}}">没有相关内容</view> |
66 | - | |
66 | +<!-- | |
67 | 67 | <view class="kill-time xc-seckill-bottom"> |
68 | 68 | <view class="theader" > |
69 | 69 | <view bindtap='tip' data-ty="1" class="xc-border-right flex-center timeac left {{type==1?'active':''}}"> |
... | ... | @@ -76,7 +76,7 @@ |
76 | 76 | 即将开始</view> |
77 | 77 | </view> |
78 | 78 | </view> |
79 | - | |
79 | +--> | |
80 | 80 | |
81 | 81 | |
82 | 82 | </view> | ... | ... |
packageC/pages/group_list/group_list.wxml
... | ... | @@ -44,7 +44,7 @@ |
44 | 44 | <nodata nodataContainer="t-c" wx:if="{{list.pageData.length == 0}}"></nodata> |
45 | 45 | |
46 | 46 | |
47 | - | |
47 | +<!-- | |
48 | 48 | <view class="kill-time xc-seckill-bottom"> |
49 | 49 | <view class="theader" > |
50 | 50 | <view bindtap='tip' data-ty="1" class="xc-border-right flex-center timeac left {{type==1?'active':''}}"> |
... | ... | @@ -54,4 +54,5 @@ |
54 | 54 | <image class="xc-bottom" src="{{url}}{{type==0?'/miniapp/images/clock-rad.png':'/miniapp/images/clock-black.png'}}"></image> |
55 | 55 | 即将开始</view> |
56 | 56 | </view> |
57 | -</view> | |
58 | 57 | \ No newline at end of file |
58 | +</view> | |
59 | +--> | |
59 | 60 | \ No newline at end of file | ... | ... |
packageC/pages/luckyGo/luckyGo_cart/luckyGo_cart.js
... | ... | @@ -1374,13 +1374,11 @@ Page({ |
1374 | 1374 | o_price += item[j].goods_price * item[j].goods_num; |
1375 | 1375 | |
1376 | 1376 | //判断是否有设置限制重量包邮 |
1377 | - if(weight_free){ | |
1378 | - if( item[j]['exp_sum_type']==2 ){ | |
1379 | - if (goods_weight < 0) goods_weight = 0; | |
1380 | - //累积商品重量 每种商品的重量 * 数量 | |
1381 | - goods_weight += item[j]['weight'] * item[j]['goods_num']; | |
1382 | - out_of_weight = (weight_free*1000) - goods_weight; | |
1383 | - } | |
1377 | + if(item[j]['is_past']!==1 && item[j]['exp_sum_type']==2 && weight_free>0){ | |
1378 | + if (goods_weight < 0) goods_weight = 0; | |
1379 | + //累积商品重量 每种商品的重量 * 数量 | |
1380 | + goods_weight += item[j]['weight'] * item[j]['goods_num']; | |
1381 | + out_of_weight = (weight_free*1000) - goods_weight; | |
1384 | 1382 | } |
1385 | 1383 | } |
1386 | 1384 | //判断是不是有组合购的金额 |
... | ... | @@ -1560,9 +1558,11 @@ Page({ |
1560 | 1558 | } |
1561 | 1559 | |
1562 | 1560 | }else{ |
1563 | - if(goods_weight && out_of_weight !== 0){ | |
1564 | - goods_weight=-1; | |
1565 | - out_of_weight=0; | |
1561 | + if(item[j]['exp_sum_type']==2){ | |
1562 | + if(out_of_weight !==0){ | |
1563 | + goods_weight=-1; | |
1564 | + out_of_weight=0; | |
1565 | + } | |
1566 | 1566 | } |
1567 | 1567 | } |
1568 | 1568 | } |
... | ... | @@ -1866,7 +1866,9 @@ Page({ |
1866 | 1866 | if (goods_weight < 0) goods_weight = 0; |
1867 | 1867 | //累积商品重量 每种商品的重量 * 数量 |
1868 | 1868 | goods_weight += good['weight'] * good['buynum']; |
1869 | - out_of_weight = (weight_free * 1000 ) - goods_weight; | |
1869 | + if(weight_free > 0){ | |
1870 | + out_of_weight = (weight_free * 1000 ) - goods_weight; | |
1871 | + } | |
1870 | 1872 | break; |
1871 | 1873 | case 3: |
1872 | 1874 | if (goods_piece < 0) goods_piece = 0; |
... | ... | @@ -2863,7 +2865,7 @@ Page({ |
2863 | 2865 | var price = 0, th = this; |
2864 | 2866 | price += parseFloat(o_shipping_price); |
2865 | 2867 | //如果是包邮 |
2866 | - if (freight_free > 0 && o_price >= freight_free && out_of_weight > 0) { | |
2868 | + if (freight_free > 0 && o_price >= freight_free && out_of_weight >= 0) { | |
2867 | 2869 | return 0; |
2868 | 2870 | } |
2869 | 2871 | if (user_addr == null) { |
... | ... | @@ -2881,7 +2883,7 @@ Page({ |
2881 | 2883 | item = item.config; |
2882 | 2884 | if (item == null) return o_shipping_price; |
2883 | 2885 | //------按重量---------- |
2884 | - if (goods_weight >= 0 && item['money'] && out_of_weight > 0) { | |
2886 | + if (goods_weight >= 0 && item['money']) { | |
2885 | 2887 | fw_price = parseFloat(item['money']); |
2886 | 2888 | if (goods_weight > item['first_weight']) { |
2887 | 2889 | var fw = goods_weight - item['first_weight']; |
... | ... | @@ -2890,11 +2892,14 @@ Page({ |
2890 | 2892 | } |
2891 | 2893 | } |
2892 | 2894 | //------超出重量---------- |
2893 | - if(out_of_weight < 0){ | |
2895 | + if(out_of_weight < 0 && o_price >= freight_free){ | |
2894 | 2896 | fw_price = parseFloat(item['money']); |
2895 | 2897 | var out_of_weight = Math.abs(out_of_weight); |
2896 | - var n = Math.ceil(out_of_weight / item['second_weight']) | |
2897 | - fw_price = fw_price + n * parseFloat(item['add_money']); | |
2898 | + if (out_of_weight > item['first_weight']) { | |
2899 | + var fw = out_of_weight - item['first_weight']; | |
2900 | + var n = Math.ceil(fw / item['second_weight']) | |
2901 | + fw_price = fw_price + n * parseFloat(item['add_money']); | |
2902 | + } | |
2898 | 2903 | } |
2899 | 2904 | //------按件数---------- |
2900 | 2905 | if (goods_piece > 0 && item['piecemoney']) { | ... | ... |
packageC/pages/luckyGo/luckyGo_cart_ct/luckyGo_cart_ct.js
... | ... | @@ -513,6 +513,10 @@ Page({ |
513 | 513 | var o_shipping_price = 0, |
514 | 514 | goods_weight = -1, |
515 | 515 | goods_piece = -1; |
516 | + var out_of_weight=null; //超出多少重量 | |
517 | + var freight_free = ee.freight_free; //全场满多少包邮 | |
518 | + var weight_free = ee.weight_free; //多少kg内包邮 | |
519 | + var no_ex_id = ee.no_ex_id; | |
516 | 520 | //-----------当地址不为空,且是物流时,计算物流费用,同时阶梯团不计算拼团价格---------- |
517 | 521 | if (th.data.user_addr != null && th.data.bn_exp_type == 0 && good.is_free_shipping == 0 && (th.data.kt_type != |
518 | 522 | 3 || th.data.bn_goods.is_normal == 1)) { |
... | ... | @@ -525,6 +529,9 @@ Page({ |
525 | 529 | if (goods_weight < 0) goods_weight = 0; |
526 | 530 | //累积商品重量 每种商品的重量 * 数量 |
527 | 531 | goods_weight += good['weight'] * good['buynum']; |
532 | + if(weight_free > 0){ | |
533 | + out_of_weight = (weight_free * 1000 ) - goods_weight; | |
534 | + } | |
528 | 535 | break; |
529 | 536 | case 3: |
530 | 537 | if (goods_piece < 0) goods_piece = 0; |
... | ... | @@ -1042,7 +1049,7 @@ Page({ |
1042 | 1049 | th = this; |
1043 | 1050 | price += parseFloat(o_shipping_price); |
1044 | 1051 | //如果是包邮 |
1045 | - if (freight_free > 0 && o_price >= freight_free) { | |
1052 | + if (freight_free > 0 && o_price >= freight_free && out_of_weight >= 0) { | |
1046 | 1053 | return 0; |
1047 | 1054 | } |
1048 | 1055 | if (user_addr == null) { |
... | ... | @@ -1061,7 +1068,7 @@ Page({ |
1061 | 1068 | item = item.config; |
1062 | 1069 | if (item == null) return o_shipping_price; |
1063 | 1070 | //------按重量---------- |
1064 | - if (goods_weight > 0) { | |
1071 | + if (goods_weight > 0 && item['money']) { | |
1065 | 1072 | fw_price = parseFloat(item['money']); |
1066 | 1073 | if (goods_weight > item['first_weight']) { |
1067 | 1074 | var fw = goods_weight - item['first_weight']; |
... | ... | @@ -1069,6 +1076,16 @@ Page({ |
1069 | 1076 | fw_price = fw_price + n * parseFloat(item['add_money']); |
1070 | 1077 | } |
1071 | 1078 | } |
1079 | + //------超出重量---------- | |
1080 | + if(out_of_weight < 0 && o_price >= freight_free){ | |
1081 | + fw_price = parseFloat(item['money']); | |
1082 | + var out_of_weight = Math.abs(out_of_weight); | |
1083 | + if (out_of_weight > item['first_weight']) { | |
1084 | + var fw = out_of_weight - item['first_weight']; | |
1085 | + var n = Math.ceil(fw / item['second_weight']) | |
1086 | + fw_price = fw_price + n * parseFloat(item['add_money']); | |
1087 | + } | |
1088 | + } | |
1072 | 1089 | //------按件数---------- |
1073 | 1090 | if (goods_piece > 0) { |
1074 | 1091 | fp_price = parseFloat(item['piecemoney']); | ... | ... |
packageC/pages/presell/cart/cart.js
... | ... | @@ -852,12 +852,12 @@ Page({ |
852 | 852 | th.calculatePrice2(); |
853 | 853 | }, |
854 | 854 | //-------------------计算物流--------------- |
855 | - calculatewuliu: function (code, o_shipping_price, goods_weight, | |
855 | + calculatewuliu: function (code, o_shipping_price, goods_weight,out_of_weight, | |
856 | 856 | goods_piece, user_addr, freight_free, o_price, rs) { |
857 | 857 | var price = 0, th = this; |
858 | 858 | price += parseFloat(o_shipping_price); |
859 | 859 | //如果是包邮 |
860 | - if (freight_free > 0 && o_price >= freight_free) { | |
860 | + if (freight_free > 0 && o_price >= freight_free && out_of_weight>=0) { | |
861 | 861 | return 0; |
862 | 862 | } |
863 | 863 | if (user_addr == null) { |
... | ... | @@ -883,6 +883,16 @@ Page({ |
883 | 883 | fw_price = fw_price + n * parseFloat(item['add_money']); |
884 | 884 | } |
885 | 885 | } |
886 | + //------超出重量---------- | |
887 | + if(out_of_weight < 0 && o_price >= freight_free){ | |
888 | + fw_price = parseFloat(item['money']); | |
889 | + var out_of_weight = Math.abs(out_of_weight); | |
890 | + if (out_of_weight > item['first_weight']) { | |
891 | + var fw = out_of_weight - item['first_weight']; | |
892 | + var n = Math.ceil(fw / item['second_weight']) | |
893 | + fw_price = fw_price + n * parseFloat(item['add_money']); | |
894 | + } | |
895 | + } | |
886 | 896 | //------按件数---------- |
887 | 897 | if (goods_piece > 0 && item['piecemoney']) { |
888 | 898 | fp_price = parseFloat(item['piecemoney']); |
... | ... | @@ -1713,6 +1723,9 @@ Page({ |
1713 | 1723 | var quan_no = null; |
1714 | 1724 | var bn_pick=th.data.pickup.pickup_id; |
1715 | 1725 | var allpice =th.data.all_price; |
1726 | + var out_of_weight=null; //超出多少重量 | |
1727 | + var freight_free = ee.freight_free; //全场满多少包邮 | |
1728 | + var weight_free = ee.weight_free; //多少kg内包邮 | |
1716 | 1729 | |
1717 | 1730 | if (th.data.using_quan[bn_pick] != null && th.data.using_quan[bn_pick] != undefined) |
1718 | 1731 | quan_no = th.data.using_quan[bn_pick].coupon_no; |
... | ... | @@ -1793,6 +1806,9 @@ Page({ |
1793 | 1806 | if (goods_weight < 0) goods_weight = 0; |
1794 | 1807 | //累积商品重量 每种商品的重量 * 数量 |
1795 | 1808 | goods_weight += good['weight'] * th.data.order.order_goods['goods_num']; |
1809 | + if(weight_free > 0){ | |
1810 | + out_of_weight = (weight_free * 1000 ) - goods_weight; | |
1811 | + } | |
1796 | 1812 | break; |
1797 | 1813 | case 3: |
1798 | 1814 | if (goods_piece < 0) goods_piece = 0; |
... | ... | @@ -1802,7 +1818,6 @@ Page({ |
1802 | 1818 | } |
1803 | 1819 | |
1804 | 1820 | var code = th.data.wu_arr[th.data.index].code; |
1805 | - var freight_free = ee.freight_free; //全场满多少包邮 | |
1806 | 1821 | var shipping_price = |
1807 | 1822 | th.calculatewuliu(code, o_shipping_price, goods_weight, |
1808 | 1823 | goods_piece, th.data.user_addr, freight_free, allpice, rs); | ... | ... |
packageC/pages/presell/cart/cart2.js
... | ... | @@ -734,7 +734,7 @@ Page({ |
734 | 734 | |
735 | 735 | //如果有赠品的时候,也要计算赠品的物流费用 |
736 | 736 | if (th.data.buy_now_gift_goods) { |
737 | - shipping_price = th.get_now_gift_goods_wuliu(code, o_shipping_price, th.data.user_addr, gift_freight_free,gift_weight_free, | |
737 | + shipping_price = th.get_now_gift_goods_wuliu(code, o_shipping_price, th.data.user_addr, gift_freight_free,out_of_weight,gift_weight_free, | |
738 | 738 | parseFloat(allpice) - cut_price - quan_price, rs, shipping_price, no_by_data, goods_weight, goods_piece); |
739 | 739 | } |
740 | 740 | |
... | ... | @@ -1693,7 +1693,7 @@ Page({ |
1693 | 1693 | item = item.config; |
1694 | 1694 | if (item == null) return o_shipping_price; |
1695 | 1695 | //------按重量---------- |
1696 | - if (goods_weight >= 0 && item['money'] && out_of_weight > 0) { | |
1696 | + if (goods_weight >= 0 && item['money']) { | |
1697 | 1697 | fw_price = parseFloat(item['money']); |
1698 | 1698 | if (goods_weight > item['first_weight']) { |
1699 | 1699 | var fw = goods_weight - item['first_weight']; |
... | ... | @@ -1703,7 +1703,7 @@ Page({ |
1703 | 1703 | } |
1704 | 1704 | |
1705 | 1705 | //------超出重量---------- |
1706 | - if(out_of_weight < 0){ | |
1706 | + if(out_of_weight < 0 && o_price >= freight_free){ | |
1707 | 1707 | fw_price = parseFloat(item['money']); |
1708 | 1708 | var out_of_weight = Math.abs(out_of_weight); |
1709 | 1709 | var n = Math.ceil(out_of_weight / item['second_weight']) |
... | ... | @@ -2540,7 +2540,7 @@ Page({ |
2540 | 2540 | }, |
2541 | 2541 | |
2542 | 2542 | //计算立即购买赠品的物流费用 |
2543 | - get_now_gift_goods_wuliu: function (code, o_shipping_price, user_addr, gift_freight_free,gift_weight_free, allpice, rs, shipping_price, no_by_data, goods_weight1, goods_piece1) { | |
2543 | + get_now_gift_goods_wuliu: function (code, o_shipping_price, user_addr, gift_freight_free,gift_weight_free,out_of_weight,allpice, rs, shipping_price, no_by_data, goods_weight1, goods_piece1) { | |
2544 | 2544 | var good = this.data.buy_now_gift_goods; |
2545 | 2545 | var goods_weight = -1, goods_piece = -1; |
2546 | 2546 | var gift_shipping_price = 0; |
... | ... | @@ -2556,8 +2556,9 @@ Page({ |
2556 | 2556 | //累积商品重量 每种商品的重量 * 数量 |
2557 | 2557 | goods_weight += good['weight'] * good['buynum']; |
2558 | 2558 | if (goods_weight1 > 0) { |
2559 | + out_of_weight = gift_weight_free - goods_weight; | |
2560 | + //不能调换位置 下面goods_weight会变大 | |
2559 | 2561 | goods_weight += goods_weight1; |
2560 | - out_of_weight = (gift_weight_free*1000) - goods_weight; | |
2561 | 2562 | } |
2562 | 2563 | break; |
2563 | 2564 | case 3: | ... | ... |
packageC/pages/presell/cart/cart2_pre.js
... | ... | @@ -342,7 +342,11 @@ Page({ |
342 | 342 | |
343 | 343 | app.getConfig2(function (ee) { |
344 | 344 | app.getwuliuprice(function (rs) { |
345 | - var o_shipping_price = 0, goods_weight = -1, goods_piece = -1; | |
345 | + var o_shipping_price = 0, goods_weight = -1, goods_piece = -1; | |
346 | + var out_of_weight=null; //超出多少重量 | |
347 | + var freight_free = ee.freight_free; //全场满多少包邮 | |
348 | + var weight_free = ee.weight_free; //多少kg内包邮 | |
349 | + var no_ex_id = ee.no_ex_id; | |
346 | 350 | //-----------当地址不为空,且是物流时,计算物流费用,同时阶梯团不计算拼团价格---------- |
347 | 351 | if (th.data.user_addr != null && th.data.bn_exp_type == 0 |
348 | 352 | && good.is_free_shipping == 0 && (th.data.kt_type!=3 || th.data.bn_goods.is_normal==1) ){ |
... | ... | @@ -353,7 +357,11 @@ Page({ |
353 | 357 | case 2: |
354 | 358 | if (goods_weight < 0) goods_weight = 0; |
355 | 359 | //累积商品重量 每种商品的重量 * 数量 |
356 | - goods_weight += good['weight'] * good['buynum'];break; | |
360 | + goods_weight += good['weight'] * good['buynum']; | |
361 | + if(weight_free > 0){ | |
362 | + out_of_weight = (weight_free * 1000 ) - goods_weight; | |
363 | + } | |
364 | + break; | |
357 | 365 | case 3: |
358 | 366 | if (goods_piece < 0) goods_piece = 0; |
359 | 367 | //累积商品数量 |
... | ... | @@ -361,9 +369,8 @@ Page({ |
361 | 369 | } |
362 | 370 | |
363 | 371 | var code = th.data.wu_arr[th.data.index].code; |
364 | - var freight_free = ee.freight_free; //全场满多少包邮 | |
365 | 372 | var shipping_price= |
366 | - th.calculatewuliu(code, o_shipping_price, goods_weight, | |
373 | + th.calculatewuliu(code, o_shipping_price, goods_weight,out_of_weight, | |
367 | 374 | goods_piece, th.data.user_addr, freight_free, allpice, rs); |
368 | 375 | |
369 | 376 | shipping_price = parseFloat(shipping_price).toFixed(2); |
... | ... | @@ -701,12 +708,12 @@ Page({ |
701 | 708 | }, |
702 | 709 | |
703 | 710 | //-------------------计算物流--------------- |
704 | - calculatewuliu:function(code, o_shipping_price, goods_weight, | |
711 | + calculatewuliu:function(code, o_shipping_price, goods_weight,out_of_weight, | |
705 | 712 | goods_piece,user_addr, freight_free, o_price, rs){ |
706 | 713 | var price =0,th=this; |
707 | 714 | price +=parseFloat(o_shipping_price); |
708 | 715 | //如果是包邮 |
709 | - if (freight_free > 0 && o_price >= freight_free){ return 0;} | |
716 | + if (freight_free > 0 && o_price >= freight_free && out_of_weight>=0){ return 0;} | |
710 | 717 | if (user_addr==null) { return 0; } |
711 | 718 | //计算物流的config item; |
712 | 719 | var item=null; |
... | ... | @@ -720,7 +727,7 @@ Page({ |
720 | 727 | item=item.config; |
721 | 728 | if (item == null) return o_shipping_price; |
722 | 729 | //------按重量---------- |
723 | - if (goods_weight>0) { | |
730 | + if (goods_weight >= 0 && item['money']) { | |
724 | 731 | fw_price =parseFloat(item['money']); |
725 | 732 | if (goods_weight > item['first_weight']){ |
726 | 733 | var fw = goods_weight - item['first_weight']; |
... | ... | @@ -728,6 +735,16 @@ Page({ |
728 | 735 | fw_price = fw_price + n * parseFloat(item['add_money']); |
729 | 736 | } |
730 | 737 | } |
738 | + //------超出重量---------- | |
739 | + if(out_of_weight < 0 && o_price >= freight_free){ | |
740 | + fw_price = parseFloat(item['money']); | |
741 | + var out_of_weight = Math.abs(out_of_weight); | |
742 | + if (out_of_weight > item['first_weight']) { | |
743 | + var fw = out_of_weight - item['first_weight']; | |
744 | + var n = Math.ceil(fw / item['second_weight']) | |
745 | + fw_price = fw_price + n * parseFloat(item['add_money']); | |
746 | + } | |
747 | + } | |
731 | 748 | //------按件数---------- |
732 | 749 | if (goods_piece > 0) { |
733 | 750 | fp_price = parseFloat(item['piecemoney']); | ... | ... |
pages/cart/cart/zh_calculate.js
... | ... | @@ -239,15 +239,8 @@ module.exports = { |
239 | 239 | if (act.is_bzyh && zhqty_bz.length > 0) { |
240 | 240 | if (zhqty_bz.length > 1) { |
241 | 241 | let zhqty_bz_arr = []; |
242 | - let zhqty_bz_flag = zhqty_bz.every((item1, i) => { | |
243 | - var bz_num = be * item1['zhqty']; //超量倍增 | |
244 | - var num = item1['num'] - item1['zhqty']; //购买数量减去超量 | |
245 | - if (bz_num > num) { | |
246 | - zhqty_bz_arr.push(item1); | |
247 | - zhqty_bz.splice(i, 1) | |
248 | - } | |
249 | - return bz_num <= num; | |
250 | - }) | |
242 | + let zhqty_bz_flag=this.zhqty_bz_fun(zhqty_bz,be,zhqty_bz_arr); | |
243 | + | |
251 | 244 | if (zhqty_bz_flag) { |
252 | 245 | for (let i = 0; i < zhqty_bz.length; i++) { |
253 | 246 | var vv = zhqty_bz[i]; |
... | ... | @@ -262,11 +255,12 @@ module.exports = { |
262 | 255 | } |
263 | 256 | } |
264 | 257 | } else { |
258 | + zhqty_len=1; | |
265 | 259 | let min_bz_num = Math.min.apply(Math, zhqty_bz_arr.map(function (o) { |
266 | - return o['num'] | |
260 | + return o['num']; | |
267 | 261 | })); |
268 | 262 | let new_arr = zhqty_bz_arr.filter(ii => { |
269 | - return ii['num'] == min_bz_num | |
263 | + return ii['num'] == min_bz_num; | |
270 | 264 | }) |
271 | 265 | var vv = new_arr[0]; |
272 | 266 | var bz_num = be * new_arr[0].zhqty; //超量倍增 |
... | ... | @@ -285,18 +279,22 @@ module.exports = { |
285 | 279 | } |
286 | 280 | bz_num_ok = be * vv.zhqty; |
287 | 281 | } |
288 | - | |
289 | - for (let j = 0; j < bz_num_ok; j++) { | |
290 | - let index = no_in_arr.findIndex(i => { | |
291 | - return vv.goods_id === i.goods_id | |
292 | - }) | |
293 | - if (index > -1) { | |
294 | - delete_num++ | |
295 | - no_in_arr.splice(index, 1) | |
282 | + | |
283 | + for(let i = 0; i < zhqty_bz.length; i++){ | |
284 | + let item1=zhqty_bz[i]; | |
285 | + for (let j = 0; j < be * item1['zhqty']; j++) { | |
286 | + let index = no_in_arr.findIndex(i => { | |
287 | + return item1.goods_id === i.goods_id | |
288 | + }) | |
289 | + if (index > -1) { | |
290 | + // delete_num++ | |
291 | + no_in_arr.splice(index, 1) | |
292 | + } | |
296 | 293 | } |
297 | 294 | } |
295 | + aprice += be * aprice; | |
298 | 296 | } |
299 | - } else { | |
297 | + } else { | |
300 | 298 | var vv = zhqty_bz[0]; |
301 | 299 | var bz_num = be * vv.zhqty; //超量倍增 |
302 | 300 | var num = vv['num'] - vv.zhqty; //购买数量减去超量 |
... | ... | @@ -310,14 +308,11 @@ module.exports = { |
310 | 308 | // be=be-bz_num_ok; |
311 | 309 | if (num % vv.zhqty == 0) { |
312 | 310 | be = num / vv.zhqty; |
313 | - // bz_num_ok = num; | |
314 | 311 | } else { |
315 | 312 | be = Math.floor(num / vv.zhqty) |
316 | - // bz_num_ok = num - (be * vv.zhqty); | |
317 | 313 | } |
318 | 314 | bz_num_ok = be * vv.zhqty; |
319 | 315 | } |
320 | - // be=vv.num; | |
321 | 316 | for (let j = 0; j < bz_num_ok; j++) { |
322 | 317 | let index = no_in_arr.findIndex(i => { |
323 | 318 | return vv.goods_id === i.goods_id |
... | ... | @@ -496,7 +491,22 @@ module.exports = { |
496 | 491 | } |
497 | 492 | } |
498 | 493 | return dest; |
499 | - } | |
494 | + }, | |
495 | + | |
496 | + zhqty_bz_fun(zhqty_bz,be,zhqty_bz_arr){ | |
497 | + let zhqty_bz_flag =true; | |
498 | + for(let i=0;i<zhqty_bz.length;i++){ | |
499 | + let item=zhqty_bz[i]; | |
500 | + let bz_num = be * item['zhqty']; //超量倍增 | |
501 | + let num = item['num'] - item['zhqty']; //购买数量减去超量 | |
502 | + if (bz_num > num) { | |
503 | + zhqty_bz_flag=false; | |
504 | + zhqty_bz_arr.push(item); | |
505 | + // zhqty_bz.splice(i,1) | |
506 | + } | |
507 | + } | |
508 | + return zhqty_bz_flag; | |
509 | + } | |
500 | 510 | |
501 | 511 | |
502 | 512 | } |
503 | 513 | \ No newline at end of file | ... | ... |
pages/cart/cart2/cart2.js
... | ... | @@ -1001,9 +1001,9 @@ Page({ |
1001 | 1001 | |
1002 | 1002 | //-- 搭配促销的门店配送方式的修复 -- |
1003 | 1003 | et = 1; |
1004 | - distr_t = 0; | |
1004 | + distr_t = 0; // 配送方式 0=用户自选 1=自提 2=物流 | |
1005 | 1005 | for (var hi in narr) { |
1006 | - var dis_t = narr[hi].distr_type; | |
1006 | + var dis_t = narr[hi].distr_type; | |
1007 | 1007 | if (dis_t == 2) { |
1008 | 1008 | th.setData({is_all_zt: 0}); |
1009 | 1009 | et = 0; |
... | ... | @@ -1012,10 +1012,9 @@ Page({ |
1012 | 1012 | distr_t = dis_t; |
1013 | 1013 | } |
1014 | 1014 | } |
1015 | - | |
1016 | 1015 | //自选的时候,系统配置了默认的配送方式是物流的时候 |
1017 | 1016 | if (distr_t == 0 && th.data.json_d.pickupway && th.data.json_d.pickupway == 1) { |
1018 | - et = 0; | |
1017 | + et = 2; | |
1019 | 1018 | } |
1020 | 1019 | |
1021 | 1020 | |
... | ... | @@ -1484,13 +1483,11 @@ Page({ |
1484 | 1483 | o_price += item[j].goods_price * item[j].goods_num; |
1485 | 1484 | |
1486 | 1485 | //判断是否有设置限制重量包邮,先看商品有没有包邮 |
1487 | - if(item[j]['is_past']!==1 && weight_free){ | |
1488 | - if( item[j]['exp_sum_type']==2 ){ | |
1489 | - if (goods_weight < 0) goods_weight = 0; | |
1490 | - //累积商品重量 每种商品的重量 * 数量 | |
1491 | - goods_weight += item[j]['weight'] * item[j]['goods_num']; | |
1492 | - out_of_weight = (weight_free*1000) - goods_weight; | |
1493 | - } | |
1486 | + if(item[j]['is_past']!==1 && item[j]['exp_sum_type']==2 && weight_free>0){ | |
1487 | + if (goods_weight < 0) goods_weight = 0; | |
1488 | + //累积商品重量 每种商品的重量 * 数量 | |
1489 | + goods_weight += item[j]['weight'] * item[j]['goods_num']; | |
1490 | + out_of_weight = (weight_free*1000) - goods_weight; | |
1494 | 1491 | } |
1495 | 1492 | } |
1496 | 1493 | //判断是不是有组合购的金额 |
... | ... | @@ -1666,7 +1663,7 @@ Page({ |
1666 | 1663 | o_shipping_price += item[j]['uniform_exp_sum']; |
1667 | 1664 | break; |
1668 | 1665 | // case 2: //1464行已计算 不必重复计算 注释为:判断是否有设置限制重量包邮 |
1669 | - // +'' | |
1666 | + // +'' | |
1670 | 1667 | // if (goods_weight < 0) goods_weight = 0; |
1671 | 1668 | // //累积商品重量 每种商品的重量 * 数量 |
1672 | 1669 | // goods_weight += item[j]['weight'] * item[j]['goods_num']; |
... | ... | @@ -1679,12 +1676,14 @@ Page({ |
1679 | 1676 | break; |
1680 | 1677 | } |
1681 | 1678 | } |
1682 | - | |
1683 | 1679 | }else{ |
1684 | - if(goods_weight && out_of_weight !==0){ | |
1685 | - goods_weight=-1; | |
1686 | - out_of_weight=0; | |
1680 | + if(item[j]['exp_sum_type']==2){ | |
1681 | + if(out_of_weight !==0){ | |
1682 | + goods_weight=-1; | |
1683 | + out_of_weight=0; | |
1684 | + } | |
1687 | 1685 | } |
1686 | + | |
1688 | 1687 | } |
1689 | 1688 | } |
1690 | 1689 | |
... | ... | @@ -1999,7 +1998,9 @@ Page({ |
1999 | 1998 | //dw |
2000 | 1999 | //累积商品重量 每种商品的重量 * 数量 |
2001 | 2000 | goods_weight += good['weight'] * good['buynum']; |
2002 | - out_of_weight = (weight_free * 1000 ) - goods_weight; | |
2001 | + if(weight_free > 0){ | |
2002 | + out_of_weight = (weight_free * 1000 ) - goods_weight; | |
2003 | + } | |
2003 | 2004 | break; |
2004 | 2005 | case 3: |
2005 | 2006 | if (goods_piece < 0) goods_piece = 0; |
... | ... | @@ -2253,6 +2254,7 @@ Page({ |
2253 | 2254 | this.data.is_summit_ing = 1; |
2254 | 2255 | var th = this, pdata = new Array(); |
2255 | 2256 | var ff = true; |
2257 | + | |
2256 | 2258 | //------------立即购买------------- |
2257 | 2259 | if (th.data.is_b_now == 1 && th.data.bn_goods.prom_type != 5) { |
2258 | 2260 | if (th.data.bn_exp_type == 0 && th.data.user_addr == null) { |
... | ... | @@ -2263,14 +2265,13 @@ Page({ |
2263 | 2265 | if (!ff) return false; |
2264 | 2266 | var addr = th.data.user_addr; |
2265 | 2267 | if (th.data.bn_exp_type == 1) addr = null; |
2266 | - | |
2267 | 2268 | if (th.data.bn_exp_type == 0) |
2268 | 2269 | if (th.data.wu_arr == null || th.data.wu_arr.length <= 0) { |
2269 | 2270 | getApp().my_warnning("读取物流失败", 0, th); |
2270 | 2271 | th.data.is_summit_ing = 0; |
2271 | 2272 | return false; |
2272 | 2273 | } |
2273 | - | |
2274 | + | |
2274 | 2275 | var item = { |
2275 | 2276 | 'user_id': to.globalData.user_id, |
2276 | 2277 | 'consignee': addr == null ? "" : addr.consignee, |
... | ... | @@ -2490,6 +2491,7 @@ Page({ |
2490 | 2491 | } |
2491 | 2492 | pdata.push(item); |
2492 | 2493 | } else { |
2494 | + | |
2493 | 2495 | //---------购物车的结算--------- |
2494 | 2496 | if (th.data.is_all_zt == 0 && th.data.user_addr == null) { |
2495 | 2497 | th.data.is_summit_ing = 0; |
... | ... | @@ -2499,6 +2501,7 @@ Page({ |
2499 | 2501 | if (!ff) return false; |
2500 | 2502 | |
2501 | 2503 | var addr = th.data.user_addr; |
2504 | + // 自提,地址数据清空 exp_type设置为1 | |
2502 | 2505 | if (th.data.is_all_zt == 1) addr = null; |
2503 | 2506 | var val_arr = th.data.user_note; |
2504 | 2507 | |
... | ... | @@ -2509,8 +2512,8 @@ Page({ |
2509 | 2512 | return false; |
2510 | 2513 | } |
2511 | 2514 | |
2512 | - var order_prom_list_cart = th.data.order_prom_list_cart; | |
2513 | - | |
2515 | + var order_prom_list_cart = th.data.order_prom_list_cart;; | |
2516 | + console.log('xxxxxxxxxxxxxxxx', order_prom_list_cart) | |
2514 | 2517 | //--组装推送数据-- |
2515 | 2518 | for (var i = 0; i < order_prom_list_cart.length; i++) { |
2516 | 2519 | var t_item = order_prom_list_cart[i]; |
... | ... | @@ -2738,7 +2741,7 @@ Page({ |
2738 | 2741 | |
2739 | 2742 | |
2740 | 2743 | } |
2741 | - | |
2744 | + | |
2742 | 2745 | if (pdata.length == 0) return; |
2743 | 2746 | var str = JSON.stringify(pdata); |
2744 | 2747 | |
... | ... | @@ -3055,7 +3058,7 @@ Page({ |
3055 | 3058 | item = item.config; |
3056 | 3059 | if (item == null) return o_shipping_price; |
3057 | 3060 | //------按重量---------- |
3058 | - if (goods_weight >= 0 && item['money'] && out_of_weight > 0) { | |
3061 | + if (goods_weight >= 0 && item['money']) { | |
3059 | 3062 | fw_price = parseFloat(item['money']); |
3060 | 3063 | if (goods_weight > item['first_weight']) { |
3061 | 3064 | var fw = goods_weight - item['first_weight']; |
... | ... | @@ -3064,11 +3067,9 @@ Page({ |
3064 | 3067 | } |
3065 | 3068 | } |
3066 | 3069 | //------超出重量---------- |
3067 | - if(out_of_weight < 0){ | |
3070 | + if(out_of_weight < 0 && o_price >= freight_free){ | |
3068 | 3071 | fw_price = parseFloat(item['money']); |
3069 | 3072 | var out_of_weight = Math.abs(out_of_weight); |
3070 | - // var n = Math.ceil(out_of_weight / item['second_weight']) | |
3071 | - // fw_price = fw_price + n * parseFloat(item['add_money']); | |
3072 | 3073 | if (out_of_weight > item['first_weight']) { |
3073 | 3074 | var fw = out_of_weight - item['first_weight']; |
3074 | 3075 | var n = Math.ceil(fw / item['second_weight']) |
... | ... | @@ -3985,7 +3986,7 @@ Page({ |
3985 | 3986 | }, |
3986 | 3987 | |
3987 | 3988 | //计算立即购买赠品的物流费用 |
3988 | - get_now_gift_goods_wuliu: function (code, o_shipping_price, user_addr, gift_freight_free,gift_weight_free, allpice, rs, shipping_price, no_by_data, goods_weight1, goods_piece1) { | |
3989 | + get_now_gift_goods_wuliu: function (code, o_shipping_price, user_addr, gift_freight_free,out_of_weight, allpice, rs, shipping_price, no_by_data, goods_weight1, goods_piece1) { | |
3989 | 3990 | var good = this.data.buy_now_gift_goods; |
3990 | 3991 | var goods_weight = -1, goods_piece = -1; |
3991 | 3992 | var gift_shipping_price = 0; | ... | ... |
pages/cart/cart2/zh_calculate.js
... | ... | @@ -152,15 +152,7 @@ module.exports = { |
152 | 152 | if (act.is_bzyh && zhqty_bz.length > 0) { |
153 | 153 | if (zhqty_bz.length > 1) { |
154 | 154 | let zhqty_bz_arr = []; |
155 | - let zhqty_bz_flag = zhqty_bz.every((item1, i) => { | |
156 | - var bz_num = be * item1['zhqty']; //超量倍增 | |
157 | - var num = item1['num'] - item1['zhqty']; //购买数量减去超量 | |
158 | - if (bz_num > num) { | |
159 | - zhqty_bz_arr.push(item1); | |
160 | - zhqty_bz.splice(i, 1) | |
161 | - } | |
162 | - return bz_num <= num; | |
163 | - }) | |
155 | + let zhqty_bz_flag=this.zhqty_bz_fun(zhqty_bz,be,zhqty_bz_arr); | |
164 | 156 | if (zhqty_bz_flag) { |
165 | 157 | for (let i = 0; i < zhqty_bz.length; i++) { |
166 | 158 | var vv = zhqty_bz[i]; |
... | ... | @@ -175,11 +167,12 @@ module.exports = { |
175 | 167 | } |
176 | 168 | } |
177 | 169 | } else { |
170 | + zhqty_len=1; | |
178 | 171 | let min_bz_num = Math.min.apply(Math, zhqty_bz_arr.map(function (o) { |
179 | - return o['num'] | |
172 | + return o['num']; | |
180 | 173 | })); |
181 | 174 | let new_arr = zhqty_bz_arr.filter(ii => { |
182 | - return ii['num'] == min_bz_num | |
175 | + return ii['num'] == min_bz_num; | |
183 | 176 | }) |
184 | 177 | var vv = new_arr[0]; |
185 | 178 | var bz_num = be * new_arr[0].zhqty; //超量倍增 |
... | ... | @@ -198,18 +191,22 @@ module.exports = { |
198 | 191 | } |
199 | 192 | bz_num_ok = be * vv.zhqty; |
200 | 193 | } |
201 | - | |
202 | - for (let j = 0; j < bz_num_ok; j++) { | |
203 | - let index = no_in_arr.findIndex(i => { | |
204 | - return vv.goods_id === i.goods_id | |
205 | - }) | |
206 | - if (index > -1) { | |
207 | - delete_num++ | |
208 | - no_in_arr.splice(index, 1) | |
194 | + | |
195 | + for(let i = 0; i < zhqty_bz.length; i++){ | |
196 | + let item1=zhqty_bz[i]; | |
197 | + for (let j = 0; j < be * item1['zhqty']; j++) { | |
198 | + let index = no_in_arr.findIndex(i => { | |
199 | + return item1.goods_id === i.goods_id | |
200 | + }) | |
201 | + if (index > -1) { | |
202 | + // delete_num++ | |
203 | + no_in_arr.splice(index, 1) | |
204 | + } | |
209 | 205 | } |
210 | 206 | } |
207 | + aprice += be * aprice; | |
211 | 208 | } |
212 | - } else { | |
209 | + } else { | |
213 | 210 | var vv = zhqty_bz[0]; |
214 | 211 | var bz_num = be * vv.zhqty; //超量倍增 |
215 | 212 | var num = vv['num'] - vv.zhqty; //购买数量减去超量 |
... | ... | @@ -223,19 +220,16 @@ module.exports = { |
223 | 220 | // be=be-bz_num_ok; |
224 | 221 | if (num % vv.zhqty == 0) { |
225 | 222 | be = num / vv.zhqty; |
226 | - // bz_num_ok = num; | |
227 | 223 | } else { |
228 | 224 | be = Math.floor(num / vv.zhqty) |
229 | - // bz_num_ok = num - (be * vv.zhqty); | |
230 | 225 | } |
231 | 226 | bz_num_ok = be * vv.zhqty; |
232 | 227 | } |
233 | - // be=vv.num; | |
234 | 228 | for (let j = 0; j < bz_num_ok; j++) { |
235 | 229 | let index = no_in_arr.findIndex(i => { |
236 | 230 | return vv.goods_id === i.goods_id |
237 | 231 | }) |
238 | - if(index > -1){ | |
232 | + if (index > -1) { | |
239 | 233 | delete_num++ |
240 | 234 | no_in_arr.splice(index, 1) |
241 | 235 | } |
... | ... | @@ -515,6 +509,20 @@ module.exports = { |
515 | 509 | } |
516 | 510 | |
517 | 511 | |
512 | + }, | |
513 | + zhqty_bz_fun(zhqty_bz,be,zhqty_bz_arr){ | |
514 | + let zhqty_bz_flag =true; | |
515 | + for(let i=0;i<zhqty_bz.length;i++){ | |
516 | + let item=zhqty_bz[i]; | |
517 | + let bz_num = be * item['zhqty']; //超量倍增 | |
518 | + let num = item['num'] - item['zhqty']; //购买数量减去超量 | |
519 | + if (bz_num > num) { | |
520 | + zhqty_bz_flag=false; | |
521 | + zhqty_bz_arr.push(item); | |
522 | + // zhqty_bz.splice(i,1) | |
523 | + } | |
524 | + } | |
525 | + return zhqty_bz_flag; | |
518 | 526 | } |
519 | 527 | |
520 | 528 | ... | ... |
pages/cart/cart2_inte/cart2_inte.js
... | ... | @@ -442,6 +442,9 @@ Page({ |
442 | 442 | to.getwuliuprice(async function (rs) { |
443 | 443 | |
444 | 444 | var o_shipping_price = 0, goods_weight = -1, goods_piece = -1; |
445 | + var out_of_weight=null; //超出多少重量 | |
446 | + var freight_free = ee.freight_free; //全场满多少包邮 | |
447 | + var weight_free = ee.weight_free; //多少kg内包邮 | |
445 | 448 | //-----------当地址不为空,且是物流时,计算物流费用,并同时商品不是优惠活动的包邮---------- |
446 | 449 | if (th.data.user_addr != null && th.data.bn_exp_type == 0 && good.is_free_shipping == 0 && good.is_past!=1 ){ |
447 | 450 | |
... | ... | @@ -452,7 +455,11 @@ Page({ |
452 | 455 | case 2: |
453 | 456 | if (goods_weight < 0) goods_weight = 0; |
454 | 457 | //累积商品重量 每种商品的重量 * 数量 |
455 | - goods_weight += good['weight'] * good['buynum'];break; | |
458 | + goods_weight += good['weight'] * good['buynum']; | |
459 | + if(weight_free > 0){ | |
460 | + out_of_weight = (weight_free * 1000 ) - goods_weight; | |
461 | + } | |
462 | + break; | |
456 | 463 | case 3: |
457 | 464 | if (goods_piece < 0) goods_piece = 0; |
458 | 465 | //累积商品数量 |
... | ... | @@ -461,8 +468,7 @@ Page({ |
461 | 468 | |
462 | 469 | var code =""; |
463 | 470 | if(th.data.wu_arr && th.data.wu_arr[th.data.index]) code=th.data.wu_arr[th.data.index].code; |
464 | - var freight_free = ee.freight_free; //全场满多少包邮 | |
465 | - var no_ex_id=ee.no_ex_id; | |
471 | + var no_ex_id=ee.no_ex_id; | |
466 | 472 | th.data.is_no_by[th.data.bn_pick]=0; |
467 | 473 | |
468 | 474 | var no_by_data=null; |
... | ... | @@ -496,7 +502,7 @@ Page({ |
496 | 502 | th.data.is_by[th.data.bn_pick]=0; |
497 | 503 | //--------------开始计算物流------------------ |
498 | 504 | var shipping_price= |
499 | - th.calculatewuliu(code, o_shipping_price, goods_weight, | |
505 | + th.calculatewuliu(code, o_shipping_price, goods_weight,out_of_weight, | |
500 | 506 | goods_piece, th.data.user_addr, freight_free, allpice-cut_price, rs); |
501 | 507 | if(shipping_price<=0){ |
502 | 508 | th.data.is_by[th.data.bn_pick]=1; //已经是包邮了,就不要选择包邮券 |
... | ... | @@ -919,12 +925,12 @@ Page({ |
919 | 925 | th.calculatePrice(); |
920 | 926 | }, |
921 | 927 | //-------------------计算物流--------------- |
922 | - calculatewuliu:function(code, o_shipping_price, goods_weight, | |
928 | + calculatewuliu:function(code, o_shipping_price, goods_weight,out_of_weight, | |
923 | 929 | goods_piece,user_addr, freight_free, o_price, rs){ |
924 | 930 | var price =0,th=this; |
925 | 931 | price +=parseFloat(o_shipping_price); |
926 | 932 | //如果是包邮 |
927 | - if (freight_free > 0 && o_price >= freight_free){ return 0;} | |
933 | + if (freight_free > 0 && o_price >= freight_free && out_of_weight>=0){ return 0;} | |
928 | 934 | if (user_addr==null) { return 0; } |
929 | 935 | //计算物流的config item; |
930 | 936 | var item=null; |
... | ... | @@ -938,7 +944,7 @@ Page({ |
938 | 944 | item=item.config; |
939 | 945 | if (item == null) return o_shipping_price; |
940 | 946 | //------按重量---------- |
941 | - if (goods_weight>=0 && item['money']) { | |
947 | + if (goods_weight >= 0 && item['money']) { | |
942 | 948 | fw_price =parseFloat(item['money']); |
943 | 949 | if (goods_weight > item['first_weight']){ |
944 | 950 | var fw = goods_weight - item['first_weight']; |
... | ... | @@ -946,6 +952,16 @@ Page({ |
946 | 952 | fw_price = fw_price + n * parseFloat(item['add_money']); |
947 | 953 | } |
948 | 954 | } |
955 | + //------超出重量---------- | |
956 | + if(out_of_weight < 0 && o_price >= freight_free){ | |
957 | + fw_price = parseFloat(item['money']); | |
958 | + var out_of_weight = Math.abs(out_of_weight); | |
959 | + if (out_of_weight > item['first_weight']) { | |
960 | + var fw = out_of_weight - item['first_weight']; | |
961 | + var n = Math.ceil(fw / item['second_weight']) | |
962 | + fw_price = fw_price + n * parseFloat(item['add_money']); | |
963 | + } | |
964 | + } | |
949 | 965 | //------按件数---------- |
950 | 966 | if (goods_piece > 0 && item['piecemoney']) { |
951 | 967 | fp_price = parseFloat(item['piecemoney']); | ... | ... |
pages/cart/cart2_pt/cart2_pt.js
... | ... | @@ -395,7 +395,6 @@ Page({ |
395 | 395 | }, |
396 | 396 | //---------计算立即购买---------- |
397 | 397 | calculatePrice2: function () { |
398 | - console.log('calculatePrice2'); | |
399 | 398 | var th = this, good = this.data.bn_goods; |
400 | 399 | //-----------计算商品总价-------------- |
401 | 400 | var allpice = good.shop_price * good.buynum; |
... | ... | @@ -408,7 +407,10 @@ Page({ |
408 | 407 | to.getwuliuprice(function (rs) { |
409 | 408 | console.log('calculatePrice2222'); |
410 | 409 | console.log(rs); |
411 | - var o_shipping_price = 0, goods_weight = -1, goods_piece = -1; | |
410 | + var o_shipping_price = 0,goods_weight = -1,goods_piece = -1; | |
411 | + var out_of_weight=null; //超出多少重量 | |
412 | + var freight_free = ee.freight_free; //全场满多少包邮 | |
413 | + var weight_free = ee.weight_free; //多少kg内包邮 | |
412 | 414 | //-----------当地址不为空,且是物流时,计算物流费用,同时阶梯团不计算拼团价格---------- |
413 | 415 | if (th.data.user_addr != null && th.data.bn_exp_type == 0 && good.is_free_shipping == 0 && (th.data.kt_type!=3 || th.data.bn_goods.is_normal==1) ){ |
414 | 416 | switch (good['exp_sum_type']) { |
... | ... | @@ -418,7 +420,12 @@ Page({ |
418 | 420 | case 2: |
419 | 421 | if (goods_weight < 0) goods_weight = 0; |
420 | 422 | //累积商品重量 每种商品的重量 * 数量 |
421 | - goods_weight += good['weight'] * good['buynum'];break; | |
423 | + goods_weight += good['weight'] * good['buynum']; | |
424 | + if(weight_free > 0){ | |
425 | + out_of_weight = (weight_free * 1000 ) - goods_weight; | |
426 | + } | |
427 | + break; | |
428 | + // goods_weight += good['weight'] * good['buynum'];break; | |
422 | 429 | case 3: |
423 | 430 | if (goods_piece < 0) goods_piece = 0; |
424 | 431 | //累积商品数量 |
... | ... | @@ -430,7 +437,7 @@ Page({ |
430 | 437 | var code = th.data.wu_arr[th.data.index].code; |
431 | 438 | var freight_free = ee.freight_free; //全场满多少包邮 |
432 | 439 | var shipping_price= |
433 | - th.calculatewuliu(code, o_shipping_price, goods_weight, | |
440 | + th.calculatewuliu(code, o_shipping_price, goods_weight,out_of_weight, | |
434 | 441 | goods_piece, th.data.user_addr, freight_free, allpice, rs); |
435 | 442 | |
436 | 443 | shipping_price = parseFloat(shipping_price).toFixed(2); |
... | ... | @@ -586,6 +593,7 @@ Page({ |
586 | 593 | }) |
587 | 594 | } |
588 | 595 | |
596 | + | |
589 | 597 | //--商品的房间号-- |
590 | 598 | if(gg.room_id && gg.room_id>0){ |
591 | 599 | item.room_ids=gg.room_id; |
... | ... | @@ -774,12 +782,12 @@ Page({ |
774 | 782 | }, |
775 | 783 | |
776 | 784 | //-------------------计算物流--------------- |
777 | - calculatewuliu:function(code, o_shipping_price, goods_weight, | |
785 | + calculatewuliu:function(code, o_shipping_price, goods_weight,out_of_weight, | |
778 | 786 | goods_piece,user_addr, freight_free, o_price, rs){ |
779 | 787 | var price =0,th=this; |
780 | 788 | price +=parseFloat(o_shipping_price); |
781 | 789 | //如果是包邮 |
782 | - if (freight_free > 0 && o_price >= freight_free){ return 0;} | |
790 | + if (freight_free > 0 && o_price >= freight_free && out_of_weight>=0){ return 0;} | |
783 | 791 | if (user_addr==null) { return 0; } |
784 | 792 | //计算物流的config item; |
785 | 793 | var item=null; |
... | ... | @@ -793,7 +801,7 @@ Page({ |
793 | 801 | item=item.config; |
794 | 802 | if (item == null) return o_shipping_price; |
795 | 803 | //------按重量---------- |
796 | - if (goods_weight>=0) { | |
804 | + if (goods_weight >= 0 && item['money']) { | |
797 | 805 | fw_price =parseFloat(item['money']); |
798 | 806 | if (goods_weight > item['first_weight']){ |
799 | 807 | var fw = goods_weight - item['first_weight']; |
... | ... | @@ -801,8 +809,18 @@ Page({ |
801 | 809 | fw_price = fw_price + n * parseFloat(item['add_money']); |
802 | 810 | } |
803 | 811 | } |
812 | + //------超出重量---------- | |
813 | + if(out_of_weight < 0 && o_price >= freight_free){ | |
814 | + fw_price = parseFloat(item['money']); | |
815 | + var out_of_weight = Math.abs(out_of_weight); | |
816 | + if (out_of_weight > item['first_weight']) { | |
817 | + var fw = out_of_weight - item['first_weight']; | |
818 | + var n = Math.ceil(fw / item['second_weight']) | |
819 | + fw_price = fw_price + n * parseFloat(item['add_money']); | |
820 | + } | |
821 | + } | |
804 | 822 | //------按件数---------- |
805 | - if (goods_piece > 0) { | |
823 | + if (goods_piece > 0 ) { | |
806 | 824 | fp_price = parseFloat(item['piecemoney']); |
807 | 825 | if (goods_piece > item['first_piece']) { |
808 | 826 | var fp = goods_piece - item['first_piece']; | ... | ... |
pages/cart/cart_wk/cart_wk.js
... | ... | @@ -420,10 +420,10 @@ Page({ |
420 | 420 | var to = getApp(), th = this; |
421 | 421 | to.getConfig2(function (ee) { |
422 | 422 | to.getwuliuprice(function (rs) { |
423 | - var o_shipping_price = 0, | |
424 | - goods_weight = -1, | |
425 | - goods_piece = -1, | |
426 | - good = th.data.goods; | |
423 | + var o_shipping_price = 0,goods_weight = -1,goods_piece = -1,good=th.data.goods; | |
424 | + var out_of_weight=null; //超出多少重量 | |
425 | + var freight_free = ee.freight_free; //全场满多少包邮 | |
426 | + var weight_free = ee.weight_free; //多少kg内包邮 | |
427 | 427 | //-----------当地址不为空,且是物流时,计算物流费用---------- |
428 | 428 | if (th.data.user_addr != null && th.data.exp_type == 0 && good.is_free_shipping == 0) { |
429 | 429 | switch (good['exp_sum_type']) { |
... | ... | @@ -435,6 +435,9 @@ Page({ |
435 | 435 | if (goods_weight < 0) goods_weight = 0; |
436 | 436 | //累积商品重量 每种商品的重量 * 数量 |
437 | 437 | goods_weight += good['weight'] * th.data.order.order_goods['goods_num']; |
438 | + if(weight_free > 0){ | |
439 | + out_of_weight = (weight_free * 1000 ) - goods_weight; | |
440 | + } | |
438 | 441 | break; |
439 | 442 | case 3: |
440 | 443 | if (goods_piece < 0) goods_piece = 0; |
... | ... | @@ -443,7 +446,6 @@ Page({ |
443 | 446 | break; |
444 | 447 | } |
445 | 448 | var code = th.data.wu_arr[th.data.index].code; |
446 | - var freight_free = ee.freight_free; //全场满多少包邮 | |
447 | 449 | //--全部金额-- |
448 | 450 | var allpice = th.data.order.order_amount + th.data.order.user_money + th.data.order.pt_tail_money; |
449 | 451 | var shipping_price = |
... | ... | @@ -470,7 +472,7 @@ Page({ |
470 | 472 | var price = 0, th = this; |
471 | 473 | price += parseFloat(o_shipping_price); |
472 | 474 | //如果是包邮 |
473 | - if (freight_free > 0 && o_price >= freight_free) { return 0; } | |
475 | + if (freight_free > 0 && o_price >= freight_free && out_of_weight>=0) { return 0; } | |
474 | 476 | if (user_addr == null) { return 0; } |
475 | 477 | //计算物流的config item; |
476 | 478 | var item = null; |
... | ... | @@ -484,7 +486,7 @@ Page({ |
484 | 486 | item = item.config; |
485 | 487 | if (item == null) return o_shipping_price; |
486 | 488 | //------按重量---------- |
487 | - if (goods_weight > 0) { | |
489 | + if (goods_weight >= 0 && item['money']) { | |
488 | 490 | fw_price = parseFloat(item['money']); |
489 | 491 | if (goods_weight > item['first_weight']) { |
490 | 492 | var fw = goods_weight - item['first_weight']; |
... | ... | @@ -492,6 +494,16 @@ Page({ |
492 | 494 | fw_price = fw_price + n * parseFloat(item['add_money']); |
493 | 495 | } |
494 | 496 | } |
497 | + //------超出重量---------- | |
498 | + if(out_of_weight < 0 && o_price >= freight_free){ | |
499 | + fw_price = parseFloat(item['money']); | |
500 | + var out_of_weight = Math.abs(out_of_weight); | |
501 | + if (out_of_weight > item['first_weight']) { | |
502 | + var fw = out_of_weight - item['first_weight']; | |
503 | + var n = Math.ceil(fw / item['second_weight']) | |
504 | + fw_price = fw_price + n * parseFloat(item['add_money']); | |
505 | + } | |
506 | + } | |
495 | 507 | //------按件数---------- |
496 | 508 | if (goods_piece > 0) { |
497 | 509 | fp_price = parseFloat(item['piecemoney']); | ... | ... |
pages/team/team_show/team_show.js
... | ... | @@ -94,18 +94,29 @@ Page({ |
94 | 94 | |
95 | 95 | }, |
96 | 96 | onLoad: function(options) { |
97 | - | |
98 | 97 | wx.setNavigationBarTitle({ title: "拼团订单",}) |
99 | 98 | //var postdata=getApp().globalData.to_group; |
100 | 99 | var postdata=options; |
101 | - var tg_id = postdata.tg_id, first_leader=options.first_leader; | |
100 | + var tg_id = postdata.tg_id, first_leader=options.first_leader,goods_id=options.goods_id; | |
102 | 101 | //如果tg_id是空的话 |
103 | - if(tg_id==undefined || tg_id==null || tg_id==""){ | |
102 | + if(tg_id==null ||goods_id==null){ | |
104 | 103 | var tg_id_str=decodeURIComponent(postdata.scene); |
105 | 104 | tg_id_str=tg_id_str.split("_"); |
106 | - tg_id=tg_id_str[0]; | |
107 | - if(tg_id_str.length>1){ | |
108 | - first_leader=tg_id_str[1]; | |
105 | + console.log(tg_id_str.length); | |
106 | + //tg_id_str[0] teamgroup.id tg_id_str[1] user_id tg_id_str[2] goods_id | |
107 | + switch(tg_id_str.length){ | |
108 | + case 1: | |
109 | + tg_id=tg_id_str[0]; | |
110 | + break; | |
111 | + case 2: | |
112 | + tg_id=tg_id_str[0]; | |
113 | + first_leader=tg_id_str[1]; | |
114 | + break; | |
115 | + case 3: | |
116 | + tg_id=tg_id_str[0]; | |
117 | + first_leader=tg_id_str[1]; | |
118 | + goods_id=tg_id_str[2]; | |
119 | + break; | |
109 | 120 | } |
110 | 121 | } |
111 | 122 | //--判断一下是不是导购-- |
... | ... | @@ -118,14 +129,13 @@ Page({ |
118 | 129 | } |
119 | 130 | }) |
120 | 131 | } |
121 | - | |
122 | - this.setData({tg_id: tg_id }); | |
132 | + this.setData({tg_id: tg_id,goods_id}); | |
123 | 133 | getApp().globalData.to_group=null; |
124 | 134 | |
125 | - var th=this; | |
126 | - getApp().getConfig2(function(e) { | |
127 | - th.setData({ bconfig: e,}); | |
128 | - th.wait_for_store_config(); //获取默认的门店 | |
135 | + var th=this; | |
136 | + getApp().getConfig2(function(e) { | |
137 | + th.setData({ bconfig: e,}); | |
138 | + th.wait_for_store_config(); //获取默认的门店 | |
129 | 139 | }) |
130 | 140 | |
131 | 141 | }, |
... | ... | @@ -358,17 +368,47 @@ Page({ |
358 | 368 | max_num = 0, |
359 | 369 | min_price = 0, |
360 | 370 | th=this, |
361 | - that=th; | |
371 | + that=th, | |
372 | + flag=null; | |
373 | + await getApp().request.promiseGet("/api/weshop/teamlist/pageteam/2",{ | |
374 | + data:{ | |
375 | + store_id: os.stoid, | |
376 | + is_end: 0, | |
377 | + is_show: 1, | |
378 | + user_id: getApp().globalData.user_id, | |
379 | + pageSize:1000 | |
380 | + } | |
381 | + }).then(res=>{ | |
382 | + let pd_list=res.data.data.pageData; | |
383 | + if(res.data.code==0 && pd_list.length>0){ | |
384 | + flag =pd_list.some(pd=>{ | |
385 | + // if(th.data.goods_id){ | |
386 | + return pd.goods_id==th.data.goods_id; | |
387 | + // } | |
388 | + }) | |
389 | + } | |
390 | + }) | |
391 | + if(!flag){ | |
392 | + wx.showToast({title: "当前会员身份不符,无法参与", icon: 'none', duration: 3000}); | |
393 | + setTimeout(function () { | |
394 | + ut.wx_back(); | |
395 | + }, 1000) | |
396 | + return false; | |
397 | + } | |
362 | 398 | |
363 | 399 | //获取活动从表信息team_id,listno团编号(券号) |
364 | 400 | await getApp().request.promiseGet("/api/weshop/teamgroup/get/"+os.stoid+"/"+tg_id, { |
365 | 401 | }).then(res => { |
402 | + | |
403 | + if(res.data.code !=0 ){ | |
404 | + getApp().showWarning(res.data.msg); | |
405 | + th.go_back(); | |
406 | + return false; | |
407 | + } | |
366 | 408 | |
367 | - | |
368 | - if(res.data.code==0 && res.data && res.data.data ) { | |
409 | + if(res.data && res.data.data ) { | |
369 | 410 | |
370 | 411 | teamgroup = res.data.data; |
371 | - | |
372 | 412 | //获取当前时间,并且判断剩余时间 |
373 | 413 | var nt = ut.gettimestamp(); |
374 | 414 | var buy_start_date = ut.formatTime(teamgroup.buy_start_date, "yyyy-MM-dd hh:mm:ss"); |
... | ... | @@ -388,7 +428,6 @@ Page({ |
388 | 428 | } |
389 | 429 | |
390 | 430 | } |
391 | - | |
392 | 431 | }) |
393 | 432 | |
394 | 433 | //判断是不是要继续的开关 |
... | ... | @@ -433,36 +472,10 @@ Page({ |
433 | 472 | //获取活动表的信息根据活动team_id |
434 | 473 | await getApp().request.promiseGet("/api/weshop/teamlist/get/" + os.stoid + "/" + teamgroup.team_id, { |
435 | 474 | data: {} |
436 | - }).then(async res => { | |
437 | - var flag=null; | |
475 | + }).then(res => { | |
438 | 476 | if (res.data.code == 0) { |
439 | 477 | teamlist = res.data.data; |
440 | 478 | goods_id = res.data.data.goods_id; |
441 | - | |
442 | - await getApp().request.promiseGet("/api/weshop/teamlist/pageteam/1",{ | |
443 | - data:{ | |
444 | - store_id: os.stoid, | |
445 | - is_end: 0, | |
446 | - is_show: 1, | |
447 | - user_id: getApp().globalData.user_id, | |
448 | - pageSize:1000 | |
449 | - } | |
450 | - }).then(res=>{ | |
451 | - let pd_list=res.data.data.pageData; | |
452 | - if(res.data.code==0 && pd_list.length>0){ | |
453 | - flag =pd_list.some(pd=>{ | |
454 | - return pd.goods_id==teamlist['goods_id'] | |
455 | - }) | |
456 | - } | |
457 | - }) | |
458 | - if(!flag){ | |
459 | - wx.showToast({title: "当前会员身份不符,无法参与", icon: 'none', duration: 3000}); | |
460 | - // setTimeout(function () { | |
461 | - ut.wx_back(); | |
462 | - // }, 2000) | |
463 | - return false; | |
464 | - } | |
465 | - | |
466 | 479 | //----------查看阶梯团------------ |
467 | 480 | if (teamlist.ct_rylist != "" && teamlist.ct_rylist != null && teamlist.ct_rylist != undefined) { |
468 | 481 | var ct_rylist = JSON.parse(teamlist.ct_rylist); | ... | ... |
pages/team/team_success/team_success.js
... | ... | @@ -398,19 +398,26 @@ Page({ |
398 | 398 | var app = getApp(); |
399 | 399 | var unit = that.data.screenWidth / 750 * 1.35; |
400 | 400 | var scene=th.data.teamgroup.id; |
401 | + var goods_id=th.data.teamlist.goods_id; | |
401 | 402 | var user_id=getApp().globalData.user_id?getApp().globalData.user_id:0; |
402 | 403 | if(user_id>0){ |
403 | 404 | scene+="_"+user_id; |
404 | 405 | } |
406 | + if(goods_id !==""){ | |
407 | + scene+="_"+goods_id; | |
408 | + } | |
405 | 409 | |
406 | 410 | //二微码 |
407 | 411 | var path3 = os.url+ "/api/wx/open/app/user/getWeAppEwm/"+ |
408 | 412 | os.stoid+"?sceneValue="+scene+"&pageValue=pages/team/team_show/team_show"; |
409 | 413 | |
414 | + console.log(path3,6000); | |
415 | + | |
410 | 416 | //读取文件成功则OK-- |
411 | 417 | wx.getImageInfo({ |
412 | 418 | src: path3, |
413 | 419 | success:function (res) { |
420 | + console.log(res,5000); | |
414 | 421 | //回调写法 |
415 | 422 | th.get_head_temp(th.get_goods_temp,function () { |
416 | 423 | var vpath = res.path; |
... | ... | @@ -812,7 +819,8 @@ Page({ |
812 | 819 | onShareAppMessage: function (e) { |
813 | 820 | var th=this; |
814 | 821 | var scene=this.data.teamgroup.id; |
815 | - var url="/pages/team/team_show/team_show?tg_id="+scene; | |
822 | + var goods_id=this.data.teamlist.goods_id; | |
823 | + var url="/pages/team/team_show/team_show?tg_id="+scene+"&goods_id"+goods_id; | |
816 | 824 | //--分享图片-- |
817 | 825 | var img=th.data.iurl+th.data.teamlist.share_imgurl; |
818 | 826 | //--把会员分享出去-- |
... | ... | @@ -828,7 +836,6 @@ Page({ |
828 | 836 | if(th.data.teamlist.share_title){ |
829 | 837 | share_title=th.data.teamlist.share_title; |
830 | 838 | } |
831 | - console.log(url,3000); | |
832 | 839 | return { |
833 | 840 | path:url, |
834 | 841 | title: share_title, | ... | ... |