diff --git a/app.js b/app.js index 95a978e..a6a3d6b 100644 --- a/app.js +++ b/app.js @@ -101,6 +101,29 @@ App({ }, }) + var th=this; + var pages = getCurrentPages(); //获取加载的页面 + var currentPage = pages[pages.length - 1]; //获取当前页面的对象 + if(!currentPage || currentPage.route.indexOf('error/error')==-1){ + var tt=this.globalData.wxapp_buy_obj; + if (!tt){ + this.get_isbuy(function (){ + tt=th.globalData.wxapp_buy_obj; + if (tt.isout == 1){ + th.promiseGet('/api/weshop/store/get/'+t.stoid,{}).then(res=>{ + wx.reLaunch({ + url: "/pages/error/error?msg=该商城已到期,暂停浏览!\r\n可联系:"+res.data.data.store_tel, + }); + }) + } + else if (tt.isbuy == 0) + wx.reLaunch({ + url: "/pages/error/error?msg=还未购买小程序", + }); + }) + } + } + }, //---初始化第三方---- @@ -287,9 +310,11 @@ App({ }, //同步化,在调用的时候要await - async get_isbuy() { - var th=this; - await api.check_isbuy({ store_id: t.stoid, type: 5 }).then(res=>{ + async get_isbuy(func) { + var th=this + var stoid=os.stoid; + + await this.promiseGet("/store/storemoduleendtime/page?store_id=" +stoid + "&type=5",{}).then(res=>{ var o=res; if (o.data.code == 0) { var ob = { isout: 0, isbuy: 1 }; @@ -308,6 +333,9 @@ App({ } ob.isbuy = isbuy; th.globalData.wxapp_buy_obj=ob; + if(func){ + func(); + } } }) }, @@ -384,44 +412,61 @@ App({ } //---如果会员没有设置默认门店,同时也没有再注册的时候选择门店-- if(pick_id==0) return func(null); - //获取用户注册时候的门店,这个门店不能关闭,同时这个门店的分类不能关闭 - th.request.get("/api/weshop/pickup/get/"+os.stoid+"/"+pick_id,{ - data:{}, - success:function (res) { - th.globalData.pk_store=null; - if(res.data.code==0 && res.data.data && res.data.data.isstop==0){ - if(res.data.data.category_id){ - th.request.get( "/api/weshop/storagecategory/get/"+os.stoid+"/"+res.data.data.category_id, { - data: {}, - success: function (ee) { - if(ee.data.code==0 && ee.data.data ){ - if(ee.data.data.is_show==1){ - th.globalData.pk_store = res.data.data; - func(th.globalData.pk_store); - }else{ - func(null); - } - }else{ - func(null); - } - } - }) - }else{ - th.globalData.pk_store = res.data.data; - func(th.globalData.pk_store); - } - }else{ - func(null); - } - } - }) + + //返回门店的数量 + th.get_pk_num(function(num){ + //获取用户注册时候的门店,这个门店不能关闭,同时这个门店的分类不能关闭 + th.request.get("/api/weshop/pickup/get/"+os.stoid+"/"+pick_id,{ + data:{}, + success:function (res) { + th.globalData.pk_store=null; + if(res.data.code==0 && res.data.data && res.data.data.isstop==0){ + //--门店的数量大于5个才要关心门店的分类有没有关闭-- + if(res.data.data.category_id && num>5){ + th.request.get( "/api/weshop/storagecategory/get/"+os.stoid+"/"+res.data.data.category_id, { + data: {}, + success: function (ee) { + if(ee.data.code==0 && ee.data.data ){ + if(ee.data.data.is_show==1){ + th.globalData.pk_store = res.data.data; + func(th.globalData.pk_store); + }else{ + func(null); + } + }else{ + func(null); + } + } + }) + }else{ + th.globalData.pk_store = res.data.data; + func(th.globalData.pk_store); + } + }else{ + func(null); + } + } + }) + + }) + }else{ func(th.globalData.pk_store); } }) - }, - + + //-- 获取门店的数量 -- + get_pk_num:function(func){ + this.request.get("/api/weshop/pickup/page",{ + data:{page:1,pageSize:1,isstop:0,store_id:os.stoid}, + success:function (res) { + if(res.data.code==0){ + func(res.data.data.total); //门店数量 + } + } + }); + }, //-------获取购物车数量---------- requestCardNum: function(th) { if(!this.globalData.user_id) return false; @@ -538,7 +583,28 @@ App({ } return index; - } + }, + + //---promise的使用get---- + promiseGet:function(url,data){ + if(url.indexOf("http")==-1) url=this.globalData.setting.url +url; + return new Promise((resolve, reject) => { + data.isShowLoading && wx.showLoading(); + wx.request({ + url, + method: 'GET', + header: {"content-type": "application/x-www-form-urlencoded" }, + data:data.data, + success(res) { + data.isShowLoading && wx.hideLoading(); + resolve(res); + }, + fail(err) { data.isShowLoading && wx.hideLoading(); reject(err); } + }) + }) + }, + + }); diff --git a/packageA/pages/activity_share/activity_share.js b/packageA/pages/activity_share/activity_share.js index fe8437d..b817b78 100644 --- a/packageA/pages/activity_share/activity_share.js +++ b/packageA/pages/activity_share/activity_share.js @@ -159,7 +159,7 @@ Page({ imageUrl: img, }; th.setData({share_hidden:1}); - th.insert_act_share(title,lbid,6); + th.insert_act_share(title,lbid,6,null,th.data.hui_active.payMoney); return ob; }else{ //---秒杀,拼团,促销--- @@ -193,9 +193,9 @@ Page({ //插入活动 if(item.prom_type==3){ var hui_active=this.data.hui_active; - th.insert_act_share(hui_active.name,hui_active.id,5); + th.insert_act_share(hui_active.name,hui_active.id,5,item.goods_sn,price); }else{ - th.insert_act_share(item.title,item.id,ind); + th.insert_act_share(item.title,item.id,ind,item.goods_sn,price); } return ob; @@ -220,7 +220,7 @@ Page({ if(th.data.currentIndex==2){ ind=5;} //插入活动 - th.insert_act_share(title,hui_active.id,ind); + th.insert_act_share(title,hui_active.id,ind,null,null); return ob; } } @@ -546,14 +546,17 @@ Page({ if(that.data.currentIndex==1){ ind=4; } - + + //-- 价格 -- + var pri0 = th.data.share_good.shop_price; + if (th.data.share_good.price) + pri0 = th.data.share_good.price; if(th.data.share_good.prom_type==3){ - th.insert_act_share(th.data.hui_active.name,th.data.hui_active.id,5); //插入分享 + th.insert_act_share(th.data.hui_active.name,th.data.hui_active.id,5,th.data.share_good.goods_sn,pri0); //插入分享 }else{ - th.insert_act_share(th.data.share_good.title,th.data.share_good.id,ind); //插入分享 + th.insert_act_share(th.data.share_good.title,th.data.share_good.id,ind,th.data.share_good.goods_sn,pri0); //插入分享 } - - + ///二微码 var path3 = os.url + "/api/wx/open/app/user/getWeAppEwm/" + os.stoid + "?sceneValue=" + scene + "&pageValue=pages/goods/goodsInfo/goodsInfo"; @@ -624,9 +627,7 @@ Page({ context.setFillStyle("red") context.fillText("¥", 416 * unit, 185 * unit); context.setFontSize(31 * unit) - var pri0 = th.data.share_good.shop_price; - if (th.data.share_good.price) - pri0 = th.data.share_good.price; + pri0 = parseFloat(pri0).toFixed(2); context.fillText(pri0, 438 * unit, 185 * unit); @@ -1136,7 +1137,7 @@ Page({ }, //-- 推送活动分享 -- - insert_act_share:function(title,actid,ind){ + insert_act_share:function(title,actid,ind,ShareActNo,ActMoney){ var th = this; var url="/api/weshop/sharetypeList/save"; var req_data={ @@ -1149,6 +1150,11 @@ Page({ shareTime:ut.gettimestamp(), storeId:os.stoid } + + if(!ShareActNo) ShareActNo=actid; //如果没有带编号就带活动id + if(ActMoney) req_data.ActMoney=ActMoney; //如果金额就要把参数带入 + req_data.ShareActNo=ShareActNo; + //插入数据 getApp().request.post(url,{ data:req_data, @@ -1164,8 +1170,8 @@ Page({ data:req_data, success:function(){} }) - - + + } diff --git a/packageA/pages/live_share/live_share.js b/packageA/pages/live_share/live_share.js index 7d3f742..8e15cf0 100644 --- a/packageA/pages/live_share/live_share.js +++ b/packageA/pages/live_share/live_share.js @@ -207,7 +207,8 @@ Page({ shareStaffId:th.data.StaffId, shareStorageId:th.data.StorageId, shareTime:ut.gettimestamp(), - storeId:os.stoid + storeId:os.stoid, + ShareActNo:actid } //插入数据 getApp().request.post(url,{ diff --git a/packageA/pages/quan/quan.js b/packageA/pages/quan/quan.js index 58460a6..8e36521 100644 --- a/packageA/pages/quan/quan.js +++ b/packageA/pages/quan/quan.js @@ -87,7 +87,7 @@ Page({ path:url, }; th.setData({share_hidden:1}); - th.insert_quan_share(title,th.data.hui_active.id); + th.insert_quan_share(title,th.data.hui_active.id,th.data.hui_active.money); return ob; }, @@ -179,7 +179,7 @@ Page({ }, //-- 推送活动分享 -- - insert_quan_share:function(title,actid){ + insert_quan_share:function(title,actid,price){ var th = this; var url="/api/weshop/sharetypeList/save"; var req_data={ @@ -190,8 +190,11 @@ Page({ shareStaffId:th.data.StaffId, shareStorageId:th.data.StorageId, shareTime:ut.gettimestamp(), - storeId:os.stoid + storeId:os.stoid, + ShareActNo:actid, + ActMoney:price } + //插入数据 getApp().request.post(url,{ data:req_data, diff --git a/pages/error/error.js b/pages/error/error.js new file mode 100644 index 0000000..5f0b0b5 --- /dev/null +++ b/pages/error/error.js @@ -0,0 +1,31 @@ +var t = require("../../utils/common.js");var os=getApp().globalData.setting; +Page({ + data:{ + store:null, + imghots: os.imghost, + msg:"", + }, + + onLoad:function(t){ + var th=this,app = getApp(); + app.getConfig(function(e){ + th.setData({ store:e,msg:t.msg}); + wx.setNavigationBarTitle({ + title: e.store_name//页面标题 + }) + }) + }, + + phone:function (){ + if(this.data.msg.indexOf("可联系:")!=-1){ + var tel=this.data.msg.split("可联系:")[1]; + if(tel){ + wx.makePhoneCall({ + phoneNumber: tel, + }) + } + } + } + + +}); diff --git a/pages/error/error.json b/pages/error/error.json new file mode 100644 index 0000000..9e26dfe --- /dev/null +++ b/pages/error/error.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/pages/error/error.wxml b/pages/error/error.wxml new file mode 100644 index 0000000..2f51e8c --- /dev/null +++ b/pages/error/error.wxml @@ -0,0 +1,8 @@ + + + + {{store.store_name}} + {{store.store_desc}} + {{msg}} + + \ No newline at end of file diff --git a/pages/error/error.wxss b/pages/error/error.wxss new file mode 100644 index 0000000..f09d0b3 --- /dev/null +++ b/pages/error/error.wxss @@ -0,0 +1,26 @@ +.all_page{ + position: fixed; + height: 100%; + width: 100%; + background: #fff; + justify-content: center;/*水平居中*/ +} +.all_page .content{ + font-size: 30rpx; + text-align: center; + height: 400px; + width: 100%; + position: absolute; + top: 50%; + margin-top:-200px; +} +.logo{width: 140rpx; height: 140rpx; border-radius:50% } +.all_page .content .title{ + font-size: 36rpx; margin: 20rpx 0 +} + +.all_page .err{ + color:red; + font-size: 36rpx; + margin-top: 300rpx; +} \ No newline at end of file diff --git a/pages/togoin/togoin.wxml b/pages/togoin/togoin.wxml index 81a94df..f9e3e25 100644 --- a/pages/togoin/togoin.wxml +++ b/pages/togoin/togoin.wxml @@ -4,8 +4,10 @@ - - {{store.store_name}} + + + {{store.store_name}} + diff --git a/pages/togoin/togoin.wxss b/pages/togoin/togoin.wxss index 9ee2fba..4563ed4 100644 --- a/pages/togoin/togoin.wxss +++ b/pages/togoin/togoin.wxss @@ -14,7 +14,6 @@ page{ width: 192rpx; height: 192rpx; border-radius: 50%; - position: absolute; } .phones{ margin-bottom: 48rpx; @@ -62,3 +61,7 @@ button{ .f2 { flex: 2 0; } + +.middle_view{ + position: absolute; left: 0; width: 100%; text-align: center; +} diff --git a/pages/user/Change_phone/Change_phone.js b/pages/user/Change_phone/Change_phone.js index 7f9f5ce..9f3d054 100644 --- a/pages/user/Change_phone/Change_phone.js +++ b/pages/user/Change_phone/Change_phone.js @@ -52,7 +52,7 @@ Page({ var change_phone = th.data.change_phone; var isver = th.data.isver; var send = th.data.send; - var myreg = /^(((13[0-9]{1})|(15[0-9]{1})|(18[0-9]{1})|(17[0-9]{1}))+\d{8})$/; + var myreg = /^(((11[0-9]{1})|(12[0-9]{1})|(13[0-9]{1})|(14[0-9]{1})|(15[0-9]{1})|(16[0-9]{1})|(19[0-9]{1})|(18[0-9]{1})|(17[0-9]{1}))+\d{8})$/; if(change_phone){ if (change_phone.length < 11) { getApp().my_warnning("请输入11位的手机号码", 0, th); diff --git a/utils/auth.js b/utils/auth.js index 5956baa..d29b134 100644 --- a/utils/auth.js +++ b/utils/auth.js @@ -213,7 +213,7 @@ module.exports = { var userInfo = a.userInfo; if (userInfo==undefined){ //判断本地是数据是否正确 - n.goto("/pages/togoin/togoin"); + if(n.globalData.wxapp_buy_obj && n.globalData.wxapp_buy_obj.isbuy==1 && n.globalData.wxapp_buy_obj.isout==0 ) n.goto("/pages/togoin/togoin"); }else{ a && void 0 != a ? (n.globalData.wechatUser = a, o.login(t, a, e)) : o.goGetUserInfo();