From e9e703e73c9a41e7edf8b85b4111b8a18e807b75 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?TOP=E7=B3=AF=E7=B1=B3?= <1130395124@qq.com>
Date: Thu, 6 Apr 2023 11:28:31 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=B8=88=E5=82=85=E5=A4=9A?=
=?UTF-8?q?=E5=8C=BA=E5=9F=9F=E9=80=89=E6=8B=A9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/core/models/user.js | 4 +-
src/pages/member/service-info.vue | 149 ++++++++++++------
.../uni-data-pickerview.vue | 1 -
3 files changed, 106 insertions(+), 48 deletions(-)
diff --git a/src/core/models/user.js b/src/core/models/user.js
index e6ada63..529e1ec 100644
--- a/src/core/models/user.js
+++ b/src/core/models/user.js
@@ -104,9 +104,7 @@ export default {
id: response.data.worker.id,
uid: response.data.worker.uid,
avatar: response.data.worker.avatar,
- province: response.data.worker.province,
- city: response.data.worker.city,
- area: response.data.worker.region,
+ area: response.data.worker.area,
cateIds: response.data.worker.service,
carTypeId: response.data.worker.car,
name: response.data.worker.name,
diff --git a/src/pages/member/service-info.vue b/src/pages/member/service-info.vue
index 5daa997..ec28a67 100644
--- a/src/pages/member/service-info.vue
+++ b/src/pages/member/service-info.vue
@@ -19,24 +19,12 @@
-
+
*服务区域
-
-
-
- {{ province }}-{{ city }}-{{ area }}
-
-
-
- 请选择服务区域
-
-
-
+
+
+ {{ currentAreaText ? currentAreaText : "请选择服务区域" }}
+
@@ -132,15 +120,35 @@
提交审核
+
+
+
+
+ 点击添加服务区域
+
+
+
+
+ {{ item }}
+
+
+ 确定
+
+
-
-
+
+
点击添加服务类型
-
-
+
+
{{ item.name }}
@@ -160,12 +168,12 @@ export default {
data() {
return {
maxContentLength: 300,
+ selectAreaModal: false,
selectCateModal: false,
avatar: "",
- province: "",
- city: "",
- area: "",
- cityList: [],
+ areaList: [],
+ currentAreaText: "",
+ currentAreaList: [],
serviceType: 0,
serviceTypeText: "",
serviceTypeList: [
@@ -203,9 +211,6 @@ export default {
await this.$store.dispatch("user/info", true);
if (this.finishInfo) {
this.avatar = this.userInfo.worker.avatar;
- this.province = this.userInfo.worker.province;
- this.city = this.userInfo.worker.city;
- this.area = this.userInfo.worker.area;
this.carTypeId = this.userInfo.worker.carTypeId;
this.name = this.userInfo.worker.name;
this.idcardA = this.userInfo.worker.idcardA;
@@ -219,8 +224,15 @@ export default {
this.serviceTypeText = item.name;
}
});
+ let currentAreaList = this.userInfo.worker.area.split(",");
+ currentAreaList.forEach((item) => {
+ if (item) {
+ this.currentAreaList.push(item);
+ }
+ });
+ this.updatecurrentAreaText();
}
- this.cityList = this.$models.system.getCity();
+ this.areaList = this.$models.system.getCity();
this.$models.service.getInstallCate().then((list) => {
this.cateList = list;
if (this.finishInfo) {
@@ -251,6 +263,9 @@ export default {
onShareTimeline() {},
onShareAppMessage() {},
methods: {
+ /**
+ * 上传头像
+ */
uploadHeadImg() {
this.$utils.chooseImage(1).then((tempFiles) => {
tempFiles.forEach((item) => {
@@ -260,11 +275,17 @@ export default {
});
});
},
+ /**
+ * 上传头像
+ */
uploadAvatar(e) {
this.$models.system.upload(e.detail.avatarUrl).then((response) => {
this.avatar = response.img;
});
},
+ /**
+ * 上传身份证
+ */
uploadIdCardA() {
this.$utils.chooseImage(1).then((tempFiles) => {
tempFiles.forEach((item) => {
@@ -274,6 +295,9 @@ export default {
});
});
},
+ /**
+ * 上传身份证
+ */
uploadIdCardB() {
this.$utils.chooseImage(1).then((tempFiles) => {
tempFiles.forEach((item) => {
@@ -283,6 +307,9 @@ export default {
});
});
},
+ /**
+ * 上传资质
+ */
uploadLicense() {
this.$utils.chooseImage(1).then((tempFiles) => {
tempFiles.forEach((item) => {
@@ -292,11 +319,34 @@ export default {
});
});
},
+ /**
+ * 选择服务区域
+ */
changeArea(e) {
- this.province = e.detail.value[0].text;
- this.city = e.detail.value[1].text;
- this.area = e.detail.value[2].text;
+ let data = e.detail.value;
+ let value = data[data.length - 1].text;
+ if (!this.currentAreaList.includes(value)) {
+ this.currentAreaList.push(value);
+ }
+ this.updatecurrentAreaText();
},
+ /**
+ * 删除服务区域
+ */
+ delArea(index) {
+ this.currentAreaList.splice(index, 1);
+ this.updatecurrentAreaText();
+ },
+ updatecurrentAreaText() {
+ let areaArr = [];
+ this.currentAreaList.forEach((item) => {
+ areaArr.push(item);
+ });
+ this.currentAreaText = areaArr.join();
+ },
+ /**
+ * 选择服务分类
+ */
changeServiceType(e) {
this.serviceTypeList.forEach((item, index) => {
if (index == e.detail.value) {
@@ -309,6 +359,9 @@ export default {
this.carTypeText = "";
}
},
+ /**
+ * 选择服务
+ */
selectCate(e) {
let id = this.cateList[e.detail.value].id,
flag = false;
@@ -325,6 +378,9 @@ export default {
this.updateCurrentCateText();
}
},
+ /**
+ * 删除服务
+ */
delCate(index) {
this.currentCateList.splice(index, 1);
this.updateCurrentCateText();
@@ -336,10 +392,16 @@ export default {
});
this.currentCateText = cateArr.join();
},
+ /**
+ * 修改车型
+ */
changeCarType(e) {
this.carTypeId = this.carTypeList[e.detail.value].id;
this.carTypeText = this.carTypeList[e.detail.value].name;
},
+ /**
+ * 提交
+ */
submit() {
let cateIds = [];
this.currentCateList.forEach((item) => {
@@ -347,10 +409,8 @@ export default {
});
let saveData = {
avatar: this.avatar,
- province: this.province,
- city: this.city,
- region: this.area,
service: cateIds.join(","),
+ area: this.currentAreaList.join(","),
name: this.name,
mobile: this.mobile,
imga: this.idcardA,
@@ -379,8 +439,8 @@ export default {