diff --git a/app.js b/app.js index efe8c1c..b0064fb 100644 --- a/app.js +++ b/app.js @@ -51,7 +51,7 @@ App({ config: null, //门店参数 config2: null, //门店配置 code: null, - user_id:null,//10153869,//6520352,// 10153869,// 6520352,// qa-6519858,// + user_id:null,//6520390,//6520352 // user_id:6520314,// qa-6519858,// // user_id:14148118,// qa-6519858,// buy_now: null, @@ -511,47 +511,60 @@ App({ get_user_store: function (func) { var th = this; this.getConfig2(function (conf) { + + var is_pricing_open_store=0; + var is_regstores=0; + var is_guide_storage=0; + if (conf.switch_list) { + var t_swi = JSON.parse(conf.switch_list); + //--购买门店是否默认登记门店-- + is_regstores=t_swi.is_regstores; + is_pricing_open_store=t_swi.is_pricing_open_store; + is_guide_storage=t_swi.is_guide_storage; + } + //---空会员的情况--- if (!th.globalData.userInfo) { - return func(null); + //没有导购门店 和 没有开启默认导购 + if(!th.globalData.guide_pick_id || !is_guide_storage) { + return func(null); + } } if (!th.globalData.pk_store) { var pick_id = 0; - var is_pricing_open_store=0; - var is_regstores=0; - if (conf.switch_list) { - var t_swi = JSON.parse(conf.switch_list); - //--购买门店是否默认登记门店-- - is_regstores=t_swi.is_regstores; - is_pricing_open_store=t_swi.is_pricing_open_store; - } + //-- 如果有导购的时候,后台有默认门店只能是导购的门店的时候 -- + if(th.globalData.guide_pick_id && is_guide_storage){ + pick_id = th.globalData.guide_pick_id + }else { - //-- 如果是区域价格提现,现在注册门店是默认 -- - if(is_pricing_open_store){ + //-- 如果是区域价格提现,现在注册门店是默认 -- + if (is_pricing_open_store) { - //查找会员的注册的地址 - if (th.globalData.userInfo.pickup_id) { - pick_id = th.globalData.userInfo.pickup_id; - th.globalData.is_dj_pk=1; - } - //先找一个会员是否有设置默认的地址 - else if (th.globalData.userInfo.def_pickup_id) { - pick_id = th.globalData.userInfo.def_pickup_id - } + //查找会员的注册的地址 + if (th.globalData.userInfo.pickup_id) { + pick_id = th.globalData.userInfo.pickup_id; + th.globalData.is_dj_pk = 1; + } + //先找一个会员是否有设置默认的地址 + else if (th.globalData.userInfo.def_pickup_id) { + pick_id = th.globalData.userInfo.def_pickup_id + } - }else{ - //先找一个会员是否有设置默认的地址 - if (th.globalData.userInfo.def_pickup_id) { - pick_id = th.globalData.userInfo.def_pickup_id - } - //查找会员的注册的地址 - else if (th.globalData.userInfo.pickup_id && is_regstores) { - pick_id = th.globalData.userInfo.pickup_id + } else { + //先找一个会员是否有设置默认的地址 + if (th.globalData.userInfo.def_pickup_id) { + pick_id = th.globalData.userInfo.def_pickup_id + } + //查找会员的注册的地址 + else if (th.globalData.userInfo.pickup_id && is_regstores) { + pick_id = th.globalData.userInfo.pickup_id + } } } + //---如果会员没有设置默认门店,同时也没有再注册的时候选择门店-- if (pick_id == 0) return func(null); @@ -704,6 +717,7 @@ App({ } }, + //清空登录时候缓存的值 onHide: function () { var th = this; @@ -725,6 +739,7 @@ App({ th.globalData.dis_buy_obj = null; //等级卡的购买记录 th.globalData.storeFooter = null; //底部的导航 th.globalData.full_screen = null; //全屏 + th.globalData.guide_pick_id = null; //分享导购门店的优化 } else { th.globalData.no_clear = 0; } diff --git a/app.json b/app.json index 680af94..16225fb 100644 --- a/app.json +++ b/app.json @@ -53,7 +53,7 @@ "pages/giftpack/payment/payment", "pages/giftpack/buygiftpack/giftpackbuy", "pages/giftpack/giftpacklist/giftpacklist", - "pages/giftpack/giftpacklistshop/giftpacklistshop", + "pages/giftpack/mygiftpack/mygiftpack", "pages/user/assistance/giftpacklist", "pages/user/assistance/task_assistance", @@ -217,6 +217,7 @@ "pages/user/slimming/slimming", "pages/user/punchInhistory/punchInhistory", "pages/user/grow_value/grow_value", + "pages/giftpack/giftpacklistshop/giftpacklistshop", "pages/user/labels/labels", "pages/cart/cart2/cart2", "pages/barCodeBank/barCodeBank", diff --git a/components/diy_store_select/diy_store_select.js b/components/diy_store_select/diy_store_select.js index 97a8f04..f4d8b61 100644 --- a/components/diy_store_select/diy_store_select.js +++ b/components/diy_store_select/diy_store_select.js @@ -54,7 +54,8 @@ Component({ fail: function(res) { if(res.errCode == 2) { getApp().confirmBox("请开启GPS定位", null, 25000, !1); - } + } + th.set_fir_store_to_def(); } }) diff --git a/packageA/pages/distribution/shop/shop.js b/packageA/pages/distribution/shop/shop.js index fb36af6..11e3bcc 100644 --- a/packageA/pages/distribution/shop/shop.js +++ b/packageA/pages/distribution/shop/shop.js @@ -55,6 +55,15 @@ Page({ getApp().globalData.first_leader = first_leader; this.data.first_leader = first_leader; + //调用接口判断是不是会员 + getApp().request.promiseGet("/api/weshop/shoppingGuide/get/" + os.stoid + "/" + first_leader, {}).then(res => { + if (res.data.code == 0) { + getApp().globalData.guide_id = res.data.data.id; + getApp().globalData.guide_pick_id= res.data.data.pickup_id + } + }) + + getApp().request.get("/api/weshop/users/get/" + os.stoid + "/" + first_leader, { isShowLoading: false, data: { r: Math.random() }, diff --git a/packageA/pages/goodsInfo/goodsInfo.js b/packageA/pages/goodsInfo/goodsInfo.js index f226fbd..982243c 100644 --- a/packageA/pages/goodsInfo/goodsInfo.js +++ b/packageA/pages/goodsInfo/goodsInfo.js @@ -231,7 +231,9 @@ Page({ that = ee, th = ee, gid = t.goods_id, - first_leader=t.first_leader; + first_leader=t.first_leader, + room_id = t.room_id, + room_user_share = t.room_user_share; //如果是会员分享带有room_id的话,那么接下来会员分享就不传room_id //检查测肤 getApp().check_skin_face(t,1,gid); @@ -259,212 +261,154 @@ Page({ //调用接口判断是不是会员 getApp().request.promiseGet("/api/weshop/shoppingGuide/get/"+os.stoid+"/"+first_leader,{}).then(res=>{ if(res.data.code==0) { - getApp().globalData.guide_id=res.data.data.id; + getApp().globalData.guide_id=res.data.data.id; + getApp().globalData.guide_pick_id= res.data.data.pickup_id } }) } - - var c_guide_id=t.c_guide_id; - if(c_guide_id){ - th.data.c_guide_id=c_guide_id; - } - - getApp().getConfig(function(e) { - ee.setData({sto_sele_name_1:e.store_name}) - }) - //----获取系统参数----- - getApp().getConfig2(function (e) { - ee.setData({ - bconfig: e, - sales_rules: e.sales_rules, - }); - - 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(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 - }); - ee.init(gid); - - //------几人评价------- - //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); - // //---如果后台又开等级卡的开关--- - // if (sw_arr.rank_switch && sw_arr.rank_switch == "2") { - // th.setData({ rank_switch: true }); - // //---回调卡的列表--- - // th.getPlusCardType(function (ob) { - // th.setData({ card_list: ob.card_list }); - // var ti = setInterval(function () { - // var user = getApp().globalData.userInfo; - // if (!user) return false; - // clearInterval(ti); - // if (user.card_field && user['card_expiredate']) { - // var str = user['card_expiredate'].replace(/-/g, '/'); - // var end = new Date(str); - // end = Date.parse(end) / 1000; - // var now = ut.gettimestamp(); - // //--- 判断是等级会员,且在有效期范围内 --- - // if (user.card_field && now < end) { - // var card_name = ob.name_map.get(user.card_field); - // //if(card_name.length>6) card_name=card_name.substring(0,6); - - // var is_near_date = 0; - // if (end - now < 60 * 60 * 30 * 24) is_near_date = 1; //如果小于30天 - // th.setData({ card_field: user.card_field, card_name: card_name, card_list: ob.card_list, is_near_date: is_near_date }); - // } - // } - // }, 500) - // }) - // } - - }, 1); + //-- 如果有房间号 -- + if (room_id) { + getApp().globalData.room_id = room_id; + getApp().globalData.room_goods_id = gid; + //如果是会员分享过来的要记录 + if (room_user_share) + getApp().globalData.room_user_share = room_user_share; - //获取用户设备信息,屏幕宽度 - wx.getSystemInfo({ - success: res => { - that.setData({ - screenWidth: res.screenWidth - }) + if (share_openid) { + this.get_room_share_guide(share_openid); + } } - }); - - //获取用户的默认门店 - getApp().get_user_store(function(e) { - console.log('get_user_store'); - console.log("999999999"); - if(!e) { - th.data.fir_def_store={}; //赋值空对象 - return false; - } + var c_guide_id=t.c_guide_id; + if(c_guide_id){ + th.data.c_guide_id=c_guide_id; + } + + getApp().getConfig(function(e) { + ee.setData({sto_sele_name_1:e.store_name}) + }) + + //----获取系统参数----- + getApp().getConfig2(function (e) { + ee.setData({ + bconfig: e, + sales_rules: e.sales_rules, + }); - console.log("000000"); + 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(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 + }); + ee.init(gid); - if(getApp().globalData.is_dj_pk) th.setData({has_def:1}) + //------几人评价------- + //n.init(th, "", "comments"); - var ee=JSON.parse(JSON.stringify(e)); + th.requestCardNum(), wx.pageScrollTo && th.setData({ + supportPageScroll: !0 + }); + //计算等级价相关 + // var swithc_list = e.switch_list; + // var sw_arr = JSON.parse(swithc_list); + // //---如果后台又开等级卡的开关--- + // if (sw_arr.rank_switch && sw_arr.rank_switch == "2") { + // th.setData({ rank_switch: true }); + // //---回调卡的列表--- + // th.getPlusCardType(function (ob) { + // th.setData({ card_list: ob.card_list }); + // var ti = setInterval(function () { + // var user = getApp().globalData.userInfo; + // if (!user) return false; + // clearInterval(ti); + // if (user.card_field && user['card_expiredate']) { + // var str = user['card_expiredate'].replace(/-/g, '/'); + // var end = new Date(str); + // end = Date.parse(end) / 1000; + // var now = ut.gettimestamp(); + // //--- 判断是等级会员,且在有效期范围内 --- + // if (user.card_field && now < end) { + // var card_name = ob.name_map.get(user.card_field); + // //if(card_name.length>6) card_name=card_name.substring(0,6); + + // var is_near_date = 0; + // if (end - now < 60 * 60 * 30 * 24) is_near_date = 1; //如果小于30天 + // th.setData({ card_field: user.card_field, card_name: card_name, card_list: ob.card_list, is_near_date: is_near_date }); + // } + // } + // }, 500) + // }) + // } + + }, 1); + + //获取用户设备信息,屏幕宽度 + wx.getSystemInfo({ + success: res => { + that.setData({ + screenWidth: res.screenWidth + }) + } + }); - console.log(e); + }, - //--定时器推迟一下-- - setTimeout(function () { - if(!th.data.data){ - return false; - } - var ser_card=th.data.data; - //--如果默认门店不在等级卡的默认们店以内 - if(ser_card.storageId!=null && ser_card.storageId!="" && ser_card.storageId.indexOf(ee.keyid)==-1){ - ee.is_no_dis=1; - } + //-- 获取直播的分享人的导购信息 -- + async get_room_share_guide(share_openid) { - var appd=getApp().globalData; - var w_time = setInterval(function() { - if (that.data.is_get_local_ok == 0) return false; - clearInterval(w_time); - var distance = null; - var e=JSON.parse(JSON.stringify(ee)); - - //如果有开启近距离的话,同时距离优不一样了 - if (that.data.lat != null) { - //如果经纬度有变化的话 - if(e && appd.lat==that.data.lat && appd.lon==that.data.lon && e.distance>0 ){ - that.data.fir_def_store=e; - that.setData({ - def_pick_store: e, - sto_sele_name: e.pickup_name, - sto_sele_id: e.pickup_id, - sto_sele_distr: e.distr_type, - sto_sele_keyid:e.keyid, - }) - }else{ - //要用接口是获取距离,js的计算不准 - getApp().request.promiseGet("/api/weshop/pickup/list",{ - data:{store_id:os.stoid,pickup_id:e.pickup_id,lat:th.data.lat,lon: th.data.lon, is_pos: 1}, - }).then(res=>{ - if(ut.ajax_ok(res)){ - e=res.data.data.pageData[0]; - if (e){ - e.is_no_dis=ee.is_no_dis; - appd.pk_store=e; - that.data.fir_def_store=e; - - console.log('get_user_store--2'); - console.log(e); - - that.setData({ - def_pick_store: e, - sto_sele_name: e.pickup_name, - sto_sele_id: e.pickup_id, - sto_sele_distr: e.distr_type, - sto_sele_keyid:e.keyid, - }) - } + var url = "/api/weshop/users/page"; + var first_leader = 0; - } - }) + //调用接口判断是不是会员 + await getApp().request.promiseGet(url, { + data: { + stoid: os.stoid, + weapp_openid: share_openid + } + }).then(res => { + if (ut.ajax_ok(res)) { + first_leader = res.data.data.pageData[0].user_id; + getApp().globalData.guide_id = res.data.data.id; } + }) - //e.distance = distance; - appd.lat=that.data.lat; - appd.lon=that.data.lon; + if (!first_leader) return false; - } else { - if (e) { + getApp().globalData.first_leader = first_leader; + //调用接口判断是不是会员 + await getApp().request.promiseGet("/api/weshop/shoppingGuide/get/" + os.stoid + "/" + first_leader, {}).then(res => { + if (res.data.code == 0) { + getApp().globalData.guide_id = res.data.data.id; + getApp().globalData.guide_pick_id= res.data.data.pickup_id + } + }) - console.log('get_user_store3---'); - console.log(e); + }, - e.distance = null; - that.data.fir_def_store=e; - that.setData({ - def_pick_store: e, - sto_sele_name: e.pickup_name, - sto_sele_id: e.pickup_id, - sto_sele_distr: e.distr_type, - sto_sele_keyid:e.keyid, - }) - } - } - }, 500) - },1500) - }); - - - }, - - - onReady() { + onReady() { // 用于控制保障服务折叠图标的显示 setTimeout(() => { wx.createSelectorQuery().selectAll(".showArea, .hideArea").boundingClientRect(res => { @@ -671,19 +615,150 @@ Page({ }, + //检测有没有导购分享的门店 + check_guide(func){ + var first_leader=getApp().globalData.first_leader; + if(!first_leader){ + func(); + return false; + } + if(this.data.is_geted_guide_pick){ + func(); + return false; + } + + if(getApp().globalData.guide_pick_id){ + func(); + return false; + } + var th=this; + getApp().request.promiseGet("/api/weshop/shoppingGuide/get/" + os.stoid + "/" + first_leader, {}).then(res => { + if (res.data.code == 0) { + getApp().globalData.guide_pick_id= res.data.data.pickup_id; + } + th.data.is_geted_guide_pick=1; + func(); + }) + }, + //---展示--- // gid 在onload阶段已经保存在this.data中 onShow: function() { getApp().check_can_share(); - var that=this; + var that=this;var th=this; var ee = this,gid = this.data.gid, i = getApp().request; this.data.is_timer = 1; - this.wait_for_store_config(); - - + //获取用户的默认门店 + th.check_guide(()=>{ + getApp().get_user_store(function(e) { + console.log('get_user_store'); + console.log("999999999"); + + + if(!e) { + th.data.fir_def_store={}; //赋值空对象 + return false; + } + + console.log("000000"); + + if(getApp().globalData.is_dj_pk) th.setData({has_def:1}) + + var ee=JSON.parse(JSON.stringify(e)); + + + console.log(e); + + //--定时器推迟一下-- + setTimeout(function () { + if(!th.data.data){ + return false; + } + var ser_card=th.data.data; + //--如果默认门店不在等级卡的默认们店以内 + if(ser_card.storageId!=null && ser_card.storageId!="" && ser_card.storageId.indexOf(ee.keyid)==-1){ + ee.is_no_dis=1; + } + + var appd=getApp().globalData; + var w_time = setInterval(function() { + if (that.data.is_get_local_ok == 0) return false; + clearInterval(w_time); + var distance = null; + var e=JSON.parse(JSON.stringify(ee)); + + //如果有开启近距离的话,同时距离优不一样了 + if (that.data.lat != null) { + //如果经纬度有变化的话 + if(e && appd.lat==that.data.lat && appd.lon==that.data.lon && e.distance>0 ){ + that.data.fir_def_store=e; + that.setData({ + def_pick_store: e, + sto_sele_name: e.pickup_name, + sto_sele_id: e.pickup_id, + sto_sele_distr: e.distr_type, + sto_sele_keyid:e.keyid, + }) + }else{ + //要用接口是获取距离,js的计算不准 + getApp().request.promiseGet("/api/weshop/pickup/list",{ + data:{store_id:os.stoid,pickup_id:e.pickup_id,lat:th.data.lat,lon: th.data.lon, is_pos: 1}, + }).then(res=>{ + if(ut.ajax_ok(res)){ + e=res.data.data.pageData[0]; + if (e){ + e.is_no_dis=ee.is_no_dis; + appd.pk_store=e; + that.data.fir_def_store=e; + + console.log('get_user_store--2'); + console.log(e); + + that.setData({ + def_pick_store: e, + sto_sele_name: e.pickup_name, + sto_sele_id: e.pickup_id, + sto_sele_distr: e.distr_type, + sto_sele_keyid:e.keyid, + }) + } + + } + }) + } + + //e.distance = distance; + appd.lat=that.data.lat; + appd.lon=that.data.lon; + + } else { + if (e) { + + + console.log('get_user_store3---'); + console.log(e); + + e.distance = null; + that.data.fir_def_store=e; + that.setData({ + def_pick_store: e, + sto_sele_name: e.pickup_name, + sto_sele_id: e.pickup_id, + sto_sele_distr: e.distr_type, + sto_sele_keyid:e.keyid, + }) + } + } + }, 500) + },1500) + + }); + }) + + this.wait_for_store_config(); i.get("/api/weshop/serviceCard/get/" + o.stoid + "/" + ee.data.gid, { failRollback: !0, @@ -2505,6 +2580,15 @@ Page({ var ind=ee.currentTarget.dataset.ind; var bconfig = th.data.bconfig; + //--先判断会员状态-- + var user_info = getApp().globalData.userInfo; + if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) { + wx.navigateTo({ + url: '/packageE/pages/togoin/togoin', + }) + return false; + } + //如果开启了,则不在选择门店 if(this.data.sys_switch.is_pricing_open_store && getApp().globalData.pk_store){ diff --git a/packageA/pages/liveStreamDetails/liveStreamDetails.js b/packageA/pages/liveStreamDetails/liveStreamDetails.js index c5bcc82..686b656 100644 --- a/packageA/pages/liveStreamDetails/liveStreamDetails.js +++ b/packageA/pages/liveStreamDetails/liveStreamDetails.js @@ -523,7 +523,8 @@ drawText: function(ctx, str, leftWidth, initHeight, titleHeight, canvasWidth, un if(res.data.code==0){ getApp().globalData.guide_id=res.data.data.id; getApp().globalData.staffId=staffId; - getApp().globalData.storageId=storageId; + getApp().globalData.storageId=storageId; + getApp().globalData.guide_pick_id= res.data.data.pickup_id } }) } diff --git a/packageA/pages/my_service/appment_main.js b/packageA/pages/my_service/appment_main.js index 977611f..0460e93 100644 --- a/packageA/pages/my_service/appment_main.js +++ b/packageA/pages/my_service/appment_main.js @@ -344,6 +344,16 @@ Page({ }, //确认选择门店 choice_store: function() { + + //--先判断会员状态-- + var user_info = getApp().globalData.userInfo; + if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) { + wx.navigateTo({ + url: '/packageE/pages/togoin/togoin', + }) + return false; + } + var th = this; var index = th.data.fir_pick_index; var store_name = th.data.store_list[index].StorageName; @@ -575,6 +585,7 @@ Page({ getApp().request.promiseGet("/api/weshop/shoppingGuide/get/"+a.stoid+"/"+options.firstleader,{}).then(res=>{         if(res.data.code==0){           getApp().globalData.guide_id=res.data.data.id; + getApp().globalData.guide_pick_id= res.data.data.pickup_id getApp().request.promiseGet('/api/weshop/shoppingGuide/geIdStaffInfo', { data: { diff --git a/packageA/pages/prom_list/prom_list.js b/packageA/pages/prom_list/prom_list.js index 27e32ca..254846a 100644 --- a/packageA/pages/prom_list/prom_list.js +++ b/packageA/pages/prom_list/prom_list.js @@ -63,6 +63,7 @@ Page({ getApp().request.promiseGet("/api/weshop/shoppingGuide/get/"+os.stoid+"/"+first_leader,{}).then(res=>{ if(res.data.code==0){ getApp().globalData.guide_id=res.data.data.id; + getApp().globalData.guide_pick_id= res.data.data.pickup_id } }) } @@ -89,91 +90,128 @@ Page({ } }); - //获取用户的默认门店 - getApp().get_user_store(function(ee) { - if(!ee) { - th.data.fir_def_store={}; //赋值空对象 - return false; - } - if(getApp().globalData.is_dj_pk) th.setData({has_def:1}) - - var appd=getApp().globalData; - var w_time = setInterval(function() { - if (that.data.is_get_local_ok == 0) return false; - if (!that.data.data) return false; - clearInterval(w_time); - var distance = null; - var e=JSON.parse(JSON.stringify(ee)); - - if(th.data.data) var g_distr_type=th.data.data.distr_type; - e.is_no_dis=0; - if(e.distr_type!=0 && g_distr_type!=0 && e.distr_type!=g_distr_type ){ - e.is_no_dis=1; + + }, + + //检测有没有导购分享的门店 + check_guide(func){ + var first_leader=getApp().globalData.first_leader; + if(!first_leader){ + func(); + return false; + } + if(this.data.is_geted_guide_pick){ + func(); + return false; + } + + if(getApp().globalData.guide_pick_id){ + func(); + return false; + } + var th=this; + getApp().request.promiseGet("/api/weshop/shoppingGuide/get/" + os.stoid + "/" + first_leader, {}).then(res => { + if (res.data.code == 0) { + getApp().globalData.guide_pick_id= res.data.data.pickup_id; + } + th.data.is_geted_guide_pick=1; + func(); + }) + }, + + //---展示--- + onShow: function() { + + getApp().check_can_share(); + var ee=this,th=ee,that=ee; + + //先获取一下导购的门店 + this.check_guide(()=> { + //获取用户的默认门店 + getApp().get_user_store(function (ee) { + if (!ee) { + th.data.fir_def_store = {}; //赋值空对象 + return false; } - //如果有开启近距离的话,同时距离优不一样了 - if (that.data.lat != null) { - //如果经纬度有变化的话 - if( appd.lat==that.data.lat && appd.lon==that.data.lon && e.distance>0 ){ - that.data.fir_def_store=e; - that.setData({ - def_pick_store: e, - sto_sele_name: e.pickup_name, - sto_sele_id: e.pickup_id, - sto_sele_distr: e.distr_type - }) - }else{ - //要用接口是获取距离,js的计算不准 - getApp().request.promiseGet("/api/weshop/pickup/list",{ - data:{store_id:os.stoid,pickup_id:e.pickup_id,lat:th.data.lat,lon: th.data.lon,is_pos: 1}, - }).then(res=>{ - if(res.data.code==0 && res.data.data && res.data.data.pageData && res.data.data.pageData.length){ - e=res.data.data.pageData[0]; - if (e){ - appd.pk_store=e; - that.data.fir_def_store=e; - that.setData({ - def_pick_store: e, - sto_sele_name: e.pickup_name, - sto_sele_id: e.pickup_id, - sto_sele_distr: e.distr_type - }) - } + if (getApp().globalData.is_dj_pk) th.setData({has_def: 1}) - } - }) + var appd = getApp().globalData; + var w_time = setInterval(function () { + if (that.data.is_get_local_ok == 0) return false; + if (!that.data.data) return false; + clearInterval(w_time); + var distance = null; + var e = JSON.parse(JSON.stringify(ee)); + + if (th.data.data) var g_distr_type = th.data.data.distr_type; + e.is_no_dis = 0; + if (e.distr_type != 0 && g_distr_type != 0 && e.distr_type != g_distr_type) { + e.is_no_dis = 1; } - //e.distance = distance; - appd.lat=that.data.lat; - appd.lon=that.data.lon; + //如果有开启近距离的话,同时距离优不一样了 + if (that.data.lat != null) { + //如果经纬度有变化的话 + if (appd.lat == that.data.lat && appd.lon == that.data.lon && e.distance > 0) { + that.data.fir_def_store = e; + that.setData({ + def_pick_store: e, + sto_sele_name: e.pickup_name, + sto_sele_id: e.pickup_id, + sto_sele_distr: e.distr_type + }) + } else { + //要用接口是获取距离,js的计算不准 + getApp().request.promiseGet("/api/weshop/pickup/list", { + data: { + store_id: os.stoid, + pickup_id: e.pickup_id, + lat: th.data.lat, + lon: th.data.lon, + is_pos: 1 + }, + }).then(res => { + if (res.data.code == 0 && res.data.data && res.data.data.pageData && res.data.data.pageData.length) { + e = res.data.data.pageData[0]; + if (e) { + appd.pk_store = e; + that.data.fir_def_store = e; + that.setData({ + def_pick_store: e, + sto_sele_name: e.pickup_name, + sto_sele_id: e.pickup_id, + sto_sele_distr: e.distr_type + }) + } - }else{ - if (e) { - e.distance = null; - that.data.fir_def_store=e; - that.setData({ - def_pick_store: e, - sto_sele_name: e.pickup_name, - sto_sele_id: e.pickup_id, - sto_sele_distr: e.distr_type - }) - } - } + } + }) + } - }, 500) - }); - - }, + //e.distance = distance; + appd.lat = that.data.lat; + appd.lon = that.data.lon; - //---展示--- - onShow: function() { + } else { + if (e) { + e.distance = null; + that.data.fir_def_store = e; + that.setData({ + def_pick_store: e, + sto_sele_name: e.pickup_name, + sto_sele_id: e.pickup_id, + sto_sele_distr: e.distr_type + }) + } + } - getApp().check_can_share(); + }, 500) + }); + }) - var ee=this,th=ee,that=ee; - var gid = this.data.gid,i = getApp().request; + var gid = this.data.gid,i = getApp().request; ee.data.g_buy_num = new Map(); this.wait_for_store_config(); clearTimeout(ot); @@ -1418,6 +1456,16 @@ Page({ // 选择门店 choice_store: function(ee) { + + //--先判断会员状态-- + var user_info = getApp().globalData.userInfo; + if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) { + wx.navigateTo({ + url: '/packageE/pages/togoin/togoin', + }) + return false; + } + var th = this; var ind=ee.currentTarget.dataset.ind; var bconfig = th.data.bconfig; diff --git a/packageA/pages/quan_list/quan_list.js b/packageA/pages/quan_list/quan_list.js index 304a1dd..4982ff4 100644 --- a/packageA/pages/quan_list/quan_list.js +++ b/packageA/pages/quan_list/quan_list.js @@ -24,6 +24,20 @@ Page({ //------初始化加载---------- onLoad: function (t) { var th = this; + + var first_leader=t.first_leader; + if(first_leader){ + //-- user_id代过来免登录 -- + getApp().globalData.first_leader=first_leader; + //调用接口判断是不是会员 + getApp().request.promiseGet("/api/weshop/shoppingGuide/get/"+os.stoid+"/"+first_leader,{}).then(res=>{ + if(res.data.code==0){ + getApp().globalData.guide_id=res.data.data.id; + getApp().globalData.guide_pick_id= res.data.data.pickup_id + } + }) + } + getApp().getConfig2(function (conf) { if (conf.couponset) conf.couponset = conf.couponset.replace(/\{ if(res.data.code==0){ getApp().globalData.guide_id=res.data.data.id; + getApp().globalData.guide_pick_id= res.data.data.pickup_id } }) } diff --git a/packageB/pages/zuhegou/index/index.js b/packageB/pages/zuhegou/index/index.js index bff9738..d91cd25 100644 --- a/packageB/pages/zuhegou/index/index.js +++ b/packageB/pages/zuhegou/index/index.js @@ -153,11 +153,39 @@ Page({ getApp().request.promiseGet("/api/weshop/shoppingGuide/get/" + os.stoid + "/" + first_leader, {}).then(res => { if (res.data.code == 0) { getApp().globalData.guide_id = res.data.data.id; + getApp().globalData.guide_pick_id= res.data.data.pickup_id } }) } }, + //检测有没有导购分享的门店 + check_guide(func){ + var first_leader=getApp().globalData.first_leader; + if(!first_leader){ + func(); + return false; + } + if(this.data.is_geted_guide_pick){ + func(); + return false; + } + + if(getApp().globalData.guide_pick_id){ + func(); + return false; + } + var th=this; + getApp().request.promiseGet("/api/weshop/shoppingGuide/get/" + os.stoid + "/" + first_leader, {}).then(res => { + if (res.data.code == 0) { + getApp().globalData.guide_pick_id= res.data.data.pickup_id; + } + th.data.is_geted_guide_pick=1; + func(); + }) + }, + + /** * 生命周期函数--监听页面显示 */ @@ -259,59 +287,61 @@ Page({ }) }) - //获取用户的默认门店 - getApp().get_user_store(function (e) { - if (!e) { - th.data.fir_def_store = {}; //赋值空对象 - return false; - } - if(getApp().globalData.is_dj_pk) th.setData({has_def:1}) + th.check_guide(()=>{ + //获取用户的默认门店 + getApp().get_user_store(function (e) { + if (!e) { + th.data.fir_def_store = {}; //赋值空对象 + return false; + } + if(getApp().globalData.is_dj_pk) th.setData({has_def:1}) - var ee = JSON.parse(JSON.stringify(e)); - var appd = getApp().globalData; - //-- 等待定位系统的开启 -- - th.waitfor2(15, 'is_get_local_ok', function () { + var ee = JSON.parse(JSON.stringify(e)); + var appd = getApp().globalData; + //-- 等待定位系统的开启 -- + th.waitfor2(15, 'is_get_local_ok', function () { - if (!th.data.is_get_local_ok) return false; + if (!th.data.is_get_local_ok) return false; - var e = JSON.parse(JSON.stringify(ee)); - //如果有开启近距离的话,同时距离优不一样了 - if (that.data.lat != null) { - //如果经纬度有变化的话 - if (e && appd.lat == that.data.lat && appd.lon == that.data.lon && e.distance > 0) { - that.set_def_storage(e); - } else { - //要用接口是获取距离,js的计算不准 - getApp().request.promiseGet("/api/weshop/pickup/list", { - data: { - store_id: os.stoid, - pickup_id: e.pickup_id, - is_pos: 1, - lat: th.data.lat, - lon: th.data.lon - }, - }).then(res => { - if (res.data.code == 0) { - e = res.data.data.pageData[0]; - if (e) { - e.is_no_dis = ee.is_no_dis; - appd.pk_store = e; - that.set_def_storage(e); - } + var e = JSON.parse(JSON.stringify(ee)); + //如果有开启近距离的话,同时距离优不一样了 + if (that.data.lat != null) { + //如果经纬度有变化的话 + if (e && appd.lat == that.data.lat && appd.lon == that.data.lon && e.distance > 0) { + that.set_def_storage(e); + } else { + //要用接口是获取距离,js的计算不准 + getApp().request.promiseGet("/api/weshop/pickup/list", { + data: { + store_id: os.stoid, + pickup_id: e.pickup_id, + is_pos: 1, + lat: th.data.lat, + lon: th.data.lon + }, + }).then(res => { + if (res.data.code == 0) { + e = res.data.data.pageData[0]; + if (e) { + e.is_no_dis = ee.is_no_dis; + appd.pk_store = e; + that.set_def_storage(e); + } - } - }) - } - appd.lat = that.data.lat; - appd.lon = that.data.lon; - } else { - if (e) { - e.distance = null; - that.set_def_storage(e); + } + }) + } + appd.lat = that.data.lat; + appd.lon = that.data.lon; + } else { + if (e) { + e.distance = null; + that.set_def_storage(e); + } } - } - }) - }); + }) + }); + }) //----获取系统参数----- getApp().getConfig2(function (e) { diff --git a/packageB/pages/zuhegou/list/list.js b/packageB/pages/zuhegou/list/list.js index 494267c..efdac38 100644 --- a/packageB/pages/zuhegou/list/list.js +++ b/packageB/pages/zuhegou/list/list.js @@ -36,6 +36,7 @@ Page({ getApp().request.promiseGet("/api/weshop/shoppingGuide/get/" + os.stoid + "/" + first_leader, {}).then(res => { if (res.data.code == 0) { getApp().globalData.guide_id = res.data.data.id; + getApp().globalData.guide_pick_id= res.data.data.pickup_id } }) } diff --git a/packageB/pages/zuhegou/preindex/index.js b/packageB/pages/zuhegou/preindex/index.js index fa0b9da..a0731d3 100644 --- a/packageB/pages/zuhegou/preindex/index.js +++ b/packageB/pages/zuhegou/preindex/index.js @@ -150,11 +150,39 @@ Page({ getApp().request.promiseGet("/api/weshop/shoppingGuide/get/" + os.stoid + "/" + first_leader, {}).then(res => { if (res.data.code == 0) { getApp().globalData.guide_id = res.data.data.id; + getApp().globalData.guide_pick_id= res.data.data.pickup_id } }) } }, + + //检测有没有导购分享的门店 + check_guide(func){ + var first_leader=getApp().globalData.first_leader; + if(!first_leader){ + func(); + return false; + } + if(this.data.is_geted_guide_pick){ + func(); + return false; + } + + if(getApp().globalData.guide_pick_id){ + func(); + return false; + } + var th=this; + getApp().request.promiseGet("/api/weshop/shoppingGuide/get/" + os.stoid + "/" + first_leader, {}).then(res => { + if (res.data.code == 0) { + getApp().globalData.guide_pick_id= res.data.data.pickup_id; + } + th.data.is_geted_guide_pick=1; + func(); + }) + }, + /** * 生命周期函数--监听页面显示 */ @@ -253,60 +281,63 @@ Page({ }) }) - //获取用户的默认门店 - getApp().get_user_store(function (e) { - if (!e) { - th.data.fir_def_store = {}; //赋值空对象 - return false; - } + //先获取一下导购的门店 + th.check_guide(()=> { + //获取用户的默认门店 + getApp().get_user_store(function (e) { + if (!e) { + th.data.fir_def_store = {}; //赋值空对象 + return false; + } - if(getApp().globalData.is_dj_pk) th.setData({has_def:1}) + if (getApp().globalData.is_dj_pk) th.setData({has_def: 1}) - var ee = JSON.parse(JSON.stringify(e)); - var appd = getApp().globalData; - //-- 等待定位系统的开启 -- - th.waitfor2(15, 'is_get_local_ok', function () { + var ee = JSON.parse(JSON.stringify(e)); + var appd = getApp().globalData; + //-- 等待定位系统的开启 -- + th.waitfor2(15, 'is_get_local_ok', function () { - if (!th.data.is_get_local_ok) return false; + if (!th.data.is_get_local_ok) return false; - var e = JSON.parse(JSON.stringify(ee)); - //如果有开启近距离的话,同时距离优不一样了 - if (that.data.lat != null) { - //如果经纬度有变化的话 - if (e && appd.lat == that.data.lat && appd.lon == that.data.lon && e.distance > 0) { - that.set_def_storage(e); - } else { - //要用接口是获取距离,js的计算不准 - getApp().request.promiseGet("/api/weshop/pickup/list", { - data: { - store_id: os.stoid, - pickup_id: e.pickup_id, - is_pos: 1, - lat: th.data.lat, - lon: th.data.lon - }, - }).then(res => { - if (res.data.code == 0) { - e = res.data.data.pageData[0]; - if (e) { - e.is_no_dis = ee.is_no_dis; - appd.pk_store = e; - that.set_def_storage(e); - } + var e = JSON.parse(JSON.stringify(ee)); + //如果有开启近距离的话,同时距离优不一样了 + if (that.data.lat != null) { + //如果经纬度有变化的话 + if (e && appd.lat == that.data.lat && appd.lon == that.data.lon && e.distance > 0) { + that.set_def_storage(e); + } else { + //要用接口是获取距离,js的计算不准 + getApp().request.promiseGet("/api/weshop/pickup/list", { + data: { + store_id: os.stoid, + pickup_id: e.pickup_id, + is_pos: 1, + lat: th.data.lat, + lon: th.data.lon + }, + }).then(res => { + if (res.data.code == 0) { + e = res.data.data.pageData[0]; + if (e) { + e.is_no_dis = ee.is_no_dis; + appd.pk_store = e; + that.set_def_storage(e); + } - } - }) - } - appd.lat = that.data.lat; - appd.lon = that.data.lon; - } else { - if (e) { - e.distance = null; - that.set_def_storage(e); + } + }) + } + appd.lat = that.data.lat; + appd.lon = that.data.lon; + } else { + if (e) { + e.distance = null; + that.set_def_storage(e); + } } - } - }) - }); + }) + }); + }) //----获取系统参数----- getApp().getConfig2(function (e) { diff --git a/packageC/pages/goods/goodsList/goodsList.js b/packageC/pages/goods/goodsList/goodsList.js index 76b6de1..e7dbf14 100644 --- a/packageC/pages/goods/goodsList/goodsList.js +++ b/packageC/pages/goods/goodsList/goodsList.js @@ -38,6 +38,7 @@ Page({ getApp().request.promiseGet("/api/weshop/shoppingGuide/get/" + oo.stoid + "/" + first_leader, {}).then(res => { if (res.data.code == 0) { getApp().globalData.guide_id = res.data.data.id; + getApp().globalData.guide_pick_id= res.data.data.pickup_id } }) } diff --git a/packageC/pages/goods/search/search.js b/packageC/pages/goods/search/search.js index f843a16..21160ec 100644 --- a/packageC/pages/goods/search/search.js +++ b/packageC/pages/goods/search/search.js @@ -46,6 +46,7 @@ Page({ getApp().request.promiseGet("/api/weshop/shoppingGuide/get/" + oo.stoid + "/" + first_leader, {}).then(res => { if (res.data.code == 0) { getApp().globalData.guide_id = res.data.data.id; + getApp().globalData.guide_pick_id= res.data.data.pickup_id } }) } diff --git a/packageC/pages/group_list/group_list.js b/packageC/pages/group_list/group_list.js index eeb4ee2..358019d 100644 --- a/packageC/pages/group_list/group_list.js +++ b/packageC/pages/group_list/group_list.js @@ -32,6 +32,19 @@ Page({ if(options && options.groupchat_id){ getApp().globalData.groupchat_id=options.groupchat_id } + var first_leader = options.first_leader; + + if (first_leader) { + getApp().globalData.first_leader = first_leader; + //调用接口判断是不是会员 + getApp().request.promiseGet("/api/weshop/shoppingGuide/get/" + os.stoid + "/" + first_leader, {}).then(res => { + if (res.data.code == 0) { + getApp().globalData.guide_id = res.data.data.id; + getApp().globalData.guide_pick_id= res.data.data.pickup_id + } + }) + } + app.isLogin().then(function(data) {//进入页面前已经授权登录成功 self.setData({ @@ -158,7 +171,6 @@ Page({ /** * 用户点击右上角分享 */ - onShareAppMessage: function () { getApp().globalData.no_clear=1; var store_name = getApp().globalData.config ? getApp().globalData.config.store_name:''; @@ -196,7 +208,6 @@ Page({ }, - /** diff --git a/packageC/pages/luckyGo/luckyGo_activityList/luckyGo_activityList.js b/packageC/pages/luckyGo/luckyGo_activityList/luckyGo_activityList.js index f83be64..c90b7be 100644 --- a/packageC/pages/luckyGo/luckyGo_activityList/luckyGo_activityList.js +++ b/packageC/pages/luckyGo/luckyGo_activityList/luckyGo_activityList.js @@ -23,11 +23,12 @@ Page({ if(first_leader) { app.globalData.first_leader = first_leader; //调用接口判断是不是会员 - // app.request.promiseGet("/api/weshop/shoppingGuide/get/" + app.globalData.setting.stoid + "/" + first_leader, {}).then(res => { - // if (res.data.code == 0) { - // getApp().globalData.guide_id = res.data.data.id; - // } - // }) + app.request.promiseGet("/api/weshop/shoppingGuide/get/" + app.globalData.setting.stoid + "/" + first_leader, {}).then(res => { + if (res.data.code == 0) { + getApp().globalData.guide_id = res.data.data.id; + getApp().globalData.guide_pick_id= res.data.data.pickup_id + } + }) }; app.isLogin().then(function(data) { diff --git a/packageC/pages/luckyGo/luckyGo_cart_ct/luckyGo_cart_ct.js b/packageC/pages/luckyGo/luckyGo_cart_ct/luckyGo_cart_ct.js index d80dc0a..578c154 100644 --- a/packageC/pages/luckyGo/luckyGo_cart_ct/luckyGo_cart_ct.js +++ b/packageC/pages/luckyGo/luckyGo_cart_ct/luckyGo_cart_ct.js @@ -241,7 +241,7 @@ Page({ // let cartList= this.data.cartlist // let cartList= arr // let length = cartList.length - if(this.data.is_pre_cut==0){ + if(!this.data.is_pre_cut){ return {} } wx.showLoading({ diff --git a/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.js b/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.js index d2663e5..a8f25c2 100644 --- a/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.js +++ b/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.js @@ -283,7 +283,8 @@ Page({ canBuy: false, btnHidden: false, - hiddenCS: true, + hiddenCS: true, + is_get_guide:0, }, //------初始化加载---------- @@ -309,6 +310,8 @@ Page({ prom_type = t.prom_type, prom_id = t.group_id; //活动ID + var share_openid = t.share_openid; + if (prom_type) { // this.data.prom_type = prom_type; // this.data.prom_id = prom_id; @@ -397,6 +400,7 @@ Page({ getApp().request.promiseGet("/api/weshop/shoppingGuide/get/" + os.stoid + "/" + first_leader, {}).then(res => { if (res.data.code == 0) { getApp().globalData.guide_id = res.data.data.id; + getApp().globalData.guide_pick_id= res.data.data.pickup_id } }) } @@ -408,6 +412,10 @@ Page({ //如果是会员分享过来的要记录 if (room_user_share) getApp().globalData.room_user_share = room_user_share; + + if (share_openid) { + this.get_room_share_guide(share_openid); + } } var c_guide_id = t.c_guide_id; @@ -506,64 +514,7 @@ Page({ } }); - //获取用户的默认门店 - getApp().get_user_store(function (e) { - if (!e) { - th.data.fir_def_store = {}; //赋值空对象 - return false; - } - - if(getApp().globalData.is_dj_pk) th.setData({has_def:1}) - var ee = JSON.parse(JSON.stringify(e)); - //--定时器推迟一下-- - setTimeout(function () { - if (th.data.fir_goods) var g_distr_type = th.data.fir_goods.distr_type; - //--如果默认门店的配送方式不对,就不能被选择,这里不控制,如果不一样,就说明配送方式不对-- - if (ee.distr_type != 0 && g_distr_type != 0 && ee.distr_type != g_distr_type) { - ee.is_no_dis = 1; - } - - var appd = getApp().globalData; - var w_time = setInterval(function () { - if (that.data.is_get_local_ok == 0) return false; - clearInterval(w_time); - var distance = null; - var e = JSON.parse(JSON.stringify(ee)); - - //如果有开启近距离的话,同时距离优不一样了 - if (that.data.lat != null) { - //如果经纬度有变化的话 - if (e && appd.lat == that.data.lat && appd.lon == that.data.lon && e.distance > 0) { - that.set_def_storage(e); - } else { - //要用接口是获取距离,js的计算不准 - getApp().request.promiseGet("/api/weshop/pickup/list", { - data: { store_id: os.stoid, pickup_id: e.pickup_id, lat: th.data.lat, lon: th.data.lon, is_pos: 1 }, - }).then(res => { - if (res.data.code == 0) { - e = res.data.data.pageData[0]; - if (e) { - e.is_no_dis = ee.is_no_dis; - appd.pk_store = e; - that.set_def_storage(e); - } - - } - }) - } - //e.distance = distance; - appd.lat = that.data.lat; - appd.lon = that.data.lon; - } else { - if (e) { - e.distance = null; - that.set_def_storage(e); - } - } - }, 500) - }, 700) - }); //更新点击量 //noinspection JSUnresolvedFunction @@ -585,6 +536,39 @@ Page({ } }, + //-- 获取直播的分享人的导购信息 -- + async get_room_share_guide(share_openid) { + + var url = "/api/weshop/users/page"; + var first_leader = 0; + + //调用接口判断是不是会员 + await getApp().request.promiseGet(url, { + data: { + stoid: os.stoid, + weapp_openid: share_openid + } + }).then(res => { + if (ut.ajax_ok(res)) { + first_leader = res.data.data.pageData[0].user_id; + getApp().globalData.guide_id = res.data.data.id; + } + }) + + if (!first_leader) return false; + + getApp().globalData.first_leader = first_leader; + + //调用接口判断是不是会员 + await getApp().request.promiseGet("/api/weshop/shoppingGuide/get/" + os.stoid + "/" + first_leader, {}).then(res => { + if (res.data.code == 0) { + getApp().globalData.guide_id = res.data.data.id; + getApp().globalData.guide_pick_id= res.data.data.pickup_id + } + }) + + }, + //--- 设置一下默认库存的数量 ---- set_def_storage(ee) { @@ -805,15 +789,6 @@ Page({ }) - - - - - - - - - ee.setData({ gallery: gallery, is_collect: is_collect, @@ -827,10 +802,99 @@ Page({ }, + //检测有没有导购分享的门店 + check_guide(func){ + var first_leader=getApp().globalData.first_leader; + if(!first_leader){ + func(); + return false; + } + if(this.data.is_geted_guide_pick){ + func(); + return false; + } + + if(getApp().globalData.guide_pick_id){ + func(); + return false; + } + var th=this; + getApp().request.promiseGet("/api/weshop/shoppingGuide/get/" + os.stoid + "/" + first_leader, {}).then(res => { + if (res.data.code == 0) { + getApp().globalData.guide_pick_id= res.data.data.pickup_id; + } + th.data.is_geted_guide_pick=1; + func(); + }) + }, + + + get_user_sto(){ + var th=this;var that=this; + //获取用户的默认门店 + getApp().get_user_store(function (e) { + if (!e) { + th.data.fir_def_store = {}; //赋值空对象 + return false; + } + + if(getApp().globalData.is_dj_pk) th.setData({has_def:1}) + var ee = JSON.parse(JSON.stringify(e)); + //--定时器推迟一下-- + setTimeout(function () { + if (th.data.fir_goods) var g_distr_type = th.data.fir_goods.distr_type; + //--如果默认门店的配送方式不对,就不能被选择,这里不控制,如果不一样,就说明配送方式不对-- + if (ee.distr_type != 0 && g_distr_type != 0 && ee.distr_type != g_distr_type) { + ee.is_no_dis = 1; + } + + var appd = getApp().globalData; + var w_time = setInterval(function () { + if (that.data.is_get_local_ok == 0) return false; + clearInterval(w_time); + var distance = null; + var e = JSON.parse(JSON.stringify(ee)); + + //如果有开启近距离的话,同时距离优不一样了 + if (that.data.lat != null) { + //如果经纬度有变化的话 + if (e && appd.lat == that.data.lat && appd.lon == that.data.lon && e.distance > 0) { + that.set_def_storage(e); + } else { + //要用接口是获取距离,js的计算不准 + getApp().request.promiseGet("/api/weshop/pickup/list", { + data: { store_id: os.stoid, pickup_id: e.pickup_id, lat: th.data.lat, lon: th.data.lon, is_pos: 1 }, + }).then(res => { + if (res.data.code == 0) { + e = res.data.data.pageData[0]; + if (e) { + e.is_no_dis = ee.is_no_dis; + appd.pk_store = e; + that.set_def_storage(e); + } + + } + }) + } + //e.distance = distance; + appd.lat = that.data.lat; + appd.lon = that.data.lon; + + } else { + if (e) { + e.distance = null; + that.set_def_storage(e); + } + } + }, 500) + }, 700) + }); + }, + //---展示--- onShow: async function () { - getApp().check_can_share(); + getApp().check_can_share(); // console.log('onshow'); var goods_list = null, th = this, that = this; var show_prew_img = this.data.show_prew_img @@ -839,6 +903,16 @@ Page({ return false; } + if (this.data.show_video) { + this.data.show_video = 0; + return false; + } + + //先获取一下导购的门店 + th.check_guide(()=> { + th.get_user_sto(); + }) + // 判断活动是否暂停 //获取单个活动成团信息 await getApp().request.promiseGet('/api/weshop/prom/luckyActivity/page', { @@ -5473,6 +5547,16 @@ Page({ // 选择门店 choice_store: function (ee) { + + //--先判断会员状态-- + var user_info = getApp().globalData.userInfo; + if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) { + wx.navigateTo({ + url: '/packageE/pages/togoin/togoin', + }) + return false; + } + var th = this; var ind = ee.currentTarget.dataset.ind; var bconfig = th.data.bconfig; @@ -6182,6 +6266,14 @@ Page({ getApp().pre_img(this.data.sele_g.original_img); }, + screenChange: function (e) { + let fullScreen = e.detail.fullScreen //值true为进入全屏,false为退出全屏 + if (fullScreen) { //退出全屏 + getApp().globalData.no_clear = 1; + this.data.show_video = 1; + } + }, + is_show_more_buy: function () { var prom_goods = this.data.prom_goods; var per_price = this.data.sele_g.shop_price diff --git a/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.wxml b/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.wxml index 5dbbfe7..196893a 100644 --- a/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.wxml +++ b/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.wxml @@ -47,7 +47,7 @@ - + diff --git a/packageC/pages/presell/cart/cart2_pre.js b/packageC/pages/presell/cart/cart2_pre.js index 7ff56ae..1fd1b8d 100644 --- a/packageC/pages/presell/cart/cart2_pre.js +++ b/packageC/pages/presell/cart/cart2_pre.js @@ -371,7 +371,7 @@ Page({ // let cartList= this.data.cartlist // let cartList= arr // let length = cartList.length - if(this.data.is_pre_cut==0){ + if(!this.data.is_pre_cut){ return {} } wx.showLoading({ diff --git a/packageC/pages/presell/goodsInfo/goodsInfo.js b/packageC/pages/presell/goodsInfo/goodsInfo.js index ca083a1..4378e30 100644 --- a/packageC/pages/presell/goodsInfo/goodsInfo.js +++ b/packageC/pages/presell/goodsInfo/goodsInfo.js @@ -267,6 +267,9 @@ Page({ first_leader = t.first_leader, room_id = t.room_id, room_user_share = t.room_user_share; //如果是会员分享带有room_id的话,那么接下来会员分享就不传room_id + + var share_openid = t.share_openid; + //检查测肤 getApp().check_skin_face(t, 0, gid); //群id @@ -332,6 +335,7 @@ Page({ getApp().request.promiseGet("/api/weshop/shoppingGuide/get/" + os.stoid + "/" + first_leader, {}).then(res => { if (res.data.code == 0) { getApp().globalData.guide_id = res.data.data.id; + getApp().globalData.guide_pick_id= res.data.data.pickup_id } }) } @@ -343,6 +347,11 @@ Page({ //如果是会员分享过来的要记录 if (room_user_share) getApp().globalData.room_user_share = room_user_share; + + if (share_openid) { + this.get_room_share_guide(share_openid); + } + } var c_guide_id = t.c_guide_id; @@ -443,6 +452,38 @@ Page({ }) }, + async get_room_share_guide(share_openid) { + + var url = "/api/weshop/users/page"; + var first_leader = 0; + + //调用接口判断是不是会员 + await getApp().request.promiseGet(url, { + data: { + stoid: os.stoid, + weapp_openid: share_openid + } + }).then(res => { + if (ut.ajax_ok(res)) { + first_leader = res.data.data.pageData[0].user_id; + getApp().globalData.guide_id = res.data.data.id; + } + }) + + if (!first_leader) return false; + + getApp().globalData.first_leader = first_leader; + + //调用接口判断是不是会员 + await getApp().request.promiseGet("/api/weshop/shoppingGuide/get/" + os.stoid + "/" + first_leader, {}).then(res => { + if (res.data.code == 0) { + getApp().globalData.guide_id = res.data.data.id; + getApp().globalData.guide_pick_id= res.data.data.pickup_id + } + }) + + }, + //--- 设置一下默认库存的数量 ---- set_def_storage(ee) { var that = this, th = this; @@ -627,6 +668,32 @@ Page({ }, + //检验导购门店 + check_guide(func){ + var first_leader=getApp().globalData.first_leader; + if(!first_leader){ + func(); + return false; + } + if(this.data.is_geted_guide_pick){ + func(); + return false; + } + + if(getApp().globalData.guide_pick_id){ + func(); + return false; + } + var th=this; + getApp().request.promiseGet("/api/weshop/shoppingGuide/get/" + os.stoid + "/" + first_leader, {}).then(res => { + if (res.data.code == 0) { + getApp().globalData.guide_pick_id= res.data.data.pickup_id; + } + th.data.is_geted_guide_pick=1; + func(); + }) + }, + //---展示--- onShow: function () { getApp().check_can_share(); @@ -707,68 +774,70 @@ Page({ ee.data.sele_g_id = t.data.data.goods_id; ee.data.sele_g = t.data.data; - //获取用户的默认门店 - getApp().get_user_store(function (e) { - if (!e) { - th.data.fir_def_store = {}; //赋值空对象 - return false; - } - if (getApp().globalData.is_dj_pk) th.setData({ has_def: 1 }) + //检测一下分享导购的门店 + ee.check_guide(() => { + //获取用户的默认门店 + getApp().get_user_store(function (e) { + if (!e) { + th.data.fir_def_store = {}; //赋值空对象 + return false; + } + if (getApp().globalData.is_dj_pk) th.setData({has_def: 1}) - var ee = JSON.parse(JSON.stringify(e)); + var ee = JSON.parse(JSON.stringify(e)); - if (th.data.fir_goods) var g_distr_type = th.data.fir_goods.distr_type; - //--如果默认门店的配送方式不对,就不能被选择,这里不控制,如果不一样,就说明配送方式不对-- - if (ee.distr_type != 0 && g_distr_type != 0 && ee.distr_type != g_distr_type) { - ee.is_no_dis = 1; - } + if (th.data.fir_goods) var g_distr_type = th.data.fir_goods.distr_type; + //--如果默认门店的配送方式不对,就不能被选择,这里不控制,如果不一样,就说明配送方式不对-- + if (ee.distr_type != 0 && g_distr_type != 0 && ee.distr_type != g_distr_type) { + ee.is_no_dis = 1; + } - var appd = getApp().globalData; - var w_time = setInterval(function () { - if (that.data.is_get_local_ok == 0) return false; - clearInterval(w_time); - var e = JSON.parse(JSON.stringify(ee)); + var appd = getApp().globalData; + var w_time = setInterval(function () { + if (that.data.is_get_local_ok == 0) return false; + clearInterval(w_time); + var e = JSON.parse(JSON.stringify(ee)); - //如果有开启近距离的话,同时距离优不一样了 - if (that.data.lat != null) { - //如果经纬度有变化的话 - if (e && appd.lat == that.data.lat && appd.lon == that.data.lon && e.distance > 0) { - that.set_def_storage(e); + //如果有开启近距离的话,同时距离优不一样了 + if (that.data.lat != null) { + //如果经纬度有变化的话 + if (e && appd.lat == that.data.lat && appd.lon == that.data.lon && e.distance > 0) { + that.set_def_storage(e); - } else { - //要用接口是获取距离,js的计算不准 - getApp().request.promiseGet("/api/weshop/pickup/list", { - data: { - store_id: os.stoid, - pickup_id: e.pickup_id, - is_pos: 1, - lat: th.data.lat, - lon: th.data.lon - }, - }).then(res => { - if (res.data.code == 0) { - e = res.data.data.pageData[0]; - if (e) { - e.is_no_dis = ee.is_no_dis; - appd.pk_store = e; - that.set_def_storage(e); - } + } else { + //要用接口是获取距离,js的计算不准 + getApp().request.promiseGet("/api/weshop/pickup/list", { + data: { + store_id: os.stoid, + pickup_id: e.pickup_id, + is_pos: 1, + lat: th.data.lat, + lon: th.data.lon + }, + }).then(res => { + if (res.data.code == 0) { + e = res.data.data.pageData[0]; + if (e) { + e.is_no_dis = ee.is_no_dis; + appd.pk_store = e; + that.set_def_storage(e); + } - } - }) - } - appd.lat = that.data.lat; - appd.lon = that.data.lon; + } + }) + } + appd.lat = that.data.lat; + appd.lon = that.data.lon; - } else { - if (e) { - e.distance = null; - that.set_def_storage(e); + } else { + if (e) { + e.distance = null; + that.set_def_storage(e); + } } - } - }, 500) - }); - + }, 500) + }); + }) t.data.data.on_time = ut.formatTime(t.data.data.on_time, 'yyyy-MM-dd hh:mm:ss'); @@ -3564,6 +3633,16 @@ Page({ }, // 选择门店 choice_store: function (ee) { + + //--先判断会员状态-- + var user_info = getApp().globalData.userInfo; + if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) { + wx.navigateTo({ + url: '/packageE/pages/togoin/togoin', + }) + return false; + } + var th = this; var ind = ee.currentTarget.dataset.ind; var bconfig = th.data.bconfig; diff --git a/packageC/pages/presell/list/list.js b/packageC/pages/presell/list/list.js index 1924c4f..70fdceb 100644 --- a/packageC/pages/presell/list/list.js +++ b/packageC/pages/presell/list/list.js @@ -30,6 +30,7 @@ Page({ getApp().request.promiseGet("/api/weshop/shoppingGuide/get/" + os.stoid + "/" + first_leader, {}).then(res => { if (res.data.code == 0) { getApp().globalData.guide_id = res.data.data.id; + getApp().globalData.guide_pick_id= res.data.data.pickup_id } }) } diff --git a/packageC/pages/presell/pregoodsInfo/goodsInfo.js b/packageC/pages/presell/pregoodsInfo/goodsInfo.js index f2978e8..109d39e 100644 --- a/packageC/pages/presell/pregoodsInfo/goodsInfo.js +++ b/packageC/pages/presell/pregoodsInfo/goodsInfo.js @@ -263,6 +263,7 @@ Page({ room_id = t.room_id, room_user_share = t.room_user_share; //如果是会员分享带有room_id的话,那么接下来会员分享就不传room_id + var share_openid = t.share_openid; //-- 自定义海报 -- getApp().request.promiseGet("/api/weshop/goods/poster/page", { data: { store_id: os.stoid, type: 1, is_use: 1 } @@ -316,11 +317,14 @@ Page({ if (first_leader) { console.log("log---".first_leader); getApp().globalData.first_leader = first_leader; + //调用接口判断是不是会员 getApp().request.promiseGet("/api/weshop/shoppingGuide/get/" + os.stoid + "/" + first_leader, {}).then(res => { if (res.data.code == 0) { getApp().globalData.guide_id = res.data.data.id; + getApp().globalData.guide_pick_id= res.data.data.pickup_id } + }) } @@ -331,6 +335,10 @@ Page({ //如果是会员分享过来的要记录 if (room_user_share) getApp().globalData.room_user_share = room_user_share; + + if (share_openid) { + this.get_room_share_guide(share_openid); + } } var c_guide_id = t.c_guide_id; @@ -429,6 +437,38 @@ Page({ }) }, + async get_room_share_guide(share_openid) { + + var url = "/api/weshop/users/page"; + var first_leader = 0; + + //调用接口判断是不是会员 + await getApp().request.promiseGet(url, { + data: { + stoid: os.stoid, + weapp_openid: share_openid + } + }).then(res => { + if (ut.ajax_ok(res)) { + first_leader = res.data.data.pageData[0].user_id; + getApp().globalData.guide_id = res.data.data.id; + } + }) + + if (!first_leader) return false; + + getApp().globalData.first_leader = first_leader; + + //调用接口判断是不是会员 + await getApp().request.promiseGet("/api/weshop/shoppingGuide/get/" + os.stoid + "/" + first_leader, {}).then(res => { + if (res.data.code == 0) { + getApp().globalData.guide_id = res.data.data.id; + getApp().globalData.guide_pick_id= res.data.data.pickup_id + } + }) + + }, + //--- 设置一下默认库存的数量 ---- set_def_storage(ee) { @@ -606,6 +646,30 @@ Page({ }, + check_guide(func){ + var first_leader=getApp().globalData.first_leader; + if(!first_leader){ + func(); + return false; + } + if(this.data.is_geted_guide_pick){ + func(); + return false; + } + + if(getApp().globalData.guide_pick_id){ + func(); + return false; + } + var th=this; + getApp().request.promiseGet("/api/weshop/shoppingGuide/get/" + os.stoid + "/" + first_leader, {}).then(res => { + if (res.data.code == 0) { + getApp().globalData.guide_pick_id= res.data.data.pickup_id; + } + th.data.is_geted_guide_pick=1; + func(); + }) + }, //---展示--- onShow: function () { @@ -687,70 +751,71 @@ Page({ ee.data.sele_g_id=t.data.data.goods_id; ee.data.sele_g=t.data.data; - //获取用户的默认门店 - getApp().get_user_store(function (e) { - if (!e) { - th.data.fir_def_store = {}; //赋值空对象 - return false; - } - - if(getApp().globalData.is_dj_pk) th.setData({has_def:1}) + //检测一下分享导购的门店 + ee.check_guide(() => { + //获取用户的默认门店 + getApp().get_user_store(function (e) { + if (!e) { + th.data.fir_def_store = {}; //赋值空对象 + return false; + } - var ee = JSON.parse(JSON.stringify(e)); + if (getApp().globalData.is_dj_pk) th.setData({has_def: 1}) - if (th.data.fir_goods) var g_distr_type = th.data.fir_goods.distr_type; - //--如果默认门店的配送方式不对,就不能被选择,这里不控制,如果不一样,就说明配送方式不对-- - if (ee.distr_type != 0 && g_distr_type != 0 && ee.distr_type != g_distr_type) { - ee.is_no_dis = 1; - } + var ee = JSON.parse(JSON.stringify(e)); - var appd = getApp().globalData; - var w_time = setInterval(function () { - if (that.data.is_get_local_ok == 0) return false; - clearInterval(w_time); - var e = JSON.parse(JSON.stringify(ee)); + if (th.data.fir_goods) var g_distr_type = th.data.fir_goods.distr_type; + //--如果默认门店的配送方式不对,就不能被选择,这里不控制,如果不一样,就说明配送方式不对-- + if (ee.distr_type != 0 && g_distr_type != 0 && ee.distr_type != g_distr_type) { + ee.is_no_dis = 1; + } - //如果有开启近距离的话,同时距离优不一样了 - if (that.data.lat != null) { - //如果经纬度有变化的话 - if (e && appd.lat == that.data.lat && appd.lon == that.data.lon && e.distance > 0) { - that.set_def_storage(e); + var appd = getApp().globalData; + var w_time = setInterval(function () { + if (that.data.is_get_local_ok == 0) return false; + clearInterval(w_time); + var e = JSON.parse(JSON.stringify(ee)); + + //如果有开启近距离的话,同时距离优不一样了 + if (that.data.lat != null) { + //如果经纬度有变化的话 + if (e && appd.lat == that.data.lat && appd.lon == that.data.lon && e.distance > 0) { + that.set_def_storage(e); + + } else { + //要用接口是获取距离,js的计算不准 + getApp().request.promiseGet("/api/weshop/pickup/list", { + data: { + store_id: os.stoid, + pickup_id: e.pickup_id, + is_pos: 1, + lat: th.data.lat, + lon: th.data.lon + }, + }).then(res => { + if (res.data.code == 0) { + e = res.data.data.pageData[0]; + if (e) { + e.is_no_dis = ee.is_no_dis; + appd.pk_store = e; + that.set_def_storage(e); + } - } else { - //要用接口是获取距离,js的计算不准 - getApp().request.promiseGet("/api/weshop/pickup/list", { - data: { - store_id: os.stoid, - pickup_id: e.pickup_id, - is_pos: 1, - lat: th.data.lat, - lon: th.data.lon - }, - }).then(res => { - if (res.data.code == 0) { - e = res.data.data.pageData[0]; - if (e) { - e.is_no_dis = ee.is_no_dis; - appd.pk_store = e; - that.set_def_storage(e); } + }) + } + appd.lat = that.data.lat; + appd.lon = that.data.lon; - } - }) - } - appd.lat = that.data.lat; - appd.lon = that.data.lon; - - } else { - if (e) { - e.distance = null; - that.set_def_storage(e); + } else { + if (e) { + e.distance = null; + that.set_def_storage(e); + } } - } - }, 500) - }); - - + }, 500) + }); + }) t.data.data.on_time = ut.formatTime(t.data.data.on_time, 'yyyy-MM-dd hh:mm:ss'); @@ -3208,6 +3273,16 @@ Page({ }, // 选择门店 choice_store: function (ee) { + + //--先判断会员状态-- + var user_info = getApp().globalData.userInfo; + if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) { + wx.navigateTo({ + url: '/packageE/pages/togoin/togoin', + }) + return false; + } + var th = this; var ind = ee.currentTarget.dataset.ind; var bconfig = th.data.bconfig; diff --git a/packageD/pages/AI-test-skin/success_result/success_result.js b/packageD/pages/AI-test-skin/success_result/success_result.js index 4d839e4..6ab6db3 100644 --- a/packageD/pages/AI-test-skin/success_result/success_result.js +++ b/packageD/pages/AI-test-skin/success_result/success_result.js @@ -107,6 +107,7 @@ Page({ getApp().request.promiseGet("/api/weshop/shoppingGuide/get/" + setting.stoid + "/" + first_leader, {}).then(res => { if (res.data.code == 0) { getApp().globalData.guide_id = res.data.data.id; + getApp().globalData.guide_pick_id= res.data.data.pickup_id } }) } diff --git a/packageE/pages/cart/cart2/cart2.js b/packageE/pages/cart/cart2/cart2.js index b68a64c..d3dec1f 100644 --- a/packageE/pages/cart/cart2/cart2.js +++ b/packageE/pages/cart/cart2/cart2.js @@ -363,7 +363,7 @@ Page({ this.setData({ [txt]: 2 }) } //搭配购直接购买特殊处理 - if(this.data.collocation_goods && this.data.cartlist){ + if(this.data.collocation_goods && this.data.collocation_goods.length>0 && this.data.cartlist){ let txt = 'cartlist[0].yck_off'; let txt1 = 'old_cartlist[0].yck_off'; if (this.data.cartlist[0].yck_off == 2) { @@ -382,7 +382,7 @@ Page({ // let cartList= this.data.cartlist // let cartList= arr // let length = cartList.length - if(this.data.is_pre_cut==0){ + if(!this.data.is_pre_cut){ return {} } wx.showLoading({ @@ -2644,9 +2644,13 @@ Page({ } let cart_yc = await th.beforAdvancesum(cart_item) + console.log('购物车--------'); if (!cart_item.yck_off) { cart_item.yck_off = cart_yc.yck_off } + if(cart_yc.yck*1==0){ + cart_item.yck_off = 0 + } cart_item.yck = cart_yc.yck cart_item.yckid = cart_yc.yckid cart_item.pre_json = cart_yc.pre_json @@ -2874,8 +2878,9 @@ Page({ if (!good) return false; - //搭配的计算要用购物的车计算方法 + //搭配的计算要用购物的车计算方法 // if (good.prom_type == 5 ) { + if (good.prom_type == 5 ) { if( th.data.old_cartlist && th.data.old_cartlist.length > 0){ th.calculatePrice(); @@ -3221,7 +3226,7 @@ Page({ } else { th.setData({ [order_prom_txt1]: 0, [order_prom_txt2]: 0 }) } - + //预存金额使用参与计算 if (th.data.udata && th.data.udata.Balance > 0 && order_m * 1 > 0) { if (!th.data.bn_goods.keyid) { @@ -3249,6 +3254,7 @@ Page({ } if (th.data.bn_goods.keyid) { + let cart_yc = await th.beforAdvancesum({ order_amount: order_m, goods: [{ @@ -3260,10 +3266,13 @@ Page({ keyid: th.data.bn_goods.keyid } }) - + if (!good.yck_off) { good.yck_off = cart_yc.yck_off } + if(cart_yc.yck*1==0){ + good.yck_off = 0 + } good.yck = cart_yc.yck good.yckid = cart_yc.yckid good.pre_json = cart_yc.pre_json @@ -5284,9 +5293,14 @@ Page({ continue; } - if(gd.prom_type==5 && !th.data.coll_prom[gd.prom_id].is_coupon && th.has_dp(goodlist,gd.prom_id)){ - continue; + //有搭配购的时候才来判断 + if(gd.prom_type==5 && th.data.coll_prom && th.data.coll_prom[gd.prom_id]){ + if(!th.data.coll_prom[gd.prom_id].is_coupon && th.has_dp(goodlist,gd.prom_id)){ + continue; + } } + + //--如果是团购,要判断有没有限制使用优惠券 if (gd.prom_type == 2) { var prom1 = null; @@ -6519,6 +6533,7 @@ Page({ select_coll(e) { console.log("--1111--aaa--"); console.log(e); + //-- 如果是购物车的选择添加搭配商品 -- if (e.detail.is_cart == 1) { this.select_coll_buy_cart(e.detail); diff --git a/packageE/pages/giftpack/giftpacklistshop/giftpacklistshop.js b/packageE/pages/giftpack/giftpacklistshop/giftpacklistshop.js new file mode 100644 index 0000000..7749bed --- /dev/null +++ b/packageE/pages/giftpack/giftpacklistshop/giftpacklistshop.js @@ -0,0 +1,1196 @@ +var e = getApp(), + a = e.globalData.setting, + os = a, + t = e.request, + d = e.globalData; +var ut = require("../../../../utils/util.js"); +var com = require("../../../../pages/giftpack/public/buy_com.js"); + +Page({ + data: { + url: a.url, //接口网址 + iurl: a.imghost, //图片前缀网址 + isBuy: 0, + getGiftID: '', //礼包id + giftImage: '', + giftTitle: '', + giftDate: '', + giftPrice: '', + giftIntegral: '', + giftPosPrice: '', + giftQty: '', + giftRemark: '', + giftType: '', + actTitle: '', + getUrl: '', + wareCard: [], + orderSn: "", //订单编号 + lbId: "", + code: "", //核销码 + c_state: "0", //判断是否已经使用, 0正常 1已使用 2已过期 + is_lb: 0, //是否有礼包 + default_color: null, + first_leader: e.globalData.first_leader || 0, // 推荐人ID + + //门店相关 + ismend: 0, + is_sec_mend: 0, + sto_sele_name: "", //选中的门店名称 + sto_sele_id: "", //选中的门店id + sto_sele_distr: "", //选择的门店的配送方式 + is_show_sto_cat: 1, //是否显示门店分类 + only_pk: null, + all_sto: null, + sec_sto: null, //选择了的门店分类 + pickpu_list: null, //读出的所有门店list + def_pickpu_list: null, //一开始5个门店list + sec_pick_index: 0, //第二级门店选择ID + fir_pick_index: 0, //第一级门店选择ID + all_pick_list: null,//所有的门店先记录起来 + select_store: 0, //选择更多 + index: 1, + more_store: 0, //选择门店 + sort_store: 0, //门店分类 + choice_sort_store: 0, //选择分类门店 + new_user: 0, //新用户 + def_pick_store: null, // 默认的门店 + fir_def_store: null, //客户默认的门店的 + lat: null, //维度 + lon: null, //经度 + is_get_local_ok: 0, //获取坐标是否完成 + region_name: "门店分类", //区域的名字 + is_gps: 1, + open_ind_store: 0, //哪里打开的门店列表的控制属性 + default_store: {}, //创建添加默认门店地址的对象 + store: 0, + openSpecModal: 0, + sto_sele_name_1: '', + share_goods_img:'', //礼包的分享图 + giftImageCover:null, + canvasHidden:true, + screenWidth: 0 + }, + onLoad: function (options) { + + var th = this; + options.isBuy=0 + this.setData({ + params: options, + }) + + // getApp().getConfig(function (e) { + // th.setData({sto_sele_name_1: e.store_name}) + // }) + + // getApp().getConfig2(function (e) { + // var json_d = JSON.parse(e.switch_list); + // th.setData({ + // bconfig: e, + // sys_switch: json_d, + // is_retail_price: json_d.is_retail_price || 0 + // }); + // }) + + //获取用户设备信息,屏幕宽度 + wx.getSystemInfo({ + success: res => { + th.setData({ + screenWidth: res.screenWidth + }) + } + }); + + }, + init() { + let options = this.data?.params; // this.data == null ? undefined:this.data.params + var th = this; + this.setData({ + getUserID: d.user_id, + getStorageID: a.stoid, + }) + + if(!options.lbId && options.scene){ + var gid_str = decodeURIComponent(options.scene); + gid_str = gid_str.split("_"); + + options.lbId=gid_str[0]; + options.first_leader=gid_str[1]; + options.isBuy=1; + } + + + this.setData({ + isBuy: options.isBuy, + getGiftID: options.lbId, + orderSn: options.orderSn, + flag: options.flag, // 如果从商品详情页的促销处点击专享礼包跳转到此页,则flag为1 + }) + if (options.lbId) th.data.lbId = options.lbId; + //-- 获取分享人的ID -- + var first_leader = options.first_leader || getApp().globalData.first_leader; + if (first_leader) { + this.setData({ + first_leader, + }) + //-- user_id代过来免登录 -- + getApp().globalData.first_leader = first_leader; + //调用接口判断是不是会员 + getApp().request.promiseGet("/api/weshop/shoppingGuide/get/" + os.stoid + "/" + first_leader, {}).then(res => { + if (res.data.code == 0) { + getApp().globalData.guide_id = res.data.data.id; + } + }) + } + // th.close(); + + + if (this.data.flag == 1) { + this.getZxlbDetails(); + } else { + this.GetMyGiftList(); + // if (this.data.isBuy == 0) { + // this.GetMyGiftList(); + // } else if (this.data.isBuy == 1) { + // this.GetBuyGiftList(); + // } + + } + + }, + + onShow: function () { + getApp().check_can_share(); + getApp().is_Single_page(this, function () { + //--先判断会员状态-- + var user_info = getApp().globalData.userInfo; + // if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) { + // getApp().goto('/packageE/pages/togoin/togoin'); + // return false; + // } + this.init(); + }) + }, + GetBuyPrice: function (e) { + var that = this.data; + var th = this; + //如果还没有开始的话 + if (th.data.isStart != 1) { + getApp().my_warnning("活动还没有开始", 0, th); + return false; + } + + this.data.payMoney = th.data.sele_g.payMoney; + th.setData({buyType: 2}) + if (th.data.sele_g.is_pickup) { + th.setData({ + openSpecModal: 1 + }) + } else { + var my_confirm = th.selectComponent("#my_confirm"); //组件的id + my_confirm.open( + "是否确定购买该礼包", + "取消", + "确定", + function () { + my_confirm.open_cancel(0); + }, + function () { + my_confirm.open_cancel(0); + com.buy_libao(th) + } + ) + } + + + }, + GetBuyIntegral: function (e) { + var that = this.data; + var th = this; + + //如果还没有开始的话 + if (th.data.isStart != 1) { + getApp().my_warnning("活动还没有开始", 0, th); + return false; + } + + th.setData({buyType: 1}); + if (th.data.sele_g.is_pickup) { + th.setData({ + openSpecModal: 1 + }) + } else { + var my_confirm = th.selectComponent("#my_confirm"); //组件的id + my_confirm.open( + "是否确定兑换该礼包", + "取消", + "确定", + function () { + my_confirm.open_cancel(0); + }, + function () { + my_confirm.open_cancel(0); + com.buy_libao(th) + }) + } + + + }, + + GetMyGiftList: function () { + var _this = this; + var th = this; + getApp().request.get('/api/weshop/marketing/my/giftbag/detail/get', { + isShowLoading: true, + data: { + "storeId": a.stoid, //商家ID + "userId": th.data.params.userId, //用户ID + "orderSn": th.data.orderSn + // "userId": d.user_id, //用户ID + // "orderSn": th.data.orderSn + // "giftBagId":th.data.params.lbId + }, + success: function (res) { + if (res.data.code == 0) { + console.log('商品------++') + console.log(res) + th.setData({ + giftImage: th.data.iurl + res.data.data.lbUrl, + giftImageCover: th.data.iurl + (th.data.params.cover_img ? th.data.params.cover_img: res.data.data.lbUrl), + giftTitle: res.data.data.giftTitle, + default_color: res.data.data.bgcolor + }) + + if (res.data.data.iswarelbtype == 1) { + th.setData({iswarelbtype: 1}) + } + + if (!res.data.data.giftRemark || res.data.data.giftRemark == '') { + th.setData({ + giftRemark: '暂无详情......' + }) + } else { + th.setData({ + giftRemark: res.data.data.giftRemark.replace(/\ t_now) + th.setData({ + c_state: -1 + }) + th.setData({ + giftDate: res.data.data.endTime, + giftPosPrice: res.data.data.giftPosPrice, + giftQty: res.data.data.giftQty, + giftIntegral: res.data.data.payIntegral, + giftPrice: res.data.data.payMoney, + giftType: res.data.data.actType, + actTitle: res.data.data.actTitle, + wareCard: res.data.data.wareCard, + lbId: res.data.data.lbId + }) + //判断是否有礼包 + for (var i = 0; i < res.data.data.wareCard.length; i++) { + if (res.data.data.wareCard[i].lbType == 1) { + th.setData({ + is_lb: 1 + }) + break; + } + } + + if (res.data.data.pickup_id) { + getApp().request.get("/api/weshop/pickup/get/" + os.stoid + "/" + res.data.data.pickup_id, { + success: function (res) { + if (res.data.code == 0) { + th.setData({pick_up: res.data.data}); + } + } + }); + + } + + + } else { + getApp().my_warnning(res.data.msg, 0, th); + return false; + } + } + }); + + }, + GetBuyGiftList: function () { + var _this2 = this; + var th = this.data; + getApp().request.get('/api/weshop/marketing/giftbag/detail/get', { + isShowLoading: true, + data: { + "storeId": a.stoid, //商家ID + "userId": d.user_id, //用户ID + "giftBagId": th.getGiftID + }, + success: function success(res) { + if (res.data.code == 0) { + _this2.setData({ + giftImage: th.iurl + res.data.data.lbUrl, + giftImageCover: th.iurl + (_this2.data.params.cover_img ? _this2.data.params.cover_img: res.data.data.lbUrl), + giftTitle: res.data.data.giftTitle, + default_color: res.data.data.bgcolor + }) + if (res.data.data.giftRemark == '') { + _this2.setData({ + giftRemark: '暂无详情......' + }) + } else { + _this2.setData({ + giftRemark: res.data.data.giftRemark.replace(/\ 0) { + scene += "_" + user_id; + } + ///二微码 + var path3 = os.url + "/api/wx/open/app/user/getWeAppEwm/" + + os.stoid + "?sceneValue=" + scene + "&pageValue=pages/giftpack/giftpacklist/giftpacklist"; + + // 读取文件成功则OK-- + wx.getImageInfo({ + src: path3, + success: function (res) { + th.get_goods_temp(function () { + var vpath = res.path; + var context = wx.createCanvasContext('share'); + // let share_goods_img = th.params.cover_img + th.drawPoster(context, unit, th.data.share_goods_img, vpath, 0); + + //把画板内容绘制成图片,并回调 画板图片路径 + context.draw(false, function () { + setTimeout(function () { + wx.canvasToTempFilePath({ + x: 0, + y: 0, + width: 750, + height: 1217, + destWidth: 1.2 * 750 * 750 / that.data.screenWidth, + destHeight: 1.2 * 1217 * 750 / that.data.screenWidth, + canvasId: 'share', + success: function (res) { + + that.setData({ + shareImgPath: res.tempFilePath, + canvasHidden: true + }) + + if (!res.tempFilePath) { + wx.showModal({ + title: '提示', + content: '图片绘制中,请稍后重试', + showCancel: false + }) + return false; + } + + that.setData({ + showPoster: true, + }); + wx.hideLoading(); + } + }) + }, 800) + + }); + }) + }, + fail: function (res) { + console.log(res); + wx.hideLoading(); + + } + }); + }, + + //-- 小程序绘制海报 -- + drawPoster(context, unit, img, vpath, type) { + // 1.灰色背景 + context.setFillStyle('#f2f1f6'); + context.rect(0, 0, 554 * unit, 899 * unit); + context.fill(); + + // 2.商城名称 + let shopName = this.data.sto_sele_name_1; + context.setTextAlign('center'); + context.setFontSize(26 * unit); + context.setFillStyle('black'); + context.fillText(shopName, 277 * unit, 60 * unit); + + // 3.推荐来源 + let fromText = `来自${getApp().globalData.userInfo.nickname}的推荐`; + context.setTextAlign('center'); + context.setFontSize(22 * unit); + context.setFillStyle('#96959a'); + context.fillText(fromText, 277 * unit, 105 * unit); + + // 4.海报背景 + context.setFillStyle('white'); + context.fillRect(37 * unit, 157 * unit, 480 * unit, 673 * unit); + + // 5.商品图片 + // 图片的x坐标 + let bg_x = 37 * unit + // 图片的y坐标 + let bg_y = 157 * unit + // 图片宽度 + let bg_w = 480 * unit + // 图片高度 + let bg_h = 474 * unit + // 图片圆角 + let bg_r = 4 + // 绘制海报背景图片圆角 + context.save() + context.beginPath() + context.arc(bg_x + bg_r, bg_y + bg_r, bg_r, Math.PI, Math.PI * 1.5) + context.arc(bg_x + bg_w - bg_r, bg_y + bg_r, bg_r, Math.PI * 1.5, Math.PI * 2) + context.arc(bg_x + bg_w, bg_y + bg_h, bg_r, 0, Math.PI * 0.5) + context.arc(bg_x, bg_y + bg_h, 0, Math.PI * 0.5, Math.PI) + context.clip() + context.drawImage(img, bg_x, bg_y, bg_w, bg_h); + context.restore(); + + // 6.强烈推荐 + let src = ''; + context.beginPath(); + if (type == 0) { // 普通 + src = '../../../images/share/q_tj.png'; + context.drawImage(src, 54 * unit, 648 * unit, 85 * unit, 30 * unit); + context.setFontSize(16 * unit) + context.setFillStyle("white") + context.setTextAlign('left'); + context.fillText('强烈推荐', 64 * unit, 668 * unit); + } + + + let price = this.data.giftPrice; + let giftIntegral = this.data.giftIntegral; + context.setFontSize(32 * unit); + context.setFillStyle('#DE1117'); + + var price_txt=""; + if(price || giftIntegral){ + if(price){ + price_txt='¥' + price; + if(giftIntegral) price_txt+='+'; + } + if(giftIntegral) price_txt+=giftIntegral+'积分'; + }else{ + price_txt="¥0"; + } + + context.fillText(price_txt, 54 * unit, 735 * unit); + + + var wp= 62 * unit; + var hp=765 * unit + this.draw_pos_price(context,wp,hp,this.giftPosPrice,unit); + + // 8.商品标题 + context.setFontSize(20 * unit); + context.setFillStyle('#898989'); + getApp().draw_Text(context, this.data.giftTitle, 54 * unit, 800 * unit, 240 * unit, 280 * unit, unit, 1); + + // 9.小程序码 + context.drawImage(vpath, 375 * unit, 660 * unit, 120 * unit, 120 * unit); + context.setFontSize(16 * unit); + context.setFillStyle('#777'); + context.fillText('长按识别二维码', 378 * unit, 810 * unit); + + // 10.竖线 + context.beginPath(); + context.setFillStyle('#eee'); + context.rect(354 * unit, 670 * unit, 1 * unit, 130 * unit); + context.fill(); + }, + + + //---市场价划掉--- + draw_pos_price(context,w,h,market_price,unit){ + + if(!this.is_retail_price) return false; + + context.setFillStyle("gray") + context.setFontSize(22 * unit) + var pri0 = "¥" + market_price.toFixed(2); + context.fillText(pri0, w, h); + + var c_h=h-6; + context.setStrokeStyle('gray'); + context.setLineWidth(1 * unit); + context.moveTo(w - 5, c_h); + context.lineTo(w + ut.measureText(pri0, 22 * unit) + 5, c_h); + context.stroke(); + + }, + + //--获取商品图片的本地缓存,回调写法-- + get_goods_temp: function (tt) { + var ee = this; + if (ee.data.share_goods_img) { + tt(); + return false; + } + var img_url = ee.data.giftImageCover ? ee.data.giftImageCover : ee.data.giftImage; + //获取商品是分享图信息 + wx.getImageInfo({ + src: img_url, + success: function (res) { + //res.path是网络图片的本地地址 + ee.data.share_goods_img = res.path; + tt(); + }, + fail: function (res) { + //获取默认空白图 + wx.getImageInfo({ + src: ee.data.iurl+'/miniapp/images/default_g_img.gif', + success: function(res) { + ee.data.share_goods_img = res.path; //分享的图片不能用网络的 + tt(); + } + }) + } + }); + }, + + closePoster() { + this.setData({ + showPoster: false, + }); + }, + // 保存图片到手机 + savePic() { + getApp().savePic(this); + }, + // 预览海报 + previewPoster() { + getApp().globalData.no_clear=1; + wx.previewImage({ + current: this.data.shareImgPath, // 当前显示图片的http链接 + urls: [this.data.shareImgPath] ,// 需要预览的图片http链接列表 + }); + }, + + + +}); \ No newline at end of file diff --git a/packageE/pages/giftpack/giftpacklistshop/giftpacklistshop.json b/packageE/pages/giftpack/giftpacklistshop/giftpacklistshop.json new file mode 100644 index 0000000..0841c16 --- /dev/null +++ b/packageE/pages/giftpack/giftpacklistshop/giftpacklistshop.json @@ -0,0 +1,10 @@ +{ + "navigationBarTitleText": "礼包详情", + "usingComponents": { + "warn": "/components/long_warn/long_warn", + "my_confirm": "/components/my_confirm/my_confirm", + "qr_code": "/components/qr_code/qr_code", + "nav_b": "/components/nav_b/nav_b", + "share": "/components/share/share" + } +} \ No newline at end of file diff --git a/packageE/pages/giftpack/giftpacklistshop/giftpacklistshop.wxml b/packageE/pages/giftpack/giftpacklistshop/giftpacklistshop.wxml new file mode 100644 index 0000000..bff8d9d --- /dev/null +++ b/packageE/pages/giftpack/giftpacklistshop/giftpacklistshop.wxml @@ -0,0 +1,247 @@ + + + + + + + + {{pick_up.pickup_name}} + + + + {{giftTitle}} + + + + + + + + + + {{"活动开始时间:"+giftStart}} + + + + + {{"兑换结束时间:"+giftDate}} + + {{"活动结束时间:"+giftDate}} + + + + + + + + + + {{"¥"+giftPrice}} + + + / + + + {{giftIntegral+"积分"}} + + + {{actTitle}} + + + + + + + + + {{is_retail_price?'零售价:':''}}{{giftPosPrice+"元"}} + + + {{"已售:"+giftQty+"件"}} + {{"数量:"+giftQty+"件"}} + + + + + + 礼包内容 + + + + + + + + + + + + + + + + + + + + + + + {{item.couponName}} + + + + + + + {{"数量:"+item.num}} + + + + + + + + + + + + 活动说明 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/packageE/pages/giftpack/giftpacklistshop/giftpacklistshop.wxss b/packageE/pages/giftpack/giftpacklistshop/giftpacklistshop.wxss new file mode 100644 index 0000000..e5edddf --- /dev/null +++ b/packageE/pages/giftpack/giftpacklistshop/giftpacklistshop.wxss @@ -0,0 +1,252 @@ +@charset "UTF-8"; +/* @import '../../goods/goodsInfo/goodsInfo.wxss'; */ +@import "../../../../utils/wxParse/wxParse.wxss"; +.box.data-v-3a5b7e36 { + -webkit-align-content: center; + align-content: center; + background-color: #e85f93; +} + +.box_top.data-v-3a5b7e36 { + width: 100%; +} + +.box_top image.data-v-3a5b7e36 { + width: 100%; + max-height: 540rpx; +} + +.box_title.data-v-3a5b7e36 { + margin: 10rpx 20rpx 20rpx 20rpx; + padding: 35rpx; + background-color: #fff; + border-radius: 40rpx; +} + +.top_title.data-v-3a5b7e36 { + font-size: 30rpx; + margin-bottom: 10rpx; + position: relative; +} + +.top_time.data-v-3a5b7e36 { + font-size: 27rpx; + color: #b9b5b5; +} + +.top_price.data-v-3a5b7e36 { + font-size: 35rpx; + color: #d61b30; + margin-top: 30rpx; + margin-bottom: 5rpx; + position: relative; +} + +.top_foot.data-v-3a5b7e36 { + display: -webkit-box; + display: -webkit-flex; + display: flex; +} + +.top_foot_price.data-v-3a5b7e36 { + font-size: 22rpx; + color: #b9b5b5; + width: 50%; + text-decoration: line-through; +} + +.top_foot_qty.data-v-3a5b7e36 { + font-size: 22rpx; + color: #b9b5b5; + width: 50%; + -webkit-align-content: flex-end; + align-content: flex-end; + text-align: right; +} + +.box_ware.data-v-3a5b7e36 { + margin: 10rpx 20rpx 20rpx 20rpx; + padding: 35rpx; + background-color: #fff; + border-radius: 40rpx; +} + +.box_ware_title.data-v-3a5b7e36 { + font-size: 35rpx; + margin: 5rpx 0rpx 30rpx 0rpx; +} + +.box_ware_box.data-v-3a5b7e36 { + display: -webkit-box; + display: -webkit-flex; + display: flex; + margin: 10rpx 0rpx 25rpx 0rpx; +} + +/* .box_ware_img.data-v-3a5b7e36 { + width: 30%; + height: 180rpx; + border: #999999 solid 1rpx; +} */ + +.box_ware_img image.data-v-3a5b7e36 { + /* width: 185rpx; + height: 190rpx; *//* background-color: rgba(138, 138, 138, 0.63); */ + border: 2rpx solid #999; + width: 120rpx; + height: 120rpx; + background-color: #f8f8f8; +} + +.box_ware_item.data-v-3a5b7e36 { + width: 70%; + margin-left: 25rpx; + position: relative; +} + +.box_ware_item_title.data-v-3a5b7e36 { + font-size: 24rpx; + word-break: break-all; + text-overflow: ellipsis; + display: -webkit-box; + -webkit-box-orient: vertical; + -webkit-line-clamp: 2; + overflow: hidden; +} + +.box_ware_count.data-v-3a5b7e36 { + display: -webkit-box; + display: -webkit-flex; + display: flex; +} + +.box_ware_item_price.data-v-3a5b7e36 { + font-size: 25rpx; + color: #b9b5b5; + position: absolute; + bottom: 60rpx; + left: 0; +} + +.box_ware_item_qty.data-v-3a5b7e36 { + font-size: 22rpx; + position: absolute; + bottom: 15rpx; + left: 0; +} + +.box_ware_code.data-v-3a5b7e36 { + position: absolute; + right: 10rpx; + bottom: 10rpx; +} + +.box_ware_code image.data-v-3a5b7e36 { + width: 50rpx; + height: 50rpx; +} + +.box_ware_code text.data-v-3a5b7e36 { + font-size: 20rpx; +} + +.foot_box.data-v-3a5b7e36 { + margin: 10rpx 20rpx 50rpx 20rpx; + padding: 35rpx; + background-color: #fff; + border-radius: 40rpx; +} + +.foot_box_title.data-v-3a5b7e36 { + font-size: 35rpx; + margin-bottom: 30rpx; +} + +.foot_box_remark.data-v-3a5b7e36 { + font-size: 27rpx; + line-height: 40rpx; +} + +.foot_empty.data-v-3a5b7e36 { + height: 90rpx; +} + +.foot_button.data-v-3a5b7e36 { + display: -webkit-box; + display: -webkit-flex; + display: flex; + margin: 20rpx 0rpx 0rpx 0rpx; + padding: 25rpx 0rpx; + background: #fff; + text-align: center; + -webkit-box-pack: center; + -webkit-justify-content: center; + justify-content: center; + position: fixed; + bottom: 0; + left: 0; + width: 100%; +} + +.foot_button_left.data-v-3a5b7e36 { + background: #e4010c; + color: #fff; + width: 250rpx; + height: 70rpx; + font-size: 28rpx; + line-height: 70rpx; + border-radius: 40rpx; + margin-right: 20rpx; +} + +.foot_button_right.data-v-3a5b7e36 { + background: #ffbb42; + color: #fff; + width: 250rpx; + height: 70rpx; + font-size: 28rpx; + line-height: 70rpx; + border-radius: 40rpx; +} + +.foot_button_buy.data-v-3a5b7e36 { + background: #e4010c; + color: #fff; + width: 400rpx; + height: 70rpx; + font-size: 28rpx; + line-height: 70rpx; + border-radius: 40rpx; +} + +.foot_button_intalge.data-v-3a5b7e36 { + background: #ffbb42; + color: #fff; + width: 400rpx; + height: 70rpx; + font-size: 28rpx; + line-height: 70rpx; + border-radius: 40rpx; +} + +page.data-v-3a5b7e36 { + background-color: #e85f93; +} + +.foot_box_remark.data-v-3a5b7e36 ._img { + width: 100%; +} + +.foot_box_remark.data-v-3a5b7e36 .img { + line-height: 0; +} +.overdue.data-v-3a5b7e36{ + background-color: rgb(153,153,153); +} + +.foot_button_intalge.data-v-3a5b7e36.gray{ background-color: #aaa; } + +.xc-share-frame { + position: absolute; right:0; top: -10rpx; +} + diff --git a/packageE/pages/togoin/togoin.js b/packageE/pages/togoin/togoin.js index f9999dd..ce5910b 100644 --- a/packageE/pages/togoin/togoin.js +++ b/packageE/pages/togoin/togoin.js @@ -134,6 +134,7 @@ Page({ app.promiseGet("/api/weshop/shoppingGuide/get/" + os.stoid + "/" + e.data.data.user_id, {}).then(res => { if (res.data.code == 0) { getApp().globalData.guide_id = res.data.data.id; + getApp().globalData.guide_pick_id= res.data.data.pickup_id } }) @@ -297,6 +298,7 @@ Page({ app.promiseGet("/api/weshop/shoppingGuide/get/" + os.stoid + "/" + e.data.data.user_id, {}).then(res => { if (res.data.code == 0) { getApp().globalData.guide_id = res.data.data.id; + getApp().globalData.guide_pick_id= res.data.data.pickup_id } }) @@ -367,6 +369,7 @@ Page({ app.promiseGet("/api/weshop/shoppingGuide/get/" + os.stoid + "/" + e.data.data.user_id, {}).then(res => { if (res.data.code == 0) { getApp().globalData.guide_id = res.data.data.id; + getApp().globalData.guide_pick_id= res.data.data.pickup_id } }) diff --git a/pages/activity/pind_list/pind_list.js b/pages/activity/pind_list/pind_list.js index 569d88f..257f307 100644 --- a/pages/activity/pind_list/pind_list.js +++ b/pages/activity/pind_list/pind_list.js @@ -50,6 +50,7 @@ Page({ getApp().request.promiseGet("/api/weshop/shoppingGuide/get/" + os.stoid + "/" + first_leader, {}).then(res => { if (res.data.code == 0) { getApp().globalData.guide_id = res.data.data.id; + getApp().globalData.guide_pick_id= res.data.data.pickup_id } }) } diff --git a/pages/activity/seckill_list/seckill_list.js b/pages/activity/seckill_list/seckill_list.js index 155c310..fecefef 100644 --- a/pages/activity/seckill_list/seckill_list.js +++ b/pages/activity/seckill_list/seckill_list.js @@ -58,6 +58,7 @@ Page({ getApp().request.promiseGet("/api/weshop/shoppingGuide/get/" + os.stoid + "/" + first_leader, {}).then(res => { if (res.data.code == 0) { getApp().globalData.guide_id = res.data.data.id; + getApp().globalData.guide_pick_id= res.data.data.pickup_id } }) } @@ -249,7 +250,7 @@ Page({ //---------分享配置-------- onShareAppMessage: function (e) { - getApp().globalData.no_clear=1; + getApp().globalData.no_clear=1; var curPage = this; var pagePath = curPage.route; //当前页面url if (pagePath.indexOf('/') != 0) { diff --git a/pages/cart/cart2_inte/cart2_inte.js b/pages/cart/cart2_inte/cart2_inte.js index cb1b64e..93d1637 100644 --- a/pages/cart/cart2_inte/cart2_inte.js +++ b/pages/cart/cart2_inte/cart2_inte.js @@ -245,7 +245,7 @@ Page({ // let cartList= this.data.cartlist // let cartList= arr // let length = cartList.length - if(this.data.is_pre_cut==0){ + if(!this.data.is_pre_cut){ return {} } wx.showLoading({ diff --git a/pages/cart/cart2_pt/cart2_pt.js b/pages/cart/cart2_pt/cart2_pt.js index e517ac3..f3e596c 100644 --- a/pages/cart/cart2_pt/cart2_pt.js +++ b/pages/cart/cart2_pt/cart2_pt.js @@ -198,7 +198,7 @@ Page({ // let cartList= this.data.cartlist // let cartList= arr // let length = cartList.length - if(this.data.is_pre_cut==0){ + if(!this.data.is_pre_cut){ return {} } wx.showLoading({ diff --git a/pages/giftpack/buygiftpack/giftpackbuy.js b/pages/giftpack/buygiftpack/giftpackbuy.js index 040bc72..ae13af1 100644 --- a/pages/giftpack/buygiftpack/giftpackbuy.js +++ b/pages/giftpack/buygiftpack/giftpackbuy.js @@ -64,7 +64,9 @@ Page({ default_store: {}, //创建添加默认门店地址的对象 store:0, - openSpecModal:0 + openSpecModal:0, + + is_get_guide:0, }, onLoad: function (options) { @@ -96,6 +98,8 @@ Page({ //-- 获取分享人的ID -- var first_leader = options.first_leader || getApp().globalData.first_leader; if (first_leader) { + + this.data.is_get_guide=1; this.setData({ first_leader, }) @@ -104,10 +108,16 @@ Page({ //调用接口判断是不是会员 getApp().request.promiseGet("/api/weshop/shoppingGuide/get/" + os.stoid + "/" + first_leader, {}).then(res => { if (res.data.code == 0) { - getApp().globalData.guide_id = res.data.data.id; + getApp().globalData.guide_id = res.data.data.id; + getApp().globalData.guide_pick_id= res.data.data.pickup_id } + + com.wait_for_store_config(th); + com.set_user_mo_store(th,os); + }) } + getApp().request.promiseGet("/api/weshop/ad/page?pid=902&store_id=" + os.stoid, { data: { enabled: 1 @@ -138,8 +148,12 @@ Page({ getApp().goto('/packageE/pages/togoin/togoin'); return false; } - com.wait_for_store_config(th); - com.set_user_mo_store(th,os); + + if(!th.data.is_get_guide) { + com.wait_for_store_config(th); + com.set_user_mo_store(th, os); + } + th.data.is_get_guide=0; }) this.init(); @@ -368,6 +382,15 @@ Page({ }, // 选择门店 choice_store: function (ee) { + //--先判断会员状态-- + var user_info = getApp().globalData.userInfo; + if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) { + wx.navigateTo({ + url: '/packageE/pages/togoin/togoin', + }) + return false; + } + var th = this; var ind = ee.currentTarget.dataset.ind; var bconfig = th.data.bconfig; diff --git a/pages/giftpack/giftpacklist/giftpacklist.js b/pages/giftpack/giftpacklist/giftpacklist.js index 53ac4f3..4338b56 100644 --- a/pages/giftpack/giftpacklist/giftpacklist.js +++ b/pages/giftpack/giftpacklist/giftpacklist.js @@ -144,6 +144,7 @@ Page({ getApp().request.promiseGet("/api/weshop/shoppingGuide/get/" + os.stoid + "/" + first_leader, {}).then(res => { if (res.data.code == 0) { getApp().globalData.guide_id = res.data.data.id; + getApp().globalData.guide_pick_id= res.data.data.pickup_id } }) } @@ -338,6 +339,31 @@ Page({ }); }, + + check_guide(func){ + var first_leader=this.data.first_leader; + if(!first_leader){ + func(); + return false; + } + if(this.data.is_geted_guide_pick){ + func(); + return false; + } + if(getApp().globalData.guide_pick_id){ + func(); + return false; + } + var th=this; + getApp().request.promiseGet("/api/weshop/shoppingGuide/get/" + os.stoid + "/" + first_leader, {}).then(res => { + if (res.data.code == 0) { + getApp().globalData.guide_pick_id= res.data.data.pickup_id; + } + th.data.is_geted_guide_pick=1; + func(); + }) + }, + GetBuyGiftList: function () { var _this2 = this; var th = this.data; @@ -393,14 +419,16 @@ Page({ //需不需要门店,不需要门店返回 if (!sele_g.is_pickup) return false; - com.wait_for_store_config(_this2); - com.set_user_mo_store(_this2, os, function () { - if (sele_g.pickup_list && _this2.data.def_pick_store) { - com.check_def_pk(_this2); - } - }); - com.get_sto(_this2, os); - + //-- 检测一下有没有门店 -- + _this2.check_guide(function (){ + com.wait_for_store_config(_this2); + com.set_user_mo_store(_this2, os, function () { + if (sele_g.pickup_list && _this2.data.def_pick_store) { + com.check_def_pk(_this2); + } + }); + com.get_sto(_this2, os); + }) } else { getApp().my_warnning(res.data.msg, 0, _this2); @@ -653,6 +681,16 @@ Page({ }, // 选择门店 choice_store: function (ee) { + + //--先判断会员状态-- + var user_info = getApp().globalData.userInfo; + if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) { + wx.navigateTo({ + url: '/packageE/pages/togoin/togoin', + }) + return false; + } + var th = this; var ind = ee.currentTarget.dataset.ind; var bconfig = th.data.bconfig; diff --git a/pages/giftpack/mygiftpack/mygiftpack.js b/pages/giftpack/mygiftpack/mygiftpack.js index 1b080ea..3ff1ea1 100644 --- a/pages/giftpack/mygiftpack/mygiftpack.js +++ b/pages/giftpack/mygiftpack/mygiftpack.js @@ -55,6 +55,7 @@ Page({ getApp().request.promiseGet("/api/weshop/shoppingGuide/get/" + os.stoid + "/" + first_leader, {}).then(res => { if (res.data.code == 0) { getApp().globalData.guide_id = res.data.data.id; + getApp().globalData.guide_pick_id= res.data.data.pickup_id } }) } diff --git a/pages/goods/goodsInfo/goodsInfo.js b/pages/goods/goodsInfo/goodsInfo.js index 0f144a8..4769427 100644 --- a/pages/goods/goodsInfo/goodsInfo.js +++ b/pages/goods/goodsInfo/goodsInfo.js @@ -382,11 +382,14 @@ Page({ if (first_leader) { console.log("gd onload--3"); console.log("log---" + first_leader); + getApp().globalData.first_leader = first_leader; //调用接口判断是不是会员 getApp().request.promiseGet("/api/weshop/shoppingGuide/get/" + os.stoid + "/" + first_leader, {}).then(res => { if (res.data.code == 0) { getApp().globalData.guide_id = res.data.data.id; + getApp().globalData.guide_pick_id= res.data.data.pickup_id; + } }) @@ -497,74 +500,6 @@ Page({ } }); - //获取用户的默认门店 - getApp().get_user_store(function (e) { - if (!e) { - th.data.fir_def_store = {}; //赋值空对象 - return false; - } - if (getApp().globalData.is_dj_pk) th.setData({ - has_def: 1 - }); - - var ee = JSON.parse(JSON.stringify(e)); - //--定时器推迟一下-- - setTimeout(function () { - if (th.data.fir_goods) var g_distr_type = th.data.fir_goods.distr_type; - //--如果默认门店的配送方式不对,就不能被选择,这里不控制,如果不一样,就说明配送方式不对-- - if (ee.distr_type != 0 && g_distr_type != 0 && ee.distr_type != g_distr_type) { - ee.is_no_dis = 1; - } - - var appd = getApp().globalData; - var w_time = setInterval(function () { - if (that.data.is_get_local_ok == 0) return false; - clearInterval(w_time); - var distance = null; - var e = JSON.parse(JSON.stringify(ee)); - - //如果有开启近距离的话,同时距离优不一样了 - if (that.data.lat != null) { - //如果经纬度有变化的话 - if (e && appd.lat == that.data.lat && appd.lon == that.data.lon && e.distance > 0) { - that.set_def_storage(e); - } else { - //要用接口是获取距离,js的计算不准 - getApp().request.promiseGet("/api/weshop/pickup/list", { - data: { - store_id: os.stoid, - pickup_id: e.pickup_id, - lat: th.data.lat, - lon: th.data.lon, - isstop: 0, - is_pos: 1 - }, - }).then(res => { - if (res.data.code == 0) { - e = res.data.data.pageData[0]; - if (e) { - e.is_no_dis = ee.is_no_dis; - appd.pk_store = e; - that.set_def_storage(e); - } - - } - }) - } - //e.distance = distance; - appd.lat = that.data.lat; - appd.lon = that.data.lon; - - } else { - if (e) { - e.distance = null; - that.set_def_storage(e); - } - } - }, 500) - }, 700) - }); - //更新点击量 //noinspection JSUnresolvedFunction getApp().request.put("/api/weshop/goods/updateClick", { @@ -605,6 +540,7 @@ Page({ await getApp().request.promiseGet("/api/weshop/shoppingGuide/get/" + os.stoid + "/" + first_leader, {}).then(res => { if (res.data.code == 0) { getApp().globalData.guide_id = res.data.data.id; + getApp().globalData.guide_pick_id= res.data.data.pickup_id } }) @@ -862,6 +798,102 @@ Page({ }, + check_guide(func){ + var first_leader=getApp().globalData.first_leader; + if(!first_leader){ + func(); + return false; + } + if(this.data.is_geted_guide_pick){ + func(); + return false; + } + + if(getApp().globalData.guide_pick_id){ + func(); + return false; + } + var th=this; + getApp().request.promiseGet("/api/weshop/shoppingGuide/get/" + os.stoid + "/" + first_leader, {}).then(res => { + if (res.data.code == 0) { + getApp().globalData.guide_pick_id= res.data.data.pickup_id; + } + th.data.is_geted_guide_pick=1; + func(); + }) + }, + + get_user_store(){ + var th=this; var that=this; + //--获取用户的默认门店 + getApp().get_user_store(function (e) { + if (!e) { + th.data.fir_def_store = {}; //赋值空对象 + return false; + } + if (getApp().globalData.is_dj_pk) th.setData({ + has_def: 1 + }); + + var ee = JSON.parse(JSON.stringify(e)); + //--定时器推迟一下-- + setTimeout(function () { + if (th.data.fir_goods) var g_distr_type = th.data.fir_goods.distr_type; + //--如果默认门店的配送方式不对,就不能被选择,这里不控制,如果不一样,就说明配送方式不对-- + if (ee.distr_type != 0 && g_distr_type != 0 && ee.distr_type != g_distr_type) { + ee.is_no_dis = 1; + } + + var appd = getApp().globalData; + var w_time = setInterval(function () { + if (that.data.is_get_local_ok == 0) return false; + clearInterval(w_time); + var distance = null; + var e = JSON.parse(JSON.stringify(ee)); + + //如果有开启近距离的话,同时距离优不一样了 + if (that.data.lat != null) { + //如果经纬度有变化的话 + if (e && appd.lat == that.data.lat && appd.lon == that.data.lon && e.distance > 0) { + that.set_def_storage(e); + } else { + //要用接口是获取距离,js的计算不准 + getApp().request.promiseGet("/api/weshop/pickup/list", { + data: { + store_id: os.stoid, + pickup_id: e.pickup_id, + lat: th.data.lat, + lon: th.data.lon, + isstop: 0, + is_pos: 1 + }, + }).then(res => { + if (res.data.code == 0) { + e = res.data.data.pageData[0]; + if (e) { + e.is_no_dis = ee.is_no_dis; + appd.pk_store = e; + that.set_def_storage(e); + } + + } + }) + } + //e.distance = distance; + appd.lat = that.data.lat; + appd.lon = that.data.lon; + + } else { + if (e) { + e.distance = null; + that.set_def_storage(e); + } + } + }, 500) + }, 700) + }); + }, + //---展示--- onShow: function () { @@ -881,6 +913,11 @@ Page({ return false; } + //先获取一下导购的门店 + th.check_guide(()=>{ + th.get_user_store(); + }) + //优惠券要实时更新 getApp().getConfig2(function (e) { var json_d = JSON.parse(e.switch_list); @@ -1159,6 +1196,9 @@ Page({ + + + }, onReady() { @@ -2151,7 +2191,7 @@ Page({ } - if (th.data.prom_goods) { + if (th.data.prom_goods && newd.prom_type!=4 && newd.prom_type!=6 ) { var prom_d = th.data.prom_goods; for (var i in prom_d) { //判断活动有俩种条件,0元 1件 @@ -2172,7 +2212,6 @@ Page({ } } } - //如果有阶梯促销的时候 if(th.data.jieti_prom && (newd.prom_type==10 || newd.prom_type==0) ){ newd.prom_type = 10; @@ -6612,6 +6651,15 @@ Page({ var ind = ee.currentTarget.dataset.ind; var bconfig = th.data.bconfig; + //--先判断会员状态-- + var user_info = getApp().globalData.userInfo; + if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) { + wx.navigateTo({ + url: '/packageE/pages/togoin/togoin', + }) + return false; + } + //如果开启了,则不在选择门店 if (this.data.sys_switch.is_pricing_open_store && getApp().globalData.pk_store) { diff --git a/pages/goods/goodsList/goodsList.js b/pages/goods/goodsList/goodsList.js index dc63abb..dbe1a0e 100644 --- a/pages/goods/goodsList/goodsList.js +++ b/pages/goods/goodsList/goodsList.js @@ -55,6 +55,7 @@ Page({ getApp().request.promiseGet("/api/weshop/shoppingGuide/get/"+oo.stoid+"/"+first_leader,{}).then(res=>{ if(res.data.code==0){ getApp().globalData.guide_id=res.data.data.id; + getApp().globalData.guide_pick_id= res.data.data.pickup_id } }) if(!getApp().globalData.user_id){ diff --git a/pages/goods/search/search.js b/pages/goods/search/search.js index 1cac2a1..4edb05c 100644 --- a/pages/goods/search/search.js +++ b/pages/goods/search/search.js @@ -80,6 +80,7 @@ Page({ getApp().request.promiseGet("/api/weshop/shoppingGuide/get/" + oo.stoid + "/" + first_leader, {}).then(res => { if (res.data.code == 0) { getApp().globalData.guide_id = res.data.data.id; + getApp().globalData.guide_pick_id= res.data.data.pickup_id } }) } diff --git a/pages/index/index/index.js b/pages/index/index/index.js index 1cc2631..80be721 100644 --- a/pages/index/index/index.js +++ b/pages/index/index/index.js @@ -196,6 +196,7 @@ Page({ getApp().request.promiseGet("/api/weshop/shoppingGuide/get/" + os.stoid + "/" + first_leader, {}).then(res => { if (res.data.code == 0) { getApp().globalData.guide_id = res.data.data.id; + getApp().globalData.guide_pick_id= res.data.data.pickup_id } }) @@ -269,18 +270,17 @@ Page({ }).then(res => { if (ut.ajax_ok(res)) { first_leader=res.data.data.pageData[0].user_id; - getApp().globalData.guide_id = res.data.data.id; + // getApp().globalData.guide_id = res.data.data.id; } }) - if(!first_leader) return false; getApp().globalData.first_leader = first_leader; - //调用接口判断是不是会员 await getApp().request.promiseGet("/api/weshop/shoppingGuide/get/" + os.stoid + "/" + first_leader, {}).then(res => { if (res.data.code == 0) { getApp().globalData.guide_id = res.data.data.id; + getApp().globalData.guide_pick_id= res.data.data.pickup_id } }) diff --git a/pages/team/team_show/team_show.js b/pages/team/team_show/team_show.js index e817ea0..52d85ec 100644 --- a/pages/team/team_show/team_show.js +++ b/pages/team/team_show/team_show.js @@ -126,6 +126,7 @@ Page({ getApp().request.promiseGet("/api/weshop/shoppingGuide/get/"+os.stoid+"/"+first_leader,{}).then(res=>{ if(res.data.code==0){ getApp().globalData.guide_id=res.data.data.id; + getApp().globalData.guide_pick_id= res.data.data.pickup_id } }) } @@ -607,7 +608,7 @@ Page({ }); //-- 获取用户的默认门店 -- - getApp().get_user_store(function(ee) { + getApp().get_user_store(function(ee) { if(!ee) { th.data.fir_def_store={}; //赋值空对象 return false; @@ -624,14 +625,14 @@ Page({ //return false; ee.is_no_dis=1; } - + var appd=getApp().globalData; var w_time = setInterval(function() { if (that.data.is_get_local_ok == 0) return false; clearInterval(w_time); var distance = null; var e=JSON.parse(JSON.stringify(ee)); - + //如果有开启近距离的话,同时距离优不一样了 if (that.data.lat != null) { //如果经纬度有变化的话 @@ -660,15 +661,15 @@ Page({ sto_sele_distr: e.distr_type }) } - + } }) } - + //e.distance = distance; appd.lat=that.data.lat; appd.lon=that.data.lon; - + }else{ if (e) { e.distance = null; @@ -681,11 +682,11 @@ Page({ }) } } - + }, 500) - },1000) + },1000) }); - + //获取下redis长度,如果团已经弄完,或者拼单已经卖完 //设置值 ee.setData({ @@ -1008,6 +1009,15 @@ Page({ //-- 选择门店。此时的门店选择与门店有关系 -- choice_store: function(ee) { + + //--先判断会员状态-- + var user_info = getApp().globalData.userInfo; + if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) { + wx.navigateTo({ + url: '/packageE/pages/togoin/togoin', + }) + return false; + } var th = this; var bconfig = th.data.bconfig; diff --git a/pages/template/index.js b/pages/template/index.js index 11800b3..dc190c7 100644 --- a/pages/template/index.js +++ b/pages/template/index.js @@ -30,6 +30,7 @@ Page({ getApp().request.promiseGet("/api/weshop/shoppingGuide/get/" + os.stoid + "/" + first_leader, {}).then(res => { if (res.data.code == 0) { getApp().globalData.guide_id = res.data.data.id; + getApp().globalData.guide_pick_id= res.data.data.pickup_id } }) } diff --git a/pages/user/index/index.js b/pages/user/index/index.js index 1603aff..2cd8406 100644 --- a/pages/user/index/index.js +++ b/pages/user/index/index.js @@ -95,6 +95,7 @@ Page({ getApp().request.promiseGet("/api/weshop/shoppingGuide/get/" + os.stoid + "/" + first_leader, {}).then(res => { if (res.data.code == 0) { getApp().globalData.guide_id = res.data.data.id; + getApp().globalData.guide_pick_id= res.data.data.pickup_id } }) @@ -561,6 +562,7 @@ Page({ getApp().globalData.no_clear = 1; var url = "/pages/user/index/index"; + var userInfo = getApp().globalData.userInfo; if (userInfo) { url += "?first_leader=" + getApp().globalData.user_id; } diff --git a/pages/user/order_detail/order_detail.js b/pages/user/order_detail/order_detail.js index 5e36889..faab3ae 100644 --- a/pages/user/order_detail/order_detail.js +++ b/pages/user/order_detail/order_detail.js @@ -1607,7 +1607,7 @@ Page({ }).then(res=>{ //-------如果购物车中有相关的数据------- if (res.data.data.total > 0) { - b_cart_goods= res.data.data.pageData[0]; + b_cart_goods= res.data.data.pageData; } }) @@ -1617,14 +1617,14 @@ Page({ if(b_cart_goods) { for (let jr = 0; jr < b_cart_goods.length; jr++) { var b_cart_item = b_cart_goods[jr]; - if (g_item.prom_type == 0) { + if (!g_item.prom_type || g_item.prom_type == 0) { if ([0, 3, 5, 7, 10].indexOf(b_cart_item.prom_type) > -1) { - is_has = b_cart_item.id; + is_has = b_cart_item; break } } else { if (b_cart_goods.prom_type == g_item.prom_type && b_cart_goods.prom_id == g_item.prom_id) { - is_has = b_cart_item.id; + is_has = b_cart_item; break } } @@ -1635,8 +1635,8 @@ Page({ //-- 如果就加入过购物车 -- if(is_has){ var updata = { - id: is_has, - goods_num: newd.goods_num + b_cart_goods.goods_num, + id: is_has.id, + goods_num: newd.goods_num + is_has.goods_num, goods_price: newd.goods_price, member_goods_price:newd.goods_price, store_id: os.stoid, diff --git a/pages/user/order_list/order_list.js b/pages/user/order_list/order_list.js index 4bfd4a8..4074f90 100644 --- a/pages/user/order_list/order_list.js +++ b/pages/user/order_list/order_list.js @@ -1977,7 +1977,7 @@ Page({ var b_cart_item = b_cart_goods[jr]; - if (g_item.prom_type == 0) { + if (!g_item.prom_type || g_item.prom_type == 0) { if ([0, 3, 5, 7, 10].indexOf(b_cart_item.prom_type) > -1) { is_has = b_cart_item; break diff --git a/pages/user/plus/plus.js b/pages/user/plus/plus.js index 455fce3..7a11fcc 100644 --- a/pages/user/plus/plus.js +++ b/pages/user/plus/plus.js @@ -81,6 +81,7 @@ Page({ getApp().request.promiseGet("/api/weshop/shoppingGuide/get/" + os.stoid + "/" + fir_leader, {}).then(res => { if (res.data.code == 0) { getApp().globalData.guide_id = res.data.data.id; + getApp().globalData.guide_pick_id= res.data.data.pickup_id } }) }