师傅邀请流程修改

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) {
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);

View File

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

View File

@ -15,8 +15,11 @@
<view class="flex justify-between">
<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="text-lg margin-left-sm">{{member.name}}</view>
: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() {
@ -148,7 +150,9 @@
async loadTeamPage(params = {}) {
params.pageNum = this.pageNum;
params.pageSize = this.pageSize;
params.leaderId = this.curUserInfo.workerId;
params.leaderId = this.curUserInfo.workerId;
params.workerId = null;
params.hasRegistered = true;
this.$refs.loadStatusBar.showLoading();
try {
let res = await this.$request.getTeamPage(params);
@ -223,7 +227,11 @@
icon: 'success',
mask: true
})
this.reloadData();
this.reloadData();
if (this.curUserInfo.status !== 0) {
//
this.showModalByRef('certifyTipModal');
}
} else if (res.code === 301) {
uni.showToast({
title: res.msg,

View File

@ -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();

View File

@ -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();

View File

@ -79,24 +79,37 @@
</view>
<!-- 登录校验弹窗 -->
<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>
</template>
<script>
export default {
<script>
// import inviteMaster from '../area-proxy/modal/invite-master.vue'
export default {
components: {
// inviteMaster
},
data() {
return {
pageContentTop: this.CustomBar,
operType: 0, // 01
countDownNum: 0,
agreeContract: false,
formData: {}
formData: {},
inviter: {}
}
},
onLoad(options) {
if (options && options.operType) {
this.operType = Number(options.operType)
onLoad(options) {
if (options) {
if (options.operType) {
this.operType = Number(options.operType)
} else if (options.inviter) {
this.inviter = JSON.parse(decodeURIComponent(options.inviter));
}
}
},
methods: {
@ -122,7 +135,11 @@
this.$refs.vertifyLogin.showModal();
return false;
} 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;
},
@ -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'
})
}
}
},
}

View File

@ -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;
},