perry-mall/components/auth-phone.vue

49 lines
1.3 KiB
Vue

<template>
<view v-if="showPhone" @touchmove.stop.prevent="moveHandle" class="disjcac posAll">
<view class="bacf radius20 width100 tank-box">
<view class="tc tank-box-itemone">请授权绑定手机号</view>
<view class="fon28 colf pad-x30 pad-zy30 tc disjb">
<view class="pad-sx10 radius10 tank-btn" style="background-color: rgba(230, 230, 230,1);color: #000000;">暂不绑定</view>
<view class="pad-sx10 radius10 tank-btn posir pbackc">
立即绑定
<button open-type="getPhoneNumber" @getphonenumber="getphonenumber" class="posia syxzo"></button>
</view>
</view>
</view>
</view>
</template>
<script>
export default {
name:"wx_auth_phone",
data() {
return {
showPhone:true
};
},
methods:{
moveHandle(){//禁止底层滑动
return false
},
getphonenumber(e){//授权绑定手机号
if(e.detail.errMsg=="getPhoneNumber:ok"){
this.$requst.post('user/bind-phone',{iv:e.detail.iv,encryptedData:e.detail.encryptedData}).then(res=>{
// console.log('手机号信息:',res);
if(res.code==0){
this.showPhone = false;
this.$toolAll.tools.showToast('手机号绑定成功','success');
}
},error=>{})
} else {
console.log('用户拒绝');
this.showPhone = true;
}
},
}
}
</script>
<style>
</style>