师傅通过分享链接邀请其他师傅加入团队,登录带参数问题修复

This commit is contained in:
donqi 2022-06-28 17:12:15 +08:00
parent 7cc29e8168
commit 524690b2b4
5 changed files with 212 additions and 159 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) { if (!args.data.workerId && userInfo && userInfo.workerId) {
args.data.workerId = userInfo.workerId; args.data.workerId = userInfo.workerId;
} }
} }

View File

@ -7,9 +7,8 @@
{{content}} {{content}}
</view> </view>
<view class="cu-bar bg-white"> <view class="cu-bar bg-white">
<view class="action margin-0 flex-sub text-black" @tap="hideModal" @click="cancelCallback">{{cancelMsg}}</view> <view class="action margin-0 flex-sub text-black" @tap="hideModal">{{cancelMsg}}</view>
<view class="action margin-0 flex-sub text-main-color solid-left" @tap="hideModal" <view class="action margin-0 flex-sub text-main-color solid-left" @click="confirmCallback">{{confirmMsg}}</view>
@click="confirmCallback">{{confirmMsg}}</view>
</view> </view>
</view> </view>
</view> </view>
@ -19,6 +18,7 @@
<script> <script>
export default { export default {
name: 'confirm-modal', name: 'confirm-modal',
emits: ["confirm", 'cancel'],
props: { props: {
content: { content: {
type: String, type: String,
@ -31,10 +31,6 @@
confirmMsg: { confirmMsg: {
type: String, type: String,
default: '确定' default: '确定'
},
cancelCallback: {
type: Boolean,
default: false
} }
}, },
data() { data() {
@ -47,13 +43,12 @@
this.isShow = true this.isShow = true
}, },
hideModal(e) { hideModal(e) {
this.isShow = false this.$emit('cancel');
this.isShow = false;
}, },
confirmCallback(e) { confirmCallback(e) {
uni.$emit(this.$globalFun.CONFIRM); this.$emit('confirm');
}, this.hideModal();
cancelCallback(e) {
uni.$emit(this.$globalFun.CANCEL);
} }
} }
} }

View File

@ -8,20 +8,23 @@
<text class="cuIcon-close text-red"></text> <text class="cuIcon-close text-red"></text>
</view> </view>
</view> </view>
<view class="padding-xl text-left"> <view class="padding-xl text-left bg-white">
<view class="margin-top-sm"> <!-- <view class="margin-top-sm">
<text>团队成员师傅ID</text> <text>团队成员师傅ID</text>
<input class="radius-input margin-top-sm" type="text" v-model="workerId"></input> <input class="radius-input margin-top-sm" type="text" v-model="workerId"></input>
</view> </view> -->
<view class="margin-top-sm"> <!-- <view>
<text>成员师傅备注</text> <text>成员师傅备注</text>
<input class="radius-input margin-top-sm" type="text" v-model="workerName"></input> <input class="radius-input margin-top-sm" type="text" v-model="workerName"></input>
</view> -->
<view>
是否确认加入{{inviteMasterObj.name}}的团队
</view> </view>
</view> </view>
<view class="cu-bar bg-white solid-top"> <view class="cu-bar bg-white solid-top">
<view class="action margin-0 flex-sub text-black" @tap="hideModal">取消</view> <view class="action margin-0 flex-sub text-black" @tap="hideModal">取消</view>
<view class="action margin-0 flex-sub text-main-color solid-left" @tap="hideModal" <view class="action margin-0 flex-sub text-main-color solid-left" @tap="hideModal"
@click="confirm">邀请</view> @click="confirm">确定</view>
</view> </view>
</view> </view>
</view> </view>
@ -31,11 +34,17 @@
export default { export default {
name: 'invite-master', name: 'invite-master',
emits: ['confirm'], emits: ['confirm'],
props: {
inviteMasterObj: {
type: Object,
default: {}
}
},
data() { data() {
return { return {
isShow: false, isShow: false,
workerId: '', workerId: null,
workerName: '' // workerName: ''
} }
}, },
methods: { methods: {
@ -47,14 +56,14 @@
this.resetData(); this.resetData();
}, },
resetData() { resetData() {
this.workerId = '', this.workerId = null
this.workerName = '' // this.workerName = ''
}, },
confirm() { confirm() {
this.$emit('confirm', { this.$emit('confirm', {
leaderId: this.$request.getCurUserInfo().workerId, leaderId: this.inviteMasterObj.workerId,
workerId: this.workerId, workerId: this.$request.getCurUserInfo().workerId,
workerName: this.workerName // workerName: this.workerName
}); });
} }
} }

