diff --git a/src/views/wallet/wallet-recharge-apply/preview-excel.vue b/src/views/wallet/wallet-recharge-apply/preview-excel.vue index 59d258e..06f2ee0 100644 --- a/src/views/wallet/wallet-recharge-apply/preview-excel.vue +++ b/src/views/wallet/wallet-recharge-apply/preview-excel.vue @@ -23,13 +23,22 @@ > - + + + + + - - + + + + @@ -76,6 +85,10 @@ import * as walletRechargeApplyApi from "/@/api/wallet/wallet-recharge-apply" import type { VNode } from "vue" import type { TableColumnCtx } from "element-plus" import { h } from "vue" +import { useDict } from "/@/hooks/dict" + +// 定义查询字典 +const { wallet_biz_recharge } = useDict("wallet_biz_recharge") interface SummaryMethodProps { columns: TableColumnCtx[] @@ -88,6 +101,7 @@ onMounted(async () => { const id = query.id as unknown as any state.queryForm.id = id getList() + getDetail() }) const state = reactive({ @@ -111,6 +125,8 @@ const data = reactive({ tableListStr: [], }) +const detail = ref({}) + const sizeChangeHandle = (e: any) => { state.pagination.size = e getList() @@ -121,6 +137,15 @@ const currentChangeHandle = (e: any) => { getList() } +const getDetail = async () => { + try { + const { data } = await walletRechargeApplyApi.getObj(state.queryForm.id) + detail.value = data ?? {} + } catch (error) { + console.log(error) + } +} + /** 查询列表 */ const getList = async () => { state.loading = true @@ -173,6 +198,42 @@ const getSummaries = (param: SummaryMethodProps) => { } else { sums[index] = "NaN" } + } else if (column.property === "prenBalance") { + const values = data1.map((item) => Number(item[column.property])) + if (!values.every((value) => Number.isNaN(value))) { + sums[index] = h("span", { style: { color: "#2e5cf6" } }, [ + displayPrice( + values.reduce((prev, curr) => { + const value = Number(curr) + if (!Number.isNaN(value)) { + return prev + curr + } else { + return prev + } + }, 0), + ), + ]) + } else { + sums[index] = "NaN" + } + } else if (column.property === "discountBalance") { + const values = data1.map((item) => Number(item[column.property])) + if (!values.every((value) => Number.isNaN(value))) { + sums[index] = h("span", { style: { color: "#f56c6c" } }, [ + displayPrice( + values.reduce((prev, curr) => { + const value = Number(curr) + if (!Number.isNaN(value)) { + return prev + curr + } else { + return prev + } + }, 0), + ), + ]) + } else { + sums[index] = "NaN" + } } else if (column.property === data.tableList[0]) { sums[index] = displayPrice( data.list.reduce((prev: any, curr: any) => {