| | |
| | | 请输入邀请码 |
| | | </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> |
| | |
| | | inviteCode:'', |
| | | appInfo:'', |
| | | inviterShow:false, |
| | | platform:'' |
| | | platform:'', |
| | | commonInvite:[], |
| | | inviteIndex:0 |
| | | } |
| | | }, |
| | | onLoad() |
| | | { |
| | | this.getInviter(); |
| | | }, |
| | | mounted() { |
| | | 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; |
| | |
| | | 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' |
| | | }) |
| | |
| | | uni.switchTab({ |
| | | url: '../index/index' |
| | | }) |
| | | } |
| | | }*/ |
| | | }).catch(function (err) { |
| | | console.log(err) |
| | | }) |
| | | }, |
| | | setCode() |
| | | { |
| | | console.log("确定"); |
| | | var that=this; |
| | | if(this.inviteCode) |
| | | { |
| | |
| | | console.log(e) |
| | | if(e.code != 0) return that.$alert(e.msg) |
| | | uni.setStorageSync('inviterInfo',e.data) |
| | | this.inviterShow = true |
| | | //this.inviterShow = true |
| | | this.setinvite(); |
| | | }).catch(function (err) { |
| | | }) |
| | | } |
| | | } |
| | | |
| | | }, |
| | | setinvite() { |
| | | var that = this; |
| | | let deviceInfo = uni.getDeviceInfo(); |
| | | console.log(deviceInfo.deviceId); |
| | | this.$u.api.bindInvitation({ |
| | | invite_code:this.inviteCode, |
| | | deviceid:deviceInfo.deviceId |
| | | }).then(e => { |
| | | if(e.code != 0) return that.$alert(e.msg) |
| | | uni.showToast({ |
| | | title:'绑定成功!', |
| | | icon:'none' |
| | | }) |
| | | setTimeout(function(){ |
| | | that.getuserInfo(); |
| | | },1000) |
| | | }).catch(function (err) { |
| | | }) |
| | | |
| | | }, |
| | | } |
| | | } |
| | | </script> |
| | |
| | | { |
| | | 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 |
| | | { |