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/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/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 24dcd80..71315f5 100644 --- a/packageA/pages/prom_list/prom_list.js +++ b/packageA/pages/prom_list/prom_list.js @@ -59,6 +59,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 } }) } @@ -85,91 +86,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); @@ -1403,6 +1441,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..4406fb6 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 43c6bbf..dfddd3e 100644 --- a/packageC/pages/group_list/group_list.js +++ b/packageC/pages/group_list/group_list.js @@ -26,7 +26,19 @@ Page({ * 生命周期函数--监听页面加载 */ onLoad: function (options) { - self = this; + self = this; + 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({ @@ -153,7 +165,29 @@ Page({ /** * 用户点击右上角分享 */ - onShareAppMessage: function () { getApp().globalData.no_clear=1; }, + onShareAppMessage: function () { + getApp().globalData.no_clear=1; + var curPage = this; + var pagePath = curPage.route; //当前页面url + if (pagePath.indexOf('/') != 0) { + pagePath = '/' + pagePath; + } + if (getApp().globalData.user_id) { + + if (pagePath.indexOf("?") > 0) { + pagePath += "&first_leader=" + getApp().globalData.user_id; + } else { + pagePath += "?first_leader=" + getApp().globalData.user_id; + } + } + + console.log("11" + pagePath); + return { + title: "团购", + path: pagePath, + } + + }, /** diff --git a/packageC/pages/luckyGo/luckyGo_activityList/luckyGo_activityList.js b/packageC/pages/luckyGo/luckyGo_activityList/luckyGo_activityList.js index 9940f77..2f68ba8 100644 --- a/packageC/pages/luckyGo/luckyGo_activityList/luckyGo_activityList.js +++ b/packageC/pages/luckyGo/luckyGo_activityList/luckyGo_activityList.js @@ -20,11 +20,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_goodsInfo/luckyGo_goodsInfo.js b/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.js index 5bb7765..5752f27 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, }, //------初始化加载---------- @@ -305,6 +306,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; @@ -393,6 +396,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 } }) } @@ -404,6 +408,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; @@ -502,64 +510,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 @@ -581,6 +532,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) { @@ -801,15 +785,6 @@ Page({ }) - - - - - - - - - ee.setData({ gallery: gallery, is_collect: is_collect, @@ -823,10 +798,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 @@ -835,6 +899,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', { @@ -5464,6 +5538,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; @@ -6173,6 +6257,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/goodsInfo/goodsInfo.js b/packageC/pages/presell/goodsInfo/goodsInfo.js index 43408be..e6095db 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); @@ -327,6 +330,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 +342,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; @@ -438,6 +447,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; @@ -622,6 +663,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(); @@ -702,68 +769,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'); @@ -3554,6 +3623,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 3408844..396f2dd 100644 --- a/packageC/pages/presell/list/list.js +++ b/packageC/pages/presell/list/list.js @@ -27,6 +27,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/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 ec3b10d..00c254f 100644 --- a/pages/activity/pind_list/pind_list.js +++ b/pages/activity/pind_list/pind_list.js @@ -46,6 +46,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 8ad5dbe..1b8aee2 100644 --- a/pages/activity/seckill_list/seckill_list.js +++ b/pages/activity/seckill_list/seckill_list.js @@ -54,6 +54,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 } }) } @@ -245,7 +246,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/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 037aa8c..b985348 100644 --- a/pages/goods/goodsInfo/goodsInfo.js +++ b/pages/goods/goodsInfo/goodsInfo.js @@ -377,11 +377,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; + } }) @@ -492,74 +495,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", { @@ -600,6 +535,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 } }) @@ -857,6 +793,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 () { @@ -876,6 +908,11 @@ Page({ return false; } + //先获取一下导购的门店 + th.check_guide(()=>{ + th.get_user_store(); + }) + //优惠券要实时更新 getApp().getConfig2(function (e) { var json_d = JSON.parse(e.switch_list); @@ -1154,6 +1191,9 @@ Page({ + + + }, onReady() { @@ -6602,6 +6642,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 1bfc900..711a5aa 100644 --- a/pages/goods/search/search.js +++ b/pages/goods/search/search.js @@ -77,6 +77,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 3efaf61..70006f2 100644 --- a/pages/index/index/index.js +++ b/pages/index/index/index.js @@ -190,6 +190,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 } }) @@ -263,18 +264,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..b7027c5 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 } }) 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 } }) }