Commit 21555f9b826f8d21f2bd99daf0db3a8a10b3b0da
Merge branch 'dev_oa_fu2' into dev
Showing
7 changed files
with
179 additions
and
60 deletions
packageB/pages/zuhegou/index/index.js
| ... | ... | @@ -597,6 +597,16 @@ Page({ |
| 597 | 597 | return |
| 598 | 598 | } |
| 599 | 599 | |
| 600 | + if(this.data.act.zh_num>0 && this.data.act.zh_num<=this.data.act.zh_buy_num){ | |
| 601 | + wx.showToast({ | |
| 602 | + title: '组合总数不足!', | |
| 603 | + icon: 'none', | |
| 604 | + duration: 2000 | |
| 605 | + }) | |
| 606 | + return | |
| 607 | + } | |
| 608 | + | |
| 609 | + | |
| 600 | 610 | //说明是加入购物车是时候 |
| 601 | 611 | this.data.is_zuhe_addcart = 1; |
| 602 | 612 | if (!haveAdded) { |
| ... | ... | @@ -640,14 +650,18 @@ Page({ |
| 640 | 650 | return false; |
| 641 | 651 | } else { |
| 642 | 652 | //先判断一下线下库存 |
| 643 | - th.check_pk_store_conut(function(){ | |
| 644 | - th.setData({ | |
| 645 | - is_no_pipei: 0 | |
| 646 | - }); | |
| 647 | - th.check_is_in_cart(function () { | |
| 648 | - th.add_cart_func(); | |
| 653 | + | |
| 654 | + th.chect_act_zh_num(function (){ | |
| 655 | + th.check_pk_store_conut(function(){ | |
| 656 | + th.setData({ | |
| 657 | + is_no_pipei: 0 | |
| 658 | + }); | |
| 659 | + th.check_is_in_cart(function () { | |
| 660 | + th.add_cart_func(); | |
| 661 | + }) | |
| 649 | 662 | }) |
| 650 | 663 | }) |
| 664 | + | |
| 651 | 665 | } |
| 652 | 666 | } else { |
| 653 | 667 | |
| ... | ... | @@ -2023,6 +2037,13 @@ Page({ |
| 2023 | 2037 | |
| 2024 | 2038 | // -- 加入之前,先判断有没有在购物车中,没有商品就添加 -- |
| 2025 | 2039 | check_is_in_cart: function (func) { |
| 2040 | + | |
| 2041 | + var act=this.data.act; | |
| 2042 | + if(act.zh_num>0 && act.zh_num<=act.zh_buy_num){ | |
| 2043 | + func(); | |
| 2044 | + return false; | |
| 2045 | + } | |
| 2046 | + | |
| 2026 | 2047 | var th = this; |
| 2027 | 2048 | var index = th.data.sele_index; |
| 2028 | 2049 | var txt = "list[" + index + "].haveAdded"; |
| ... | ... | @@ -2518,5 +2539,38 @@ Page({ |
| 2518 | 2539 | } |
| 2519 | 2540 | } |
| 2520 | 2541 | return zhqty_bz_flag; |
| 2542 | + }, | |
| 2543 | + | |
| 2544 | + chect_act_zh_num(func){ | |
| 2545 | + var userInfo = getApp().globalData.userInfo; | |
| 2546 | + //获取活动信息 | |
| 2547 | + var url = "/api/weshop/prom/zhbuy/get/" + os.stoid + "/" + this.data.id + "/" + userInfo.user_id; | |
| 2548 | + getApp().request.get(url, { | |
| 2549 | + success: function (e) { | |
| 2550 | + if (e.data.code == 0 && e.data.data) { | |
| 2551 | + var t_act=e.data.data; | |
| 2552 | + if(t_act.zh_num>0 && t_act.zh_num<=t_act.zh_buy_num){ | |
| 2553 | + wx.showToast({ | |
| 2554 | + title: '组合活动不足!', | |
| 2555 | + icon: 'none', | |
| 2556 | + duration: 2000 | |
| 2557 | + }) | |
| 2558 | + return false; | |
| 2559 | + } | |
| 2560 | + func(); | |
| 2561 | + | |
| 2562 | + }else{ | |
| 2563 | + wx.showToast({ | |
| 2564 | + title: '未找到活动!', | |
| 2565 | + icon: 'none', | |
| 2566 | + duration: 2000 | |
| 2567 | + }) | |
| 2568 | + } | |
| 2569 | + | |
| 2570 | + } | |
| 2571 | + }) | |
| 2521 | 2572 | } |
| 2573 | + | |
| 2574 | + | |
| 2575 | + | |
| 2522 | 2576 | }) |
| 2523 | 2577 | \ No newline at end of file | ... | ... |
packageE/pages/cart/cart2/cart2.js
| ... | ... | @@ -714,6 +714,10 @@ Page({ |
| 714 | 714 | //---是不是购买等级卡成功的返回---等级卡显示的判断--- |
| 715 | 715 | var is_card_back = getApp().globalData.is_card_back; |
| 716 | 716 | |
| 717 | + | |
| 718 | + //-- 判断组合购是总数量是不是存在 -- | |
| 719 | + var no_zh_num={}; | |
| 720 | + | |
| 717 | 721 | for (var i = 0; i < carr.length; i++) { |
| 718 | 722 | var item1 = carr[i]; |
| 719 | 723 | //把已经购买了多少见的内容填入 |
| ... | ... | @@ -761,11 +765,20 @@ Page({ |
| 761 | 765 | await th.add_prom_goods_map(item1); |
| 762 | 766 | } |
| 763 | 767 | |
| 764 | - //要把组合购的东西拿出来算一下 | |
| 768 | + //-- 如果组合购的总数量不足的处理 -- | |
| 769 | + if(no_zh_num[item1.prom_id] && item1.prom_type == 7){ | |
| 770 | + item1.prom_type = 0; | |
| 771 | + item1.prom_type1 = 0; | |
| 772 | + item1.prom_id = 0; | |
| 773 | + item1.prom_id1 = 0 | |
| 774 | + } | |
| 775 | + | |
| 776 | + //要把组合购的东西拿出来算一下,同时组合购的总数量要有存在 | |
| 765 | 777 | if (item1.prom_type == 7) { |
| 766 | 778 | if (!th.data.zuhe_map_good[item1.prom_id]) { |
| 767 | 779 | var isok = 1; |
| 768 | 780 | var is_flag = 1; |
| 781 | + var store_count_ok=1; | |
| 769 | 782 | //如果有组合购 |
| 770 | 783 | var url = "/api/weshop/prom/zhbuy/get/" + os.stoid + "/" + item1.prom_id + '/' + getApp().globalData.userInfo.user_id; |
| 771 | 784 | await getApp().request.promiseGet(url, {}).then(res => { |
| ... | ... | @@ -778,39 +791,61 @@ Page({ |
| 778 | 791 | isok = 0; |
| 779 | 792 | } |
| 780 | 793 | item1.act = res.data.data; |
| 781 | - th.data.zhhe_act_map[item1.prom_id] = res.data.data; | |
| 794 | + | |
| 795 | + //-- 在这里要判断一下活动的组合购总数量 -- | |
| 796 | + if(item1.act.zh_num>0 && item1.act.zh_buy_num>=item1.act.zh_num){ | |
| 797 | + store_count_ok = 0; | |
| 798 | + no_zh_num[item1.prom_id]=1; | |
| 799 | + //-- 清理一下活动的状态 -- | |
| 800 | + item1.prom_type = 0; | |
| 801 | + item1.prom_type1 = 0; | |
| 802 | + item1.prom_id = 0; | |
| 803 | + item1.prom_id1 = 0 | |
| 804 | + | |
| 805 | + }else{ | |
| 806 | + th.data.zhhe_act_map[item1.prom_id] = res.data.data; | |
| 807 | + } | |
| 808 | + | |
| 782 | 809 | } else { |
| 783 | 810 | //未找到商品的活动 |
| 784 | 811 | is_flag = 0; |
| 785 | 812 | } |
| 786 | 813 | }) |
| 814 | + | |
| 787 | 815 | if (!isok) { |
| 788 | 816 | getApp().my_warnning("组合购的活动已经过期", 0, th); |
| 789 | 817 | return false; |
| 790 | 818 | } |
| 791 | - var url1 = "/api/weshop/prom/zhbuyGoods/page"; | |
| 792 | - var req_data = { | |
| 793 | - page: 1, | |
| 794 | - pageSize: 2000, | |
| 795 | - store_id: os.stoid, | |
| 796 | - zh_id: item1.prom_id, | |
| 797 | - } | |
| 798 | - await getApp().request.promiseGet(url1, { | |
| 799 | - data: req_data | |
| 800 | - }).then(res => { | |
| 801 | - if (ut.ajax_ok(res)) { | |
| 802 | - var gdlist = res.data.data.pageData; | |
| 803 | - gdlist.forEach(i => { | |
| 804 | - if (item1.goods_id == i.goods_id && !is_flag) { | |
| 805 | - item1.prom_type = 0; | |
| 806 | - item1.prom_type1 = 0; | |
| 807 | - item1.prom_id = 0; | |
| 808 | - item1.prom_id1 = 0 | |
| 819 | + | |
| 820 | + //------ 先增组合活动的总数量的时候 ------- | |
| 821 | + if(store_count_ok) { | |
| 822 | + var url1 = "/api/weshop/prom/zhbuyGoods/page"; | |
| 823 | + var req_data = { | |
| 824 | + page: 1, | |
| 825 | + pageSize: 2000, | |
| 826 | + store_id: os.stoid, | |
| 827 | + zh_id: item1.prom_id, | |
| 828 | + } | |
| 829 | + await getApp().request.promiseGet(url1, { | |
| 830 | + data: req_data | |
| 831 | + }).then(res => { | |
| 832 | + if (ut.ajax_ok(res)) { | |
| 833 | + var gdlist = res.data.data.pageData; | |
| 834 | + gdlist.forEach(i => { | |
| 835 | + if (item1.goods_id == i.goods_id && !is_flag) { | |
| 836 | + item1.prom_type = 0; | |
| 837 | + item1.prom_type1 = 0; | |
| 838 | + item1.prom_id = 0; | |
| 839 | + item1.prom_id1 = 0 | |
| 840 | + } | |
| 841 | + }) | |
| 842 | + th.data.zuhe_map_good[item1.prom_id] = gdlist; | |
| 809 | 843 | } |
| 810 | 844 | }) |
| 811 | - th.data.zuhe_map_good[item1.prom_id] = gdlist; | |
| 812 | - } | |
| 813 | - }) | |
| 845 | + } | |
| 846 | + | |
| 847 | + | |
| 848 | + | |
| 814 | 849 | } |
| 815 | 850 | else { |
| 816 | 851 | item1.act = th.data.zhhe_act_map[item1.prom_id]; |
| ... | ... | @@ -3982,6 +4017,7 @@ Page({ |
| 3982 | 4017 | |
| 3983 | 4018 | var order_prom_list_cart = th.data.order_prom_list_cart; |
| 3984 | 4019 | |
| 4020 | + | |
| 3985 | 4021 | //--组装推送数据-- |
| 3986 | 4022 | for (var i = 0; i < order_prom_list_cart.length; i++) { |
| 3987 | 4023 | var t_item = order_prom_list_cart[i]; |
| ... | ... | @@ -4119,6 +4155,8 @@ Page({ |
| 4119 | 4155 | var df_room_ids = ""; |
| 4120 | 4156 | |
| 4121 | 4157 | |
| 4158 | + //此单的组合活动汇总 | |
| 4159 | + var zh_map_count={}; | |
| 4122 | 4160 | var check_map = {}; |
| 4123 | 4161 | let groupchat_ids=[] |
| 4124 | 4162 | //-------------让商品添加到商品列表-------------------- |
| ... | ... | @@ -4179,6 +4217,7 @@ Page({ |
| 4179 | 4217 | case 7: |
| 4180 | 4218 | goods.prom_type = 7; |
| 4181 | 4219 | goods.prom_id = g_item.prom_id; |
| 4220 | + zh_map_count[g_item.prom_id]=1; //汇总一下组合购的活动 | |
| 4182 | 4221 | break |
| 4183 | 4222 | default: |
| 4184 | 4223 | goods.prom_type = 0; |
| ... | ... | @@ -4264,7 +4303,14 @@ Page({ |
| 4264 | 4303 | } |
| 4265 | 4304 | |
| 4266 | 4305 | |
| 4267 | - | |
| 4306 | + //-- 如果订单中有组合购 --- | |
| 4307 | + if(Object.keys(zh_map_count).length){ | |
| 4308 | + var zhlist=[]; | |
| 4309 | + for (var kf in zh_map_count) { | |
| 4310 | + zhlist.push({zhid:kf}); | |
| 4311 | + } | |
| 4312 | + item.zhlist=zhlist; | |
| 4313 | + } | |
| 4268 | 4314 | |
| 4269 | 4315 | //如果房间号不为空的时候 |
| 4270 | 4316 | if (room_ids != "") item.room_ids = ut.sub_last(room_ids); |
| ... | ... | @@ -4364,6 +4410,8 @@ Page({ |
| 4364 | 4410 | } |
| 4365 | 4411 | |
| 4366 | 4412 | var str = JSON.stringify(pdata); |
| 4413 | + console.log(str,'aaaaaaaaaaaaaaa'); | |
| 4414 | + //return false; | |
| 4367 | 4415 | |
| 4368 | 4416 | wx.showLoading({ title: "加载中" }); |
| 4369 | 4417 | th.setData({ submit: 1, }) | ... | ... |
packageE/pages/cart/cart2/ladder_calculate.js
| ... | ... | @@ -43,6 +43,7 @@ module.exports = { |
| 43 | 43 | for (var j = 0; j < item.cart_num; j++) { |
| 44 | 44 | no_in_arr.push({ |
| 45 | 45 | price: item.goods_price, |
| 46 | + goods_market_price:item.goods_market_price, | |
| 46 | 47 | offline_price: item.offline_price, |
| 47 | 48 | goods_id: item.goods_id, |
| 48 | 49 | shop_price: item.shop_price, |
| ... | ... | @@ -65,7 +66,7 @@ module.exports = { |
| 65 | 66 | if (no_in_arr.length == 0) break; |
| 66 | 67 | let item_j =ladder_list[j]; |
| 67 | 68 | var end = no_in_arr.pop(); |
| 68 | - var new_price = parseInt(item_j.discount_field) == 1 ? end.shop_price : end.price; | |
| 69 | + var new_price = parseInt(item_j.discount_field) == 2?end.goods_market_price:(parseInt(item_j.discount_field) == 1 ? end.shop_price : end.price); | |
| 69 | 70 | var account=new_price * parseFloat(item_j.discount) / 10; |
| 70 | 71 | aprice +=account; |
| 71 | 72 | |
| ... | ... | @@ -240,7 +241,6 @@ module.exports = { |
| 240 | 241 | } |
| 241 | 242 | } |
| 242 | 243 | |
| 243 | - | |
| 244 | 244 | } |
| 245 | 245 | } |
| 246 | 246 | ... | ... |
pages/cart/cart/cart.js
pages/goods/goodsInfo/goodsInfo.js
| ... | ... | @@ -1973,7 +1973,7 @@ Page({ |
| 1973 | 1973 | } |
| 1974 | 1974 | |
| 1975 | 1975 | //如果有搭配购的时候的时候 |
| 1976 | - if(th.data.zh_act && newd.prom_type==0){ | |
| 1976 | + if(th.data.zh_act && (!th.data.zh_act.zh_num || th.data.zh_act.zh_buy_num>th.data.zh_act.zh_num ) && newd.prom_type==0){ | |
| 1977 | 1977 | newd.prom_type = 7; |
| 1978 | 1978 | newd.prom_id = th.data.zh_act.id; |
| 1979 | 1979 | } |
| ... | ... | @@ -7724,6 +7724,11 @@ Page({ |
| 7724 | 7724 | isok = 0; |
| 7725 | 7725 | } |
| 7726 | 7726 | |
| 7727 | + //还未开始 | |
| 7728 | + if (res.data.data.zh_num>0 && res.data.data.zh_num<=res.data.data.zh_buy_num ) { | |
| 7729 | + isok = 0; | |
| 7730 | + } | |
| 7731 | + | |
| 7727 | 7732 | } else { |
| 7728 | 7733 | //未找到商品的活动 |
| 7729 | 7734 | isok = 0; | ... | ... |
pages/user/order_detail/order_detail.js
| ... | ... | @@ -1222,26 +1222,31 @@ Page({ |
| 1222 | 1222 | b_item.price = prom.price; |
| 1223 | 1223 | } |
| 1224 | 1224 | break; |
| 1225 | - case 6: | |
| 1226 | - b_item.is_pd_normal = 1; | |
| 1227 | - break; | |
| 1228 | - case 7: | |
| 1229 | - //如果有组合购 | |
| 1230 | - var url = "/api/weshop/prom/zhbuy/get/" + os.stoid + "/" + good.prom_id + "/" + getApp().globalData.userInfo.user_id; | |
| 1231 | - await getApp().request.promiseGet(url, {}).then(res => { | |
| 1232 | - if (res.data.code == 0 && res.data.data) { | |
| 1233 | - if (res.data.data.is_show == 1 && res.data.data.is_end == 0 | |
| 1234 | - && ut.gettimestamp() < res.data.data.end_time | |
| 1235 | - && ut.gettimestamp() > res.data.data.start_time | |
| 1236 | - ) { | |
| 1237 | - b_item.prom_type = 7; | |
| 1238 | - b_item.prom_id = res.data.data.id; | |
| 1239 | - good.prom_type = 7; | |
| 1240 | - good.prom_id = res.data.data.id; | |
| 1241 | - } | |
| 1242 | - } | |
| 1243 | - }) | |
| 1244 | - break; | |
| 1225 | + case 6: | |
| 1226 | + b_item.is_pd_normal = 1; | |
| 1227 | + break; | |
| 1228 | + case 7: | |
| 1229 | + //如果有组合购 | |
| 1230 | + var url = "/api/weshop/prom/zhbuy/get/" + os.stoid + "/" + good.prom_id + "/" + getApp().globalData.userInfo.user_id; | |
| 1231 | + await getApp().request.promiseGet(url, {}).then(res => { | |
| 1232 | + if (res.data.code == 0 && res.data.data) { | |
| 1233 | + | |
| 1234 | + var t_act=res.data.data; | |
| 1235 | + if(!t_act.zh_num || t_act.zh_num>t_act.zh_buy_num) { | |
| 1236 | + | |
| 1237 | + if (res.data.data.is_show == 1 && res.data.data.is_end == 0 | |
| 1238 | + && ut.gettimestamp() < res.data.data.end_time | |
| 1239 | + && ut.gettimestamp() > res.data.data.start_time | |
| 1240 | + ) { | |
| 1241 | + b_item.prom_type = 7; | |
| 1242 | + b_item.prom_id = res.data.data.id; | |
| 1243 | + good.prom_type = 7; | |
| 1244 | + good.prom_id = res.data.data.id; | |
| 1245 | + } | |
| 1246 | + } | |
| 1247 | + } | |
| 1248 | + }) | |
| 1249 | + break; | |
| 1245 | 1250 | case 10: |
| 1246 | 1251 | |
| 1247 | 1252 | var url = `/api/weshop/prom/ladderForm/getNew/${os.stoid}/${user_id}/${good.prom_id}`; |
| ... | ... | @@ -1252,7 +1257,7 @@ Page({ |
| 1252 | 1257 | } |
| 1253 | 1258 | }) |
| 1254 | 1259 | break; |
| 1255 | - } | |
| 1260 | + } | |
| 1256 | 1261 | |
| 1257 | 1262 | |
| 1258 | 1263 | //如果有优惠促销的时候,要看下商品的优惠活动有没有过期 | ... | ... |
pages/user/order_list/order_list.js
| ... | ... | @@ -1583,13 +1583,16 @@ Page({ |
| 1583 | 1583 | var url = "/api/weshop/prom/zhbuy/get/" + os.stoid + "/" + good.prom_id + "/" + getApp().globalData.userInfo.user_id; |
| 1584 | 1584 | await getApp().request.promiseGet(url, {}).then(res => { |
| 1585 | 1585 | if (res.data.code == 0 && res.data.data) { |
| 1586 | - if (res.data.data.is_show == 1 && res.data.data.is_end == 0 | |
| 1587 | - && ut.gettimestamp() < res.data.data.end_time | |
| 1588 | - && ut.gettimestamp() > res.data.data.start_time | |
| 1589 | - ) { | |
| 1590 | - b_item.prom_type = 7; | |
| 1591 | - b_item.prom_id = res.data.data.id; | |
| 1586 | + var t_act=res.data.data; | |
| 1587 | + if(!t_act.zh_num || t_act.zh_num>t_act.zh_buy_num) { | |
| 1588 | + if (res.data.data.is_show == 1 && res.data.data.is_end == 0 | |
| 1589 | + && ut.gettimestamp() < res.data.data.end_time | |
| 1590 | + && ut.gettimestamp() > res.data.data.start_time | |
| 1591 | + ) { | |
| 1592 | + b_item.prom_type = 7; | |
| 1593 | + b_item.prom_id = res.data.data.id; | |
| 1592 | 1594 | |
| 1595 | + } | |
| 1593 | 1596 | } |
| 1594 | 1597 | } |
| 1595 | 1598 | }) | ... | ... |