View File

@ -6,106 +6,150 @@
<block slot="content">我的团队</block> <block slot="content">我的团队</block>
</cu-custom> </cu-custom>
<!-- 团队成员 --> <!-- 团队成员 -->
<view> <view>
<view class="bg-white padding bottom-border" v-for="(member, index) in members"> <view class="bg-white padding bottom-border" v-for="(member, index) in members">
<view class="flex justify-between"> <view class="flex justify-between">
<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="text-lg margin-left-sm">{{member.name}}</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"
class="flex justify-end align-center margin-lr-sm"> class="flex justify-end align-center margin-lr-sm">
<input class="radius-input" type="text" v-model="member.workerName" placeholder="姓名备注"></input> <input class="radius-input" type="text" v-model="member.workerName"
<view class="text-lg margin-left-sm"> placeholder="姓名备注"></input>
<text class="cuIcon-roundcheckfill text-main-color" :data-index="index" <view class="text-lg margin-left-sm">
@click="editWorkerName"></text> <text class="cuIcon-roundcheckfill text-main-color" :data-index="index"
<text class="cuIcon-roundclosefill margin-left-xs" :data-index="index" @click="editWorkerName"></text>
@click="hideEditInput"></text> <text class="cuIcon-roundclosefill margin-left-xs" :data-index="index"
</view> @click="hideEditInput"></text>
</view> </view>
<view v-else class="flex justify-end margin-lr-sm" :key="member.workerId"> </view>
<text>{{member.workerName}}</text> <view v-else class="flex justify-end margin-lr-sm" :key="member.workerId">
<text class="text-lg" :data-index="index" @click="showEditInput"><text <text>{{member.workerName ? member.workerName : ''}}</text>
class="cuIcon-edit margin-left-xs"></text></text> <text class="text-lg" :data-index="index" @click="showEditInput"><text
</view> class="cuIcon-edit margin-left-xs"></text></text>
<view class="text-xxl text-main-color" :data-phone="member.phone" @click="makePhoneCall"> </view>
<view class="cuIcon-phone"></view> <view class="text-xxl text-main-color" :data-phone="member.phone" @click="makePhoneCall">
</view> <view class="cuIcon-phone"></view>
</view> </view>
</view> </view>
</view> </view>
</view> </view>
<load-status-bar class="margin-bottom-with-bar" ref="loadStatusBar" @loadMore="loadTeamPage"></load-status-bar> </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 class="cu-bar bg-white tabbar border shop fixed-bottom-bar">
<view>设置扣点</view> <view class="left-grid text-center" data-modal="takeRateSet" @click="showModalByRef('setTakeRateModal')">
<view v-if="curUserInfo.leaderTeamRate">(扣点<text class="text-red">{{Number(curUserInfo.leaderTeamRate)*100}}%</text>)</view> <view>设置扣点</view>
</view> <view v-if="curUserInfo.leaderTeamRate">(扣点<text
<view class="bg-main-color submit" @click="showModalByRef('inviteMasterModal')">邀请团队</view> class="text-red">{{Number(curUserInfo.leaderTeamRate)*100}}%</text>)</view>
</view> </view>
<!-- <view class="bg-main-color submit" @click="showModalByRef('inviteMasterModal')">邀请团队</view> -->
<set-take-rate ref="setTakeRateModal" :leaderTeamRate="Number(curUserInfo.leaderTeamRate)*100" :leaderTeamMoney="curUserInfo.leaderTeamMoney" @confirm="applySetTakeRate"></set-take-rate> <view class="bg-main-color submit">
<invite-master ref="inviteMasterModal" @confirm="inviteMaster"></invite-master> <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>
<confirm-modal ref="confirmModal" :content="'当前无法加入师傅团队,请先登录并完成师傅入驻申请。'" @confirm="goToIndex"></confirm-modal>
</view> </view>
</template> </template>
<script> <script>
import setTakeRate from '@/pages/area-proxy/modal/set-take-rate.vue'; import setTakeRate from '@/pages/area-proxy/modal/set-take-rate.vue';
import inviteMaster from '@/pages/area-proxy/modal/invite-master.vue'; import inviteMaster from '@/pages/area-proxy/modal/invite-master.vue';
import loadStatusBar from '@/components/custom-bar/load-status-bar.vue'; import loadStatusBar from '@/components/custom-bar/load-status-bar.vue';
export default { export default {
components: { components: {
inviteMaster, inviteMaster,
setTakeRate, setTakeRate,
loadStatusBar loadStatusBar
}, },
data() { data() {
return { return {
members: [], members: [],
pageNum: 0, pageNum: 0,
pageSize: 0, pageSize: 0,
curUserInfo: null curUserInfo: {},
inviteMasterObj: {}
} }
}, },
onLoad() { onLoad(options) {
this.loadData(); if (options && options.inviteMasterObj) {
//
this.beInvited2Team(JSON.parse(decodeURIComponent(options.inviteMasterObj)));
} else {
this.loadData();
}
}, },
methods: { onShareAppMessage() {
return {
title: '邀请你成为我的团队成员',
path: '/pages/area-proxy/my-team?inviteMasterObj=' + encodeURIComponent(JSON.stringify(this.curUserInfo)),
// imageUrl: 'https://ossweb-img.qq.com/images/lol/web201310/skin/big5000.jpg'
}
},
methods: {
async beInvited2Team(inviteMasterObj) {
this.inviteMasterObj = inviteMasterObj;
let curUserInfo = await this.login();
if (curUserInfo == null || curUserInfo.status !== 0) {
//
this.showModalByRef('confirmModal');
} else {
this.showModalByRef('inviteMasterModal');
}
},
async login() {
// userInfo
await this.$request.storageExistUser();
// userInfo
return this.$request.getCurUserInfo();
},
goToIndex() {
uni.reLaunch({
url: '/pages/index/index'
})
},
async loadData() { async loadData() {
// this.myTeamInfo = await this.$api.data('myTeamInfo'); // this.myTeamInfo = await this.$api.data('myTeamInfo');
// this.members = this.myTeamInfo.members; // this.members = this.myTeamInfo.members;
this.pageSize = this.$globalData.initPageSize; this.pageSize = this.$globalData.initPageSize;
this.curUserInfo = this.$request.getCurUserInfo(); this.curUserInfo = this.$request.getCurUserInfo();
this.loadTeamPage(); this.loadTeamPage();
}, },
async reloadData() { async reloadData() {
this.pageNum = 0; this.pageNum = 0;
this.members = []; this.members = [];
this.loadData(); this.loadData();
}, },
async loadTeamPage(params = {}) { async loadTeamPage(params = {}) {
params.pageNum = this.pageNum; params.pageNum = this.pageNum;
params.pageSize = this.pageSize; params.pageSize = this.pageSize;
this.$refs.loadStatusBar.showLoading(); this.$refs.loadStatusBar.showLoading();
try { try {
let res = await this.$request.getTeamPage(params); let res = await this.$request.getTeamPage(params);
let rowsLength = res.rows.length; let rowsLength = res.rows.length;
if (rowsLength > 0) { if (rowsLength > 0) {
this.members = this.members.concat(res.rows); this.members = this.members.concat(res.rows);
this.pageNum++; this.pageNum++;
if (rowsLength === this.pageSize) { if (rowsLength === this.pageSize) {
this.$refs.loadStatusBar.showLoadMore(); this.$refs.loadStatusBar.showLoadMore();
} }
} }
this.$refs.loadStatusBar.showLoadOver(); this.$refs.loadStatusBar.showLoadOver();
} catch (e) { } catch (e) {
console.error(e) console.error(e)
this.$refs.loadStatusBar.showLoadErr(); this.$refs.loadStatusBar.showLoadErr();
} }
}, },
showEditInput(e) { showEditInput(e) {
let curIndex = e.currentTarget.dataset.index; let curIndex = e.currentTarget.dataset.index;
@ -119,20 +163,20 @@
showEditInput: false showEditInput: false
})) }))
}, },
async editWorkerName(e) { async editWorkerName(e) {
let curIndex = e.currentTarget.dataset.index; let curIndex = e.currentTarget.dataset.index;
let memberInfo = this.members[curIndex]; let memberInfo = this.members[curIndex];
let res = await this.$request.updateWorkerTeam({ let res = await this.$request.updateWorkerTeam({
workerTeamId: memberInfo.workerTeamId, workerTeamId: memberInfo.workerTeamId,
workerName: memberInfo.workerName workerName: memberInfo.workerName
}); });
if (res.code === 0) { if (res.code === 0) {
uni.showToast({ uni.showToast({
title: '修改成功', title: '修改成功',
icon: 'success', icon: 'success',
mask: true mask: true
}); });
this.hideEditInput(e); this.hideEditInput(e);
} }
}, },
makePhoneCall(e) { makePhoneCall(e) {
@ -140,31 +184,31 @@
uni.makePhoneCall({ uni.makePhoneCall({
phoneNumber: phoneNum phoneNumber: phoneNum
}) })
}, },
showModalByRef(refName) { showModalByRef(refName) {
this.$refs[refName].showModal(); this.$refs[refName].showModal();
}, },
async applySetTakeRate(params) { async applySetTakeRate(params) {
let res = await this.$request.updateWorker(params); let res = await this.$request.updateWorker(params);
if (res.code === 0) { if (res.code === 0) {
uni.showToast({ uni.showToast({
title: '保存成功', title: '保存成功',
icon: 'success', icon: 'success',
mask: true mask: true
}); });
this.reloadData(); this.reloadData();
} }
}, },
async inviteMaster(params) { async inviteMaster(params) {
let res = await this.$request.addTeam(params); let res = await this.$request.addTeam(params);
if (res.code === 0) { if (res.code === 0) {
uni.showToast({ uni.showToast({
title: '邀请成功', title: '邀请成功',
icon: 'success', icon: 'success',
mask: true mask: true
}) })
this.reloadData(); this.reloadData();
} }
} }
}, },
} }
@ -173,9 +217,9 @@
<style scoped> <style scoped>
.left-grid { .left-grid {
width: 50%; width: 50%;
} }
.bottom-border { .bottom-border {
border-bottom: 1rpx solid rgba(0, 0, 0, 0.1); border-bottom: 1rpx solid rgba(0, 0, 0, 0.1);
} }
</style> </style>

View File

@ -209,7 +209,7 @@
this.curUserInfo = curUserInfo; this.curUserInfo = curUserInfo;
// //
this.isShowSteer = this.curUserInfo.type != null && this.curUserInfo.type != undefined ? false : true; this.isShowSteer = this.curUserInfo.type == null || this.curUserInfo.status !== 0 ? true : false;
this.myInfo = await this.$api.data('myInfo'); this.myInfo = await this.$api.data('myInfo');
// this.isShowSteer = !this.myInfo.entryType; // this.isShowSteer = !this.myInfo.entryType;
@ -226,9 +226,14 @@
} }
this.servModules = newServModules; this.servModules = newServModules;
}, },
async chooseEntryType(typeCode) { async chooseEntryType(typeCode) {
let status = 1;
if (typeCode === 1) {
status = 0;
}
await this.$request.updateWorker({ await this.$request.updateWorker({
type: typeCode type: typeCode,
status: status
}); });
if (typeCode === 1) { if (typeCode === 1) {
this.$emit('changeCurPageCode', 'supplyChainPage'); this.$emit('changeCurPageCode', 'supplyChainPage');