Files
pupil/packageMy/memberCenter/memberCenter.vue
2023-02-24 12:20:41 +08:00

115 lines
2.8 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<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
}
},
methods: {
handleSureClick() {
let name = this.$refs.nameAndphone.model.userInfo.name
let phone = this.$refs.nameAndphone.model.userInfo.phone
if (!/^1[3456789]\d{9}$/.test(phone)) {
this.$toast.warn('请输入正确的手机号')
return false
}
this.$apiServe.bindComponyAndUpdate({
uid: 1,
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>