<template>
|
<view class="modifyPass-container wrapperLayer">
|
<titleBar titleText='' :pageForm='"modifyPass"'></titleBar>
|
<view class="pageInfoContent-container colCen borderBox">
|
<view class="titleText">
|
修改邀请码
|
</view>
|
<view v-if="user.level >=ablelevel">
|
|
|
<view class="input-container colCen">
|
<view class="outSidebox rowCenBet" data-type='code'>
|
<input
|
:disabled="!isedit"
|
maxlength="8"
|
type="text"
|
v-model="code"
|
:placeholder="c_placeholder"
|
placeholder-class="input-placeHolder"/>
|
</view>
|
</view>
|
|
<view class="txtTips">
|
邀请码需设置为4~8位的数字与字母的组合。
|
</view>
|
</view>
|
<view v-if="user.level <ablelevel">
|
|
|
<view class="vip-info-container rowCenBet" v-if="!showtar || platform!='iOS'">
|
<view class="left-info" >
|
当前等级不可修改,再邀请{{needIvite}}人升级
|
</view>
|
<!-- <view class="left-info" v-else>
|
您已经是最高等级,快去邀请好友赚佣金吧!
|
</view> -->
|
<view class="rt-btn rowCenCen" @tap="golevelRules()" v-if="user.level <ablelevel">
|
<image class="vipimg" src="../../../static/images/goods/vip.png" mode="aspectFill"></image>
|
<view class="level-txt">
|
立即升级
|
</view>
|
</view>
|
</view>
|
<!-- <view class="rt-btn rowCenCen" @tap="golevelRules()" v-else>
|
<image class="vipimg" src="../../../static/images/goods/vip.png" mode="aspectFill"></image>
|
<view class="level-txt">
|
立即查看
|
</view>
|
</view> -->
|
</view>
|
<view v-if="isedit" class="login-btn rowCenCen" :class="true?'colorfulbtn':''" @click="modify()">
|
<view class="btn-font">
|
确认修改
|
</view>
|
</view>
|
<view v-else class="login-btn rowCenCen" :class="true?'colorfulbtn':''" @click="back()">
|
<view class="btn-font">
|
返回
|
</view>
|
</view>
|
</view>
|
</view>
|
</template>
|
|
<script>
|
import titleBar from '../../../components/backTitlebar.vue'
|
import MD5 from '../../../utils/md5.js'
|
import config from '../../../utils/config.js'
|
import util from '../../../utils/utils.js'
|
export default {
|
components: {
|
titleBar
|
},
|
data(){
|
return{
|
user:'',
|
code:'',
|
showtar:false,
|
platform:'',
|
isedit:false,
|
needIvite:0,
|
ablelevel:2,
|
c_placeholder:'请输入新的邀请码'
|
}
|
},
|
onLoad() {
|
this.getUserInfo();
|
},
|
methods:{
|
getUserInfo()
|
{
|
// #ifdef APP-PLUS
|
this.showtar = getApp().globalData.ifwt == 1 ? false : true;
|
this.platform = plus.os.name
|
// #endif
|
|
var that = this;
|
this.$u.api.getUserInfo({}).then(e => {
|
that.user = e.data.userinfo;
|
that.isedit=that.user.level>=that.ablelevel;
|
console.log(that.isedit)
|
if(that.user.level<that.ablelevel)
|
{
|
that.c_placeholder='当前等级不可修改哦';
|
this.getTopDate();
|
}
|
util.setCache('userInfo', e.data.userinfo)
|
}).catch(function (err) {
|
console.log(err)
|
})
|
},
|
getTopDate(){
|
var that = this;
|
this.$u.api.getUpgradeInfo({}).then(e => {
|
console.log(e);
|
var nextSet=e.data.list[1];
|
var needcount=(nextSet.direct_primary_count+nextSet.direct_intermediate_count)-e.data.info.user_zong_num;
|
that.needIvite=needcount<0?0:needcount;
|
}).catch(function (err) {
|
})
|
},
|
back()
|
{
|
uni.navigateBack({
|
delta:1
|
})
|
},
|
golevelRules() {
|
uni.navigateTo({
|
url: '../../goods/privilege'
|
})
|
},
|
modify() {
|
var that = this;
|
var str = /^[a-zA-Z0-9]{4,8}$/;
|
if (str.test(this.code)) {
|
this.$u.api.changeCode({
|
invite_code:this.code
|
}).then(e => {
|
if(e.code == 1)return that.$alert(e.msg);
|
that.$alert('修改成功');
|
setTimeout(function(){
|
uni.navigateBack({
|
delta:1
|
})
|
},1000)
|
|
}).catch(function (err) {
|
})
|
} else {
|
uni.showToast({
|
title: '邀请码不符合要求,请输入4~8位的数字与字母的组合',
|
icon: 'none',
|
position: 'bottom',
|
duration: 3000
|
});
|
}
|
}
|
}
|
}
|
</script>
|
|
<style lang="scss">
|
.vip-info-container {
|
width: 100%;
|
height: 60rpx;
|
background: #FFF2CF;
|
border-radius: 16rpx;
|
padding: 0 20rpx;
|
margin-top: 40rpx;
|
.left-info {
|
font-size: 24rpx;
|
font-weight: 500;
|
color: #593A0F;
|
margin-right: 15rpx;
|
}
|
|
.rt-btn {
|
width: 152rpx;
|
height: 44rpx;
|
background-color: rgba(0, 0, 0, 0.6);
|
border-radius: 22rpx;
|
|
.vipimg {
|
width: 27rpx;
|
height: 24rpx;
|
}
|
|
.level-txt {
|
font-size: 24rpx;
|
font-weight: 500;
|
color: #FFFFFF;
|
margin-left: 10rpx;
|
}
|
}
|
}
|
|
.modifyPass-container{
|
width: 100%;
|
min-height: 100vh;
|
background-color: #FFFFFF;
|
.pageInfoContent-container{
|
width: 100%;
|
padding: 0 60rpx;
|
.titleText{
|
width: 100%;
|
font-size: 42rpx;
|
font-weight: bold;
|
color: #333333;
|
margin: 60rpx 0;
|
}
|
|
.input-container{
|
width: 100%;
|
margin-bottom: 20rpx;
|
.outSidebox{
|
width: 100%;
|
height: 85rpx;
|
border-bottom: 2rpx solid #F1F1F1;
|
.input-placeHolder{
|
font-size: 34rpx;
|
font-weight: 500;
|
color: #CACACA;
|
}
|
input{
|
font-size: 34rpx;
|
font-weight: 500;
|
color: #222222;
|
}
|
.hidepass{
|
font-size: 32rpx;
|
font-weight: 800;
|
color: #CACACA;
|
}
|
.getcodebox{
|
font-size: 28rpx;
|
white-space: nowrap;
|
font-weight: 400;
|
color: #FF2851;
|
pointer-events: none;
|
}
|
.colorTxt{
|
pointer-events: auto;
|
}
|
}
|
.outSidebox-active{
|
border-bottom: 2rpx solid #FF2851;
|
}
|
}
|
.login-btn{
|
width: 100%;
|
height: 86rpx;
|
background: #E2E2E2;
|
border-radius: 43rpx;
|
margin-top: 80rpx;
|
pointer-events: none;
|
.btn-font{
|
font-size: 30rpx;
|
font-weight: 500;
|
color: #FFFFFF;
|
}
|
}
|
.txtTips {
|
font-size: 26rpx;
|
font-weight: 400;
|
color: #999999;
|
line-height: 38rpx;
|
}
|
.colorfulbtn{
|
background: #FD002F;
|
pointer-events: auto;
|
}
|
}
|
}
|
</style>
|