师傅入驻不同状态下的展示及跳转

This commit is contained in:
donqi 2022-06-17 16:43:49 +08:00
parent abd92a200c
commit 600dd845e3
5 changed files with 225 additions and 58 deletions

View File

@ -106,8 +106,7 @@ export default {
let registerRes = await this.registerUser({
openId: openId,
name: userInfo.userInfo.nickName,
workerLogoUrl: userInfo.userInfo.avatarUrl,
status: 0
workerLogoUrl: userInfo.userInfo.avatarUrl
});
if (registerRes.code === 0) {
wxGetUserRes = await this.qryUserInfo(openId);
@ -228,6 +227,11 @@ export default {
}
return userInfo;
},
async updateCurUserCache() {
let curUserInfo = await this.getCurUserNoCache();
uni.setStorageSync('userProfile', curUserInfo);
return true;
},
async uploadFile(filePath) {
let res = await uni.uploadFile({
url: this.address + '/tool/qiniu/upload',
@ -454,4 +458,27 @@ export default {
})
return res[1].data;
},
async getWorkerArea(params = {}) {
let res = await uni.request({
url: '/worker/area/worker',
method: 'GET',
data: params
})
return res[1].data;
},
async getWorkerGoodsCategory(params = {}) {
let res = await uni.request({
url: '/worker/goods/category/worker',
method: 'GET',
data: params
})
return res[1].data;
},
async getWorkerSpecialSkill(params = {}) {
let res = await uni.request({
url: '/worker/special/skill/' + params.workerId,
method: 'POST'
})
return res[1].data;
}
}

View File

@ -49,6 +49,8 @@
"path": "personal-info"
}, {
"path": "account-security"
}, {
"path": "master-settled-info"
}]
}],
"globalStyle": {

View File

@ -77,7 +77,7 @@
}, {
name: '师傅入驻',
icon: 'profile',
pageUrl: '/pages/my/master-occupancy'
pageUrl: '/pages/my/master-settled-info'
}, {
name: '个人信息',
icon: 'lock',
@ -113,10 +113,15 @@
this.myInfo = await this.$api.data('myInfo');
},
clickMenuItem(menu) {
if (menu.prefixFun) {
this[menu.prefixFun]();
}
if (menu.pageUrl) {
uni.navigateTo({
url: menu.pageUrl
})
}
}
},
}
</script>

View File

