师傅邀请流程修改
This commit is contained in:
parent
7ce564b1e8
commit
a61bf0401a
|
|
@ -23,7 +23,7 @@ export default {
|
|||
if (args.data instanceof Object) {
|
||||
args.data.deptId = globalData.deptId;
|
||||
args.data.from = globalData.from;
|
||||
if (!args.data.workerId && userInfo && userInfo.workerId) {
|
||||
if (args.data.workerId === undefined && userInfo && userInfo.workerId) {
|
||||
args.data.workerId = userInfo.workerId;
|
||||
}
|
||||
}
|
||||
|
|
@ -89,10 +89,10 @@ export default {
|
|||
let userInfo = await wx.getUserProfile({
|
||||
desc: '用于小程序登录'
|
||||
});
|
||||
console.log("从微信获取基本用户信息:" + userInfo);
|
||||
// console.log("从微信获取基本用户信息:" + userInfo);
|
||||
// 获取微信登录凭证
|
||||
const wxLoginRes = await wx.login();
|
||||
console.log(wxLoginRes)
|
||||
// console.log(wxLoginRes)
|
||||
// 获取openid
|
||||
const wxAuthRes = await uni.request({
|
||||
url: '/wx/auth',
|
||||
|
|
@ -100,7 +100,7 @@ export default {
|
|||
code: wxLoginRes.code
|
||||
}
|
||||
})
|
||||
console.log(wxAuthRes)
|
||||
// console.log(wxAuthRes)
|
||||
const openId = wxAuthRes[1].data.data.openid;
|
||||
// 第一次从服务端获取用户信息
|
||||
let wxGetUserRes = await this.qryUserInfo(openId);
|
||||
|
|
@ -124,7 +124,7 @@ export default {
|
|||
wxLoginCode: wxLoginRes.code
|
||||
}
|
||||
}
|
||||
console.log("通过后台服务获取用户信息:" + userInfo);
|
||||
// console.log("通过后台服务获取用户信息:" + userInfo);
|
||||
if (!userInfo || userInfo.workerId == null || userInfo.workerId == undefined) {
|
||||
uni.showToast({
|
||||
icon: 'none',
|
||||
|
|
@ -265,6 +265,9 @@ export default {
|
|||
let userProfile = uni.getStorageSync('userProfile');
|
||||
return userProfile;
|
||||
},
|
||||
updateCache(cacheKey, cacheVal) {
|
||||
uni.setStorageSync(cacheKey, cacheVal);
|
||||
},
|
||||
async getCurUserNoCache() {
|
||||
let userInfo = this.getCurUserInfo();
|
||||
let wxGetUserRes = await this.qryUserInfo(userInfo.openId);
|
||||
|
|
|
|||
|
|
@ -48,10 +48,10 @@
|
|||
}
|
||||
},
|
||||
methods: {
|
||||
showModal(e) {
|
||||
showModal() {
|
||||
this.isShow = true
|
||||
},
|
||||
hideModal(e) {
|
||||
hideModal() {
|
||||
this.isShow = false;
|
||||
this.resetData();
|
||||
},
|
||||
|
|
|
|||
|
|
@ -16,7 +16,10 @@
|
|||
<view class="flex justify-start align-center" style="width: 40%;">
|
||||
<view class="cu-avatar round"
|
||||
:style="'background-image:url(' + member.workerLogoUrl + ');min-width: 64rpx'"></view>
|
||||
<view class="flex-column-between">
|
||||
<view class="text-lg margin-left-sm">{{member.name}}</view>
|
||||
<view class="cu-tag bg-red radius light margin-left-sm margin-top-xs" v-if="member.workerStatus !== 0">未实名或绑卡</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="flex justify-end align-center">
|
||||
<view v-if="Boolean(member.showEditInput)" :key="member.workerId"
|
||||
|
|
@ -62,8 +65,8 @@
|
|||
<set-take-rate ref="setTakeRateModal" :leaderTeamRate="Number(curUserInfo.leaderTeamRate)*100"
|
||||
:leaderTeamMoney="curUserInfo.leaderTeamMoney" @confirm="applySetTakeRate"></set-take-rate>
|
||||
<invite-master ref="inviteMasterModal" :inviteMasterObj="inviteMasterObj" @confirm="inviteMaster"></invite-master>
|
||||
<confirm-modal ref="loginTipModal" :content="'当前无法加入师傅团队,请先登录。'" @confirm="goToPage('/pages/index/index')"></confirm-modal>
|
||||
<confirm-modal ref="certifyTipModal" :content="'当前无法加入师傅团队,请先完成师傅实名及银行账户绑定。'" @confirm="goToPage('/pages/index/index?menuCode=myPage')"></confirm-modal>
|
||||
<confirm-modal ref="loginTipModal" :content="'当前无法加入师傅团队,请完成注册。'" @confirm="goToPage('/pages/login/login?inviter=', inviteMasterObj, true)"></confirm-modal>
|
||||
<confirm-modal ref="certifyTipModal" :content="'请前往完成师傅实名及银行账户绑定以激活'" @confirm="goToPage('/pages/index/index?menuCode=myPage')"></confirm-modal>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
|
|
@ -108,26 +111,25 @@
|
|||
async beInvited2Team(inviteMasterObj) {
|
||||
this.loadBasicData();
|
||||
this.inviteMasterObj = inviteMasterObj;
|
||||
let curUserInfo = await this.login();
|
||||
if (!curUserInfo) {
|
||||
// 提示登录,返回首页
|
||||
// let curUserInfo = await this.login();
|
||||
if (!this.curUserInfo) {
|
||||
// 提示前往注册
|
||||
this.showModalByRef('loginTipModal');
|
||||
} else if (curUserInfo.status !== 0) {
|
||||
// 提示绑卡和实名,返回首页
|
||||
this.showModalByRef('certifyTipModal');
|
||||
} else {
|
||||
this.showModalByRef('inviteMasterModal');
|
||||
}
|
||||
},
|
||||
async login() {
|
||||
// async login() {
|
||||
// 更新缓存中的userInfo
|
||||
// await this.$request.storageExistUser();
|
||||
// 返回缓存中的userInfo
|
||||
return this.$request.getCurUserInfo();
|
||||
},
|
||||
goToPage(pageUrl) {
|
||||
// return this.$request.getCurUserInfo();
|
||||
// },
|
||||
goToPage(pageUrl, obj, ifEncode) {
|
||||
// console.log(JSON.stringify(obj))
|
||||
let params = ifEncode ? encodeURIComponent(JSON.stringify(obj)) : JSON.stringify(obj);
|
||||
uni.reLaunch({
|
||||
url: pageUrl
|
||||
url: pageUrl + params
|
||||
})
|
||||
},
|
||||
loadBasicData() {
|
||||
|
|
@ -149,6 +151,8 @@
|
|||
params.pageNum = this.pageNum;
|
||||
params.pageSize = this.pageSize;
|
||||
params.leaderId = this.curUserInfo.workerId;
|
||||
params.workerId = null;
|
||||
params.hasRegistered = true;
|
||||
this.$refs.loadStatusBar.showLoading();
|
||||
try {
|
||||
let res = await this.$request.getTeamPage(params);
|
||||
|
|
@ -224,6 +228,10 @@
|
|||
mask: true
|
||||
})
|
||||
this.reloadData();
|
||||
if (this.curUserInfo.status !== 0) {
|
||||
// 提示前往绑卡和实名已生效
|
||||
this.showModalByRef('certifyTipModal');
|
||||
}
|
||||
} else if (res.code === 301) {
|
||||
uni.showToast({
|
||||
title: res.msg,
|
||||
|
|
|
|||
|
|
@ -172,7 +172,6 @@
|
|||
// let res = await this.$request.storageExistUser();
|
||||
// 获取缓存中的userInfo
|
||||
let curUserInfo = this.$request.getCurUserInfo();
|
||||
console.log(curUserInfo)
|
||||
// 校验提示登录
|
||||
// if (!curUserInfo || !curUserInfo.openId) {
|
||||
// this.$refs.vertifyLogin.showModal();
|
||||
|
|
|
|||
|
|
@ -82,7 +82,6 @@
|
|||
// let res = await this.$request.storageExistUser();
|
||||
// 获取缓存中的userInfo
|
||||
let curUserInfo = this.$request.getCurUserInfo();
|
||||
console.log(curUserInfo)
|
||||
// 校验提示登录
|
||||
// if (!curUserInfo || !curUserInfo.openId) {
|
||||
// this.$refs.vertifyLogin.showModal();
|
||||
|
|
|
|||
|
|
@ -80,23 +80,36 @@
|
|||
|
||||
<!-- 登录校验弹窗 -->
|
||||
<vertify-login ref="vertifyLogin" @reload="authLogin"></vertify-login>
|
||||
<!-- 加入师傅团队提示 -->
|
||||
<!-- <invite-master ref="inviteMasterModal" :inviteMasterObj="inviter" @confirm="inviteMaster"></invite-master> -->
|
||||
<confirm-modal ref="inviteMasterModal" :content="'是否确认加入' + inviter.name + '的团队?'" @confirm="inviteMaster(inviter)"></confirm-modal>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
// import inviteMaster from '../area-proxy/modal/invite-master.vue'
|
||||
|
||||
export default {
|
||||
components: {
|
||||
// inviteMaster
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
pageContentTop: this.CustomBar,
|
||||
operType: 0, // 0为登录,1为注册
|
||||
countDownNum: 0,
|
||||
agreeContract: false,
|
||||
formData: {}
|
||||
formData: {},
|
||||
inviter: {}
|
||||
}
|
||||
},
|
||||
onLoad(options) {
|
||||
if (options && options.operType) {
|
||||
if (options) {
|
||||
if (options.operType) {
|
||||
this.operType = Number(options.operType)
|
||||
} else if (options.inviter) {
|
||||
this.inviter = JSON.parse(decodeURIComponent(options.inviter));
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
|
@ -123,6 +136,10 @@
|
|||
return false;
|
||||
} else {
|
||||
this.$refs.vertifyLogin.hideModal();
|
||||
this.$request.updateCache('userProfile', curUserInfo);
|
||||
if (this.inviter && this.inviter.workerId) {
|
||||
this.$refs.inviteMasterModal.showModal();
|
||||
}
|
||||
}
|
||||
return true;
|
||||
},
|
||||
|
|
@ -269,6 +286,29 @@
|
|||
title: '注册失败'
|
||||
})
|
||||
}
|
||||
},
|
||||
async inviteMaster(params) {
|
||||
let res = await this.$request.addTeam({
|
||||
leaderId: params.workerId,
|
||||
workerId: this.$request.getCurUserInfo().workerId,
|
||||
});
|
||||
if (res.code === 0) {
|
||||
uni.showToast({
|
||||
title: '预加入成功,请完成注册登录及信息完善以激活',
|
||||
icon: 'none',
|
||||
duration: 4000
|
||||
})
|
||||
} else if (res.msg) {
|
||||
uni.showToast({
|
||||
title: res.msg,
|
||||
icon: 'none'
|
||||
})
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: '预加入失败',
|
||||
icon: 'error'
|
||||
})
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
|
|
|
|||
|
|
@ -476,7 +476,9 @@
|
|||
},
|
||||
async loadTeamMembers() {
|
||||
let res = await this.$request.getTeamPage({
|
||||
leaderId: this.curUserInfo.workerId
|
||||
leaderId: this.curUserInfo.workerId,
|
||||
workerStatus: 0,
|
||||
workerId: null
|
||||
});
|
||||
this.myTeamMembers = res.rows;
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in New Issue