<template style="background:#fff">
|
<view class="invite-code-container colCen borderBox">
|
<view class="model-title rowCenCen">
|
请输入邀请码
|
</view>
|
<view class="grey-input-content rowCen borderBox">
|
<input class="iptclas" type="text" v-model="inviteCode" placeholder="请填写邀请码" placeholder-class="pla-input"/>
|
</view>
|
<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>
|
|
<view class="yqmtip rowCenCen">
|
<span @click="showinvite">没有邀请码?</span>
|
</view>
|
<u-popup v-model="inviterShow" mode="center" border-radius="32" v-if="inviterShow" :mask-close-able='true'>
|
<inviter-model ref='invitermodel' @rewrite='rewriteCode' @setInvite='setCodebtn'></inviter-model>
|
</u-popup>
|
|
</view>
|
</template>
|
|
<script>
|
import inviterModel from '../../components/inviterModel.vue'
|
import util from '../../utils/utils.js'
|
export default {
|
components: {
|
inviterModel
|
},
|
data(){
|
return{
|
isShowCode:false,
|
inviteCode:'',
|
appInfo:'',
|
inviterShow:false
|
}
|
},
|
mounted() {
|
this.appInfo = uni.getStorageSync('appInfo')
|
},
|
methods: {
|
useCode()
|
{
|
this.inviteCode=this.appInfo.officialInvitationCode;
|
},
|
rewriteCode()
|
{
|
this.inviterShow=false;
|
},
|
setCodebtn(){
|
this.inviterShow=false;
|
this.getuserInfo()
|
},
|
showinvite() {
|
var that=this;
|
uni.showModal({
|
title: '温馨提示',
|
content: "您可向推荐您使用大返官的好友获取邀请码~",
|
cancelText:'没有推荐人',
|
confirmText:'联系推荐人',
|
success:function(res)
|
{
|
that.isShowCode=res.cancel;
|
console.log(that.isShowCode)
|
}
|
});
|
},
|
getuserInfo() {
|
var that = this;
|
this.$u.api.getUserInfo({}).then(e => {
|
console.log(e)
|
util.setCache('userInfo', e.data.userinfo);
|
if (e.data.userinfo.isPwd == 'N') {
|
uni.redirectTo({
|
url: './setPass'
|
})
|
} else {
|
uni.switchTab({
|
url: '../index/index'
|
})
|
}
|
}).catch(function (err) {
|
console.log(err)
|
})
|
},
|
setCode()
|
{
|
var that=this;
|
if(this.inviteCode)
|
{
|
this.$u.api.getInviteInfo({
|
invite_code:this.inviteCode
|
}).then(e => {
|
console.log(e)
|
if(e.code != 0) return that.$alert(e.msg)
|
uni.setStorageSync('inviterInfo',e.data)
|
this.inviterShow = true
|
}).catch(function (err) {
|
})
|
}
|
}
|
|
}
|
}
|
</script>
|
|
<style lang="scss">
|
body
|
{
|
background: #fff;
|
}
|
|
.yqmtip
|
{
|
width: 100%;
|
position: fixed;
|
bottom: 100rpx;
|
bottom: calc(100rpx + constant(safe-area-inset-bottom));
|
bottom: env(100rpx + constant(safe-area-inset-bottom));
|
left: 0;
|
z-index: 1;
|
color: #999999;
|
}
|
.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;
|
}
|
}
|
.colorfulbtn {
|
background: #FD002F;
|
pointer-events: auto;
|
}
|
.invite-code-container{
|
background: #FFFFFF;
|
padding: 0 46rpx;
|
.model-title{
|
width: 100%;
|
height: 135rpx;
|
font-size: 54rpx;
|
font-weight: 500;
|
color: #333333;
|
margin-top: 250rpx;
|
}
|
.grey-input-content{
|
width: 100%;
|
height: 90rpx;
|
background: #F8F8F8;
|
border-radius: 45rpx;
|
padding: 0 21rpx;
|
margin-bottom: 35rpx;
|
.iptclas{
|
flex: 1;
|
}
|
.pla-input{
|
font-size: 28rpx;
|
font-weight: 500;
|
color: #999999;
|
}
|
}
|
|
.btn-bar{
|
width: 100%;
|
margin-bottom: 50rpx;
|
.close-btn{
|
width: 263rpx;
|
height: 90rpx;
|
background: #F7F7F7;
|
border: 1rpx solid #CBCBC9;
|
border-radius: 45rpx;
|
font-size: 28rpx;
|
font-weight: 500;
|
color: #999999;
|
}
|
.next-btn{
|
width: 263rpx;
|
height: 90rpx;
|
background: #CBCBC9;
|
border-radius: 45rpx;
|
font-size: 28rpx;
|
font-weight: 500;
|
color: #FFFFFF;
|
}
|
.pinkbtn{
|
background-color: #FD002F;
|
}
|
}
|
|
.model-tips{
|
width: 100%;
|
font-size: 24rpx;
|
font-weight: 500;
|
color: #999999;
|
margin-bottom: 25rpx;
|
}
|
|
.copy-bar{
|
width: 100%;
|
height: 72rpx;
|
background: #F8F8F8;
|
border-radius: 12rpx;
|
margin-bottom: 30rpx;
|
padding: 0 20rpx;
|
.left-code{
|
font-size: 26rpx;
|
font-weight: 500;
|
color: #FF002C;
|
}
|
.copybtn{
|
width: 158rpx;
|
height: 54rpx;
|
background: #FFFFFF;
|
border-radius: 12rpx;
|
font-size: 26rpx;
|
font-weight: 500;
|
color: #333333;
|
}
|
}
|
}
|
</style>
|