新增
This commit is contained in:
@@ -5,6 +5,21 @@ export function orderLists(params: any) {
|
||||
return request.get({ url: '/order.order/lists', params })
|
||||
}
|
||||
|
||||
// 同步企业微信对外收款账单到订单
|
||||
export function syncWechatWorkBills(params?: { begin_time?: string; end_time?: string }) {
|
||||
return request.get({ url: '/order.order/syncWechatWorkBills', params })
|
||||
}
|
||||
|
||||
// 调试:测试企业微信对外收款 API 连接
|
||||
export function syncWechatWorkBillsDebug(params?: { begin_time?: string; end_time?: string; payee_userid?: string }) {
|
||||
return request.get({ url: '/order.order/syncWechatWorkBillsDebug', params })
|
||||
}
|
||||
|
||||
// 今日收益(按角色权限)
|
||||
export function orderTodayRevenue() {
|
||||
return request.get({ url: '/order.order/todayRevenue' })
|
||||
}
|
||||
|
||||
// 订单统计(0退款,1挂号费,2问诊费,3药品费用,4首付,5尾款,6其他)
|
||||
export function orderStats(params?: { order_type?: number; days?: number }) {
|
||||
return request.get({ url: '/order.order/orderStats', params })
|
||||
@@ -20,6 +35,11 @@ export function orderCreate(params: any) {
|
||||
return request.post({ url: '/order.order/create', params })
|
||||
}
|
||||
|
||||
// 创建企业微信对外收款订单(返回 order_no 供企业微信发起收款时使用)
|
||||
export function orderCreateForWechatWork(params: any) {
|
||||
return request.post({ url: '/order.order/createForWechatWork', params })
|
||||
}
|
||||
|
||||
// 编辑订单
|
||||
export function orderEdit(params: any) {
|
||||
return request.post({ url: '/order.order/edit', params })
|
||||
|
||||
@@ -212,9 +212,9 @@
|
||||
<div class="prescription-footer">
|
||||
<div class="footer-left">
|
||||
<div class="footer-dosage">
|
||||
共 {{ savedPrescription.dose_count }}{{ savedPrescription.dose_unit || '剂' }}, {{ savedPrescription.usage_instruction }}
|
||||
共{{ savedPrescription.dose_count }}{{ savedPrescription.dose_unit || '剂' }}, {{ savedPrescription.usage_instruction }}
|
||||
</div>
|
||||
<div class="footer-amount">金额 {{ savedPrescription.amount }}</div>
|
||||
<!-- <div class="footer-amount">金额 {{ savedPrescription.amount }}</div> -->
|
||||
</div>
|
||||
<div class="footer-right footer-sign">
|
||||
<span class="signature-cell">
|
||||
@@ -230,6 +230,11 @@
|
||||
<!-- <span>核对发药</span> -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="prescription-area">
|
||||
<div >成都双流甄养堂互联网医院有限公司 联系方式:4001667339</div>
|
||||
<div >地址 :四川省成都市双流区黄甲街道黄龙大道二段280号</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="flex justify-end gap-2 mt-4">
|
||||
@@ -738,9 +743,24 @@ defineExpose({
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: flex-start;
|
||||
position: relative;
|
||||
margin-bottom: 12px;
|
||||
padding-bottom: 12px;
|
||||
border-bottom: 1px solid #ddd;
|
||||
|
||||
.prescription-title {
|
||||
flex: 1;
|
||||
text-align: center;
|
||||
font-size: 20px;
|
||||
font-weight: 600;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.prescription-type {
|
||||
position: absolute;
|
||||
right: 0;
|
||||
top: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.prescription-void-info {
|
||||
@@ -831,7 +851,11 @@ defineExpose({
|
||||
margin: 12px 0;
|
||||
height: 300px;
|
||||
}
|
||||
|
||||
.prescription-area {
|
||||
border-top: 1px dashed #ddd;
|
||||
padding-top: 12px;
|
||||
margin-top: 10px;
|
||||
}
|
||||
.prescription-footer {
|
||||
margin-top: 16px;
|
||||
padding-top: 12px;
|
||||
|
||||
+357
-28
@@ -50,6 +50,7 @@
|
||||
<el-button type="primary" @click="handleSearch">查询</el-button>
|
||||
<el-button @click="handleReset">重置</el-button>
|
||||
<export-data
|
||||
v-perms="['order.order/export']"
|
||||
class="ml-2.5"
|
||||
:fetch-fun="orderExport"
|
||||
:params="queryParams"
|
||||
@@ -63,10 +64,35 @@
|
||||
>
|
||||
+ 创建订单
|
||||
</el-button>
|
||||
<el-button
|
||||
v-perms="['order.order/alltongbu']"
|
||||
type="warning"
|
||||
class="ml-2.5"
|
||||
:loading="syncLoading"
|
||||
@click="handleSyncWechatWork"
|
||||
>
|
||||
同步企业微信收款
|
||||
</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-card>
|
||||
|
||||
<!-- Tab 筛选 + 今日收益 -->
|
||||
<el-card class="!border-none mt-4" shadow="never">
|
||||
<div class="flex items-center justify-between mb-4">
|
||||
<el-tabs v-model="patientAssociationTab" @tab-change="handleTabChange">
|
||||
<el-tab-pane label="全部" name="" />
|
||||
<el-tab-pane label="待关联" name="pending" />
|
||||
<el-tab-pane label="已关联" name="associated" />
|
||||
</el-tabs>
|
||||
<div class="flex items-center gap-4 text-sm">
|
||||
<span class="text-gray-500">今日收益:</span>
|
||||
<span class="text-red-500 font-semibold text-lg">¥{{ todayRevenue.amount }}</span>
|
||||
<span class="text-gray-400">({{ todayRevenue.count }} 笔)</span>
|
||||
</div>
|
||||
</div>
|
||||
</el-card>
|
||||
|
||||
<!-- 数据表格 -->
|
||||
<el-card class="!border-none mt-4" shadow="never">
|
||||
<el-table
|
||||
@@ -78,12 +104,18 @@
|
||||
|
||||
<el-table-column label="患者信息" min-width="150">
|
||||
<template #default="{ row }">
|
||||
<div>{{ row.patient.patient_name }}</div>
|
||||
<div class="text-xs text-gray-400">{{ row.patient.phone }}</div>
|
||||
<div v-if="row.patient">{{ row.patient.patient_name }}</div>
|
||||
<div v-else class="text-amber-600">待关联</div>
|
||||
<div class="text-xs text-gray-400">{{ row.patient?.phone || '-' }}</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column label="创建人" prop="creator.name" min-width="120" />
|
||||
<el-table-column label="创建人" min-width="120">
|
||||
<template #default="{ row }">
|
||||
<div>{{ row.creator?.name || '-' }}</div>
|
||||
<div v-if="row.payee_userid" class="text-xs text-gray-400">收款: {{ row.payee_userid }}</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column label="订单类型" width="100">
|
||||
<template #default="{ row }">
|
||||
@@ -136,8 +168,17 @@
|
||||
详情
|
||||
</el-button>
|
||||
<el-button
|
||||
v-perms="['order.order/edit']"
|
||||
type="primary"
|
||||
link
|
||||
@click="handleEditOrder(row)"
|
||||
>
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
type="primary"
|
||||
v-perms="['order.order/wxQrcode']"
|
||||
link
|
||||
@click="handleOrderQrcode(row)"
|
||||
>
|
||||
小程序码
|
||||
@@ -202,13 +243,19 @@
|
||||
</el-tag>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="患者姓名">
|
||||
{{ detailData.patient.patient_name }}
|
||||
{{ detailData.patient?.patient_name || '待关联' }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="患者电话">
|
||||
{{ detailData.patient.phone }}
|
||||
{{ detailData.patient?.phone || '-' }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="创建人">
|
||||
{{ detailData.creator.name }}
|
||||
{{ detailData.creator?.name || '-' }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="收款人userid" v-if="detailData.payee_userid">
|
||||
{{ detailData.payee_userid }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="付款人external_userid" v-if="detailData.payer_external_userid">
|
||||
{{ detailData.payer_external_userid }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="订单类型">
|
||||
<el-tag :type="getOrderTypeTag(detailData.order_type)">
|
||||
@@ -269,6 +316,7 @@
|
||||
<el-radio-group v-model="payForm.payment_method">
|
||||
<el-radio label="alipay">支付宝</el-radio>
|
||||
<el-radio label="wechat">微信</el-radio>
|
||||
<el-radio label="wechat_work">企业微信</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
@@ -291,6 +339,22 @@
|
||||
:rules="createRules"
|
||||
label-width="100px"
|
||||
>
|
||||
<el-form-item label="创建方式">
|
||||
<el-radio-group v-model="createForm.createType">
|
||||
<el-radio label="normal">普通订单</el-radio>
|
||||
<el-radio label="wechat_work">企业微信对外收款</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-alert
|
||||
v-if="createForm.createType === 'wechat_work'"
|
||||
type="info"
|
||||
:closable="false"
|
||||
show-icon
|
||||
class="mb-4"
|
||||
>
|
||||
<template #title>企业微信对外收款</template>
|
||||
创建后将生成订单号,请在企业微信发起收款时将该订单号填写为「商户订单号」,收款成功后系统将自动更新订单状态。
|
||||
</el-alert>
|
||||
<el-form-item label="患者" prop="patient_id">
|
||||
<el-select
|
||||
v-model="createForm.patient_id"
|
||||
@@ -340,10 +404,86 @@
|
||||
<template #footer>
|
||||
<el-button @click="createDialogVisible = false">取消</el-button>
|
||||
<el-button type="primary" @click="submitCreateOrder" :loading="createLoading">
|
||||
创建订单
|
||||
{{ createForm.createType === 'wechat_work' ? '创建并获取收款订单号' : '创建订单' }}
|
||||
</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
<!-- 同步企业微信收款弹窗 -->
|
||||
<el-dialog
|
||||
v-model="syncDialogVisible"
|
||||
title="同步企业微信对外收款"
|
||||
width="420px"
|
||||
>
|
||||
<p class="text-gray-600 mb-4">拉取员工在企业微信内直接发起的对外收款记录,自动创建订单(未经过后台创建的收款)</p>
|
||||
<el-form label-width="90px">
|
||||
<el-form-item label="时间范围">
|
||||
<el-date-picker
|
||||
v-model="syncDateRange"
|
||||
type="daterange"
|
||||
range-separator="至"
|
||||
start-placeholder="开始日期"
|
||||
end-placeholder="结束日期"
|
||||
value-format="YYYY-MM-DD"
|
||||
:shortcuts="syncDateShortcuts"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="收款人userid">
|
||||
<el-input v-model="syncPayeeUserid" placeholder="可选,如 GaoXingLiang,排查时若返回 try_payee_userids 可逐个尝试" clearable />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<el-button @click="syncDialogVisible = false">取消</el-button>
|
||||
<el-button type="info" :loading="syncDebugLoading" @click="handleSyncDebug">
|
||||
排查同步为0
|
||||
</el-button>
|
||||
<el-button type="primary" :loading="syncLoading" @click="submitSyncWechatWork">
|
||||
开始同步
|
||||
</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
<!-- 编辑订单弹窗 -->
|
||||
<el-dialog
|
||||
v-model="editOrderDialogVisible"
|
||||
title="编辑订单"
|
||||
width="480px"
|
||||
>
|
||||
<el-form v-if="editOrderForm" ref="editOrderFormRef" :model="editOrderForm" :rules="editOrderRules" label-width="100px">
|
||||
<el-form-item label="关联患者" prop="patient_id">
|
||||
<el-select
|
||||
v-model="editOrderForm.patient_id"
|
||||
filterable
|
||||
remote
|
||||
placeholder="搜索患者姓名/手机号,可留空表示待关联"
|
||||
:remote-method="searchPatientsForEdit"
|
||||
:loading="editPatientLoading"
|
||||
clearable
|
||||
class="w-full"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in editPatientList"
|
||||
:key="item.id"
|
||||
:label="`${item.patient_name || '-'} (${item.phone || '-'})`"
|
||||
:value="item.id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="订单类型" prop="order_type">
|
||||
<el-select v-model="editOrderForm.order_type" placeholder="请选择" class="w-full">
|
||||
<el-option label="挂号费" :value="1" />
|
||||
<el-option label="问诊费" :value="2" />
|
||||
<el-option label="药品费用" :value="3" />
|
||||
<el-option label="首付费用" :value="4" />
|
||||
<el-option label="尾款费用" :value="5" />
|
||||
<el-option label="其他费用" :value="6" />
|
||||
<el-option label="全部费用" :value="7" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<el-button @click="editOrderDialogVisible = false">取消</el-button>
|
||||
<el-button type="primary" :loading="editOrderLoading" @click="submitEditOrder">保存</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
<!-- 小程序码弹窗 -->
|
||||
<el-dialog
|
||||
v-model="qrcodeDialogVisible"
|
||||
@@ -381,7 +521,7 @@
|
||||
|
||||
<script setup lang="ts" name="orderList">
|
||||
import { usePaging } from '@/hooks/usePaging'
|
||||
import { orderLists, orderDetail, orderPay, orderCancel, orderDelete, orderRefund, orderExport, orderCreate, searchPatients as searchPatientsAPI, alipayPay, wechatPay } from '@/api/order'
|
||||
import { orderLists, orderDetail, orderPay, orderCancel, orderDelete, orderRefund, orderExport, orderCreate, orderCreateForWechatWork, orderEdit, orderTodayRevenue, syncWechatWorkBills, syncWechatWorkBillsDebug, searchPatients as searchPatientsAPI, alipayPay, wechatPay } from '@/api/order'
|
||||
import { generateOrderQrcode } from '@/api/tcm'
|
||||
import { Loading } from '@element-plus/icons-vue'
|
||||
import feedback from '@/utils/feedback'
|
||||
@@ -391,10 +531,14 @@ const queryParams = reactive({
|
||||
patient_keyword: '',
|
||||
order_type: '',
|
||||
status: '',
|
||||
patient_association: '' as '' | 'pending' | 'associated',
|
||||
create_time_start: '',
|
||||
create_time_end: ''
|
||||
})
|
||||
|
||||
const patientAssociationTab = ref<'' | 'pending' | 'associated'>('')
|
||||
const todayRevenue = ref({ amount: '0.00', count: 0 })
|
||||
|
||||
const { pager, getLists, resetPage, resetParams } = usePaging({
|
||||
fetchFun: orderLists,
|
||||
params: queryParams
|
||||
@@ -405,8 +549,25 @@ const handleSearch = () => {
|
||||
resetPage()
|
||||
}
|
||||
|
||||
// Tab 切换
|
||||
const handleTabChange = (name: string | number) => {
|
||||
queryParams.patient_association = (name as '' | 'pending' | 'associated') || ''
|
||||
resetPage()
|
||||
}
|
||||
|
||||
// 获取今日收益
|
||||
const fetchTodayRevenue = async () => {
|
||||
try {
|
||||
const res: any = await orderTodayRevenue()
|
||||
todayRevenue.value = res?.data || res || { amount: '0.00', count: 0 }
|
||||
} catch (e) {
|
||||
todayRevenue.value = { amount: '0.00', count: 0 }
|
||||
}
|
||||
}
|
||||
|
||||
// 重置
|
||||
const handleReset = () => {
|
||||
patientAssociationTab.value = ''
|
||||
resetParams()
|
||||
}
|
||||
|
||||
@@ -431,6 +592,7 @@ const patientLoading = ref(false)
|
||||
const patientList = ref<any[]>([])
|
||||
|
||||
const createForm = reactive({
|
||||
createType: 'normal' as 'normal' | 'wechat_work',
|
||||
patient_id: '',
|
||||
order_type: '',
|
||||
amount: 0,
|
||||
@@ -443,6 +605,17 @@ const createRules = {
|
||||
amount: [{ required: true, message: '请输入订单金额', trigger: 'blur' }]
|
||||
}
|
||||
|
||||
// 编辑订单相关
|
||||
const editOrderDialogVisible = ref(false)
|
||||
const editOrderFormRef = ref()
|
||||
const editOrderLoading = ref(false)
|
||||
const editPatientLoading = ref(false)
|
||||
const editPatientList = ref<any[]>([])
|
||||
const editOrderForm = ref<{ id: number; patient_id: number | null; order_type: number } | null>(null)
|
||||
const editOrderRules = {
|
||||
order_type: [{ required: true, message: '请选择订单类型', trigger: 'change' }]
|
||||
}
|
||||
|
||||
// 搜索患者
|
||||
const searchPatients = async (query: string) => {
|
||||
if (!query) {
|
||||
@@ -466,6 +639,7 @@ const searchPatients = async (query: string) => {
|
||||
|
||||
// 重置创建表单
|
||||
const resetCreateForm = () => {
|
||||
createForm.createType = 'normal'
|
||||
createForm.patient_id = ''
|
||||
createForm.order_type = ''
|
||||
createForm.amount = 0
|
||||
@@ -479,6 +653,98 @@ const handleCreate = () => {
|
||||
createDialogVisible.value = true
|
||||
}
|
||||
|
||||
// 同步企业微信收款
|
||||
const syncDialogVisible = ref(false)
|
||||
const syncLoading = ref(false)
|
||||
const syncDebugLoading = ref(false)
|
||||
const syncPayeeUserid = ref('')
|
||||
const syncDateRange = ref<[string, string]>([
|
||||
new Date(Date.now() - 7 * 86400000).toISOString().slice(0, 10),
|
||||
new Date().toISOString().slice(0, 10)
|
||||
])
|
||||
const syncDateShortcuts = [
|
||||
{ text: '最近7天', value: () => {
|
||||
const end = new Date()
|
||||
const start = new Date()
|
||||
start.setTime(start.getTime() - 7 * 86400000)
|
||||
return [start, end]
|
||||
}},
|
||||
{ text: '最近30天', value: () => {
|
||||
const end = new Date()
|
||||
const start = new Date()
|
||||
start.setTime(start.getTime() - 30 * 86400000)
|
||||
return [start, end]
|
||||
}},
|
||||
{ text: '今天', value: () => {
|
||||
const d = new Date()
|
||||
return [d, d]
|
||||
}}
|
||||
]
|
||||
|
||||
const handleSyncWechatWork = () => {
|
||||
syncDateRange.value = [
|
||||
new Date(Date.now() - 7 * 86400000).toISOString().slice(0, 10),
|
||||
new Date().toISOString().slice(0, 10)
|
||||
]
|
||||
syncDialogVisible.value = true
|
||||
}
|
||||
|
||||
const handleSyncDebug = async () => {
|
||||
const range = syncDateRange.value
|
||||
if (!range || range.length !== 2) {
|
||||
feedback.msgError('请先选择时间范围')
|
||||
return
|
||||
}
|
||||
try {
|
||||
syncDebugLoading.value = true
|
||||
const res: any = await syncWechatWorkBillsDebug({
|
||||
begin_time: range[0],
|
||||
end_time: range[1],
|
||||
payee_userid: syncPayeeUserid.value || undefined
|
||||
})
|
||||
const d = res?.data || res
|
||||
let msg = `配置:${d.config_ok ? '✓' : '✗'} | token:${d.access_token} | errcode:${d.api_errcode} | errmsg:${d.api_errmsg || '-'} | 账单数:${d.bill_count}`
|
||||
if (d.try_payee_userids?.length) {
|
||||
msg += `。可尝试收款人: ${d.try_payee_userids.join(', ')}`
|
||||
}
|
||||
if (d.api_errcode !== 0 && d.api_errcode !== -999) {
|
||||
msg += '。提示:需使用「对外收款」应用的Secret(管理后台-应用管理-对外收款-API)'
|
||||
}
|
||||
feedback.msgSuccess(msg)
|
||||
console.log('企业微信同步调试:', d)
|
||||
} catch (e: any) {
|
||||
feedback.msgError(e?.message || '排查失败')
|
||||
} finally {
|
||||
syncDebugLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
const submitSyncWechatWork = async () => {
|
||||
const range = syncDateRange.value
|
||||
if (!range || range.length !== 2) {
|
||||
feedback.msgError('请选择时间范围')
|
||||
return
|
||||
}
|
||||
try {
|
||||
syncLoading.value = true
|
||||
const res: any = await syncWechatWorkBills({
|
||||
begin_time: range[0],
|
||||
end_time: range[1]
|
||||
})
|
||||
const data = res?.data || res
|
||||
syncDialogVisible.value = false
|
||||
getLists()
|
||||
const msg = `同步完成:新增 ${data.created || 0} 笔,更新 ${data.updated || 0} 笔,跳过 ${data.skipped || 0} 笔` +
|
||||
(data.errors?.length ? `;错误:${data.errors.join(';')}` : '')
|
||||
feedback.msgSuccess(msg)
|
||||
fetchTodayRevenue()
|
||||
} catch (error: any) {
|
||||
feedback.msgError(error?.message || '同步失败')
|
||||
} finally {
|
||||
syncLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
// 提交创建订单
|
||||
const submitCreateOrder = async () => {
|
||||
try {
|
||||
@@ -493,10 +759,18 @@ const submitCreateOrder = async () => {
|
||||
remark: createForm.remark
|
||||
}
|
||||
|
||||
await orderCreate(params)
|
||||
feedback.msgSuccess('订单创建成功')
|
||||
createDialogVisible.value = false
|
||||
getLists()
|
||||
if (createForm.createType === 'wechat_work') {
|
||||
const res: any = await orderCreateForWechatWork(params)
|
||||
const orderNo = res?.order_no ?? res?.data?.order_no
|
||||
createDialogVisible.value = false
|
||||
getLists()
|
||||
feedback.msgSuccess(orderNo ? `订单创建成功,请在企业微信收款时使用订单号:${orderNo}` : '订单创建成功')
|
||||
} else {
|
||||
await orderCreate(params)
|
||||
feedback.msgSuccess('订单创建成功')
|
||||
createDialogVisible.value = false
|
||||
getLists()
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('创建订单失败:', error)
|
||||
} finally {
|
||||
@@ -555,11 +829,60 @@ const getPaymentMethodText = (method: string | null) => {
|
||||
if (!method) return '-'
|
||||
const methodMap: Record<string, string> = {
|
||||
alipay: '支付宝',
|
||||
wechat: '微信'
|
||||
wechat: '微信',
|
||||
wechat_work: '企业微信'
|
||||
}
|
||||
return methodMap[method] || '未知'
|
||||
}
|
||||
|
||||
// 编辑订单
|
||||
const handleEditOrder = (row: any) => {
|
||||
editOrderForm.value = {
|
||||
id: row.id,
|
||||
patient_id: row.patient_id || null,
|
||||
order_type: row.order_type
|
||||
}
|
||||
editPatientList.value = row.patient ? [row.patient] : []
|
||||
editOrderDialogVisible.value = true
|
||||
}
|
||||
|
||||
const searchPatientsForEdit = async (query: string) => {
|
||||
if (!query) {
|
||||
editPatientList.value = []
|
||||
return
|
||||
}
|
||||
try {
|
||||
editPatientLoading.value = true
|
||||
const res = await searchPatientsAPI({ keyword: query, page_no: 1, page_size: 10 })
|
||||
editPatientList.value = res?.lists || []
|
||||
} catch (e) {
|
||||
editPatientList.value = []
|
||||
} finally {
|
||||
editPatientLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
const submitEditOrder = async () => {
|
||||
if (!editOrderForm.value) return
|
||||
try {
|
||||
await editOrderFormRef.value?.validate()
|
||||
editOrderLoading.value = true
|
||||
await orderEdit({
|
||||
id: editOrderForm.value.id,
|
||||
patient_id: editOrderForm.value.patient_id ?? 0,
|
||||
order_type: editOrderForm.value.order_type
|
||||
})
|
||||
feedback.msgSuccess('保存成功')
|
||||
editOrderDialogVisible.value = false
|
||||
getLists()
|
||||
fetchTodayRevenue()
|
||||
} catch (e: any) {
|
||||
if (e?.message) feedback.msgError(e.message)
|
||||
} finally {
|
||||
editOrderLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
// 查看详情
|
||||
const handleDetail = async (row: any) => {
|
||||
try {
|
||||
@@ -614,23 +937,28 @@ const confirmPay = async () => {
|
||||
}
|
||||
}
|
||||
|
||||
// 调用对应的支付网关
|
||||
let payResult: any
|
||||
if (payForm.value.payment_method === 'alipay') {
|
||||
payResult = await alipayPay(payParams)
|
||||
} else if (payForm.value.payment_method === 'wechat') {
|
||||
payResult = await wechatPay(payParams)
|
||||
}
|
||||
|
||||
// 支付网关返回支付链接或二维码
|
||||
if (payResult && payResult.pay_url) {
|
||||
// 如果是支付宝,跳转到支付页面
|
||||
// 企业微信补单:直接调用 orderPay 更新订单状态
|
||||
if (payForm.value.payment_method === 'wechat_work') {
|
||||
await orderPay(payParams)
|
||||
feedback.msgSuccess('补单成功')
|
||||
} else {
|
||||
// 调用对应的支付网关
|
||||
let payResult: any
|
||||
if (payForm.value.payment_method === 'alipay') {
|
||||
window.location.href = payResult.pay_url
|
||||
payResult = await alipayPay(payParams)
|
||||
} else if (payForm.value.payment_method === 'wechat') {
|
||||
// 如果是微信,显示二维码或其他处理
|
||||
feedback.msgSuccess('请扫描二维码进行支付')
|
||||
// 可以在这里显示二维码弹窗
|
||||
payResult = await wechatPay(payParams)
|
||||
}
|
||||
|
||||
// 支付网关返回支付链接或二维码
|
||||
if (payResult && payResult.pay_url) {
|
||||
// 如果是支付宝,跳转到支付页面
|
||||
if (payForm.value.payment_method === 'alipay') {
|
||||
window.location.href = payResult.pay_url
|
||||
} else if (payForm.value.payment_method === 'wechat') {
|
||||
// 如果是微信,显示二维码或其他处理
|
||||
feedback.msgSuccess('请扫描二维码进行支付')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -720,6 +1048,7 @@ const handleOrderQrcodeRefresh = () => {
|
||||
|
||||
onMounted(() => {
|
||||
getLists()
|
||||
fetchTodayRevenue()
|
||||
})
|
||||
</script>
|
||||
|
||||
|
||||
@@ -193,7 +193,7 @@
|
||||
size="small"
|
||||
@click="handleViewCase(row)"
|
||||
>
|
||||
病例
|
||||
病历
|
||||
</el-button>
|
||||
<template v-if="row.status === 1">
|
||||
<el-button
|
||||
@@ -911,7 +911,7 @@ const handleMiniProgramQRCode = async (row: any) => {
|
||||
}
|
||||
}
|
||||
|
||||
// 处方保存成功(刷新列表,并刷新编辑抽屉中的病例列表)
|
||||
// 处方保存成功(刷新列表,并刷新编辑抽屉中的病历列表)
|
||||
const onPrescriptionSuccess = () => {
|
||||
loadData()
|
||||
editRef.value?.refreshCaseList?.()
|
||||
@@ -926,7 +926,7 @@ const handlePrescription = (row: any) => {
|
||||
prescriptionRef.value?.open(row)
|
||||
}
|
||||
|
||||
// 查看病例(开方后显示)
|
||||
// 查看病历(开方后显示)
|
||||
const handleViewCase = async (row: any) => {
|
||||
if (!row.id) {
|
||||
feedback.msgWarning('预约信息不完整')
|
||||
@@ -937,10 +937,10 @@ const handleViewCase = async (row: any) => {
|
||||
if (prescription?.id) {
|
||||
prescriptionRef.value?.openById(prescription.id)
|
||||
} else {
|
||||
feedback.msgWarning('该预约暂无病例记录,请先开方')
|
||||
feedback.msgWarning('该预约暂无病历记录,请先开方')
|
||||
}
|
||||
} catch (error: any) {
|
||||
feedback.msgError(error?.msg || '获取病例失败')
|
||||
feedback.msgError(error?.msg || '获取病历失败')
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<el-empty v-if="!loading && caseList.length === 0" description="暂无病例记录,开方后会自动显示" class="mt-4" />
|
||||
<el-empty v-if="!loading && caseList.length === 0" description="暂无病历记录,开方后会自动显示" class="mt-4" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -58,7 +58,7 @@ const getCases = async () => {
|
||||
const data = await prescriptionListByDiagnosis({ diagnosis_id: props.diagnosisId })
|
||||
caseList.value = Array.isArray(data) ? data : []
|
||||
} catch (error) {
|
||||
console.error('获取病例记录失败:', error)
|
||||
console.error('获取病历记录失败:', error)
|
||||
caseList.value = []
|
||||
} finally {
|
||||
loading.value = false
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
>
|
||||
<el-tabs v-model="activeTab" class="diagnosis-tabs">
|
||||
<!-- 基本信息标签页 -->
|
||||
<el-tab-pane label="基本信息" name="basic">
|
||||
<el-tab-pane label="病历" name="basic">
|
||||
<el-form
|
||||
ref="formRef"
|
||||
:model="formData"
|
||||
@@ -103,7 +103,7 @@
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="身高(cm)" prop="height">
|
||||
<el-form-item label="就诊人身高(cm)" prop="height">
|
||||
<el-input-number
|
||||
v-model="formData.height"
|
||||
:min="0"
|
||||
@@ -137,23 +137,23 @@
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="收缩压(mmHg)" prop="systolic_pressure">
|
||||
<el-form-item label="就诊人血压(高压mmHg)" prop="systolic_pressure">
|
||||
<el-input-number
|
||||
v-model="formData.systolic_pressure"
|
||||
:min="0"
|
||||
:max="250"
|
||||
placeholder="请输入收缩压"
|
||||
placeholder="请输入高压"
|
||||
class="w-full"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="舒张压(mmHg)" prop="diastolic_pressure">
|
||||
<el-form-item label="就诊人血压(低压mmHg)" prop="diastolic_pressure">
|
||||
<el-input-number
|
||||
v-model="formData.diastolic_pressure"
|
||||
:min="0"
|
||||
:max="150"
|
||||
placeholder="请输入舒张压"
|
||||
placeholder="请输入低压"
|
||||
class="w-full"
|
||||
/>
|
||||
</el-form-item>
|
||||
@@ -194,45 +194,11 @@
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="证型" prop="syndrome_type">
|
||||
<el-select
|
||||
v-model="formData.syndrome_type"
|
||||
placeholder="请选择证型"
|
||||
class="w-full"
|
||||
:popper-options="{ strategy: 'fixed' }"
|
||||
popper-class="high-z-index"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in syndromeTypeOptions"
|
||||
:key="item.value"
|
||||
:label="item.name"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
</el-row>
|
||||
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="糖尿病期数" prop="diabetes_type">
|
||||
<el-select
|
||||
v-model="formData.diabetes_type"
|
||||
placeholder="请选择糖尿病期数"
|
||||
class="w-full"
|
||||
:popper-options="{ strategy: 'fixed' }"
|
||||
popper-class="high-z-index"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in diabetesTypeOptions"
|
||||
:key="item.value"
|
||||
:label="item.name + (item.remark ? ' (' + item.remark + ')' : '')"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="12">
|
||||
<el-form-item label="状态" prop="status">
|
||||
<el-radio-group v-model="formData.status">
|
||||
@@ -246,7 +212,7 @@
|
||||
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="线下诊断日期" prop="diagnosis_date">
|
||||
<el-form-item label="当地医院诊断日期" prop="diagnosis_date">
|
||||
<el-date-picker
|
||||
v-model="formData.diagnosis_date"
|
||||
type="date"
|
||||
@@ -259,7 +225,7 @@
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="发现糖尿病就患病史" prop="diabetes_discovery_year">
|
||||
<el-form-item label="发现糖尿病病患病史" prop="diabetes_discovery_year">
|
||||
<el-input-number
|
||||
v-model="formData.diabetes_discovery_year"
|
||||
:min="0"
|
||||
@@ -272,7 +238,7 @@
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-form-item label="当地医院诊断结果" class="checkbox-form-item">
|
||||
<el-form-item label="当地医院诊断结果" prop="local_hospital_diagnosis" class="checkbox-form-item">
|
||||
<el-checkbox-group v-model="formData.local_hospital_diagnosis">
|
||||
<el-checkbox-button label="糖尿病">糖尿病</el-checkbox-button>
|
||||
<el-checkbox-button label="高血压">高血压</el-checkbox-button>
|
||||
@@ -573,8 +539,8 @@
|
||||
/>
|
||||
<el-empty v-else description="请先保存诊单后再添加血糖血压记录" />
|
||||
</el-tab-pane>
|
||||
<!-- 病例记录标签页(开方后自动显示) -->
|
||||
<el-tab-pane label="病例" name="bingli" :disabled="!formData.id">
|
||||
<!-- 病历记录标签页(开方后自动显示) -->
|
||||
<el-tab-pane label="处方" name="bingli" :disabled="!formData.id">
|
||||
<div v-if="formData.id" class="bingli-tab-content">
|
||||
<!-- 诊断信息:舌苔照片、检查报告 -->
|
||||
<div class="bingli-diagnosis-section">
|
||||
@@ -610,18 +576,18 @@
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
<!-- 病例记录列表 -->
|
||||
<!-- 病历记录列表 -->
|
||||
<case-record-list
|
||||
ref="caseRecordListRef"
|
||||
:diagnosis-id="Number(formData.id)"
|
||||
@view="handleViewCase"
|
||||
/>
|
||||
</div>
|
||||
<el-empty v-else description="请先保存诊单,开方后病例将在此显示" />
|
||||
<el-empty v-else description="请先保存诊单,开方后病历将在此显示" />
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
|
||||
<!-- 处方详情(查看病例) -->
|
||||
<!-- 处方详情(查看病历) -->
|
||||
<tcm-prescription ref="prescriptionRef" @success="caseRecordListRef?.refresh?.()" />
|
||||
|
||||
<template #footer>
|
||||
@@ -751,8 +717,9 @@ const formRules = {
|
||||
age: [{ required: true, message: '请输入年龄', trigger: 'blur' }],
|
||||
diagnosis_date: [{ required: true, message: '请选择诊断日期', trigger: 'change' }],
|
||||
diagnosis_type: [{ required: true, message: '请选择诊断类型', trigger: 'change' }],
|
||||
syndrome_type: [{ required: true, message: '请选择证型', trigger: 'change' }],
|
||||
diabetes_type: [{ required: true, message: '请选择糖尿病期数', trigger: 'change' }]
|
||||
diabetes_discovery_year: [{ required: true, message: '请输入发现糖尿病病患病史年数', trigger: 'blur' }],
|
||||
local_hospital_diagnosis: [{ required: true, type: 'array', min: 1, message: '请选择当地医院诊断结果', trigger: 'change' }],
|
||||
local_hospital_name: [{ required: true, message: '请输入当地就诊医院名称', trigger: 'blur' }]
|
||||
}
|
||||
|
||||
// 获取字典选项
|
||||
@@ -1114,7 +1081,7 @@ defineExpose({
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
/* 病例 tab 诊断信息 */
|
||||
/* 病历 tab 诊断信息 */
|
||||
.bingli-tab-content {
|
||||
padding: 0 4px;
|
||||
}
|
||||
|
||||
@@ -160,7 +160,7 @@
|
||||
<el-dropdown-menu>
|
||||
<el-dropdown-item v-if="hasPermission(['tcm.diagnosis/assign'])" command="assign"><el-icon><User /></el-icon>指派</el-dropdown-item>
|
||||
<el-dropdown-item v-if="row.has_appointment && hasPermission(['tcm.diagnosis/videoQr'])" command="videoQr"><el-icon><Picture /></el-icon>视频二维码</el-dropdown-item>
|
||||
<el-dropdown-item v-if="hasPermission(['tcm.diagnosis/guahao'])" command="confirmQr"><el-icon><Picture /></el-icon>确认诊单二维码</el-dropdown-item>
|
||||
<el-dropdown-item v-if="hasPermission(['tcm.diagnosis/guahao'])" command="confirmQr"><el-icon><Picture /></el-icon>二维码</el-dropdown-item>
|
||||
<el-dropdown-item command="order" v-if="hasPermission(['tcm.diagnosis/order'])"><el-icon><Document /></el-icon>创建订单</el-dropdown-item>
|
||||
<el-dropdown-item v-if="hasPermission(['tcm.diagnosis/delete'])" command="delete" divided><el-icon><Delete /></el-icon><span class="text-danger">删除</span></el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
@@ -948,6 +948,7 @@ const handleVideoQRCode = async (row: any) => {
|
||||
}
|
||||
const result = await generateMiniProgramQrcode({
|
||||
doctor_id: row.appointment_doctor_id,
|
||||
diagnosis_id: row.appointment_doctor_id,
|
||||
patient_id: row.patient_id,
|
||||
share_user_id: userStore.userInfo?.id || '',
|
||||
mini_program_path: 'pages/login/login'
|
||||
@@ -975,7 +976,7 @@ const handleMiniProgramQRCode = async (row: any) => {
|
||||
qrcodeDialogVisible.value = true
|
||||
qrcodeLoading.value = true
|
||||
qrcodeUrl.value = ''
|
||||
qrcodeDialogTitle.value = '确认诊单二维码'
|
||||
qrcodeDialogTitle.value = '诊单二维码'
|
||||
|
||||
try {
|
||||
// 获取小程序配置
|
||||
@@ -993,6 +994,7 @@ const handleMiniProgramQRCode = async (row: any) => {
|
||||
// 调用生成二维码接口
|
||||
const result = await generateMiniProgramQrcode({
|
||||
diagnosis_id: row.id,
|
||||
doctor_id: row.appointment_doctor_id,
|
||||
patient_id: row.patient_id,
|
||||
share_user_id: currentUser?.id || ''
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user