|
|
|
@ -52,18 +52,25 @@ |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<!-- 多店铺的时候,选择店铺的弹窗 --> |
|
|
|
<view> |
|
|
|
<uni-popup ref="popup" background-color="#fff"> |
|
|
|
<view class="popup-content"> |
|
|
|
<view class="popup-title"> |
|
|
|
<text>{{wayValue == 1?'选择登录物流':'选择登录店铺'}}</text> |
|
|
|
</view> |
|
|
|
<view class="popup-container" v-for="item in shopList" :key="item" @tap="checkShop(item)"> |
|
|
|
<text style="display: inline-block">{{wayValue==1?item.companyName:item.shopName}}</text> |
|
|
|
</view> |
|
|
|
<uni-popup ref="popup" background-color="#fff"> |
|
|
|
<view class="popup-content"> |
|
|
|
<view class="popup-title"> |
|
|
|
<text>{{wayValue == 1?'选择登录物流':'选择登录店铺'}}</text> |
|
|
|
</view> |
|
|
|
</uni-popup> |
|
|
|
</view> |
|
|
|
<view class="popup-container" v-for="item in shopList" :key="item" @tap="checkShop(item)"> |
|
|
|
<text style="display: inline-block">{{wayValue==1?item.companyName:item.shopName}}</text> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</uni-popup> |
|
|
|
<!-- 获取手机号弹窗 --> |
|
|
|
<uni-popup ref="mobilePopup" background-color="#fff"> |
|
|
|
<view class="mobile-popup-content"> |
|
|
|
<view class=""> |
|
|
|
获取手机号,为您提供更便捷的使用体验 |
|
|
|
</view> |
|
|
|
<button open-type="getPhoneNumber" @getphonenumber="getPhoneNumber">一键获取手机号</button> |
|
|
|
</view> |
|
|
|
</uni-popup> |
|
|
|
</view> |
|
|
|
</template> |
|
|
|
|
|
|
|
@ -171,6 +178,40 @@ |
|
|
|
} |
|
|
|
}).catch((res) => {}) |
|
|
|
}, |
|
|
|
getPhoneNumber (e) { |
|
|
|
console.log(e) |
|
|
|
if (e.detail.code) { |
|
|
|
// 将 code 发送给后端 |
|
|
|
this.tui.request("/social/wechat/getPhone", "POST", { |
|
|
|
code: e.detail.code |
|
|
|
}, false, true).then((res) => { |
|
|
|
if (res.code == 200) { |
|
|
|
// 授权成功后的处理逻辑 |
|
|
|
this.tui.toast('获取手机号成功'+res.result); |
|
|
|
|
|
|
|
// 如果后端返回了 phone,将其存入缓存,方便以后使用 |
|
|
|
if (res.result) { |
|
|
|
uni.setStorageSync('mobile', res.result); |
|
|
|
} |
|
|
|
} else { |
|
|
|
this.tui.toast(res.message || '获取失败'); |
|
|
|
} |
|
|
|
}).catch((err) => { |
|
|
|
console.log("请求异常: ", err); |
|
|
|
this.tui.toast('请求获取手机号失败'); |
|
|
|
}); |
|
|
|
} else { |
|
|
|
// 用户拒绝授权 |
|
|
|
console.log('用户取消授权', e.detail.errMsg); |
|
|
|
this.tui.toast('您取消了手机号授权'); |
|
|
|
} |
|
|
|
setTimeout(() => { |
|
|
|
uni.reLaunch({ |
|
|
|
url: '/pages/index/index' |
|
|
|
}) |
|
|
|
}, 200) |
|
|
|
this.tui.toast('登录成功', 2000, true) |
|
|
|
}, |
|
|
|
sectionChange(index) { |
|
|
|
this.wayValue = index; |
|
|
|
if(index == '2'){ |
|
|
|
@ -297,12 +338,16 @@ |
|
|
|
uni.setStorageSync('unionid',res.result.user.unionid) |
|
|
|
uni.setStorageSync('miniProgramOpenid',res.result.user.miniProgramOpenid) |
|
|
|
uni.setStorageSync('officialAccountOpenid',res.result.user.officialAccountOpenid) |
|
|
|
setTimeout(() => { |
|
|
|
uni.reLaunch({ |
|
|
|
url: '/pages/index/index' |
|
|
|
}) |
|
|
|
}, 200) |
|
|
|
this.tui.toast('登录成功', 2000, true) |
|
|
|
if(res.result.user.mobile == null){ |
|
|
|
that.$refs.mobilePopup.open('bottom') |
|
|
|
}else{ |
|
|
|
setTimeout(() => { |
|
|
|
uni.reLaunch({ |
|
|
|
url: '/pages/index/index' |
|
|
|
}) |
|
|
|
}, 200) |
|
|
|
that.tui.toast('登录成功', 2000, true) |
|
|
|
} |
|
|
|
} else { |
|
|
|
that.tui.toast(res.message) |
|
|
|
} |
|
|
|
|