|
@@ -58,7 +58,7 @@
|
|
|
|
|
|
<view v-for="item in updata_list" :key="item.key" class="updata-imgs">
|
|
|
<UpdataImgs :fileList="file_url[item.key]" :data="item" ref="zsImg"
|
|
|
- v-if="item.permission.includes(data.key)" @onSubmit="onChange" />
|
|
|
+ @onSubmit="onChange" />
|
|
|
</view>
|
|
|
|
|
|
|
|
@@ -75,7 +75,7 @@ import { onLoad } from '@dcloudio/uni-app';
|
|
|
import FontTitle from "@/pages_home/components/font-title/index.vue";
|
|
|
import CustForm from "@/pages_home/components/cust-form/index";
|
|
|
import UpdataImgs from "@/pages_home/components/updata-imgs/index.vue";
|
|
|
-import { chatting, education, health } from "./data";
|
|
|
+import { column } from "./data";
|
|
|
import { add, getVolunteerInfo } from "@/api/volunteer";
|
|
|
import { computed } from 'vue';
|
|
|
import { getTreeList } from '@/api/volunteer'
|
|
@@ -91,7 +91,7 @@ const updata_list = [
|
|
|
img: '/static/img/updata-user-img.png',
|
|
|
key: 'volunteerPicture',
|
|
|
ref: userImg,
|
|
|
- permission: [1, 2],
|
|
|
+ // permission: [1, 2],
|
|
|
required: true
|
|
|
},
|
|
|
{
|
|
@@ -100,7 +100,7 @@ const updata_list = [
|
|
|
img: '/static/img/updata-user-img.png',
|
|
|
key: 'idCardPicture',
|
|
|
ref: zsImg,
|
|
|
- permission: [1, 2],
|
|
|
+ // permission: [1, 2],
|
|
|
required: true
|
|
|
},
|
|
|
{
|
|
@@ -109,7 +109,7 @@ const updata_list = [
|
|
|
img: '/static/img/updata-user-img.png',
|
|
|
key: 'certificationPicture',
|
|
|
ref: zsImg,
|
|
|
- permission: [1, 2],
|
|
|
+ // permission: [1, 2],
|
|
|
required: false
|
|
|
}
|
|
|
]
|
|
@@ -131,8 +131,8 @@ const serviceKeys = reactive({
|
|
|
classKeyname: '',
|
|
|
itemKey: '',//服务项目
|
|
|
itemKeyname: '',
|
|
|
- time:'',//时间
|
|
|
- price:'',//价格
|
|
|
+ time: '',//时间
|
|
|
+ price: '',//价格
|
|
|
})
|
|
|
|
|
|
const timeList = [
|
|
@@ -154,16 +154,10 @@ const sex_status = {
|
|
|
'男': 0,
|
|
|
'女': 1
|
|
|
}
|
|
|
-const register_column = {
|
|
|
- 1: chatting,
|
|
|
- 2: education,
|
|
|
- 3: health
|
|
|
-
|
|
|
-}
|
|
|
|
|
|
//根据类型获取表单item 值
|
|
|
const com_column = computed(() => {
|
|
|
- let column_list = data.value ? register_column[data.value.key] : [];
|
|
|
+ let column_list = data.value ?column : [];
|
|
|
return column_list
|
|
|
})
|
|
|
|
|
@@ -173,16 +167,13 @@ function onSubmit() {
|
|
|
// return;
|
|
|
// 校验表单并获取数据
|
|
|
cust_form_ref.value.onSubmit().then(async (res) => {
|
|
|
- console.log('===res===>', res, file_url);
|
|
|
|
|
|
//文件必传校验
|
|
|
for (let i = 0; i < updata_list.length; i++) {
|
|
|
const element = updata_list[i];
|
|
|
- console.log(element.required, element.permission.includes(data.value.key), file_url[element.key]);
|
|
|
|
|
|
|
|
|
- const type = element.required && element.permission.includes(data.value.key) && !file_url[element.key];
|
|
|
- console.log('element', element, type);
|
|
|
+ const type = element.required&& !file_url[element.key];
|
|
|
|
|
|
if (type) {
|
|
|
uni.showToast({
|
|
@@ -192,33 +183,33 @@ function onSubmit() {
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- if(!(serviceKeys.itemKeyname || serviceKeys.classKeyname)){
|
|
|
+
|
|
|
+ if (!(serviceKeys.itemKeyname || serviceKeys.classKeyname)) {
|
|
|
uni.showToast({
|
|
|
- title: '请选择服务',
|
|
|
- icon: 'none'
|
|
|
- })
|
|
|
+ title: '请选择服务',
|
|
|
+ icon: 'none'
|
|
|
+ })
|
|
|
return
|
|
|
}
|
|
|
- if(!serviceKeys.time){
|
|
|
+ if (!serviceKeys.time) {
|
|
|
uni.showToast({
|
|
|
- title: '请选择服务时长',
|
|
|
- icon: 'none'
|
|
|
- })
|
|
|
+ title: '请选择服务时长',
|
|
|
+ icon: 'none'
|
|
|
+ })
|
|
|
return
|
|
|
}
|
|
|
- if(!serviceKeys.price){
|
|
|
+ if (!serviceKeys.price) {
|
|
|
uni.showToast({
|
|
|
- title: '请输入服务价格',
|
|
|
- icon: 'none'
|
|
|
- })
|
|
|
+ title: '请输入服务价格',
|
|
|
+ icon: 'none'
|
|
|
+ })
|
|
|
return
|
|
|
}
|
|
|
|
|
|
const parmas = {
|
|
|
serviceCategory: data.value.key,
|
|
|
...file_url,
|
|
|
- businessManagementId:serviceKeys.itemKey || serviceKeys.classKey,
|
|
|
+ businessManagementId: serviceKeys.itemKey || serviceKeys.classKey,
|
|
|
businessPrice: serviceKeys.price,
|
|
|
businessDuration: serviceKeys.time
|
|
|
};
|
|
@@ -251,7 +242,6 @@ function onSubmit() {
|
|
|
title: res.msg,
|
|
|
icon: 'none'
|
|
|
})
|
|
|
- console.log('==submit_res====>', submit_res);
|
|
|
})
|
|
|
|
|
|
|
|
@@ -265,7 +255,6 @@ function onSubmit() {
|
|
|
}
|
|
|
|
|
|
function onChange({ key, url }) {
|
|
|
- console.log('onChange', key, url);
|
|
|
Object.assign(file_url, {
|
|
|
[key]: url
|
|
|
})
|
|
@@ -273,37 +262,36 @@ function onChange({ key, url }) {
|
|
|
|
|
|
function idToIndexs(array, targetId, path = []) {
|
|
|
|
|
|
- for (let i = 0; i < array.length; i++) {
|
|
|
- const item = array[i];
|
|
|
- const currentPath = path.concat(i);
|
|
|
+ for (let i = 0; i < array.length; i++) {
|
|
|
+ const item = array[i];
|
|
|
+ const currentPath = path.concat(i);
|
|
|
|
|
|
- if (item.id === targetId) {
|
|
|
- console.log('indexs',item);
|
|
|
- return item
|
|
|
- }
|
|
|
+ if (item.id === targetId) {
|
|
|
+ return item
|
|
|
+ }
|
|
|
|
|
|
- if (item.children) {
|
|
|
- const result = idToIndexs(item.children, targetId, currentPath);
|
|
|
- if (result) {
|
|
|
- return result;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+ if (item.children) {
|
|
|
+ const result = idToIndexs(item.children, targetId, currentPath);
|
|
|
+ if (result) {
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- return null; // 如果没有找到对应的项,返回 null
|
|
|
+ return null; // 如果没有找到对应的项,返回 null
|
|
|
}
|
|
|
//重新提交的服务信息回显
|
|
|
-function servesInit(){
|
|
|
- const indexs = idToIndexs(serviceOptions.value,details.value.businessManagementId +'')
|
|
|
+function servesInit() {
|
|
|
+ const indexs = idToIndexs(serviceOptions.value, details.value.businessManagementId + '')
|
|
|
const names = indexs.businessTierName.split('-');
|
|
|
Object.assign(serviceKeys, {
|
|
|
- classKey: String(indexs.parentId)===String(data.value.key)? indexs.id :indexs.parentId,//服务类别
|
|
|
- classKeyname:names[1],
|
|
|
- itemKey: indexs.id,//服务项目
|
|
|
- itemKeyname: indexs.businessName,
|
|
|
- time:details.value.businessDuration,//时间
|
|
|
- price:details.value.businessPrice,//价格
|
|
|
- })
|
|
|
+ classKey: String(indexs.parentId) === String(data.value.key) ? indexs.id : indexs.parentId,//服务类别
|
|
|
+ classKeyname: names[1],
|
|
|
+ itemKey: indexs.id,//服务项目
|
|
|
+ itemKeyname: indexs.businessName,
|
|
|
+ time: details.value.businessDuration,//时间
|
|
|
+ price: details.value.businessPrice,//价格
|
|
|
+ })
|
|
|
}
|
|
|
async function getRegister() {
|
|
|
|
|
@@ -320,12 +308,15 @@ async function getRegister() {
|
|
|
idCardPicture: res.data.idCardPicture,
|
|
|
certificationPicture: res.data.certificationPicture
|
|
|
})
|
|
|
-
|
|
|
- servesInit(data)
|
|
|
-
|
|
|
-
|
|
|
+ servesInit(data)
|
|
|
isAdd.value = false;
|
|
|
-
|
|
|
+ }
|
|
|
+
|
|
|
+ if (data.value.record) {
|
|
|
+ Object.assign(serviceKeys, {
|
|
|
+ classKey: data.value.record.id,//服务类别
|
|
|
+ classKeyname: data.value.record.businessName,
|
|
|
+ })
|
|
|
}
|
|
|
} catch (error) {
|
|
|
console.log('error', error);
|
|
@@ -341,7 +332,6 @@ async function getRegister() {
|
|
|
|
|
|
|
|
|
const serviceChange = (item, key) => {
|
|
|
- console.log('----', item);
|
|
|
if (key === 'classKey') {
|
|
|
serviceItems.value = item.children;
|
|
|
serviceKeys['itemKey'] = '';
|
|
@@ -354,7 +344,6 @@ const serviceChange = (item, key) => {
|
|
|
}
|
|
|
const getTreeListInit = () => {
|
|
|
getTreeList({ parentId: data.value.key }).then(res => {
|
|
|
- console.log('----', res.data);
|
|
|
serviceOptions.value = res.data;
|
|
|
})
|
|
|
}
|
|
@@ -365,7 +354,7 @@ onMounted(() => {
|
|
|
onLoad((options) => {
|
|
|
const option = JSON.parse(decodeURIComponent(options.data));
|
|
|
data.value = option;
|
|
|
- console.log("option", option);
|
|
|
+ console.log("option", data.value);
|
|
|
|
|
|
uni.setNavigationBarTitle({
|
|
|
title: option.name // 根据业务逻辑调整
|
|
@@ -373,7 +362,6 @@ onLoad((options) => {
|
|
|
|
|
|
setTimeout(() => {
|
|
|
getRegister();
|
|
|
-
|
|
|
}, 500);
|
|
|
|
|
|
})
|