Commit 8da54d0161ec2fcfaec16c2c746388dfdf4d0b9c
1 parent
af4f3123
优化
Showing
2 changed files
with
140 additions
and
66 deletions
components/add_purchase/add_purchase.js
| ... | ... | @@ -18,9 +18,145 @@ Component({ |
| 18 | 18 | properties: { |
| 19 | 19 | |
| 20 | 20 | }, |
| 21 | + | |
| 21 | 22 | lifetimes: { |
| 22 | - attached: function () { | |
| 23 | + // attached: function () { | |
| 24 | + // // this.clearTime() | |
| 25 | + // console.error('加购组件'); | |
| 26 | + // self = this | |
| 27 | + // // 在组件实例进入页面节点树时执行 | |
| 28 | + // let ee = this, that = ee, th = ee; | |
| 29 | + // //先获取一下导购的门店 | |
| 30 | + // th.check_guide(() => { | |
| 31 | + // th.get_user_store(); | |
| 32 | + // }) | |
| 33 | + // //----获取系统参数----- | |
| 34 | + // getApp().getConfig2(function (e) { | |
| 35 | + // ee.setData({ | |
| 36 | + // bconfig: e, | |
| 37 | + // sales_rules: e.sales_rules, | |
| 38 | + // }); | |
| 39 | + // th.wait_for_store_config(); | |
| 40 | + // if (e.categoryset.indexOf("," + 1 + ",") != -1) { | |
| 41 | + // ee.setData({ | |
| 42 | + // is_show_pl: 1 | |
| 43 | + // }); | |
| 44 | + // } | |
| 45 | + // if (e.categoryset.indexOf("," + 3 + ",") != -1) { | |
| 46 | + // ee.setData({ | |
| 47 | + // is_show_pp: 1 | |
| 48 | + // }); | |
| 49 | + // } | |
| 50 | + // if (e.categoryset.indexOf("," + 2 + ",") != -1) { | |
| 51 | + // ee.setData({ | |
| 52 | + // is_show_gb: 1 | |
| 53 | + // }); | |
| 54 | + // } | |
| 55 | + // console.log('获取系统参数'); | |
| 56 | + // console.log(e); | |
| 57 | + // var json_d = JSON.parse(e.switch_list); | |
| 58 | + // ee.setData({ | |
| 59 | + // store_config: e, | |
| 60 | + // sys_switch: json_d, | |
| 61 | + // is_closecoupon: json_d.is_closecoupon, | |
| 62 | + // is_newsales_rules: json_d.is_newsales_rules, | |
| 63 | + // is_retail_price: json_d.is_retail_price || 0, | |
| 64 | + // appoint_pick_keyid: json_d.appoint_pick_keyid, | |
| 65 | + // // goods_bottomconent:e.goods_bottomconent | |
| 66 | + // }); | |
| 67 | + | |
| 68 | + // //判断商品详情要有东西 | |
| 69 | + // // if (e && e.goods_bottomconent) { | |
| 70 | + // // //商品详情广告---- | |
| 71 | + // // a.wxParse("goodInfo_ad", "html", ut.format_content(e.goods_bottomconent), ee, 6); | |
| 72 | + // // common.wxParseAddFullImageUrl(ee, "goodInfo_ad"); | |
| 73 | + // // //------- | |
| 74 | + // // } | |
| 75 | + | |
| 76 | + // //------几人评价------- | |
| 77 | + // //n.init(th, "", "comments"); | |
| 78 | + | |
| 79 | + // // th.requestCardNum(), | |
| 80 | + // wx.pageScrollTo && th.setData({ | |
| 81 | + // supportPageScroll: !0 | |
| 82 | + // }); | |
| 83 | + | |
| 84 | + // //计算等级价相关 | |
| 85 | + // var swithc_list = e.switch_list; | |
| 86 | + // var sw_arr = JSON.parse(swithc_list); | |
| 87 | + // console.log('plus-111') | |
| 88 | + // //---如果后台又开等级卡的开关--- | |
| 89 | + // ut.get_plus_name_price(sw_arr, th); | |
| 90 | + | |
| 91 | + // }, 1); | |
| 92 | + // }, | |
| 93 | + | |
| 94 | + }, | |
| 95 | + /** | |
| 96 | + * 组件的初始数据 | |
| 97 | + */ | |
| 98 | + data: { | |
| 99 | + add_cart_show: false, //是否显示 | |
| 100 | + iurl: getApp().globalData.setting.imghost, | |
| 101 | + prom_price: null, | |
| 102 | + sele_g: null, | |
| 103 | + gid: '', | |
| 104 | + prom_type: '', | |
| 105 | + prom_id: '', | |
| 106 | + goodsInputNum: 1, | |
| 107 | + def_pick_store: null, // 默认的门店 | |
| 108 | + openSpecModal_ind: 1, | |
| 109 | + goods_type: 0, | |
| 110 | + iscart: 0, //是否从购物车过来的 | |
| 111 | + cx_prom_group: [], //促销活动,用于显示和判断默认要用什么促销活动 | |
| 112 | + //门店相关 | |
| 113 | + ismend: 0, | |
| 114 | + only_pk: null, | |
| 115 | + stoid: o.stoid, | |
| 116 | + is_get_local_ok: 0, //获取坐标是否完成 | |
| 117 | + def_pickpu_list: null, | |
| 118 | + more_store: 0, //选择门店 | |
| 119 | + sort_store: 0, //门店分类 | |
| 120 | + choice_sort_store: 0, //选择分类门店 | |
| 121 | + sec_pick_index: 0, //第二级门店选择ID | |
| 122 | + fir_pick_index: 0, //第一级门店选择ID | |
| 123 | + all_pick_list: null, //所有的门店先记录起来 | |
| 124 | + fir_def_store: null, //客户默认的门店的 | |
| 125 | + keyword: '', //门店搜索 | |
| 126 | + is_no_new: 1, | |
| 127 | + }, | |
| 128 | + | |
| 129 | + /** | |
| 130 | + * 组件的方法列表 | |
| 131 | + */ | |
| 132 | + methods: { | |
| 133 | + closeSpecModal() { | |
| 134 | + this.clearTime() | |
| 135 | + this.setData({ | |
| 136 | + add_cart_show: false | |
| 137 | + }) | |
| 138 | + | |
| 139 | + this.triggerEvent('hide_add_purchase', {}) | |
| 140 | + }, | |
| 141 | + clearTime() { | |
| 142 | + if (timer_get) { | |
| 143 | + clearInterval(timer_get); | |
| 144 | + } | |
| 145 | + if (w_time) { | |
| 146 | + clearInterval(w_time); | |
| 147 | + } | |
| 148 | + if (t_time) { | |
| 149 | + clearInterval(t_time); | |
| 150 | + } | |
| 151 | + | |
| 152 | + }, | |
| 153 | + previewImage(e) { | |
| 154 | + // this.data.show_prew_img = 1; | |
| 155 | + getApp().pre_img(this.data.sele_g.original_img); | |
| 156 | + }, | |
| 157 | + initbef: function () { | |
| 23 | 158 | // this.clearTime() |
| 159 | + console.error('加购组件'); | |
| 24 | 160 | self = this |
| 25 | 161 | // 在组件实例进入页面节点树时执行 |
| 26 | 162 | let ee = this, that = ee, th = ee; |
| ... | ... | @@ -87,71 +223,9 @@ Component({ |
| 87 | 223 | ut.get_plus_name_price(sw_arr, th); |
| 88 | 224 | |
| 89 | 225 | }, 1); |
| 90 | - } | |
| 91 | - }, | |
| 92 | - /** | |
| 93 | - * 组件的初始数据 | |
| 94 | - */ | |
| 95 | - data: { | |
| 96 | - add_cart_show: false, //是否显示 | |
| 97 | - iurl: getApp().globalData.setting.imghost, | |
| 98 | - prom_price: null, | |
| 99 | - sele_g: null, | |
| 100 | - gid: '', | |
| 101 | - prom_type: '', | |
| 102 | - prom_id: '', | |
| 103 | - goodsInputNum: 1, | |
| 104 | - def_pick_store: null, // 默认的门店 | |
| 105 | - openSpecModal_ind: 1, | |
| 106 | - goods_type: 0, | |
| 107 | - iscart: 0, //是否从购物车过来的 | |
| 108 | - cx_prom_group: [], //促销活动,用于显示和判断默认要用什么促销活动 | |
| 109 | - //门店相关 | |
| 110 | - ismend: 0, | |
| 111 | - only_pk: null, | |
| 112 | - stoid: o.stoid, | |
| 113 | - is_get_local_ok: 0, //获取坐标是否完成 | |
| 114 | - def_pickpu_list: null, | |
| 115 | - more_store: 0, //选择门店 | |
| 116 | - sort_store: 0, //门店分类 | |
| 117 | - choice_sort_store: 0, //选择分类门店 | |
| 118 | - sec_pick_index: 0, //第二级门店选择ID | |
| 119 | - fir_pick_index: 0, //第一级门店选择ID | |
| 120 | - all_pick_list: null, //所有的门店先记录起来 | |
| 121 | - fir_def_store: null, //客户默认的门店的 | |
| 122 | - keyword: '', //门店搜索 | |
| 123 | - is_no_new: 1, | |
| 124 | - }, | |
| 125 | - | |
| 126 | - /** | |
| 127 | - * 组件的方法列表 | |
| 128 | - */ | |
| 129 | - methods: { | |
| 130 | - closeSpecModal() { | |
| 131 | - this.clearTime() | |
| 132 | - this.setData({ | |
| 133 | - add_cart_show: false | |
| 134 | - }) | |
| 135 | - | |
| 136 | - this.triggerEvent('hide_add_purchase', {}) | |
| 137 | - }, | |
| 138 | - clearTime() { | |
| 139 | - if (timer_get) { | |
| 140 | - clearInterval(timer_get); | |
| 141 | - } | |
| 142 | - if (w_time) { | |
| 143 | - clearInterval(w_time); | |
| 144 | - } | |
| 145 | - if (t_time) { | |
| 146 | - clearInterval(t_time); | |
| 147 | - } | |
| 148 | - | |
| 149 | - }, | |
| 150 | - previewImage(e) { | |
| 151 | - // this.data.show_prew_img = 1; | |
| 152 | - getApp().pre_img(this.data.sele_g.original_img); | |
| 153 | 226 | }, |
| 154 | 227 | init(gid, prom_type, prom_id, goods_type = 0, iscart = 0, cartid = 0) { |
| 228 | + this.initbef() | |
| 155 | 229 | // this.clearTime() |
| 156 | 230 | //--先判断会员状态-- |
| 157 | 231 | var user_info = getApp().globalData.userInfo; |
| ... | ... | @@ -4115,7 +4189,7 @@ Component({ |
| 4115 | 4189 | |
| 4116 | 4190 | //-- 计算一下限购,满足限购数才显示 -- |
| 4117 | 4191 | if (fir_act.limit_num) { |
| 4118 | - await this.getUserBuyPromNum_pre(fir_act.prom_id); | |
| 4192 | + // await this.getUserBuyPromNum_pre(fir_act.prom_id); | |
| 4119 | 4193 | if (th.data.user_pre_buynum >= fir_act.limit_num) { |
| 4120 | 4194 | is_yh_out_limit = 1; |
| 4121 | 4195 | } | ... | ... |