2022-04-29 17:23:40 +08:00
|
|
|
|
<template>
|
|
|
|
|
|
<view>
|
2022-07-10 19:58:22 +08:00
|
|
|
|
<!-- 顶部操作条 -->
|
|
|
|
|
|
<cu-custom :bgColor="'bg-main-color'" :isBack="false" :isBackHome="true" :homePageUrl="'/pages/index/index'" v-if="backIndex">
|
|
|
|
|
|
<block slot="backHomeText">首页</block>
|
|
|
|
|
|
<block slot="content">我的团队</block>
|
|
|
|
|
|
</cu-custom>
|
|
|
|
|
|
<cu-custom :bgColor="'bg-main-color'" :isBack="true" v-else>
|
2022-04-29 17:23:40 +08:00
|
|
|
|
<block slot="backText">返回</block>
|
|
|
|
|
|
<block slot="content">我的团队</block>
|
|
|
|
|
|
</cu-custom>
|
|
|
|
|
|
<!-- 团队成员 -->
|
2022-06-28 17:12:15 +08:00
|
|
|
|
<view>
|
|
|
|
|
|
<view class="bg-white padding bottom-border" v-for="(member, index) in members">
|
|
|
|
|
|
<view class="flex justify-between">
|
|
|
|
|
|
<view class="flex justify-start align-center" style="width: 40%;">
|
|
|
|
|
|
<view class="cu-avatar round"
|
2022-08-16 23:26:51 +08:00
|
|
|
|
: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>
|
2022-06-28 17:12:15 +08:00
|
|
|
|
</view>
|
|
|
|
|
|
<view class="flex justify-end align-center">
|
|
|
|
|
|
<view v-if="Boolean(member.showEditInput)" :key="member.workerId"
|
|
|
|
|
|
class="flex justify-end align-center margin-lr-sm">
|
|
|
|
|
|
<input class="radius-input" type="text" v-model="member.workerName"
|
|
|
|
|
|
placeholder="姓名备注"></input>
|
|
|
|
|
|
<view class="text-lg margin-left-sm">
|
|
|
|
|
|
<text class="cuIcon-roundcheckfill text-main-color" :data-index="index"
|
|
|
|
|
|
@click="editWorkerName"></text>
|
|
|
|
|
|
<text class="cuIcon-roundclosefill margin-left-xs" :data-index="index"
|
|
|
|
|
|
@click="hideEditInput"></text>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
<view v-else class="flex justify-end margin-lr-sm" :key="member.workerId">
|
|
|
|
|
|
<text>{{member.workerName ? member.workerName : ''}}</text>
|
|
|
|
|
|
<text class="text-lg" :data-index="index" @click="showEditInput"><text
|
|
|
|
|
|
class="cuIcon-edit margin-left-xs"></text></text>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
<view class="text-xxl text-main-color" :data-phone="member.phone" @click="makePhoneCall">
|
|
|
|
|
|
<view class="cuIcon-phone"></view>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
<load-status-bar class="margin-bottom-with-bar" ref="loadStatusBar" @loadMore="loadTeamPage"></load-status-bar>
|
|
|
|
|
|
<!-- 底部操作栏 -->
|
|
|
|
|
|
<view class="cu-bar bg-white tabbar border shop fixed-bottom-bar">
|
|
|
|
|
|
<view class="left-grid text-center" data-modal="takeRateSet" @click="showModalByRef('setTakeRateModal')">
|
|
|
|
|
|
<view>设置扣点</view>
|
|
|
|
|
|
<view v-if="curUserInfo.leaderTeamRate">(扣点:<text
|
|
|
|
|
|
class="text-red">{{Number(curUserInfo.leaderTeamRate)*100}}%</text>)</view>
|
|
|
|
|
|
</view>
|
2023-03-12 17:07:20 +08:00
|
|
|
|
<!-- <view class="bg-main-color submit" @click="showModalByRef('inviteMasterModal')">邀请团队</view> -->
|
|
|
|
|
|
<view class="bg-main-color submit" v-if="!certified">
|
|
|
|
|
|
<button class="cu-btn bg-main-color" style="width: 100%; height: 100%;" @click="noticeCertifyCheckedRes">
|
|
|
|
|
|
<text class="cuIcon-share"></text>
|
|
|
|
|
|
<text>邀请师傅</text>
|
|
|
|
|
|
</button>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
<view class="bg-main-color submit" v-else>
|
2022-06-28 17:12:15 +08:00
|
|
|
|
<button class="cu-btn bg-main-color" open-type="share" style="width: 100%; height: 100%;">
|
|
|
|
|
|
<text class="cuIcon-share"></text>
|
|
|
|
|
|
<text>邀请师傅</text>
|
|
|
|
|
|
</button>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
|
|
|
|
|
|
<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>
|
2022-12-02 02:27:42 +08:00
|
|
|
|
<confirm-modal ref="loginTipModal" :content="'当前无法加入团队,请先完成注册。如您已注册,请登录后重新点击此链接,完成加入团队。'" @confirm="goToPage('/pages/login/login?inviter=', inviteMasterObj, true)"></confirm-modal>
|
2023-03-12 17:07:20 +08:00
|
|
|
|
<confirm-modal ref="certifyTipModal" :content="'请前往完成师傅实名及银行账户绑定以激活'" @confirm="goToPage('/pages/index/index?menuCode=myPage')"></confirm-modal>
|
|
|
|
|
|
<!-- 账户及实名弹窗 -->
|
|
|
|
|
|
<vertify-certify ref="vertifyCertify"></vertify-certify>
|
|
|
|
|
|
<vertify-business-certify ref="vertifyBusinessCertify"></vertify-business-certify>
|
2022-04-29 17:23:40 +08:00
|
|
|
|
</view>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
2022-06-28 17:12:15 +08:00
|
|
|
|
<script>
|
|
|
|
|
|
import setTakeRate from '@/pages/area-proxy/modal/set-take-rate.vue';
|
|
|
|
|
|
import inviteMaster from '@/pages/area-proxy/modal/invite-master.vue';
|
|
|
|
|
|
import loadStatusBar from '@/components/custom-bar/load-status-bar.vue';
|
|
|
|
|
|
|
|
|
|
|
|
export default {
|
|
|
|
|
|
components: {
|
|
|
|
|
|
inviteMaster,
|
|
|
|
|
|
setTakeRate,
|
|
|
|
|
|
loadStatusBar
|
2022-06-01 18:18:33 +08:00
|
|
|
|
},
|
2022-04-29 17:23:40 +08:00
|
|
|
|
data() {
|
2022-07-10 19:58:22 +08:00
|
|
|
|
return {
|
|
|
|
|
|
backIndex: false,
|
2022-06-28 17:12:15 +08:00
|
|
|
|
members: [],
|
|
|
|
|
|
pageNum: 0,
|
|
|
|
|
|
pageSize: 0,
|
|
|
|
|
|
curUserInfo: {},
|
2023-03-12 17:07:20 +08:00
|
|
|
|
inviteMasterObj: {},
|
|
|
|
|
|
certified: false,
|
|
|
|
|
|
certifyInfo: null,
|
|
|
|
|
|
certifyCheckedMsg: ''
|
2022-06-28 17:12:15 +08:00
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
onLoad(options) {
|
|
|
|
|
|
if (options && options.inviteMasterObj) {
|
|
|
|
|
|
// 点击邀请链接进入的页面
|
|
|
|
|
|
this.beInvited2Team(JSON.parse(decodeURIComponent(options.inviteMasterObj)));
|
2022-07-10 19:58:22 +08:00
|
|
|
|
this.backIndex = true;
|
2022-06-28 17:12:15 +08:00
|
|
|
|
} else {
|
|
|
|
|
|
this.loadData();
|
2022-04-29 17:23:40 +08:00
|
|
|
|
}
|
2023-03-12 17:07:20 +08:00
|
|
|
|
},
|
|
|
|
|
|
onShow() {
|
|
|
|
|
|
this.checkCertify();
|
2022-04-29 17:23:40 +08:00
|
|
|
|
},
|
2022-06-28 17:12:15 +08:00
|
|
|
|
onShareAppMessage() {
|
|
|
|
|
|
return {
|
|
|
|
|
|
title: '邀请你成为我的团队成员',
|
|
|
|
|
|
path: '/pages/area-proxy/my-team?inviteMasterObj=' + encodeURIComponent(JSON.stringify(this.curUserInfo)),
|
2022-07-10 19:58:22 +08:00
|
|
|
|
imageUrl: 'http://gqz.opsoul.com/sys/group-selfie.png'
|
2022-06-28 17:12:15 +08:00
|
|
|
|
}
|
2022-04-29 17:23:40 +08:00
|
|
|
|
},
|
2022-06-28 17:12:15 +08:00
|
|
|
|
methods: {
|
2023-03-12 17:07:20 +08:00
|
|
|
|
async checkCertify() {
|
|
|
|
|
|
// 查询实名信息
|
|
|
|
|
|
let certifyInfoRes = await this.$request.getWorkerCertify();
|
|
|
|
|
|
this.certifyInfo = certifyInfoRes.data;
|
|
|
|
|
|
this.certified = true;
|
|
|
|
|
|
if (!this.certifyInfo || !this.certifyInfo.workerCertificationId) {
|
|
|
|
|
|
this.certified = false;
|
|
|
|
|
|
} else if (this.certifyInfo.status != 1) {
|
|
|
|
|
|
this.certified = false;
|
2023-03-18 23:59:22 +08:00
|
|
|
|
this.certifyCheckedMsg = '营业执照认证审核通过后才具备组建公司团队资质';
|
2023-03-12 17:07:20 +08:00
|
|
|
|
} else if (!this.certifyInfo.businessLicenseNum || !this.certifyInfo.businessLicenseUrl) {
|
|
|
|
|
|
this.certified = false;
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
noticeCertifyCheckedRes() {
|
2023-03-18 23:59:22 +08:00
|
|
|
|
if (!this.certifyInfo || !this.certifyInfo.workerCertificationId
|
|
|
|
|
|
|| !this.certifyInfo.businessLicenseNum || !this.certifyInfo.businessLicenseUrl) {
|
2023-03-12 17:07:20 +08:00
|
|
|
|
this.$refs.vertifyBusinessCertify.showModal();
|
|
|
|
|
|
} else {
|
|
|
|
|
|
uni.showToast({
|
|
|
|
|
|
icon: 'none',
|
|
|
|
|
|
title: this.certifyCheckedMsg,
|
|
|
|
|
|
duration: 2500
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
2022-06-28 17:12:15 +08:00
|
|
|
|
async beInvited2Team(inviteMasterObj) {
|
2022-06-30 16:49:12 +08:00
|
|
|
|
this.loadBasicData();
|
2022-06-28 17:12:15 +08:00
|
|
|
|
this.inviteMasterObj = inviteMasterObj;
|
2022-08-16 23:26:51 +08:00
|
|
|
|
// let curUserInfo = await this.login();
|
|
|
|
|
|
if (!this.curUserInfo) {
|
|
|
|
|
|
// 提示前往注册
|
2022-07-10 19:58:22 +08:00
|
|
|
|
this.showModalByRef('loginTipModal');
|
2022-06-28 17:12:15 +08:00
|
|
|
|
} else {
|
|
|
|
|
|
this.showModalByRef('inviteMasterModal');
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
2022-08-16 23:26:51 +08:00
|
|
|
|
// async login() {
|
2022-06-28 17:12:15 +08:00
|
|
|
|
// 更新缓存中的userInfo
|
2022-08-10 23:01:52 +08:00
|
|
|
|
// await this.$request.storageExistUser();
|
2022-06-28 17:12:15 +08:00
|
|
|
|
// 返回缓存中的userInfo
|
2022-08-16 23:26:51 +08:00
|
|
|
|
// return this.$request.getCurUserInfo();
|
|
|
|
|
|
// },
|
|
|
|
|
|
goToPage(pageUrl, obj, ifEncode) {
|
|
|
|
|
|
// console.log(JSON.stringify(obj))
|
|
|
|
|
|
let params = ifEncode ? encodeURIComponent(JSON.stringify(obj)) : JSON.stringify(obj);
|
2022-06-28 17:12:15 +08:00
|
|
|
|
uni.reLaunch({
|
2022-08-16 23:26:51 +08:00
|
|
|
|
url: pageUrl + params
|
2022-06-28 17:12:15 +08:00
|
|
|
|
})
|
2022-06-30 16:49:12 +08:00
|
|
|
|
},
|
|
|
|
|
|
loadBasicData() {
|
2022-07-09 18:41:34 +08:00
|
|
|
|
this.pageNum = this.$globalData.initPageNum;
|
2022-06-30 16:49:12 +08:00
|
|
|
|
this.pageSize = this.$globalData.initPageSize;
|
|
|
|
|
|
this.curUserInfo = this.$request.getCurUserInfo();
|
2022-06-28 17:12:15 +08:00
|
|
|
|
},
|
2022-04-29 17:23:40 +08:00
|
|
|
|
async loadData() {
|
2022-06-01 18:18:33 +08:00
|
|
|
|
// this.myTeamInfo = await this.$api.data('myTeamInfo');
|
2022-06-28 17:12:15 +08:00
|
|
|
|
// this.members = this.myTeamInfo.members;
|
2022-06-30 16:49:12 +08:00
|
|
|
|
this.loadBasicData();
|
2022-06-01 18:18:33 +08:00
|
|
|
|
this.loadTeamPage();
|
2022-06-28 17:12:15 +08:00
|
|
|
|
},
|
|
|
|
|
|
async reloadData() {
|
|
|
|
|
|
this.members = [];
|
|
|
|
|
|
this.loadData();
|
|
|
|
|
|
},
|
|
|
|
|
|
async loadTeamPage(params = {}) {
|
|
|
|
|
|
params.pageNum = this.pageNum;
|
2022-06-29 21:21:16 +08:00
|
|
|
|
params.pageSize = this.pageSize;
|
2022-08-16 23:26:51 +08:00
|
|
|
|
params.leaderId = this.curUserInfo.workerId;
|
|
|
|
|
|
params.workerId = null;
|
|
|
|
|
|
params.hasRegistered = true;
|
2022-06-28 17:12:15 +08:00
|
|
|
|
this.$refs.loadStatusBar.showLoading();
|
|
|
|
|
|
try {
|
|
|
|
|
|
let res = await this.$request.getTeamPage(params);
|
|
|
|
|
|
let rowsLength = res.rows.length;
|
|
|
|
|
|
if (rowsLength > 0) {
|
|
|
|
|
|
this.members = this.members.concat(res.rows);
|
|
|
|
|
|
this.pageNum++;
|
|
|
|
|
|
if (rowsLength === this.pageSize) {
|
2022-07-09 18:41:34 +08:00
|
|
|
|
this.$refs.loadStatusBar.showLoadMore();
|
|
|
|
|
|
return;
|
2022-06-28 17:12:15 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
this.$refs.loadStatusBar.showLoadOver();
|
|
|
|
|
|
} catch (e) {
|
|
|
|
|
|
console.error(e)
|
|
|
|
|
|
this.$refs.loadStatusBar.showLoadErr();
|
|
|
|
|
|
}
|
2022-04-29 17:23:40 +08:00
|
|
|
|
},
|
|
|
|
|
|
showEditInput(e) {
|
|
|
|
|
|
let curIndex = e.currentTarget.dataset.index;
|
|
|
|
|
|
this.$set(this.members, curIndex, Object.assign(this.members[curIndex], {
|
|
|
|
|
|
showEditInput: true
|
|
|
|
|
|
}))
|
|
|
|
|
|
},
|
|
|
|
|
|
hideEditInput(e) {
|
|
|
|
|
|
let curIndex = e.currentTarget.dataset.index;
|
|
|
|
|
|
this.$set(this.members, curIndex, Object.assign(this.members[curIndex], {
|
|
|
|
|
|
showEditInput: false
|
|
|
|
|
|
}))
|
|
|
|
|
|
},
|
2022-06-28 17:12:15 +08:00
|
|
|
|
async editWorkerName(e) {
|
|
|
|
|
|
let curIndex = e.currentTarget.dataset.index;
|
|
|
|
|
|
let memberInfo = this.members[curIndex];
|
|
|
|
|
|
let res = await this.$request.updateWorkerTeam({
|
|
|
|
|
|
workerTeamId: memberInfo.workerTeamId,
|
|
|
|
|
|
workerName: memberInfo.workerName
|
|
|
|
|
|
});
|
|
|
|
|
|
if (res.code === 0) {
|
|
|
|
|
|
uni.showToast({
|
|
|
|
|
|
title: '修改成功',
|
|
|
|
|
|
icon: 'success',
|
|
|
|
|
|
mask: true
|
|
|
|
|
|
});
|
|
|
|
|
|
this.hideEditInput(e);
|
2022-06-01 23:58:24 +08:00
|
|
|
|
}
|
2022-04-29 17:23:40 +08:00
|
|
|
|
},
|
|
|
|
|
|
makePhoneCall(e) {
|
|
|
|
|
|
let phoneNum = e.currentTarget.dataset.phone;
|
|
|
|
|
|
uni.makePhoneCall({
|
|
|
|
|
|
phoneNumber: phoneNum
|
|
|
|
|
|
})
|
2022-06-28 17:12:15 +08:00
|
|
|
|
},
|
|
|
|
|
|
showModalByRef(refName) {
|
|
|
|
|
|
this.$refs[refName].showModal();
|
|
|
|
|
|
},
|
|
|
|
|
|
async applySetTakeRate(params) {
|
|
|
|
|
|
let res = await this.$request.updateWorker(params);
|
|
|
|
|
|
if (res.code === 0) {
|
|
|
|
|
|
uni.showToast({
|
|
|
|
|
|
title: '保存成功',
|
|
|
|
|
|
icon: 'success',
|
|
|
|
|
|
mask: true
|
|
|
|
|
|
});
|
|
|
|
|
|
this.reloadData();
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
async inviteMaster(params) {
|
|
|
|
|
|
let res = await this.$request.addTeam(params);
|
|
|
|
|
|
if (res.code === 0) {
|
|
|
|
|
|
uni.showToast({
|
2022-06-30 16:49:12 +08:00
|
|
|
|
title: '加入成功',
|
2022-06-28 17:12:15 +08:00
|
|
|
|
icon: 'success',
|
|
|
|
|
|
mask: true
|
2022-06-30 16:49:12 +08:00
|
|
|
|
})
|
2022-08-16 23:26:51 +08:00
|
|
|
|
this.reloadData();
|
|
|
|
|
|
if (this.curUserInfo.status !== 0) {
|
|
|
|
|
|
// 提示前往绑卡和实名已生效
|
|
|
|
|
|
this.showModalByRef('certifyTipModal');
|
|
|
|
|
|
}
|
2022-06-30 16:49:12 +08:00
|
|
|
|
} else if (res.code === 301) {
|
|
|
|
|
|
uni.showToast({
|
|
|
|
|
|
title: res.msg,
|
|
|
|
|
|
icon: 'none',
|
|
|
|
|
|
mask: true
|
|
|
|
|
|
})
|
2022-06-28 17:12:15 +08:00
|
|
|
|
}
|
2022-04-29 17:23:40 +08:00
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
}
|
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
<style scoped>
|
|
|
|
|
|
.left-grid {
|
|
|
|
|
|
width: 50%;
|
2022-06-28 17:12:15 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.bottom-border {
|
|
|
|
|
|
border-bottom: 1rpx solid rgba(0, 0, 0, 0.1);
|
2022-04-29 17:23:40 +08:00
|
|
|
|
}
|
|
|
|
|
|
</style>
|