From 8da54d0161ec2fcfaec16c2c746388dfdf4d0b9c Mon Sep 17 00:00:00 2001 From: luo <17530855@qq.com> Date: Tue, 19 Dec 2023 17:07:52 +0800 Subject: [PATCH] 优化 --- components/add_purchase/add_purchase.js | 204 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++----------------------------------------------------------------- components/add_purchase/add_purchase.wxml | 2 +- 2 files changed, 140 insertions(+), 66 deletions(-) diff --git a/components/add_purchase/add_purchase.js b/components/add_purchase/add_purchase.js index 8f9f8b2..b98bfec 100644 --- a/components/add_purchase/add_purchase.js +++ b/components/add_purchase/add_purchase.js @@ -18,9 +18,145 @@ Component({ properties: { }, + lifetimes: { - attached: function () { + // attached: function () { + // // this.clearTime() + // console.error('加购组件'); + // self = this + // // 在组件实例进入页面节点树时执行 + // let ee = this, that = ee, th = ee; + // //先获取一下导购的门店 + // th.check_guide(() => { + // th.get_user_store(); + // }) + // //----获取系统参数----- + // getApp().getConfig2(function (e) { + // ee.setData({ + // bconfig: e, + // sales_rules: e.sales_rules, + // }); + // th.wait_for_store_config(); + // if (e.categoryset.indexOf("," + 1 + ",") != -1) { + // ee.setData({ + // is_show_pl: 1 + // }); + // } + // if (e.categoryset.indexOf("," + 3 + ",") != -1) { + // ee.setData({ + // is_show_pp: 1 + // }); + // } + // if (e.categoryset.indexOf("," + 2 + ",") != -1) { + // ee.setData({ + // is_show_gb: 1 + // }); + // } + // console.log('获取系统参数'); + // console.log(e); + // var json_d = JSON.parse(e.switch_list); + // ee.setData({ + // store_config: e, + // sys_switch: json_d, + // is_closecoupon: json_d.is_closecoupon, + // is_newsales_rules: json_d.is_newsales_rules, + // is_retail_price: json_d.is_retail_price || 0, + // appoint_pick_keyid: json_d.appoint_pick_keyid, + // // goods_bottomconent:e.goods_bottomconent + // }); + + // //判断商品详情要有东西 + // // if (e && e.goods_bottomconent) { + // // //商品详情广告---- + // // a.wxParse("goodInfo_ad", "html", ut.format_content(e.goods_bottomconent), ee, 6); + // // common.wxParseAddFullImageUrl(ee, "goodInfo_ad"); + // // //------- + // // } + + // //------几人评价------- + // //n.init(th, "", "comments"); + + // // th.requestCardNum(), + // wx.pageScrollTo && th.setData({ + // supportPageScroll: !0 + // }); + + // //计算等级价相关 + // var swithc_list = e.switch_list; + // var sw_arr = JSON.parse(swithc_list); + // console.log('plus-111') + // //---如果后台又开等级卡的开关--- + // ut.get_plus_name_price(sw_arr, th); + + // }, 1); + // }, + + }, + /** + * 组件的初始数据 + */ + data: { + add_cart_show: false, //是否显示 + iurl: getApp().globalData.setting.imghost, + prom_price: null, + sele_g: null, + gid: '', + prom_type: '', + prom_id: '', + goodsInputNum: 1, + def_pick_store: null, // 默认的门店 + openSpecModal_ind: 1, + goods_type: 0, + iscart: 0, //是否从购物车过来的 + cx_prom_group: [], //促销活动,用于显示和判断默认要用什么促销活动 + //门店相关 + ismend: 0, + only_pk: null, + stoid: o.stoid, + is_get_local_ok: 0, //获取坐标是否完成 + def_pickpu_list: null, + more_store: 0, //选择门店 + sort_store: 0, //门店分类 + choice_sort_store: 0, //选择分类门店 + sec_pick_index: 0, //第二级门店选择ID + fir_pick_index: 0, //第一级门店选择ID + all_pick_list: null, //所有的门店先记录起来 + fir_def_store: null, //客户默认的门店的 + keyword: '', //门店搜索 + is_no_new: 1, + }, + + /** + * 组件的方法列表 + */ + methods: { + closeSpecModal() { + this.clearTime() + this.setData({ + add_cart_show: false + }) + + this.triggerEvent('hide_add_purchase', {}) + }, + clearTime() { + if (timer_get) { + clearInterval(timer_get); + } + if (w_time) { + clearInterval(w_time); + } + if (t_time) { + clearInterval(t_time); + } + + }, + previewImage(e) { + // this.data.show_prew_img = 1; + getApp().pre_img(this.data.sele_g.original_img); + }, + initbef: function () { // this.clearTime() + console.error('加购组件'); self = this // 在组件实例进入页面节点树时执行 let ee = this, that = ee, th = ee; @@ -87,71 +223,9 @@ Component({ ut.get_plus_name_price(sw_arr, th); }, 1); - } - }, - /** - * 组件的初始数据 - */ - data: { - add_cart_show: false, //是否显示 - iurl: getApp().globalData.setting.imghost, - prom_price: null, - sele_g: null, - gid: '', - prom_type: '', - prom_id: '', - goodsInputNum: 1, - def_pick_store: null, // 默认的门店 - openSpecModal_ind: 1, - goods_type: 0, - iscart: 0, //是否从购物车过来的 - cx_prom_group: [], //促销活动,用于显示和判断默认要用什么促销活动 - //门店相关 - ismend: 0, - only_pk: null, - stoid: o.stoid, - is_get_local_ok: 0, //获取坐标是否完成 - def_pickpu_list: null, - more_store: 0, //选择门店 - sort_store: 0, //门店分类 - choice_sort_store: 0, //选择分类门店 - sec_pick_index: 0, //第二级门店选择ID - fir_pick_index: 0, //第一级门店选择ID - all_pick_list: null, //所有的门店先记录起来 - fir_def_store: null, //客户默认的门店的 - keyword: '', //门店搜索 - is_no_new: 1, - }, - - /** - * 组件的方法列表 - */ - methods: { - closeSpecModal() { - this.clearTime() - this.setData({ - add_cart_show: false - }) - - this.triggerEvent('hide_add_purchase', {}) - }, - clearTime() { - if (timer_get) { - clearInterval(timer_get); - } - if (w_time) { - clearInterval(w_time); - } - if (t_time) { - clearInterval(t_time); - } - - }, - previewImage(e) { - // this.data.show_prew_img = 1; - getApp().pre_img(this.data.sele_g.original_img); }, init(gid, prom_type, prom_id, goods_type = 0, iscart = 0, cartid = 0) { + this.initbef() // this.clearTime() //--先判断会员状态-- var user_info = getApp().globalData.userInfo; @@ -4115,7 +4189,7 @@ Component({ //-- 计算一下限购,满足限购数才显示 -- if (fir_act.limit_num) { - await this.getUserBuyPromNum_pre(fir_act.prom_id); + // await this.getUserBuyPromNum_pre(fir_act.prom_id); if (th.data.user_pre_buynum >= fir_act.limit_num) { is_yh_out_limit = 1; } diff --git a/components/add_purchase/add_purchase.wxml b/components/add_purchase/add_purchase.wxml index 8467242..620b696 100644 --- a/components/add_purchase/add_purchase.wxml +++ b/components/add_purchase/add_purchase.wxml @@ -1,6 +1,6 @@ - + -- libgit2 0.21.4