Commit 7bb4edaef0d4e5a39b09978fe2d0a354b840b027
1 parent
33439a11
预售的由阿胡
Showing
4 changed files
with
223 additions
and
296 deletions
packageC/pages/presell/cart/cart.js
| ... | ... | @@ -1859,11 +1859,26 @@ Page({ |
| 1859 | 1859 | th.setData({ quan_price: 0 }) |
| 1860 | 1860 | } |
| 1861 | 1861 | |
| 1862 | + | |
| 1863 | + //---获取订单优惠--- | |
| 1864 | + var condition = allpice - quan_price; //判断的条件 | |
| 1865 | + var prom_ord=null | |
| 1866 | + if(condition > 0 && this.data.pre_arr.is_useorderyh) { | |
| 1867 | + await getApp().request.promiseGet("/api/weshop/promorder/getOrderPromotion", { | |
| 1868 | + data: {store_id: os.stoid, orderAmount: condition} | |
| 1869 | + }).then(res => { | |
| 1870 | + if (res.data.code == 0) { | |
| 1871 | + prom_ord = res.data.data; | |
| 1872 | + } | |
| 1873 | + | |
| 1874 | + }) | |
| 1875 | + } | |
| 1876 | + | |
| 1862 | 1877 | //-----------当地址不为空,且是物流时,计算物流费用---------- |
| 1863 | 1878 | if (th.data.user_addr != null && th.data.exp_type == 0 && good.is_free_shipping == 0) { |
| 1864 | 1879 | //看是不是有调用过包邮券,如果活动可以使用优化券的情况下 |
| 1865 | 1880 | if (!th.data.isget_by_quan[bn_pick] && th.data.act.is_usecoupon) { |
| 1866 | - var condition = allpice - quan_price; | |
| 1881 | + | |
| 1867 | 1882 | //--判断要不要显示包邮券,链式调用接口,调取包邮券,已经是减了优惠的金额,见到优惠券的钱--- |
| 1868 | 1883 | getApp().request.promiseGet("/api/weshop/userfeemail/pageAndArea", { |
| 1869 | 1884 | data: { |
| ... | ... | @@ -1897,14 +1912,19 @@ Page({ |
| 1897 | 1912 | var user_addr=th.data.user_addr; |
| 1898 | 1913 | var req_d = { |
| 1899 | 1914 | province: user_addr.province, city: user_addr.city, district: user_addr.district, |
| 1900 | - wuliu: parseFloat(allpice).toFixed(2), store_id: os.stoid | |
| 1915 | + wuliu: parseFloat(condition).toFixed(2), store_id: os.stoid | |
| 1901 | 1916 | } |
| 1902 | 1917 | var back_data = null; |
| 1903 | - await getApp().request.promisePost("/api/weshop/order/areaFreight", { | |
| 1904 | - is_json: 1, data: req_d | |
| 1905 | - }).then(rs => { | |
| 1906 | - if (rs.data.code == 0) back_data = rs.data.data; | |
| 1907 | - }); | |
| 1918 | + | |
| 1919 | + //-- 判断是不是包邮 -- | |
| 1920 | + if (this.data.pre_arr.is_post_temp && (!prom_ord || !prom_ord.is_ord_prom_post)) { | |
| 1921 | + | |
| 1922 | + await getApp().request.promisePost("/api/weshop/order/areaFreight", { | |
| 1923 | + is_json: 1, data: req_d | |
| 1924 | + }).then(rs => { | |
| 1925 | + if (rs.data.code == 0) back_data = rs.data.data; | |
| 1926 | + }); | |
| 1927 | + } | |
| 1908 | 1928 | |
| 1909 | 1929 | var gd_arr_list = []; |
| 1910 | 1930 | gd_arr_list.push(good); |
| ... | ... | @@ -1993,12 +2013,13 @@ Page({ |
| 1993 | 2013 | |
| 1994 | 2014 | exp_price = parseFloat(shipping_price).toFixed(2); |
| 1995 | 2015 | } |
| 1996 | - th.wuliu_next(allpice, quan_price, exp_price); | |
| 2016 | + th.wuliu_next(allpice, quan_price, exp_price,prom_ord,1); | |
| 1997 | 2017 | } else { |
| 1998 | - th.wuliu_next(allpice, quan_price, exp_price); | |
| 2018 | + th.wuliu_next(allpice, quan_price, exp_price,prom_ord,1); | |
| 1999 | 2019 | } |
| 2000 | 2020 | //}); |
| 2001 | 2021 | }, |
| 2022 | + | |
| 2002 | 2023 | async calculate_same_city() { |
| 2003 | 2024 | var th = this, |
| 2004 | 2025 | good = th.data.goods, |
| ... | ... | @@ -2061,20 +2082,34 @@ Page({ |
| 2061 | 2082 | |
| 2062 | 2083 | |
| 2063 | 2084 | |
| 2064 | - //相同的东西统一在一起 | |
| 2065 | - wuliu_next(allpice, quan_price, exp_price) { | |
| 2085 | + //相同的东西统一在一起,is_get表示订单优惠有没有被读取一遍 | |
| 2086 | + async wuliu_next(allpice, quan_price, exp_price,ord_prom,is_get) { | |
| 2066 | 2087 | var th = this; |
| 2067 | 2088 | var o_condition = parseFloat(allpice) - parseFloat(quan_price); |
| 2068 | 2089 | if (o_condition < 0) o_condition = 0; |
| 2090 | + | |
| 2091 | + if(!ord_prom && !is_get){ | |
| 2092 | + if(o_condition > 0 && this.data.pre_arr.is_useorderyh){ | |
| 2093 | + await getApp().request.promiseGet("/api/weshop/promorder/getOrderPromotion", { | |
| 2094 | + data: { store_id: os.stoid, orderAmount: condition } | |
| 2095 | + }).then(res => { | |
| 2096 | + if (res.data.code == 0) { | |
| 2097 | + ord_prom = res.data.data; | |
| 2098 | + } | |
| 2099 | + }) | |
| 2100 | + } | |
| 2101 | + } | |
| 2102 | + | |
| 2103 | + | |
| 2069 | 2104 | //如果同意参与订单优惠 |
| 2070 | - if (o_condition > 0 && this.data.pre_arr.is_useorderyh) { | |
| 2071 | - th.check_is_order_prom(o_condition,async function (ord_price) { | |
| 2105 | + if (ord_prom) { | |
| 2106 | + //th.check_is_order_prom(o_condition,async function (ord_price) { | |
| 2072 | 2107 | var bn_pick = th.data.pickup.pickup_id |
| 2073 | 2108 | var order_prom_amount = 0; |
| 2074 | 2109 | var order_prom_id = 0; |
| 2075 | 2110 | var order_m = 0; |
| 2076 | - if (th.data.order_prom[bn_pick]) { | |
| 2077 | - var ord_prom = th.data.order_prom[bn_pick]; | |
| 2111 | + //if (th.data.order_prom[bn_pick]) { | |
| 2112 | + //var ord_prom = th.data.order_prom[bn_pick]; | |
| 2078 | 2113 | //么有使用券,或者活动没有限制使用优惠券 |
| 2079 | 2114 | if (quan_price <= 0 || !ord_prom.is_xz_yh) { |
| 2080 | 2115 | order_prom_id = ord_prom['id']; |
| ... | ... | @@ -2090,7 +2125,7 @@ Page({ |
| 2090 | 2125 | } |
| 2091 | 2126 | ord_price = order_m; |
| 2092 | 2127 | } |
| 2093 | - } | |
| 2128 | + //} | |
| 2094 | 2129 | |
| 2095 | 2130 | //--订单优惠的显示-- |
| 2096 | 2131 | if (order_prom_id > 0) { |
| ... | ... | @@ -2177,11 +2212,9 @@ Page({ |
| 2177 | 2212 | if( th.data.bn_use_commission){ |
| 2178 | 2213 | the_price-=th.data.bn_use_commission; |
| 2179 | 2214 | } |
| 2180 | - | |
| 2181 | - | |
| 2182 | 2215 | th.setData({ exp_price: exp_price, order_m: the_price, show_submit: 1, }) |
| 2183 | 2216 | |
| 2184 | - }) | |
| 2217 | + //}) | |
| 2185 | 2218 | } else { |
| 2186 | 2219 | |
| 2187 | 2220 | var o_condition1 = parseFloat(o_condition) - parseFloat(th.data.presell.presell_deposit); | ... | ... |
packageC/pages/presell/cart/cart2.js
| ... | ... | @@ -641,12 +641,11 @@ Page({ |
| 641 | 641 | calculatePrice2: async function () { |
| 642 | 642 | var th = this, good = this.data.bn_goods; |
| 643 | 643 | if (!good) return false; |
| 644 | - | |
| 645 | 644 | //搭配的计算要用购物的车计算方法 |
| 646 | - if (good.prom_type == 5) { | |
| 647 | - th.calculatePrice(); | |
| 648 | - return false; | |
| 649 | - } | |
| 645 | + // if (good.prom_type == 5) { | |
| 646 | + // th.calculatePrice(); | |
| 647 | + // return false; | |
| 648 | + // } | |
| 650 | 649 | |
| 651 | 650 | th.setData({dis_btn:1}) |
| 652 | 651 | |
| ... | ... | @@ -678,8 +677,7 @@ Page({ |
| 678 | 677 | } |
| 679 | 678 | |
| 680 | 679 | |
| 681 | - // to.getConfig2(function (ee) { | |
| 682 | - // to.getwuliuprice(async function (rs) { | |
| 680 | + | |
| 683 | 681 | |
| 684 | 682 | var o_shipping_price = 0, goods_weight = -1, goods_piece = -1; |
| 685 | 683 | var out_of_weight = null; //超出多少重量 |
| ... | ... | @@ -708,6 +706,30 @@ Page({ |
| 708 | 706 | } |
| 709 | 707 | } |
| 710 | 708 | |
| 709 | + //-----------------支付价,优惠券不减物流----------------- | |
| 710 | + var total_m = (parseFloat(allpice1)).toFixed(2); | |
| 711 | + var order_m = (parseFloat(allpice - cut_price) - quan_price).toFixed(2); | |
| 712 | + var coupon_price = quan_price; //优惠券优惠了多少钱 | |
| 713 | + if (order_m < 0) { | |
| 714 | + order_m = 0; | |
| 715 | + coupon_price = parseFloat(order_m).toFixed(2); | |
| 716 | + } | |
| 717 | + //--看一下有没有订单优惠-- | |
| 718 | + var o_condition = parseFloat(order_m); | |
| 719 | + | |
| 720 | + //-- 判断订单优惠的叠加 -- | |
| 721 | + var ord_prom=null; | |
| 722 | + var o_condition=allpice; | |
| 723 | + if (o_condition > 0 && th.data.act.is_useorderyh) { | |
| 724 | + await getApp().request.promiseGet("/api/weshop/promorder/getOrderPromotion", { | |
| 725 | + data: { store_id: os.stoid, orderAmount: o_condition, user_id: getApp().globalData.user_id } | |
| 726 | + }).then(res => { | |
| 727 | + if (res.data.code == 0) { | |
| 728 | + ord_prom = res.data.data; | |
| 729 | + } | |
| 730 | + }) | |
| 731 | + } | |
| 732 | + | |
| 711 | 733 | //-----------当地址不为空,且是物流时,计算物流费用,并同时商品不是优惠活动的包邮---------- |
| 712 | 734 | if (th.data.user_addr != null && th.data.bn_exp_type == 0 && good.is_free_shipping == 0 && good.is_past != 1) { |
| 713 | 735 | //看是不是有调用过包邮券 |
| ... | ... | @@ -757,11 +779,16 @@ Page({ |
| 757 | 779 | wuliu: parseFloat(parseFloat(allpice) - cut_price - quan_price).toFixed(2), store_id: os.stoid |
| 758 | 780 | } |
| 759 | 781 | var back_data = null; |
| 760 | - await getApp().request.promisePost("/api/weshop/order/areaFreight", { | |
| 761 | - is_json: 1, data: req_d | |
| 762 | - }).then(rs => { | |
| 763 | - if (rs.data.code == 0) back_data = rs.data.data; | |
| 764 | - }); | |
| 782 | + | |
| 783 | + if(!ord_prom || ord_prom.is_post_temp) { | |
| 784 | + if (th.data.act.is_post_temp){ | |
| 785 | + await getApp().request.promisePost("/api/weshop/order/areaFreight", { | |
| 786 | + is_json: 1, data: req_d | |
| 787 | + }).then(rs => { | |
| 788 | + if (rs.data.code == 0) back_data = rs.data.data; | |
| 789 | + }); | |
| 790 | + } | |
| 791 | + } | |
| 765 | 792 | |
| 766 | 793 | var cut_good_weight = 0; |
| 767 | 794 | for (let i in gd_arr_list) { |
| ... | ... | @@ -868,306 +895,171 @@ Page({ |
| 868 | 895 | th.setData({ [wl_txt]: 0, }) |
| 869 | 896 | } |
| 870 | 897 | } |
| 871 | - //-----------------支付价,优惠券不减物流----------------- | |
| 872 | - var total_m = (parseFloat(allpice1)).toFixed(2); | |
| 873 | - var order_m = (parseFloat(allpice - cut_price) - quan_price).toFixed(2); | |
| 874 | - var coupon_price = quan_price; //优惠券优惠了多少钱 | |
| 875 | - if (order_m < 0) { | |
| 876 | - order_m = 0; | |
| 877 | - coupon_price = parseFloat(order_m).toFixed(2); | |
| 878 | - } | |
| 879 | - //--看一下有没有订单优惠-- | |
| 880 | - var o_condition = parseFloat(order_m); | |
| 881 | 898 | |
| 882 | 899 | |
| 883 | - | |
| 884 | - if (o_condition > 0 && th.data.act.is_useorderyh) { | |
| 885 | - th.check_is_order_prom(o_condition, async function () { | |
| 886 | - var order_prom_amount = 0; | |
| 887 | - var order_prom_id = 0; | |
| 888 | - if (th.data.order_prom[th.data.bn_pick]) { | |
| 889 | - var ord_prom = th.data.order_prom[th.data.bn_pick]; | |
| 890 | - if (!ord_prom.is_xz_yh || quan_price <= 0) { | |
| 891 | - order_prom_id = ord_prom['id']; | |
| 892 | - switch (ord_prom['type']) { | |
| 893 | - case 0: | |
| 894 | - order_m = Math.round(o_condition * ord_prom['expression']) / 100;//满额打折 | |
| 895 | - order_prom_amount = (o_condition - order_m).toFixed(2); | |
| 896 | - break; | |
| 897 | - case 1: | |
| 898 | - | |
| 899 | - var bs=1; | |
| 900 | - if(ord_prom.is_bz){ | |
| 901 | - bs=Math.floor(o_condition/ord_prom.money); | |
| 902 | - } | |
| 903 | - | |
| 904 | - order_m = o_condition - bs*ord_prom['expression'];//满额优惠金额 | |
| 905 | - order_prom_amount = bs*ord_prom['expression']; | |
| 906 | - break; | |
| 900 | + var order_prom_amount = 0; | |
| 901 | + var order_prom_id = 0; | |
| 902 | + var order_prom_txt1 = "formData.order_prom_id"; | |
| 903 | + var order_prom_txt2 = "formData.order_prom_amount"; | |
| 904 | + if(ord_prom){ | |
| 905 | + if (!ord_prom.is_xz_yh || quan_price <= 0) { | |
| 906 | + order_prom_id = ord_prom['id']; | |
| 907 | + switch (ord_prom['type']) { | |
| 908 | + case 0: | |
| 909 | + order_m = Math.round(o_condition * ord_prom['expression']) / 100;//满额打折 | |
| 910 | + order_prom_amount = (o_condition - order_m).toFixed(2); | |
| 911 | + break; | |
| 912 | + case 1: | |
| 913 | + | |
| 914 | + var bs=1; | |
| 915 | + if(ord_prom.is_bz){ | |
| 916 | + bs=Math.floor(o_condition/ord_prom.money); | |
| 907 | 917 | } |
| 908 | - } | |
| 909 | - } | |
| 910 | - //--订单优惠的显示-- | |
| 911 | - if (order_prom_id > 0) { | |
| 912 | - var order_prom_txt1 = "formData.order_prom_id"; | |
| 913 | - var order_prom_txt2 = "formData.order_prom_amount"; | |
| 914 | - th.setData({ [order_prom_txt1]: order_prom_id, [order_prom_txt2]: order_prom_amount }) | |
| 918 | + order_m = o_condition - bs*ord_prom['expression'];//满额优惠金额 | |
| 919 | + order_prom_amount = bs*ord_prom['expression']; | |
| 920 | + break; | |
| 915 | 921 | } |
| 922 | + } | |
| 923 | + //--订单优惠的显示-- | |
| 924 | + if (order_prom_id > 0) { | |
| 925 | + th.setData({ [order_prom_txt1]: order_prom_id, [order_prom_txt2]: order_prom_amount }) | |
| 926 | + } | |
| 927 | + }else { | |
| 928 | + th.setData({ [order_prom_txt1]: 0, [order_prom_txt2]: 0 }) | |
| 929 | + } | |
| 916 | 930 | |
| 917 | - //判断是否同城配送,而且没有调用过 | |
| 918 | - if(th.data.bn_exp_type==2 && th.data.user_addr) { | |
| 919 | - | |
| 920 | - var lon=0;var lat=0; | |
| 921 | - //-- 获取距离 -- | |
| 922 | - await getApp().request.promisePost("/api/weshop/order/sameCityExp/getGeocoder", { | |
| 923 | - is_json: 1, data: {address:th.data.user_addr.more_address+th.data.user_addr.address} | |
| 924 | - }).then(res=>{ | |
| 925 | - if(res.data.code==0){ | |
| 926 | - var data= JSON.parse(res.data.data); | |
| 927 | - if(data.status==0){ | |
| 928 | - lon=data.result.location.lng; | |
| 929 | - lat=data.result.location.lat; | |
| 930 | - } | |
| 931 | - } | |
| 932 | - }) | |
| 933 | 931 | |
| 932 | + var order_prom_txt1 = "formData.order_prom_id"; | |
| 933 | + var order_prom_txt2 = "formData.order_prom_amount"; | |
| 934 | + th.setData({ [order_prom_txt1]: 0, [order_prom_txt2]: 0 }) | |
| 934 | 935 | |
| 935 | - var gd_w = good['weight'] * good['buynum']; | |
| 936 | - //-- 获取距离 -- | |
| 937 | - var req_data = { | |
| 938 | - store_id: os.stoid, | |
| 939 | - order_amount: parseFloat(order_m), | |
| 940 | - lon: lon, lat: lat, | |
| 941 | - pickup_id: bn_pick, | |
| 942 | - goods_weight: gd_w | |
| 943 | - } | |
| 944 | 936 | |
| 945 | - var is_next=1; | |
| 946 | - //获取同城配送参数 | |
| 947 | - await getApp().request.promisePost("/api/weshop/order/sameCityExp/getMoney", { | |
| 948 | - is_json: 1, | |
| 949 | - data: req_data | |
| 950 | - }).then(res => { | |
| 951 | - if (res.data.code == 0) { | |
| 952 | - var wl_txt = "formData.shipping_price"; | |
| 953 | - th.setData({ [wl_txt]: res.data.data, }) | |
| 954 | - }else{ | |
| 955 | - is_next=0; | |
| 956 | - wx.showToast({ | |
| 957 | - title: res.data.msg, icon: 'none', duration: 2000 | |
| 958 | - }) | |
| 959 | - } | |
| 960 | - }) | |
| 961 | - if(!is_next) return false | |
| 937 | + //判断是否同城配送,而且没有调用过 | |
| 938 | + if(th.data.bn_exp_type==2 && th.data.user_addr) { | |
| 939 | + var lon=0;var lat=0; | |
| 940 | + //-- 获取距离 -- | |
| 941 | + await getApp().request.promisePost("/api/weshop/order/sameCityExp/getGeocoder", { | |
| 942 | + is_json: 1, data: {address:th.data.user_addr.more_address+th.data.user_addr.address} | |
| 943 | + }).then(res=>{ | |
| 944 | + if(res.data.code==0){ | |
| 945 | + var data= JSON.parse(res.data.data); | |
| 946 | + if(data.status==0){ | |
| 947 | + lon=data.result.location.lng; | |
| 948 | + lat=data.result.location.lat; | |
| 949 | + } | |
| 962 | 950 | } |
| 951 | + }) | |
| 963 | 952 | |
| 953 | + var gd_w = good['weight'] * good['buynum']; | |
| 954 | + //-- 获取距离 -- | |
| 955 | + var req_data = { | |
| 956 | + store_id: os.stoid, | |
| 957 | + order_amount:parseFloat(order_m), | |
| 958 | + lon: lon, lat: lat, | |
| 959 | + pickup_id: bn_pick, | |
| 960 | + goods_weight: gd_w | |
| 961 | + } | |
| 964 | 962 | |
| 965 | - | |
| 966 | - total_m = parseFloat(total_m) + parseFloat(th.data.formData.shipping_price); | |
| 967 | - order_m = parseFloat(order_m) + parseFloat(th.data.formData.shipping_price); | |
| 968 | - | |
| 969 | - total_m = total_m.toFixed(2); | |
| 970 | - order_m = order_m.toFixed(2); | |
| 971 | - | |
| 972 | - var atxt = "formData.total_amount"; | |
| 973 | - th.setData({ [atxt]: total_m, }) | |
| 974 | - | |
| 975 | - var txt = "formData.user_money"; | |
| 976 | - var txt2 = "formData.order_amount"; | |
| 977 | - var txt3 = "formData.coupon_price"; | |
| 978 | - | |
| 979 | - if(parseFloat(order_m)<parseFloat(th.data.bn_goods.use_commission)){ | |
| 980 | - | |
| 963 | + var is_next=1; | |
| 964 | + //获取同城配送参数 | |
| 965 | + await getApp().request.promisePost("/api/weshop/order/sameCityExp/getMoney", { | |
| 966 | + is_json: 1, | |
| 967 | + data: req_data | |
| 968 | + }).then(res => { | |
| 969 | + if (res.data.code == 0) { | |
| 970 | + var wl_txt = "formData.shipping_price"; | |
| 971 | + th.setData({ [wl_txt]: res.data.data, }) | |
| 972 | + }else{ | |
| 973 | + is_next=0; | |
| 981 | 974 | wx.showToast({ |
| 982 | - title: '应付金额小于本单佣金,不可使用!', | |
| 983 | - icon: 'none', | |
| 984 | - duration: 2000 | |
| 985 | - }) | |
| 986 | - | |
| 987 | - th.setData({ | |
| 988 | - bn_use_commission:0 | |
| 975 | + title: res.data.msg, icon: 'none', duration: 2000 | |
| 989 | 976 | }) |
| 990 | - | |
| 991 | - } | |
| 992 | - | |
| 993 | - var txt4 = "formData.use_commission"; | |
| 994 | - | |
| 995 | - if(th.data.bn_use_commission){ | |
| 996 | - order_m=(parseFloat(order_m)- parseFloat(th.data.bn_goods.use_commission)).toFixed(2); | |
| 997 | - th.setData({[txt4]:th.data.bn_goods.use_commission}) | |
| 998 | - } | |
| 999 | - | |
| 1000 | - var amoney = parseFloat(th.data.userinfo.user_money - th.data.txmon - th.data.userinfo.frozen_money); | |
| 1001 | - //--------------如果使用余额--------------------- | |
| 1002 | - if (th.data.bn_use_money == 1) { | |
| 1003 | - if (amoney > parseFloat(order_m)) { | |
| 1004 | - order_m = parseFloat(order_m).toFixed(2); | |
| 1005 | - th.setData({ [txt]: order_m, [txt2]: 0, [txt3]: coupon_price, show_submit: 1,dis_btn:0 }) | |
| 1006 | - } else { | |
| 1007 | - order_m = parseFloat(order_m) - parseFloat(amoney); | |
| 1008 | - order_m = order_m.toFixed(2); | |
| 1009 | - th.setData({ [txt]: amoney, [txt2]: order_m, [txt3]: coupon_price, show_submit: 1,dis_btn:0 }) | |
| 1010 | - } | |
| 1011 | - } else { | |
| 1012 | - th.setData({ [txt]: 0, [txt2]: order_m, [txt3]: coupon_price, show_submit: 1,dis_btn:0 }) | |
| 1013 | - } | |
| 1014 | - //优惠活动送积分 | |
| 1015 | - if (good.s_intValue) { | |
| 1016 | - txt = "formData.give_integral"; | |
| 1017 | - th.setData({ [txt]: good.s_intValue }); | |
| 1018 | - } | |
| 1019 | - //优惠送券 | |
| 1020 | - if (good.s_coupon_id) { | |
| 1021 | - var i_txt = "formData.give_coupon_id"; | |
| 1022 | - //这个是json格式的 | |
| 1023 | - var i_txt1 = "formData.g_coupon_num"; | |
| 1024 | - var ob = [{ "num": good.s_coupon_num, "c_id": good.s_coupon_id }]; | |
| 1025 | - ob = JSON.stringify(ob); | |
| 1026 | - th.setData({ [i_txt]: good.s_coupon_id, [i_txt1]: ob }); | |
| 1027 | - } | |
| 1028 | - //优惠礼包 | |
| 1029 | - if (good.s_libao) { | |
| 1030 | - var l_txt = "formData.give_lb_id"; | |
| 1031 | - //这个是json格式的 | |
| 1032 | - var l_txt1 = "formData.g_lb_num"; | |
| 1033 | - var ob = [{ "num": good.s_lb_num, "l_id": good.s_libao }]; | |
| 1034 | - ob = JSON.stringify(ob); | |
| 1035 | - th.setData({ [l_txt]: good.s_libao, [l_txt1]: ob }); | |
| 1036 | 977 | } |
| 1037 | 978 | }) |
| 1038 | - } else { | |
| 1039 | - var order_prom_txt1 = "formData.order_prom_id"; | |
| 1040 | - var order_prom_txt2 = "formData.order_prom_amount"; | |
| 1041 | - th.setData({ [order_prom_txt1]: 0, [order_prom_txt2]: 0 }) | |
| 1042 | - | |
| 1043 | - | |
| 1044 | - //判断是否同城配送,而且没有调用过 | |
| 1045 | - if(th.data.bn_exp_type==2 && th.data.user_addr) { | |
| 1046 | - var lon=0;var lat=0; | |
| 1047 | - //-- 获取距离 -- | |
| 1048 | - await getApp().request.promisePost("/api/weshop/order/sameCityExp/getGeocoder", { | |
| 1049 | - is_json: 1, data: {address:th.data.user_addr.more_address+th.data.user_addr.address} | |
| 1050 | - }).then(res=>{ | |
| 1051 | - if(res.data.code==0){ | |
| 1052 | - var data= JSON.parse(res.data.data); | |
| 1053 | - if(data.status==0){ | |
| 1054 | - lon=data.result.location.lng; | |
| 1055 | - lat=data.result.location.lat; | |
| 1056 | - } | |
| 1057 | - } | |
| 1058 | - }) | |
| 1059 | - | |
| 1060 | - var gd_w = good['weight'] * good['buynum']; | |
| 1061 | - //-- 获取距离 -- | |
| 1062 | - var req_data = { | |
| 1063 | - store_id: os.stoid, | |
| 1064 | - order_amount:parseFloat(order_m), | |
| 1065 | - lon: lon, lat: lat, | |
| 1066 | - pickup_id: bn_pick, | |
| 1067 | - goods_weight: gd_w | |
| 1068 | - } | |
| 1069 | - | |
| 1070 | - var is_next=1; | |
| 1071 | - //获取同城配送参数 | |
| 1072 | - await getApp().request.promisePost("/api/weshop/order/sameCityExp/getMoney", { | |
| 1073 | - is_json: 1, | |
| 1074 | - data: req_data | |
| 1075 | - }).then(res => { | |
| 1076 | - if (res.data.code == 0) { | |
| 1077 | - var wl_txt = "formData.shipping_price"; | |
| 1078 | - th.setData({ [wl_txt]: res.data.data, }) | |
| 1079 | - }else{ | |
| 1080 | - is_next=0; | |
| 1081 | - wx.showToast({ | |
| 1082 | - title: res.data.msg, icon: 'none', duration: 2000 | |
| 1083 | - }) | |
| 1084 | - } | |
| 1085 | - }) | |
| 1086 | - if(!is_next) return false | |
| 1087 | - } | |
| 1088 | - | |
| 1089 | - total_m = parseFloat(total_m) + parseFloat(th.data.formData.shipping_price); | |
| 1090 | - order_m = parseFloat(order_m) + parseFloat(th.data.formData.shipping_price); | |
| 1091 | - var atxt = "formData.total_amount"; | |
| 979 | + if(!is_next) return false | |
| 980 | + } | |
| 1092 | 981 | |
| 1093 | - total_m = total_m.toFixed(2); | |
| 1094 | - order_m = order_m.toFixed(2); | |
| 982 | + total_m = parseFloat(total_m) + parseFloat(th.data.formData.shipping_price); | |
| 983 | + order_m = parseFloat(order_m) + parseFloat(th.data.formData.shipping_price); | |
| 984 | + var atxt = "formData.total_amount"; | |
| 1095 | 985 | |
| 1096 | - th.setData({ [atxt]: total_m, }) | |
| 986 | + total_m = total_m.toFixed(2); | |
| 987 | + order_m = order_m.toFixed(2); | |
| 1097 | 988 | |
| 1098 | - var txt = "formData.user_money"; | |
| 1099 | - var txt2 = "formData.order_amount"; | |
| 1100 | - var txt3 = "formData.coupon_price"; | |
| 989 | + th.setData({ [atxt]: total_m, }) | |
| 1101 | 990 | |
| 1102 | - if(parseFloat(order_m)<parseFloat(th.data.bn_goods.use_commission)){ | |
| 991 | + var txt = "formData.user_money"; | |
| 992 | + var txt2 = "formData.order_amount"; | |
| 993 | + var txt3 = "formData.coupon_price"; | |
| 1103 | 994 | |
| 1104 | - if(th.data.bn_use_commission){ | |
| 1105 | - wx.showToast({ | |
| 1106 | - title: '应付金额小于本单佣金,不可使用!', | |
| 1107 | - icon: 'none', | |
| 1108 | - duration: 2000 | |
| 1109 | - }) | |
| 1110 | - } | |
| 995 | + if(parseFloat(order_m)<parseFloat(th.data.bn_goods.use_commission)){ | |
| 1111 | 996 | |
| 1112 | - th.setData({ | |
| 1113 | - bn_use_commission:0 | |
| 997 | + if(th.data.bn_use_commission){ | |
| 998 | + wx.showToast({ | |
| 999 | + title: '应付金额小于本单佣金,不可使用!', | |
| 1000 | + icon: 'none', | |
| 1001 | + duration: 2000 | |
| 1114 | 1002 | }) |
| 1115 | 1003 | } |
| 1116 | 1004 | |
| 1005 | + th.setData({ | |
| 1006 | + bn_use_commission:0 | |
| 1007 | + }) | |
| 1008 | + } | |
| 1117 | 1009 | |
| 1118 | 1010 | |
| 1119 | - var txt4 = "formData.use_commission"; | |
| 1120 | 1011 | |
| 1121 | - if(th.data.bn_use_commission){ | |
| 1122 | - order_m=(parseFloat(order_m)- parseFloat(th.data.bn_goods.use_commission)).toFixed(2); | |
| 1123 | - th.setData({[txt4]:th.data.bn_goods.use_commission}) | |
| 1124 | - } | |
| 1012 | + var txt4 = "formData.use_commission"; | |
| 1125 | 1013 | |
| 1014 | + if(th.data.bn_use_commission){ | |
| 1015 | + order_m=(parseFloat(order_m)- parseFloat(th.data.bn_goods.use_commission)).toFixed(2); | |
| 1016 | + th.setData({[txt4]:th.data.bn_goods.use_commission}) | |
| 1017 | + } | |
| 1126 | 1018 | |
| 1127 | 1019 | |
| 1128 | - var amoney = parseFloat(th.data.userinfo.user_money - th.data.txmon - th.data.userinfo.frozen_money); | |
| 1129 | - //--------------如果使用余额--------------------- | |
| 1130 | - if (th.data.bn_use_money == 1) { | |
| 1131 | - if (amoney > order_m) { | |
| 1132 | - order_m = parseFloat(order_m).toFixed(2); | |
| 1133 | - th.setData({ [txt]: order_m, [txt2]: 0, [txt3]: coupon_price, show_submit: 1,dis_btn:0 }) | |
| 1134 | - } else { | |
| 1135 | - order_m = parseFloat(order_m) - parseFloat(amoney); | |
| 1136 | - order_m = order_m.toFixed(2); | |
| 1137 | - th.setData({ [txt]: amoney, [txt2]: order_m, [txt3]: coupon_price, show_submit: 1,dis_btn:0 }) | |
| 1138 | - } | |
| 1020 | + | |
| 1021 | + var amoney = parseFloat(th.data.userinfo.user_money - th.data.txmon - th.data.userinfo.frozen_money); | |
| 1022 | + //--------------如果使用余额--------------------- | |
| 1023 | + if (th.data.bn_use_money == 1) { | |
| 1024 | + if (amoney > order_m) { | |
| 1025 | + order_m = parseFloat(order_m).toFixed(2); | |
| 1026 | + th.setData({ [txt]: order_m, [txt2]: 0, [txt3]: coupon_price, show_submit: 1,dis_btn:0 }) | |
| 1139 | 1027 | } else { |
| 1140 | - th.setData({ [txt]: 0, [txt2]: order_m, [txt3]: coupon_price, show_submit: 1,dis_btn:0 }) | |
| 1141 | - } | |
| 1142 | - //优惠活动送积分 | |
| 1143 | - if (good.s_intValue) { | |
| 1144 | - txt = "formData.give_integral"; | |
| 1145 | - th.setData({ [txt]: good.s_intValue }); | |
| 1146 | - } | |
| 1147 | - //优惠送券 | |
| 1148 | - if (good.s_coupon_id) { | |
| 1149 | - var i_txt = "formData.give_coupon_id"; | |
| 1150 | - //这个是json格式的 | |
| 1151 | - var i_txt1 = "formData.g_coupon_num"; | |
| 1152 | - var ob = [{ "num": good.s_coupon_num, "c_id": good.s_coupon_id }]; | |
| 1153 | - ob = JSON.stringify(ob); | |
| 1154 | - th.setData({ [i_txt]: good.s_coupon_id, [i_txt1]: ob }); | |
| 1155 | - } | |
| 1156 | - //优惠礼包 | |
| 1157 | - if (good.s_libao) { | |
| 1158 | - var l_txt = "formData.give_lb_id"; | |
| 1159 | - //这个是json格式的 | |
| 1160 | - var l_txt1 = "formData.g_lb_num"; | |
| 1161 | - var ob = [{ "num": good.s_lb_num, "l_id": good.s_libao }]; | |
| 1162 | - ob = JSON.stringify(ob); | |
| 1163 | - th.setData({ [l_txt]: good.s_coupon_id, [l_txt1]: ob }); | |
| 1028 | + order_m = parseFloat(order_m) - parseFloat(amoney); | |
| 1029 | + order_m = order_m.toFixed(2); | |
| 1030 | + th.setData({ [txt]: amoney, [txt2]: order_m, [txt3]: coupon_price, show_submit: 1,dis_btn:0 }) | |
| 1164 | 1031 | } |
| 1032 | + } else { | |
| 1033 | + th.setData({ [txt]: 0, [txt2]: order_m, [txt3]: coupon_price, show_submit: 1,dis_btn:0 }) | |
| 1034 | + } | |
| 1035 | + //优惠活动送积分 | |
| 1036 | + if (good.s_intValue) { | |
| 1037 | + txt = "formData.give_integral"; | |
| 1038 | + th.setData({ [txt]: good.s_intValue }); | |
| 1039 | + } | |
| 1040 | + //优惠送券 | |
| 1041 | + if (good.s_coupon_id) { | |
| 1042 | + var i_txt = "formData.give_coupon_id"; | |
| 1043 | + //这个是json格式的 | |
| 1044 | + var i_txt1 = "formData.g_coupon_num"; | |
| 1045 | + var ob = [{ "num": good.s_coupon_num, "c_id": good.s_coupon_id }]; | |
| 1046 | + ob = JSON.stringify(ob); | |
| 1047 | + th.setData({ [i_txt]: good.s_coupon_id, [i_txt1]: ob }); | |
| 1165 | 1048 | } |
| 1049 | + //优惠礼包 | |
| 1050 | + if (good.s_libao) { | |
| 1051 | + var l_txt = "formData.give_lb_id"; | |
| 1052 | + //这个是json格式的 | |
| 1053 | + var l_txt1 = "formData.g_lb_num"; | |
| 1054 | + var ob = [{ "num": good.s_lb_num, "l_id": good.s_libao }]; | |
| 1055 | + ob = JSON.stringify(ob); | |
| 1056 | + th.setData({ [l_txt]: good.s_coupon_id, [l_txt1]: ob }); | |
| 1057 | + } | |
| 1058 | + | |
| 1166 | 1059 | |
| 1167 | 1060 | wx.hideLoading(); |
| 1168 | 1061 | |
| 1169 | - // }); | |
| 1170 | - // }); | |
| 1062 | + | |
| 1171 | 1063 | }, |
| 1172 | 1064 | |
| 1173 | 1065 | //--------------------提交订单----------------------- | ... | ... |
pages/goods/goodsInfo/goodsInfo.js
| ... | ... | @@ -7725,7 +7725,7 @@ Page({ |
| 7725 | 7725 | let item = arr_data[i]; |
| 7726 | 7726 | //找不到活动要剔除 |
| 7727 | 7727 | if (!item.act_name) continue; |
| 7728 | - if ([1,2,4,6].indexOf(item.prom_type)==-1) continue; | |
| 7728 | + if ([1,2,4,6,8].indexOf(item.prom_type)==-1) continue; | |
| 7729 | 7729 | new_arr.push(item); |
| 7730 | 7730 | } |
| 7731 | 7731 | ... | ... |
pages/goods/goodsInfo/goodsInfo.wxml
| ... | ... | @@ -604,6 +604,7 @@ |
| 604 | 604 | <view wx:if="{{item.prom_type==2}}" class="cx-sizs wsize" style="width: 144rpx">团购</view> |
| 605 | 605 | <view wx:if="{{item.prom_type==4}}" class="cx-sizs wsize" style="width: 144rpx">积分购</view> |
| 606 | 606 | <view wx:if="{{item.prom_type==6}}" class="cx-sizs wsize" style="width: 144rpx">天天拼单</view> |
| 607 | + <view wx:if="{{item.prom_type==8}}" class="cx-sizs wsize" style="width: 144rpx">预售</view> | |
| 607 | 608 | |
| 608 | 609 | <!-- 中间显示层 --> |
| 609 | 610 | <view class="flex ai-center jc_sb" style="width: 570rpx" bindtap="go_more_flash" data-prom_type="{{item.prom_type}}" data-id="{{item.act_id}}"> |
| ... | ... | @@ -613,6 +614,7 @@ |
| 613 | 614 | <view wx:if="{{item.prom_type==2}}" class="miao_lab">团</view> |
| 614 | 615 | <view wx:if="{{item.prom_type==4}}" class="miao_lab">积</view> |
| 615 | 616 | <view wx:if="{{item.prom_type==6}}" class="miao_lab">拼</view> |
| 617 | + <view wx:if="{{item.prom_type==6}}" class="miao_lab">预</view> | |
| 616 | 618 | |
| 617 | 619 | |
| 618 | 620 | <view class="order_hui"> | ... | ... |