更新
This commit is contained in:
@@ -0,0 +1,93 @@
|
||||
<template>
|
||||
<el-dialog
|
||||
v-model="visible"
|
||||
title="修改订单创建时间"
|
||||
width="min(440px, 94vw)"
|
||||
append-to-body
|
||||
destroy-on-close
|
||||
:close-on-click-modal="false"
|
||||
:close-on-press-escape="!submitting"
|
||||
:show-close="!submitting"
|
||||
>
|
||||
<el-form ref="formRef" :model="form" :rules="rules" label-position="top">
|
||||
<el-form-item label="业务订单">
|
||||
<span class="break-all">{{ orderNo || `#${form.id}` }}</span>
|
||||
</el-form-item>
|
||||
<el-form-item label="创建时间" prop="create_time">
|
||||
<el-date-picker
|
||||
v-model="form.create_time"
|
||||
type="datetime"
|
||||
format="YYYY-MM-DD HH:mm:ss"
|
||||
value-format="YYYY-MM-DD HH:mm:ss"
|
||||
placeholder="请选择创建时间"
|
||||
:clearable="false"
|
||||
:disabled="submitting"
|
||||
class="!w-full"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<p class="text-xs text-gray-500">保存后,列表和业绩统计将按新的创建时间归属日期,修改记录可在订单日志中查看。</p>
|
||||
<template #footer>
|
||||
<el-button :disabled="submitting" @click="visible = false">取消</el-button>
|
||||
<el-button type="primary" :loading="submitting" @click="submit">保存</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { nextTick, reactive, ref } from 'vue'
|
||||
import type { FormInstance, FormRules } from 'element-plus'
|
||||
import { prescriptionOrderEditTime } from '@/api/tcm'
|
||||
import feedback from '@/utils/feedback'
|
||||
|
||||
const emit = defineEmits<{ (event: 'saved', id: number): void }>()
|
||||
const visible = ref(false)
|
||||
const submitting = ref(false)
|
||||
const orderNo = ref('')
|
||||
const formRef = ref<FormInstance>()
|
||||
const form = reactive({ id: 0, create_time: '' })
|
||||
const rules: FormRules = {
|
||||
create_time: [{ required: true, message: '请选择创建时间', trigger: 'change' }]
|
||||
}
|
||||
|
||||
// 列表可能返回日期字符串或历史 Unix 时间戳;保留秒,避免只打开弹窗就丢失精度。
|
||||
function editableTime(value: unknown): string {
|
||||
const raw = String(value ?? '').trim()
|
||||
if (/^\d{4}-\d{2}-\d{2}[ T]\d{2}:\d{2}(:\d{2})?$/.test(raw)) {
|
||||
return raw.replace('T', ' ').padEnd(19, ':00')
|
||||
}
|
||||
if (!/^\d+$/.test(raw) || Number(raw) <= 0) return ''
|
||||
const timestamp = Number(raw)
|
||||
const date = new Date(timestamp < 1e11 ? timestamp * 1000 : timestamp)
|
||||
if (Number.isNaN(date.getTime())) return ''
|
||||
const pad = (part: number) => String(part).padStart(2, '0')
|
||||
return `${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())} ${pad(date.getHours())}:${pad(date.getMinutes())}:${pad(date.getSeconds())}`
|
||||
}
|
||||
|
||||
function open(row: { id?: unknown; order_no?: unknown; create_time?: unknown }) {
|
||||
if (submitting.value || !Number(row.id)) return
|
||||
form.id = Number(row.id)
|
||||
form.create_time = editableTime(row.create_time)
|
||||
orderNo.value = String(row.order_no || '')
|
||||
visible.value = true
|
||||
nextTick(() => formRef.value?.clearValidate())
|
||||
}
|
||||
|
||||
async function submit() {
|
||||
if (submitting.value || !formRef.value) return
|
||||
submitting.value = true
|
||||
try {
|
||||
if (!(await formRef.value.validate().catch(() => false))) return
|
||||
await prescriptionOrderEditTime({ id: form.id, create_time: form.create_time })
|
||||
feedback.msgSuccess('订单创建时间已修改')
|
||||
visible.value = false
|
||||
emit('saved', form.id)
|
||||
} catch {
|
||||
// 请求拦截器展示错误,保留已填写的时间便于重试。
|
||||
} finally {
|
||||
submitting.value = false
|
||||
}
|
||||
}
|
||||
|
||||
defineExpose({ open })
|
||||
</script>
|
||||
@@ -178,7 +178,8 @@ export function logActionText(act: string) {
|
||||
ej_pharmacy_callback: '洛阳药房状态',
|
||||
patch_rx_patient: '处方患者信息',
|
||||
patch_rx_usage: '服用参数',
|
||||
update_amount: '修改订单金额',
|
||||
update_amount: '修改订单金额',
|
||||
edit_time: '修改创建时间',
|
||||
complete: '完成订单',
|
||||
refund: '退款',
|
||||
manual_log: '手工备注',
|
||||
|
||||
@@ -182,7 +182,6 @@
|
||||
<el-select v-model="editForm.appointment_type" class="!w-full">
|
||||
<el-option label="视频问诊" value="video" />
|
||||
<el-option label="图文问诊" value="text" />
|
||||
<el-option label="电话问诊" value="phone" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="渠道来源" required>
|
||||
|
||||
@@ -1585,7 +1585,7 @@ import DaterangePicker from '@/components/daterange-picker/index.vue'
|
||||
import MedicineNameSelect from '@/components/medicine-name-select/index.vue'
|
||||
import PrescriptionSlip from '@/components/prescription-slip/index.vue'
|
||||
import { Search, Download, Printer, EditPen } from '@element-plus/icons-vue'
|
||||
import { computed, onMounted, reactive, ref, watch, nextTick, defineAsyncComponent } from 'vue'
|
||||
import { computed, onMounted, onActivated, onDeactivated, reactive, ref, watch, nextTick, defineAsyncComponent } from 'vue'
|
||||
import { useRouter } from 'vue-router'
|
||||
import html2canvas from 'html2canvas'
|
||||
import jsPDF from 'jspdf'
|
||||
@@ -3882,7 +3882,18 @@ const handleDelete = async (id: number) => {
|
||||
getLists()
|
||||
}
|
||||
|
||||
onMounted(async () => {
|
||||
// 从订单页返回缓存的处方列表时,重新读取退款后的占用状态。
|
||||
let refreshOnReturn = false
|
||||
onDeactivated(() => {
|
||||
refreshOnReturn = true
|
||||
})
|
||||
onActivated(() => {
|
||||
if (!refreshOnReturn) return
|
||||
refreshOnReturn = false
|
||||
getLists()
|
||||
})
|
||||
|
||||
onMounted(async () => {
|
||||
await loadRoleOptions()
|
||||
await loadRegionData()
|
||||
await loadServicePackageOptions()
|
||||
|
||||
@@ -550,7 +550,13 @@
|
||||
type="primary"
|
||||
link
|
||||
@click="openEdit(row)"
|
||||
>编辑</el-button>
|
||||
>编辑</el-button>
|
||||
<el-button
|
||||
v-perms="['tcm.prescriptionOrder/editTime']"
|
||||
type="primary"
|
||||
link
|
||||
@click="orderTimeDialogRef?.open(row)"
|
||||
>修改创建时间</el-button>
|
||||
<el-button
|
||||
v-if="canQuickTrackRow(row)"
|
||||
v-perms="['tcm.prescriptionOrder/ddcode']"
|
||||
@@ -649,7 +655,12 @@
|
||||
>{{ shipModeLabel(detail.ship_mode) }}</el-tag>
|
||||
</div>
|
||||
</template>
|
||||
<template #header-actions="{ detail }">
|
||||
<template #header-actions="{ detail }">
|
||||
<el-button
|
||||
v-perms="['tcm.prescriptionOrder/editTime']"
|
||||
size="small"
|
||||
@click="orderTimeDialogRef?.open(detail)"
|
||||
>修改创建时间</el-button>
|
||||
<gancao-submission-reconcile-button
|
||||
:order="detail"
|
||||
@resolved="handleGancaoSubmissionResolved"
|
||||
@@ -1511,7 +1522,9 @@
|
||||
</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
<!-- 订单退款:须填写原因 -->
|
||||
<prescription-order-time-dialog ref="orderTimeDialogRef" @saved="onOrderTimeSaved" />
|
||||
|
||||
<!-- 订单退款:须填写原因 -->
|
||||
<el-dialog
|
||||
v-model="refundOrderDialogVisible"
|
||||
title="订单退款"
|
||||
@@ -2031,7 +2044,8 @@ import { computed, onMounted, reactive, ref, nextTick, watch, defineAsyncCompone
|
||||
import { useRoute } from 'vue-router'
|
||||
import { ArrowDown, InfoFilled, QuestionFilled, Search, Calendar, Document, Link as LinkIcon, Wallet } from '@element-plus/icons-vue'
|
||||
import ListTimeFilter from '@/components/list-time-filter/index.vue'
|
||||
import PrescriptionOrderDetailDrawer from './components/PrescriptionOrderDetailDrawer.vue'
|
||||
import PrescriptionOrderDetailDrawer from './components/PrescriptionOrderDetailDrawer.vue'
|
||||
import PrescriptionOrderTimeDialog from './components/PrescriptionOrderTimeDialog.vue'
|
||||
import GancaoSubmissionReconcileButton from './components/GancaoSubmissionReconcileButton.vue'
|
||||
import {
|
||||
TCM_ASSISTANT_ROLE_ID,
|
||||
@@ -3087,7 +3101,13 @@ function canUploadPharmacyRow(row: {
|
||||
}
|
||||
|
||||
// ─── 详情抽屉(共享组件 PrescriptionOrderDetailDrawer):状态桥接 ───
|
||||
const detailDrawerRef = ref<InstanceType<typeof PrescriptionOrderDetailDrawer>>()
|
||||
const detailDrawerRef = ref<InstanceType<typeof PrescriptionOrderDetailDrawer>>()
|
||||
const orderTimeDialogRef = ref<InstanceType<typeof PrescriptionOrderTimeDialog>>()
|
||||
|
||||
async function onOrderTimeSaved(id: number) {
|
||||
getLists()
|
||||
await detailDrawerRef.value?.refreshIfCurrent(id)
|
||||
}
|
||||
/** 当前详情数据(组件内部 ref 的桥接;可原地修改属性,整体刷新请用 detailDrawerRef.refresh()) */
|
||||
const detailData = computed(() => (detailDrawerRef.value?.detail ?? null) as Record<string, any> | null)
|
||||
|
||||
|
||||
@@ -474,7 +474,12 @@
|
||||
v-perms="['tcm.prescriptionOrder/edit']"
|
||||
size="small"
|
||||
@click="openEdit(row)"
|
||||
>编辑</el-button>
|
||||
>编辑</el-button>
|
||||
<el-button
|
||||
v-perms="['tcm.prescriptionOrder/editTime']"
|
||||
size="small"
|
||||
@click="orderTimeDialogRef?.open(row)"
|
||||
>修改创建时间</el-button>
|
||||
<el-button
|
||||
v-if="canQuickTrackRow(row)"
|
||||
v-perms="['tcm.prescriptionOrder/ddcode']"
|
||||
@@ -592,8 +597,13 @@
|
||||
>
|
||||
撤回支付审核
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="canShipRow(detailData)"
|
||||
<el-button
|
||||
v-perms="['tcm.prescriptionOrder/editTime']"
|
||||
size="small"
|
||||
@click="orderTimeDialogRef?.open(detailData)"
|
||||
>修改创建时间</el-button>
|
||||
<el-button
|
||||
v-if="canShipRow(detailData)"
|
||||
v-perms="['tcm.prescriptionOrder/ship']"
|
||||
type="primary"
|
||||
size="small"
|
||||
@@ -2566,12 +2576,13 @@
|
||||
</div>
|
||||
</el-drawer>
|
||||
|
||||
<!-- 与 consumer/prescription/index、诊单 edit 同一套界面:只读诊单与全部分页签 -->
|
||||
<TcmDiagnosisEditView ref="diagnosisViewRef" />
|
||||
<!-- 与 consumer/prescription/index、诊单 edit 同一套界面:只读诊单与全部分页签 -->
|
||||
<TcmDiagnosisEditView ref="diagnosisViewRef" />
|
||||
<prescription-order-time-dialog ref="orderTimeDialogRef" @saved="onOrderTimeSaved" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup name="prescriptionOrderListH5">
|
||||
<script lang="ts" setup name="prescriptionOrderListH5">
|
||||
import { computed, onMounted, reactive, ref, nextTick, watch, defineAsyncComponent } from 'vue'
|
||||
import {
|
||||
Refresh,
|
||||
@@ -2585,7 +2596,8 @@ import {
|
||||
Wallet,
|
||||
User
|
||||
} from '@element-plus/icons-vue'
|
||||
import ListTimeFilter from '@/components/list-time-filter/index.vue'
|
||||
import ListTimeFilter from '@/components/list-time-filter/index.vue'
|
||||
import PrescriptionOrderTimeDialog from './components/PrescriptionOrderTimeDialog.vue'
|
||||
import GancaoSubmissionReconcileButton from './components/GancaoSubmissionReconcileButton.vue'
|
||||
import { useListTimeFilter } from '@/hooks/useListTimeFilter'
|
||||
import {
|
||||
@@ -3513,7 +3525,15 @@ function canUpdateAmount(row: { id?: number; fulfillment_status?: number } | nul
|
||||
|
||||
const detailVisible = ref(false)
|
||||
const detailLoading = ref(false)
|
||||
const detailData = ref<Record<string, any> | null>(null)
|
||||
const detailData = ref<Record<string, any> | null>(null)
|
||||
const orderTimeDialogRef = ref<InstanceType<typeof PrescriptionOrderTimeDialog>>()
|
||||
|
||||
async function onOrderTimeSaved(id: number) {
|
||||
getLists()
|
||||
if (detailVisible.value && Number(detailData.value?.id) === id) {
|
||||
await openDetail(id)
|
||||
}
|
||||
}
|
||||
|
||||
const detailServicePackageText = computed(() =>
|
||||
formatServicePackageLabels(detailData.value?.service_package, servicePackageOptions.value)
|
||||
@@ -3838,7 +3858,8 @@ function logActionText(act: string) {
|
||||
patch_rx_patient: '处方患者信息',
|
||||
update_amount: '修改订单金额',
|
||||
complete: '完成订单',
|
||||
refund: '退款'
|
||||
refund: '退款',
|
||||
edit_time: '修改创建时间'
|
||||
}
|
||||
return m[act] || act
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user