zhaojs
2023-08-11 83e49ed8b1ab05dd332def0fba6c3703d1e91373
uniapp/pages/mine/setting/modifyInviteCode.vue
@@ -5,14 +5,17 @@
         <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="请输入新的邀请码"
                  :placeholder="c_placeholder"
                  placeholder-class="input-placeHolder"/>
            </view>
         </view>
@@ -20,10 +23,39 @@
         <view class="txtTips">
            邀请码需设置为4~8位的数字与字母的组合。
         </view>
         </view>
         <view v-if="user.level <ablelevel">
         
         <view class="login-btn rowCenCen" :class="true?'colorfulbtn':''" @click="modify()">
         <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>
@@ -34,7 +66,7 @@
   import titleBar from '../../../components/backTitlebar.vue'
   import MD5 from '../../../utils/md5.js'
   import config from '../../../utils/config.js'
   import utils from '../../../utils/utils.js'
   import util from '../../../utils/utils.js'
   export default {
      components: {
         titleBar
@@ -42,12 +74,62 @@
      data(){
         return{
            user:'',
            code:''
            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}$/;
@@ -79,6 +161,40 @@
</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;