|
@@ -83,6 +83,17 @@
|
|
|
</view>
|
|
|
|
|
|
</uni-popup>
|
|
|
+ <!-- 手机号授权 -->
|
|
|
+ <view class="authorizBox" v-if="authorizShow" @click="authorizShowno">
|
|
|
+ <view class="authorizCont" @click.stop="">
|
|
|
+ <view class="authorizName">{{wxOpenData.miniAppName}}</view>
|
|
|
+ <view class="authorizMs">您好,欢迎访问本店,授权手机号登录能获取我们最新的促销活动哦~</view>
|
|
|
+ <button class="authorizContbutton" type="default" open-type="getPhoneNumber" @getphonenumber="decryptPhoneNumber">授权</button>
|
|
|
+ </view>
|
|
|
+ <view style="text-align: center;padding-top: 56rpx;">
|
|
|
+ <image src="../../static/timg/icon_guanbi@2x.png" @click="authorizShowno" mode="" class="authorizCloseImg"></image>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
</view>
|
|
|
</template>
|
|
|
|
|
@@ -110,34 +121,35 @@
|
|
|
index:'',
|
|
|
areaName:'区域',
|
|
|
loading:false,
|
|
|
+ ext:'',
|
|
|
+ authorizShow:false,
|
|
|
+ wxOpenData:'',
|
|
|
+ userInfo: '',
|
|
|
}
|
|
|
},
|
|
|
|
|
|
onLoad() {
|
|
|
var that = this;
|
|
|
uni.removeStorageSync('selectCity');
|
|
|
- uni.authorize({
|
|
|
- scope: 'scope.userLocation',
|
|
|
- success() {
|
|
|
- uni.getLocation({
|
|
|
- type: 'gcj02',
|
|
|
- success: function(res) {
|
|
|
- console.log(res)
|
|
|
- that.location.lat = res.latitude
|
|
|
- that.location.lng = res.longitude
|
|
|
- that.getAdress();
|
|
|
- //that.getqueryShopList() //获取全部门店列表
|
|
|
- },
|
|
|
- fail(err) {
|
|
|
- console.log("定位失败")
|
|
|
- that.getqueryShopList();
|
|
|
- }
|
|
|
- });
|
|
|
- },
|
|
|
- fail: (err) => {
|
|
|
- that.getqueryShopList();
|
|
|
-
|
|
|
- }})
|
|
|
+ this.userInfo = uni.getStorageSync("userInfo");
|
|
|
+ this.ext=this.$common.getExtStoreId();
|
|
|
+ if(this.userInfo){
|
|
|
+ this.themeColor = uni.getStorageSync("themeColor");
|
|
|
+ this.wxOpenData=this.$store.state.wxOpenData;
|
|
|
+ this.init()
|
|
|
+ }else{
|
|
|
+ this.$common.automaticlogin().then(val => {
|
|
|
+ this.themeColor = uni.getStorageSync("themeColor");
|
|
|
+ this.userInfo=this.$store.state.userInfo;
|
|
|
+ this.wxOpenData=this.$store.state.wxOpenData;
|
|
|
+ this.init()
|
|
|
+ if(!this.userInfo){
|
|
|
+ uni.hideLoading();
|
|
|
+ this.authorizShow=true
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
// that.getqueryShopList();
|
|
|
|
|
@@ -156,13 +168,66 @@
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
+ authorizShowno(){
|
|
|
+ this.authorizShow=false
|
|
|
+ },
|
|
|
+ decryptPhoneNumber: function(e) {
|
|
|
+ console.log(e);
|
|
|
+ this.code=e.detail.code
|
|
|
+ this.wxPhoneLogin()
|
|
|
+ this.authorizShow=false;
|
|
|
+ },
|
|
|
+ wxPhoneLogin(){
|
|
|
+ var that=this;
|
|
|
+ this.$http('miniApp2/sys/wxPhoneLogin', {
|
|
|
+ appId:this.ext.appId,
|
|
|
+ unionId:this.ext.unionId,
|
|
|
+ code:this.code,
|
|
|
+ openId:this.wxOpenData.openid
|
|
|
+ },'POST').then(res => {
|
|
|
+ var data = res.data;
|
|
|
+ if(data.loginInfo){
|
|
|
+ this.userInfo=data.loginInfo.openUser;
|
|
|
+ this.wxOpenData=data.loginInfo;
|
|
|
+ this.$store.commit('mutationswxOpenData', data)
|
|
|
+ this.$store.commit('mutationsuserInfo', this.userInfo)
|
|
|
+ this.getInfo()
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ init(){
|
|
|
+ var that = this;
|
|
|
+ uni.authorize({
|
|
|
+ scope: 'scope.userLocation',
|
|
|
+ success() {
|
|
|
+ uni.getLocation({
|
|
|
+ type: 'gcj02',
|
|
|
+ success: function(res) {
|
|
|
+ console.log(res)
|
|
|
+ that.location.lat = res.latitude
|
|
|
+ that.location.lng = res.longitude
|
|
|
+ that.getAdress();
|
|
|
+ //that.getqueryShopList() //获取全部门店列表
|
|
|
+
|
|
|
+ },
|
|
|
+ fail(err) {
|
|
|
+ console.log("定位失败")
|
|
|
+ that.getqueryShopList();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ fail: (err) => {
|
|
|
+ that.getqueryShopList();
|
|
|
+
|
|
|
+ }})
|
|
|
+ },
|
|
|
quCilck(){
|
|
|
this.$refs.popup.open("right")
|
|
|
this.popupShow=true;
|
|
|
},
|
|
|
gocity(){
|
|
|
uni.navigateTo({
|
|
|
- url:'/pages/subPack/chooseCity?type=1'
|
|
|
+ url:'/pages/subPack/chooseCity'
|
|
|
})
|
|
|
},
|
|
|
checkarea(item){
|
|
@@ -245,8 +310,6 @@
|
|
|
|
|
|
}else{
|
|
|
console.log("接口获取失败")
|
|
|
- that.cityCode = ''
|
|
|
- that.getqueryShopList() //获取全部门店列表
|
|
|
}
|
|
|
|
|
|
}
|
|
@@ -284,9 +347,15 @@
|
|
|
// uni.navigateTo({
|
|
|
// url: '../shop/shopDetail?id=' + item.shopId
|
|
|
// })
|
|
|
- uni.navigateTo({
|
|
|
- url:'onlineBooking?naShopId='+item.shopId
|
|
|
- })
|
|
|
+ if (this.userInfo) {
|
|
|
+ uni.navigateTo({
|
|
|
+ url:'onlineBooking?naShopId='+item.shopId
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ this.authorizShow = true;
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
},
|
|
|
|
|
@@ -604,4 +673,63 @@
|
|
|
color: #999999;
|
|
|
font-size: 28rpx;
|
|
|
}
|
|
|
+ .authorizBox{
|
|
|
+ width: 100vw;
|
|
|
+ height: 100vh;
|
|
|
+ background: rgba(0, 0, 0, 0.5);
|
|
|
+ position: fixed;
|
|
|
+ top: 0;
|
|
|
+ left: 0;
|
|
|
+ }
|
|
|
+ .authorizCont{
|
|
|
+ margin-top: 30vh;
|
|
|
+ width: 564rpx;
|
|
|
+ height: 408rpx;
|
|
|
+ background: #FFFFFF;
|
|
|
+ border-radius: 24rpx;
|
|
|
+ margin-left: 93rpx;
|
|
|
+ position: relative;
|
|
|
+ }
|
|
|
+ .authorizCloseImg{
|
|
|
+ width: 62rpx;
|
|
|
+ height: 62rpx;
|
|
|
+ }
|
|
|
+ .sqLogoBox{
|
|
|
+ width: 180rpx;
|
|
|
+ height: 180rpx;
|
|
|
+ background: #FFFFFF;
|
|
|
+ border-radius: 90rpx;
|
|
|
+ text-align: center;
|
|
|
+ position: absolute;
|
|
|
+ top: -50rpx;
|
|
|
+ left: 192rpx;
|
|
|
+ }
|
|
|
+ .authorizName{
|
|
|
+ color: #333333;
|
|
|
+ line-height: 42rpx;
|
|
|
+ font-size: 30rpx;
|
|
|
+ text-align: center;
|
|
|
+ padding-top: 58rpx;
|
|
|
+ }
|
|
|
+ .authorizMs{
|
|
|
+ color: #999999;
|
|
|
+ line-height: 36rpx;
|
|
|
+ font-size: 26rpx;
|
|
|
+ width: 452rpx;
|
|
|
+ padding-top: 24rpx;
|
|
|
+ text-align: center;
|
|
|
+ margin-left: 56rpx;
|
|
|
+ }
|
|
|
+ .authorizContbutton{
|
|
|
+ width: 422rpx;
|
|
|
+ height: 88rpx;
|
|
|
+ background: #D53533;
|
|
|
+ border-radius: 44rpx;
|
|
|
+ line-height: 88rpx;
|
|
|
+ text-align: center;
|
|
|
+ font-size:30rpx;
|
|
|
+ color: #FFFFFF;
|
|
|
+ margin-top: 62rpx;
|
|
|
+ margin-left:71rpx;
|
|
|
+ }
|
|
|
</style>
|