Commit f2ce552a1366088ebcf1a120f426cc463829b69d
1 parent
4fe1c3b3
1、拼团能购使用优惠券
2、OA单
Showing
13 changed files
with
1829 additions
and
242 deletions
packageE/pages/cart/cart2_pt/cart2_pt.js
| @@ -77,6 +77,19 @@ Page({ | @@ -77,6 +77,19 @@ Page({ | ||
| 77 | bconfig:null, | 77 | bconfig:null, |
| 78 | showFold:true, | 78 | showFold:true, |
| 79 | template_id:[], | 79 | template_id:[], |
| 80 | + | ||
| 81 | + //--更优惠券抵用有关,立即购买的,如果是购物车,就要把相应的值,写入cartlist数组中-- | ||
| 82 | + ckeck_quan_price: 0, | ||
| 83 | + check_quan_price_list: '', | ||
| 84 | + check_quan_ware_list: '', | ||
| 85 | + | ||
| 86 | + // 设计一个数组来存放已经选择了的券编号,coupon_no是券号,money是面值,coupon_price是真正优惠的价格,数组的下标是pickid | ||
| 87 | + //using_quan[11]={coupon_no:"1212121",money:"20",coupon_price:"45"} | ||
| 88 | + using_quan: {}, | ||
| 89 | + //如果是全场包邮了,或者是全场不包邮了,就不要选包邮券 | ||
| 90 | + is_no_by: {}, | ||
| 91 | + is_by: {}, | ||
| 92 | + is_quan_by: {}, | ||
| 80 | }, | 93 | }, |
| 81 | 94 | ||
| 82 | 95 | ||
| @@ -483,6 +496,10 @@ Page({ | @@ -483,6 +496,10 @@ Page({ | ||
| 483 | } else { | 496 | } else { |
| 484 | 497 | ||
| 485 | 498 | ||
| 499 | + th.data.ckeck_quan_price = t.data.data.shop_price * gg.goods_num; | ||
| 500 | + th.data.check_quan_price_list = t.data.data.shop_price * gg.goods_num + ""; | ||
| 501 | + th.data.check_quan_ware_list = t.data.data.erpwareid + ""; | ||
| 502 | + | ||
| 486 | gd.prom_id=gg.prom_id; | 503 | gd.prom_id=gg.prom_id; |
| 487 | //--阶梯团很特殊,不能用总表来拿价格-- | 504 | //--阶梯团很特殊,不能用总表来拿价格-- |
| 488 | getApp().request.get("/api/weshop/teamlist/get/" + oo.stoid + "/" + gd.prom_id, { | 505 | getApp().request.get("/api/weshop/teamlist/get/" + oo.stoid + "/" + gd.prom_id, { |
| @@ -510,6 +527,15 @@ Page({ | @@ -510,6 +527,15 @@ Page({ | ||
| 510 | t.data.data.commission = tt.data.data.commission; | 527 | t.data.data.commission = tt.data.data.commission; |
| 511 | 528 | ||
| 512 | 529 | ||
| 530 | + if (!tt.data.data.is_quan || pt_data.kttype == 3) { | ||
| 531 | + | ||
| 532 | + th.data.ckeck_quan_price = 0; | ||
| 533 | + th.data.check_quan_price_list = ""; | ||
| 534 | + th.data.check_quan_ware_list = ""; | ||
| 535 | + gd.is_xz_yh = 1; | ||
| 536 | + } | ||
| 537 | + | ||
| 538 | + | ||
| 513 | 539 | ||
| 514 | if (pt_data.kttype == 3) { | 540 | if (pt_data.kttype == 3) { |
| 515 | t.data.data.shop_price = tt.data.data.yf_price; //用定金来购买 | 541 | t.data.data.shop_price = tt.data.data.yf_price; //用定金来购买 |
| @@ -566,14 +592,15 @@ Page({ | @@ -566,14 +592,15 @@ Page({ | ||
| 566 | } | 592 | } |
| 567 | 593 | ||
| 568 | 594 | ||
| 569 | - th.setData({ | ||
| 570 | - bn_goods: t.data.data, bn_pickname: gg.pick_name, | ||
| 571 | - bn_pick: gg.pick_id, bn_t_exp_t: distr_t, bn_exp_type: et | ||
| 572 | - }); | 595 | + th.setData({ |
| 596 | + bn_goods: t.data.data, bn_pickname: gg.pick_name, | ||
| 597 | + bn_pick: gg.pick_id, bn_t_exp_t: distr_t, bn_exp_type: et | ||
| 598 | + }); | ||
| 573 | 599 | ||
| 574 | 600 | ||
| 575 | - //计算价格 | ||
| 576 | - th.calculatePrice2(); | 601 | + //计算价格 |
| 602 | + th.calculatePrice2(); | ||
| 603 | + th.get_buy_now_quan(); | ||
| 577 | } | 604 | } |
| 578 | }); | 605 | }); |
| 579 | } | 606 | } |
| @@ -631,11 +658,13 @@ Page({ | @@ -631,11 +658,13 @@ Page({ | ||
| 631 | this.getuser_addr(function (ie) { | 658 | this.getuser_addr(function (ie) { |
| 632 | //更换地址回来要重新调用计算价钱的接口 | 659 | //更换地址回来要重新调用计算价钱的接口 |
| 633 | 660 | ||
| 634 | - if (!th.data.user_addr || th.data.user_addr.address_id != ie.address_id) { | 661 | + if (!th.data.user_addr || !ie || th.data.user_addr.address_id != ie.address_id) { |
| 635 | th.setData({ add_back: 1,same_ok:1 }); | 662 | th.setData({ add_back: 1,same_ok:1 }); |
| 636 | //if (th.data.bn_goods) th.calculatePrice2(); | 663 | //if (th.data.bn_goods) th.calculatePrice2(); |
| 637 | } | 664 | } |
| 638 | th.setData({ user_addr: ie,show_btn:0 }); | 665 | th.setData({ user_addr: ie,show_btn:0 }); |
| 666 | + | ||
| 667 | + th.data.isget_by_quan = {}; | ||
| 639 | }) | 668 | }) |
| 640 | //--更新默认地址--,看一下是不是跳到地址页面 | 669 | //--更新默认地址--,看一下是不是跳到地址页面 |
| 641 | if (!getApp().globalData.is_cart_old) { | 670 | if (!getApp().globalData.is_cart_old) { |
| @@ -764,9 +793,45 @@ Page({ | @@ -764,9 +793,45 @@ Page({ | ||
| 764 | var o_shipping_price = 0, goods_weight = -1, goods_piece = -1; | 793 | var o_shipping_price = 0, goods_weight = -1, goods_piece = -1; |
| 765 | var out_of_weight = null; //超出多少重量 | 794 | var out_of_weight = null; //超出多少重量 |
| 766 | 795 | ||
| 796 | + | ||
| 797 | + | ||
| 798 | + | ||
| 799 | + //---如果有选择优惠券的情况下--- | ||
| 800 | + var quan_price = 0, bn_pick = th.data.bn_pick; | ||
| 801 | + var quan_no = null; | ||
| 802 | + if (th.data.using_quan[bn_pick] != null && th.data.using_quan[bn_pick] != undefined) | ||
| 803 | + quan_no = th.data.using_quan[bn_pick].coupon_no; | ||
| 804 | + | ||
| 805 | + if (quan_no) { | ||
| 806 | + //如果是一件代发就不要找商品 | ||
| 807 | + if (th.data.using_quan[bn_pick].isby != 1) { | ||
| 808 | + //---获取优惠券优惠--- | ||
| 809 | + await getApp().request.promiseGet("/api/weshop/couponList/getUseCouponPrice", { | ||
| 810 | + data: { | ||
| 811 | + storeId: oo.stoid, | ||
| 812 | + CashRepNo: quan_no, | ||
| 813 | + WaresSum: th.data.ckeck_quan_price, | ||
| 814 | + WareIds: th.data.check_quan_ware_list | ||
| 815 | + } | ||
| 816 | + }).then(res => { | ||
| 817 | + | ||
| 818 | + if (res.data.code == 0 && res.data.data && res.data.data.length > 0) { | ||
| 819 | + quan_price = res.data.data[0].WareCashSum; | ||
| 820 | + | ||
| 821 | + allpice=allpice-quan_price; | ||
| 822 | + | ||
| 823 | + } | ||
| 824 | + }) | ||
| 825 | + } | ||
| 826 | + } | ||
| 827 | + | ||
| 767 | //-- 判断订单优惠的叠加 -- | 828 | //-- 判断订单优惠的叠加 -- |
| 768 | var ord_prom=null; | 829 | var ord_prom=null; |
| 769 | var o_condition=allpice; | 830 | var o_condition=allpice; |
| 831 | + var pickid = th.data.bn_pick; | ||
| 832 | + | ||
| 833 | + | ||
| 834 | + | ||
| 770 | if(th.data.bn_is_order_yh && th.data.kt_type != 3 ){ | 835 | if(th.data.bn_is_order_yh && th.data.kt_type != 3 ){ |
| 771 | 836 | ||
| 772 | await getApp().request.promiseGet("/api/weshop/promorder/getOrderPromotion", { | 837 | await getApp().request.promiseGet("/api/weshop/promorder/getOrderPromotion", { |
| @@ -781,6 +846,40 @@ Page({ | @@ -781,6 +846,40 @@ Page({ | ||
| 781 | //-----------当地址不为空,且是物流时,计算物流费用,同时阶梯团不计算拼团价格---------- | 846 | //-----------当地址不为空,且是物流时,计算物流费用,同时阶梯团不计算拼团价格---------- |
| 782 | if (th.data.user_addr != null && th.data.bn_exp_type == 0 && (th.data.kt_type != 3 || th.data.bn_goods.is_normal == 1)) { | 847 | if (th.data.user_addr != null && th.data.bn_exp_type == 0 && (th.data.kt_type != 3 || th.data.bn_goods.is_normal == 1)) { |
| 783 | 848 | ||
| 849 | + //看是不是有调用过包邮券 | ||
| 850 | + if (!th.data.isget_by_quan[th.data.bn_pick] && good.is_xz_yh != 1) { | ||
| 851 | + | ||
| 852 | + //--判断要不要显示包邮券,链式调用接口,调取包邮券,已经是减了优惠的金额,见到优惠券的钱--- | ||
| 853 | + getApp().request.promiseGet("/api/weshop/userfeemail/pageAndArea", { | ||
| 854 | + data: { | ||
| 855 | + store_id: os.stoid, | ||
| 856 | + isuse: 0, | ||
| 857 | + condition: o_condition, | ||
| 858 | + user_id: getApp().globalData.user_id, | ||
| 859 | + pageSize: 2000 | ||
| 860 | + } | ||
| 861 | + }).then(res => { | ||
| 862 | + if (res.data.code == 0 && res.data.data.total > 0) { | ||
| 863 | + //此时要循环判断包邮的地区,不包邮商品是不是符合 | ||
| 864 | + var arr = [], quanlist = res.data.data.pageData; | ||
| 865 | + quanlist = th.check_is_frozenQuan(quanlist, th.data.frozenQuan, 1); | ||
| 866 | + for (var i in quanlist) { | ||
| 867 | + var item = quanlist[i]; | ||
| 868 | + if (item.region_list && th.check_by_area(item.region_list)) continue; //如果是不包邮区域 | ||
| 869 | + if (item.goods_list) { | ||
| 870 | + var no_goods_arr = item.goods_list.split(","); | ||
| 871 | + if (ut.isContained(no_goods_arr, gd_arr_list)) continue; //如果是不包邮商品 | ||
| 872 | + } | ||
| 873 | + arr.push(item); | ||
| 874 | + } | ||
| 875 | + if (arr) { | ||
| 876 | + th.setData({ get_by_quan_list: arr }); | ||
| 877 | + } | ||
| 878 | + th.data.isget_by_quan[th.data.bn_pick] = 1; | ||
| 879 | + } | ||
| 880 | + }) | ||
| 881 | + } | ||
| 882 | + | ||
| 784 | if(good.is_free_shipping){ | 883 | if(good.is_free_shipping){ |
| 785 | var wl_txt = "formData.shipping_price"; | 884 | var wl_txt = "formData.shipping_price"; |
| 786 | th.setData({ [wl_txt]: 0 }) | 885 | th.setData({ [wl_txt]: 0 }) |
| @@ -791,6 +890,7 @@ Page({ | @@ -791,6 +890,7 @@ Page({ | ||
| 791 | wuliu: parseFloat(allpice).toFixed(2), store_id: os.stoid | 890 | wuliu: parseFloat(allpice).toFixed(2), store_id: os.stoid |
| 792 | } | 891 | } |
| 793 | var back_data = null; | 892 | var back_data = null; |
| 893 | + var quan_no_goods_arr=null; | ||
| 794 | 894 | ||
| 795 | if(!ord_prom || ord_prom.is_post_temp) { | 895 | if(!ord_prom || ord_prom.is_post_temp) { |
| 796 | if (th.data.bn_is_post_temp || th.data.bn_goods.is_normal == 1) { | 896 | if (th.data.bn_is_post_temp || th.data.bn_goods.is_normal == 1) { |
| @@ -802,108 +902,142 @@ Page({ | @@ -802,108 +902,142 @@ Page({ | ||
| 802 | } | 902 | } |
| 803 | } | 903 | } |
| 804 | 904 | ||
| 805 | - var gd_arr_list = []; | ||
| 806 | - gd_arr_list.push(good); | ||
| 807 | - var cut_good_weight = 0; | ||
| 808 | - for (let i in gd_arr_list) { | ||
| 809 | - let item = gd_arr_list[i]; | ||
| 810 | - | ||
| 811 | - if (back_data && back_data['is_by_all'] && (!back_data.no_free_goods || back_data.no_free_goods.indexOf(item.goods_id) == -1)) { | 905 | + var is_by_quan = 0; |
| 906 | + //如果是包邮券的时候,要看看券的情况,判断一下包邮有没有不包邮模板 | ||
| 907 | + if (quan_no && th.data.using_quan[pickid].isby == 1) { | ||
| 908 | + var quan = th.data.using_quan[pickid]; | ||
| 909 | + if (quan.goods_list) { | ||
| 910 | + quan_no_goods_arr = quan.goods_list.split(","); | ||
| 911 | + } else { | ||
| 912 | + is_by_quan = 1; | ||
| 913 | + } | ||
| 914 | + } | ||
| 812 | 915 | ||
| 813 | - if (item['exp_sum_type'] == 2 && back_data.weight_free > 0) { | ||
| 814 | - if (goods_weight < 0) goods_weight = 0; | ||
| 815 | - cut_good_weight += item['weight'] * item['buynum']; | ||
| 816 | - goods_weight += item['weight'] * item['buynum']; | ||
| 817 | - } | ||
| 818 | - if (back_data.weight_free > 0) { | ||
| 819 | - out_of_weight = (back_data.weight_free * 1000) - cut_good_weight; | ||
| 820 | - } | ||
| 821 | - continue; | 916 | + //如果有包邮券的不包邮商品的时候 |
| 917 | + if (quan_no_goods_arr) { | ||
| 918 | + if (back_data && back_data.no_free_goods) { | ||
| 919 | + back_data['is_by_all'] = 1; | ||
| 920 | + var arr3 = back_data.no_free_goods.filter(item => { | ||
| 921 | + return quan_no_goods_arr.includes(item) | ||
| 922 | + }) | ||
| 923 | + back_data.no_free_goods = null; | ||
| 924 | + if (arr3.length) { | ||
| 925 | + back_data.no_free_goods = arr3; | ||
| 822 | } | 926 | } |
| 927 | + } | ||
| 928 | + if (!back_data || !back_data.no_free_goods) { | ||
| 929 | + if (!back_data) back_data = {}; | ||
| 930 | + back_data['is_by_all'] = 1; | ||
| 931 | + back_data['no_free_goods'] = quan_no_goods_arr; | ||
| 932 | + } | ||
| 933 | + } | ||
| 934 | + | ||
| 935 | + | ||
| 936 | + if(!is_by_quan){ | ||
| 937 | + var gd_arr_list = []; | ||
| 938 | + gd_arr_list.push(good); | ||
| 939 | + var cut_good_weight = 0; | ||
| 940 | + for (let i in gd_arr_list) { | ||
| 941 | + let item = gd_arr_list[i]; | ||
| 823 | 942 | ||
| 824 | - switch (item['exp_sum_type']) { | ||
| 825 | - case 1: | ||
| 826 | - //统一运费 | ||
| 827 | - o_shipping_price += item['uniform_exp_sum']; | ||
| 828 | - break; | ||
| 829 | - case 2: | ||
| 830 | - if (goods_weight < 0) goods_weight = 0; | ||
| 831 | - //累积商品重量 每种商品的重量 * 数量 | ||
| 832 | - goods_weight += item['weight'] * item['buynum']; | ||
| 833 | - | ||
| 834 | - if (back_data && back_data.is_by_all && !back_data.no_free_goods) { | 943 | + if (back_data && back_data['is_by_all'] && (!back_data.no_free_goods || back_data.no_free_goods.indexOf(item.goods_id) == -1)) { |
| 944 | + | ||
| 945 | + if (item['exp_sum_type'] == 2 && back_data.weight_free > 0) { | ||
| 946 | + if (goods_weight < 0) goods_weight = 0; | ||
| 835 | cut_good_weight += item['weight'] * item['buynum']; | 947 | cut_good_weight += item['weight'] * item['buynum']; |
| 836 | - if (back_data.weight_free > 0) { | ||
| 837 | - out_of_weight = (back_data.weight_free * 1000) - cut_good_weight; | ||
| 838 | - } | 948 | + goods_weight += item['weight'] * item['buynum']; |
| 839 | } | 949 | } |
| 840 | - break; | ||
| 841 | - case 3: | ||
| 842 | - if (goods_piece < 0) goods_piece = 0; | ||
| 843 | - //累积商品数量 | ||
| 844 | - goods_piece += item['buynum']; | ||
| 845 | - break; | ||
| 846 | - } | ||
| 847 | - } | 950 | + if (back_data.weight_free > 0) { |
| 951 | + out_of_weight = (back_data.weight_free * 1000) - cut_good_weight; | ||
| 952 | + } | ||
| 953 | + continue; | ||
| 954 | + } | ||
| 848 | 955 | ||
| 849 | - //如果是正值的时候 | ||
| 850 | - if (out_of_weight >= 0) out_of_weight = -cut_good_weight; | ||
| 851 | - else out_of_weight = -back_data.weight_free * 1000; | 956 | + switch (item['exp_sum_type']) { |
| 957 | + case 1: | ||
| 958 | + //统一运费 | ||
| 959 | + o_shipping_price += item['uniform_exp_sum']; | ||
| 960 | + break; | ||
| 961 | + case 2: | ||
| 962 | + if (goods_weight < 0) goods_weight = 0; | ||
| 963 | + //累积商品重量 每种商品的重量 * 数量 | ||
| 964 | + goods_weight += item['weight'] * item['buynum']; | ||
| 965 | + | ||
| 966 | + if (back_data && back_data.is_by_all && !back_data.no_free_goods) { | ||
| 967 | + cut_good_weight += item['weight'] * item['buynum']; | ||
| 968 | + if (back_data.weight_free > 0) { | ||
| 969 | + out_of_weight = (back_data.weight_free * 1000) - cut_good_weight; | ||
| 970 | + } | ||
| 971 | + } | ||
| 972 | + break; | ||
| 973 | + case 3: | ||
| 974 | + if (goods_piece < 0) goods_piece = 0; | ||
| 975 | + //累积商品数量 | ||
| 976 | + goods_piece += item['buynum']; | ||
| 977 | + break; | ||
| 978 | + } | ||
| 979 | + } | ||
| 852 | 980 | ||
| 981 | + //如果是正值的时候 | ||
| 982 | + if (out_of_weight >= 0) out_of_weight = -cut_good_weight; | ||
| 983 | + else out_of_weight = -back_data.weight_free * 1000; | ||
| 853 | 984 | ||
| 854 | - if(!th.data.wu_arr){ | ||
| 855 | - wx.hideLoading(); | ||
| 856 | - wx.showToast({ | ||
| 857 | - title: "物流配置未启用物流公司", icon: 'none', duration: 2000 | ||
| 858 | - }) | ||
| 859 | - //th.setData({ show_submit:0, }); | ||
| 860 | - th.setData({show_submit:1, submit: 0,same_ok:0 }) | ||
| 861 | - return false; | ||
| 862 | - } | ||
| 863 | 985 | ||
| 864 | - var code = th.data.wu_arr[th.data.index].code; | ||
| 865 | - | ||
| 866 | - //--------------开始计算物流------------------ | ||
| 867 | - var shipping_price = 0; | ||
| 868 | - // var shipping_price = ut.calculatewuliu(code, o_shipping_price, goods_weight, out_of_weight, | ||
| 869 | - // goods_piece, th.data.user_addr, back_data, rs); | ||
| 870 | - | ||
| 871 | - var w_data = { | ||
| 872 | - store_id: os.stoid, code: code, | ||
| 873 | - o_shipping_price: o_shipping_price, | ||
| 874 | - goods_weight: goods_weight, | ||
| 875 | - out_of_weight: out_of_weight, goods_piece: goods_piece, | ||
| 876 | - user_addr_province: th.data.user_addr.province, | ||
| 877 | - user_addr_city: th.data.user_addr.city, | ||
| 878 | - user_addr_district: th.data.user_addr.district, | ||
| 879 | - is_by_all: back_data && back_data.is_by_all ? 1 : 0, | ||
| 880 | - no_free_goods: back_data && back_data.no_free_goods && back_data.no_free_goods.length > 0 ? 1 : 0, | ||
| 881 | - } | 986 | + if(!th.data.wu_arr){ |
| 987 | + wx.hideLoading(); | ||
| 988 | + wx.showToast({ | ||
| 989 | + title: "物流配置未启用物流公司", icon: 'none', duration: 2000 | ||
| 990 | + }) | ||
| 991 | + //th.setData({ show_submit:0, }); | ||
| 992 | + th.setData({show_submit:1, submit: 0,same_ok:0 }) | ||
| 993 | + return false; | ||
| 994 | + } | ||
| 882 | 995 | ||
| 883 | - var is_ok = 0; | ||
| 884 | - await getApp().request.promisePost('/api/weshop/order/getOrderWuLiPrice', { | ||
| 885 | - data: w_data, | ||
| 886 | - is_json: 1 | ||
| 887 | - }).then(res => { | ||
| 888 | - if (res.data.code == 0) { | ||
| 889 | - shipping_price = res.data.data; | ||
| 890 | - is_ok = 1; | 996 | + var code = th.data.wu_arr[th.data.index].code; |
| 997 | + | ||
| 998 | + //--------------开始计算物流------------------ | ||
| 999 | + var shipping_price = 0; | ||
| 1000 | + // var shipping_price = ut.calculatewuliu(code, o_shipping_price, goods_weight, out_of_weight, | ||
| 1001 | + // goods_piece, th.data.user_addr, back_data, rs); | ||
| 1002 | + | ||
| 1003 | + var w_data = { | ||
| 1004 | + store_id: os.stoid, code: code, | ||
| 1005 | + o_shipping_price: o_shipping_price, | ||
| 1006 | + goods_weight: goods_weight, | ||
| 1007 | + out_of_weight: out_of_weight, goods_piece: goods_piece, | ||
| 1008 | + user_addr_province: th.data.user_addr.province, | ||
| 1009 | + user_addr_city: th.data.user_addr.city, | ||
| 1010 | + user_addr_district: th.data.user_addr.district, | ||
| 1011 | + is_by_all: back_data && back_data.is_by_all ? 1 : 0, | ||
| 1012 | + no_free_goods: back_data && back_data.no_free_goods && back_data.no_free_goods.length > 0 ? 1 : 0, | ||
| 891 | } | 1013 | } |
| 892 | - }) | ||
| 893 | - if (!is_ok) { | ||
| 894 | - wx.hideLoading(); | ||
| 895 | - wx.showToast({ | ||
| 896 | - title: "计算物流错误", icon: 'none', duration: 2000 | 1014 | + |
| 1015 | + var is_ok = 0; | ||
| 1016 | + await getApp().request.promisePost('/api/weshop/order/getOrderWuLiPrice', { | ||
| 1017 | + data: w_data, | ||
| 1018 | + is_json: 1 | ||
| 1019 | + }).then(res => { | ||
| 1020 | + if (res.data.code == 0) { | ||
| 1021 | + shipping_price = res.data.data; | ||
| 1022 | + is_ok = 1; | ||
| 1023 | + } | ||
| 897 | }) | 1024 | }) |
| 898 | - //th.setData({ show_submit:0 }); | ||
| 899 | - th.setData({show_submit:1, submit: 0,same_ok:0 }) | 1025 | + if (!is_ok) { |
| 1026 | + wx.hideLoading(); | ||
| 1027 | + wx.showToast({ | ||
| 1028 | + title: "计算物流错误", icon: 'none', duration: 2000 | ||
| 1029 | + }) | ||
| 1030 | + //th.setData({ show_submit:0 }); | ||
| 1031 | + th.setData({show_submit:1, submit: 0,same_ok:0 }) | ||
| 1032 | + | ||
| 1033 | + return false; | ||
| 1034 | + } | ||
| 900 | 1035 | ||
| 901 | - return false; | ||
| 902 | - } | 1036 | + shipping_price = parseFloat(shipping_price).toFixed(2); |
| 1037 | + var wl_txt = "formData.shipping_price"; | ||
| 1038 | + th.setData({ [wl_txt]: shipping_price, }) | ||
| 903 | 1039 | ||
| 904 | - shipping_price = parseFloat(shipping_price).toFixed(2); | ||
| 905 | - var wl_txt = "formData.shipping_price"; | ||
| 906 | - th.setData({ [wl_txt]: shipping_price, }) | 1040 | + } |
| 907 | } | 1041 | } |
| 908 | } else if (th.data.bn_exp_type == 1) { | 1042 | } else if (th.data.bn_exp_type == 1) { |
| 909 | var wl_txt = "formData.shipping_price"; | 1043 | var wl_txt = "formData.shipping_price"; |
| @@ -1140,6 +1274,9 @@ Page({ | @@ -1140,6 +1274,9 @@ Page({ | ||
| 1140 | } | 1274 | } |
| 1141 | 1275 | ||
| 1142 | 1276 | ||
| 1277 | + | ||
| 1278 | + var txt3 = "formData.coupon_price"; | ||
| 1279 | + | ||
| 1143 | if (th.data.bn_use_commission) { | 1280 | if (th.data.bn_use_commission) { |
| 1144 | order_m = (parseFloat(order_m) - parseFloat(th.data.bn_goods.use_commission)).toFixed(2); | 1281 | order_m = (parseFloat(order_m) - parseFloat(th.data.bn_goods.use_commission)).toFixed(2); |
| 1145 | th.setData({ [txt4]: th.data.bn_goods.use_commission }) | 1282 | th.setData({ [txt4]: th.data.bn_goods.use_commission }) |
| @@ -1148,14 +1285,14 @@ Page({ | @@ -1148,14 +1285,14 @@ Page({ | ||
| 1148 | //--------------如果使用余额--------------------- | 1285 | //--------------如果使用余额--------------------- |
| 1149 | if (th.data.bn_use_money == 1 && th.data.yuer > 0) { | 1286 | if (th.data.bn_use_money == 1 && th.data.yuer > 0) { |
| 1150 | if (parseFloat(th.data.yuer) > parseFloat(order_m)) { | 1287 | if (parseFloat(th.data.yuer) > parseFloat(order_m)) { |
| 1151 | - th.setData({ [txt]: order_m, [txt2]: 0, submit: 0, show_btn: 1 }) | 1288 | + th.setData({ [txt]: order_m, [txt2]: 0, [txt3]:quan_price,submit: 0, show_btn: 1 }) |
| 1152 | } else { | 1289 | } else { |
| 1153 | order_m = parseFloat(order_m) - parseFloat(th.data.yuer); | 1290 | order_m = parseFloat(order_m) - parseFloat(th.data.yuer); |
| 1154 | order_m = order_m.toFixed(2); | 1291 | order_m = order_m.toFixed(2); |
| 1155 | - th.setData({ [txt]: th.data.yuer, [txt2]: order_m, submit: 0, show_btn: 1 }) | 1292 | + th.setData({ [txt]: th.data.yuer, [txt2]: order_m,[txt3]:quan_price, submit: 0, show_btn: 1 }) |
| 1156 | } | 1293 | } |
| 1157 | } else { | 1294 | } else { |
| 1158 | - th.setData({ [txt]: 0, [txt2]: order_m, submit: 0, show_btn: 1 }) | 1295 | + th.setData({ [txt]: 0, [txt2]: order_m,[txt3]:quan_price, submit: 0, show_btn: 1 }) |
| 1159 | } | 1296 | } |
| 1160 | 1297 | ||
| 1161 | wx.hideLoading(); | 1298 | wx.hideLoading(); |
| @@ -1268,6 +1405,17 @@ Page({ | @@ -1268,6 +1405,17 @@ Page({ | ||
| 1268 | item['shipping_name'] = th.data.bn_exp_type == 1 ? '' : th.data.wu_arr[th.data.index].name; | 1405 | item['shipping_name'] = th.data.bn_exp_type == 1 ? '' : th.data.wu_arr[th.data.index].name; |
| 1269 | } | 1406 | } |
| 1270 | 1407 | ||
| 1408 | + | ||
| 1409 | + //组装优惠券的钱 | ||
| 1410 | + if (parseFloat(th.data.formData.coupon_price) > 0) { | ||
| 1411 | + item.coupon_price = th.data.formData.coupon_price; | ||
| 1412 | + item.coupon_no = th.data.using_quan[th.data.bn_pick].coupon_no; | ||
| 1413 | + } | ||
| 1414 | + if (th.data.using_quan[th.data.bn_pick] && th.data.using_quan[th.data.bn_pick].coupon_no && th.data.using_quan[th.data.bn_pick].isby) { | ||
| 1415 | + item.coupon_no = th.data.using_quan[th.data.bn_pick].coupon_no; | ||
| 1416 | + item.coupon_price = 0; | ||
| 1417 | + } | ||
| 1418 | + | ||
| 1271 | if (!th.data.bn_goods.is_normal) { | 1419 | if (!th.data.bn_goods.is_normal) { |
| 1272 | item.is_zsorder = th.data.kt_type + 1; //开团类型 | 1420 | item.is_zsorder = th.data.kt_type + 1; //开团类型 |
| 1273 | } | 1421 | } |
| @@ -1681,5 +1829,428 @@ Page({ | @@ -1681,5 +1829,428 @@ Page({ | ||
| 1681 | buycard: function () { | 1829 | buycard: function () { |
| 1682 | getApp().goto("/pages/user/plus/plus"); | 1830 | getApp().goto("/pages/user/plus/plus"); |
| 1683 | getApp().globalData.plus_buy_back = 1; | 1831 | getApp().globalData.plus_buy_back = 1; |
| 1684 | - } | 1832 | + }, |
| 1833 | + | ||
| 1834 | + //------ 获取立即购买的购物车的劵 -------- | ||
| 1835 | + get_buy_now_quan: function () { | ||
| 1836 | + var quanlist = null, th = this, frozenQuan = null; | ||
| 1837 | + var good = this.data.bn_goods; | ||
| 1838 | + | ||
| 1839 | + //一件代发商品不使用优惠券 | ||
| 1840 | + if (good.whsle_id) return false; | ||
| 1841 | + if(!th.data.check_quan_ware_list) return false; | ||
| 1842 | + | ||
| 1843 | + //--如果商家后台没有限制使用优惠券,同时商品的优惠活动没有限制使用优惠券-- | ||
| 1844 | + if (th.data.is_close_quan != 1 && th.data.bn_goods.is_xz_yh != 1 && th.data.check_quan_ware_list) { | ||
| 1845 | + var url0 = "/api/weshop/users/frozenQuan/listFrozenQuan/" + app.globalData.user_id; | ||
| 1846 | + var url = "/api/weshop/couponList/getUseCouponList"; | ||
| 1847 | + app.request.promiseGet(url0, { 1: 1 }).then(res => { | ||
| 1848 | + if (res.data.code == 0) { | ||
| 1849 | + frozenQuan = res.data.data; | ||
| 1850 | + th.data.frozenQuan = frozenQuan; | ||
| 1851 | + } | ||
| 1852 | + app.request.time_limit_get(6, url, { | ||
| 1853 | + data: { | ||
| 1854 | + storeId: oo.stoid, | ||
| 1855 | + userId: app.globalData.user_id, | ||
| 1856 | + BuySum: th.data.ckeck_quan_price, | ||
| 1857 | + WareIds: encodeURIComponent(th.data.check_quan_ware_list), | ||
| 1858 | + pageSize: 100 | ||
| 1859 | + }, | ||
| 1860 | + success: function (res) { | ||
| 1861 | + if (res.data.code == 0) { | ||
| 1862 | + quanlist = res.data.data.pageData; | ||
| 1863 | + if (quanlist) { | ||
| 1864 | + quanlist = th.check_is_frozenQuan(quanlist, frozenQuan); | ||
| 1865 | + th.setData({ selected_quan_list: quanlist }) | ||
| 1866 | + } | ||
| 1867 | + } | ||
| 1868 | + } | ||
| 1869 | + }) | ||
| 1870 | + }) | ||
| 1871 | + } | ||
| 1872 | + }, | ||
| 1873 | + | ||
| 1874 | + //--验证是否已经冻结-- | ||
| 1875 | + check_is_frozenQuan: function (quanlist, frozenQuan, isby) { | ||
| 1876 | + console.log("券列表", quanlist); | ||
| 1877 | + if (!quanlist) return null; | ||
| 1878 | + if (!frozenQuan) return quanlist; | ||
| 1879 | + var arr = []; | ||
| 1880 | + for (var i = 0; i < quanlist.length; i++) { | ||
| 1881 | + var item = quanlist[i]; | ||
| 1882 | + var is_find = 0; | ||
| 1883 | + var Q_no = quanlist[i].CashRepNo; | ||
| 1884 | + if (isby) Q_no = quanlist[i].no; | ||
| 1885 | + for (var j = 0; j < frozenQuan.length; j++) { | ||
| 1886 | + var q_no = frozenQuan[j].cashRepNo; | ||
| 1887 | + if (Q_no == q_no) { | ||
| 1888 | + is_find = 1; | ||
| 1889 | + break; | ||
| 1890 | + } | ||
| 1891 | + } | ||
| 1892 | + if (!is_find) arr.push(item); | ||
| 1893 | + } | ||
| 1894 | + return arr; | ||
| 1895 | + }, | ||
| 1896 | + | ||
| 1897 | + /*----券的所有操作----*/ | ||
| 1898 | + open_coupon_list: function (e) { | ||
| 1899 | + var th = this; | ||
| 1900 | + var pickid = e.currentTarget.dataset.pickid; | ||
| 1901 | + var bn = e.currentTarget.dataset.bn; | ||
| 1902 | + var cindx = e.currentTarget.dataset.cind; | ||
| 1903 | + | ||
| 1904 | + if (bn == 1) { | ||
| 1905 | + th.setData({ open_quan: 1, selected_quan_pick: pickid, disabled: 1 }); | ||
| 1906 | + } else { | ||
| 1907 | + //---多单打开券的时候,就要判断券在其他门店是否有使用--- | ||
| 1908 | + var quanlist = th.data.cartlist[cindx].quan_list; | ||
| 1909 | + var exp_type = th.data.cartlist[cindx].exp_type; | ||
| 1910 | + | ||
| 1911 | + | ||
| 1912 | + //对于在其他门店已经选择了的券 要判断是否显示到界面 | ||
| 1913 | + var t_user = th.data.using_quan[pickid]; | ||
| 1914 | + | ||
| 1915 | + for (var i in quanlist) { | ||
| 1916 | + quanlist[i].is_using = th.check_in_sele(quanlist[i].CashRepNo, pickid); | ||
| 1917 | + if (t_user && quanlist[i].CashRepNo == t_user.coupon_no) | ||
| 1918 | + quanlist[i].show_red = 1; | ||
| 1919 | + else | ||
| 1920 | + quanlist[i].show_red = 0; | ||
| 1921 | + } | ||
| 1922 | + | ||
| 1923 | + if (get_by_quan_list_cart) { | ||
| 1924 | + for (var i in get_by_quan_list_cart) { | ||
| 1925 | + get_by_quan_list_cart[i].is_using = th.check_in_sele(get_by_quan_list_cart[i].no, pickid); | ||
| 1926 | + if (t_user && get_by_quan_list_cart[i].no == t_user.coupon_no) | ||
| 1927 | + get_by_quan_list_cart[i].show_red = 1; | ||
| 1928 | + else | ||
| 1929 | + get_by_quan_list_cart[i].show_red = 0; | ||
| 1930 | + } | ||
| 1931 | + th.setData({ by_quan_list_cart: get_by_quan_list_cart }); | ||
| 1932 | + } else { | ||
| 1933 | + th.setData({ by_quan_list_cart: null }); | ||
| 1934 | + } | ||
| 1935 | + | ||
| 1936 | + console.log("2222222券的列表", quanlist); | ||
| 1937 | + th.setData({ | ||
| 1938 | + sele_cart_ind: cindx, | ||
| 1939 | + sele_exp_type: exp_type, | ||
| 1940 | + open_quan: 1, | ||
| 1941 | + selected_quan_pick: pickid, | ||
| 1942 | + selected_quan_list: quanlist, | ||
| 1943 | + disabled: 1 | ||
| 1944 | + }); | ||
| 1945 | + } | ||
| 1946 | + }, | ||
| 1947 | + close_coupon: function (e) { | ||
| 1948 | + var th = this; | ||
| 1949 | + th.setData({ open_quan: 0, disabled: 0 }); | ||
| 1950 | + }, | ||
| 1951 | + | ||
| 1952 | + /*--点击选择券--*/ | ||
| 1953 | + sele_quan_item: function (e) { | ||
| 1954 | + | ||
| 1955 | + var ind = e.currentTarget.dataset.ind; | ||
| 1956 | + var quan_item = this.data.selected_quan_list[ind]; | ||
| 1957 | + var pickid = this.data.selected_quan_pick; //现在选择的是哪一个门店 | ||
| 1958 | + //--如果券是单品使用的时候-- | ||
| 1959 | + if (quan_item && quan_item.UseObjectType && quan_item.UseObjectType == "20") { | ||
| 1960 | + //---只有多件购买的时候才要计算,//购物车购买和搭配勾的时候--- | ||
| 1961 | + var gg = getApp().get_b_now(); | ||
| 1962 | + if (this.data.is_b_now == 0 || gg.prom_type == 5) { | ||
| 1963 | + var arr = this.data.order_prom_list_cart; | ||
| 1964 | + var t_pk_item = null; | ||
| 1965 | + for (var ii in arr) { | ||
| 1966 | + var ep = arr[ii]; | ||
| 1967 | + if (pickid == ep.pickup_id) { | ||
| 1968 | + t_pk_item = ep; | ||
| 1969 | + break; | ||
| 1970 | + } | ||
| 1971 | + } | ||
| 1972 | + //--寻找券指定的商品-- | ||
| 1973 | + var gd = null; | ||
| 1974 | + if (t_pk_item) { | ||
| 1975 | + var goods = t_pk_item.goods; | ||
| 1976 | + for (var gid in goods) { | ||
| 1977 | + if (quan_item.UseObjectID == goods[gid].erpwareid) { | ||
| 1978 | + gd = goods[gid]; | ||
| 1979 | + } | ||
| 1980 | + } | ||
| 1981 | + } | ||
| 1982 | + if (!gd) { | ||
| 1983 | + getApp().my_warnning("未找到指定商品使用", 0, this, 600); | ||
| 1984 | + return false; | ||
| 1985 | + } | ||
| 1986 | + //计算价格,如果有平摊的实收要计算实收的金额 | ||
| 1987 | + var item_price = gd.goods_price * gd.goods_num; | ||
| 1988 | + //-- 如果有平摊下去,有实收价格的时候,就要用account_fir来计算价格 -- | ||
| 1989 | + if (gd.account_fir != null && gd.account_fir != undefined) { | ||
| 1990 | + item_price = gd.account_fir * gd.goods_num; | ||
| 1991 | + } | ||
| 1992 | + | ||
| 1993 | + if (item_price < parseFloat(quan_item.BuySum)) { | ||
| 1994 | + getApp().my_warnning("该单品金额没有大于等于" + quan_item.BuySum + "元时不能使用优惠券", 0, this, 600); | ||
| 1995 | + return false; | ||
| 1996 | + } | ||
| 1997 | + } | ||
| 1998 | + } | ||
| 1999 | + | ||
| 2000 | + var no_use = e.currentTarget.dataset.no, quanlist = this.data.selected_quan_list; | ||
| 2001 | + //---所有的券的显示红色选择都清理一遍--- | ||
| 2002 | + for (var i in quanlist) { | ||
| 2003 | + quanlist[i].show_red = 0; | ||
| 2004 | + } | ||
| 2005 | + this.setData({ selected_quan_list: quanlist }); | ||
| 2006 | + var by_quanlist = this.data.get_by_quan_list; | ||
| 2007 | + if (by_quanlist) { | ||
| 2008 | + //---所有的券的显示红色选择都清理一遍--- | ||
| 2009 | + for (var inb in by_quanlist) { | ||
| 2010 | + by_quanlist[inb].show_red = 0; | ||
| 2011 | + } | ||
| 2012 | + this.setData({ get_by_quan_list: by_quanlist }); | ||
| 2013 | + } | ||
| 2014 | + | ||
| 2015 | + var by_cart_list = this.data.by_quan_list_cart; | ||
| 2016 | + if (by_cart_list) { | ||
| 2017 | + //---所有的券的显示红色选择都清理一遍--- | ||
| 2018 | + for (var inc in by_cart_list) { | ||
| 2019 | + by_cart_list[inc].show_red = 0; | ||
| 2020 | + } | ||
| 2021 | + this.setData({ by_quan_list_cart: by_cart_list }); | ||
| 2022 | + } | ||
| 2023 | + | ||
| 2024 | + var using_quan = this.data.using_quan; | ||
| 2025 | + var th = this; | ||
| 2026 | + //---如果是不使用优惠券--- | ||
| 2027 | + if (no_use == 1) { | ||
| 2028 | + console.log("有进来吗券", no_use); | ||
| 2029 | + if (using_quan[th.data.selected_quan_pick]) { | ||
| 2030 | + using_quan[th.data.selected_quan_pick].is_nouse_red = 1; | ||
| 2031 | + } | ||
| 2032 | + else { | ||
| 2033 | + using_quan[th.data.selected_quan_pick] = { is_nouse_red: 1 }; | ||
| 2034 | + } | ||
| 2035 | + this.setData({ using_quan: using_quan, is_coupon: th.is_coupon }); | ||
| 2036 | + return; | ||
| 2037 | + } | ||
| 2038 | + | ||
| 2039 | + | ||
| 2040 | + var txt = "selected_quan_list[" + ind + "].show_red"; | ||
| 2041 | + var obj = {}; | ||
| 2042 | + obj[txt] = 1; | ||
| 2043 | + if (quan_item.show_red) { | ||
| 2044 | + obj[txt] = 0; | ||
| 2045 | + } | ||
| 2046 | + this.setData(obj); | ||
| 2047 | + console.log(this.data.selected_quan_list, "选中的券的下标", quan_item, "数据都在这里", txt); | ||
| 2048 | + if (using_quan[th.data.selected_quan_pick]) { | ||
| 2049 | + using_quan[th.data.selected_quan_pick].is_nouse_red = 0; | ||
| 2050 | + } | ||
| 2051 | + else { | ||
| 2052 | + using_quan[th.data.selected_quan_pick] = { is_nouse_red: 0 }; | ||
| 2053 | + } | ||
| 2054 | + this.setData({ using_quan: using_quan }); | ||
| 2055 | + | ||
| 2056 | + }, | ||
| 2057 | + | ||
| 2058 | + /*----- 点击选择包邮券 -----*/ | ||
| 2059 | + sele_quan_item_by: function (e) { | ||
| 2060 | + var no_use = e.currentTarget.dataset.no; | ||
| 2061 | + //立即购买的包邮券 | ||
| 2062 | + var by_quanlist = this.data.get_by_quan_list; | ||
| 2063 | + if (by_quanlist) { | ||
| 2064 | + //---所有的券的显示红色选择都清理一遍--- | ||
| 2065 | + for (var ind in by_quanlist) { | ||
| 2066 | + by_quanlist[ind].show_red = 0; | ||
| 2067 | + } | ||
| 2068 | + this.setData({ get_by_quan_list: by_quanlist }); | ||
| 2069 | + } | ||
| 2070 | + | ||
| 2071 | + //--购物车过来的包邮券-- | ||
| 2072 | + var by_cart_list = this.data.by_quan_list_cart; | ||
| 2073 | + if (by_cart_list) { | ||
| 2074 | + //---所有的券的显示红色选择都清理一遍--- | ||
| 2075 | + for (var ind in by_cart_list) { | ||
| 2076 | + by_cart_list[ind].show_red = 0; | ||
| 2077 | + } | ||
| 2078 | + this.setData({ by_quan_list_cart: by_cart_list }); | ||
| 2079 | + } | ||
| 2080 | + //普通券 | ||
| 2081 | + var quanlist = this.data.selected_quan_list; | ||
| 2082 | + if (quanlist) { | ||
| 2083 | + //---所有的券的显示红色选择都清理一遍--- | ||
| 2084 | + for (var ind in quanlist) { | ||
| 2085 | + quanlist[ind].show_red = 0; | ||
| 2086 | + } | ||
| 2087 | + this.setData({ selected_quan_list: quanlist }); | ||
| 2088 | + } | ||
| 2089 | + | ||
| 2090 | + var th = this; | ||
| 2091 | + var using_quan = this.data.using_quan; | ||
| 2092 | + //---如果是不使用优惠券--- | ||
| 2093 | + if (no_use == 1) { | ||
| 2094 | + if (using_quan[th.data.selected_quan_pick]) { | ||
| 2095 | + using_quan[th.data.selected_quan_pick].is_nouse_red = 1; | ||
| 2096 | + } | ||
| 2097 | + else { | ||
| 2098 | + using_quan[th.data.selected_quan_pick] = { is_nouse_red: 1 }; | ||
| 2099 | + } | ||
| 2100 | + this.setData({ using_quan: using_quan, is_coupon: th.is_coupon }); | ||
| 2101 | + return; | ||
| 2102 | + } | ||
| 2103 | + | ||
| 2104 | + var pickid = th.data.selected_quan_pick; //现在选择的是哪一个门店 | ||
| 2105 | + var ind = e.currentTarget.dataset.ind; | ||
| 2106 | + //--如果是立即购买的部分-- | ||
| 2107 | + var txt = ""; | ||
| 2108 | + var txt1 = ""; | ||
| 2109 | + var quan_item = null; | ||
| 2110 | + if (th.data.is_b_now) { | ||
| 2111 | + quan_item = this.data.get_by_quan_list[ind]; | ||
| 2112 | + txt = "get_by_quan_list[" + ind + "].show_red"; | ||
| 2113 | + var obj = {}; | ||
| 2114 | + obj[txt] = 1; | ||
| 2115 | + this.setData(obj); | ||
| 2116 | + } else { | ||
| 2117 | + txt = "by_quan_list_cart[" + ind + "].show_red"; | ||
| 2118 | + quan_item = th.data.by_quan_list_cart[ind]; | ||
| 2119 | + var obj = {}; | ||
| 2120 | + obj[txt] = 1; | ||
| 2121 | + this.setData(obj); | ||
| 2122 | + th.data.get_by_quan_list_cart[pickid] = JSON.parse(JSON.stringify(th.data.by_quan_list_cart)); //要把选中的弄回数组 | ||
| 2123 | + } | ||
| 2124 | + | ||
| 2125 | + if (using_quan[th.data.selected_quan_pick]) { | ||
| 2126 | + using_quan[th.data.selected_quan_pick].is_nouse_red = 0; | ||
| 2127 | + } | ||
| 2128 | + else { | ||
| 2129 | + using_quan[th.data.selected_quan_pick] = { is_nouse_red: 0 }; | ||
| 2130 | + } | ||
| 2131 | + this.setData({ using_quan: using_quan }); | ||
| 2132 | + }, | ||
| 2133 | + | ||
| 2134 | + //--确认使用券--- | ||
| 2135 | + confirm_quan: function () { | ||
| 2136 | + var using_quan = this.data.using_quan; //正在使用中的券列表 | ||
| 2137 | + var pickid = this.data.selected_quan_pick; //选中的门店ID | ||
| 2138 | + var th = this; | ||
| 2139 | + var selected_quan_list = this.data.selected_quan_list; //选择了那个门店的券列表 | ||
| 2140 | + var get_by_quan_list = this.data.get_by_quan_list; //立即购买的包邮券列表 | ||
| 2141 | + var by_quan_list_cart = this.data.by_quan_list_cart; //购物车购买的包邮券列表 | ||
| 2142 | + //选择了的券 | ||
| 2143 | + var sele_quan = null; | ||
| 2144 | + | ||
| 2145 | + //循环普通的券 | ||
| 2146 | + for (var i in selected_quan_list) { | ||
| 2147 | + var item = selected_quan_list[i]; | ||
| 2148 | + if (item.show_red) { | ||
| 2149 | + th.insert_into_using_quan(item, using_quan, pickid); | ||
| 2150 | + return; | ||
| 2151 | + } | ||
| 2152 | + } | ||
| 2153 | + //循环包邮的券,立即购买的 | ||
| 2154 | + for (var i in get_by_quan_list) { | ||
| 2155 | + var item = get_by_quan_list[i]; | ||
| 2156 | + if (item.show_red) { | ||
| 2157 | + if (th.data.is_no_by[pickid] == 1) { | ||
| 2158 | + getApp().my_warnning("已全场不能包邮,不能选择包邮券", 0, th); | ||
| 2159 | + return false; | ||
| 2160 | + } | ||
| 2161 | + if (th.data.is_by[pickid] == 1) { | ||
| 2162 | + getApp().my_warnning("已全场包邮,不能选择包邮券", 0, th); | ||
| 2163 | + return false; | ||
| 2164 | + } | ||
| 2165 | + | ||
| 2166 | + th.insert_into_using_quan(item, using_quan, pickid, 1); | ||
| 2167 | + return; | ||
| 2168 | + } | ||
| 2169 | + } | ||
| 2170 | + | ||
| 2171 | + //循环包邮的券 | ||
| 2172 | + for (var i in by_quan_list_cart) { | ||
| 2173 | + var item = by_quan_list_cart[i]; | ||
| 2174 | + if (item.show_red) { | ||
| 2175 | + if (th.data.is_no_by[pickid] == 1) { | ||
| 2176 | + getApp().my_warnning("已全场不能包邮,不能选择包邮券", 0, th); | ||
| 2177 | + return false; | ||
| 2178 | + } | ||
| 2179 | + if (th.data.is_by[pickid] == 1) { | ||
| 2180 | + getApp().my_warnning("已全场包邮,不能选择包邮券", 0, th); | ||
| 2181 | + return false; | ||
| 2182 | + } | ||
| 2183 | + th.insert_into_using_quan(item, using_quan, pickid, 1); | ||
| 2184 | + return; | ||
| 2185 | + } | ||
| 2186 | + } | ||
| 2187 | + | ||
| 2188 | + //选择了的券,看是不是点击了不使用券,点击了不使用优惠券 | ||
| 2189 | + if (using_quan[pickid]) { | ||
| 2190 | + if (using_quan[pickid].is_nouse_red == 1) { | ||
| 2191 | + using_quan[pickid] = { is_nouse_red: 1 }; | ||
| 2192 | + th.setData({ using_quan: using_quan }); | ||
| 2193 | + if (th.data.is_b_now == 1) { | ||
| 2194 | + th.calculatePrice2(); | ||
| 2195 | + } else { | ||
| 2196 | + th.calculatePrice(); | ||
| 2197 | + } | ||
| 2198 | + th.setData({ open_quan: 0 }); | ||
| 2199 | + return; | ||
| 2200 | + } | ||
| 2201 | + } | ||
| 2202 | + }, | ||
| 2203 | + | ||
| 2204 | + //----把券插入之后的操作,同时还要重新计算价格---- | ||
| 2205 | + insert_into_using_quan: async function (item, using_quan, pickid, isby) { | ||
| 2206 | + | ||
| 2207 | + | ||
| 2208 | + var th = this; | ||
| 2209 | + var old_quan = null; | ||
| 2210 | + if (isby == 1) { | ||
| 2211 | + using_quan[pickid] = { | ||
| 2212 | + coupon_no: item.no, | ||
| 2213 | + money: 0, | ||
| 2214 | + is_nouse_red: 0, | ||
| 2215 | + region_list: item.region_list, | ||
| 2216 | + goods_list: item.goods_list | ||
| 2217 | + }; | ||
| 2218 | + using_quan[pickid].isby = 1; | ||
| 2219 | + } else { | ||
| 2220 | + if (using_quan[pickid]) old_quan = using_quan[pickid]; | ||
| 2221 | + using_quan[pickid] = { coupon_no: item.CashRepNo, money: item.Sum, is_nouse_red: 0 }; | ||
| 2222 | + using_quan[pickid].isby = 0; | ||
| 2223 | + } | ||
| 2224 | + this.setData({ using_quan: using_quan }); | ||
| 2225 | + if (th.data.is_b_now == 1) { | ||
| 2226 | + th.calculatePrice2(function () { | ||
| 2227 | + | ||
| 2228 | + if (old_quan) using_quan[pickid] = old_quan; | ||
| 2229 | + else using_quan[pickid] = null; | ||
| 2230 | + th.setData({ using_quan: using_quan, submit: 0 }); | ||
| 2231 | + wx.showToast({ | ||
| 2232 | + title: "不能使用优惠券,同城起送价不足", | ||
| 2233 | + icon: 'none', | ||
| 2234 | + duration: 2000 | ||
| 2235 | + }) | ||
| 2236 | + | ||
| 2237 | + }); | ||
| 2238 | + } else { | ||
| 2239 | + th.calculatePrice(function () { | ||
| 2240 | + if (old_quan) using_quan[pickid] = old_quan; | ||
| 2241 | + else using_quan[pickid] = null; | ||
| 2242 | + th.setData({ using_quan: using_quan, submit: 0 }); | ||
| 2243 | + wx.showToast({ | ||
| 2244 | + title: "不能使用优惠券,同城起送价不足", | ||
| 2245 | + icon: 'none', | ||
| 2246 | + duration: 2000 | ||
| 2247 | + }) | ||
| 2248 | + }); | ||
| 2249 | + } | ||
| 2250 | + th.setData({ open_quan: 0 }); | ||
| 2251 | + }, | ||
| 2252 | + | ||
| 2253 | + | ||
| 2254 | + | ||
| 2255 | + | ||
| 1685 | }); | 2256 | }); |
packageE/pages/cart/cart2_pt/cart2_pt.wxml
| 1 | <wxs module="filters" src="../../../../utils/filter.wxs"></wxs> | 1 | <wxs module="filters" src="../../../../utils/filter.wxs"></wxs> |
| 2 | +<wxs module="filter" src="../cart2/c_filter.wxs"></wxs> | ||
| 2 | <form bindsubmit="sendsm"> | 3 | <form bindsubmit="sendsm"> |
| 3 | <view class="container"> | 4 | <view class="container"> |
| 4 | 5 | ||
| @@ -101,6 +102,24 @@ | @@ -101,6 +102,24 @@ | ||
| 101 | <icon color="#f23030" size="16" type="info"></icon>{{order.store_prom}} | 102 | <icon color="#f23030" size="16" type="info"></icon>{{order.store_prom}} |
| 102 | </view> | 103 | </view> |
| 103 | 104 | ||
| 105 | + | ||
| 106 | + <view class="xc-coupon-frame flex-center" data-bn="1" bindtap="open_coupon_list" data-pickid="{{bn_pick}}" hidden="{{(selected_quan_list?selected_quan_list.length:0)+ (get_by_quan_list && bn_exp_type==0?get_by_quan_list.length:0)<=0}}" wx:if="{{(selected_quan_list && selected_quan_list.length>0) || get_by_quan_list!=null}}"> | ||
| 107 | + <view class="work-frame flex-space-between"> | ||
| 108 | + <view class="work"> | ||
| 109 | + 优惠券 <text class="quan_num_show">{{(selected_quan_list?selected_quan_list.length:0)+ (get_by_quan_list && bn_exp_type==0?get_by_quan_list.length:0)}}张可用</text> | ||
| 110 | + </view> | ||
| 111 | + <view class="xc-right-frame"> | ||
| 112 | + <text wx:if="{{using_quan[bn_pick].is_nouse}}">不使用</text> | ||
| 113 | + <block wx:else> | ||
| 114 | + <text wx:if="{{using_quan[bn_pick].money}}">¥{{using_quan[bn_pick].money}}元优惠券</text> | ||
| 115 | + <text wx:if="{{using_quan[bn_pick].isby}}">包邮券</text> | ||
| 116 | + </block> | ||
| 117 | + <view class="xc-right"></view> | ||
| 118 | + </view> | ||
| 119 | + </view> | ||
| 120 | + </view> | ||
| 121 | + | ||
| 122 | + | ||
| 104 | <!--阶梯团是不显示的--> | 123 | <!--阶梯团是不显示的--> |
| 105 | <block wx:if="{{bn_exp_type==0 && !is_default_logistics}}"> | 124 | <block wx:if="{{bn_exp_type==0 && !is_default_logistics}}"> |
| 106 | <view class="use-item flex-space-between" wx:if="{{kt_type!=3 || is_normal==1}}"> | 125 | <view class="use-item flex-space-between" wx:if="{{kt_type!=3 || is_normal==1}}"> |
| @@ -186,6 +205,12 @@ | @@ -186,6 +205,12 @@ | ||
| 186 | <view>配送费用</view> | 205 | <view>配送费用</view> |
| 187 | <view class="co-red">¥ {{formData.shipping_price}}元</view> | 206 | <view class="co-red">¥ {{formData.shipping_price}}元</view> |
| 188 | </view> | 207 | </view> |
| 208 | + | ||
| 209 | + <view class="item" wx:if="{{formData.coupon_price>0}}"> | ||
| 210 | + <view>使用优惠券</view> | ||
| 211 | + <view class="co-red">- ¥ {{formData.coupon_price}}元</view> | ||
| 212 | + </view> | ||
| 213 | + | ||
| 189 | <!-- 使用预存优惠金额 --> | 214 | <!-- 使用预存优惠金额 --> |
| 190 | <view class="item" wx:if="{{formData.prestore>0}}"> | 215 | <view class="item" wx:if="{{formData.prestore>0}}"> |
| 191 | <view>使用预存</view> | 216 | <view>使用预存</view> |
| @@ -256,4 +281,128 @@ | @@ -256,4 +281,128 @@ | ||
| 256 | </view> | 281 | </view> |
| 257 | </view> | 282 | </view> |
| 258 | 283 | ||
| 259 | -<warn id="warn"></warn> | ||
| 260 | \ No newline at end of file | 284 | \ No newline at end of file |
| 285 | +<warn id="warn"></warn> | ||
| 286 | + | ||
| 287 | + | ||
| 288 | + | ||
| 289 | + <!-- 使用券列表的弹窗 --> | ||
| 290 | +<view wx:if='{{open_quan==1}}'> | ||
| 291 | + <view class="cover-layer flex-center " bindtap='close_coupon'> </view> | ||
| 292 | + <view class="cx-popup {{open_quan==true?'up' : 'down'}}"> | ||
| 293 | + <!-- 最上面 --> | ||
| 294 | + <view class="top flex"> | ||
| 295 | + <view class="xc-top-content t-c"> | ||
| 296 | + <view class="xc-title">优惠券使用</view> | ||
| 297 | + </view> | ||
| 298 | + <view class="xc-close-frame" bindtap='close_coupon'> | ||
| 299 | + <view class="xc-close">×</view> | ||
| 300 | + </view> | ||
| 301 | + </view> | ||
| 302 | + <!-- 使用优惠券和不使用优惠券层--> | ||
| 303 | + <view class="may_use_coupon fs28 flex"> 可使用的优惠券 | ||
| 304 | + <view class=" is_use_coupon flex-vertical" bindtap="sele_quan_item" data-no="1">不使用优惠券 | ||
| 305 | + <block wx:if="{{using_quan[selected_quan_pick].is_nouse_red}}"> | ||
| 306 | + <view class="circle white xc-hooka fs20 red-b sn"><text>Γ</text></view> | ||
| 307 | + </block> | ||
| 308 | + <block wx:else> | ||
| 309 | + <view class="circle xc-hookst ons"></view> | ||
| 310 | + </block> | ||
| 311 | + </view> | ||
| 312 | + </view> | ||
| 313 | + | ||
| 314 | + <!-- 中间券内容显示 --> | ||
| 315 | + <view class="xc-frame flex-level"> | ||
| 316 | + <view class="list-frame"> | ||
| 317 | + <view wx:for="{{selected_quan_list}}" bindtap="sele_quan_item" wx:if="{{!item.is_using}}" data-ind="{{q_index}}" wx:for-item="item" wx:for-index="q_index"> | ||
| 318 | + <view class="xc-coupon-frame flex-center" data-ind="{{q_index}}"> | ||
| 319 | + <view class="coupon-frame flex rel"> | ||
| 320 | + <!-- 锯齿 --> | ||
| 321 | + <include src="../cart2/juchi_part.wxml" /> | ||
| 322 | + <!-- 左边 --> | ||
| 323 | + <view class="coupon-left rel {{filter.setcolor(item.UseObjectType)}} flex-center"> | ||
| 324 | + <view class="white xc-money-frames"> | ||
| 325 | + <view class="f_text"><text class="xc-rmb-symbol">¥</text><text class="xc-rmb-val">{{item.Sum}}</text></view> | ||
| 326 | + <view class="coupon-explain t-c" wx:if="{{item.BuySum>0}}">满{{item.BuySum}}元可用</view> | ||
| 327 | + <view class="coupon-explain t-c" wx:else>满0元可用</view> | ||
| 328 | + </view> | ||
| 329 | + </view> | ||
| 330 | + <!-- 右边 --> | ||
| 331 | + <view class="coupon-right flex-center rel"> | ||
| 332 | + <view class="coupon-annotation flex"> | ||
| 333 | + <view class="flex top-frame"> | ||
| 334 | + <view class="frame"> | ||
| 335 | + <view class="coupon-wode ib flex ellipsis-2 "> | ||
| 336 | + <text class="xc-brand t-c ib white {{filter.setcolor(item.UseObjectType)}}">{{filter.get_type_card(item.UseObjectType)}}</text> | ||
| 337 | + <block>{{item.Sum}}元优惠券</block> | ||
| 338 | + </view> | ||
| 339 | + <view class="coupon-time">{{filters.replace_time2(item.BeginDate)}}至{{item.ValidDate?filters.replace_time2(item.ValidDate):'不限'}}</view> | ||
| 340 | + </view> | ||
| 341 | + </view> | ||
| 342 | + <block wx:if="{{item.show_red}}"> | ||
| 343 | + <view class="circle white xc-hook fs20 red-b sn"><text>Γ</text></view> | ||
| 344 | + </block> | ||
| 345 | + <block wx:else> | ||
| 346 | + <view class="circle xc-hooks on"></view> | ||
| 347 | + </block> | ||
| 348 | + </view> | ||
| 349 | + <include src="../cart2/remark_click_part.wxml" /> | ||
| 350 | + </view> | ||
| 351 | + </view> | ||
| 352 | + </view> | ||
| 353 | + <!-- 打开是说明 --> | ||
| 354 | + <include src="../cart2/remark_part.wxml" /> | ||
| 355 | + </view> | ||
| 356 | + <!-- 包邮券的显示,立即购买 --> | ||
| 357 | + <block wx:if="{{ is_b_now && bn_exp_type==0}}"> | ||
| 358 | + <view wx:for="{{get_by_quan_list}}" bindtap="sele_quan_item_by" wx:if="{{!item.is_using}}" data-ind="{{byq_index}}" wx:for-item="item" wx:for-index="byq_index"> | ||
| 359 | + <view class="xc-coupon-frame flex-center" data-ind="{{byq_index}}"> | ||
| 360 | + <view class="coupon-frame flex rel"> | ||
| 361 | + <!-- 锯齿 --> | ||
| 362 | + <include src="../cart2/juchi_part.wxml" /> | ||
| 363 | + <!-- 左边 --> | ||
| 364 | + <view class="coupon-left rel {{filter.setcolor(item.UseObjectType)}} flex-center"> | ||
| 365 | + <view class="white xc-money-frames"> | ||
| 366 | + <view class="f_text"><text class="xc-rmb-val">包邮券</text></view> | ||
| 367 | + <view class="coupon-explain t-c" wx:if="{{item.condition>0}}">满{{item.condition}}元可用</view> | ||
| 368 | + <view class="coupon-explain t-c" wx:else>满0元可用</view> | ||
| 369 | + </view> | ||
| 370 | + </view> | ||
| 371 | + <!-- 右边 --> | ||
| 372 | + <view class="coupon-right flex-center rel"> | ||
| 373 | + <view class="coupon-annotation flex"> | ||
| 374 | + <view class="flex top-frame"> | ||
| 375 | + <view class="frame"> | ||
| 376 | + <view class="coupon-wode ib flex ellipsis-2 "> | ||
| 377 | + <text class="xc-brand t-c ib white {{filter.setcolor(item.UseObjectType)}}">{{filter.get_type_card(0)}}</text> | ||
| 378 | + <block>包邮券</block> | ||
| 379 | + </view> | ||
| 380 | + <view class="coupon-time">{{filters.format_time(item.use_start_time)}}至{{item.use_end_time?filters.format_time(item.use_end_time):'不限'}}</view> | ||
| 381 | + </view> | ||
| 382 | + </view> | ||
| 383 | + <block wx:if="{{item.show_red}}"> | ||
| 384 | + <view class="circle white xc-hook fs20 red-b sn"><text>Γ</text></view> | ||
| 385 | + </block> | ||
| 386 | + <block wx:else> | ||
| 387 | + <view class="circle xc-hooks on"></view> | ||
| 388 | + </block> | ||
| 389 | + </view> | ||
| 390 | + <include src="../cart2/remark_click_part2.wxml" /> | ||
| 391 | + </view> | ||
| 392 | + </view> | ||
| 393 | + </view> | ||
| 394 | + <!-- 打开是说明 --> | ||
| 395 | + <include src="../cart2/remark_part.wxml" /> | ||
| 396 | + </view> | ||
| 397 | + </block> | ||
| 398 | + | ||
| 399 | + | ||
| 400 | + | ||
| 401 | + | ||
| 402 | + </view> | ||
| 403 | + </view> | ||
| 404 | + <!-- 最底下确定层--> | ||
| 405 | + <view class="determine-frame"> | ||
| 406 | + <view class="xc-confirm flex-center" bindtap="confirm_quan"> 确定 </view> | ||
| 407 | + </view> | ||
| 408 | + </view> | ||
| 409 | +</view> | ||
| 261 | \ No newline at end of file | 410 | \ No newline at end of file |
packageE/pages/cart/cart2_pt/cart2_pt.wxss
packageE/pages/cart/cart_wk/cart_wk.js
| 1 | // pages/cart/cart_wk/cart_wk.js | 1 | // pages/cart/cart_wk/cart_wk.js |
| 2 | var t = getApp(), | 2 | var t = getApp(), |
| 3 | - oo = t.globalData.setting, | 3 | + oo = t.globalData.setting,app=t, |
| 4 | os=oo; | 4 | os=oo; |
| 5 | var ut=require("../../../../utils/util.js"); | 5 | var ut=require("../../../../utils/util.js"); |
| 6 | var util_pay=require("../../../../utils/pay.js"); | 6 | var util_pay=require("../../../../utils/pay.js"); |
| @@ -53,8 +53,21 @@ Page({ | @@ -53,8 +53,21 @@ Page({ | ||
| 53 | paying:0, //支付中 | 53 | paying:0, //支付中 |
| 54 | same_ok:1, //同城配送的控制 | 54 | same_ok:1, //同城配送的控制 |
| 55 | formData:{ | 55 | formData:{ |
| 56 | - order_prom_amount:0 | ||
| 57 | - } | 56 | + order_prom_amount:0, |
| 57 | + coupon_price:0 | ||
| 58 | + }, | ||
| 59 | + | ||
| 60 | + //--更优惠券抵用有关,立即购买的,如果是购物车,就要把相应的值,写入cartlist数组中-- | ||
| 61 | + ckeck_quan_price: 0, | ||
| 62 | + check_quan_price_list: '', | ||
| 63 | + check_quan_ware_list: '', | ||
| 64 | + | ||
| 65 | + // 设计一个数组来存放已经选择了的券编号,coupon_no是券号,money是面值,coupon_price是真正优惠的价格,数组的下标是pickid | ||
| 66 | + //using_quan[11]={coupon_no:"1212121",money:"20",coupon_price:"45"} | ||
| 67 | + using_quan: {}, | ||
| 68 | + isget_by_quan: {}, //是否调用了接口获取包邮券 | ||
| 69 | + is_by:{}, | ||
| 70 | + get_by_quan_list: null, //立即购买的 | ||
| 58 | 71 | ||
| 59 | }, | 72 | }, |
| 60 | 73 | ||
| @@ -154,13 +167,8 @@ Page({ | @@ -154,13 +167,8 @@ Page({ | ||
| 154 | user_addr: addr, enterAddressPage: 0,same_ok:1 | 167 | user_addr: addr, enterAddressPage: 0,same_ok:1 |
| 155 | }); | 168 | }); |
| 156 | } | 169 | } |
| 157 | - | ||
| 158 | - if (th.data.exp_type == 0 && th.data.goods) { | ||
| 159 | - th.calculate_wuliu(); | ||
| 160 | - } | ||
| 161 | - | ||
| 162 | - if (th.data.exp_type == 2 && th.data.goods) { | ||
| 163 | - th.calculate_same_city(); | 170 | + if (th.data.goods) { |
| 171 | + th.calculatePrice2(); | ||
| 164 | } | 172 | } |
| 165 | 173 | ||
| 166 | }) | 174 | }) |
| @@ -361,7 +369,7 @@ Page({ | @@ -361,7 +369,7 @@ Page({ | ||
| 361 | 369 | ||
| 362 | if (!goods) return false; | 370 | if (!goods) return false; |
| 363 | 371 | ||
| 364 | - if(goods.is_minishop==1 && getApp().is_sp_hao()){ | 372 | + if(goods.is_minishop==1 && getApp().is_sp_hao()){ |
| 365 | 373 | ||
| 366 | if(goods.distr_type==1 || pickup.distr_type==1) { | 374 | if(goods.distr_type==1 || pickup.distr_type==1) { |
| 367 | wx.showToast({ | 375 | wx.showToast({ |
| @@ -423,7 +431,6 @@ Page({ | @@ -423,7 +431,6 @@ Page({ | ||
| 423 | } | 431 | } |
| 424 | 432 | ||
| 425 | 433 | ||
| 426 | - | ||
| 427 | order.order_goods = order_goods; | 434 | order.order_goods = order_goods; |
| 428 | 435 | ||
| 429 | //-- 计算获得佣金的金额 -- | 436 | //-- 计算获得佣金的金额 -- |
| @@ -446,12 +453,23 @@ Page({ | @@ -446,12 +453,23 @@ Page({ | ||
| 446 | 453 | ||
| 447 | } | 454 | } |
| 448 | 455 | ||
| 456 | + if(teamlist.is_quan){ | ||
| 457 | + let q_ch_money= parseFloat(price * order_goods.goods_num).toFixed(2); | ||
| 458 | + th.data.ckeck_quan_price = q_ch_money; | ||
| 459 | + th.data.check_quan_price_list = q_ch_money + ""; | ||
| 460 | + th.data.check_quan_ware_list = goods.erpwareid + ""; | ||
| 461 | + }else{ | ||
| 462 | + goods.is_xz_yh = 1; | ||
| 463 | + } | ||
| 464 | + | ||
| 465 | + | ||
| 449 | 466 | ||
| 450 | 467 | ||
| 451 | this.setData({ | 468 | this.setData({ |
| 452 | order: order, | 469 | order: order, |
| 453 | distr_type: distr_type, | 470 | distr_type: distr_type, |
| 454 | pickup: pickup, | 471 | pickup: pickup, |
| 472 | + bn_pick: pickup.pickup_id, | ||
| 455 | exp_type: exp_type, | 473 | exp_type: exp_type, |
| 456 | goods: goods, | 474 | goods: goods, |
| 457 | teamgroup: teamgroup, | 475 | teamgroup: teamgroup, |
| @@ -460,6 +478,7 @@ Page({ | @@ -460,6 +478,7 @@ Page({ | ||
| 460 | 478 | ||
| 461 | //--计算价格-- | 479 | //--计算价格-- |
| 462 | th.calculatePrice2(); | 480 | th.calculatePrice2(); |
| 481 | + th.get_buy_now_quan(); | ||
| 463 | }, | 482 | }, |
| 464 | 483 | ||
| 465 | 484 | ||
| @@ -469,6 +488,37 @@ Page({ | @@ -469,6 +488,37 @@ Page({ | ||
| 469 | th.setData({submit: 1}) | 488 | th.setData({submit: 1}) |
| 470 | 489 | ||
| 471 | var allpice = th.data.order.order_amount + th.data.order.user_money + th.data.order.tail_money; | 490 | var allpice = th.data.order.order_amount + th.data.order.user_money + th.data.order.tail_money; |
| 491 | + | ||
| 492 | + //---如果有选择优惠券的情况下--- | ||
| 493 | + var quan_price = 0, bn_pick = th.data.bn_pick; | ||
| 494 | + var quan_no = null; | ||
| 495 | + if (th.data.using_quan[bn_pick] != null && th.data.using_quan[bn_pick] != undefined) | ||
| 496 | + quan_no = th.data.using_quan[bn_pick].coupon_no; | ||
| 497 | + | ||
| 498 | + if (quan_no) { | ||
| 499 | + //如果是一件代发就不要找商品 | ||
| 500 | + if (th.data.using_quan[bn_pick].isby != 1) { | ||
| 501 | + //---获取优惠券优惠--- | ||
| 502 | + await getApp().request.promiseGet("/api/weshop/couponList/getUseCouponPrice", { | ||
| 503 | + data: { | ||
| 504 | + storeId: oo.stoid, | ||
| 505 | + CashRepNo: quan_no, | ||
| 506 | + WaresSum: th.data.ckeck_quan_price, | ||
| 507 | + WareIds: th.data.check_quan_ware_list | ||
| 508 | + } | ||
| 509 | + }).then(res => { | ||
| 510 | + | ||
| 511 | + if (res.data.code == 0 && res.data.data && res.data.data.length > 0) { | ||
| 512 | + quan_price = res.data.data[0].WareCashSum; | ||
| 513 | + allpice=allpice-quan_price; | ||
| 514 | + } | ||
| 515 | + }) | ||
| 516 | + } | ||
| 517 | + } | ||
| 518 | + | ||
| 519 | + var order_prom_txt3 = "formData.coupon_price"; | ||
| 520 | + th.setData({[order_prom_txt3]: quan_price}) | ||
| 521 | + | ||
| 472 | var o_condition = allpice; | 522 | var o_condition = allpice; |
| 473 | var ord_prom=null; | 523 | var ord_prom=null; |
| 474 | var order_prom_amount=0; | 524 | var order_prom_amount=0; |
| @@ -487,10 +537,10 @@ Page({ | @@ -487,10 +537,10 @@ Page({ | ||
| 487 | 537 | ||
| 488 | //--计算物流-- | 538 | //--计算物流-- |
| 489 | if (th.data.exp_type == 0) { | 539 | if (th.data.exp_type == 0) { |
| 490 | - th.calculate_wuliu(); | 540 | + th.calculate_wuliu(allpice); |
| 491 | return false; | 541 | return false; |
| 492 | }else if(th.data.exp_type == 2){ | 542 | }else if(th.data.exp_type == 2){ |
| 493 | - th.calculate_same_city(); | 543 | + th.calculate_same_city(allpice); |
| 494 | return false; | 544 | return false; |
| 495 | } else { | 545 | } else { |
| 496 | 546 | ||
| @@ -521,6 +571,7 @@ Page({ | @@ -521,6 +571,7 @@ Page({ | ||
| 521 | //--订单优惠的显示-- | 571 | //--订单优惠的显示-- |
| 522 | var order_prom_txt1 = "formData.order_prom_id"; | 572 | var order_prom_txt1 = "formData.order_prom_id"; |
| 523 | var order_prom_txt2 = "formData.order_prom_amount"; | 573 | var order_prom_txt2 = "formData.order_prom_amount"; |
| 574 | + | ||
| 524 | if (order_prom_id > 0) { | 575 | if (order_prom_id > 0) { |
| 525 | th.setData({[order_prom_txt1]: order_prom_id, [order_prom_txt2]: order_prom_amount}) | 576 | th.setData({[order_prom_txt1]: order_prom_id, [order_prom_txt2]: order_prom_amount}) |
| 526 | } else { | 577 | } else { |
| @@ -565,19 +616,10 @@ Page({ | @@ -565,19 +616,10 @@ Page({ | ||
| 565 | exp_type: type,same_ok:1 | 616 | exp_type: type,same_ok:1 |
| 566 | }); | 617 | }); |
| 567 | //--计算物流的值-- | 618 | //--计算物流的值-- |
| 568 | - if (type == 0) { | ||
| 569 | - th.calculate_wuliu(); | ||
| 570 | - } else if(type==1){ | ||
| 571 | - var allpice = parseFloat(th.data.order.order_amount) | ||
| 572 | - + parseFloat(th.data.order.user_money) | ||
| 573 | - + parseFloat(th.data.order.tail_money); | ||
| 574 | - allpice = allpice.toFixed(2); | ||
| 575 | - this.setData({ | ||
| 576 | - allpice: allpice, exp_price: 0,show_submit:1,submit:0 | ||
| 577 | - }); | ||
| 578 | - }else{ | ||
| 579 | - th.calculate_same_city(); | 619 | + if (th.data.goods) { |
| 620 | + th.calculatePrice2(); | ||
| 580 | } | 621 | } |
| 622 | + | ||
| 581 | }, | 623 | }, |
| 582 | 624 | ||
| 583 | //关闭支付 | 625 | //关闭支付 |
| @@ -632,6 +674,18 @@ Page({ | @@ -632,6 +674,18 @@ Page({ | ||
| 632 | tail_pay_type: ind,//0微信支付 1余额支付 | 674 | tail_pay_type: ind,//0微信支付 1余额支付 |
| 633 | }; | 675 | }; |
| 634 | 676 | ||
| 677 | + //组装优惠券的钱 | ||
| 678 | + if (parseFloat(th.data.formData.coupon_price) > 0) { | ||
| 679 | + dd.coupon_price = th.data.formData.coupon_price; | ||
| 680 | + dd.coupon_no = th.data.using_quan[th.data.bn_pick].coupon_no; | ||
| 681 | + } | ||
| 682 | + | ||
| 683 | + if (th.data.using_quan[th.data.bn_pick] && th.data.using_quan[th.data.bn_pick].coupon_no && th.data.using_quan[th.data.bn_pick].isby) { | ||
| 684 | + dd.coupon_no = th.data.using_quan[th.data.bn_pick].coupon_no; | ||
| 685 | + dd.coupon_price = 0; | ||
| 686 | + } | ||
| 687 | + | ||
| 688 | + | ||
| 635 | if (th.data.exp_type == 0 || th.data.exp_type == 2) { | 689 | if (th.data.exp_type == 0 || th.data.exp_type == 2) { |
| 636 | var index = th.data.index; | 690 | var index = th.data.index; |
| 637 | dd.shipping_code = th.data.wu_arr[index].code; | 691 | dd.shipping_code = th.data.wu_arr[index].code; |
| @@ -774,7 +828,7 @@ Page({ | @@ -774,7 +828,7 @@ Page({ | ||
| 774 | }, | 828 | }, |
| 775 | 829 | ||
| 776 | //----计算物流的钱---- | 830 | //----计算物流的钱---- |
| 777 | - async calculate_wuliu() { | 831 | + async calculate_wuliu(p_allpice) { |
| 778 | //让按钮变灰色 | 832 | //让按钮变灰色 |
| 779 | this.setData({submit: 1}); | 833 | this.setData({submit: 1}); |
| 780 | var to = getApp(), th = this; | 834 | var to = getApp(), th = this; |
| @@ -791,14 +845,54 @@ Page({ | @@ -791,14 +845,54 @@ Page({ | ||
| 791 | var order_prom_amount=0; | 845 | var order_prom_amount=0; |
| 792 | //--全部金额-- | 846 | //--全部金额-- |
| 793 | var allpice = th.data.order.order_amount + th.data.order.user_money + th.data.order.pt_tail_money; | 847 | var allpice = th.data.order.order_amount + th.data.order.user_money + th.data.order.pt_tail_money; |
| 848 | + if(p_allpice) allpice=p_allpice; | ||
| 794 | // if(th.data.bn_use_commission){ | 849 | // if(th.data.bn_use_commission){ |
| 795 | // allpice-=th.data.goods.use_commission; | 850 | // allpice-=th.data.goods.use_commission; |
| 796 | // } | 851 | // } |
| 852 | + var pickid=th.data.bn_pick; | ||
| 797 | var o_condition=allpice; | 853 | var o_condition=allpice; |
| 854 | + var quan_no = null; | ||
| 855 | + | ||
| 856 | + if (th.data.using_quan[pickid] != null && th.data.using_quan[pickid] != undefined) | ||
| 857 | + quan_no = th.data.using_quan[pickid].coupon_no; | ||
| 798 | 858 | ||
| 799 | //-----------当地址不为空,且是物流时,计算物流费用---------- | 859 | //-----------当地址不为空,且是物流时,计算物流费用---------- |
| 800 | if (th.data.user_addr != null && th.data.exp_type == 0 && good.is_free_shipping == 0) { | 860 | if (th.data.user_addr != null && th.data.exp_type == 0 && good.is_free_shipping == 0) { |
| 801 | 861 | ||
| 862 | + //看是不是有调用过包邮券 | ||
| 863 | + if (!th.data.isget_by_quan[th.data.pickid] && good.is_xz_yh != 1) { | ||
| 864 | + | ||
| 865 | + //--判断要不要显示包邮券,链式调用接口,调取包邮券,已经是减了优惠的金额,见到优惠券的钱--- | ||
| 866 | + getApp().request.promiseGet("/api/weshop/userfeemail/pageAndArea", { | ||
| 867 | + data: { | ||
| 868 | + store_id: os.stoid, | ||
| 869 | + isuse: 0, | ||
| 870 | + condition: o_condition, | ||
| 871 | + user_id: getApp().globalData.user_id, | ||
| 872 | + pageSize: 2000 | ||
| 873 | + } | ||
| 874 | + }).then(res => { | ||
| 875 | + if (res.data.code == 0 && res.data.data.total > 0) { | ||
| 876 | + //此时要循环判断包邮的地区,不包邮商品是不是符合 | ||
| 877 | + var arr = [], quanlist = res.data.data.pageData; | ||
| 878 | + quanlist = th.check_is_frozenQuan(quanlist, th.data.frozenQuan, 1); | ||
| 879 | + for (var i in quanlist) { | ||
| 880 | + var item = quanlist[i]; | ||
| 881 | + if (item.region_list && th.check_by_area(item.region_list)) continue; //如果是不包邮区域 | ||
| 882 | + if (item.goods_list) { | ||
| 883 | + var no_goods_arr = item.goods_list.split(","); | ||
| 884 | + if (ut.isContained(no_goods_arr, gd_arr_list)) continue; //如果是不包邮商品 | ||
| 885 | + } | ||
| 886 | + arr.push(item); | ||
| 887 | + } | ||
| 888 | + if (arr) { | ||
| 889 | + th.setData({ get_by_quan_list: arr }); | ||
| 890 | + } | ||
| 891 | + th.data.isget_by_quan[th.data.bn_pick] = 1; | ||
| 892 | + } | ||
| 893 | + }) | ||
| 894 | + } | ||
| 895 | + | ||
| 802 | //订单促销的包邮模板 和 活动的包邮模板要一起判断 | 896 | //订单促销的包邮模板 和 活动的包邮模板要一起判断 |
| 803 | if ((!ord_prom || ord_prom.is_post_temp) && th.data.bn_is_post_temp) { | 897 | if ((!ord_prom || ord_prom.is_post_temp) && th.data.bn_is_post_temp) { |
| 804 | var user_addr = th.data.user_addr; | 898 | var user_addr = th.data.user_addr; |
| @@ -814,98 +908,137 @@ Page({ | @@ -814,98 +908,137 @@ Page({ | ||
| 814 | }); | 908 | }); |
| 815 | } | 909 | } |
| 816 | 910 | ||
| 817 | - var cut_good_weight = 0; | ||
| 818 | - for (let i in gd_arr_list) { | ||
| 819 | - let item = gd_arr_list[i]; | ||
| 820 | 911 | ||
| 821 | - if (back_data && back_data['is_by_all'] && (!back_data.no_free_goods || back_data.no_free_goods.indexOf(item.goods_id) == -1)) { | 912 | + var is_by_quan = 0; |
| 913 | + var quan_no_goods_arr=null; | ||
| 822 | 914 | ||
| 823 | - if (item['exp_sum_type'] == 2 && back_data.weight_free > 0) { | ||
| 824 | - if (goods_weight < 0) goods_weight = 0; | ||
| 825 | - goods_weight += item['weight'] * item['buynum']; | ||
| 826 | - cut_good_weight += item['weight'] * item['buynum']; | ||
| 827 | - } | ||
| 828 | - if (back_data.weight_free > 0) { | ||
| 829 | - out_of_weight = (back_data.weight_free * 1000) - cut_good_weight; | 915 | + //如果是包邮券的时候,要看看券的情况,判断一下包邮有没有不包邮模板 |
| 916 | + if (quan_no && th.data.using_quan[pickid].isby == 1) { | ||
| 917 | + var quan = th.data.using_quan[pickid]; | ||
| 918 | + if (quan.goods_list) { | ||
| 919 | + quan_no_goods_arr = quan.goods_list.split(","); | ||
| 920 | + } else { | ||
| 921 | + is_by_quan = 1; | ||
| 922 | + } | ||
| 923 | + } | ||
| 924 | + | ||
| 925 | + //如果有包邮券的不包邮商品的时候 | ||
| 926 | + if (quan_no_goods_arr) { | ||
| 927 | + if (back_data && back_data.no_free_goods) { | ||
| 928 | + back_data['is_by_all'] = 1; | ||
| 929 | + var arr3 = back_data.no_free_goods.filter(item => { | ||
| 930 | + return quan_no_goods_arr.includes(item) | ||
| 931 | + }) | ||
| 932 | + back_data.no_free_goods = null; | ||
| 933 | + if (arr3.length) { | ||
| 934 | + back_data.no_free_goods = arr3; | ||
| 830 | } | 935 | } |
| 831 | - continue; | ||
| 832 | } | 936 | } |
| 937 | + if (!back_data || !back_data.no_free_goods) { | ||
| 938 | + if (!back_data) back_data = {}; | ||
| 939 | + back_data['is_by_all'] = 1; | ||
| 940 | + back_data['no_free_goods'] = quan_no_goods_arr; | ||
| 941 | + } | ||
| 942 | + } | ||
| 833 | 943 | ||
| 834 | - switch (item['exp_sum_type']) { | ||
| 835 | - case 1: | ||
| 836 | - //统一运费 | ||
| 837 | - o_shipping_price += item['uniform_exp_sum']; | ||
| 838 | - break; | ||
| 839 | - case 2: | ||
| 840 | - if (goods_weight < 0) goods_weight = 0; | ||
| 841 | - //累积商品重量 每种商品的重量 * 数量 | ||
| 842 | - goods_weight += item['weight'] * item['buynum']; | 944 | + if(!is_by_quan){ |
| 945 | + var cut_good_weight = 0; | ||
| 946 | + for (let i in gd_arr_list) { | ||
| 947 | + let item = gd_arr_list[i]; | ||
| 843 | 948 | ||
| 844 | - if (back_data && back_data.is_by_all && !back_data.no_free_goods) { | ||
| 845 | - cut_good_weight += item['weight'] * item['buynum']; | 949 | + if (back_data && back_data['is_by_all'] && (!back_data.no_free_goods || back_data.no_free_goods.indexOf(item.goods_id) == -1)) { |
| 950 | + | ||
| 951 | + if (item['exp_sum_type'] == 2 && back_data.weight_free > 0) { | ||
| 952 | + if (goods_weight < 0) goods_weight = 0; | ||
| 953 | + goods_weight += item['weight'] * item['buynum']; | ||
| 954 | + cut_good_weight += item['weight'] * item['buynum']; | ||
| 955 | + } | ||
| 846 | if (back_data.weight_free > 0) { | 956 | if (back_data.weight_free > 0) { |
| 847 | out_of_weight = (back_data.weight_free * 1000) - cut_good_weight; | 957 | out_of_weight = (back_data.weight_free * 1000) - cut_good_weight; |
| 848 | } | 958 | } |
| 959 | + continue; | ||
| 849 | } | 960 | } |
| 850 | - break; | ||
| 851 | - case 3: | ||
| 852 | - if (goods_piece < 0) goods_piece = 0; | ||
| 853 | - //累积商品数量 | ||
| 854 | - goods_piece += item['buynum']; | ||
| 855 | - break; | ||
| 856 | - } | ||
| 857 | - } | ||
| 858 | 961 | ||
| 859 | - //如果是正值的时候 | ||
| 860 | - if (out_of_weight >= 0) out_of_weight = -cut_good_weight; | ||
| 861 | - else out_of_weight = -back_data.weight_free * 1000; | 962 | + switch (item['exp_sum_type']) { |
| 963 | + case 1: | ||
| 964 | + //统一运费 | ||
| 965 | + o_shipping_price += item['uniform_exp_sum']; | ||
| 966 | + break; | ||
| 967 | + case 2: | ||
| 968 | + if (goods_weight < 0) goods_weight = 0; | ||
| 969 | + //累积商品重量 每种商品的重量 * 数量 | ||
| 970 | + goods_weight += item['weight'] * item['buynum']; | ||
| 971 | + | ||
| 972 | + if (back_data && back_data.is_by_all && !back_data.no_free_goods) { | ||
| 973 | + cut_good_weight += item['weight'] * item['buynum']; | ||
| 974 | + if (back_data.weight_free > 0) { | ||
| 975 | + out_of_weight = (back_data.weight_free * 1000) - cut_good_weight; | ||
| 976 | + } | ||
| 977 | + } | ||
| 978 | + break; | ||
| 979 | + case 3: | ||
| 980 | + if (goods_piece < 0) goods_piece = 0; | ||
| 981 | + //累积商品数量 | ||
| 982 | + goods_piece += item['buynum']; | ||
| 983 | + break; | ||
| 984 | + } | ||
| 985 | + } | ||
| 862 | 986 | ||
| 863 | - if(!th.data.wu_arr){ | ||
| 864 | - wx.hideLoading(); | ||
| 865 | - wx.showToast({ | ||
| 866 | - title: "物流配置未启用物流公司", icon: 'none', duration: 2000 | ||
| 867 | - }) | ||
| 868 | - //th.setData({ show_submit:0, }); | ||
| 869 | - th.setData({show_submit:1, submit: 0,same_ok:0 }) | ||
| 870 | - return false; | ||
| 871 | - } | ||
| 872 | - var code = th.data.wu_arr[th.data.index].code; | ||
| 873 | - | ||
| 874 | - //--------------开始计算物流------------------ | ||
| 875 | - var shipping_price = 0; | ||
| 876 | - // ut.calculatewuliu(code, o_shipping_price, goods_weight, out_of_weight, | ||
| 877 | - // goods_piece, th.data.user_addr, back_data, rs); | ||
| 878 | - | ||
| 879 | - var w_data = { | ||
| 880 | - store_id: os.stoid, code: code, | ||
| 881 | - o_shipping_price: o_shipping_price, | ||
| 882 | - goods_weight: goods_weight, | ||
| 883 | - out_of_weight: out_of_weight, goods_piece: goods_piece, | ||
| 884 | - user_addr_province: th.data.user_addr.province, | ||
| 885 | - user_addr_city: th.data.user_addr.city, | ||
| 886 | - user_addr_district: th.data.user_addr.district, | ||
| 887 | - is_by_all: back_data && back_data.is_by_all ? 1 : 0, | ||
| 888 | - no_free_goods: back_data && back_data.no_free_goods && back_data.no_free_goods.length > 0 ? 1 : 0, | ||
| 889 | - } | 987 | + //如果是正值的时候 |
| 988 | + if (out_of_weight >= 0) out_of_weight = -cut_good_weight; | ||
| 989 | + else out_of_weight = -back_data.weight_free * 1000; | ||
| 990 | + | ||
| 991 | + if (!th.data.wu_arr) { | ||
| 992 | + wx.hideLoading(); | ||
| 993 | + wx.showToast({ | ||
| 994 | + title: "物流配置未启用物流公司", icon: 'none', duration: 2000 | ||
| 995 | + }) | ||
| 996 | + //th.setData({ show_submit:0, }); | ||
| 997 | + th.setData({show_submit: 1, submit: 0, same_ok: 0}) | ||
| 998 | + return false; | ||
| 999 | + } | ||
| 1000 | + var code = th.data.wu_arr[th.data.index].code; | ||
| 1001 | + | ||
| 1002 | + //--------------开始计算物流------------------ | ||
| 1003 | + var shipping_price = 0; | ||
| 1004 | + // ut.calculatewuliu(code, o_shipping_price, goods_weight, out_of_weight, | ||
| 1005 | + // goods_piece, th.data.user_addr, back_data, rs); | ||
| 1006 | + | ||
| 1007 | + var w_data = { | ||
| 1008 | + store_id: os.stoid, code: code, | ||
| 1009 | + o_shipping_price: o_shipping_price, | ||
| 1010 | + goods_weight: goods_weight, | ||
| 1011 | + out_of_weight: out_of_weight, goods_piece: goods_piece, | ||
| 1012 | + user_addr_province: th.data.user_addr.province, | ||
| 1013 | + user_addr_city: th.data.user_addr.city, | ||
| 1014 | + user_addr_district: th.data.user_addr.district, | ||
| 1015 | + is_by_all: back_data && back_data.is_by_all ? 1 : 0, | ||
| 1016 | + no_free_goods: back_data && back_data.no_free_goods && back_data.no_free_goods.length > 0 ? 1 : 0, | ||
| 1017 | + } | ||
| 890 | 1018 | ||
| 891 | - var is_ok = 0; | ||
| 892 | - await getApp().request.promisePost('/api/weshop/order/getOrderWuLiPrice', { | ||
| 893 | - data: w_data, | ||
| 894 | - is_json: 1 | ||
| 895 | - }).then(res => { | ||
| 896 | - if (res.data.code == 0) { | ||
| 897 | - shipping_price = res.data.data; | ||
| 898 | - is_ok = 1; | ||
| 899 | - } else { | ||
| 900 | - getApp().confirmBox("计算物流错误:" + res.data.msg); | ||
| 901 | - } | ||
| 902 | - }) | ||
| 903 | - if (!is_ok) { | ||
| 904 | - th.setData({show_submit:1, submit: 0,same_ok:0 }) | ||
| 905 | - wx.hideLoading(); | ||
| 906 | - return false; | 1019 | + var is_ok = 0; |
| 1020 | + await getApp().request.promisePost('/api/weshop/order/getOrderWuLiPrice', { | ||
| 1021 | + data: w_data, | ||
| 1022 | + is_json: 1 | ||
| 1023 | + }).then(res => { | ||
| 1024 | + if (res.data.code == 0) { | ||
| 1025 | + shipping_price = res.data.data; | ||
| 1026 | + is_ok = 1; | ||
| 1027 | + } else { | ||
| 1028 | + getApp().confirmBox("计算物流错误:" + res.data.msg); | ||
| 1029 | + } | ||
| 1030 | + }) | ||
| 1031 | + if (!is_ok) { | ||
| 1032 | + th.setData({show_submit: 1, submit: 0, same_ok: 0}) | ||
| 1033 | + wx.hideLoading(); | ||
| 1034 | + return false; | ||
| 1035 | + } | ||
| 907 | } | 1036 | } |
| 908 | 1037 | ||
| 1038 | + | ||
| 1039 | + | ||
| 1040 | + | ||
| 1041 | + | ||
| 909 | //-- 计算一下订单促销 -- | 1042 | //-- 计算一下订单促销 -- |
| 910 | if (ord_prom) { | 1043 | if (ord_prom) { |
| 911 | order_prom_id = ord_prom['id']; | 1044 | order_prom_id = ord_prom['id']; |
| @@ -1026,7 +1159,7 @@ Page({ | @@ -1026,7 +1159,7 @@ Page({ | ||
| 1026 | }, | 1159 | }, |
| 1027 | 1160 | ||
| 1028 | //----计算物流的钱--- | 1161 | //----计算物流的钱--- |
| 1029 | - async calculate_same_city() { | 1162 | + async calculate_same_city(p_allpice) { |
| 1030 | //让按钮变灰色 | 1163 | //让按钮变灰色 |
| 1031 | this.setData({submit:1}); | 1164 | this.setData({submit:1}); |
| 1032 | var th = this; | 1165 | var th = this; |
| @@ -1039,7 +1172,9 @@ Page({ | @@ -1039,7 +1172,9 @@ Page({ | ||
| 1039 | var order_prom_amount=0; | 1172 | var order_prom_amount=0; |
| 1040 | 1173 | ||
| 1041 | //--全部金额-- | 1174 | //--全部金额-- |
| 1042 | - var allpice = th.data.order.order_amount + th.data.order.user_money + th.data.order.pt_tail_money; | 1175 | + var allpice = p_allpice; |
| 1176 | + var o_condition=p_allpice; | ||
| 1177 | + | ||
| 1043 | //-----------当地址不为空,且是物流时,计算物流费用---------- | 1178 | //-----------当地址不为空,且是物流时,计算物流费用---------- |
| 1044 | if (th.data.user_addr != null) { | 1179 | if (th.data.user_addr != null) { |
| 1045 | 1180 | ||
| @@ -1145,7 +1280,7 @@ Page({ | @@ -1145,7 +1280,7 @@ Page({ | ||
| 1145 | 1280 | ||
| 1146 | } else { | 1281 | } else { |
| 1147 | 1282 | ||
| 1148 | - var allpice = th.data.order.order_amount + th.data.order.user_money + th.data.order.tail_money; | 1283 | + |
| 1149 | 1284 | ||
| 1150 | //-- 计算一下订单促销 -- | 1285 | //-- 计算一下订单促销 -- |
| 1151 | if (ord_prom) { | 1286 | if (ord_prom) { |
| @@ -1339,6 +1474,397 @@ Page({ | @@ -1339,6 +1474,397 @@ Page({ | ||
| 1339 | var th = this; | 1474 | var th = this; |
| 1340 | th.setData({bn_use_commission: !th.data.bn_use_commission}); | 1475 | th.setData({bn_use_commission: !th.data.bn_use_commission}); |
| 1341 | th.calculatePrice2(); | 1476 | th.calculatePrice2(); |
| 1342 | - } | 1477 | + }, |
| 1478 | + | ||
| 1479 | + //------ 获取立即购买的购物车的劵 -------- | ||
| 1480 | + get_buy_now_quan: function () { | ||
| 1481 | + var quanlist = null, th = this, frozenQuan = null; | ||
| 1482 | + var good = this.data.goods; | ||
| 1483 | + | ||
| 1484 | + //一件代发商品不使用优惠券 | ||
| 1485 | + if (good.whsle_id) return false; | ||
| 1486 | + if(!th.data.check_quan_ware_list) return false; | ||
| 1487 | + | ||
| 1488 | + //--如果商家后台没有限制使用优惠券,同时商品的优惠活动没有限制使用优惠券-- | ||
| 1489 | + if (th.data.is_close_quan != 1 && good.is_xz_yh != 1 && th.data.check_quan_ware_list) { | ||
| 1490 | + var url0 = "/api/weshop/users/frozenQuan/listFrozenQuan/" + app.globalData.user_id; | ||
| 1491 | + var url = "/api/weshop/couponList/getUseCouponList"; | ||
| 1492 | + app.request.promiseGet(url0, { 1: 1 }).then(res => { | ||
| 1493 | + if (res.data.code == 0) { | ||
| 1494 | + frozenQuan = res.data.data; | ||
| 1495 | + th.data.frozenQuan = frozenQuan; | ||
| 1496 | + } | ||
| 1497 | + app.request.time_limit_get(6, url, { | ||
| 1498 | + data: { | ||
| 1499 | + storeId: oo.stoid, | ||
| 1500 | + userId: app.globalData.user_id, | ||
| 1501 | + BuySum: th.data.ckeck_quan_price, | ||
| 1502 | + WareIds: encodeURIComponent(th.data.check_quan_ware_list), | ||
| 1503 | + pageSize: 100 | ||
| 1504 | + }, | ||
| 1505 | + success: function (res) { | ||
| 1506 | + if (res.data.code == 0) { | ||
| 1507 | + quanlist = res.data.data.pageData; | ||
| 1508 | + if (quanlist) { | ||
| 1509 | + quanlist = th.check_is_frozenQuan(quanlist, frozenQuan); | ||
| 1510 | + th.setData({ selected_quan_list: quanlist }) | ||
| 1511 | + } | ||
| 1512 | + } | ||
| 1513 | + } | ||
| 1514 | + }) | ||
| 1515 | + }) | ||
| 1516 | + } | ||
| 1517 | + }, | ||
| 1518 | + | ||
| 1519 | + //--验证是否已经冻结-- | ||
| 1520 | + check_is_frozenQuan: function (quanlist, frozenQuan, isby) { | ||
| 1521 | + console.log("券列表", quanlist); | ||
| 1522 | + if (!quanlist) return null; | ||
| 1523 | + if (!frozenQuan) return quanlist; | ||
| 1524 | + var arr = []; | ||
| 1525 | + for (var i = 0; i < quanlist.length; i++) { | ||
| 1526 | + var item = quanlist[i]; | ||
| 1527 | + var is_find = 0; | ||
| 1528 | + var Q_no = quanlist[i].CashRepNo; | ||
| 1529 | + if (isby) Q_no = quanlist[i].no; | ||
| 1530 | + for (var j = 0; j < frozenQuan.length; j++) { | ||
| 1531 | + var q_no = frozenQuan[j].cashRepNo; | ||
| 1532 | + if (Q_no == q_no) { | ||
| 1533 | + is_find = 1; | ||
| 1534 | + break; | ||
| 1535 | + } | ||
| 1536 | + } | ||
| 1537 | + if (!is_find) arr.push(item); | ||
| 1538 | + } | ||
| 1539 | + return arr; | ||
| 1540 | + }, | ||
| 1541 | + | ||
| 1542 | + /*----券的所有操作----*/ | ||
| 1543 | + open_coupon_list: function (e) { | ||
| 1544 | + var th = this; | ||
| 1545 | + var pickid = e.currentTarget.dataset.pickid; | ||
| 1546 | + var bn = e.currentTarget.dataset.bn; | ||
| 1547 | + var cindx = e.currentTarget.dataset.cind; | ||
| 1548 | + | ||
| 1549 | + if (bn == 1) { | ||
| 1550 | + th.setData({ open_quan: 1, selected_quan_pick: pickid, disabled: 1 }); | ||
| 1551 | + } else { | ||
| 1552 | + //---多单打开券的时候,就要判断券在其他门店是否有使用--- | ||
| 1553 | + var quanlist = th.data.cartlist[cindx].quan_list; | ||
| 1554 | + var exp_type = th.data.cartlist[cindx].exp_type; | ||
| 1555 | + | ||
| 1556 | + | ||
| 1557 | + //对于在其他门店已经选择了的券 要判断是否显示到界面 | ||
| 1558 | + var t_user = th.data.using_quan[pickid]; | ||
| 1559 | + | ||
| 1560 | + for (var i in quanlist) { | ||
| 1561 | + quanlist[i].is_using = th.check_in_sele(quanlist[i].CashRepNo, pickid); | ||
| 1562 | + if (t_user && quanlist[i].CashRepNo == t_user.coupon_no) | ||
| 1563 | + quanlist[i].show_red = 1; | ||
| 1564 | + else | ||
| 1565 | + quanlist[i].show_red = 0; | ||
| 1566 | + } | ||
| 1567 | + | ||
| 1568 | + if (get_by_quan_list_cart) { | ||
| 1569 | + for (var i in get_by_quan_list_cart) { | ||
| 1570 | + get_by_quan_list_cart[i].is_using = th.check_in_sele(get_by_quan_list_cart[i].no, pickid); | ||
| 1571 | + if (t_user && get_by_quan_list_cart[i].no == t_user.coupon_no) | ||
| 1572 | + get_by_quan_list_cart[i].show_red = 1; | ||
| 1573 | + else | ||
| 1574 | + get_by_quan_list_cart[i].show_red = 0; | ||
| 1575 | + } | ||
| 1576 | + th.setData({ by_quan_list_cart: get_by_quan_list_cart }); | ||
| 1577 | + } else { | ||
| 1578 | + th.setData({ by_quan_list_cart: null }); | ||
| 1579 | + } | ||
| 1580 | + | ||
| 1581 | + console.log("2222222券的列表", quanlist); | ||
| 1582 | + th.setData({ | ||
| 1583 | + sele_cart_ind: cindx, | ||
| 1584 | + sele_exp_type: exp_type, | ||
| 1585 | + open_quan: 1, | ||
| 1586 | + selected_quan_pick: pickid, | ||
| 1587 | + selected_quan_list: quanlist, | ||
| 1588 | + disabled: 1 | ||
| 1589 | + }); | ||
| 1590 | + } | ||
| 1591 | + }, | ||
| 1592 | + close_coupon: function (e) { | ||
| 1593 | + var th = this; | ||
| 1594 | + th.setData({ open_quan: 0, disabled: 0 }); | ||
| 1595 | + }, | ||
| 1596 | + | ||
| 1597 | + /*--点击选择券--*/ | ||
| 1598 | + sele_quan_item: function (e) { | ||
| 1599 | + | ||
| 1600 | + var ind = e.currentTarget.dataset.ind; | ||
| 1601 | + var quan_item = this.data.selected_quan_list[ind]; | ||
| 1602 | + var pickid = this.data.selected_quan_pick; //现在选择的是哪一个门店 | ||
| 1603 | + //--如果券是单品使用的时候-- | ||
| 1604 | + if (quan_item && quan_item.UseObjectType && quan_item.UseObjectType == "20") { | ||
| 1605 | + //---只有多件购买的时候才要计算,//购物车购买和搭配勾的时候--- | ||
| 1606 | + var gg = getApp().get_b_now(); | ||
| 1607 | + if (this.data.is_b_now == 0 || gg.prom_type == 5) { | ||
| 1608 | + var arr = this.data.order_prom_list_cart; | ||
| 1609 | + var t_pk_item = null; | ||
| 1610 | + for (var ii in arr) { | ||
| 1611 | + var ep = arr[ii]; | ||
| 1612 | + if (pickid == ep.pickup_id) { | ||
| 1613 | + t_pk_item = ep; | ||
| 1614 | + break; | ||
| 1615 | + } | ||
| 1616 | + } | ||
| 1617 | + //--寻找券指定的商品-- | ||
| 1618 | + var gd = null; | ||
| 1619 | + if (t_pk_item) { | ||
| 1620 | + var goods = t_pk_item.goods; | ||
| 1621 | + for (var gid in goods) { | ||
| 1622 | + if (quan_item.UseObjectID == goods[gid].erpwareid) { | ||
| 1623 | + gd = goods[gid]; | ||
| 1624 | + } | ||
| 1625 | + } | ||
| 1626 | + } | ||
| 1627 | + if (!gd) { | ||
| 1628 | + getApp().my_warnning("未找到指定商品使用", 0, this, 600); | ||
| 1629 | + return false; | ||
| 1630 | + } | ||
| 1631 | + //计算价格,如果有平摊的实收要计算实收的金额 | ||
| 1632 | + var item_price = gd.goods_price * gd.goods_num; | ||
| 1633 | + //-- 如果有平摊下去,有实收价格的时候,就要用account_fir来计算价格 -- | ||
| 1634 | + if (gd.account_fir != null && gd.account_fir != undefined) { | ||
| 1635 | + item_price = gd.account_fir * gd.goods_num; | ||
| 1636 | + } | ||
| 1637 | + | ||
| 1638 | + if (item_price < parseFloat(quan_item.BuySum)) { | ||
| 1639 | + getApp().my_warnning("该单品金额没有大于等于" + quan_item.BuySum + "元时不能使用优惠券", 0, this, 600); | ||
| 1640 | + return false; | ||
| 1641 | + } | ||
| 1642 | + } | ||
| 1643 | + } | ||
| 1644 | + | ||
| 1645 | + var no_use = e.currentTarget.dataset.no, quanlist = this.data.selected_quan_list; | ||
| 1646 | + //---所有的券的显示红色选择都清理一遍--- | ||
| 1647 | + for (var i in quanlist) { | ||
| 1648 | + quanlist[i].show_red = 0; | ||
| 1649 | + } | ||
| 1650 | + this.setData({ selected_quan_list: quanlist }); | ||
| 1651 | + var by_quanlist = this.data.get_by_quan_list; | ||
| 1652 | + if (by_quanlist) { | ||
| 1653 | + //---所有的券的显示红色选择都清理一遍--- | ||
| 1654 | + for (var inb in by_quanlist) { | ||
| 1655 | + by_quanlist[inb].show_red = 0; | ||
| 1656 | + } | ||
| 1657 | + this.setData({ get_by_quan_list: by_quanlist }); | ||
| 1658 | + } | ||
| 1659 | + | ||
| 1660 | + var by_cart_list = this.data.by_quan_list_cart; | ||
| 1661 | + if (by_cart_list) { | ||
| 1662 | + //---所有的券的显示红色选择都清理一遍--- | ||
| 1663 | + for (var inc in by_cart_list) { | ||
| 1664 | + by_cart_list[inc].show_red = 0; | ||
| 1665 | + } | ||
| 1666 | + this.setData({ by_quan_list_cart: by_cart_list }); | ||
| 1667 | + } | ||
| 1668 | + | ||
| 1669 | + var using_quan = this.data.using_quan; | ||
| 1670 | + var th = this; | ||
| 1671 | + //---如果是不使用优惠券--- | ||
| 1672 | + if (no_use == 1) { | ||
| 1673 | + console.log("有进来吗券", no_use); | ||
| 1674 | + if (using_quan[th.data.selected_quan_pick]) { | ||
| 1675 | + using_quan[th.data.selected_quan_pick].is_nouse_red = 1; | ||
| 1676 | + } | ||
| 1677 | + else { | ||
| 1678 | + using_quan[th.data.selected_quan_pick] = { is_nouse_red: 1 }; | ||
| 1679 | + } | ||
| 1680 | + this.setData({ using_quan: using_quan, is_coupon: th.is_coupon }); | ||
| 1681 | + return; | ||
| 1682 | + } | ||
| 1683 | + | ||
| 1684 | + | ||
| 1685 | + var txt = "selected_quan_list[" + ind + "].show_red"; | ||
| 1686 | + var obj = {}; | ||
| 1687 | + obj[txt] = 1; | ||
| 1688 | + if (quan_item.show_red) { | ||
| 1689 | + obj[txt] = 0; | ||
| 1690 | + } | ||
| 1691 | + this.setData(obj); | ||
| 1692 | + console.log(this.data.selected_quan_list, "选中的券的下标", quan_item, "数据都在这里", txt); | ||
| 1693 | + if (using_quan[th.data.selected_quan_pick]) { | ||
| 1694 | + using_quan[th.data.selected_quan_pick].is_nouse_red = 0; | ||
| 1695 | + } | ||
| 1696 | + else { | ||
| 1697 | + using_quan[th.data.selected_quan_pick] = { is_nouse_red: 0 }; | ||
| 1698 | + } | ||
| 1699 | + this.setData({ using_quan: using_quan }); | ||
| 1700 | + | ||
| 1701 | + }, | ||
| 1702 | + | ||
| 1703 | + /*----- 点击选择包邮券 -----*/ | ||
| 1704 | + sele_quan_item_by: function (e) { | ||
| 1705 | + var no_use = e.currentTarget.dataset.no; | ||
| 1706 | + //立即购买的包邮券 | ||
| 1707 | + var by_quanlist = this.data.get_by_quan_list; | ||
| 1708 | + if (by_quanlist) { | ||
| 1709 | + //---所有的券的显示红色选择都清理一遍--- | ||
| 1710 | + for (var ind in by_quanlist) { | ||
| 1711 | + by_quanlist[ind].show_red = 0; | ||
| 1712 | + } | ||
| 1713 | + this.setData({ get_by_quan_list: by_quanlist }); | ||
| 1714 | + } | ||
| 1715 | + | ||
| 1716 | + //普通券 | ||
| 1717 | + var quanlist = this.data.selected_quan_list; | ||
| 1718 | + if (quanlist) { | ||
| 1719 | + //---所有的券的显示红色选择都清理一遍--- | ||
| 1720 | + for (var ind in quanlist) { | ||
| 1721 | + quanlist[ind].show_red = 0; | ||
| 1722 | + } | ||
| 1723 | + this.setData({ selected_quan_list: quanlist }); | ||
| 1724 | + } | ||
| 1725 | + | ||
| 1726 | + var th = this; | ||
| 1727 | + var using_quan = this.data.using_quan; | ||
| 1728 | + //---如果是不使用优惠券--- | ||
| 1729 | + if (no_use == 1) { | ||
| 1730 | + if (using_quan[th.data.selected_quan_pick]) { | ||
| 1731 | + using_quan[th.data.selected_quan_pick].is_nouse_red = 1; | ||
| 1732 | + } | ||
| 1733 | + else { | ||
| 1734 | + using_quan[th.data.selected_quan_pick] = { is_nouse_red: 1 }; | ||
| 1735 | + } | ||
| 1736 | + this.setData({ using_quan: using_quan, is_coupon: th.is_coupon }); | ||
| 1737 | + return; | ||
| 1738 | + } | ||
| 1739 | + | ||
| 1740 | + var pickid = th.data.selected_quan_pick; //现在选择的是哪一个门店 | ||
| 1741 | + var ind = e.currentTarget.dataset.ind; | ||
| 1742 | + //--如果是立即购买的部分-- | ||
| 1743 | + var txt = ""; | ||
| 1744 | + var txt1 = ""; | ||
| 1745 | + var quan_item = null; | ||
| 1746 | + | ||
| 1747 | + quan_item = this.data.get_by_quan_list[ind]; | ||
| 1748 | + txt = "get_by_quan_list[" + ind + "].show_red"; | ||
| 1749 | + var obj = {}; | ||
| 1750 | + obj[txt] = 1; | ||
| 1751 | + this.setData(obj); | ||
| 1752 | + | ||
| 1753 | + | ||
| 1754 | + if (using_quan[th.data.selected_quan_pick]) { | ||
| 1755 | + using_quan[th.data.selected_quan_pick].is_nouse_red = 0; | ||
| 1756 | + } | ||
| 1757 | + else { | ||
| 1758 | + using_quan[th.data.selected_quan_pick] = { is_nouse_red: 0 }; | ||
| 1759 | + } | ||
| 1760 | + this.setData({ using_quan: using_quan }); | ||
| 1761 | + }, | ||
| 1762 | + | ||
| 1763 | + //--确认使用券--- | ||
| 1764 | + confirm_quan: function () { | ||
| 1765 | + var using_quan = this.data.using_quan; //正在使用中的券列表 | ||
| 1766 | + var pickid = this.data.selected_quan_pick; //选中的门店ID | ||
| 1767 | + var th = this; | ||
| 1768 | + var selected_quan_list = this.data.selected_quan_list; //选择了那个门店的券列表 | ||
| 1769 | + var get_by_quan_list = this.data.get_by_quan_list; //立即购买的包邮券列表 | ||
| 1770 | + var by_quan_list_cart = this.data.by_quan_list_cart; //购物车购买的包邮券列表 | ||
| 1771 | + //选择了的券 | ||
| 1772 | + var sele_quan = null; | ||
| 1773 | + | ||
| 1774 | + //循环普通的券 | ||
| 1775 | + for (var i in selected_quan_list) { | ||
| 1776 | + var item = selected_quan_list[i]; | ||
| 1777 | + if (item.show_red) { | ||
| 1778 | + th.insert_into_using_quan(item, using_quan, pickid); | ||
| 1779 | + return; | ||
| 1780 | + } | ||
| 1781 | + } | ||
| 1782 | + //循环包邮的券,立即购买的 | ||
| 1783 | + for (var i in get_by_quan_list) { | ||
| 1784 | + var item = get_by_quan_list[i]; | ||
| 1785 | + if (item.show_red) { | ||
| 1786 | + if (th.data.is_no_by[pickid] == 1) { | ||
| 1787 | + getApp().my_warnning("已全场不能包邮,不能选择包邮券", 0, th); | ||
| 1788 | + return false; | ||
| 1789 | + } | ||
| 1790 | + if (th.data.is_by[pickid] == 1) { | ||
| 1791 | + getApp().my_warnning("已全场包邮,不能选择包邮券", 0, th); | ||
| 1792 | + return false; | ||
| 1793 | + } | ||
| 1794 | + | ||
| 1795 | + th.insert_into_using_quan(item, using_quan, pickid, 1); | ||
| 1796 | + return; | ||
| 1797 | + } | ||
| 1798 | + } | ||
| 1799 | + | ||
| 1800 | + //循环包邮的券 | ||
| 1801 | + for (var i in by_quan_list_cart) { | ||
| 1802 | + var item = by_quan_list_cart[i]; | ||
| 1803 | + if (item.show_red) { | ||
| 1804 | + if (th.data.is_no_by[pickid] == 1) { | ||
| 1805 | + getApp().my_warnning("已全场不能包邮,不能选择包邮券", 0, th); | ||
| 1806 | + return false; | ||
| 1807 | + } | ||
| 1808 | + if (th.data.is_by[pickid] == 1) { | ||
| 1809 | + getApp().my_warnning("已全场包邮,不能选择包邮券", 0, th); | ||
| 1810 | + return false; | ||
| 1811 | + } | ||
| 1812 | + th.insert_into_using_quan(item, using_quan, pickid, 1); | ||
| 1813 | + return; | ||
| 1814 | + } | ||
| 1815 | + } | ||
| 1816 | + | ||
| 1817 | + //选择了的券,看是不是点击了不使用券,点击了不使用优惠券 | ||
| 1818 | + if (using_quan[pickid]) { | ||
| 1819 | + if (using_quan[pickid].is_nouse_red == 1) { | ||
| 1820 | + using_quan[pickid] = { is_nouse_red: 1 }; | ||
| 1821 | + th.setData({ using_quan: using_quan }); | ||
| 1822 | + th.calculatePrice2(); | ||
| 1823 | + th.setData({ open_quan: 0 }); | ||
| 1824 | + return; | ||
| 1825 | + } | ||
| 1826 | + } | ||
| 1827 | + }, | ||
| 1828 | + | ||
| 1829 | + //----把券插入之后的操作,同时还要重新计算价格---- | ||
| 1830 | + insert_into_using_quan: async function (item, using_quan, pickid, isby) { | ||
| 1831 | + | ||
| 1832 | + | ||
| 1833 | + var th = this; | ||
| 1834 | + var old_quan = null; | ||
| 1835 | + if (isby == 1) { | ||
| 1836 | + using_quan[pickid] = { | ||
| 1837 | + coupon_no: item.no, | ||
| 1838 | + money: 0, | ||
| 1839 | + is_nouse_red: 0, | ||
| 1840 | + region_list: item.region_list, | ||
| 1841 | + goods_list: item.goods_list | ||
| 1842 | + }; | ||
| 1843 | + using_quan[pickid].isby = 1; | ||
| 1844 | + } else { | ||
| 1845 | + if (using_quan[pickid]) old_quan = using_quan[pickid]; | ||
| 1846 | + using_quan[pickid] = { coupon_no: item.CashRepNo, money: item.Sum, is_nouse_red: 0 }; | ||
| 1847 | + using_quan[pickid].isby = 0; | ||
| 1848 | + } | ||
| 1849 | + this.setData({ using_quan: using_quan }); | ||
| 1850 | + | ||
| 1851 | + th.calculatePrice2(function () { | ||
| 1852 | + | ||
| 1853 | + if (old_quan) using_quan[pickid] = old_quan; | ||
| 1854 | + else using_quan[pickid] = null; | ||
| 1855 | + th.setData({ using_quan: using_quan, submit: 0 }); | ||
| 1856 | + wx.showToast({ | ||
| 1857 | + title: "不能使用优惠券,同城起送价不足", | ||
| 1858 | + icon: 'none', | ||
| 1859 | + duration: 2000 | ||
| 1860 | + }) | ||
| 1861 | + | ||
| 1862 | + }); | ||
| 1863 | + | ||
| 1864 | + th.setData({ open_quan: 0 }); | ||
| 1865 | + }, | ||
| 1866 | + | ||
| 1867 | + | ||
| 1868 | + | ||
| 1343 | 1869 | ||
| 1344 | }) | 1870 | }) |
| 1345 | \ No newline at end of file | 1871 | \ No newline at end of file |
packageE/pages/cart/cart_wk/cart_wk.wxml
| 1 | <wxs module="filters" src="../../../../utils/filter.wxs"></wxs> | 1 | <wxs module="filters" src="../../../../utils/filter.wxs"></wxs> |
| 2 | +<wxs module="filter" src="../cart2/c_filter.wxs"></wxs> | ||
| 2 | 3 | ||
| 3 | <!-- 先选择配送方式,2021.7修改 --> | 4 | <!-- 先选择配送方式,2021.7修改 --> |
| 4 | <block wx:if="{{show_submit}}"> | 5 | <block wx:if="{{show_submit}}"> |
| @@ -67,6 +68,23 @@ | @@ -67,6 +68,23 @@ | ||
| 67 | 68 | ||
| 68 | </view> | 69 | </view> |
| 69 | 70 | ||
| 71 | + | ||
| 72 | +<view class="xc-coupon-frame flex-center" data-bn="1" bindtap="open_coupon_list" data-pickid="{{bn_pick}}" hidden="{{(selected_quan_list?selected_quan_list.length:0)+ (get_by_quan_list && exp_type==0?get_by_quan_list.length:0)<=0}}" wx:if="{{(selected_quan_list && selected_quan_list.length>0) || (get_by_quan_list!=null && exp_type==0 )}}"> | ||
| 73 | + <view class="work-frame flex-space-between"> | ||
| 74 | + <view class="work"> | ||
| 75 | + 优惠券 <text class="quan_num_show">{{(selected_quan_list?selected_quan_list.length:0)+ (get_by_quan_list && exp_type==0?get_by_quan_list.length:0)}}张可用</text> | ||
| 76 | + </view> | ||
| 77 | + <view class="xc-right-frame"> | ||
| 78 | + <text wx:if="{{using_quan[bn_pick].is_nouse}}">不使用</text> | ||
| 79 | + <block wx:else> | ||
| 80 | + <text wx:if="{{using_quan[bn_pick].money}}">¥{{using_quan[bn_pick].money}}元优惠券</text> | ||
| 81 | + <text wx:if="{{using_quan[bn_pick].isby}}">包邮券</text> | ||
| 82 | + </block> | ||
| 83 | + <view class="xc-right"></view> | ||
| 84 | + </view> | ||
| 85 | + </view> | ||
| 86 | +</view> | ||
| 87 | + | ||
| 70 | <view class="use-item bdr_b-14 jc_sb" wx:if='{{exp_type==0 && !is_default_logistics}}'> | 88 | <view class="use-item bdr_b-14 jc_sb" wx:if='{{exp_type==0 && !is_default_logistics}}'> |
| 71 | <view>选择物流:</view> | 89 | <view>选择物流:</view> |
| 72 | <view class="flex-vertical" bindtap="show_wu_arr" data-txt='index' style="margin-right: 8rpx;"> | 90 | <view class="flex-vertical" bindtap="show_wu_arr" data-txt='index' style="margin-right: 8rpx;"> |
| @@ -103,6 +121,14 @@ | @@ -103,6 +121,14 @@ | ||
| 103 | <text class='redwz'>¥{{order.tail_money}}</text> | 121 | <text class='redwz'>¥{{order.tail_money}}</text> |
| 104 | </view> | 122 | </view> |
| 105 | </view> | 123 | </view> |
| 124 | + | ||
| 125 | + <view class='ct_one jc_sb' wx:if="{{formData.coupon_price>0}}"> | ||
| 126 | + <view class='ct_one_left'>使用优惠券</view> | ||
| 127 | + <view class='ct_one_right'> | ||
| 128 | + <text class='redwz'>- ¥ {{formData.coupon_price}}元</text> | ||
| 129 | + </view> | ||
| 130 | + </view> | ||
| 131 | + | ||
| 106 | <view class='ct_one jc_sb' wx:if="{{exp_price>0}}"> | 132 | <view class='ct_one jc_sb' wx:if="{{exp_price>0}}"> |
| 107 | <view class='ct_one_left'>配送费用</view> | 133 | <view class='ct_one_left'>配送费用</view> |
| 108 | <view class='ct_one_right'> | 134 | <view class='ct_one_right'> |
| @@ -134,7 +160,7 @@ | @@ -134,7 +160,7 @@ | ||
| 134 | <text class='zf_left_wz'>支付合计:</text> | 160 | <text class='zf_left_wz'>支付合计:</text> |
| 135 | <text class='zf_left_red'>¥{{filters.toFix(order.tail_money+exp_price,2)}}</text> | 161 | <text class='zf_left_red'>¥{{filters.toFix(order.tail_money+exp_price,2)}}</text> |
| 136 | </view> --> | 162 | </view> --> |
| 137 | - <view class='zf_left'>支付合计:<text class='zf_left_red'>¥{{filters.toFix(order.tail_money+exp_price-(bn_use_commission?goods.use_commission:0)-(formData.order_prom_amount?formData.order_prom_amount:0) ,2)}}</text></view> | 163 | + <view class='zf_left'>支付合计:<text class='zf_left_red'>¥{{filters.toFix(order.tail_money+exp_price-formData.coupon_price-(bn_use_commission?goods.use_commission:0)-(formData.order_prom_amount?formData.order_prom_amount:0) ,2)}}</text></view> |
| 138 | <view class="zf_btn {{(submit || !same_ok)?'gray':''}}" bindtap="to_pay">支付尾款</view> | 164 | <view class="zf_btn {{(submit || !same_ok)?'gray':''}}" bindtap="to_pay">支付尾款</view> |
| 139 | </view> | 165 | </view> |
| 140 | 166 | ||
| @@ -201,3 +227,121 @@ | @@ -201,3 +227,121 @@ | ||
| 201 | </view> | 227 | </view> |
| 202 | <view style="height: 50rpx"></view> | 228 | <view style="height: 50rpx"></view> |
| 203 | 229 | ||
| 230 | +<!-- 使用券列表的弹窗 --> | ||
| 231 | +<view wx:if='{{open_quan==1}}'> | ||
| 232 | + <view class="cover-layer flex-center " bindtap='close_coupon'> </view> | ||
| 233 | + <view class="cx-popup {{open_quan==true?'up' : 'down'}}"> | ||
| 234 | + <!-- 最上面 --> | ||
| 235 | + <view class="top flex"> | ||
| 236 | + <view class="xc-top-content t-c"> | ||
| 237 | + <view class="xc-title">优惠券使用</view> | ||
| 238 | + </view> | ||
| 239 | + <view class="xc-close-frame" bindtap='close_coupon'> | ||
| 240 | + <view class="xc-close">×</view> | ||
| 241 | + </view> | ||
| 242 | + </view> | ||
| 243 | + <!-- 使用优惠券和不使用优惠券层--> | ||
| 244 | + <view class="may_use_coupon fs28 flex"> 可使用的优惠券 | ||
| 245 | + <view class=" is_use_coupon flex-vertical" bindtap="sele_quan_item" data-no="1">不使用优惠券 | ||
| 246 | + <block wx:if="{{using_quan[selected_quan_pick].is_nouse_red}}"> | ||
| 247 | + <view class="circle white xc-hooka fs20 red-b sn"><text>Γ</text></view> | ||
| 248 | + </block> | ||
| 249 | + <block wx:else> | ||
| 250 | + <view class="circle xc-hookst ons"></view> | ||
| 251 | + </block> | ||
| 252 | + </view> | ||
| 253 | + </view> | ||
| 254 | + | ||
| 255 | + <!-- 中间券内容显示 --> | ||
| 256 | + <view class="xc-frame flex-level"> | ||
| 257 | + <view class="list-frame"> | ||
| 258 | + <view wx:for="{{selected_quan_list}}" bindtap="sele_quan_item" wx:if="{{!item.is_using}}" data-ind="{{q_index}}" wx:for-item="item" wx:for-index="q_index"> | ||
| 259 | + <view class="xc-coupon-frame flex-center" data-ind="{{q_index}}"> | ||
| 260 | + <view class="coupon-frame flex rel"> | ||
| 261 | + <!-- 锯齿 --> | ||
| 262 | + <include src="../cart2/juchi_part.wxml" /> | ||
| 263 | + <!-- 左边 --> | ||
| 264 | + <view class="coupon-left rel {{filter.setcolor(item.UseObjectType)}} flex-center"> | ||
| 265 | + <view class="white xc-money-frames"> | ||
| 266 | + <view class="f_text"><text class="xc-rmb-symbol">¥</text><text class="xc-rmb-val">{{item.Sum}}</text></view> | ||
| 267 | + <view class="coupon-explain t-c" wx:if="{{item.BuySum>0}}">满{{item.BuySum}}元可用</view> | ||
| 268 | + <view class="coupon-explain t-c" wx:else>满0元可用</view> | ||
| 269 | + </view> | ||
| 270 | + </view> | ||
| 271 | + <!-- 右边 --> | ||
| 272 | + <view class="coupon-right flex-center rel"> | ||
| 273 | + <view class="coupon-annotation flex"> | ||
| 274 | + <view class="flex top-frame"> | ||
| 275 | + <view class="frame"> | ||
| 276 | + <view class="coupon-wode ib flex ellipsis-2 "> | ||
| 277 | + <text class="xc-brand t-c ib white {{filter.setcolor(item.UseObjectType)}}">{{filter.get_type_card(item.UseObjectType)}}</text> | ||
| 278 | + <block>{{item.Sum}}元优惠券</block> | ||
| 279 | + </view> | ||
| 280 | + <view class="coupon-time">{{filters.replace_time2(item.BeginDate)}}至{{item.ValidDate?filters.replace_time2(item.ValidDate):'不限'}}</view> | ||
| 281 | + </view> | ||
| 282 | + </view> | ||
| 283 | + <block wx:if="{{item.show_red}}"> | ||
| 284 | + <view class="circle white xc-hook fs20 red-b sn"><text>Γ</text></view> | ||
| 285 | + </block> | ||
| 286 | + <block wx:else> | ||
| 287 | + <view class="circle xc-hooks on"></view> | ||
| 288 | + </block> | ||
| 289 | + </view> | ||
| 290 | + <include src="../cart2/remark_click_part.wxml" /> | ||
| 291 | + </view> | ||
| 292 | + </view> | ||
| 293 | + </view> | ||
| 294 | + <!-- 打开是说明 --> | ||
| 295 | + <include src="../cart2/remark_part.wxml" /> | ||
| 296 | + </view> | ||
| 297 | + <!-- 包邮券的显示,立即购买 --> | ||
| 298 | + <block wx:if="{{get_by_quan_list && get_by_quan_list.length}}"> | ||
| 299 | + <view wx:for="{{get_by_quan_list}}" bindtap="sele_quan_item_by" wx:if="{{!item.is_using}}" data-ind="{{byq_index}}" wx:for-item="item" wx:for-index="byq_index"> | ||
| 300 | + <view class="xc-coupon-frame flex-center" data-ind="{{byq_index}}"> | ||
| 301 | + <view class="coupon-frame flex rel"> | ||
| 302 | + <!-- 锯齿 --> | ||
| 303 | + <include src="../cart2/juchi_part.wxml" /> | ||
| 304 | + <!-- 左边 --> | ||
| 305 | + <view class="coupon-left rel {{filter.setcolor(item.UseObjectType)}} flex-center"> | ||
| 306 | + <view class="white xc-money-frames"> | ||
| 307 | + <view class="f_text"><text class="xc-rmb-val">包邮券</text></view> | ||
| 308 | + <view class="coupon-explain t-c" wx:if="{{item.condition>0}}">满{{item.condition}}元可用</view> | ||
| 309 | + <view class="coupon-explain t-c" wx:else>满0元可用</view> | ||
| 310 | + </view> | ||
| 311 | + </view> | ||
| 312 | + <!-- 右边 --> | ||
| 313 | + <view class="coupon-right flex-center rel"> | ||
| 314 | + <view class="coupon-annotation flex"> | ||
| 315 | + <view class="flex top-frame"> | ||
| 316 | + <view class="frame"> | ||
| 317 | + <view class="coupon-wode ib flex ellipsis-2 "> | ||
| 318 | + <text class="xc-brand t-c ib white {{filter.setcolor(item.UseObjectType)}}">{{filter.get_type_card(0)}}</text> | ||
| 319 | + <block>包邮券</block> | ||
| 320 | + </view> | ||
| 321 | + <view class="coupon-time">{{filters.format_time(item.use_start_time)}}至{{item.use_end_time?filters.format_time(item.use_end_time):'不限'}}</view> | ||
| 322 | + </view> | ||
| 323 | + </view> | ||
| 324 | + <block wx:if="{{item.show_red}}"> | ||
| 325 | + <view class="circle white xc-hook fs20 red-b sn"><text>Γ</text></view> | ||
| 326 | + </block> | ||
| 327 | + <block wx:else> | ||
| 328 | + <view class="circle xc-hooks on"></view> | ||
| 329 | + </block> | ||
| 330 | + </view> | ||
| 331 | + <include src="../cart2/remark_click_part2.wxml" /> | ||
| 332 | + </view> | ||
| 333 | + </view> | ||
| 334 | + </view> | ||
| 335 | + <!-- 打开是说明 --> | ||
| 336 | + <include src="../cart2/remark_part.wxml" /> | ||
| 337 | + </view> | ||
| 338 | + </block> | ||
| 339 | + | ||
| 340 | + </view> | ||
| 341 | + </view> | ||
| 342 | + <!-- 最底下确定层--> | ||
| 343 | + <view class="determine-frame"> | ||
| 344 | + <view class="xc-confirm flex-center" bindtap="confirm_quan"> 确定 </view> | ||
| 345 | + </view> | ||
| 346 | + </view> | ||
| 347 | +</view> |
packageE/pages/cart/cart_wk/cart_wk.wxss
packageE/pages/user/monthgiftbag/giftpackbuy/giftpackbuy.wxss
packageE/pages/user/monthgiftbag/giftpacklist/giftpacklist.js
packageE/pages/user/monthgiftbag/giftpacklist/giftpacklist.wxml
| @@ -152,7 +152,34 @@ | @@ -152,7 +152,34 @@ | ||
| 152 | <view class="foot_empty data-v-3a5b7e36"></view> | 152 | <view class="foot_empty data-v-3a5b7e36"></view> |
| 153 | 153 | ||
| 154 | <block wx:if="{{flag != 1}}"> | 154 | <block wx:if="{{flag != 1}}"> |
| 155 | - <block wx:if="{{isBuy==0 && giftTitle}}"> | 155 | + |
| 156 | + <!-- 已经领取过的orderSn是有值的 --> | ||
| 157 | + <block wx:if="{{isBuy==0 && orderSn}}"> | ||
| 158 | + <view class="foot_button data-v-3a5b7e36"> | ||
| 159 | + <block wx:if="{{is_lb!=1}}"> | ||
| 160 | + <view class="foot_button_buy data-v-3a5b7e36 overdue"> | ||
| 161 | + <text class="data-v-3a5b7e36">无核销商品</text> | ||
| 162 | + </view> | ||
| 163 | + </block> | ||
| 164 | + <block wx:else> | ||
| 165 | + <view wx:if="{{c_state==-1}}" class="foot_button_buy data-v-3a5b7e36 overdue" > | ||
| 166 | + <text class="data-v-3a5b7e36">兑换未开始</text> | ||
| 167 | + </view> | ||
| 168 | + <view wx:if="{{c_state==0}}" class="foot_button_buy data-v-3a5b7e36" bindtap="getcode"> | ||
| 169 | + <text class="data-v-3a5b7e36">立即使用</text> | ||
| 170 | + </view> | ||
| 171 | + <view wx:if="{{c_state==1}}" class="foot_button_buy data-v-3a5b7e36 overdue" bindtap="getcode"> | ||
| 172 | + <text class="data-v-3a5b7e36">商品已核销</text> | ||
| 173 | + </view> | ||
| 174 | + <view wx:if="{{c_state==2}}" class="foot_button_buy data-v-3a5b7e36 overdue"> | ||
| 175 | + <text class="data-v-3a5b7e36">商品兑换时间已过</text> | ||
| 176 | + </view> | ||
| 177 | + </block> | ||
| 178 | + </view> | ||
| 179 | + </block> | ||
| 180 | + | ||
| 181 | + <!-- 没有订单号,说明要进来领取 --> | ||
| 182 | + <block wx:elif="{{isBuy==0 && giftTitle}}"> | ||
| 156 | <block wx:if="{{isStart==1}}"> | 183 | <block wx:if="{{isStart==1}}"> |
| 157 | <view class="foot_button data-v-3a5b7e36"> | 184 | <view class="foot_button data-v-3a5b7e36"> |
| 158 | <!-- <block wx:if="{{giftPrice>0 && giftIntegral>0}}"> | 185 | <!-- <block wx:if="{{giftPrice>0 && giftIntegral>0}}"> |
| @@ -192,29 +219,9 @@ | @@ -192,29 +219,9 @@ | ||
| 192 | </block> --> | 219 | </block> --> |
| 193 | 220 | ||
| 194 | </block> | 221 | </block> |
| 195 | - <block wx:if="{{isBuy==0 && orderSn}}"> | ||
| 196 | - <view class="foot_button data-v-3a5b7e36"> | ||
| 197 | - <block wx:if="{{is_lb!=1}}"> | ||
| 198 | - <view class="foot_button_buy data-v-3a5b7e36 overdue"> | ||
| 199 | - <text class="data-v-3a5b7e36">无核销商品</text> | ||
| 200 | - </view> | ||
| 201 | - </block> | ||
| 202 | - <block wx:else> | ||
| 203 | - <view wx:if="{{c_state==-1}}" class="foot_button_buy data-v-3a5b7e36 overdue" > | ||
| 204 | - <text class="data-v-3a5b7e36">兑换未开始</text> | ||
| 205 | - </view> | ||
| 206 | - <view wx:if="{{c_state==0}}" class="foot_button_buy data-v-3a5b7e36" bindtap="getcode"> | ||
| 207 | - <text class="data-v-3a5b7e36">立即使用</text> | ||
| 208 | - </view> | ||
| 209 | - <view wx:if="{{c_state==1}}" class="foot_button_buy data-v-3a5b7e36 overdue" bindtap="getcode"> | ||
| 210 | - <text class="data-v-3a5b7e36">商品已核销</text> | ||
| 211 | - </view> | ||
| 212 | - <view wx:if="{{c_state==2}}" class="foot_button_buy data-v-3a5b7e36 overdue"> | ||
| 213 | - <text class="data-v-3a5b7e36">商品兑换时间已过</text> | ||
| 214 | - </view> | ||
| 215 | - </block> | ||
| 216 | - </view> | ||
| 217 | - </block> | 222 | + |
| 223 | + | ||
| 224 | + | ||
| 218 | </block> | 225 | </block> |
| 219 | 226 | ||
| 220 | </view> | 227 | </view> |
packageE/pages/user/monthgiftbag/monthgiftbag.js
| @@ -3,9 +3,11 @@ var e = getApp(), | @@ -3,9 +3,11 @@ var e = getApp(), | ||
| 3 | a = e.globalData.setting, | 3 | a = e.globalData.setting, |
| 4 | os = a, | 4 | os = a, |
| 5 | t = e.request, | 5 | t = e.request, |
| 6 | - d = e.globalData; | 6 | + d = e.globalData,ut=i; |
| 7 | + | ||
| 7 | Page({ | 8 | Page({ |
| 8 | data: { | 9 | data: { |
| 10 | + url: a.url, //接口网址 | ||
| 9 | iurl: a.imghost, //图片前缀网址 | 11 | iurl: a.imghost, //图片前缀网址 |
| 10 | getDate: "", | 12 | getDate: "", |
| 11 | getStorageID: '', | 13 | getStorageID: '', |
| @@ -118,7 +120,8 @@ Page({ | @@ -118,7 +120,8 @@ Page({ | ||
| 118 | user_id: th.data.getUserID, //用户ID | 120 | user_id: th.data.getUserID, //用户ID |
| 119 | page: th.data.curpage, | 121 | page: th.data.curpage, |
| 120 | pageSize: th.data.pageSize, | 122 | pageSize: th.data.pageSize, |
| 121 | - pay_state:1 | 123 | + pay_state:1, |
| 124 | + isdetail:1 | ||
| 122 | }; | 125 | }; |
| 123 | 126 | ||
| 124 | if(this.data.sear_key){ | 127 | if(this.data.sear_key){ |
| @@ -157,6 +160,44 @@ Page({ | @@ -157,6 +160,44 @@ Page({ | ||
| 157 | 160 | ||
| 158 | // arr2[j].virtualsales=arr2[j].virtualSales | 161 | // arr2[j].virtualsales=arr2[j].virtualSales |
| 159 | // arr2[j].lbnum=arr2[j].lbNum | 162 | // arr2[j].lbnum=arr2[j].lbNum |
| 163 | + | ||
| 164 | + | ||
| 165 | + | ||
| 166 | + if(!arr2[j].receive_ordersn){ | ||
| 167 | + arr2[j].is_no_rev=1; | ||
| 168 | + } | ||
| 169 | + | ||
| 170 | + arr2[j].is_detail=0; | ||
| 171 | + if(arr2[j].detaillist){ | ||
| 172 | + arr2[j].is_detail=1; | ||
| 173 | + }else{ | ||
| 174 | + continue; | ||
| 175 | + } | ||
| 176 | + | ||
| 177 | + | ||
| 178 | + | ||
| 179 | + arr2[j].lbType=0; | ||
| 180 | + if(arr2[j].detaillist.iswarelbtype){ | ||
| 181 | + arr2[j].lbType=1; | ||
| 182 | + } | ||
| 183 | + //---获取日期的时间戳--- | ||
| 184 | + var t_endtime = arr2[j].detaillist.endTime; | ||
| 185 | + t_endtime = t_endtime.replace(/-/g, '/'); | ||
| 186 | + var t_date = new Date(t_endtime) / 1000; | ||
| 187 | + var t_now = ut.gettimestamp(); | ||
| 188 | + | ||
| 189 | + var t_starttime = arr2[j].detaillist.starTime; | ||
| 190 | + t_starttime = t_starttime.replace(/-/g, '/'); | ||
| 191 | + var t_sdate = new Date(t_starttime) / 1000; | ||
| 192 | + | ||
| 193 | + arr2[j].c_state=0 | ||
| 194 | + if (arr2[j].detaillist.goodsUseState) | ||
| 195 | + arr2[j].c_state=1 | ||
| 196 | + else if (t_date <= t_now) | ||
| 197 | + arr2[j].c_state=2 | ||
| 198 | + else if (t_sdate > t_now) | ||
| 199 | + arr2[j].c_state=-1 | ||
| 200 | + | ||
| 160 | } | 201 | } |
| 161 | 202 | ||
| 162 | 203 | ||
| @@ -260,7 +301,101 @@ Page({ | @@ -260,7 +301,101 @@ Page({ | ||
| 260 | input_sear(e){ | 301 | input_sear(e){ |
| 261 | let value = e.detail; | 302 | let value = e.detail; |
| 262 | this.data.sear_key=value; | 303 | this.data.sear_key=value; |
| 263 | - } | 304 | + }, |
| 305 | + | ||
| 306 | + //-- 获取核销码 --- | ||
| 307 | + getcode: function (e) { | ||
| 308 | + var th = this; | ||
| 309 | + let codeId = e.currentTarget.dataset.codeid; | ||
| 310 | + let orderSn = e.currentTarget.dataset.ordersn; | ||
| 311 | + var json = { | ||
| 312 | + "storeId": a.stoid, | ||
| 313 | + "orderSn": orderSn, | ||
| 314 | + } | ||
| 315 | + if (codeId && codeId !== "") { | ||
| 316 | + json.id = codeId | ||
| 317 | + } | ||
| 318 | + var data = JSON.stringify(json); | ||
| 319 | + var url = th.data.url + "/api/weshop/marketing/gift/goods/verify/code/get"; //预约接口地址 | ||
| 320 | + getApp().request.json_post(url, json, | ||
| 321 | + function (res) { | ||
| 322 | + if (res.data.code == 0) { | ||
| 323 | + th.setData({ | ||
| 324 | + code: res.data.data | ||
| 325 | + }) | ||
| 326 | + th.code_show(); | ||
| 327 | + } else { | ||
| 328 | + getApp().my_warnning(res.data.msg, 0, th); | ||
| 329 | + } | ||
| 330 | + }, | ||
| 331 | + function (res) { | ||
| 332 | + | ||
| 333 | + }, | ||
| 334 | + "put" | ||
| 335 | + ) | ||
| 336 | + }, | ||
| 337 | + | ||
| 338 | + //显示核销码 | ||
| 339 | + code_show: function (e) { | ||
| 340 | + var th = this; | ||
| 341 | + //--获取成功的时候-- | ||
| 342 | + var no = th.data.code; | ||
| 343 | + var qc_com = th.selectComponent("#qc_com"); //组件的id | ||
| 344 | + var obj = { | ||
| 345 | + val: no, | ||
| 346 | + content: "请将二维码展示给核销员,收货更快捷" | ||
| 347 | + }; | ||
| 348 | + qc_com.open(obj) | ||
| 349 | + }, | ||
| 350 | + | ||
| 351 | + getGift(e){ | ||
| 352 | + var that=this; | ||
| 353 | + if (that.data.islogin) { | ||
| 354 | + return | ||
| 355 | + } | ||
| 356 | + that.setData({ | ||
| 357 | + islogin:true | ||
| 358 | + }) | ||
| 359 | + | ||
| 360 | + var record_list_id=e.currentTarget.dataset.record_list_id; | ||
| 361 | + var index=e.currentTarget.dataset.index; | ||
| 362 | + | ||
| 363 | + var json = { | ||
| 364 | + "id":record_list_id,// "记录Id", | ||
| 365 | + "storeId": that.data.getStorageID, //商家Id | ||
| 366 | + "userId": that.data.getUserID, //用户ID | ||
| 367 | + }; | ||
| 368 | + // var url ="/api/weshop/marketing/buy/receive/gift/record/insert"; | ||
| 369 | + // var url ="/api/weshop/marketing/marketingMonthgiftbagRecord/createOrder"; | ||
| 370 | + var url ="/api/weshop/marketing/marketingMonthgiftbagRecord/recordReceive"; | ||
| 371 | + getApp().request.json_post(url, json, | ||
| 372 | + function (res) { | ||
| 373 | + console.log('领取礼包'); | ||
| 374 | + console.log(res); | ||
| 375 | + if (res.data.code == 0 && res.data.data) { | ||
| 376 | + | ||
| 377 | + var txt="wareCard["+index+"]is_receive"; | ||
| 378 | + that.setData({ | ||
| 379 | + [txt]:1 | ||
| 380 | + }) | ||
| 381 | + getApp().my_warnning("领取成功!", 1, that); | ||
| 382 | + | ||
| 383 | + } else { | ||
| 384 | + that.setData({submit:0}) | ||
| 385 | + getApp().my_warnning(res.data.msg, 0, that); | ||
| 386 | + } | ||
| 387 | + that.setData({ | ||
| 388 | + islogin:false | ||
| 389 | + }) | ||
| 390 | + }, | ||
| 391 | + function (res) { | ||
| 392 | + that.setData({submit:0}) | ||
| 393 | + } | ||
| 394 | + ) | ||
| 395 | + }, | ||
| 396 | + | ||
| 397 | + | ||
| 398 | + | ||
| 264 | 399 | ||
| 265 | 400 | ||
| 266 | }); | 401 | }); |
| 267 | \ No newline at end of file | 402 | \ No newline at end of file |
packageE/pages/user/monthgiftbag/monthgiftbag.json
| @@ -4,6 +4,7 @@ | @@ -4,6 +4,7 @@ | ||
| 4 | "usingComponents": { | 4 | "usingComponents": { |
| 5 | "warn": "/components/long_warn/long_warn", | 5 | "warn": "/components/long_warn/long_warn", |
| 6 | "my_confirm": "/components/my_confirm/my_confirm", | 6 | "my_confirm": "/components/my_confirm/my_confirm", |
| 7 | - "lb_sear": "/components/lb_sear/lb_sear" | 7 | + "lb_sear": "/components/lb_sear/lb_sear", |
| 8 | + "qr_code": "/components/qr_code/qr_code" | ||
| 8 | } | 9 | } |
| 9 | } | 10 | } |
| 10 | \ No newline at end of file | 11 | \ No newline at end of file |
packageE/pages/user/monthgiftbag/monthgiftbag.wxml
| @@ -103,9 +103,40 @@ | @@ -103,9 +103,40 @@ | ||
| 103 | 103 | ||
| 104 | </view> | 104 | </view> |
| 105 | </view> | 105 | </view> |
| 106 | - <view wx:if="{{item.is_back !=1}}" class="content_box_button" bindtap="navigateTo" data-url="/packageE/pages/user/monthgiftbag/giftpacklist/giftpacklist?isBuy=0&lbId={{item.lbId}}&cover_img={{item.cover_img}}&orderSn={{item.receive_ordersn}}&record_list_id={{item.record_list_id}}&is_receive={{item.is_receive}}"> | ||
| 107 | - <button wx:if="{{item.receive_ordersn}}">立即使用</button> | ||
| 108 | - <button wx:else>立即领取</button> | 106 | + <view wx:if="{{item.is_back !=1}}" class="content_box_button" bindtap="navigateTo" |
| 107 | + data-url="/packageE/pages/user/monthgiftbag/giftpacklist/giftpacklist?isBuy=0&lbId={{item.lbId}}&cover_img={{item.cover_img}}&orderSn={{item.receive_ordersn}}&record_list_id={{item.record_list_id}}&is_receive={{item.is_receive}}"> | ||
| 108 | + | ||
| 109 | + <button wx:if="{{item.is_detail || item.is_no_rev}}" class="white" style="margin-right:10rpx">查看详情</button> | ||
| 110 | + <button wx:else class="white">查看详情</button> | ||
| 111 | + | ||
| 112 | + | ||
| 113 | + <!-- 已经领取过的,有单号 --> | ||
| 114 | + <block wx:if="{{item.receive_ordersn}}"> | ||
| 115 | + | ||
| 116 | + <block wx:if="{{item.is_detail}}"> | ||
| 117 | + <block wx:if="{{item.lbType==1}}" > | ||
| 118 | + <button wx:if="{{item.c_state==-1}}" class="overdue">兑换未开始</button> | ||
| 119 | + <button wx:if="{{item.c_state==0}}" data-ordersn="{{item.receive_ordersn}}" catchtap="getcode">立即使用</button> | ||
| 120 | + <button wx:if="{{item.c_state==1}}" data-ordersn="{{item.receive_ordersn}}" catchtap="getcode" class="overdue">商品已核销</button> | ||
| 121 | + <button wx:if="{{item.c_state==2}}" class="overdue">商品兑换时间已过</button> | ||
| 122 | + </block> | ||
| 123 | + | ||
| 124 | + <block wx:else> | ||
| 125 | + <button class="overdue">无核销商品</button> | ||
| 126 | + </block> | ||
| 127 | + </block> | ||
| 128 | + </block> | ||
| 129 | + <!-- 点击领取后的动画效果--> | ||
| 130 | + <block wx:elif="{{item.is_receive}}"> | ||
| 131 | + <button class="overdue">已领取</button> | ||
| 132 | + </block> | ||
| 133 | + <!-- 未领取的 --> | ||
| 134 | + <block wx:else> | ||
| 135 | + <button catchtap="getGift" data-index="{{index}}" data-record_list_id="{{item.record_list_id}}" data-id="{{item.lbId}}" >立即领取</button> | ||
| 136 | + </block> | ||
| 137 | + | ||
| 138 | + | ||
| 139 | + | ||
| 109 | </view> | 140 | </view> |
| 110 | <view class="content_box_button" style="color:#b9b5b5;" wx:else>已退款</view> | 141 | <view class="content_box_button" style="color:#b9b5b5;" wx:else>已退款</view> |
| 111 | </view> | 142 | </view> |
| @@ -134,4 +165,6 @@ | @@ -134,4 +165,6 @@ | ||
| 134 | </view> | 165 | </view> |
| 135 | <!-- 引入提示组件 --> | 166 | <!-- 引入提示组件 --> |
| 136 | <warn id="warn"></warn> | 167 | <warn id="warn"></warn> |
| 137 | -<my_confirm id="my_confirm"></my_confirm> | ||
| 138 | \ No newline at end of file | 168 | \ No newline at end of file |
| 169 | +<my_confirm id="my_confirm"></my_confirm> | ||
| 170 | +<!-- 弹出框扫描 --> | ||
| 171 | +<qr_code id="qc_com"></qr_code> | ||
| 139 | \ No newline at end of file | 172 | \ No newline at end of file |
packageE/pages/user/monthgiftbag/monthgiftbag.wxss
| @@ -184,8 +184,18 @@ | @@ -184,8 +184,18 @@ | ||
| 184 | background: #d41c34; | 184 | background: #d41c34; |
| 185 | color: #fff; | 185 | color: #fff; |
| 186 | line-height: 50rpx; | 186 | line-height: 50rpx; |
| 187 | + border-radius:10rpx; | ||
| 187 | } | 188 | } |
| 188 | 189 | ||
| 190 | + | ||
| 191 | +.content_box_button button.white { | ||
| 192 | + | ||
| 193 | + background: #fff; | ||
| 194 | + color: #666; | ||
| 195 | + | ||
| 196 | +} | ||
| 197 | + | ||
| 198 | + | ||
| 189 | .foot_box { | 199 | .foot_box { |
| 190 | -webkit-align-content: center; | 200 | -webkit-align-content: center; |
| 191 | align-content: center; | 201 | align-content: center; |
| @@ -251,3 +261,8 @@ page { | @@ -251,3 +261,8 @@ page { | ||
| 251 | .After_all .end { | 261 | .After_all .end { |
| 252 | margin: 0rpx 15rpx; | 262 | margin: 0rpx 15rpx; |
| 253 | } | 263 | } |
| 264 | + | ||
| 265 | + | ||
| 266 | +.content_box_button button.overdue{ | ||
| 267 | + background: rgb(153,153,153); | ||
| 268 | +} | ||
| 254 | \ No newline at end of file | 269 | \ No newline at end of file |