|
|
@@ -312,7 +312,6 @@ const displayTableData = computed(() => {
|
|
|
const isShowDelivery = ref<boolean>(false);
|
|
|
// 监听 displayTableData 的变化
|
|
|
watch(displayTableData, (newValue, oldValue) => {
|
|
|
- console.log('displayTableData 变化了:', newValue);
|
|
|
if (newValue.length > 0) {
|
|
|
isShowDelivery.value = newValue.some((item) => {
|
|
|
return item.conditioningProgramDetail?.isDelivery === 'Y';
|
|
|
@@ -320,7 +319,6 @@ watch(displayTableData, (newValue, oldValue) => {
|
|
|
newValue.forEach((row: any) => {
|
|
|
row.frequencyTypeing = row.frequencyType ? [row.frequencyType] : [];
|
|
|
});
|
|
|
- console.log(newValue, '开过的newValue');
|
|
|
}
|
|
|
});
|
|
|
const totalPrice = computed(() => {
|
|
|
@@ -456,7 +454,6 @@ function detailPreview(row) {
|
|
|
}
|
|
|
}
|
|
|
function editPart(row) {
|
|
|
- if (row.conditioningProgramDetail.id) {
|
|
|
VxeUI.modal.open({
|
|
|
title: `编辑部位`,
|
|
|
height: 700,
|
|
|
@@ -470,17 +467,13 @@ function editPart(row) {
|
|
|
default() {
|
|
|
return h(AcupointEdit, <any>{
|
|
|
data: row,
|
|
|
- onSubmit(data: PlanModel) {
|
|
|
- refresh(page.value);
|
|
|
+ onSubmit(data: any) {
|
|
|
VxeUI.modal.close(`edit-part-modal`);
|
|
|
},
|
|
|
});
|
|
|
},
|
|
|
},
|
|
|
});
|
|
|
- } else {
|
|
|
- message.warning('请先添加服务包');
|
|
|
- }
|
|
|
}
|
|
|
const allProjects = ref<
|
|
|
Array<{
|
|
|
@@ -513,6 +506,9 @@ function calculateCount(row: any) {
|
|
|
const pricingType = row.conditioningProgramDetail.pricingType;
|
|
|
const period = Number(row.days) || 0;
|
|
|
const frequency = Number(row.frequencyMeasure) || 0;
|
|
|
+ const maxCount = row.conditioningProgramDetail.cpDynamicPricingRule?.[1]?.max;
|
|
|
+ const acCount = (row.acuMeridianNames?.length ?? 0) + (row.acuPointNames?.length ?? 0);
|
|
|
+ // console.log(row, 'calculateCount',pricingType);
|
|
|
// 一口价
|
|
|
if (pricingType === '0') {
|
|
|
// 检查是否选择了"不限"
|
|
|
@@ -530,10 +526,39 @@ function calculateCount(row: any) {
|
|
|
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 frequencyType = Number(row.frequencyType) || 0;
|
|
|
+ row.totalMeasure = Math.ceil((period / frequencyType) * frequency);
|
|
|
+ if (acCount > maxCount) {
|
|
|
+ if (row.conditioningProgramDetail.cpDynamicPricingRule?.[1]?.priceType === 0) {
|
|
|
+ // 单价
|
|
|
+ let unitPrice: number = row.conditioningProgramDetail.cpDynamicPricingRule[1].price*acCount;
|
|
|
+ row.unitPrice = unitPrice;
|
|
|
+ // row.totalMeasure = Math.ceil((period / frequencyType) * frequency);
|
|
|
+ row.totalPrice = Math.ceil((period / frequencyType) * frequency * unitPrice);
|
|
|
+ } else if (row.conditioningProgramDetail.cpDynamicPricingRule?.[1]?.priceType === 1) {
|
|
|
+ // 一口价
|
|
|
+ row.unitPrice = '-';
|
|
|
+ row.totalPrice = row.conditioningProgramDetail.cpDynamicPricingRule[1].price;
|
|
|
+ // row.totalMeasure = Math.ceil((period / frequencyType) * frequency);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ // console.log("数量很少",row.conditioningProgramDetail.cpDynamicPricingRule?.[0]?.priceType)
|
|
|
+ if (row.conditioningProgramDetail.cpDynamicPricingRule?.length > 0) {
|
|
|
+ if (row.conditioningProgramDetail.cpDynamicPricingRule?.[0]?.priceType === 0) {
|
|
|
+ // 单价
|
|
|
+ let unitPrice: number = row.conditioningProgramDetail.cpDynamicPricingRule[0].price*acCount;
|
|
|
+ row.unitPrice = unitPrice;
|
|
|
+ // row.totalMeasure = Math.ceil((period / frequencyType) * frequency);
|
|
|
+ row.totalPrice = Math.ceil((period / frequencyType) * frequency * unitPrice );
|
|
|
+ // console.log("数量很少",row.totalPrice,'row.unitPrice',row.unitPrice,'period',period,'frequencyType',frequencyType,'acCount',acCount)
|
|
|
+ } else if (row.conditioningProgramDetail.cpDynamicPricingRule?.[0]?.priceType === 1) {
|
|
|
+ // 一口价
|
|
|
+ row.unitPrice = '-';
|
|
|
+ row.totalPrice = row.conditioningProgramDetail.cpDynamicPricingRule[0].price;
|
|
|
+ // row.totalMeasure = Math.ceil((period / frequencyType) * frequency);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
// function calculateCount(row: any) {
|
|
|
@@ -896,7 +921,7 @@ watch(showProjectPopover, (val) => {
|
|
|
<a-input v-model:value="row.frequencyType" style="width: 50px" @change="() => calculateCount(row)" :disabled="row.frequencyType === '不限'" />
|
|
|
<span>天</span>
|
|
|
<a-input v-model:value="row.frequencyMeasure" style="width: 50px" @change="() => calculateCount(row)" :disabled="row.frequencyType === '不限'" />
|
|
|
- <span>{{ row.conditioningProgramDetail?.cpFixedPricingRule?.convertUnit }}</span>
|
|
|
+ <span>{{ row.conditioningProgramDetail?.cpFixedPricingRule?.convertUnit ? row.conditioningProgramDetail?.cpFixedPricingRule?.convertUnit : '次' }}</span>
|
|
|
</div>
|
|
|
<div>
|
|
|
<a-checkbox-group
|
|
|
@@ -918,7 +943,7 @@ watch(showProjectPopover, (val) => {
|
|
|
<a-input v-model:value="row.frequencyType" style="width: 50px" @change="() => calculateCount(row)" />
|
|
|
<span>天</span>
|
|
|
<a-input v-model:value="row.frequencyMeasure" style="width: 50px" @change="() => calculateCount(row)" />
|
|
|
- <span>{{ row.conditioningProgramDetail?.cpFixedPricingRule?.convertUnit }}</span>
|
|
|
+ <span>{{ row.conditioningProgramDetail?.cpFixedPricingRule?.convertUnit ? row.conditioningProgramDetail?.cpFixedPricingRule?.convertUnit : '次' }}</span>
|
|
|
</div>
|
|
|
</template>
|
|
|
</vxe-column>
|
|
|
@@ -934,12 +959,12 @@ watch(showProjectPopover, (val) => {
|
|
|
</vxe-column>
|
|
|
<vxe-column field="row?.conditioningProgramDetail?.cpFixedPricingRule?.unit" title="单位" width="60">
|
|
|
<template #default="{ row }">
|
|
|
- {{ row?.conditioningProgramDetail?.cpFixedPricingRule?.pricingUnit || '-' }}
|
|
|
+ {{ row?.conditioningProgramDetail?.cpFixedPricingRule?.pricingUnit ? row?.conditioningProgramDetail?.cpFixedPricingRule?.pricingUnit : '次' }}
|
|
|
</template>
|
|
|
</vxe-column>
|
|
|
<vxe-column field="row.conditioningProgramDetail.cpFixedPricingRule.unitPrice" title="单价(元)" width="100">
|
|
|
<template #default="{ row }">
|
|
|
- {{ row.conditioningProgramDetail?.cpFixedPricingRule?.unitPrice ?? '-' }}
|
|
|
+ {{ row?.conditioningProgramDetail?.pricingType === '0' ? row.conditioningProgramDetail?.cpFixedPricingRule?.unitPrice : row?.unitPrice }}
|
|
|
</template>
|
|
|
</vxe-column>
|
|
|
<vxe-column field="row.totalPrice" title="总价(元)" width="auto" @change="() => calculateCount(row)">
|