-
Status changed to merged
-
mentioned in commit 8f78a6e783222a1675487f687ee21834858ea70d
Showing
12 changed files
app.js
| ... | ... | @@ -101,6 +101,29 @@ App({ |
| 101 | 101 | }, |
| 102 | 102 | }) |
| 103 | 103 | |
| 104 | + var th=this; | |
| 105 | + var pages = getCurrentPages(); //获取加载的页面 | |
| 106 | + var currentPage = pages[pages.length - 1]; //获取当前页面的对象 | |
| 107 | + if(!currentPage || currentPage.route.indexOf('error/error')==-1){ | |
| 108 | + var tt=this.globalData.wxapp_buy_obj; | |
| 109 | + if (!tt){ | |
| 110 | + this.get_isbuy(function (){ | |
| 111 | + tt=th.globalData.wxapp_buy_obj; | |
| 112 | + if (tt.isout == 1){ | |
| 113 | + th.promiseGet('/api/weshop/store/get/'+t.stoid,{}).then(res=>{ | |
| 114 | + wx.reLaunch({ | |
| 115 | + url: "/pages/error/error?msg=该商城已到期,暂停浏览!\r\n可联系:"+res.data.data.store_tel, | |
| 116 | + }); | |
| 117 | + }) | |
| 118 | + } | |
| 119 | + else if (tt.isbuy == 0) | |
| 120 | + wx.reLaunch({ | |
| 121 | + url: "/pages/error/error?msg=还未购买小程序", | |
| 122 | + }); | |
| 123 | + }) | |
| 124 | + } | |
| 125 | + } | |
| 126 | + | |
| 104 | 127 | }, |
| 105 | 128 | |
| 106 | 129 | //---初始化第三方---- |
| ... | ... | @@ -287,9 +310,11 @@ App({ |
| 287 | 310 | }, |
| 288 | 311 | |
| 289 | 312 | //同步化,在调用的时候要await |
| 290 | - async get_isbuy() { | |
| 291 | - var th=this; | |
| 292 | - await api.check_isbuy({ store_id: t.stoid, type: 5 }).then(res=>{ | |
| 313 | + async get_isbuy(func) { | |
| 314 | + var th=this | |
| 315 | + var stoid=os.stoid; | |
| 316 | + | |
| 317 | + await this.promiseGet("/store/storemoduleendtime/page?store_id=" +stoid + "&type=5",{}).then(res=>{ | |
| 293 | 318 | var o=res; |
| 294 | 319 | if (o.data.code == 0) { |
| 295 | 320 | var ob = { isout: 0, isbuy: 1 }; |
| ... | ... | @@ -308,6 +333,9 @@ App({ |
| 308 | 333 | } |
| 309 | 334 | ob.isbuy = isbuy; |
| 310 | 335 | th.globalData.wxapp_buy_obj=ob; |
| 336 | + if(func){ | |
| 337 | + func(); | |
| 338 | + } | |
| 311 | 339 | } |
| 312 | 340 | }) |
| 313 | 341 | }, |
| ... | ... | @@ -384,44 +412,61 @@ App({ |
| 384 | 412 | } |
| 385 | 413 | //---如果会员没有设置默认门店,同时也没有再注册的时候选择门店-- |
| 386 | 414 | if(pick_id==0) return func(null); |
| 387 | - //获取用户注册时候的门店,这个门店不能关闭,同时这个门店的分类不能关闭 | |
| 388 | - th.request.get("/api/weshop/pickup/get/"+os.stoid+"/"+pick_id,{ | |
| 389 | - data:{}, | |
| 390 | - success:function (res) { | |
| 391 | - th.globalData.pk_store=null; | |
| 392 | - if(res.data.code==0 && res.data.data && res.data.data.isstop==0){ | |
| 393 | - if(res.data.data.category_id){ | |
| 394 | - th.request.get( "/api/weshop/storagecategory/get/"+os.stoid+"/"+res.data.data.category_id, { | |
| 395 | - data: {}, | |
| 396 | - success: function (ee) { | |
| 397 | - if(ee.data.code==0 && ee.data.data ){ | |
| 398 | - if(ee.data.data.is_show==1){ | |
| 399 | - th.globalData.pk_store = res.data.data; | |
| 400 | - func(th.globalData.pk_store); | |
| 401 | - }else{ | |
| 402 | - func(null); | |
| 403 | - } | |
| 404 | - }else{ | |
| 405 | - func(null); | |
| 406 | - } | |
| 407 | - } | |
| 408 | - }) | |
| 409 | - }else{ | |
| 410 | - th.globalData.pk_store = res.data.data; | |
| 411 | - func(th.globalData.pk_store); | |
| 412 | - } | |
| 413 | - }else{ | |
| 414 | - func(null); | |
| 415 | - } | |
| 416 | - } | |
| 417 | - }) | |
| 415 | + | |
| 416 | + //返回门店的数量 | |
| 417 | + th.get_pk_num(function(num){ | |
| 418 | + //获取用户注册时候的门店,这个门店不能关闭,同时这个门店的分类不能关闭 | |
| 419 | + th.request.get("/api/weshop/pickup/get/"+os.stoid+"/"+pick_id,{ | |
| 420 | + data:{}, | |
| 421 | + success:function (res) { | |
| 422 | + th.globalData.pk_store=null; | |
| 423 | + if(res.data.code==0 && res.data.data && res.data.data.isstop==0){ | |
| 424 | + //--门店的数量大于5个才要关心门店的分类有没有关闭-- | |
| 425 | + if(res.data.data.category_id && num>5){ | |
| 426 | + th.request.get( "/api/weshop/storagecategory/get/"+os.stoid+"/"+res.data.data.category_id, { | |
| 427 | + data: {}, | |
| 428 | + success: function (ee) { | |
| 429 | + if(ee.data.code==0 && ee.data.data ){ | |
| 430 | + if(ee.data.data.is_show==1){ | |
| 431 | + th.globalData.pk_store = res.data.data; | |
| 432 | + func(th.globalData.pk_store); | |
| 433 | + }else{ | |
| 434 | + func(null); | |
| 435 | + } | |
| 436 | + }else{ | |
| 437 | + func(null); | |
| 438 | + } | |
| 439 | + } | |
| 440 | + }) | |
| 441 | + }else{ | |
| 442 | + th.globalData.pk_store = res.data.data; | |
| 443 | + func(th.globalData.pk_store); | |
| 444 | + } | |
| 445 | + }else{ | |
| 446 | + func(null); | |
| 447 | + } | |
| 448 | + } | |
| 449 | + }) | |
| 450 | + | |
| 451 | + }) | |
| 452 | + | |
| 418 | 453 | }else{ |
| 419 | 454 | func(th.globalData.pk_store); |
| 420 | 455 | } |
| 421 | 456 | }) |
| 422 | - | |
| 423 | 457 | }, |
| 424 | - | |
| 458 | + | |
| 459 | + //-- 获取门店的数量 -- | |
| 460 | + get_pk_num:function(func){ | |
| 461 | + this.request.get("/api/weshop/pickup/page",{ | |
| 462 | + data:{page:1,pageSize:1,isstop:0,store_id:os.stoid}, | |
| 463 | + success:function (res) { | |
| 464 | + if(res.data.code==0){ | |
| 465 | + func(res.data.data.total); //门店数量 | |
| 466 | + } | |
| 467 | + } | |
| 468 | + }); | |
| 469 | + }, | |
| 425 | 470 | //-------获取购物车数量---------- |
| 426 | 471 | requestCardNum: function(th) { |
| 427 | 472 | if(!this.globalData.user_id) return false; |
| ... | ... | @@ -538,7 +583,28 @@ App({ |
| 538 | 583 | } |
| 539 | 584 | return index; |
| 540 | 585 | |
| 541 | - } | |
| 586 | + }, | |
| 587 | + | |
| 588 | + //---promise的使用get---- | |
| 589 | + promiseGet:function(url,data){ | |
| 590 | + if(url.indexOf("http")==-1) url=this.globalData.setting.url +url; | |
| 591 | + return new Promise((resolve, reject) => { | |
| 592 | + data.isShowLoading && wx.showLoading(); | |
| 593 | + wx.request({ | |
| 594 | + url, | |
| 595 | + method: 'GET', | |
| 596 | + header: {"content-type": "application/x-www-form-urlencoded" }, | |
| 597 | + data:data.data, | |
| 598 | + success(res) { | |
| 599 | + data.isShowLoading && wx.hideLoading(); | |
| 600 | + resolve(res); | |
| 601 | + }, | |
| 602 | + fail(err) { data.isShowLoading && wx.hideLoading(); reject(err); } | |
| 603 | + }) | |
| 604 | + }) | |
| 605 | + }, | |
| 606 | + | |
| 607 | + | |
| 542 | 608 | |
| 543 | 609 | |
| 544 | 610 | }); | ... | ... |
packageA/pages/activity_share/activity_share.js
| ... | ... | @@ -159,7 +159,7 @@ Page({ |
| 159 | 159 | imageUrl: img, |
| 160 | 160 | }; |
| 161 | 161 | th.setData({share_hidden:1}); |
| 162 | - th.insert_act_share(title,lbid,6); | |
| 162 | + th.insert_act_share(title,lbid,6,null,th.data.hui_active.payMoney); | |
| 163 | 163 | return ob; |
| 164 | 164 | }else{ |
| 165 | 165 | //---秒杀,拼团,促销--- |
| ... | ... | @@ -193,9 +193,9 @@ Page({ |
| 193 | 193 | //插入活动 |
| 194 | 194 | if(item.prom_type==3){ |
| 195 | 195 | var hui_active=this.data.hui_active; |
| 196 | - th.insert_act_share(hui_active.name,hui_active.id,5); | |
| 196 | + th.insert_act_share(hui_active.name,hui_active.id,5,item.goods_sn,price); | |
| 197 | 197 | }else{ |
| 198 | - th.insert_act_share(item.title,item.id,ind); | |
| 198 | + th.insert_act_share(item.title,item.id,ind,item.goods_sn,price); | |
| 199 | 199 | } |
| 200 | 200 | |
| 201 | 201 | return ob; |
| ... | ... | @@ -220,7 +220,7 @@ Page({ |
| 220 | 220 | if(th.data.currentIndex==2){ ind=5;} |
| 221 | 221 | |
| 222 | 222 | //插入活动 |
| 223 | - th.insert_act_share(title,hui_active.id,ind); | |
| 223 | + th.insert_act_share(title,hui_active.id,ind,null,null); | |
| 224 | 224 | return ob; |
| 225 | 225 | } |
| 226 | 226 | } |
| ... | ... | @@ -546,14 +546,17 @@ Page({ |
| 546 | 546 | if(that.data.currentIndex==1){ |
| 547 | 547 | ind=4; |
| 548 | 548 | } |
| 549 | - | |
| 549 | + | |
| 550 | + //-- 价格 -- | |
| 551 | + var pri0 = th.data.share_good.shop_price; | |
| 552 | + if (th.data.share_good.price) | |
| 553 | + pri0 = th.data.share_good.price; | |
| 550 | 554 | if(th.data.share_good.prom_type==3){ |
| 551 | - th.insert_act_share(th.data.hui_active.name,th.data.hui_active.id,5); //插入分享 | |
| 555 | + th.insert_act_share(th.data.hui_active.name,th.data.hui_active.id,5,th.data.share_good.goods_sn,pri0); //插入分享 | |
| 552 | 556 | }else{ |
| 553 | - th.insert_act_share(th.data.share_good.title,th.data.share_good.id,ind); //插入分享 | |
| 557 | + th.insert_act_share(th.data.share_good.title,th.data.share_good.id,ind,th.data.share_good.goods_sn,pri0); //插入分享 | |
| 554 | 558 | } |
| 555 | - | |
| 556 | - | |
| 559 | + | |
| 557 | 560 | ///二微码 |
| 558 | 561 | var path3 = os.url + "/api/wx/open/app/user/getWeAppEwm/" + |
| 559 | 562 | os.stoid + "?sceneValue=" + scene + "&pageValue=pages/goods/goodsInfo/goodsInfo"; |
| ... | ... | @@ -624,9 +627,7 @@ Page({ |
| 624 | 627 | context.setFillStyle("red") |
| 625 | 628 | context.fillText("¥", 416 * unit, 185 * unit); |
| 626 | 629 | context.setFontSize(31 * unit) |
| 627 | - var pri0 = th.data.share_good.shop_price; | |
| 628 | - if (th.data.share_good.price) | |
| 629 | - pri0 = th.data.share_good.price; | |
| 630 | + | |
| 630 | 631 | |
| 631 | 632 | pri0 = parseFloat(pri0).toFixed(2); |
| 632 | 633 | context.fillText(pri0, 438 * unit, 185 * unit); |
| ... | ... | @@ -1136,7 +1137,7 @@ Page({ |
| 1136 | 1137 | }, |
| 1137 | 1138 | |
| 1138 | 1139 | //-- 推送活动分享 -- |
| 1139 | - insert_act_share:function(title,actid,ind){ | |
| 1140 | + insert_act_share:function(title,actid,ind,ShareActNo,ActMoney){ | |
| 1140 | 1141 | var th = this; |
| 1141 | 1142 | var url="/api/weshop/sharetypeList/save"; |
| 1142 | 1143 | var req_data={ |
| ... | ... | @@ -1149,6 +1150,11 @@ Page({ |
| 1149 | 1150 | shareTime:ut.gettimestamp(), |
| 1150 | 1151 | storeId:os.stoid |
| 1151 | 1152 | } |
| 1153 | + | |
| 1154 | + if(!ShareActNo) ShareActNo=actid; //如果没有带编号就带活动id | |
| 1155 | + if(ActMoney) req_data.ActMoney=ActMoney; //如果金额就要把参数带入 | |
| 1156 | + req_data.ShareActNo=ShareActNo; | |
| 1157 | + | |
| 1152 | 1158 | //插入数据 |
| 1153 | 1159 | getApp().request.post(url,{ |
| 1154 | 1160 | data:req_data, |
| ... | ... | @@ -1164,8 +1170,8 @@ Page({ |
| 1164 | 1170 | data:req_data, |
| 1165 | 1171 | success:function(){} |
| 1166 | 1172 | }) |
| 1167 | - | |
| 1168 | - | |
| 1173 | + | |
| 1174 | + | |
| 1169 | 1175 | } |
| 1170 | 1176 | |
| 1171 | 1177 | ... | ... |
packageA/pages/live_share/live_share.js
packageA/pages/quan/quan.js
| ... | ... | @@ -87,7 +87,7 @@ Page({ |
| 87 | 87 | path:url, |
| 88 | 88 | }; |
| 89 | 89 | th.setData({share_hidden:1}); |
| 90 | - th.insert_quan_share(title,th.data.hui_active.id); | |
| 90 | + th.insert_quan_share(title,th.data.hui_active.id,th.data.hui_active.money); | |
| 91 | 91 | |
| 92 | 92 | return ob; |
| 93 | 93 | }, |
| ... | ... | @@ -179,7 +179,7 @@ Page({ |
| 179 | 179 | }, |
| 180 | 180 | |
| 181 | 181 | //-- 推送活动分享 -- |
| 182 | - insert_quan_share:function(title,actid){ | |
| 182 | + insert_quan_share:function(title,actid,price){ | |
| 183 | 183 | var th = this; |
| 184 | 184 | var url="/api/weshop/sharetypeList/save"; |
| 185 | 185 | var req_data={ |
| ... | ... | @@ -190,8 +190,11 @@ Page({ |
| 190 | 190 | shareStaffId:th.data.StaffId, |
| 191 | 191 | shareStorageId:th.data.StorageId, |
| 192 | 192 | shareTime:ut.gettimestamp(), |
| 193 | - storeId:os.stoid | |
| 193 | + storeId:os.stoid, | |
| 194 | + ShareActNo:actid, | |
| 195 | + ActMoney:price | |
| 194 | 196 | } |
| 197 | + | |
| 195 | 198 | //插入数据 |
| 196 | 199 | getApp().request.post(url,{ |
| 197 | 200 | data:req_data, | ... | ... |
pages/error/error.js
0 → 100644
| 1 | +var t = require("../../utils/common.js");var os=getApp().globalData.setting; | |
| 2 | +Page({ | |
| 3 | + data:{ | |
| 4 | + store:null, | |
| 5 | + imghots: os.imghost, | |
| 6 | + msg:"", | |
| 7 | + }, | |
| 8 | + | |
| 9 | + onLoad:function(t){ | |
| 10 | + var th=this,app = getApp(); | |
| 11 | + app.getConfig(function(e){ | |
| 12 | + th.setData({ store:e,msg:t.msg}); | |
| 13 | + wx.setNavigationBarTitle({ | |
| 14 | + title: e.store_name//页面标题 | |
| 15 | + }) | |
| 16 | + }) | |
| 17 | + }, | |
| 18 | + | |
| 19 | + phone:function (){ | |
| 20 | + if(this.data.msg.indexOf("可联系:")!=-1){ | |
| 21 | + var tel=this.data.msg.split("可联系:")[1]; | |
| 22 | + if(tel){ | |
| 23 | + wx.makePhoneCall({ | |
| 24 | + phoneNumber: tel, | |
| 25 | + }) | |
| 26 | + } | |
| 27 | + } | |
| 28 | + } | |
| 29 | + | |
| 30 | + | |
| 31 | +}); | ... | ... |
pages/error/error.json
0 → 100644
pages/error/error.wxml
0 → 100644
| 1 | +<view class="all_page"> | |
| 2 | + <view class="content"> | |
| 3 | + <view><image class='logo' src="{{imghots+store.store_logo}}"> </image></view> | |
| 4 | + <view class="title">{{store.store_name}}</view> | |
| 5 | + <view>{{store.store_desc}}</view> | |
| 6 | + <view bindtap="phone" class="err"><text>{{msg}}</text></view> | |
| 7 | + </view> | |
| 8 | +</view> | |
| 0 | 9 | \ No newline at end of file | ... | ... |
pages/error/error.wxss
0 → 100644
| 1 | +.all_page{ | |
| 2 | + position: fixed; | |
| 3 | + height: 100%; | |
| 4 | + width: 100%; | |
| 5 | + background: #fff; | |
| 6 | + justify-content: center;/*水平居中*/ | |
| 7 | +} | |
| 8 | +.all_page .content{ | |
| 9 | + font-size: 30rpx; | |
| 10 | + text-align: center; | |
| 11 | + height: 400px; | |
| 12 | + width: 100%; | |
| 13 | + position: absolute; | |
| 14 | + top: 50%; | |
| 15 | + margin-top:-200px; | |
| 16 | +} | |
| 17 | +.logo{width: 140rpx; height: 140rpx; border-radius:50% } | |
| 18 | +.all_page .content .title{ | |
| 19 | + font-size: 36rpx; margin: 20rpx 0 | |
| 20 | +} | |
| 21 | + | |
| 22 | +.all_page .err{ | |
| 23 | + color:red; | |
| 24 | + font-size: 36rpx; | |
| 25 | + margin-top: 300rpx; | |
| 26 | +} | |
| 0 | 27 | \ No newline at end of file | ... | ... |
pages/togoin/togoin.wxml
| ... | ... | @@ -4,8 +4,10 @@ |
| 4 | 4 | <view > |
| 5 | 5 | <view class="logins flex-center2 ali-c flex" style="position: relative;top: 120rpx;"> |
| 6 | 6 | <image mode="widthFix" bindtap="go_index" class="login_img_back" src="{{imghots}}/miniapp/images/loginbg.jpg"></image> |
| 7 | - <image bindtap="go_index" class="login_img" src="{{store_logo}}" binderror="bind_bnerr" lazy-load="true" data-errorimg="store_logo"></image> | |
| 8 | - <view style="position: absolute; margin-top:140rpx">{{store.store_name}}</view> | |
| 7 | + <view class="middle_view"> | |
| 8 | + <image bindtap="go_index" class="login_img" src="{{store_logo}}" binderror="bind_bnerr" lazy-load="true" data-errorimg="store_logo"></image> | |
| 9 | + <view>{{store.store_name}}</view> | |
| 10 | + </view> | |
| 9 | 11 | </view> |
| 10 | 12 | </view> |
| 11 | 13 | ... | ... |
pages/togoin/togoin.wxss
| ... | ... | @@ -14,7 +14,6 @@ page{ |
| 14 | 14 | width: 192rpx; |
| 15 | 15 | height: 192rpx; |
| 16 | 16 | border-radius: 50%; |
| 17 | - position: absolute; | |
| 18 | 17 | } |
| 19 | 18 | .phones{ |
| 20 | 19 | margin-bottom: 48rpx; |
| ... | ... | @@ -62,3 +61,7 @@ button{ |
| 62 | 61 | .f2 { |
| 63 | 62 | flex: 2 0; |
| 64 | 63 | } |
| 64 | + | |
| 65 | +.middle_view{ | |
| 66 | + position: absolute; left: 0; width: 100%; text-align: center; | |
| 67 | +} | ... | ... |
pages/user/Change_phone/Change_phone.js
| ... | ... | @@ -52,7 +52,7 @@ Page({ |
| 52 | 52 | var change_phone = th.data.change_phone; |
| 53 | 53 | var isver = th.data.isver; |
| 54 | 54 | var send = th.data.send; |
| 55 | - var myreg = /^(((13[0-9]{1})|(15[0-9]{1})|(18[0-9]{1})|(17[0-9]{1}))+\d{8})$/; | |
| 55 | + 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})$/; | |
| 56 | 56 | if(change_phone){ |
| 57 | 57 | if (change_phone.length < 11) { |
| 58 | 58 | getApp().my_warnning("请输入11位的手机号码", 0, th); | ... | ... |
utils/auth.js
| ... | ... | @@ -213,7 +213,7 @@ module.exports = { |
| 213 | 213 | var userInfo = a.userInfo; |
| 214 | 214 | if (userInfo==undefined){ |
| 215 | 215 | //判断本地是数据是否正确 |
| 216 | - n.goto("/pages/togoin/togoin"); | |
| 216 | + 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"); | |
| 217 | 217 | |
| 218 | 218 | }else{ |
| 219 | 219 | a && void 0 != a ? (n.globalData.wechatUser = a, o.login(t, a, e)) : o.goGetUserInfo(); | ... | ... |