Commit 1672593197a2ac590ed7acd4fefb8fd31135d7e9
1 parent
bbbda7ec
优惠促销优化显示
Showing
2 changed files
with
26 additions
and
15 deletions
components/promate_pop/promate_pop.js
... | ... | @@ -40,7 +40,6 @@ Component({ |
40 | 40 | copy_obj.more=ut.format_yh_act(prom_list[i]); |
41 | 41 | copy_obj.is_no_sele=1; |
42 | 42 | copy_obj.condition=prom_list[i].condition + (prom_list[i].prom_type == 1 ? '件' : '元'), |
43 | - copy_obj.limit='每人' + (copy_obj.limit_num ? '限参与' + copy_obj.limit_num + '次' : '参与不限次'), | |
44 | 43 | copy_obj.yh_index=i; //优惠阶梯 |
45 | 44 | cx_prom_group.splice(yh_index+i,0,copy_obj); |
46 | 45 | } | ... | ... |
pages/goods/goodsInfo/goodsInfo.js
... | ... | @@ -267,7 +267,7 @@ Page({ |
267 | 267 | base_nor_prom_type: 0, |
268 | 268 | base_nor_prom_id: 0, |
269 | 269 | base_nor_goods_id: 0, |
270 | - user_pre_buynum: 0, //用户优惠促销参与次数 | |
270 | + user_pre_buynum: 0, //用户优惠促销参与次数,这个字段只针对优惠促销 | |
271 | 271 | keyword: '', //门店搜索 |
272 | 272 | sec_i: -1, //选中分类门店 下标 |
273 | 273 | cx_prom_group: [], //促销活动,用于显示和判断默认要用什么促销活动 |
... | ... | @@ -909,6 +909,10 @@ Page({ |
909 | 909 | |
910 | 910 | getApp().check_can_share(this); |
911 | 911 | |
912 | + //-- 要清空,因为有回退。优惠促的数组,购买数量要清理成1 -- | |
913 | + this.data.cx_prom_group=[]; | |
914 | + this.data.goodsInputNum=1; | |
915 | + | |
912 | 916 | var goods_list = null, |
913 | 917 | th = this, |
914 | 918 | that = this; |
... | ... | @@ -2629,10 +2633,10 @@ Page({ |
2629 | 2633 | var th = this; |
2630 | 2634 | var usr = getApp().globalData.userInfo; |
2631 | 2635 | if (this.data.sele_g.prom_type != 0 && this.data.sele_g.prom_type != 3 && !this.data.sele_g.whsle_id) { |
2632 | - callback(); | |
2636 | + callback(); | |
2633 | 2637 | } else { |
2634 | - //-- 判断有没有优惠活动 -- | |
2635 | - getApp().request.promiseGet("/api/weshop/goods/getGoodsPromListNew1/" + os.stoid + "/" + th.data.sele_g.goods_id + "/0" + "/" + usr.user_id, {}).then(async res => { | |
2638 | + //-- 判断有没有优惠活动 -- | |
2639 | + getApp().request.promiseGet("/api/weshop/goods/getGoodsPromListNew1/" + os.stoid + "/" + th.data.sele_g.goods_id + "/0" + "/" + usr.user_id, {}).then(async res => { | |
2636 | 2640 | if (res.data.code == 0) { |
2637 | 2641 | |
2638 | 2642 | var r_data = res.data.data; |
... | ... | @@ -2684,7 +2688,6 @@ Page({ |
2684 | 2688 | } |
2685 | 2689 | }, |
2686 | 2690 | |
2687 | - | |
2688 | 2691 | //----获取线下价格------- |
2689 | 2692 | get_off_price() { |
2690 | 2693 | var th = this; |
... | ... | @@ -7483,7 +7486,7 @@ Page({ |
7483 | 7486 | //-- 计算一下限购,满足限购数才显示 -- |
7484 | 7487 | if (fir_act.limit_num ) { |
7485 | 7488 | await this.getUserBuyPromNum_pre(fir_act.prom_id); |
7486 | - if(th.data.user_pre_buynum < fir_act.limit_num){ | |
7489 | + if(th.data.user_pre_buynum >= fir_act.limit_num){ | |
7487 | 7490 | is_yh_out_limit=1; |
7488 | 7491 | } |
7489 | 7492 | |
... | ... | @@ -7582,7 +7585,7 @@ Page({ |
7582 | 7585 | prom_goods: r_data.promGoodsLists, |
7583 | 7586 | }) |
7584 | 7587 | } |
7585 | - th.is_show_more_buy(); | |
7588 | + | |
7586 | 7589 | |
7587 | 7590 | } |
7588 | 7591 | }) |
... | ... | @@ -7634,6 +7637,8 @@ Page({ |
7634 | 7637 | }) |
7635 | 7638 | } |
7636 | 7639 | |
7640 | + th.is_show_more_buy(); | |
7641 | + | |
7637 | 7642 | //-- 如果有促销活动也算是有参与活动,参与活动的也统一不进行计算起订的数量 -- |
7638 | 7643 | this.data.is_act = 0; |
7639 | 7644 | if (this.data.zh_act || this.data.prom_goods || this.data.jieti_prom || this.data.collocationGoods) { |
... | ... | @@ -7703,16 +7708,22 @@ Page({ |
7703 | 7708 | id: 0 |
7704 | 7709 | }; |
7705 | 7710 | } |
7711 | + | |
7706 | 7712 | var prom = null; |
7707 | - //-- 看有没有选中的活动 -- | |
7708 | - var fd = this.data.cx_prom_group.findIndex(function (a) { | |
7709 | - return a.sele == 1; | |
7710 | - }) | |
7713 | + prom = JSON.parse(JSON.stringify(this.data.cx_prom_group[0])); | |
7714 | + | |
7715 | + //-- 要判断有没有超出限购 -- | |
7716 | + if(prom.prom_type==3 && prom.is_yh_out_limit){ | |
7717 | + if(this.data.cx_prom_group.length>1){ | |
7718 | + prom=this.data.cx_prom_group[1]; | |
7719 | + }else{ | |
7720 | + prom.prom_type=0; | |
7721 | + prom.id=0; | |
7722 | + } | |
7723 | + } | |
7711 | 7724 | |
7712 | - prom = this.data.cx_prom_group[0]; | |
7713 | - if (fd > -1) prom = this.data.cx_prom_group[fd]; | |
7714 | 7725 | if (ind) { |
7715 | - return prom.prom_type; | |
7726 | + return prom.prom_type; | |
7716 | 7727 | } |
7717 | 7728 | return prom; |
7718 | 7729 | }, |
... | ... | @@ -7745,6 +7756,7 @@ Page({ |
7745 | 7756 | if (this.data.card_field && this.data.sele_g[this.data.card_field] > 0) { |
7746 | 7757 | per_price = this.data.sele_g[this.data.card_field]; |
7747 | 7758 | } |
7759 | + | |
7748 | 7760 | var all_price = per_price * this.data.goodsInputNum; |
7749 | 7761 | var con = null; |
7750 | 7762 | for (var i in prom_goods) { | ... | ... |