bug修复10.12
This commit is contained in:
parent
c7c0570dd9
commit
c88a1d08ab
@ -24,7 +24,7 @@
|
||||
|
||||
<view class="field-group">
|
||||
<view class="field-label">开单科室</view>
|
||||
<view class="project-input" @tap="openBillDeptPicker">
|
||||
<view class="project-input" :class="{ 'disabled-input': hasBenefitEntries }" @tap="openBillDeptPicker">
|
||||
<text :class="billDeptId ? 'value-text' : 'placeholder-text'">{{ billDeptName || "请选择开单科室" }}</text>
|
||||
<uni-icons type="right" size="18" color="#999" />
|
||||
</view>
|
||||
@ -127,15 +127,15 @@
|
||||
<view v-if="projectEntry.selected && Number(projectEntry.validDays || 0) > 0" class="field-group">
|
||||
<view class="field-label">有效期</view>
|
||||
<view class="valid-time-wrap">
|
||||
<view class="valid-time-picker disabled-picker">
|
||||
<picker mode="multiSelector" :range="validTimeRange" :value="validTimeIndex" disabled
|
||||
<view class="valid-time-picker" @tap="prepareValidTimePicker(projectEntry)">
|
||||
<picker mode="multiSelector" :range="validTimeRange" :value="validTimeIndex"
|
||||
@columnchange="onValidTimeColumnChange" @change="changeValidTime($event, projectEntry)">
|
||||
<view class="picker-value" :class="projectEntry.validTime ? 'value-text' : 'placeholder-text'">
|
||||
{{ projectEntry.validTime || "选择日期/长期" }}
|
||||
</view>
|
||||
</picker>
|
||||
</view>
|
||||
<view class="valid-time-locked-tip">套餐有效期已锁定</view>
|
||||
<view class="unlimited-button" @tap="clearValidTime(projectEntry)">长期</view>
|
||||
</view>
|
||||
</view>
|
||||
<view v-if="projectEntry.selected" class="todo-switch-row">
|
||||
@ -339,15 +339,47 @@
|
||||
<view v-if="batchTodoVisible" class="picker-mask" @tap="closeBatchTodoPicker">
|
||||
<view class="batch-todo-picker" @tap.stop>
|
||||
<view class="picker-header">
|
||||
<text class="picker-title">生成待办批量操作</text>
|
||||
<text class="picker-title">权益批量操作</text>
|
||||
<uni-icons type="closeempty" size="22" color="#666" @tap="closeBatchTodoPicker" />
|
||||
</view>
|
||||
<view class="batch-todo-row" @tap.stop>
|
||||
<text>批量生成待办</text>
|
||||
<switch :checked="batchTodoConfig.todoEnabled" color="#0877f1"
|
||||
@change="batchTodoConfig.todoEnabled = $event.detail.value" />
|
||||
@change="batchTodoConfig.todoEnabled = $event.detail.value; batchTodoConfig.todoEnabledTouched = true" />
|
||||
</view>
|
||||
<view class="batch-todo-row">
|
||||
<text>批量设置项目有效期</text>
|
||||
<switch :checked="batchTodoConfig.setBenefitValidTime" color="#0877f1"
|
||||
@change="batchTodoConfig.setBenefitValidTime = $event.detail.value" />
|
||||
</view>
|
||||
<view v-if="batchTodoConfig.setBenefitValidTime" class="batch-todo-field">
|
||||
<text>项目有效期:</text>
|
||||
<picker mode="multiSelector" :range="validTimeRange" :value="validTimeIndex"
|
||||
@tap="openBatchDatePicker('benefitValidTime')" @columnchange="onValidTimeColumnChange"
|
||||
@change="changeTodoDate($event)">
|
||||
<text :class="batchTodoConfig.benefitValidTime ? 'value-text' : 'placeholder-text'">
|
||||
{{ batchTodoConfig.benefitValidTime || "选择日期" }}
|
||||
</text>
|
||||
</picker>
|
||||
<text class="batch-unlimited" @tap.stop="batchTodoConfig.benefitValidTime = ''">长期</text>
|
||||
</view>
|
||||
<template v-if="batchTodoConfig.todoEnabled">
|
||||
<view class="batch-todo-row">
|
||||
<text>批量设置回访计划有效期</text>
|
||||
<switch :checked="batchTodoConfig.setTodoExpireDate" color="#0877f1"
|
||||
@change="batchTodoConfig.setTodoExpireDate = $event.detail.value" />
|
||||
</view>
|
||||
<view v-if="batchTodoConfig.setTodoExpireDate" class="batch-todo-field">
|
||||
<text>截止日期:</text>
|
||||
<picker mode="multiSelector" :range="validTimeRange" :value="validTimeIndex"
|
||||
@tap="openBatchDatePicker('todoExpireDate')" @columnchange="onValidTimeColumnChange"
|
||||
@change="changeTodoDate($event)">
|
||||
<text :class="batchTodoConfig.todoExpireDate ? 'value-text' : 'placeholder-text'">
|
||||
{{ batchTodoConfig.todoExpireDate || "请选择截止日期" }}
|
||||
</text>
|
||||
</picker>
|
||||
<uni-icons type="right" size="16" color="#999" />
|
||||
</view>
|
||||
<view class="batch-todo-row">
|
||||
<text>待办完成后关联核销权益</text>
|
||||
<switch :checked="batchTodoConfig.deductBenefit" color="#0877f1"
|
||||
@ -529,6 +561,11 @@ const billDeptKeyword = ref("");
|
||||
const billDeptPickerVisible = ref(false);
|
||||
const billDeptExpanded = ref(new Set());
|
||||
const entries = ref([]);
|
||||
const hasBenefitEntries = computed(() => entries.value.some((entry) => (
|
||||
entry.isPackage
|
||||
|| entry.project?._id
|
||||
|| (Array.isArray(entry.projects) && entry.projects.some((project) => project?.project?._id || project?.selected))
|
||||
)));
|
||||
const saving = ref(false);
|
||||
const projectPickerVisible = ref(false);
|
||||
const projectPickerIndex = ref(-1);
|
||||
@ -560,6 +597,11 @@ const batchTodoConfig = ref({
|
||||
executorName: "",
|
||||
executeTeamId: "",
|
||||
executeTeamName: "",
|
||||
todoEnabledTouched: false,
|
||||
setBenefitValidTime: false,
|
||||
benefitValidTime: "",
|
||||
setTodoExpireDate: false,
|
||||
todoExpireDate: "",
|
||||
});
|
||||
const batchExecutorTarget = ref(null);
|
||||
const benefitDetailVisible = ref(false);
|
||||
@ -917,6 +959,21 @@ function changeBillDoctor(event) {
|
||||
const doctor = getBillDoctors()[Number(event.detail.value)] || null;
|
||||
billDoctorUserId.value = doctor?.userid || "";
|
||||
billDoctorName.value = doctor?.anotherName || doctor?.name || "";
|
||||
refreshTreatmentDoctorDefaults();
|
||||
}
|
||||
|
||||
function refreshTreatmentDoctorDefaults() {
|
||||
entries.value.forEach((entry) => {
|
||||
if (entry.isPackage) {
|
||||
entry.projects.forEach((project) => {
|
||||
if (project.selected && String(project.dept?._id || "") === String(billDeptId.value || "")) {
|
||||
applyTreatmentDefaults(project);
|
||||
}
|
||||
});
|
||||
} else if (entry.project?._id && String(entry.dept?._id || "") === String(billDeptId.value || "")) {
|
||||
applyTreatmentDefaults(entry);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
const filteredBillDeptOptions = computed(() => {
|
||||
@ -944,6 +1001,10 @@ const filteredBillDeptOptions = computed(() => {
|
||||
});
|
||||
|
||||
function openBillDeptPicker() {
|
||||
if (hasBenefitEntries.value) {
|
||||
uni.showToast({ title: "已有权益项目,请先清空后修改开单科室", icon: "none" });
|
||||
return;
|
||||
}
|
||||
billDeptPickerVisible.value = true;
|
||||
billDeptKeyword.value = "";
|
||||
billDeptExpanded.value = new Set(billDeptOptions.value.filter((item) => item.children?.length).map((item) => String(item._id)));
|
||||
@ -962,11 +1023,16 @@ function toggleBillDept(item) {
|
||||
}
|
||||
|
||||
function selectBillDept(dept) {
|
||||
if (hasBenefitEntries.value) {
|
||||
uni.showToast({ title: "已有权益项目,请先清空后修改开单科室", icon: "none" });
|
||||
return;
|
||||
}
|
||||
billDeptId.value = String(dept._id || "");
|
||||
billDeptName.value = dept.deptName || dept.name || "";
|
||||
billDeptValue.value = billDeptId.value;
|
||||
billDoctorUserId.value = "";
|
||||
billDoctorName.value = "";
|
||||
refreshTreatmentDoctorDefaults();
|
||||
closeBillDeptPicker();
|
||||
}
|
||||
|
||||
@ -1171,9 +1237,7 @@ function selectProject(project) {
|
||||
entry.discount = normalizeDiscount({ ...entry, discount: 10 });
|
||||
entry.isFree = false;
|
||||
calculateTotalPrice(entry);
|
||||
entry.dept = getProjectDepts(entry).length === 1 ? getProjectDepts(entry)[0] : null;
|
||||
entry.treatmentDoctorUserId = "";
|
||||
entry.treatmentDoctorName = "";
|
||||
applyTreatmentDefaults(entry);
|
||||
closeProjectPicker();
|
||||
}
|
||||
|
||||
@ -1184,7 +1248,7 @@ function createPackageProjectEntry(project = {}, packageItem = {}) {
|
||||
const validDate = hasValidDays && validDays > 0
|
||||
? formatDate(new Date(Date.now() + validDays * 24 * 60 * 60 * 1000))
|
||||
: "";
|
||||
return {
|
||||
const entry = {
|
||||
...createEntry(),
|
||||
project: normalizedProject,
|
||||
price: Number(normalizedProject.price ?? project.price ?? 0),
|
||||
@ -1196,11 +1260,26 @@ function createPackageProjectEntry(project = {}, packageItem = {}) {
|
||||
totalPrice: Number(project.totalPrice || 0),
|
||||
selected: packageItem.packageType === "fixed" || project.required === true,
|
||||
required: project.required === true,
|
||||
packageId: packageItem._id || "",
|
||||
packageName: packageItem.name || "",
|
||||
packageType: packageItem.packageType || "",
|
||||
hasValidDays,
|
||||
validDays,
|
||||
validTime: validDate,
|
||||
dept: normalizedProject.depts?.length === 1 ? normalizedProject.depts[0] : null,
|
||||
dept: null,
|
||||
};
|
||||
applyTreatmentDefaults(entry);
|
||||
return entry;
|
||||
}
|
||||
|
||||
function applyTreatmentDefaults(entry) {
|
||||
const depts = getProjectDepts(entry);
|
||||
entry.dept = depts.length === 1
|
||||
? depts[0]
|
||||
: depts.find((dept) => String(dept._id) === String(billDeptId.value)) || null;
|
||||
const doctor = getTreatmentDoctors(entry).find((item) => String(item.userid) === String(billDoctorUserId.value));
|
||||
entry.treatmentDoctorUserId = doctor?.userid || "";
|
||||
entry.treatmentDoctorName = doctor?.anotherName || doctor?.name || "";
|
||||
}
|
||||
|
||||
async function selectPackage(packageItem) {
|
||||
@ -1300,6 +1379,11 @@ function openBatchTodoPicker() {
|
||||
batchTodoVisible.value = true;
|
||||
}
|
||||
|
||||
function openBatchDatePicker(field) {
|
||||
todoDateTarget.value = { entry: batchTodoConfig.value, field };
|
||||
prepareValidTimePicker({ validTime: batchTodoConfig.value[field] });
|
||||
}
|
||||
|
||||
function closeBatchTodoPicker() {
|
||||
batchTodoVisible.value = false;
|
||||
}
|
||||
@ -1313,15 +1397,39 @@ function openBatchExecutorPicker() {
|
||||
}
|
||||
|
||||
function applyBatchTodoConfig() {
|
||||
let skippedValidityCount = 0;
|
||||
const applyConfig = (entry) => {
|
||||
if (!entry?.project?._id) return;
|
||||
if (batchTodoConfig.value.setBenefitValidTime) {
|
||||
if (entry.packageId && entry.hasValidDays !== true) {
|
||||
skippedValidityCount += 1;
|
||||
} else {
|
||||
entry.validTime = batchTodoConfig.value.benefitValidTime || "";
|
||||
}
|
||||
}
|
||||
if (batchTodoConfig.value.todoEnabledTouched) {
|
||||
entry.todoEnabled = Boolean(batchTodoConfig.value.todoEnabled);
|
||||
}
|
||||
const shouldApplyTodoSettings = batchTodoConfig.value.todoEnabledTouched
|
||||
|| batchTodoConfig.value.setTodoExpireDate
|
||||
|| Boolean(batchTodoConfig.value.executorUserId);
|
||||
if (!shouldApplyTodoSettings) return;
|
||||
if (!entry.todoEnabled) {
|
||||
if (batchTodoConfig.value.setTodoExpireDate && batchTodoConfig.value.todoExpireDate) {
|
||||
entry.todoConfig = entry.todoConfig || getDefaultTodoConfig(entry);
|
||||
entry.todoConfig.expireDate = batchTodoConfig.value.todoExpireDate;
|
||||
entry.todoConfig.expireDateManual = true;
|
||||
} else if (batchTodoConfig.value.todoEnabledTouched) {
|
||||
entry.todoConfig = null;
|
||||
}
|
||||
return;
|
||||
}
|
||||
entry.todoConfig = entry.todoConfig || getDefaultTodoConfig(entry);
|
||||
entry.todoConfig.deductBenefit = Boolean(batchTodoConfig.value.deductBenefit);
|
||||
if (batchTodoConfig.value.setTodoExpireDate && batchTodoConfig.value.todoExpireDate) {
|
||||
entry.todoConfig.expireDate = batchTodoConfig.value.todoExpireDate;
|
||||
entry.todoConfig.expireDateManual = true;
|
||||
}
|
||||
if (batchTodoConfig.value.executorUserId) {
|
||||
Object.assign(entry.todoConfig, {
|
||||
executorUserId: batchTodoConfig.value.executorUserId,
|
||||
@ -1339,6 +1447,9 @@ function applyBatchTodoConfig() {
|
||||
applyConfig(entry);
|
||||
}
|
||||
});
|
||||
if (skippedValidityCount) {
|
||||
uni.showToast({ title: `${skippedValidityCount}个套餐项目不支持有效期`, icon: "none" });
|
||||
}
|
||||
closeBatchTodoPicker()
|
||||
}
|
||||
|
||||
@ -1431,6 +1542,12 @@ function changeTodoDate(event) {
|
||||
const month = Number(validTimeRange.value[1][monthIndex].replace("月", ""));
|
||||
const day = Number(validTimeRange.value[2][dayIndex].replace("日", ""));
|
||||
const selectedDate = `${year}-${String(month).padStart(2, "0")}-${String(day).padStart(2, "0")}`;
|
||||
if (target.entry === batchTodoConfig.value) {
|
||||
batchTodoConfig.value[target.field] = selectedDate;
|
||||
validTimeIndex.value = [yearIndex, monthIndex, dayIndex];
|
||||
todoDateTarget.value = null;
|
||||
return;
|
||||
}
|
||||
target.entry.todoConfig[target.field] = selectedDate;
|
||||
validTimeIndex.value = [yearIndex, monthIndex, dayIndex];
|
||||
if (target.field === "planDate" && !target.entry.validTime) {
|
||||
@ -1455,8 +1572,9 @@ function syncPackageTotals(entry) {
|
||||
|
||||
function changeDept(event, entry) {
|
||||
entry.dept = getProjectDepts(entry)[Number(event.detail.value)] || null;
|
||||
entry.treatmentDoctorUserId = "";
|
||||
entry.treatmentDoctorName = "";
|
||||
const doctor = getTreatmentDoctors(entry).find((item) => String(item.userid) === String(billDoctorUserId.value));
|
||||
entry.treatmentDoctorUserId = doctor?.userid || "";
|
||||
entry.treatmentDoctorName = doctor?.anotherName || doctor?.name || "";
|
||||
}
|
||||
|
||||
function changeTreatmentDoctor(event, entry) {
|
||||
@ -2155,6 +2273,8 @@ async function submitEntries() {
|
||||
left: 0;
|
||||
z-index: 10001;
|
||||
box-sizing: border-box;
|
||||
max-height: calc(100vh - var(--keyboard-height));
|
||||
overflow-y: auto;
|
||||
padding: 28rpx 28rpx 32rpx;
|
||||
border-radius: 24rpx 24rpx 0 0;
|
||||
background: #fff;
|
||||
@ -2199,6 +2319,19 @@ async function submitEntries() {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.batch-todo-field picker {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.batch-todo-field picker text {
|
||||
display: block;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.batch-todo-actions {
|
||||
display: flex;
|
||||
gap: 20rpx;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user