zhaojs
2023-06-30 ba3d748f9eb65a66fca9bd74fc7796b90a0a70ae
uniapp/pages/login/setInviteCode.vue
@@ -4,27 +4,47 @@
         请输入邀请码
      </view>
      <view class="grey-input-content rowCen borderBox">
         <input class="iptclas" type="text" v-model="inviteCode" placeholder="请填写邀请码" placeholder-class="pla-input"/>
         <input class="iptclas" type="text" v-model="inviteCode" placeholder="请填写邀请码!" placeholder-class="pla-input"/>
      </view>
      <view class="model-tips" v-if="appInfo.isOpenOfficialCode==1">
       <view class="model-tips" v-if="appInfo.isOpenOfficialCode==1">
         <view>填写邀请码有助于您的购物返佣哦!</view>
      </view>
      
      <template v-if="isShowCode">
      <view class="copy-bar rowCenBet borderBox" v-if="appInfo.isOpenOfficialCode==1">
         <view class="left-code">
            {{appInfo.officialInvitationCode}}
         </view>
         <view class="copybtn rowCenCen" @tap="useCode()">
            <view>使用邀请码</view>
         </view>
      </view>
      </template>
      <view @click="setCode" class="login-btn rowCenCen" :class="inviteCode?'colorfulbtn':''" >
         <view class="btn-font"  >
            确定
         </view>
      </view>
      <template v-if="isShowCode">
         <template v-if='commonInvite!=null&&commonInvite.length>0'>
         <view class="s_inviter" @click="userInviter()">
            <view class="s_img">
               <image :src="commonInvite[inviteIndex].avatar"></image>
               <span>{{commonInvite[inviteIndex].nickname}}</span>
            </view>
            <view>
               <view>使用Ta的邀请码</view>
            </view>
         </view>
         <view @click="changeInviter()" style="color: #999999; margin-top: 20rpx;">
            换一个
         </view>
         </template>
         <template v-else>
         <view class="copy-bar rowCenBet borderBox" style="margin-top: 70rpx;" v-if="appInfo.isOpenOfficialCode==1">
                        <view class="left-code">
                           {{appInfo.officialInvitationCode}}
                        </view>
                        <view class="copybtn rowCenCen" @tap="useCode()">
                           <view>使用邀请码</view>
                        </view>
                     </view>
         </template>
      </template>
      
      <view class="yqmtip rowCenCen">
         <span @click="showinvite">没有邀请码?</span>
@@ -48,13 +68,48 @@
            isShowCode:false,
            inviteCode:'',
            appInfo:'',
            inviterShow:false
            inviterShow:false,
            platform:'',
            commonInvite:[],
            inviteIndex:0
         }
      },
      onLoad()
      {
         this.getInviter();
      },
      mounted() {
         this.appInfo = uni.getStorageSync('appInfo')
         this.appInfo = uni.getStorageSync('appInfo');
         this.platform = uni.getSystemInfoSync().platform
      },
      methods: {
         //获取系统推荐人
         getInviter()
         {
            var that=this;
            this.$u.api.getRecomInviter({}).then(e => {
               console.log(e)
               that.commonInvite=e.data;
            }).catch(function (err) {
               console.log(err)
            })
         },
         changeInviter()
         {
            console.log(this.commonInvite.length)
            if(this.inviteIndex==this.commonInvite.length-1)
            {
               this.inviteIndex=0;
            }
            else{
               this.inviteIndex=this.inviteIndex+1;
            }
         },
         userInviter()
         {
            this.inviteCode=this.commonInvite[this.inviteIndex].invitation_code;
         },
         useCode()
         {
            this.inviteCode=this.appInfo.officialInvitationCode;
@@ -76,11 +131,17 @@
               confirmText:'联系推荐人',
               success:function(res)
               {
                  console.log(that.platform);
                  console.log(res);
                  if (res.confirm) {
                      that.isShowCode=true;
                      that.isShowCode=false;
                  } else if (res.cancel) {
                     that.isShowCode=false;
                     that.isShowCode=true;
                  }
               },
               fail:function(res)
               {
                   that.isShowCode=true;
               }
            });
         },
@@ -89,7 +150,10 @@
            this.$u.api.getUserInfo({}).then(e => {
               console.log(e)
               util.setCache('userInfo', e.data.userinfo);
               if (e.data.userinfo.isPwd == 'N') {
               uni.switchTab({
                 url: '../index/index'
               })
               /* if (e.data.userinfo.isPwd == 'N') {
                  uni.redirectTo({
                     url: './setPass'
                  })
@@ -97,7 +161,7 @@
                  uni.switchTab({
                    url: '../index/index'
                  })
               }
                }*/
            }).catch(function (err) {
               console.log(err)
            })
@@ -118,7 +182,6 @@
               })
            }
         }
      }
   }
</script>
@@ -128,6 +191,26 @@
   {
      background: #fff;
   }
   .s_inviter
   {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-top: 70rpx;
      width:100%;
      .s_img
      {
         display: flex;
         align-items: center;
         span{
            margin-left: 13rpx;
         };
      }
      image{
         width:100rpx;
         height: 100rpx;
      }
   }
   
   .yqmtip
   {