index.vue 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803
  1. <template>
  2. <div class="p-2">
  3. <transition :enter-active-class="proxy?.animate.searchAnimate.enter" :leave-active-class="proxy?.animate.searchAnimate.leave">
  4. <div v-show="showSearch" class="mb-[10px]">
  5. <el-card shadow="hover">
  6. <el-form ref="queryFormRef" :model="queryParams" :inline="true" :label-width="85">
  7. <el-form-item label="开方时间" prop="orderTime">
  8. <el-date-picker v-model="queryParams.dateRange" type="daterange" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" />
  9. </el-form-item>
  10. <el-form-item label="收费类型" prop="chargeType">
  11. <el-select v-model="queryParams.chargeType">
  12. <el-option v-for="dict in fee_type" :key="dict.value" :label="dict.label" :value="dict.value" />
  13. </el-select>
  14. </el-form-item>
  15. <el-form-item label="患者科室" prop="doorId">
  16. <el-tree-select v-model="queryParams.doorId" :data="treeData" :props="treeProps" placeholder="请选择" check-strictly node-key="id" @keyup.enter="handleQuery" />
  17. </el-form-item>
  18. <el-form-item label="看诊类型:">
  19. <el-select v-model="queryParams.visitType">
  20. <el-option v-for="dict in treatment_user_type" :key="dict.value" :label="dict.label" :value="dict.value" />
  21. </el-select>
  22. </el-form-item>
  23. <el-form-item>
  24. <el-input v-model="queryParams.searchValue" placeholder="医生姓名/门诊号/住院号" style="width: 240px; " clearable />
  25. </el-form-item>
  26. <el-form-item>
  27. <el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
  28. <el-button icon="Refresh" @click="resetQuery">重置</el-button>
  29. </el-form-item>
  30. </el-form>
  31. </el-card>
  32. </div>
  33. </transition>
  34. <el-card shadow="never">
  35. <template #header>
  36. <el-row :gutter="10" class="mb8">
  37. <el-col :span="1.5">
  38. <el-button type="primary" plain @click="handleAdd" v-hasPermi="['system:settlement:add']">批量收费</el-button>
  39. </el-col>
  40. <right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
  41. </el-row>
  42. </template>
  43. <el-table v-loading="loading" border :data="settlementList" @selection-change="handleSelectionChange">
  44. <el-table-column type="selection" width="55" align="center" />
  45. <el-table-column label="主键ID" align="center" prop="id" v-if="false" />
  46. <el-table-column label="开单时间" align="center" prop="orderTime" width="180">
  47. <template #default="scope">
  48. <span>{{ parseTime(scope.row.orderTime, '{y}-{m}-{d}') }}</span>
  49. </template>
  50. </el-table-column>
  51. <el-table-column label="看诊类型" align="center" prop="visitType">
  52. <template #default="scope">
  53. <span>{{ getDictLabel(treatment_user_type, scope.row.visitType) || '--' }}</span>
  54. </template>
  55. </el-table-column>
  56. <el-table-column label="收费类型" align="center" prop="chargeType">
  57. <template #default="scope">
  58. <span>{{ getDictLabel(fee_type, scope.row.chargeType) || '--' }}</span>
  59. </template>
  60. </el-table-column>
  61. <el-table-column label="患者姓名" align="center" prop="patientName" />
  62. <el-table-column label="患者科室" align="center" prop="patientDepartment" />
  63. <el-table-column label="门诊/住院号" align="center" prop="patientNo" />
  64. <el-table-column label="联系电话" align="center" prop="phone" />
  65. <el-table-column label="身份证号" align="center" prop="idCard" />
  66. <el-table-column label="应收金额" align="center" prop="receivableAmount" />
  67. <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
  68. <template #default="scope">
  69. <el-tooltip content="详情" placement="top">
  70. <el-button link type="primary" @click="handleDetail(scope.row)" v-hasPermi="['system:settlement:edit']">详情</el-button>
  71. </el-tooltip>
  72. <el-tooltip content="收费" placement="top">
  73. <el-button link type="primary" @click="handleCharge(scope.row)" v-hasPermi="['system:settlement:edit']">收费</el-button>
  74. </el-tooltip>
  75. <el-tooltip content="打印" placement="top">
  76. <el-button link type="primary" @click="handleDelete(scope.row)" v-hasPermi="['system:settlement:edit']">打印</el-button>
  77. </el-tooltip>
  78. </template>
  79. </el-table-column>
  80. </el-table>
  81. <pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination="getList" />
  82. </el-card>
  83. <!-- 添加或修改结算管理对话框 -->
  84. <el-dialog :title="dialog.title" v-model="dialog.visible" width="65%" append-to-body>
  85. <!-- 患者信息 -->
  86. <div class="patient-info">
  87. <el-row :gutter="20">
  88. <el-col :span="4">
  89. <div class="info-item">
  90. <span class="label">开方日期:</span>
  91. <span class="value">{{ parseTime(form.orderTime, '{y}-{m}-{d}') || '' }}</span>
  92. </div>
  93. </el-col>
  94. <el-col :span="5">
  95. <div class="info-item">
  96. <span class="label">患者姓名:</span>
  97. <span class="value">{{ rowData.patientName || '' }}</span>
  98. </div>
  99. </el-col>
  100. <el-col :span="5">
  101. <div class="info-item">
  102. <span class="label">身份证号:</span>
  103. <span class="value">{{ rowData.idCard || '' }}</span>
  104. </div>
  105. </el-col>
  106. <el-col :span="5">
  107. <div class="info-item">
  108. <span class="label">门诊/住院号:</span>
  109. <span class="value">{{ rowData.patientNo || '' }}</span>
  110. </div>
  111. </el-col>
  112. <el-col :span="5">
  113. <div class="info-item">
  114. <span class="label">看诊类型:</span>
  115. <span class="value">{{ getDictLabel(treatment_user_type, rowData.visitType) || '' }}</span>
  116. </div>
  117. </el-col>
  118. </el-row>
  119. <el-row :gutter="20">
  120. <el-col :span="4">
  121. <div class="info-item">
  122. <span class="label">联系电话:</span>
  123. <span class="value">{{ rowData.phone || '' }}</span>
  124. </div>
  125. </el-col>
  126. <el-col :span="5">
  127. <div class="info-item">
  128. <span class="label">诊疗卡号:</span>
  129. <span class="value">{{ rowData.treatNum || '' }}</span>
  130. </div>
  131. </el-col>
  132. <el-col :span="5">
  133. <div class="info-item">
  134. <span class="label">病区:</span>
  135. <span class="value">{{ rowData.wardName || '--' }}</span>
  136. </div>
  137. </el-col>
  138. <el-col :span="5">
  139. <div class="info-item">
  140. <span class="label">患者科室:</span>
  141. <span class="value">{{ rowData.patientDepartment || '' }}</span>
  142. </div>
  143. </el-col>
  144. <el-col :span="5">
  145. <div class="info-item">
  146. <span class="label">处方Id:</span>
  147. <span class="value">{{ rowData.id || '' }}</span>
  148. </div>
  149. </el-col>
  150. </el-row>
  151. </div>
  152. <!-- 处方明细表格 -->
  153. <!-- 处方表格 -->
  154. <div class="prescription-table-wrapper">
  155. <!-- 处方数据表格 -->
  156. <table v-if="recipeDetailData.length > 0" class="prescription-table">
  157. <thead>
  158. <tr>
  159. <th>组号</th>
  160. <th>产品名称</th>
  161. <th>规格</th>
  162. <th>销售价格(元)</th>
  163. <th>用量/次</th>
  164. <th>频次</th>
  165. <th>使用天数</th>
  166. <th>首日</th>
  167. <th>用量/总</th>
  168. <th>应收金额(元)</th>
  169. <th>操作人</th>
  170. </tr>
  171. </thead>
  172. <tbody>
  173. <tr v-for="(product, index) in recipeDetailData" :key="index">
  174. <td>{{ Number(product.groupNo) + 1 || '--' }}</td>
  175. <td>{{ product.nutritionProduct || '--' }}</td>
  176. <td>{{ product.specification || '--' }}</td>
  177. <td>{{ product.salePrice || '--' }}</td>
  178. <td>{{ product.dosePerTime || '--' }}</td>
  179. <td>{{ product.frequency || '--' }}</td>
  180. <td>{{ product.usageDays || '--' }}</td>
  181. <td>{{ product.firstDay || '--' }}</td>
  182. <td>{{ product.totalDose || '--' }}</td>
  183. <td>{{ product.amount || '--' }}</td>
  184. <td>{{ product.createByUser || '--' }}</td>
  185. </tr>
  186. </tbody>
  187. </table>
  188. <!-- 筛查数据表格 -->
  189. <table v-if="screeningData.length > 0" class="prescription-table" style="margin-top: 10px;">
  190. <thead>
  191. <tr>
  192. <th>项目名称</th>
  193. <th>销售单位</th>
  194. <th>销售价格</th>
  195. <th>数量</th>
  196. <th>应收金额(元)</th>
  197. <th>操作人</th>
  198. </tr>
  199. </thead>
  200. <tbody>
  201. <tr v-for="(item, index) in screeningData" :key="index">
  202. <td>{{ getDictLabel(fee_type,rowData.chargeType) || '--' }}</td>
  203. <td>次</td>
  204. <td>{{ rowData.receivableAmount || '--' }}</td>
  205. <td>1</td>
  206. <td>{{ rowData.receivableAmount || '--' }}</td>
  207. <td>{{ item.createByName || '--' }}</td>
  208. </tr>
  209. </tbody>
  210. </table>
  211. <!-- 评估数据表格 -->
  212. <table v-if="evaluationData.length > 0" class="prescription-table" style="margin-top: 10px;">
  213. <thead>
  214. <tr>
  215. <th>项目名称</th>
  216. <th>销售单位</th>
  217. <th>销售价格</th>
  218. <th>数量</th>
  219. <th>应收金额(元)</th>
  220. <th>操作人</th>
  221. </tr>
  222. </thead>
  223. <tbody>
  224. <tr v-for="(item, index) in evaluationData" :key="index">
  225. <td>{{ getDictLabel(fee_type,rowData.chargeType) || '--' }}</td>
  226. <td>次</td>
  227. <td>{{ rowData.receivableAmount || '--' }}</td>
  228. <td>1</td>
  229. <td>{{ rowData.receivableAmount || '--' }}</td>
  230. <td>{{ item.createByName || '--' }}</td>
  231. </tr>
  232. </tbody>
  233. </table>
  234. <!-- 无数据提示 -->
  235. <div v-if="recipeDetailData.length === 0 && screeningData.length === 0 && evaluationData.length === 0" style="text-align: center; color: #909399; padding: 40px 0;">
  236. 暂无数据
  237. </div>
  238. <!-- 金额统计 -->
  239. <div style="margin-top:10px;margin-bottom:130px">
  240. <el-row>
  241. <el-col style="text-align: right;">
  242. <span>(营养配置费:<span>¥{{ prescriptionFee||'0' }}</span>)</span>
  243. </el-col>
  244. </el-row>
  245. <el-row>
  246. <el-col style="text-align: right;">
  247. <span>合计金额:<span style="color: #f56c6c;">¥{{rowData.receivableAmount}}</span></span>
  248. </el-col>
  249. </el-row>
  250. </div>
  251. </div>
  252. <template #footer>
  253. <div class="dialog-footer">
  254. <el-button :loading="buttonLoading" type="primary" @click="handleMoney">现金收费</el-button>
  255. <el-button :loading="buttonLoading" type="success" @click="handleUnionPay">银联支付</el-button>
  256. <el-button :loading="buttonLoading" type="success" @click="handleQRCode">二维码支付</el-button>
  257. </div>
  258. </template>
  259. </el-dialog>
  260. <!-- 现金收费dialog -->
  261. <el-dialog :title="moneyDialog.title" v-model="moneyDialog.visible" width="30%" append-to-body>
  262. <el-form ref="chrageRecordFormRef" :model="rowData" :rules="rules" label-width="80px">
  263. <el-row :gutter="10">
  264. <el-col :span="7">
  265. <div class="info-item">
  266. <span>姓名:</span>
  267. <span>{{ rowData.patientName || '' }}</span>
  268. </div>
  269. </el-col>
  270. <el-col :span="7">
  271. <div class="info-item">
  272. <span class="label">联系电话:</span>
  273. <span class="value">{{ rowData.phone || '' }}</span>
  274. </div>
  275. </el-col>
  276. <el-col :span="7">
  277. <div class="info-item">
  278. <span class="label">身份证号:</span>
  279. <span class="value">{{ rowData.idCard || '' }}</span>
  280. </div>
  281. </el-col>
  282. </el-row>
  283. <el-row>
  284. <el-col :span="24">
  285. </el-col>
  286. </el-row>
  287. <div class="setting-group">
  288. <label class="setting-label">
  289. <span class="required">*</span>
  290. 收费方式:
  291. </label>
  292. <el-radio-group v-model="currentChargeMode">
  293. <el-radio v-for="dict in filteredChargeWay" :key="dict.value" :value="dict.value">
  294. {{ dict.label }}
  295. </el-radio>
  296. </el-radio-group>
  297. </div>
  298. <div class="setting-group">
  299. <label class="setting-label">
  300. 应收金额(元):
  301. </label>
  302. <span class="amount-value">{{ rowData.receivableAmount || '0.00' }}</span>
  303. </div>
  304. <div class="setting-group">
  305. <label class="setting-label">
  306. <span class="required">*</span>
  307. 收到金额(元):
  308. </label>
  309. <el-input style="width:260px" v-model="fundsReceived" @change="changeFundsReceived" placeholder="请输入" />
  310. </div>
  311. <div class="setting-group">
  312. <label class="setting-label">
  313. 找零金额(元):
  314. </label>
  315. <span class="amount-value">{{ changeFund.toFixed(2) }}</span>
  316. </div>
  317. </el-form>
  318. <div>
  319. </div>
  320. <template #footer>
  321. <div class="dialog-footer">
  322. <el-button v-if="showQRCodeButton" :loading="buttonLoading" type="primary">二维码支付</el-button>
  323. <el-button :loading="buttonLoading" type="primary" @click="handleAddCharge">确认</el-button>
  324. <el-button :loading="buttonLoading" @click="moneyDialogCancel">取消</el-button>
  325. </div>
  326. </template>
  327. </el-dialog>
  328. </div>
  329. </template>
  330. <script setup name="Settlement" lang="ts">
  331. import { listSettlement, getSettlement, delSettlement, addSettlement, updateSettlement } from '@/api/patients/settlement';
  332. import { SettlementVO, SettlementQuery, SettlementForm } from '@/api/patients/settlement/types';
  333. import { addRecord } from '@/api/settlement/chargeRecord';
  334. import { ChrageRecordVO, ChrageRecordQuery, ChrageRecordForm } from '@/api/settlement/chargeRecord/types';
  335. import { listDept } from '@/api/system/dept'; // 部门列表
  336. import { listSet } from '@/api/parameter/chargeSet';
  337. import { ChargeSetVO } from '@/api/parameter/chargeSet/types';
  338. import { computed } from 'vue';
  339. const { proxy } = getCurrentInstance() as ComponentInternalInstance;
  340. const { treatment_user_type, check_status, recipe_type, fee_type, charge_way } = toRefs < any > (proxy ?.useDict('treatment_user_type', 'check_status', 'recipe_type', 'fee_type', 'charge_way'));
  341. import { useChargeSetStore } from '@/store/modules/chargeSet';
  342. const useStore = useChargeSetStore();
  343. const settlementList = ref < SettlementVO[] > ([]);
  344. const buttonLoading = ref(false);
  345. const loading = ref(true);
  346. const showSearch = ref(true);
  347. const ids = ref < Array < string | number >> ([]);
  348. const single = ref(true);
  349. const multiple = ref(true);
  350. const total = ref(0);
  351. const fundsReceived = ref(0); //定义收到金额
  352. const changeFund = ref(0); //定义收到金额
  353. const treeData = ref([]); // 定义 treeData
  354. const rowData = ref < SettlementVO > ({})
  355. const currentChargeMode = ref('1'); // 当前选择的收费方式,默认为现金收费
  356. const queryFormRef = ref < ElFormInstance > ();
  357. const chargeSetInfo = computed(() => useStore.chargeSetInfo as ChargeSetVO || {} as ChargeSetVO);
  358. const settlementFormRef = ref < ElFormInstance > ();
  359. const chrageRecordFormRef = ref < ElFormInstance > ();
  360. const prescriptionFee = ref(0)
  361. // 处方明细数据
  362. const recipeDetailData = ref([]);
  363. const evaluationData = ref([]);
  364. const screeningData = ref([]);
  365. const dialog = reactive < DialogOption > ({
  366. visible: false,
  367. title: ''
  368. });
  369. // 现金收费
  370. const moneyDialog = reactive < DialogOption > ({
  371. visible: false,
  372. title: ''
  373. });
  374. const initFormData: SettlementForm = {
  375. id: undefined,
  376. orderTime: undefined,
  377. visitType: undefined,
  378. chargeType: undefined,
  379. patientId: undefined,
  380. patientName: undefined,
  381. patientDepartment: undefined,
  382. patientNo: undefined,
  383. phone: undefined,
  384. idCard: undefined,
  385. receivableAmount: undefined,
  386. paymentStatus: undefined,
  387. paymentMethod: undefined,
  388. status: undefined,
  389. }
  390. const data = reactive < PageData < SettlementForm,
  391. SettlementQuery >> ({
  392. form: { ...initFormData },
  393. queryParams: {
  394. pageNum: 1,
  395. pageSize: 10,
  396. checkStatus: undefined,
  397. orderTime: undefined,
  398. doorId: undefined,
  399. visitType: undefined,
  400. chargeType: undefined,
  401. dateRange: [],
  402. searchValue: undefined,
  403. params: {}
  404. },
  405. rules: {
  406. id: [
  407. { required: true, message: "主键ID不能为空", trigger: "blur" }
  408. ],
  409. }
  410. });
  411. const { queryParams, form, rules } = toRefs(data);
  412. const treeProps = ref({
  413. value: 'deptId', // 对应部门的 deptId
  414. label: 'deptName', // 对应部门的 deptName
  415. children: 'children' // 保持原有的父子结构
  416. });
  417. // 过滤收费方式选项
  418. const filteredChargeWay = computed(() => {
  419. if (!charge_way.value) return [];
  420. return charge_way.value.filter(dict => {
  421. // 银联支付(值为2)始终显示
  422. if (dict.value === '2') {
  423. return true;
  424. }
  425. // 现金收费(值为1)只有在 chargeSetInfo.moneyCharge = 1 时才显示
  426. if (dict.value === '1') {
  427. return chargeSetInfo.value ?.moneyCharge === 1 || chargeSetInfo.value ?.moneyCharge === '1';
  428. }
  429. // 其他选项不显示
  430. return false;
  431. });
  432. });
  433. // 是否显示二维码支付按钮 - 只有选择银联支付(值为2)时才显示
  434. const showQRCodeButton = computed(() => currentChargeMode.value === '2');
  435. /** 查询结算管理列表 */
  436. const getList = async () => {
  437. loading.value = true;
  438. const res = await listSettlement(queryParams.value);
  439. settlementList.value = res.rows;
  440. // 获取部门数据
  441. const deptMap = new Map();
  442. treeData.value.forEach(dept => {
  443. deptMap.set(dept.deptId, dept.deptName);
  444. if (dept.children) {
  445. dept.children.forEach(child => {
  446. deptMap.set(child.deptId, child.deptName);
  447. });
  448. }
  449. });
  450. getSetList()
  451. total.value = res.total;
  452. loading.value = false;
  453. }
  454. // 字典label工具
  455. function getDictLabel(dictList: any[], value: string) {
  456. if (!dictList || !Array.isArray(dictList)) return value || '--';
  457. const found = dictList.find((item) => item.value === value);
  458. return found ? found.label : value || '--';
  459. }
  460. const getDeptList = async () => {
  461. loading.value = true;
  462. try {
  463. const res = await listDept({ pageNum: 1, pageSize: 999 });
  464. if (!res.data) {
  465. console.warn("部门数据为空");
  466. treeData.value = [];
  467. return;
  468. }
  469. // 处理树形数据
  470. const processedData = proxy ?.handleTree(res.data, 'deptId');
  471. if (!processedData) {
  472. console.warn("树形数据处理失败");
  473. treeData.value = [];
  474. return;
  475. }
  476. treeData.value = processedData;
  477. } catch (error) {
  478. console.error('获取部门列表失败:', error);
  479. treeData.value = [];
  480. } finally {
  481. loading.value = false;
  482. }
  483. };
  484. /** 取消按钮 */
  485. const cancel = () => {
  486. reset();
  487. dialog.visible = false;
  488. }
  489. /** 表单重置 */
  490. const reset = () => {
  491. form.value = { ...initFormData };
  492. settlementFormRef.value ?.resetFields();
  493. }
  494. /** 搜索按钮操作 */
  495. const handleQuery = () => {
  496. queryParams.value.pageNum = 1;
  497. getList();
  498. }
  499. /** 重置按钮操作 */
  500. const resetQuery = () => {
  501. queryFormRef.value ?.resetFields();
  502. queryParams.value.dateRange = undefined;
  503. queryParams.value.searchValue = undefined;
  504. queryParams.value.visitType = undefined;
  505. queryParams.value.chargeType = undefined;
  506. queryParams.value.doorId = undefined;
  507. handleQuery();
  508. }
  509. /** 多选框选中数据 */
  510. const handleSelectionChange = (selection: SettlementVO[]) => {
  511. ids.value = selection.map(item => item.id);
  512. single.value = selection.length != 1;
  513. multiple.value = !selection.length;
  514. }
  515. /** 新增按钮操作 */
  516. const handleAdd = () => {
  517. reset();
  518. dialog.visible = true;
  519. dialog.title = "";
  520. }
  521. /** 收费详情 */
  522. const handleDetail = async (row ? : SettlementVO) => {
  523. reset();
  524. rowData.value = row || {} as SettlementVO;
  525. const _id = row ?.id || ids.value[0]
  526. const res = await getSettlement(_id);
  527. recipeDetailData.value = res.data.enteralNutritionList
  528. evaluationData.value = res.data.nutritionEvaluationList
  529. screeningData.value = res.data.nutritionScreeningList
  530. prescriptionFee.value = res.data.prescriptionFee
  531. Object.assign(form.value, res.data);
  532. dialog.visible = true;
  533. dialog.title = "收费详情";
  534. }
  535. /** 收费 */
  536. const handleCharge = async (row ? : SettlementVO) => {
  537. rowData.value = row || {} as SettlementVO;
  538. // 设置默认收费方式为现金收费(值为1),如果现金收费可选的话
  539. const availableOptions = filteredChargeWay.value;
  540. const cashOption = availableOptions.find(option => option.value === '1');
  541. if (cashOption) {
  542. currentChargeMode.value = '1';
  543. } else if (availableOptions.length > 0) {
  544. // 如果没有现金收费选项,默认选择第一个可用选项
  545. currentChargeMode.value = availableOptions[0].value;
  546. }
  547. moneyDialog.visible = true;
  548. moneyDialog.title = "收费"
  549. }
  550. /** 现金收费 */
  551. const handleMoney = async (row ? : SettlementVO) => {
  552. moneyDialog.visible = true;
  553. moneyDialog.title = "收费"
  554. }
  555. /** 银联支付 */
  556. const handleUnionPay = async (row ? : SettlementVO) => {
  557. }
  558. /** 二维码支付 */
  559. const handleQRCode = async (row ? : SettlementVO) => {
  560. }
  561. const moneyDialogCancel = () => {
  562. moneyDialog.visible = false
  563. }
  564. /** 收到金额变化处理 */
  565. const changeFundsReceived = () => {
  566. const received = parseFloat(String(fundsReceived.value)) || 0;
  567. const receivable = parseFloat(String(rowData.value.receivableAmount)) || 0;
  568. const change = received - receivable;
  569. changeFund.value = change < 0 ? 0 : change;
  570. }
  571. /** 确认收费 - 添加金额验证 */
  572. const handleAddCharge = () => {
  573. const received = parseFloat(String(fundsReceived.value)) || 0;
  574. const receivable = parseFloat(String(rowData.value.receivableAmount)) || 0;
  575. if (received < receivable) {
  576. proxy ?.$modal.msgWarning('收到金额小于应收金额,请重新核对!');
  577. return;
  578. }
  579. rowData.value.paymentMethod = currentChargeMode.value
  580. rowData.value.settlementId = rowData.value.id
  581. rowData.value.fundsReceived = rowData.value.receivableAmount
  582. // 这里可以添加确认收费的逻辑
  583. chrageRecordFormRef.value ?.validate(async (valid: boolean) => {
  584. if (valid) {
  585. await addRecord(rowData.value).finally();
  586. proxy ?.$modal.msgSuccess('收费成功');
  587. moneyDialog.visible = false;
  588. await getList();
  589. }
  590. });
  591. }
  592. /** 提交按钮 */
  593. const submitForm = () => {
  594. settlementFormRef.value ?.validate(async (valid: boolean) => {
  595. if (valid) {
  596. buttonLoading.value = true;
  597. if (form.value.id) {
  598. await updateSettlement(form.value).finally(() => buttonLoading.value = false);
  599. } else {
  600. await addSettlement(form.value).finally(() => buttonLoading.value = false);
  601. }
  602. proxy ?.$modal.msgSuccess("操作成功");
  603. dialog.visible = false;
  604. await getList();
  605. }
  606. });
  607. }
  608. /** 删除按钮操作 */
  609. const handleDelete = async (row ? : SettlementVO) => {
  610. const _ids = row ?.id || ids.value;
  611. await proxy ?.$modal.confirm('是否确认删除结算管理编号为"' + _ids + '"的数据项?').finally(() => loading.value = false);
  612. await delSettlement(_ids);
  613. proxy ?.$modal.msgSuccess("删除成功");
  614. await getList();
  615. }
  616. const getSetList = async () => {
  617. loading.value = true;
  618. const res = await listSet(queryParams.value);
  619. if (res.rows.length > 0) {
  620. useStore.setChargeInfo(res.rows[0]);
  621. }
  622. };
  623. /** 导出按钮操作 */
  624. const handleExport = () => {
  625. proxy ?.download('system/settlement/export', {
  626. ...queryParams.value
  627. }, `settlement_${new Date().getTime()}.xlsx`)
  628. }
  629. onMounted(() => {
  630. getList();
  631. getDeptList()
  632. });
  633. </script>
  634. <style lang="scss" scoped>
  635. .patient-info {
  636. background-color: #f5f7fa;
  637. padding: 16px;
  638. border-radius: 4px;
  639. margin-bottom: 20px;
  640. }
  641. .info-item {
  642. display: flex;
  643. margin-bottom: 12px;
  644. }
  645. .info-item .label {
  646. font-weight: bold;
  647. color: #606266;
  648. min-width: 100px;
  649. flex-shrink: 0;
  650. }
  651. .info-item .value {
  652. color: #303133;
  653. flex: 1;
  654. }
  655. .recipe-detail {
  656. margin-top: 20px;
  657. }
  658. .dialog-footer {
  659. text-align: center;
  660. }
  661. .dialog-footer .el-button {
  662. margin: 0 10px;
  663. }
  664. .prescription-table-wrapper {
  665. overflow-x: auto;
  666. .prescription-table {
  667. width: 100%;
  668. border-collapse: collapse;
  669. border: 1px solid #ddd;
  670. background: white;
  671. font-size: 14px;
  672. th,
  673. td {
  674. border: 1px solid #ddd;
  675. padding: 10px 12px;
  676. text-align: center;
  677. vertical-align: middle;
  678. min-width: 90px;
  679. white-space: nowrap;
  680. overflow: hidden;
  681. text-overflow: ellipsis;
  682. }
  683. th {
  684. background: #e8f4fd !important;
  685. color: #303133 !important;
  686. font-weight: 600 !important;
  687. font-size: 14px !important;
  688. height: 40px !important;
  689. }
  690. td {
  691. color: #303133;
  692. font-size: 14px;
  693. height: 36px;
  694. &:first-child {
  695. font-weight: 500;
  696. }
  697. }
  698. // 斑马纹
  699. tbody tr:nth-child(even) {
  700. background: #fafbfc;
  701. }
  702. // 悬停效果
  703. tbody tr:hover {
  704. background: #f0f9ff;
  705. }
  706. }
  707. }
  708. .setting-group {
  709. display: flex;
  710. align-items: center;
  711. margin-bottom: 20px;
  712. .setting-label {
  713. width: 180px;
  714. color: #606266;
  715. font-size: 14px;
  716. flex-shrink: 0;
  717. text-align: right;
  718. .required {
  719. color: #f56c6c;
  720. margin-right: 4px;
  721. }
  722. }
  723. .amount-value {
  724. color: #303133;
  725. font-size: 14px;
  726. font-weight: 500;
  727. min-width: 80px;
  728. text-align: left;
  729. }
  730. }
  731. </style>