From 6432e9990c0ae306dd5bd4ae5821ef3d02ab482f Mon Sep 17 00:00:00 2001 From: Your Name Date: Wed, 8 Jul 2026 14:53:41 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../consumer/prescription/order_list_h5.vue | 306 ++++++++++++++++-- 1 file changed, 282 insertions(+), 24 deletions(-) diff --git a/admin/src/views/consumer/prescription/order_list_h5.vue b/admin/src/views/consumer/prescription/order_list_h5.vue index 0438396d..a0111d43 100644 --- a/admin/src/views/consumer/prescription/order_list_h5.vue +++ b/admin/src/views/consumer/prescription/order_list_h5.vue @@ -858,31 +858,94 @@ - - +
+
+ 主方: + + +
+
+ 辅方: + + +
+
- + +
-
- 每天次数: - {{ detailPrescription.times_per_day ? detailPrescription.times_per_day + ' 次' : '—' }} -
-
- 处方开立: - {{ - detailPrescription.usage_days != null && detailPrescription.usage_days !== '' - ? detailPrescription.usage_days + ' 天' - : '—' - }} -
+ +
订单设置: {{ @@ -2152,6 +2215,93 @@ + + + +
主方
+ + + + +
+ + +
+
+ +
订单设置
+ +
+ + +
+
+
+ +
+ { const detailRxHerbs = computed(() => normalizeSlipHerbs(detailPrescription.value?.herbs)) +const detailHasAuxHerbs = computed(() => prescriptionHasAuxFormula(detailPrescription.value as any)) + +const detailAuxUsage = computed(() => { + const rx = detailPrescription.value as any + if (!rx || !prescriptionHasAuxFormula(rx)) return null + const raw = rx.aux_usage + if (raw == null || raw === '' || (Array.isArray(raw) && raw.length === 0)) return null + return normalizeSlipAuxUsageForm(raw, rx.prescription_type || '浓缩水丸') +}) + /** false=无权限;true/缺省兼容旧接口(旧版未下发该字段时仍展示药材) */ const detailHerbsVisible = computed(() => detailData.value?.prescription_detail_herbs_visible !== false) @@ -3844,6 +4007,101 @@ const patchRxPatientRules: FormRules = { phone: [{ required: true, message: '请输入手机号', trigger: 'blur' }] } +const patchUsageVisible = ref(false) +const patchUsageSaving = ref(false) +const patchUsageFormRef = ref() +const patchUsageForm = reactive({ + times_per_day: 3 as number | undefined, + usage_days: 7 as number | undefined, + aux_times_per_day: 3 as number | undefined, + aux_usage_days: 7 as number | undefined, + medication_days: undefined as number | undefined +}) +const patchUsageRules = computed(() => { + const rules: FormRules = { + times_per_day: [{ required: true, message: '请填写主方每天次数', trigger: 'change' }], + usage_days: [{ required: true, message: '请填写主方开立天数', trigger: 'change' }], + medication_days: [{ required: true, message: '请填写订单服用天数', trigger: 'change' }] + } + if (detailHasAuxHerbs.value) { + rules.aux_times_per_day = [{ required: true, message: '请填写辅方每天次数', trigger: 'change' }] + rules.aux_usage_days = [{ required: true, message: '请填写辅方开立天数', trigger: 'change' }] + } + return rules +}) + +function openPatchUsageDialog() { + const rx = detailPrescription.value + const ord = detailData.value + if (!rx || !ord?.id || !ord.prescription_id) { + feedback.msgWarning('无处方数据') + return + } + const aux = detailAuxUsage.value + patchUsageForm.times_per_day = + Number(rx.times_per_day) > 0 ? Number(rx.times_per_day) : 3 + patchUsageForm.usage_days = + Number(rx.usage_days) > 0 ? Number(rx.usage_days) : 7 + patchUsageForm.aux_times_per_day = + aux && Number(aux.times_per_day) > 0 ? Number(aux.times_per_day) : 3 + patchUsageForm.aux_usage_days = + aux && Number(aux.usage_days) > 0 ? Number(aux.usage_days) : 7 + const md = Number(ord.medication_days) + patchUsageForm.medication_days = md > 0 ? md : Number(rx.usage_days) > 0 ? Number(rx.usage_days) : 7 + patchUsageVisible.value = true + nextTick(() => patchUsageFormRef.value?.clearValidate()) +} + +function resetPatchUsageForm() { + patchUsageForm.times_per_day = 3 + patchUsageForm.usage_days = 7 + patchUsageForm.aux_times_per_day = 3 + patchUsageForm.aux_usage_days = 7 + patchUsageForm.medication_days = undefined +} + +async function submitPatchUsage() { + const form = patchUsageFormRef.value + if (!form) return + try { + await form.validate() + } catch { + return + } + const ordId = detailData.value?.id + if (!ordId) return + patchUsageSaving.value = true + try { + const payload: { + id: number + times_per_day: number + usage_days: number + medication_days: number + aux_times_per_day?: number + aux_usage_days?: number + } = { + id: ordId, + times_per_day: Number(patchUsageForm.times_per_day), + usage_days: Number(patchUsageForm.usage_days), + medication_days: Number(patchUsageForm.medication_days) + } + if (detailHasAuxHerbs.value) { + payload.aux_times_per_day = Number(patchUsageForm.aux_times_per_day) + payload.aux_usage_days = Number(patchUsageForm.aux_usage_days) + } + await prescriptionOrderPatchPrescriptionUsage(payload) + feedback.msgSuccess('保存成功') + patchUsageVisible.value = false + await refreshCurrentPrescriptionOrderDetail() + await fetchLogs(ordId) + getLists() + } catch { + /* 拦截器已提示 */ + } finally { + patchUsageSaving.value = false + } +} + function openPatchRxPatientDialog() { const rx = detailPrescription.value const ord = detailData.value