preview.vue 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760
  1. <template>
  2. <Dialog
  3. v-model="dialogVisible"
  4. title="对账单预览"
  5. class="billPayPreview"
  6. width="60%"
  7. scroll
  8. @closed="handleClosed"
  9. >
  10. <el-tabs v-model="activeName" class="demo-tabs" @tab-change="handleClick">
  11. <el-tab-pane label="打印类型A(含固定费明细)" name="first">
  12. <div class="first" id="printTab1">
  13. <div class="header">
  14. <p class="title" style="font-size: 18px">{{ tenantName }}对账单预览</p>
  15. <div class="info-wrap" style="margin-top: -4px">
  16. <span
  17. ><b>姓名:</b> {{ dataForm.elderName
  18. }}{{
  19. dataForm.contractNumber == null || dataForm.contractNumber == ''
  20. ? ''
  21. : `(${dataForm.contractNumber})`
  22. }}</span
  23. >
  24. <span><b>床位号:</b> {{ dataForm.bedName }}</span>
  25. <span><b>缴费时间:</b> {{ formatTime(dataForm.payTime, 'yyyy-MM-dd') }}</span>
  26. <!-- <span><b>应收金额:</b> {{ totalPayAmount }}元</span>-->
  27. <span><b>经手人:</b> {{ dataForm.payeeName }}</span>
  28. <!-- <span><b>账单月:</b> {{ dataForm.billingMonth }}</span>-->
  29. <!-- <span><b>打印时间:</b> {{ dayjs(new Date()).format('YYYY-MM-DD HH:mm:ss') }}</span>-->
  30. </div>
  31. <!-- <div class="info-wrap" style="margin-top: -10px">-->
  32. <!-- <span><b>发票号:</b> {{ dataForm.invoiceNumber }}</span> -->
  33. <!-- <span><b>应收金额:</b> {{ totalPayAmount }}元</span>-->
  34. <!-- <span><b>医保费用:</b> {{ formatNum(dataForm.insuranceAmount) || '0' }}元</span>
  35. <span><b>个人应缴:</b> {{ formatNum(dataForm.payAmount) }}元</span> -->
  36. <!-- <span><b>长护险余额:</b> {{ formatNum(longTermAmount) || '0' }}元</span>-->
  37. <!-- <span><b>抹零金额:</b> {{ roundDown }}元</span>-->
  38. <!-- <span><b>个人应缴:</b> {{ payTotal }}元</span>-->
  39. <!-- </div>-->
  40. <!-- <div class="info-wrap" style="margin-top: -10px">-->
  41. <!-- <span><b>缴费时间:</b> {{ formatTime(dataForm.payTime, 'yyyy-MM-dd') }}</span>-->
  42. <!-- </div>-->
  43. </div>
  44. <el-divider style="margin-top: 0px" />
  45. <div class="content">
  46. <!-- <p class="info">以下是账单明细</p>-->
  47. <div class="flex">
  48. <b>{{
  49. dataForm.description
  50. ? tTitle + '(' + dataForm.description + ')'
  51. : tTitle + '(' + bTitle + ')'
  52. }}</b>
  53. <span><b>金额小计:</b>¥ {{ tableSubtotal }}</span>
  54. </div>
  55. <table style="width: 100%" border="2">
  56. <tr align="center">
  57. <td>序号</td>
  58. <td>费用分类</td>
  59. <td>费用名称</td>
  60. <!-- <td>单价(元/月)</td>
  61. <td>数量</td> -->
  62. <td>金额(元)</td>
  63. <td>实际发生时间</td>
  64. <td>备注</td>
  65. </tr>
  66. <tr v-for="(item, index) in dataForm.items" :key="index" align="center">
  67. <td>{{ index + 1 }}</td>
  68. <td>{{ item.itemCategoryName }}</td>
  69. <td>{{ item.itemName }}</td>
  70. <!-- <td>{{ tableRowPrice(item) }}</td>
  71. <td>{{ item.count }}</td> -->
  72. <td>{{ tableRowPay(item) }}</td>
  73. <td>{{ formatStartDate(item) }}</td>
  74. <td>{{ item.description }}</td>
  75. </tr>
  76. <tr align="center">
  77. <td>支付方式描述</td>
  78. <td colspan="5" class="pay-text-cell">{{ payText }}</td>
  79. </tr>
  80. <!-- <tr align="center">
  81. <td>预缴金额</td>
  82. <td colspan="5"></td>
  83. </tr> -->
  84. </table>
  85. </div>
  86. </div>
  87. </el-tab-pane>
  88. <el-tab-pane label="打印类型B(不含固定费明细)" name="second">
  89. <div class="second" id="printTab2">
  90. <div class="header">
  91. <p class="title">{{ tenantName }}对账单预览</p>
  92. <div class="info-wrap">
  93. <span>{{ dataForm.billingMonth }}账单</span>
  94. <span>{{ tenantName }}</span>
  95. <div class="right">
  96. <span><b>打印时间:</b> {{ dayjs(new Date()).format('YYYY-MM-DD HH:mm:ss') }}</span>
  97. </div>
  98. </div>
  99. </div>
  100. <div class="content">
  101. <table style="width: 100%" border="2">
  102. <tr align="center">
  103. <td>姓名</td>
  104. <td colspan="3">{{ dataForm.elderName }}</td>
  105. <td>床位号</td>
  106. <td colspan="3"> {{ dataForm.bedName }}</td>
  107. </tr>
  108. <tr align="center">
  109. <td rowspan="4">月度费用</td>
  110. <td colspan="2">费用名称</td>
  111. <td>金额(元)</td>
  112. <td rowspan="4">其他费用</td>
  113. <td colspan="2">费用名称</td>
  114. <td>金额(元)</td>
  115. </tr>
  116. <tr align="center">
  117. <td colspan="2">
  118. <p>{{ tTitle }}</p>
  119. <p v-if="!dataForm.description">({{ bTitle }})</p>
  120. <p v-if="dataForm.description">({{ dataForm.description }})</p>
  121. </td>
  122. <td>{{ table2MonthPay }}</td>
  123. <td colspan="2">{{ dataForm.otherName }}</td>
  124. <td>{{ table2OtherPay }}</td>
  125. </tr>
  126. <tr></tr>
  127. <tr align="center">
  128. <td colspan="2">小计</td>
  129. <td>{{ formatNum(dataForm.monthNum) }}</td>
  130. <td colspan="2">小计</td>
  131. <td>{{ formatNum(dataForm.otherNum) }}</td>
  132. </tr>
  133. <tr>
  134. <td colspan="2" align="center">账单金额</td>
  135. <td colspan="6">{{ totalPayAmount }}元</td>
  136. </tr>
  137. <tr>
  138. <td colspan="2" align="center">长护险费用</td>
  139. <td colspan="6">{{ formatNum(longTermAmount) || '0' }}元</td>
  140. </tr>
  141. <tr>
  142. <td colspan="2" align="center">抹零金额</td>
  143. <td colspan="6">{{ formatNum(roundDown) }}元</td>
  144. </tr>
  145. <tr>
  146. <td colspan="2" align="center">个人应缴</td>
  147. <td colspan="6">{{ payTotal }}元</td>
  148. </tr>
  149. </table>
  150. </div>
  151. </div>
  152. </el-tab-pane>
  153. </el-tabs>
  154. <template #footer>
  155. <el-button @click="handleClosed">取消</el-button>
  156. <el-button type="primary" v-print="printTab2" v-if="activeName == 'second'">打印</el-button>
  157. <el-button type="primary" v-print="printTab1" v-if="activeName == 'first'">打印</el-button>
  158. </template>
  159. </Dialog>
  160. </template>
  161. <script setup lang="ts">
  162. import { getExpenseOrderDetail } from '@/api/elderly/fee/bill-pay'
  163. import dayjs from 'dayjs'
  164. import { useUserStore } from '@/store/modules/user'
  165. import {
  166. fixedNum,
  167. formatCeil,
  168. formatDecimal,
  169. formatNum,
  170. formatRid,
  171. formatRound
  172. } from '@/utils/formatter'
  173. import { useSettingStore } from '@/store/modules/setting'
  174. import { formatTime } from '@/utils'
  175. import { getDictLabel, DICT_TYPE } from '@/utils/dict'
  176. defineOptions({ name: 'BillPayPreview' })
  177. const settingStore = useSettingStore()
  178. const tenantName = useUserStore().getTenantName // 当前登录的编号
  179. const dialogVisible = ref(false)
  180. const activeName = ref('first')
  181. const dataForm = ref({
  182. insuranceAmount: 0,
  183. payAmount: 0,
  184. billingMonth: '',
  185. contractNumber: '',
  186. items: [],
  187. payInfos: [],
  188. otherName: '',
  189. otherNum: '',
  190. monthNum: '',
  191. elderName: '',
  192. bedName: '',
  193. actualAmount: '',
  194. type: '',
  195. invoiceNumber: '',
  196. payTime: '',
  197. payeeName: '',
  198. description: ''
  199. })
  200. const longTermAmount = ref(0)
  201. const payText = ref('')
  202. const roundDown = ref(0)
  203. const formatPayCreatedTime = (createdTime) => {
  204. if (!createdTime) return ''
  205. const timestamp = String(createdTime).length === 10 ? Number(createdTime) * 1000 : Number(createdTime)
  206. return dayjs(timestamp).format('YYYY-MM-DD')
  207. }
  208. /** 打开弹窗 */
  209. const open = async (id, row) => {
  210. dialogVisible.value = true
  211. const res = await getExpenseOrderDetail(id)
  212. let flag = false
  213. dataForm.value = res
  214. res.items = res.items.filter((item) => item.isShow == 1)
  215. res.items.map((item) => {
  216. if (item.expenseSource == 'long_term_care_insurance') {
  217. longTermAmount.value += item.actualPrice
  218. item.payStatus = 0
  219. flag = true
  220. // 遍历长护险
  221. res.expenseSubsidyDO.map((d) => {
  222. if (Math.abs(d.id || 1) == Math.abs(item.sourceExpenseItemId || 0)) {
  223. item.createdTime = d.month
  224. item.description = d.remarks
  225. if (!item.itemCategoryName) {
  226. item.itemCategoryName = '长护险'
  227. }
  228. }
  229. })
  230. }
  231. })
  232. dataForm.value.payeeName = row.payeeName
  233. // 已支付状态下的才是所有items
  234. if (res.payStatus == 0) {
  235. const arr = []
  236. res.items.map((item) => {
  237. if (item.payStatus == 1) {
  238. arr.push(item)
  239. }
  240. })
  241. dataForm.value.items = arr
  242. }
  243. // 已支付订单金额
  244. let num = 0
  245. let insurance = 0
  246. res.payInfos.map((item) => {
  247. item.items.map((info) => {
  248. const payLine =
  249. getDictLabel(DICT_TYPE.BILL_PAY_TYPE, info.payType) +
  250. ':' +
  251. info.payAmount +
  252. '元(支付时间:' +
  253. formatPayCreatedTime(info.createdTime) +
  254. ')'
  255. payText.value += payText.value ? '\n' + payLine : payLine
  256. })
  257. num += formatDecimal(item.payAmount) as number
  258. insurance += item.insuranceAmount ? (formatDecimal(item.insuranceAmount) as number) : 0
  259. // 看看是否有抹零金额
  260. if (item.discountAmount) {
  261. roundDown.value += item.discountAmount
  262. }
  263. })
  264. dataForm.value.payAmount = formatRid(num) as number
  265. dataForm.value.insuranceAmount = formatRid(insurance) as number
  266. // 有长护险
  267. if (!flag) {
  268. if (res.expenseSubsidyDO && res.expenseSubsidyDO.length) {
  269. let num = 0
  270. res.expenseSubsidyDO.map((item) => {
  271. num += item.amount
  272. dataForm.value.items.push({
  273. expenseSource: 'long_term_care_insurance',
  274. itemCategoryName: '长护险',
  275. itemName: '长护险抵扣',
  276. description: item.remarks ? item.remarks : item.month + '长护险抵扣',
  277. roundAmount: -item.amount,
  278. roundTwoDecimalAmount: -item.amount,
  279. totalAmount: -item.amount,
  280. createdTime: item.month,
  281. payTime: '',
  282. payStatus: item.status
  283. })
  284. })
  285. // 去除长护险费用
  286. // unPayTotal.value -= num
  287. longTermAmount.value = num
  288. // payTotal.value -= res.num
  289. }
  290. }
  291. }
  292. defineExpose({ open }) // 提供 open 方法,用于打开弹窗
  293. const handleClick = (val) => {
  294. activeName.value = val
  295. // 计算固定费用和其他费用
  296. if (val == 'second') {
  297. let monthNum = 0,
  298. otherNum = 0,
  299. otherName = ''
  300. dataForm.value.items.map((item) => {
  301. if (item.isMonthlyExpense == 1) {
  302. if (rounding.value) {
  303. // 取整
  304. monthNum +=
  305. item.expenseSource == 'consumer_voucher'
  306. ? getConsumerVoucherAmountNumber(item)
  307. : Number(item.roundAmount)
  308. } else if (fixed2Num.value) {
  309. // 四舍五入
  310. monthNum +=
  311. item.expenseSource == 'consumer_voucher'
  312. ? getConsumerVoucherAmountNumber(item)
  313. : Number(item.roundTwoDecimalAmount)
  314. } else {
  315. // 应收
  316. monthNum +=
  317. item.expenseSource == 'consumer_voucher'
  318. ? getConsumerVoucherAmountNumber(item)
  319. : Number(formatNum(item.totalAmount))
  320. }
  321. } else {
  322. if (item.itemName != '长护险护理补贴费用') {
  323. otherName += item.itemName + ';'
  324. if (rounding.value) {
  325. // 取整
  326. otherNum +=
  327. item.expenseSource == 'consumer_voucher'
  328. ? getConsumerVoucherAmountNumber(item)
  329. : Number(item.roundAmount)
  330. } else if (fixed2Num.value) {
  331. // 四舍五入
  332. otherNum +=
  333. item.expenseSource == 'consumer_voucher'
  334. ? getConsumerVoucherAmountNumber(item)
  335. : Number(item.roundTwoDecimalAmount)
  336. } else {
  337. // 应收
  338. otherNum +=
  339. item.expenseSource == 'consumer_voucher'
  340. ? getConsumerVoucherAmountNumber(item)
  341. : Number(formatNum(item.totalAmount))
  342. }
  343. }
  344. }
  345. })
  346. dataForm.value.monthNum = monthNum
  347. dataForm.value.otherNum = otherNum
  348. dataForm.value.otherName = otherName
  349. }
  350. }
  351. const handleClosed = () => {
  352. payText.value = ''
  353. activeName.value = 'first'
  354. longTermAmount.value = 0
  355. dialogVisible.value = false
  356. }
  357. // 取整金额
  358. const rounding = computed(() => {
  359. return settingStore.getRounding
  360. })
  361. // 四舍五入保留两位
  362. const fixed2Num = computed(() => {
  363. return settingStore.getFix2Num
  364. })
  365. const getConsumerVoucherAmountNumber = (item) => {
  366. const ruleValue = settingStore.getCouponRuleValue
  367. const rawAmount = item?.totalAmount ?? 0
  368. if (ruleValue == 2 || ruleValue == '2') {
  369. return Number(formatRound(rawAmount))
  370. }
  371. return Number(formatNum(rawAmount))
  372. }
  373. const getConsumerVoucherAmountText = (item) => {
  374. const ruleValue = settingStore.getCouponRuleValue
  375. const rawAmount = item?.totalAmount ?? 0
  376. if (ruleValue == 2 || ruleValue == '2') {
  377. return formatRound(rawAmount)
  378. }
  379. return formatNum(rawAmount)
  380. }
  381. // 账单总额
  382. const totalPayAmount = computed(() => {
  383. let num1 = 0,
  384. num2 = 0,
  385. num3 = 0 // 入院向上取整 、 入院保留两位、 入院应收
  386. // 遍历里面的所有数据得到数据
  387. dataForm.value.items.map((item) => {
  388. if (item.itemName != '长护险护理补贴费用') {
  389. num1 +=
  390. item.expenseSource == 'consumer_voucher'
  391. ? getConsumerVoucherAmountNumber(item)
  392. : Number(item.roundAmount)
  393. num2 +=
  394. item.expenseSource == 'consumer_voucher'
  395. ? getConsumerVoucherAmountNumber(item)
  396. : Number(item.roundTwoDecimalAmount)
  397. if (item.isMonthlyExpense == 1 && dataForm.value.type == 1) {
  398. if (settingStore.getAdmissionBill == 2) {
  399. // 向上取整
  400. num3 +=
  401. item.expenseSource == 'consumer_voucher'
  402. ? getConsumerVoucherAmountNumber(item)
  403. : Number(formatCeil(item.totalAmount))
  404. } else if (settingStore.getAdmissionBill == 3) {
  405. // 四舍五入保留两位
  406. num3 +=
  407. item.expenseSource == 'consumer_voucher'
  408. ? getConsumerVoucherAmountNumber(item)
  409. : Number(item.roundTwoDecimalAmount)
  410. } else if (settingStore.getAdmissionBill == 4) {
  411. // 四舍五入取整
  412. num3 +=
  413. item.expenseSource == 'consumer_voucher'
  414. ? getConsumerVoucherAmountNumber(item)
  415. : Number(item.roundAmount)
  416. } else {
  417. num3 +=
  418. item.expenseSource == 'consumer_voucher'
  419. ? getConsumerVoucherAmountNumber(item)
  420. : Number(item.totalAmount)
  421. }
  422. } else {
  423. if (rounding.value) {
  424. num3 +=
  425. item.expenseSource == 'consumer_voucher'
  426. ? getConsumerVoucherAmountNumber(item)
  427. : Number(item.roundAmount)
  428. } else if (fixed2Num.value) {
  429. num3 +=
  430. item.expenseSource == 'consumer_voucher'
  431. ? getConsumerVoucherAmountNumber(item)
  432. : Number(item.roundTwoDecimalAmount)
  433. } else {
  434. num3 +=
  435. item.expenseSource == 'consumer_voucher'
  436. ? getConsumerVoucherAmountNumber(item)
  437. : Number(item.totalAmount)
  438. }
  439. }
  440. }
  441. })
  442. if (dataForm.value.type == 1) {
  443. return formatNum(num3)
  444. } else {
  445. if (rounding.value) {
  446. // 取整(有问题)
  447. return formatNum(num1)
  448. } else if (fixed2Num.value) {
  449. // 四舍五入
  450. return formatNum(num2)
  451. } else {
  452. return formatNum(dataForm.value.actualAmount)
  453. }
  454. }
  455. })
  456. // 个人应缴
  457. const payTotal = computed(() => {
  458. let num = 0
  459. dataForm.value.payInfos.map((item) => {
  460. num += item.payAmount
  461. })
  462. return formatNum(num)
  463. // return formatNum(totalPayAmount.value - longTermAmount.value - roundDown.value)
  464. })
  465. // 表格1单价
  466. const tableRowPrice = (row) => {
  467. return formatNum(row.actualPrice)
  468. }
  469. // 表格1总额单项小计
  470. const tableRowPay = (row) => {
  471. if (row.expenseSource == 'consumer_voucher') {
  472. return getConsumerVoucherAmountText(row)
  473. }
  474. if (dataForm.value.type == '1' && row.isMonthlyExpense == 1) {
  475. if (settingStore.getAdmissionBill == 2) {
  476. // 向上取整
  477. return formatNum(formatCeil(row.totalAmount))
  478. } else if (settingStore.getAdmissionBill == 3) {
  479. // 四舍五入保留两位
  480. return formatNum(row.roundTwoDecimalAmount)
  481. } else if (settingStore.getAdmissionBill == 4) {
  482. // 四舍五入取整
  483. return formatNum(row.roundAmount)
  484. } else {
  485. return formatNum(row.totalAmount)
  486. }
  487. } else {
  488. if (rounding.value) {
  489. return formatNum(row.roundAmount)
  490. } else if (fixed2Num.value) {
  491. return formatNum(row.roundTwoDecimalAmount)
  492. } else {
  493. return formatNum(row.totalAmount)
  494. }
  495. }
  496. }
  497. // 表格1总额小计
  498. const tableSubtotal = computed(() => {
  499. let num = 0
  500. dataForm.value.items.map((item) => {
  501. if (dataForm.value.type == '1' && item.isMonthlyExpense == 1) {
  502. if (settingStore.getAdmissionBill == 2) {
  503. // 向上取整
  504. num +=
  505. item.expenseSource == 'consumer_voucher'
  506. ? getConsumerVoucherAmountNumber(item)
  507. : Number(formatCeil(item.totalAmount))
  508. } else if (settingStore.getAdmissionBill == 3) {
  509. // 四舍五入保留两位
  510. num +=
  511. item.expenseSource == 'consumer_voucher'
  512. ? getConsumerVoucherAmountNumber(item)
  513. : Number(item.roundTwoDecimalAmount)
  514. } else if (settingStore.getAdmissionBill == 4) {
  515. // 四舍五入取整
  516. num +=
  517. item.expenseSource == 'consumer_voucher'
  518. ? getConsumerVoucherAmountNumber(item)
  519. : Number(item.roundAmount)
  520. } else {
  521. // 应收
  522. num +=
  523. item.expenseSource == 'consumer_voucher'
  524. ? getConsumerVoucherAmountNumber(item)
  525. : Number(item.totalAmount)
  526. }
  527. } else {
  528. if (rounding.value) {
  529. num +=
  530. item.expenseSource == 'consumer_voucher'
  531. ? getConsumerVoucherAmountNumber(item)
  532. : Number(item.roundAmount)
  533. } else if (fixed2Num.value) {
  534. num +=
  535. item.expenseSource == 'consumer_voucher'
  536. ? getConsumerVoucherAmountNumber(item)
  537. : Number(item.roundTwoDecimalAmount)
  538. } else {
  539. num +=
  540. item.expenseSource == 'consumer_voucher'
  541. ? getConsumerVoucherAmountNumber(item)
  542. : Number(item.totalAmount)
  543. }
  544. }
  545. })
  546. return formatNum(num)
  547. })
  548. // 表格2月度总额
  549. const table2MonthPay = computed(() => {
  550. return formatNum(dataForm.value.monthNum)
  551. })
  552. // 表格2其他费用
  553. const table2OtherPay = computed(() => {
  554. return formatNum(dataForm.value.otherNum)
  555. })
  556. const tTitle = computed(() => {
  557. const arr = dataForm.value.billingMonth ? dataForm.value.billingMonth.split('-') : ''
  558. if (arr.length) {
  559. return `预收${arr[0]}年${arr[1]}月固定费用`
  560. }
  561. return ''
  562. })
  563. const bTitle = computed(() => {
  564. const arr = dataForm.value.billingMonth ? dataForm.value.billingMonth.split('-') : ''
  565. if (arr.length) {
  566. // 获取当月最后一天
  567. const date = new Date(new Date(Number(arr[0]), Number(arr[1]), 0)).getDate()
  568. return `${arr[0]}年${arr[1]}月01日-${arr[0]}年${arr[1]}月${date}日`
  569. }
  570. return ''
  571. })
  572. // const formatStartDate = (item) => {
  573. // return item.expenseSource == 'long_term_care_insurance' || item.itemName == '长护险护理补贴费用' ? item.createdTime : (item.expenseSource == 'expense_item' ? (dataForm.value.description ? dataForm.value.description : bTitle) : (item.startDate + '至' + item.endDate))
  574. // }
  575. const formatStartDate = (item) => {
  576. if (item.itemName == '长护险护理补贴费用' || item.expenseSource == 'long_term_care_insurance') {
  577. // 长护险
  578. return item.createdTime
  579. // let dataStr = item.startDate??"--"
  580. // if(dataStr.length>=10){
  581. // dataStr = dataStr.substring(0,7)
  582. // }
  583. // return dataStr
  584. } else if (item.expenseSource == 'expense_item') {
  585. // if(dataForm.value.description){
  586. // return dataForm.value.description
  587. // }else{
  588. // return bTitle
  589. // }
  590. if (item.description && item.description.includes('的')) {
  591. return item.description.split('的')[0]
  592. } else if (item.startDate != null && item.endDate != null) {
  593. return `${item.startDate}至${item.endDate}`
  594. } else if (
  595. item.startDate == null &&
  596. dataForm.value.description &&
  597. dataForm.value.description.length > 21
  598. ) {
  599. return dataForm.value.description.toString().substring(0, 21)
  600. } else {
  601. return bTitle
  602. }
  603. } else {
  604. return item.startDate + '至' + item.endDate
  605. }
  606. }
  607. const formatStr = (dateStr) => {
  608. if (dateStr) {
  609. // 2. 按 "-" 拆分字符串,得到 [年, 月, 日] 数组
  610. const [year, month, day] = dateStr.split('-')
  611. // 3. 按目标格式拼接
  612. return `${year}年${month}月${day}日`
  613. }
  614. return ''
  615. }
  616. // 打印
  617. const printTab1 = {
  618. id: 'printTab1',
  619. extraCss: '',
  620. popTitle: '', // 打印配置页上方的标题
  621. extraHead: '', // 最上方的头部文字,附加在head标签上的额外标签,使用逗号分割
  622. preview: false, // 是否启动预览模式,默认是false
  623. previewTitle: tenantName + '对账单预览', // 打印预览的标题
  624. previewPrintBtnLabel: '预览结束,开始打印', // 打印预览的标题下方的按钮文本,点击可进入打印
  625. zIndex: 20002, // 预览窗口的z-index,默认是20002,最好比默认值更高
  626. previewBeforeOpenCallback() {
  627. console.log('正在加载预览窗口!')
  628. }, // 预览窗口打开之前的callback
  629. previewOpenCallback() {
  630. console.log('已经加载完预览窗口,预览打开了!')
  631. }, // 预览窗口打开时的callback
  632. beforeOpenCallback() {
  633. console.log('开始打印之前!')
  634. }, // 开始打印之前的callback
  635. openCallback() {
  636. console.log('执行打印了!')
  637. }, // 调用打印时的callback
  638. closeCallback() {
  639. console.log('关闭了打印工具!')
  640. }, // 关闭打印的callback(无法区分确认or取消)
  641. clickMounted() {
  642. console.log('点击v-print绑定的按钮了!')
  643. },
  644. standard: ''
  645. }
  646. // 打印
  647. const printTab2 = {
  648. id: 'printTab2',
  649. extraCss: '',
  650. popTitle: '', // 打印配置页上方的标题
  651. extraHead: '', // 最上方的头部文字,附加在head标签上的额外标签,使用逗号分割
  652. preview: false, // 是否启动预览模式,默认是false
  653. previewTitle: tenantName + '对账单预览', // 打印预览的标题
  654. previewPrintBtnLabel: '预览结束,开始打印', // 打印预览的标题下方的按钮文本,点击可进入打印
  655. zIndex: 20002, // 预览窗口的z-index,默认是20002,最好比默认值更高
  656. previewBeforeOpenCallback() {
  657. console.log('正在加载预览窗口!')
  658. }, // 预览窗口打开之前的callback
  659. previewOpenCallback() {
  660. console.log('已经加载完预览窗口,预览打开了!')
  661. }, // 预览窗口打开时的callback
  662. beforeOpenCallback() {
  663. console.log('开始打印之前!')
  664. }, // 开始打印之前的callback
  665. openCallback() {
  666. console.log('执行打印了!')
  667. }, // 调用打印时的callback
  668. closeCallback() {
  669. console.log('关闭了打印工具!')
  670. }, // 关闭打印的callback(无法区分确认or取消)
  671. clickMounted() {
  672. console.log('点击v-print绑定的按钮了!')
  673. },
  674. standard: ''
  675. }
  676. </script>
  677. <style lang="scss" scoped>
  678. .first {
  679. .header {
  680. .title {
  681. font-size: 20px;
  682. font-weight: bold;
  683. text-align: center;
  684. }
  685. .info-wrap {
  686. position: relative;
  687. span {
  688. display: inline-block;
  689. margin-bottom: 10px;
  690. width: 25%;
  691. }
  692. .right {
  693. display: inline-block;
  694. width: 49%;
  695. text-align: right;
  696. span {
  697. width: 100%;
  698. }
  699. }
  700. }
  701. }
  702. .content {
  703. .info {
  704. text-align: center;
  705. }
  706. .flex {
  707. display: flex;
  708. justify-content: space-between;
  709. margin-bottom: 10px;
  710. }
  711. }
  712. }
  713. .second {
  714. .header {
  715. .title {
  716. font-size: 20px;
  717. font-weight: bold;
  718. text-align: center;
  719. }
  720. .info-wrap {
  721. display: flex;
  722. justify-content: space-between;
  723. }
  724. }
  725. }
  726. .pay-text-cell {
  727. white-space: pre-line;
  728. }
  729. </style>