|
@@ -39,6 +39,8 @@ const { loading: addOrgCwLoading, send: addOrgCw } = useRequest(addOrgCwMethod,
|
|
|
emit('submit');
|
|
emit('submit');
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
|
|
+const localData = reactive({ ...props.data }); // Create a local copy of props.data
|
|
|
|
|
+
|
|
|
const formData = reactive<FollowModel>({
|
|
const formData = reactive<FollowModel>({
|
|
|
name: '', //服务包名称
|
|
name: '', //服务包名称
|
|
|
price: 0, //总计价格
|
|
price: 0, //总计价格
|
|
@@ -86,6 +88,7 @@ const emptyRow = {
|
|
|
conditioningProgramId: 0,
|
|
conditioningProgramId: 0,
|
|
|
days: '',
|
|
days: '',
|
|
|
frequencyType: '',
|
|
frequencyType: '',
|
|
|
|
|
+ frequencyTypeing: [],
|
|
|
frequencyMeasure: '',
|
|
frequencyMeasure: '',
|
|
|
totalMeasure: '',
|
|
totalMeasure: '',
|
|
|
totalPrice: '',
|
|
totalPrice: '',
|
|
@@ -104,8 +107,8 @@ const emptyRow = {
|
|
|
cpDynamicPricingRule: [],
|
|
cpDynamicPricingRule: [],
|
|
|
cpMedicines: [],
|
|
cpMedicines: [],
|
|
|
effect: '',
|
|
effect: '',
|
|
|
- isOnline: '',
|
|
|
|
|
- isDelivery: '',
|
|
|
|
|
|
|
+ isOffline: null,
|
|
|
|
|
+ isDelivery: null,
|
|
|
photo: '',
|
|
photo: '',
|
|
|
institutionId: '',
|
|
institutionId: '',
|
|
|
institutionName: '',
|
|
institutionName: '',
|
|
@@ -129,17 +132,10 @@ function getInstitutionProjectList() {
|
|
|
});
|
|
});
|
|
|
onSuccess(({ data }: any) => {
|
|
onSuccess(({ data }: any) => {
|
|
|
allProjects.value = data;
|
|
allProjects.value = data;
|
|
|
- console.log(allProjects.value, 'allProjects.value');
|
|
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
function getSystemProjectList() {
|
|
function getSystemProjectList() {
|
|
|
- const {
|
|
|
|
|
- loading: projectLoading,
|
|
|
|
|
- onSuccess,
|
|
|
|
|
- replace,
|
|
|
|
|
- refresh,
|
|
|
|
|
- remove,
|
|
|
|
|
- } = useRequest(getAllSystemCpMethod, {
|
|
|
|
|
|
|
+ const { loading: projectLoading, onSuccess } = useRequest(getAllSystemCpMethod, {
|
|
|
immediate: true,
|
|
immediate: true,
|
|
|
});
|
|
});
|
|
|
onSuccess(({ data }: any) => {
|
|
onSuccess(({ data }: any) => {
|
|
@@ -147,9 +143,7 @@ function getSystemProjectList() {
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
async function getProjectList() {
|
|
async function getProjectList() {
|
|
|
- console.log(props.data, 'getProjectList');
|
|
|
|
|
- if (props.data.types === 'system') {
|
|
|
|
|
- // console.log('系统');
|
|
|
|
|
|
|
+ if (localData.types === 'system') {
|
|
|
getSystemProjectList();
|
|
getSystemProjectList();
|
|
|
} else {
|
|
} else {
|
|
|
getInstitutionProjectList();
|
|
getInstitutionProjectList();
|
|
@@ -238,7 +232,7 @@ function onSelectProject({ row }: any) {
|
|
|
},
|
|
},
|
|
|
cpDynamicPricingRule: row?.cpDynamicPricingRule,
|
|
cpDynamicPricingRule: row?.cpDynamicPricingRule,
|
|
|
cpMedicines: row?.cpMedicines,
|
|
cpMedicines: row?.cpMedicines,
|
|
|
- isOnline: row?.isOnline,
|
|
|
|
|
|
|
+ isOffline: row?.isOffline,
|
|
|
isDelivery: row?.isDelivery,
|
|
isDelivery: row?.isDelivery,
|
|
|
photo: row?.photo,
|
|
photo: row?.photo,
|
|
|
conditioningProgramSupplierName: row?.conditioningProgramSupplierName,
|
|
conditioningProgramSupplierName: row?.conditioningProgramSupplierName,
|
|
@@ -254,7 +248,6 @@ function onSelectProject({ row }: any) {
|
|
|
// 预览
|
|
// 预览
|
|
|
|
|
|
|
|
function onPreview(row) {
|
|
function onPreview(row) {
|
|
|
- console.log(row, '66666');
|
|
|
|
|
if (row.conditioningProgramDetail.id) {
|
|
if (row.conditioningProgramDetail.id) {
|
|
|
// 这里写你的预览逻辑
|
|
// 这里写你的预览逻辑
|
|
|
VxeUI.modal.open({
|
|
VxeUI.modal.open({
|
|
@@ -336,34 +329,39 @@ function editPart(row) {
|
|
|
message.warning('请先添加服务包');
|
|
message.warning('请先添加服务包');
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
-let frequencyType = ref<string[]>([]);
|
|
|
|
|
|
|
+
|
|
|
// 添加计算数量的函数
|
|
// 添加计算数量的函数
|
|
|
function calculateCount(row: any) {
|
|
function calculateCount(row: any) {
|
|
|
|
|
+ const pricingType = row.conditioningProgramDetail.pricingType;
|
|
|
const period = Number(row.days) || 0;
|
|
const period = Number(row.days) || 0;
|
|
|
const frequency = Number(row.frequencyMeasure) || 0;
|
|
const frequency = Number(row.frequencyMeasure) || 0;
|
|
|
-
|
|
|
|
|
- console.log(row.frequencyMeasure, 'row.frequencyMeasure');
|
|
|
|
|
- // 检查是否选择了"不限"
|
|
|
|
|
- if (row.frequencyType === '不限') {
|
|
|
|
|
- frequencyType.value = [row.frequencyType];
|
|
|
|
|
- row.frequencyMeasure = ''; // 重置 frequencyMeasure
|
|
|
|
|
- row.totalMeasure = 1;
|
|
|
|
|
- } else {
|
|
|
|
|
- const frequencyType = Number(row.frequencyType) || 0;
|
|
|
|
|
- row.totalMeasure = Math.ceil(period / frequencyType) * frequency;
|
|
|
|
|
|
|
+ // 一口价
|
|
|
|
|
+ if (pricingType === '0') {
|
|
|
|
|
+ // 检查是否选择了"不限"
|
|
|
|
|
+ if (row.frequencyType === '不限') {
|
|
|
|
|
+ row.frequencyMeasure = ''; // 重置 frequencyMeasure
|
|
|
|
|
+ row.totalMeasure = 1;
|
|
|
|
|
+ } else {
|
|
|
|
|
+ const frequencyType = Number(row.frequencyType) || 0;
|
|
|
|
|
+ row.totalMeasure = Math.ceil(period / frequencyType) * frequency;
|
|
|
|
|
+ }
|
|
|
|
|
+ // 获取单价
|
|
|
|
|
+ const unitPrice = Number(row.conditioningProgramDetail?.cpFixedPricingRule?.unitPrice) || 0;
|
|
|
|
|
+ // 计算总价
|
|
|
|
|
+ row.totalPrice = (row.totalMeasure * unitPrice).toFixed(2);
|
|
|
|
|
+ } else if (pricingType === '1') {
|
|
|
|
|
+ // 按穴位计价
|
|
|
|
|
+ row.totalPrice =
|
|
|
|
|
+ row.conditioningProgramDetail?.cpDynamicPricingRule?.reduce((sum: number, item: any) => {
|
|
|
|
|
+ return sum + (Number(item.price) || 0);
|
|
|
|
|
+ }, 0) || 0;
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
- // 获取单价
|
|
|
|
|
- const unitPrice = Number(row.conditioningProgramDetail?.cpFixedPricingRule?.unitPrice) || 0;
|
|
|
|
|
- // 计算总价
|
|
|
|
|
- row.totalPrice = (row.totalMeasure * unitPrice).toFixed(2);
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 添加监听器
|
|
// 添加监听器
|
|
|
watch(
|
|
watch(
|
|
|
() => formData.items,
|
|
() => formData.items,
|
|
|
(newData) => {
|
|
(newData) => {
|
|
|
- console.log(newData, 'newData');
|
|
|
|
|
if (!newData) return;
|
|
if (!newData) return;
|
|
|
newData.forEach((row) => {
|
|
newData.forEach((row) => {
|
|
|
if (row?.days || row?.frequencyType || row?.frequencyMeasure) {
|
|
if (row?.days || row?.frequencyType || row?.frequencyMeasure) {
|
|
@@ -379,7 +377,6 @@ function cancel() {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
function confirm() {
|
|
function confirm() {
|
|
|
- // console.log(formData, '性别值'); // 打印性别值
|
|
|
|
|
const isValid = (formData.items ?? []).every((item: any) => {
|
|
const isValid = (formData.items ?? []).every((item: any) => {
|
|
|
delete item.id; // 删除 id 属性
|
|
delete item.id; // 删除 id 属性
|
|
|
if (item?.conditioningProgramDetail && item?.conditioningProgramDetail?.pricingType === '1') {
|
|
if (item?.conditioningProgramDetail && item?.conditioningProgramDetail?.pricingType === '1') {
|
|
@@ -395,11 +392,16 @@ function confirm() {
|
|
|
}
|
|
}
|
|
|
return true; // 返回 true 表示条件满足
|
|
return true; // 返回 true 表示条件满足
|
|
|
});
|
|
});
|
|
|
-
|
|
|
|
|
|
|
+ formData?.items?.forEach((row: any) => {
|
|
|
|
|
+ if (row.frequencyTypeing && row.frequencyTypeing.length > 0) {
|
|
|
|
|
+ row.frequencyType = row.frequencyTypeing[0];
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ console.log(localData.types, 'formData.items');
|
|
|
// 如果所有条件都满足,继续执行后续代码
|
|
// 如果所有条件都满足,继续执行后续代码
|
|
|
if (isValid) {
|
|
if (isValid) {
|
|
|
// 系统服务包
|
|
// 系统服务包
|
|
|
- if (props.data.types === 'system') {
|
|
|
|
|
|
|
+ if (localData.types === 'system') {
|
|
|
delete formData.types;
|
|
delete formData.types;
|
|
|
addSystemCw({
|
|
addSystemCw({
|
|
|
...formData,
|
|
...formData,
|
|
@@ -407,7 +409,7 @@ function confirm() {
|
|
|
notification.success({ message: '操作成功' });
|
|
notification.success({ message: '操作成功' });
|
|
|
VxeUI.modal.close(`edit-system-service-modal`);
|
|
VxeUI.modal.close(`edit-system-service-modal`);
|
|
|
});
|
|
});
|
|
|
- } else if (props.data.types === 'institution') {
|
|
|
|
|
|
|
+ } else if (localData.types === 'institution') {
|
|
|
if (fileList.value.length > 0) {
|
|
if (fileList.value.length > 0) {
|
|
|
const upImg = fileList.value[0].response?.url;
|
|
const upImg = fileList.value[0].response?.url;
|
|
|
formData.photo = upImg;
|
|
formData.photo = upImg;
|
|
@@ -438,7 +440,6 @@ const desiredConditions = ref<{ id: string; name: string }[]>([]);
|
|
|
const constitutionGroups = ref<{ id: string; name: string }[]>([]);
|
|
const constitutionGroups = ref<{ id: string; name: string }[]>([]);
|
|
|
async function getDesiredConditions() {
|
|
async function getDesiredConditions() {
|
|
|
const res = await getDictionaryMethod('conditioning_wrap_willill_state');
|
|
const res = await getDictionaryMethod('conditioning_wrap_willill_state');
|
|
|
- // console.log(res, 'getDesiredConditions');
|
|
|
|
|
if (res?.length > 0) {
|
|
if (res?.length > 0) {
|
|
|
desiredConditions.value = res.map((item: any) => ({
|
|
desiredConditions.value = res.map((item: any) => ({
|
|
|
id: item.value,
|
|
id: item.value,
|
|
@@ -450,7 +451,7 @@ async function getDesiredConditions() {
|
|
|
const genders = ref<{ id: string; name: string }[]>([]);
|
|
const genders = ref<{ id: string; name: string }[]>([]);
|
|
|
async function getGender() {
|
|
async function getGender() {
|
|
|
const res = await getDictionaryMethod('sys_user_sex');
|
|
const res = await getDictionaryMethod('sys_user_sex');
|
|
|
- if (res?.length > 0) {
|
|
|
|
|
|
|
+ if (res && res.length > 0) {
|
|
|
genders.value = res.map((item: any) => ({
|
|
genders.value = res.map((item: any) => ({
|
|
|
id: item.label,
|
|
id: item.label,
|
|
|
name: item.label,
|
|
name: item.label,
|
|
@@ -463,8 +464,7 @@ async function getGender() {
|
|
|
const ages = ref<{ id: string; name: string }[]>([]);
|
|
const ages = ref<{ id: string; name: string }[]>([]);
|
|
|
async function getAge() {
|
|
async function getAge() {
|
|
|
const res = await getDictionaryMethod('conditioning_wrap_rule_age');
|
|
const res = await getDictionaryMethod('conditioning_wrap_rule_age');
|
|
|
- console.log(res, 'getAge');
|
|
|
|
|
- if (res?.length > 0) {
|
|
|
|
|
|
|
+ if (res && res.length > 0) {
|
|
|
ages.value = res.map((item: any) => ({
|
|
ages.value = res.map((item: any) => ({
|
|
|
id: item.label,
|
|
id: item.label,
|
|
|
name: item.label,
|
|
name: item.label,
|
|
@@ -473,8 +473,7 @@ async function getAge() {
|
|
|
}
|
|
}
|
|
|
async function getConstitutionGroup() {
|
|
async function getConstitutionGroup() {
|
|
|
const res = await getDictionaryMethod('constitution_group');
|
|
const res = await getDictionaryMethod('constitution_group');
|
|
|
- // console.log(res, 'constitutionGroup');
|
|
|
|
|
- if (res?.length > 0) {
|
|
|
|
|
|
|
+ if (res && res.length > 0) {
|
|
|
constitutionGroups.value = res.map((item: any) => ({
|
|
constitutionGroups.value = res.map((item: any) => ({
|
|
|
id: item.value,
|
|
id: item.value,
|
|
|
name: item.label,
|
|
name: item.label,
|
|
@@ -486,12 +485,11 @@ onMounted(async () => {
|
|
|
getGender();
|
|
getGender();
|
|
|
getAge();
|
|
getAge();
|
|
|
getConstitutionGroup();
|
|
getConstitutionGroup();
|
|
|
- console.log(props.data, 'props.data');
|
|
|
|
|
- if (props.data.id) {
|
|
|
|
|
- props.data.type = 'institution';
|
|
|
|
|
|
|
+ if (localData.id) {
|
|
|
|
|
+ localData.types = 'institution'; // Modify the local copy instead
|
|
|
// 调编辑接口获取数据
|
|
// 调编辑接口获取数据
|
|
|
- const res: any = await getConditioningRecordDetailMethod(props.data);
|
|
|
|
|
- Object.assign(formData, res);
|
|
|
|
|
|
|
+ const res: any = await getConditioningRecordDetailMethod(localData);
|
|
|
|
|
+ Object.assign(formData, res); // Use the response to update formData
|
|
|
await nextTick(); // 确保视图更新
|
|
await nextTick(); // 确保视图更新
|
|
|
|
|
|
|
|
formData.conditioningWrapPatientMatchRule = res?.conditioningWrapPatientMatchRule ?? {
|
|
formData.conditioningWrapPatientMatchRule = res?.conditioningWrapPatientMatchRule ?? {
|
|
@@ -514,12 +512,16 @@ onMounted(async () => {
|
|
|
},
|
|
},
|
|
|
]
|
|
]
|
|
|
: [];
|
|
: [];
|
|
|
|
|
+ formData?.items?.forEach((row: any) => {
|
|
|
|
|
+ row.frequencyTypeing = row.frequencyType ? [row.frequencyType] : [];
|
|
|
|
|
+ });
|
|
|
}
|
|
}
|
|
|
- // console.log(formData.conditioningWrapPatientMatchRule, '初始化时性别值'); // 添加日志
|
|
|
|
|
await getProjectList();
|
|
await getProjectList();
|
|
|
|
|
+ console.log(formData.items, 'formData');
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
const tableData = computed(() => {
|
|
const tableData = computed(() => {
|
|
|
|
|
+ console.log(formData.items, 'formData.items');
|
|
|
return [...(formData.items ?? []), { ...emptyRow }];
|
|
return [...(formData.items ?? []), { ...emptyRow }];
|
|
|
});
|
|
});
|
|
|
|
|
|
|
@@ -579,16 +581,16 @@ let multiple = ref<boolean>(true);
|
|
|
<template>
|
|
<template>
|
|
|
<div style="padding: 24px">
|
|
<div style="padding: 24px">
|
|
|
<div class="flex">
|
|
<div class="flex">
|
|
|
- <div style="margin-bottom: 16px" class="mr-4" v-if="props.data?.types === 'institution'">
|
|
|
|
|
|
|
+ <div style="margin-bottom: 16px" class="mr-4" v-if="localData?.types === 'institution'">
|
|
|
<span>机构名称:</span>
|
|
<span>机构名称:</span>
|
|
|
<a-input style="width: 200px" v-model:value="formData.institutionName" />
|
|
<a-input style="width: 200px" v-model:value="formData.institutionName" />
|
|
|
</div>
|
|
</div>
|
|
|
<div style="margin-bottom: 16px" class="mr-6">
|
|
<div style="margin-bottom: 16px" class="mr-6">
|
|
|
<span>服务包名称:</span>
|
|
<span>服务包名称:</span>
|
|
|
<a-input style="width: 200px" v-model:value="formData.name" />
|
|
<a-input style="width: 200px" v-model:value="formData.name" />
|
|
|
- <a-button type="primary" @click="addInstitution" class="ml-4" v-if="props.data?.types === 'institution'">引入</a-button>
|
|
|
|
|
|
|
+ <a-button type="primary" @click="addInstitution" class="ml-4" v-if="localData?.types === 'institution'">引入</a-button>
|
|
|
</div>
|
|
</div>
|
|
|
- <div class="flex" v-if="props.data?.types === 'institution'">
|
|
|
|
|
|
|
+ <div class="flex" v-if="localData?.types === 'institution'">
|
|
|
<div class="w-35">服务形象照:</div>
|
|
<div class="w-35">服务形象照:</div>
|
|
|
<a-upload
|
|
<a-upload
|
|
|
:showUploadList="uploadProps"
|
|
:showUploadList="uploadProps"
|
|
@@ -731,7 +733,7 @@ let multiple = ref<boolean>(true);
|
|
|
</vxe-column>
|
|
</vxe-column>
|
|
|
<vxe-column title="预览" width="50">
|
|
<vxe-column title="预览" width="50">
|
|
|
<template #default="{ row }">
|
|
<template #default="{ row }">
|
|
|
- <EyeOutlined style="font-size: 18px; color: #1890ff; cursor: pointer" @click="onPreview(row)" />
|
|
|
|
|
|
|
+ <EyeOutlined style="font-size: 18px; color: #1890ff; cursor: pointer" @click="onPreview(row)" v-if="row?.conditioningProgramDetail?.id" />
|
|
|
</template>
|
|
</template>
|
|
|
</vxe-column>
|
|
</vxe-column>
|
|
|
<vxe-column field="days" title="周期" width="100">
|
|
<vxe-column field="days" title="周期" width="100">
|
|
@@ -754,13 +756,14 @@ let multiple = ref<boolean>(true);
|
|
|
</div>
|
|
</div>
|
|
|
<div>
|
|
<div>
|
|
|
<a-checkbox-group
|
|
<a-checkbox-group
|
|
|
|
|
+ v-model:value="row.frequencyTypeing"
|
|
|
@change="
|
|
@change="
|
|
|
(value) => {
|
|
(value) => {
|
|
|
|
|
+ row.frequencyTypeing = value.includes('不限') ? ['不限'] : [];
|
|
|
row.frequencyType = value.includes('不限') ? '不限' : '';
|
|
row.frequencyType = value.includes('不限') ? '不限' : '';
|
|
|
calculateCount(row);
|
|
calculateCount(row);
|
|
|
}
|
|
}
|
|
|
"
|
|
"
|
|
|
- v-model:value="row.frequencyType"
|
|
|
|
|
>
|
|
>
|
|
|
<a-checkbox value="不限">不限</a-checkbox>
|
|
<a-checkbox value="不限">不限</a-checkbox>
|
|
|
</a-checkbox-group>
|
|
</a-checkbox-group>
|
|
@@ -810,10 +813,10 @@ let multiple = ref<boolean>(true);
|
|
|
</div>
|
|
</div>
|
|
|
</template>
|
|
</template>
|
|
|
</vxe-column>
|
|
</vxe-column>
|
|
|
- <vxe-column field="conditioningProgramDetail.isOnline" title="线上项目" width="100">
|
|
|
|
|
|
|
+ <vxe-column field="conditioningProgramDetail.isOffline" title="线下项目" width="100">
|
|
|
<template #default="{ row }">
|
|
<template #default="{ row }">
|
|
|
- <span v-if="row.conditioningProgramDetail">
|
|
|
|
|
- {{ row.conditioningProgramDetail.isOnline === 'Y' ? '是' : '否' }}
|
|
|
|
|
|
|
+ <span v-if="row.conditioningProgramDetail?.isOffline">
|
|
|
|
|
+ {{ row.conditioningProgramDetail.isOffline === 'Y' ? '是' : '否' }}
|
|
|
</span>
|
|
</span>
|
|
|
<span v-else>-</span>
|
|
<span v-else>-</span>
|
|
|
</template>
|
|
</template>
|
|
@@ -827,7 +830,7 @@ let multiple = ref<boolean>(true);
|
|
|
</vxe-column>
|
|
</vxe-column>
|
|
|
<vxe-column field="remark" title="说明" width="180">
|
|
<vxe-column field="remark" title="说明" width="180">
|
|
|
<template #default="{ row }">
|
|
<template #default="{ row }">
|
|
|
- <a-textarea v-model:value="row.remark" style="max-width: 180px; width: 100%; height: 50px" rows="2" show-count :maxLength="200" />
|
|
|
|
|
|
|
+ <a-textarea v-model:value="row.remark" style="max-width: 180px; width: 100%; height: 50px" :rows="2" show-count :maxLength="200" />
|
|
|
</template>
|
|
</template>
|
|
|
</vxe-column>
|
|
</vxe-column>
|
|
|
</vxe-table>
|
|
</vxe-table>
|
|
@@ -841,11 +844,11 @@ let multiple = ref<boolean>(true);
|
|
|
}"
|
|
}"
|
|
|
:src="previewImg"
|
|
:src="previewImg"
|
|
|
/>
|
|
/>
|
|
|
- <div style="display: flex; justify-content: flex-end;">
|
|
|
|
|
|
|
+ <div style="display: flex; justify-content: flex-end">
|
|
|
<span style="font-weight: bold">合计:{{ formData.price }}元</span>
|
|
<span style="font-weight: bold">合计:{{ formData.price }}元</span>
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
- <div style="display: flex; justify-content: center;">
|
|
|
|
|
|
|
+ <div style="display: flex; justify-content: center">
|
|
|
<a-button style="margin-right: 24px" @click="cancel">取消</a-button>
|
|
<a-button style="margin-right: 24px" @click="cancel">取消</a-button>
|
|
|
<a-button type="primary" @click="confirm">确认</a-button>
|
|
<a-button type="primary" @click="confirm">确认</a-button>
|
|
|
</div>
|
|
</div>
|