From 600dd845e382863c689573f3d12eb5ddb55fa318 Mon Sep 17 00:00:00 2001 From: donqi Date: Fri, 17 Jun 2022 16:43:49 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B8=88=E5=82=85=E5=85=A5=E9=A9=BB=E4=B8=8D?= =?UTF-8?q?=E5=90=8C=E7=8A=B6=E6=80=81=E4=B8=8B=E7=9A=84=E5=B1=95=E7=A4=BA?= =?UTF-8?q?=E5=8F=8A=E8=B7=B3=E8=BD=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common/js/request.js | 33 ++++++++- pages.json | 2 + pages/index/my-home.vue | 17 +++-- pages/my/master-occupancy.vue | 112 ++++++++++++++++------------- pages/my/master-settled-info.vue | 119 +++++++++++++++++++++++++++++++ 5 files changed, 225 insertions(+), 58 deletions(-) create mode 100644 pages/my/master-settled-info.vue diff --git a/common/js/request.js b/common/js/request.js index e27e828..462b7b3 100644 --- a/common/js/request.js +++ b/common/js/request.js @@ -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); @@ -227,6 +226,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({ @@ -453,5 +457,28 @@ export default { data: params }) 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; + } } diff --git a/pages.json b/pages.json index 4fd4df6..8155686 100644 --- a/pages.json +++ b/pages.json @@ -49,6 +49,8 @@ "path": "personal-info" }, { "path": "account-security" + }, { + "path": "master-settled-info" }] }], "globalStyle": { diff --git a/pages/index/my-home.vue b/pages/index/my-home.vue index b4abf47..bbdf6d8 100644 --- a/pages/index/my-home.vue +++ b/pages/index/my-home.vue @@ -76,8 +76,8 @@ icon: 'calendar' }, { name: '师傅入驻', - icon: 'profile', - pageUrl: '/pages/my/master-occupancy' + icon: 'profile', + pageUrl: '/pages/my/master-settled-info' }, { name: '个人信息', icon: 'lock', @@ -112,10 +112,15 @@ this.curUserInfo = this.$request.getCurUserInfo(); this.myInfo = await this.$api.data('myInfo'); }, - clickMenuItem(menu) { - uni.navigateTo({ - url: menu.pageUrl - }) + clickMenuItem(menu) { + if (menu.prefixFun) { + this[menu.prefixFun](); + } + if (menu.pageUrl) { + uni.navigateTo({ + url: menu.pageUrl + }) + } } }, } diff --git a/pages/my/master-occupancy.vue b/pages/my/master-occupancy.vue index 33a60c8..ae57d0a 100644 --- a/pages/my/master-occupancy.vue +++ b/pages/my/master-occupancy.vue @@ -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) { - uni.showToast({ - icon: 'success', - title: '提交成功' - }) + // 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 }) diff --git a/pages/my/master-settled-info.vue b/pages/my/master-settled-info.vue new file mode 100644 index 0000000..1d3ea60 --- /dev/null +++ b/pages/my/master-settled-info.vue @@ -0,0 +1,119 @@ + + + + +