Commit 4564568feb40edd4a06cd3795eea01bde43039d9
1 parent
de3f7688
1. 立即购买和购物车 购买时,切换地址时, 优惠券的使用bug修复
2. 助力活动的bug修复
Showing
2 changed files
with
192 additions
and
145 deletions
pages/cart/cart2/cart2.js
| @@ -142,8 +142,9 @@ Page({ | @@ -142,8 +142,9 @@ Page({ | ||
| 142 | //----------子页返回父页触发---------- | 142 | //----------子页返回父页触发---------- |
| 143 | onShow: function() { | 143 | onShow: function() { |
| 144 | var th=this; | 144 | var th=this; |
| 145 | - th.setData({show_submit:0}); | ||
| 146 | - | 145 | + th.setData({show_submit:0}); //让提交先掩藏 |
| 146 | + th.data.g_cart_q_time=null; | ||
| 147 | + | ||
| 147 | if (th.data.isclose==0){ | 148 | if (th.data.isclose==0){ |
| 148 | wx.navigateTo({ | 149 | wx.navigateTo({ |
| 149 | url: "/pages/index/index/index" | 150 | url: "/pages/index/index/index" |
| @@ -739,6 +740,152 @@ Page({ | @@ -739,6 +740,152 @@ Page({ | ||
| 739 | }); | 740 | }); |
| 740 | }, | 741 | }, |
| 741 | 742 | ||
| 743 | + calc_per:async function(c_arr){ | ||
| 744 | + var th=this; | ||
| 745 | + //-- 循环处理 -- | ||
| 746 | + for(var i in c_arr){ | ||
| 747 | + var cart_item=c_arr[i]; //就是每一单的意思 | ||
| 748 | + var pickid=cart_item.pickup_id; | ||
| 749 | + var ord_goods=c_arr[i].goods; //就是每一单的从表的意思 | ||
| 750 | + var o_price=0,q_conditin=0; | ||
| 751 | + //--------循环计算总价----------- | ||
| 752 | + for(var j=0;j<ord_goods.length;j++){ | ||
| 753 | + o_price += ord_goods[j].goods_price * ord_goods[j].goods_num; | ||
| 754 | + } | ||
| 755 | + | ||
| 756 | + //---如果该门店的相关活动,就要算一下减价-- | ||
| 757 | + if(th.data.prom_goods_map[pickid]){ | ||
| 758 | + var ob=th.data.prom_goods_map[pickid]; | ||
| 759 | + for(var ii in ob){ | ||
| 760 | + var item_map=ob[ii]; | ||
| 761 | + if(item_map.bs==undefined || item_map.bs==null) { | ||
| 762 | + //等待,获取一下优惠活动的信息 | ||
| 763 | + await getApp().request.promiseGet("/api/weshop/goods/getDiscount", { | ||
| 764 | + data: { | ||
| 765 | + price: item_map.price, prom_id: item_map.prom_id, | ||
| 766 | + goods_num: item_map.goods_num, user_id: getApp().globalData.user_id, | ||
| 767 | + is_bz: item_map.is_bz | ||
| 768 | + } | ||
| 769 | + }).then(res => { | ||
| 770 | + if (res.data.code == 0 && res.data.data.condition) { | ||
| 771 | + var get_data = res.data.data; | ||
| 772 | + item_map.is_bz = get_data.is_bz; //是不是倍增 | ||
| 773 | + item_map.bs = get_data.bs; //是不是倍数 | ||
| 774 | + item_map.is_past = get_data.is_past; //是不是包邮 | ||
| 775 | + item_map.prom_price = get_data.price>=0?get_data.price:item_map.price; | ||
| 776 | + item_map.s_intValue = get_data.intValue; | ||
| 777 | + item_map.s_coupon_id = get_data.coupon_id; | ||
| 778 | + item_map.s_coupon_num = get_data.coupon_num; | ||
| 779 | + if(get_data.gift_id && get_data.goodsinfo) { | ||
| 780 | + item_map.gift_id = get_data.gift_id; | ||
| 781 | + item_map.gift_goods_id = get_data.goods_id; | ||
| 782 | + item_map.gift_goods_name = get_data.goods_name; | ||
| 783 | + item_map.gift_goods_color = get_data.goodsinfo.goods_color ? get_data.goodsinfo.goods_color : ''; | ||
| 784 | + item_map.gift_goods_spec = get_data.goodsinfo.goods_spec ? get_data.goodsinfo.goods_spec : ''; | ||
| 785 | + item_map.gift_original_img = get_data.goodsinfo.original_img; | ||
| 786 | + item_map.gift_limit_num = get_data.limit_num; | ||
| 787 | + item_map.gift_storecount = get_data.gift_storecount; | ||
| 788 | + item_map.gift_weight = get_data.goodsinfo.weight; | ||
| 789 | + item_map.gift_exp_sum_type = get_data.goodsinfo.exp_sum_type; | ||
| 790 | + item_map.uniform_exp_sum = get_data.goodsinfo.uniform_exp_sum; | ||
| 791 | + | ||
| 792 | + } | ||
| 793 | + item_map.s_libao = get_data.libao; | ||
| 794 | + item_map.s_lb_num = get_data.lb_num; | ||
| 795 | + } | ||
| 796 | + }) | ||
| 797 | + } | ||
| 798 | + | ||
| 799 | + //有活动,且优惠活动并没有限制使用优惠券,且有减价 | ||
| 800 | + //--看有没有减价-- | ||
| 801 | + //if(item_map.prom_price>=0 && item_map.price-item_map.prom_price){ | ||
| 802 | + if(item_map.price-item_map.prom_price && item_map.prom_price!==null){ | ||
| 803 | + if(cart_item.prom_pt_json){ | ||
| 804 | + cart_item.prom_pt_json.push({"prom_id":item_map.prom_id,"dis":(item_map.price-item_map.prom_price).toFixed(2),"ispt":0}) | ||
| 805 | + }else{ | ||
| 806 | + cart_item.prom_pt_json=[{"prom_id":item_map.prom_id,"dis":(item_map.price-item_map.prom_price).toFixed(2),"ispt":0}]; | ||
| 807 | + } | ||
| 808 | + | ||
| 809 | + //-- 如果系统要平摊到单品 -- | ||
| 810 | + //if(!th.data.ispt_goods){ | ||
| 811 | + var pt_data={ | ||
| 812 | + 'prom_id':item_map.prom_id, | ||
| 813 | + 'dis': parseFloat((item_map.price-item_map.prom_price).toFixed(2)), | ||
| 814 | + 'goods':item_map.goods | ||
| 815 | + } | ||
| 816 | + | ||
| 817 | + var pt_res=null; | ||
| 818 | + await getApp().request.promisePost("/api/weshop/order/getGoodsSplit",{is_json:1,data:pt_data}).then(res=>{ | ||
| 819 | + if(res.data.code==0){ pt_res=res.data.data; } | ||
| 820 | + }) | ||
| 821 | + if(pt_res){ | ||
| 822 | + for (var io in item_map.goods){ | ||
| 823 | + //平摊赋值 | ||
| 824 | + item_map.goods[io].account_fir=th.arr_get_goods(item_map.goods[io].goods_id,pt_res).fisrt_account; | ||
| 825 | + item_map.goods[io].account_yu_fir=th.arr_get_goods(item_map.goods[io].goods_id,pt_res).fisrt_account_yu; | ||
| 826 | + if(!th.data.ispt_goods){ | ||
| 827 | + item_map.goods[io].account=item_map.goods[io].account_fir; | ||
| 828 | + item_map.goods[io].account_yu=item_map.goods[io].account_yu_fir; | ||
| 829 | + } | ||
| 830 | + } | ||
| 831 | + } | ||
| 832 | + // } | ||
| 833 | + | ||
| 834 | + o_price-=(item_map.price-item_map.prom_price); | ||
| 835 | + //如果有限制使用优惠券,就要减掉参与的活动商品的钱 | ||
| 836 | + if(!item_map.is_xz_yh) q_conditin=o_price; | ||
| 837 | + } | ||
| 838 | + | ||
| 839 | + //--------循环计算商品是不是包邮,是不是使用优惠券,此时循环是商品从表----------- | ||
| 840 | + for(var j=0;j<ord_goods.length;j++){ | ||
| 841 | + if(ord_goods[j].is_gift) continue; | ||
| 842 | + if(ord_goods[j].prom_type==3 && ord_goods[j].prom_id==item_map.prom_id){ | ||
| 843 | + ord_goods[j].is_xz_yh= item_map.is_xz_yh; | ||
| 844 | + ord_goods[j].is_past= item_map.is_past; | ||
| 845 | + ord_goods[j].account_fir= th.item_map_get_goods(ord_goods[j].goods_id,item_map).account_fir; | ||
| 846 | + ord_goods[j].account_yu_fir= th.item_map_get_goods(ord_goods[j].goods_id,item_map).account_yu_fir; | ||
| 847 | + ord_goods[j].account= th.item_map_get_goods(ord_goods[j].goods_id,item_map).account; | ||
| 848 | + ord_goods[j].account_yu= th.item_map_get_goods(ord_goods[j].goods_id,item_map).account_yu; | ||
| 849 | + } | ||
| 850 | + } | ||
| 851 | + | ||
| 852 | + | ||
| 853 | + //--优惠多少钱-- | ||
| 854 | + if(!cart_item.cut_price) cart_item.cut_price=0; | ||
| 855 | + cart_item.cut_price+=(item_map.price-item_map.prom_price); | ||
| 856 | + //---如果有送积分--- | ||
| 857 | + if(item_map.s_intValue){ | ||
| 858 | + if(!cart_item.s_intValue) cart_item.s_intValue=0; | ||
| 859 | + cart_item.s_intValue+=item_map.s_intValue; | ||
| 860 | + } | ||
| 861 | + //-- 如果有送优惠券的情况 -- | ||
| 862 | + if(item_map.s_coupon_id){ | ||
| 863 | + if(!cart_item.s_coupon_id) { | ||
| 864 | + cart_item.s_coupon_id=item_map.s_coupon_id+""; | ||
| 865 | + cart_item.g_coupon_num=[{'c_id':item_map.s_coupon_id,"num": item_map.s_coupon_num}]; | ||
| 866 | + } | ||
| 867 | + else{ | ||
| 868 | + cart_item.s_coupon_id+=","+item_map.s_coupon_id; | ||
| 869 | + cart_item.g_coupon_num.push({'c_id':item_map.s_coupon_id,"num": item_map.s_coupon_num}) | ||
| 870 | + } | ||
| 871 | + } | ||
| 872 | + | ||
| 873 | + //-- 如果有送优包邮券的情况 -- | ||
| 874 | + if(item_map.s_libao){ | ||
| 875 | + if(!cart_item.s_libao) { | ||
| 876 | + cart_item.s_libao=item_map.s_libao+""; | ||
| 877 | + cart_item.g_lb_num=[{'l_id':item_map.s_libao,"num": item_map.s_lb_num}]; | ||
| 878 | + } | ||
| 879 | + else{ | ||
| 880 | + cart_item.s_libao+=","+item_map.s_libao; | ||
| 881 | + cart_item.g_lb_num.push({'l_id':item_map.s_libao,"num": item_map.s_lb_num}) | ||
| 882 | + } | ||
| 883 | + } | ||
| 884 | + } | ||
| 885 | + } | ||
| 886 | + } | ||
| 887 | + }, | ||
| 888 | + | ||
| 742 | //-------------------计算订单价格------------------- | 889 | //-------------------计算订单价格------------------- |
| 743 | calculatePrice: function(t, s) { | 890 | calculatePrice: function(t, s) { |
| 744 | var th = this; | 891 | var th = this; |
| @@ -770,7 +917,17 @@ Page({ | @@ -770,7 +917,17 @@ Page({ | ||
| 770 | } | 917 | } |
| 771 | }) | 918 | }) |
| 772 | }; | 919 | }; |
| 773 | - var c_arr=JSON.parse(JSON.stringify(th.data.old_cartlist)); | 920 | + var c_arr=JSON.parse(JSON.stringify(th.data.old_cartlist)); |
| 921 | + if(th.data.cartlist && th.data.cartlist.length>0){ | ||
| 922 | + for(var i =0;i<c_arr.length;i++){ | ||
| 923 | + c_arr[i].exp_type=th.data.cartlist[i].exp_type; | ||
| 924 | + } | ||
| 925 | + } | ||
| 926 | + | ||
| 927 | + //调用函数计算每件商品的单价 | ||
| 928 | + await th.calc_per(c_arr); | ||
| 929 | + //调用函数计算,优惠券优惠什么商品价格,优惠券优惠什么商品 | ||
| 930 | + await th.get_cart_quan(c_arr); | ||
| 774 | //---循环购物车--- | 931 | //---循环购物车--- |
| 775 | for(var i in c_arr){ | 932 | for(var i in c_arr){ |
| 776 | //因为搭配购买也是再这里计算,搭配购的is_b_now==1 | 933 | //因为搭配购买也是再这里计算,搭配购的is_b_now==1 |
| @@ -798,142 +955,16 @@ Page({ | @@ -798,142 +955,16 @@ Page({ | ||
| 798 | for(var j=0;j<item.length;j++){ | 955 | for(var j=0;j<item.length;j++){ |
| 799 | o_price += item[j].goods_price * item[j].goods_num; | 956 | o_price += item[j].goods_price * item[j].goods_num; |
| 800 | } | 957 | } |
| 958 | + | ||
| 959 | + //如果又优惠的钱,就要减价 | ||
| 960 | + if(c_arr[i].cut_price>0) o_price-=c_arr[i].cut_price; | ||
| 961 | + | ||
| 801 | var f_o_price=o_price; | 962 | var f_o_price=o_price; |
| 802 | 963 | ||
| 803 | //判断包邮券的钱 | 964 | //判断包邮券的钱 |
| 804 | var q_conditin=0; | 965 | var q_conditin=0; |
| 805 | q_conditin=o_price; | 966 | q_conditin=o_price; |
| 806 | - //---如果该门店的相关活动,就要算一下减价-- | ||
| 807 | - if(th.data.prom_goods_map[pickid]){ | ||
| 808 | - var ob=th.data.prom_goods_map[pickid]; | ||
| 809 | - for(var ii in ob){ | ||
| 810 | - var item_map=ob[ii]; | ||
| 811 | - if(item_map.bs==undefined || item_map.bs==null) { | ||
| 812 | - //等待,获取一下优惠活动的信息 | ||
| 813 | - await getApp().request.promiseGet("/api/weshop/goods/getDiscount", { | ||
| 814 | - data: { | ||
| 815 | - price: item_map.price, prom_id: item_map.prom_id, | ||
| 816 | - goods_num: item_map.goods_num, user_id: getApp().globalData.user_id, | ||
| 817 | - is_bz: item_map.is_bz | ||
| 818 | - } | ||
| 819 | - }).then(res => { | ||
| 820 | - if (res.data.code == 0 && res.data.data.condition) { | ||
| 821 | - var get_data = res.data.data; | ||
| 822 | - item_map.is_bz = get_data.is_bz; //是不是倍增 | ||
| 823 | - item_map.bs = get_data.bs; //是不是倍数 | ||
| 824 | - item_map.is_past = get_data.is_past; //是不是包邮 | ||
| 825 | - item_map.prom_price = get_data.price>=0?get_data.price:item_map.price; | ||
| 826 | - item_map.s_intValue = get_data.intValue; | ||
| 827 | - item_map.s_coupon_id = get_data.coupon_id; | ||
| 828 | - item_map.s_coupon_num = get_data.coupon_num; | ||
| 829 | - if(get_data.gift_id && get_data.goodsinfo) { | ||
| 830 | - item_map.gift_id = get_data.gift_id; | ||
| 831 | - item_map.gift_goods_id = get_data.goods_id; | ||
| 832 | - item_map.gift_goods_name = get_data.goods_name; | ||
| 833 | - item_map.gift_goods_color = get_data.goodsinfo.goods_color ? get_data.goodsinfo.goods_color : ''; | ||
| 834 | - item_map.gift_goods_spec = get_data.goodsinfo.goods_spec ? get_data.goodsinfo.goods_spec : ''; | ||
| 835 | - item_map.gift_original_img = get_data.goodsinfo.original_img; | ||
| 836 | - item_map.gift_limit_num = get_data.limit_num; | ||
| 837 | - item_map.gift_storecount = get_data.gift_storecount; | ||
| 838 | - item_map.gift_weight = get_data.goodsinfo.weight; | ||
| 839 | - item_map.gift_exp_sum_type = get_data.goodsinfo.exp_sum_type; | ||
| 840 | - item_map.uniform_exp_sum = get_data.goodsinfo.uniform_exp_sum; | ||
| 841 | - | ||
| 842 | - } | ||
| 843 | - item_map.s_libao = get_data.libao; | ||
| 844 | - item_map.s_lb_num = get_data.lb_num; | ||
| 845 | - } | ||
| 846 | - }) | ||
| 847 | - } | ||
| 848 | - | ||
| 849 | - //有活动,且优惠活动并没有限制使用优惠券,且有减价 | ||
| 850 | - //--看有没有减价-- | ||
| 851 | - //if(item_map.prom_price>=0 && item_map.price-item_map.prom_price){ | ||
| 852 | - if(item_map.price-item_map.prom_price && item_map.prom_price!==null){ | ||
| 853 | - if(cart_item.prom_pt_json){ | ||
| 854 | - cart_item.prom_pt_json.push({"prom_id":item_map.prom_id,"dis":(item_map.price-item_map.prom_price).toFixed(2),"ispt":0}) | ||
| 855 | - }else{ | ||
| 856 | - cart_item.prom_pt_json=[{"prom_id":item_map.prom_id,"dis":(item_map.price-item_map.prom_price).toFixed(2),"ispt":0}]; | ||
| 857 | - } | ||
| 858 | - | ||
| 859 | - //-- 如果系统要平摊到单品 -- | ||
| 860 | - //if(!th.data.ispt_goods){ | ||
| 861 | - var pt_data={ | ||
| 862 | - 'prom_id':item_map.prom_id, | ||
| 863 | - 'dis': parseFloat((item_map.price-item_map.prom_price).toFixed(2)), | ||
| 864 | - 'goods':item_map.goods | ||
| 865 | - } | ||
| 866 | - | ||
| 867 | - var pt_res=null; | ||
| 868 | - await getApp().request.promisePost("/api/weshop/order/getGoodsSplit",{is_json:1,data:pt_data}).then(res=>{ | ||
| 869 | - if(res.data.code==0){ pt_res=res.data.data; } | ||
| 870 | - }) | ||
| 871 | - if(pt_res){ | ||
| 872 | - for (var io in item_map.goods){ | ||
| 873 | - //平摊赋值 | ||
| 874 | - item_map.goods[io].account_fir=th.arr_get_goods(item_map.goods[io].goods_id,pt_res).fisrt_account; | ||
| 875 | - item_map.goods[io].account_yu_fir=th.arr_get_goods(item_map.goods[io].goods_id,pt_res).fisrt_account_yu; | ||
| 876 | - if(!th.data.ispt_goods){ | ||
| 877 | - item_map.goods[io].account=item_map.goods[io].account_fir; | ||
| 878 | - item_map.goods[io].account_yu=item_map.goods[io].account_yu_fir; | ||
| 879 | - } | ||
| 880 | - } | ||
| 881 | - } | ||
| 882 | - // } | ||
| 883 | - | ||
| 884 | - o_price-=(item_map.price-item_map.prom_price); | ||
| 885 | - //如果有限制使用优惠券,就要减掉参与的活动商品的钱 | ||
| 886 | - if(!item_map.is_xz_yh) q_conditin=o_price; | ||
| 887 | - } | ||
| 888 | - | ||
| 889 | - //--------循环计算商品是不是包邮,是不是使用优惠券,此时循环是商品从表----------- | ||
| 890 | - for(var j=0;j<item.length;j++){ | ||
| 891 | - if(item[j].is_gift) continue; | ||
| 892 | - if(item[j].prom_type==3 && item[j].prom_id==item_map.prom_id){ | ||
| 893 | - item[j].is_xz_yh= item_map.is_xz_yh; | ||
| 894 | - item[j].is_past= item_map.is_past; | ||
| 895 | - item[j].account_fir= th.item_map_get_goods(item[j].goods_id,item_map).account_fir; | ||
| 896 | - item[j].account_yu_fir= th.item_map_get_goods(item[j].goods_id,item_map).account_yu_fir; | ||
| 897 | - item[j].account= th.item_map_get_goods(item[j].goods_id,item_map).account; | ||
| 898 | - item[j].account_yu= th.item_map_get_goods(item[j].goods_id,item_map).account_yu; | ||
| 899 | - } | ||
| 900 | - } | ||
| 901 | - | ||
| 902 | - | ||
| 903 | - //--优惠多少钱-- | ||
| 904 | - if(!cart_item.cut_price) cart_item.cut_price=0; | ||
| 905 | - cart_item.cut_price+=(item_map.price-item_map.prom_price); | ||
| 906 | - //---如果有送积分--- | ||
| 907 | - if(item_map.s_intValue){ | ||
| 908 | - if(!cart_item.s_intValue) cart_item.s_intValue=0; | ||
| 909 | - cart_item.s_intValue+=item_map.s_intValue; | ||
| 910 | - } | ||
| 911 | - //-- 如果有送优惠券的情况 -- | ||
| 912 | - if(item_map.s_coupon_id){ | ||
| 913 | - if(!cart_item.s_coupon_id) { | ||
| 914 | - cart_item.s_coupon_id=item_map.s_coupon_id+""; | ||
| 915 | - cart_item.g_coupon_num=[{'c_id':item_map.s_coupon_id,"num": item_map.s_coupon_num}]; | ||
| 916 | - } | ||
| 917 | - else{ | ||
| 918 | - cart_item.s_coupon_id+=","+item_map.s_coupon_id; | ||
| 919 | - cart_item.g_coupon_num.push({'c_id':item_map.s_coupon_id,"num": item_map.s_coupon_num}) | ||
| 920 | - } | ||
| 921 | - } | ||
| 922 | - | ||
| 923 | - //-- 如果有送优包邮券的情况 -- | ||
| 924 | - if(item_map.s_libao){ | ||
| 925 | - if(!cart_item.s_libao) { | ||
| 926 | - cart_item.s_libao=item_map.s_libao+""; | ||
| 927 | - cart_item.g_lb_num=[{'l_id':item_map.s_libao,"num": item_map.s_lb_num}]; | ||
| 928 | - } | ||
| 929 | - else{ | ||
| 930 | - cart_item.s_libao+=","+item_map.s_libao; | ||
| 931 | - cart_item.g_lb_num.push({'l_id':item_map.s_libao,"num": item_map.s_lb_num}) | ||
| 932 | - } | ||
| 933 | - } | ||
| 934 | - } | ||
| 935 | - } | ||
| 936 | - | 967 | + |
| 937 | cart_item.goods_price = f_o_price.toFixed(2); //商品总费用,用f_o_price来计算 | 968 | cart_item.goods_price = f_o_price.toFixed(2); //商品总费用,用f_o_price来计算 |
| 938 | //计算物流费用 | 969 | //计算物流费用 |
| 939 | cart_item.shipping_price = 0; | 970 | cart_item.shipping_price = 0; |
| @@ -993,7 +1024,10 @@ Page({ | @@ -993,7 +1024,10 @@ Page({ | ||
| 993 | } | 1024 | } |
| 994 | 1025 | ||
| 995 | var quan_no=null; | 1026 | var quan_no=null; |
| 996 | - if(th.data.using_quan[pickid])quan_no=th.data.using_quan[pickid].coupon_no; | 1027 | + if(th.data.using_quan[pickid]){ |
| 1028 | + quan_no=th.data.using_quan[pickid].coupon_no; | ||
| 1029 | + } | ||
| 1030 | + | ||
| 997 | //如果是包邮券的时候,要看看券的情况 | 1031 | //如果是包邮券的时候,要看看券的情况 |
| 998 | if(quan_no && th.data.using_quan[pickid].isby==1){ | 1032 | if(quan_no && th.data.using_quan[pickid].isby==1){ |
| 999 | var quan=th.data.using_quan[pickid]; | 1033 | var quan=th.data.using_quan[pickid]; |
| @@ -1069,7 +1103,9 @@ Page({ | @@ -1069,7 +1103,9 @@ Page({ | ||
| 1069 | //计算物流价格 | 1103 | //计算物流价格 |
| 1070 | if (cart_item.exp_type == 0) { | 1104 | if (cart_item.exp_type == 0) { |
| 1071 | freight_free=0; //后面不在进行判断 | 1105 | freight_free=0; //后面不在进行判断 |
| 1072 | - var code = th.data.wu_arr[cart_item.wind].code; | 1106 | + var code = ""; |
| 1107 | + if(th.data.wu_arr && th.data.wu_arr[cart_item.wind]) | ||
| 1108 | + code=th.data.wu_arr[cart_item.wind].code; | ||
| 1073 | cart_item.shipping_price = | 1109 | cart_item.shipping_price = |
| 1074 | th.calculatewuliu(code, o_shipping_price, goods_weight, | 1110 | th.calculatewuliu(code, o_shipping_price, goods_weight, |
| 1075 | goods_piece,th.data.user_addr, freight_free, o_price, rs); | 1111 | goods_piece,th.data.user_addr, freight_free, o_price, rs); |
| @@ -1093,6 +1129,7 @@ Page({ | @@ -1093,6 +1129,7 @@ Page({ | ||
| 1093 | if(quan_no){ | 1129 | if(quan_no){ |
| 1094 | //如果不是包邮券的时候 | 1130 | //如果不是包邮券的时候 |
| 1095 | if(th.data.using_quan[pickid] && th.data.using_quan[pickid].isby!=1) { | 1131 | if(th.data.using_quan[pickid] && th.data.using_quan[pickid].isby!=1) { |
| 1132 | + var ui=2; | ||
| 1096 | //---获取优惠券优惠--- | 1133 | //---获取优惠券优惠--- |
| 1097 | await getApp().request.promiseGet("/api/weshop/couponList/getUseCouponPrice", { | 1134 | await getApp().request.promiseGet("/api/weshop/couponList/getUseCouponPrice", { |
| 1098 | data: { | 1135 | data: { |
| @@ -1335,12 +1372,12 @@ Page({ | @@ -1335,12 +1372,12 @@ Page({ | ||
| 1335 | goods_piece += good['buynum']; break; | 1372 | goods_piece += good['buynum']; break; |
| 1336 | } | 1373 | } |
| 1337 | 1374 | ||
| 1338 | - var code = th.data.wu_arr[th.data.index].code; | 1375 | + var code =""; |
| 1376 | + if(th.data.wu_arr && th.data.wu_arr[th.data.index]) code=th.data.wu_arr[th.data.index].code; | ||
| 1339 | var freight_free = ee.freight_free; //全场满多少包邮 | 1377 | var freight_free = ee.freight_free; //全场满多少包邮 |
| 1340 | var no_ex_id=ee.no_ex_id; | 1378 | var no_ex_id=ee.no_ex_id; |
| 1341 | th.data.is_no_by[th.data.bn_pick]=0; | 1379 | th.data.is_no_by[th.data.bn_pick]=0; |
| 1342 | 1380 | ||
| 1343 | - | ||
| 1344 | var no_by_data=null; | 1381 | var no_by_data=null; |
| 1345 | var gift_freight_free=freight_free; | 1382 | var gift_freight_free=freight_free; |
| 1346 | //有不包邮区域,且不免运费 | 1383 | //有不包邮区域,且不免运费 |
| @@ -2228,6 +2265,7 @@ Page({ | @@ -2228,6 +2265,7 @@ Page({ | ||
| 2228 | if (item == null) return o_shipping_price; | 2265 | if (item == null) return o_shipping_price; |
| 2229 | var fw_price = 0, fp_price=0; | 2266 | var fw_price = 0, fp_price=0; |
| 2230 | item=item.config; | 2267 | item=item.config; |
| 2268 | + if (item == null) return o_shipping_price; | ||
| 2231 | //------按重量---------- | 2269 | //------按重量---------- |
| 2232 | if (goods_weight>=0 && item['money']) { | 2270 | if (goods_weight>=0 && item['money']) { |
| 2233 | fw_price =parseFloat(item['money']); | 2271 | fw_price =parseFloat(item['money']); |
| @@ -2302,13 +2340,19 @@ Page({ | @@ -2302,13 +2340,19 @@ Page({ | ||
| 2302 | 2340 | ||
| 2303 | for(var i in quanlist){ | 2341 | for(var i in quanlist){ |
| 2304 | quanlist[i].is_using= th.check_in_sele(quanlist[i].CashRepNo,pickid); | 2342 | quanlist[i].is_using= th.check_in_sele(quanlist[i].CashRepNo,pickid); |
| 2305 | - if(!t_user || quanlist[i].CashRepNo!=t_user.coupon_no) quanlist[i].show_red=0; | 2343 | + if(t_user && quanlist[i].CashRepNo==t_user.coupon_no) |
| 2344 | + quanlist[i].show_red=1; | ||
| 2345 | + else | ||
| 2346 | + quanlist[i].show_red=0; | ||
| 2306 | } | 2347 | } |
| 2307 | 2348 | ||
| 2308 | if(get_by_quan_list_cart){ | 2349 | if(get_by_quan_list_cart){ |
| 2309 | for(var i in get_by_quan_list_cart){ | 2350 | for(var i in get_by_quan_list_cart){ |
| 2310 | get_by_quan_list_cart[i].is_using= th.check_in_sele(get_by_quan_list_cart[i].no,pickid); | 2351 | get_by_quan_list_cart[i].is_using= th.check_in_sele(get_by_quan_list_cart[i].no,pickid); |
| 2311 | - if(!t_user || get_by_quan_list_cart[i].no!=t_user.coupon_no) get_by_quan_list_cart[i].show_red=0; | 2352 | + if(t_user && get_by_quan_list_cart[i].no==t_user.coupon_no) |
| 2353 | + get_by_quan_list_cart[i].show_red=1; | ||
| 2354 | + else | ||
| 2355 | + get_by_quan_list_cart[i].show_red=0; | ||
| 2312 | } | 2356 | } |
| 2313 | th.setData({by_quan_list_cart:get_by_quan_list_cart}); | 2357 | th.setData({by_quan_list_cart:get_by_quan_list_cart}); |
| 2314 | }else { | 2358 | }else { |
| @@ -2744,12 +2788,13 @@ Page({ | @@ -2744,12 +2788,13 @@ Page({ | ||
| 2744 | },500); | 2788 | },500); |
| 2745 | }, | 2789 | }, |
| 2746 | //-----获取购物车进来的劵------- | 2790 | //-----获取购物车进来的劵------- |
| 2747 | - get_cart_quan:function () { | 2791 | + get_cart_quan:async function (order_prom_list_cart) { |
| 2748 | var th=this; | 2792 | var th=this; |
| 2749 | var is_xz_yh=1; | 2793 | var is_xz_yh=1; |
| 2750 | //等待值的出现 | 2794 | //等待值的出现 |
| 2751 | - getApp().waitfor2(this,"g_cart_q_time","order_prom_list_cart",async function () { | ||
| 2752 | - var arr=th.data.order_prom_list_cart; | 2795 | + //getApp().waitfor2(this,"g_cart_q_time","order_prom_list_cart",async function () { |
| 2796 | + //var arr=th.data.order_prom_list_cart; | ||
| 2797 | + var arr=order_prom_list_cart; | ||
| 2753 | //如果系统有限制使用优惠券 | 2798 | //如果系统有限制使用优惠券 |
| 2754 | if(th.data.is_close_quan) return false; | 2799 | if(th.data.is_close_quan) return false; |
| 2755 | //------------开始计算使用优惠券相关------------ | 2800 | //------------开始计算使用优惠券相关------------ |
| @@ -2828,7 +2873,7 @@ Page({ | @@ -2828,7 +2873,7 @@ Page({ | ||
| 2828 | th.set_can_num(); | 2873 | th.set_can_num(); |
| 2829 | } | 2874 | } |
| 2830 | 2875 | ||
| 2831 | - }) | 2876 | + //}) |
| 2832 | }, | 2877 | }, |
| 2833 | 2878 | ||
| 2834 | //------ 获取立即购买的购物车的劵 -------- | 2879 | //------ 获取立即购买的购物车的劵 -------- |
pages/user/assistance/task_assistance.js
| @@ -557,7 +557,8 @@ Page({ | @@ -557,7 +557,8 @@ Page({ | ||
| 557 | taskid: task_id, | 557 | taskid: task_id, |
| 558 | is_dismantle: 0, | 558 | is_dismantle: 0, |
| 559 | is_clik: 1, | 559 | is_clik: 1, |
| 560 | - bc_page: 1 | 560 | + bc_page: 1, |
| 561 | + giftQty:aitem[index].giftQty | ||
| 561 | }) | 562 | }) |
| 562 | if (this.data.switch_head == 1) { | 563 | if (this.data.switch_head == 1) { |
| 563 | //判断有没有帮拆记录 | 564 | //判断有没有帮拆记录 |
| @@ -589,6 +590,7 @@ Page({ | @@ -589,6 +590,7 @@ Page({ | ||
| 589 | taskid: task_id, | 590 | taskid: task_id, |
| 590 | is_dismantle: 0, | 591 | is_dismantle: 0, |
| 591 | bc_page: 1, | 592 | bc_page: 1, |
| 593 | + giftQty:aitem[index].giftQty | ||
| 592 | }) | 594 | }) |
| 593 | if (this.data.switch_head == 1) { | 595 | if (this.data.switch_head == 1) { |
| 594 | this.dismantle_record(); | 596 | this.dismantle_record(); |