@ -459,56 +459,70 @@
this.curStep = this.curStep === 0 ? 0 : --this.curStep;
},
async submit() {
let workerId = this.curUserInfo.workerId;
let workerAreas = [];
let goodsCategories = [];
let specialSkills = [];
//
this.servArea.forEach((item) => {
item.streetIds.forEach((streetId) => {
workerAreas.push({
workerId: workerId,
provinceId: item.provinceObj.areaId,
cityId: item.cityObj.areaId,
districtId: item.districtObj.areaId,
streetId: streetId
})
});
});
//
this.servSkill.forEach((item) => {
item.subSubTypeIds.forEach((goodsCategoryId) => {
goodsCategories.push({
workerId: workerId,
goodsCategoryId: goodsCategoryId
});
});
});
//
this.specialSkill.forEach((item) => {
specialSkills.push({
workerId: workerId,
specialSkillId: item.specialSkillObj.specialSkillId,
credential: item.skillCert[0],
insurance: item.insurCert[0],
insuranceStart: item.insurStartDate,
insuranceEnd: item.insurEndDate
});
});
// let workerId = this.curUserInfo.workerId;
// let workerAreas = [];
// let goodsCategories = [];
// let specialSkills = [];
// //
// this.servArea.forEach((item) => {
// item.streetIds.forEach((streetId) => {
// workerAreas.push({
// workerId: workerId,
// provinceId: item.provinceObj.areaId,
// cityId: item.cityObj.areaId,
// districtId: item.districtObj.areaId,
// streetId: streetId
// })
// });
// });
// //
// this.servSkill.forEach((item) => {
// item.subSubTypeIds.forEach((goodsCategoryId) => {
// goodsCategories.push({
// workerId: workerId,
// goodsCategoryId: goodsCategoryId
// });
// });
// });
// //
// this.specialSkill.forEach((item) => {
// specialSkills.push({
// workerId: workerId,
// specialSkillId: item.specialSkillObj.specialSkillId,
// credential: item.skillCert[0],
// insurance: item.insurCert[0],
// insuranceStart: item.insurStartDate,
// insuranceEnd: item.insurEndDate
// });
// });
let params = {
workerId: workerId,
workerAreas: workerAreas,
goodsCategories: goodsCategories,
specialSkills: specialSkills
}
console.log(params)
let res = await this.$request.workerSettled(params);
if (res.code === 0) {
// let params = {
// workerId: workerId,
// workerAreas: workerAreas,
// goodsCategories: goodsCategories,
// specialSkills: specialSkills
// }
// let res = await this.$request.workerSettled(params);
// if (res.code === 0) {
// uni.showToast({
// icon: 'success',
// title: ''
// })
// //
// let updateCurUserCacheRes = await this.$request.updateCurUserCache();
// if (updateCurUserCacheRes) {
// uni.navigateBack({
// delta: -1
// })
// }
// }
uni.showToast({
icon: 'success',
title: '提交成功'
})
//
let updateCurUserCacheRes = await this.$request.updateCurUserCache();
if (updateCurUserCacheRes) {
uni.navigateBack({
delta: -1
})

View File

@ -0,0 +1,119 @@
<template>
<view>
<!-- 顶部操作条 -->
<cu-custom :bgColor="'bg-main-color'" :isBack="true">
<block slot="backText">返回</block>
<block slot="content">师傅入驻信息</block>
</cu-custom>
<view v-if="curUserInfo.status === 1" class="margin bg-white padding">
<view class="margin-bottom-sm">账户未审核请填写入驻信息</view>
<button class="cu-btn bg-main-color shadow-blur" @click="navigate2ApplySettled">填写入驻信息</button>
</view>
<view v-else class="margin bg-white">
<view class="padding">
<view class="text-black text-bold">服务区域</view>
<view v-for="(item,index) in servAreas">
<text>{{strReplace(item.mergerName, "-", ",")}}</text>
<!-- <text v-if="index !== servAreas.length - 1"></text> -->
</view>
</view>
<view class="padding">
<view class="text-black text-bold">服务技能</view>
<view v-for="(item,index) in servSkills">
<text>{{item.goodsCategoryName}}</text>
<!-- <text v-if="index !== servSkills.length - 1"></text> -->
</view>
</view>
<view class="padding">
<view class="text-black text-bold">特殊技能</view>
<view class="solid margin-top-sm padding-sm" v-for="(item,index) in servSpecialSkills">
<view class="margin-bottom-xs">类目{{item.specialSkillName}}</view>
<view class="margin-bottom-xs">是否危险技能{{item.dangerous === 0 ? '否' : '是'}}</view>
<view class="margin-bottom-xs">
<view class="margin-bottom-xs">技能证书</view>
<image style="width: 200px; height: 200px; background-color: #eeeeee;" mode="aspectFit"
:src="item.credential" :data-url="item.credential" @click="viewImage($event, [item.credential])"></image>
</view>
<view v-if="item.dangerous == 1" class="margin-bottom-xs">
<view class="margin-bottom-xs">保险证明</view>
<image style="width: 200px; height: 200px; background-color: #eeeeee;" mode="aspectFit"
:src="item.insurance" :data-url="item.insurance" @click="viewImage($event, [item.insurance])"></image>
</view>
<view>保险生效时期{{item.insuranceStart}} ~ {{item.insuranceEnd}}</view>
</view>
</view>
<view class="padding">
<text class="text-black text-bold">审核状态</text>
<text v-if="curUserInfo.status === 0" class="text-green">审核通过</text>
<text v-else-if="curUserInfo.status === 3" class="text-yellow">审核中</text>
<text v-else-if="curUserInfo.status === 4" class="text-red">审核未通过</text>
<button class="cu-btn bg-main-color margin-left-sm shadow-blur" v-if="curUserInfo.status === 4" @click="navigate2ApplySettled">重新填写入驻信息</button>
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
curUserInfo: {},
servAreas: [],
servSkills: [],
servSpecialSkills: []
}
},
// onLoad() {
// this.loadData();
// },
onShow() {
this.loadData();
},
methods: {
loadData() {
this.curUserInfo = this.$request.getCurUserInfo();
this.loadServAreas();
this.loadServSkills();
this.loadSpecialSkills();
},
async loadServAreas() {
let res = await this.$request.getWorkerArea({
workerId: this.curUserInfo.workerId
});
this.servAreas = res.data;
},
async loadServSkills() {
let res = await this.$request.getWorkerGoodsCategory({
workerId: this.curUserInfo.workerId
});
this.servSkills = res.data;
},
async loadSpecialSkills() {
let res = await this.$request.getWorkerSpecialSkill({
workerId: this.curUserInfo.workerId
});
this.servSpecialSkills = res.data;
},
viewImage(e, imgList) {
uni.previewImage({
urls: imgList,
current: e.currentTarget.dataset.url
});
},
navigate2ApplySettled() {
uni.navigateTo({
url: '/pages/my/master-occupancy'
})
},
strReplace(wholeStr, newStr, oldStr) {
if (wholeStr && wholeStr.length > 0) {
wholeStr = wholeStr.replaceAll(oldStr, newStr);
}
return wholeStr;
}
},
}
</script>
<style>
</style>