师傅邀请流程修改

This commit is contained in:
donqi 2022-08-16 23:26:51 +08:00
parent 7ce564b1e8
commit a61bf0401a
7 changed files with 86 additions and 35 deletions

View File

@ -23,7 +23,7 @@ export default {
if (args.data instanceof Object) { if (args.data instanceof Object) {
args.data.deptId = globalData.deptId; args.data.deptId = globalData.deptId;
args.data.from = globalData.from; 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; args.data.workerId = userInfo.workerId;
} }
} }
@ -89,10 +89,10 @@ export default {
let userInfo = await wx.getUserProfile({ let userInfo = await wx.getUserProfile({
desc: '用于小程序登录' desc: '用于小程序登录'
}); });
console.log("从微信获取基本用户信息:" + userInfo); // console.log("从微信获取基本用户信息:" + userInfo);
// 获取微信登录凭证 // 获取微信登录凭证
const wxLoginRes = await wx.login(); const wxLoginRes = await wx.login();
console.log(wxLoginRes) // console.log(wxLoginRes)
// 获取openid // 获取openid
const wxAuthRes = await uni.request({ const wxAuthRes = await uni.request({
url: '/wx/auth', url: '/wx/auth',
@ -100,7 +100,7 @@ export default {
code: wxLoginRes.code code: wxLoginRes.code
} }
}) })
console.log(wxAuthRes) // console.log(wxAuthRes)
const openId = wxAuthRes[1].data.data.openid; const openId = wxAuthRes[1].data.data.openid;
// 第一次从服务端获取用户信息 // 第一次从服务端获取用户信息
let wxGetUserRes = await this.qryUserInfo(openId); let wxGetUserRes = await this.qryUserInfo(openId);
@ -124,7 +124,7 @@ export default {
wxLoginCode: wxLoginRes.code wxLoginCode: wxLoginRes.code
} }
} }
console.log("通过后台服务获取用户信息:" + userInfo); // console.log("通过后台服务获取用户信息:" + userInfo);
if (!userInfo || userInfo.workerId == null || userInfo.workerId == undefined) { if (!userInfo || userInfo.workerId == null || userInfo.workerId == undefined) {
uni.showToast({ uni.showToast({
icon: 'none', icon: 'none',
@ -265,6 +265,9 @@ export default {
let userProfile = uni.getStorageSync('userProfile'); let userProfile = uni.getStorageSync('userProfile');
return userProfile; return userProfile;
}, },
updateCache(cacheKey, cacheVal) {
uni.setStorageSync(cacheKey, cacheVal);
},
async getCurUserNoCache() { async getCurUserNoCache() {
let userInfo = this.getCurUserInfo(); let userInfo = this.getCurUserInfo();
let wxGetUserRes = await this.qryUserInfo(userInfo.openId); let wxGetUserRes = await this.qryUserInfo(userInfo.openId);

View File

@ -48,10 +48,10 @@
} }
}, },
methods: { methods: {
showModal(e) { showModal() {
this.isShow = true this.isShow = true
}, },
hideModal(e) { hideModal() {
this.isShow = false; this.isShow = false;
this.resetData(); this.resetData();
}, },

View File

@ -16,7 +16,10 @@
<view class="flex justify-start align-center" style="width: 40%;"> <view class="flex justify-start align-center" style="width: 40%;">
<view class="cu-avatar round" <view class="cu-avatar round"
:style="'background-image:url(' + member.workerLogoUrl + ');min-width: 64rpx'"></view> :style="'background-image:url(' + member.workerLogoUrl + ');min-width: 64rpx'"></view>
<view class="text-lg margin-left-sm">{{member.name}}</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>
<view class="flex justify-end align-center"> <view class="flex justify-end align-center">
<view v-if="Boolean(member.showEditInput)" :key="member.workerId" <view v-if="Boolean(member.showEditInput)" :key="member.workerId"
@ -62,8 +65,8 @@
<set-take-rate ref="setTakeRateModal" :leaderTeamRate="Number(curUserInfo.leaderTeamRate)*100" <set-take-rate ref="setTakeRateModal" :leaderTeamRate="Number(curUserInfo.leaderTeamRate)*100"
:leaderTeamMoney="curUserInfo.leaderTeamMoney" @confirm="applySetTakeRate"></set-take-rate> :leaderTeamMoney="curUserInfo.leaderTeamMoney" @confirm="applySetTakeRate"></set-take-rate>
<invite-master ref="inviteMasterModal" :inviteMasterObj="inviteMasterObj" @confirm="inviteMaster"></invite-master> <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="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> <confirm-modal ref="certifyTipModal" :content="'请前往完成师傅实名及银行账户绑定以激活'" @confirm="goToPage('/pages/index/index?menuCode=myPage')"></confirm-modal>
</view> </view>
</template> </template>
@ -108,26 +111,25 @@
async beInvited2Team(inviteMasterObj) { async beInvited2Team(inviteMasterObj) {
this.loadBasicData(); this.loadBasicData();
this.inviteMasterObj = inviteMasterObj; this.inviteMasterObj = inviteMasterObj;
let curUserInfo = await this.login(); // let curUserInfo = await this.login();
if (!curUserInfo) { if (!this.curUserInfo) {
// //
this.showModalByRef('loginTipModal'); this.showModalByRef('loginTipModal');
} else if (curUserInfo.status !== 0) {
//
this.showModalByRef('certifyTipModal');
} else { } else {
this.showModalByRef('inviteMasterModal'); this.showModalByRef('inviteMasterModal');
} }
}, },
async login() { // async login() {
// userInfo // userInfo
// await this.$request.storageExistUser(); // await this.$request.storageExistUser();
// userInfo // userInfo
return this.$request.getCurUserInfo(); // return this.$request.getCurUserInfo();
}, // },
goToPage(pageUrl) { goToPage(pageUrl, obj, ifEncode) {
// console.log(JSON.stringify(obj))
let params = ifEncode ? encodeURIComponent(JSON.stringify(obj)) : JSON.stringify(obj);
uni.reLaunch({ uni.reLaunch({
url: pageUrl url: pageUrl + params
}) })
}, },
loadBasicData() { loadBasicData() {
@ -149,6 +151,8 @@
params.pageNum = this.pageNum; params.pageNum = this.pageNum;
params.pageSize = this.pageSize; params.pageSize = this.pageSize;
params.leaderId = this.curUserInfo.workerId; params.leaderId = this.curUserInfo.workerId;
params.workerId = null;
params.hasRegistered = true;
this.$refs.loadStatusBar.showLoading(); this.$refs.loadStatusBar.showLoading();
try { try {
let res = await this.$request.getTeamPage(params); let res = await this.$request.getTeamPage(params);
@ -224,6 +228,10 @@
mask: true mask: true
}) })
this.reloadData(); this.reloadData();
if (this.curUserInfo.status !== 0) {
//
this.showModalByRef('certifyTipModal');
}
} else if (res.code === 301) { } else if (res.code === 301) {
uni.showToast({ uni.showToast({
title: res.msg, title: res.msg,

View File

@ -172,7 +172,6 @@
// let res = await this.$request.storageExistUser(); // let res = await this.$request.storageExistUser();
// userInfo // userInfo
let curUserInfo = this.$request.getCurUserInfo(); let curUserInfo = this.$request.getCurUserInfo();
console.log(curUserInfo)
// //
// if (!curUserInfo || !curUserInfo.openId) { // if (!curUserInfo || !curUserInfo.openId) {
// this.$refs.vertifyLogin.showModal(); // this.$refs.vertifyLogin.showModal();

View File

@ -82,7 +82,6 @@
// let res = await this.$request.storageExistUser(); // let res = await this.$request.storageExistUser();
// userInfo // userInfo
let curUserInfo = this.$request.getCurUserInfo(); let curUserInfo = this.$request.getCurUserInfo();
console.log(curUserInfo)
// //
// if (!curUserInfo || !curUserInfo.openId) { // if (!curUserInfo || !curUserInfo.openId) {
// this.$refs.vertifyLogin.showModal(); // this.$refs.vertifyLogin.showModal();

View File

@ -80,23 +80,36 @@
<!-- 登录校验弹窗 --> <!-- 登录校验弹窗 -->
<vertify-login ref="vertifyLogin" @reload="authLogin"></vertify-login> <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> </view>
</template> </template>
<script> <script>
// import inviteMaster from '../area-proxy/modal/invite-master.vue'
export default { export default {
components: {
// inviteMaster
},
data() { data() {
return { return {
pageContentTop: this.CustomBar, pageContentTop: this.CustomBar,
operType: 0, // 01 operType: 0, // 01
countDownNum: 0, countDownNum: 0,
agreeContract: false, agreeContract: false,
formData: {} formData: {},
inviter: {}
} }
}, },
onLoad(options) { onLoad(options) {
if (options && options.operType) { if (options) {
this.operType = Number(options.operType) if (options.operType) {
this.operType = Number(options.operType)
} else if (options.inviter) {
this.inviter = JSON.parse(decodeURIComponent(options.inviter));
}
} }
}, },
methods: { methods: {
@ -123,6 +136,10 @@
return false; return false;
} else { } else {
this.$refs.vertifyLogin.hideModal(); this.$refs.vertifyLogin.hideModal();
this.$request.updateCache('userProfile', curUserInfo);
if (this.inviter && this.inviter.workerId) {
this.$refs.inviteMasterModal.showModal();
}
} }
return true; return true;
}, },
@ -269,6 +286,29 @@
title: '注册失败' 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'
})
}
} }
}, },
} }

View File

@ -476,7 +476,9 @@
}, },
async loadTeamMembers() { async loadTeamMembers() {
let res = await this.$request.getTeamPage({ let res = await this.$request.getTeamPage({
leaderId: this.curUserInfo.workerId leaderId: this.curUserInfo.workerId,
workerStatus: 0,
workerId: null
}); });
this.myTeamMembers = res.rows; this.myTeamMembers = res.rows;
}, },