132 lines
3.4 KiB
Vue
132 lines
3.4 KiB
Vue
<template>
|
||
<view>
|
||
<u-navbar :autoBack="true" title="会员中心"></u-navbar>
|
||
<u--image src="/static/my/wo_icon_hyzxbj.png" width="750rpx" height="349rpx" :lazy-load="true">
|
||
</u--image>
|
||
<myAvatar ref="myavatar" :center="show"></myAvatar>
|
||
<view style="height: 56rpx;"></view>
|
||
<myForm ref="nameAndphone"></myForm>
|
||
<view class="commitment">
|
||
{{commitment}}
|
||
</view>
|
||
<u-button type="success" :text="btnText" color="#0EBB5B" @click="handleSureClick()" :disabled="btnDisabled">
|
||
</u-button>
|
||
<u-modal :show="showM" closeOnClickOverlay="false" confirmText="确定" @confirm="confirm">
|
||
<rich-text :nodes="content"></rich-text>
|
||
</u-modal>
|
||
</view>
|
||
</template>
|
||
|
||
<script>
|
||
export default {
|
||
data() {
|
||
return {
|
||
name: '',
|
||
phone: '',
|
||
showM: false,
|
||
btnText: '升级VIP',
|
||
btnDisabled: false,
|
||
//部分产品无权限访问,需升级VIP
|
||
needAsk: '',
|
||
//会员中心的用户名旁边不显示edit图标
|
||
show: false,
|
||
content: `请保持手机畅通<br>
|
||
客服会及时联系您`,
|
||
commitment: ''
|
||
}
|
||
},
|
||
onLoad(option) {
|
||
if (uni.getStorageSync('member') == 2) {
|
||
this.btnText = '升级VIP'
|
||
} else if (uni.getStorageSync('member') == 3) {
|
||
this.btnText = '升级vip,正在审核中'
|
||
this.btnDisabled = true
|
||
} else if (uni.getStorageSync('member') == 4) {
|
||
this.btnText = '升级VIP'
|
||
this.btnDisabled = true
|
||
}
|
||
this.commitment = uni.getStorageSync('agreement')
|
||
if (option.ask == 1) {
|
||
this.needAsk = option.ask
|
||
}
|
||
if (uni.getStorageSync('com_name') && uni.getStorageSync('com_mobile')) {
|
||
this.$refs.nameAndphone.model.userInfo.name = uni.getStorageSync('com_name')
|
||
this.$refs.nameAndphone.model.userInfo.phone = uni.getStorageSync('com_mobile')
|
||
this.$refs.nameAndphone.disabled = true
|
||
}
|
||
},
|
||
methods: {
|
||
handleSureClick() {
|
||
if (this.btnDisabled == false) {
|
||
let name = this.$refs.nameAndphone.model.userInfo.name
|
||
let phone = this.$refs.nameAndphone.model.userInfo.phone
|
||
console.log('name', name);
|
||
console.log('phone', phone);
|
||
|
||
if (!/^1[3456789]\d{9}$/.test(phone)) {
|
||
this.$toast.warn('请输入正确的手机号')
|
||
return false
|
||
}
|
||
if (name == '') {
|
||
this.$toast.warn('请完善数据')
|
||
return false
|
||
}
|
||
if (name && phone) {
|
||
console.log('数据已完善');
|
||
this.$apiServe.bindComponyAndUpdate({
|
||
uid: uni.getStorageSync('user_id'),
|
||
type: 2,
|
||
companyName: name,
|
||
companyPhone: phone
|
||
}).then(res => {
|
||
console.log('升级VIP', res.data);
|
||
if (res.data.code == 20003) {
|
||
this.showM = true
|
||
} else if (res.data.code == 20005) {
|
||
this.$toast.warn('请完善数据')
|
||
}
|
||
}).finally(_ => {})
|
||
}
|
||
}
|
||
},
|
||
confirm() {
|
||
uni.reLaunch({
|
||
url: '/pages/my/my'
|
||
})
|
||
if (this.needAsk == 1) {
|
||
uni.reLaunch({
|
||
url: '/pages/index/index'
|
||
})
|
||
}
|
||
}
|
||
}
|
||
}
|
||
</script>
|
||
|
||
<style lang="scss">
|
||
.commitment {
|
||
font-size: 26rpx;
|
||
font-family: PingFangSC-Regular, PingFang SC;
|
||
font-weight: 400;
|
||
color: #C8C8C8;
|
||
line-height: 28rpx;
|
||
margin: 40rpx 66rpx;
|
||
}
|
||
|
||
.u-button {
|
||
width: 644rpx !important;
|
||
height: 86rpx !important;
|
||
background: #0EBB5B;
|
||
border-radius: 20rpx !important;
|
||
}
|
||
|
||
.u-modal__content {
|
||
padding: 43rpx 104rpx !important;
|
||
text-indent: 14rpx;
|
||
}
|
||
|
||
.u-modal__button-group__wrapper--hover {
|
||
background: #0EBB5B !important;
|
||
}
|
||
</style>
|