From cf5637d306f3b6d67565e1ebcdfe9bfec86f5f50 Mon Sep 17 00:00:00 2001 From: dzc <2388224167@qq.com> Date: Tue, 25 Aug 2026 12:49:16 +0800 Subject: [PATCH] =?UTF-8?q?feat:hard=E3=80=81wallet=E8=A1=A8=E6=A0=BC?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E4=BA=BA=E5=91=98=E3=80=81=E4=BA=BA=E5=91=98?= =?UTF-8?q?=E8=BA=AB=E4=BB=BD=E5=AD=97=E6=AE=B5=E5=92=8C=E6=90=9C=E7=B4=A2?= =?UTF-8?q?=20fix:=E4=BC=98=E5=8C=96hard=E6=A8=A1=E5=9D=97=E7=BB=9F?= =?UTF-8?q?=E8=AE=A1=E5=AF=BC=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/hard/hard-total-appt.ts | 61 ---------------- src/api/hard/hard-total.ts | 27 +++++++ src/api/thirdparty/third-pay-order.ts | 8 -- .../components/dept-person-total-table.vue | 20 ++--- .../appt/canteen-dept-appt-total/index.vue | 62 +++++++++++++--- .../appt/canteen-product-appt-total/index.vue | 73 +++++++++++++++---- .../components/dept-person-total-table.vue | 20 ++--- src/views/hard/hard-after-sale/index.vue | 28 +++++-- src/views/hard/hard-auth/index.vue | 23 +++++- src/views/hard/hard-broadcast/index.vue | 22 +++++- src/views/hard/hard-door-flow/index.vue | 25 ++++++- src/views/hard/hard-invoice/index.vue | 35 +++++---- src/views/hard/hard-offline-order/index.vue | 30 ++++---- src/views/hard/hard-order/index.vue | 30 +++++--- src/views/hard/hard-recog/index.vue | 29 ++++---- .../components/pay-setting-form.vue | 7 +- .../thirdparty/third-pay-order/index.vue | 16 ---- src/views/wallet/wallet-active/index.vue | 23 +++++- src/views/wallet/wallet-cz/index.vue | 20 +++-- src/views/wallet/wallet-foreign/index.vue | 25 ++++++- src/views/wallet/wallet-freeze/index.vue | 25 ++++++- src/views/wallet/wallet-inactive/index.vue | 26 +++++-- src/views/wallet/wallet-jz/index.vue | 23 ++++-- src/views/wallet/wallet-manage/index.vue | 26 +++++-- src/views/wallet/wallet-qb/index.vue | 21 ++++-- .../wallet/wallet-recharge-apply/index.vue | 23 +++++- .../wallet/wallet-recharge-invoice/index.vue | 21 +++++- .../wallet/wallet-recharge-water/index.vue | 26 ++++--- .../wallet/wallet-rule-transaction/index.vue | 24 ++++-- src/views/wallet/wallet-stride/index.vue | 25 ++++++- src/views/wallet/wallet-th/index.vue | 23 ++++-- src/views/wallet/wallet-tk/index.vue | 25 +++++-- src/views/wallet/wallet-xf/index.vue | 25 +++++-- 33 files changed, 605 insertions(+), 292 deletions(-) diff --git a/src/api/hard/hard-total-appt.ts b/src/api/hard/hard-total-appt.ts index 52cbf02f..668dd188 100644 --- a/src/api/hard/hard-total-appt.ts +++ b/src/api/hard/hard-total-appt.ts @@ -154,32 +154,6 @@ export interface CanteenUserReservationStatisticsResponse { msg?: string } -/** - * 按预约使用日期查询食堂预约部门统计。 - */ -export function listByDept(query: any) { - return request({ - url: "/hard/hard-canteen-appt-total-log/list-by-dept", - method: "post", - data: query, - }) -} - -/** - * 食堂统计 - */ -export function canteenProudctTotal(query: any) { - return request({ - url: "/hard/hard-canteen-appt-total-log/proudct-reserv-total", - method: "post", - params: { - current: query.current, - size: query.size, - }, - data: query, - }) -} - /** * 按用户和用餐日期范围分页查询每日食堂预约,后端会保留每天没有预约日志的权限范围用户。 */ @@ -250,38 +224,3 @@ export function exportCanteenUserReservation(query: CanteenUserReservationQuery) responseType: "blob", }) } - -/** 菜品预约统计导出查询条件,日期范围使用预约使用时间闭区间。 */ -export interface CanteenProductReservationExportQuery { - /** 预约使用日期时间范围,格式为 YYYY-MM-DD HH:mm:ss。 */ - apptUseDateTimeList?: [string, string] - /** 餐段字典编码。 */ - hourType?: string | number - /** 食堂商户主键。 */ - merchantId?: string | number - /** 用户部门主键集合。 */ - userDeptIds?: Array - /** 是否包含所选部门。 */ - isInclude?: boolean - /** 商户部门主键集合。 */ - merchantDeptIds?: Array - /** 菜品预约统计允许的商户主键集合。 */ - mchIds?: Array -} - -/** 菜品预约统计异步导出提交接口的统一响应。 */ -export interface CanteenProductReservationExportTaskResponse { - /** 后端创建的异步任务进度。 */ - data: AsyncTaskProgress - /** 后端返回的任务提交提示。 */ - msg?: string -} - -/** 按当前菜品预约统计筛选条件提交异步导出任务。 */ -export function submitCanteenProductReservationExport(query: CanteenProductReservationExportQuery) { - return request({ - url: "/hard/hard-canteen-appt-total-log/product-reserv-export-task", - method: "post", - data: query, - }) -} diff --git a/src/api/hard/hard-total.ts b/src/api/hard/hard-total.ts index 3c4357e5..aa70f45a 100644 --- a/src/api/hard/hard-total.ts +++ b/src/api/hard/hard-total.ts @@ -1,4 +1,5 @@ import request from "/@/utils/request" +import type { AsyncTaskProgress } from "/@/api/asyncTask" /** 食堂销售统计来源协议编码。 */ export const SALE_SOURCE = { @@ -58,6 +59,14 @@ export interface CanteenStatisticsRow { children?: CanteenStatisticsRow[] } +/** 食堂销售统计异步导出提交接口响应。 */ +export interface CanteenStatisticsExportTaskResponse { + /** 后端创建的初始异步任务进度。 */ + data: AsyncTaskProgress + /** 后端返回的任务提交提示。 */ + msg?: string +} + /** * 食堂菜品购买部门统计 */ @@ -147,6 +156,24 @@ export function exportDept(query: CanteenStatisticsQuery) { }) } +/** 提交按自然日分批生成的菜品销售统计异步导出任务。 */ +export function submitProductExport(query: CanteenStatisticsQuery) { + return request({ + url: "/hard/hard-canteen-total-log/export-product-task", + method: "post", + data: query, + }) +} + +/** 提交按自然日分批生成的部门销售统计异步导出任务。 */ +export function submitDeptExport(query: CanteenStatisticsQuery) { + return request({ + url: "/hard/hard-canteen-total-dept/export-dept-task", + method: "post", + data: query, + }) +} + /** * 菜品出售商户统计 */ diff --git a/src/api/thirdparty/third-pay-order.ts b/src/api/thirdparty/third-pay-order.ts index f7d9c8db..d9236c57 100755 --- a/src/api/thirdparty/third-pay-order.ts +++ b/src/api/thirdparty/third-pay-order.ts @@ -32,14 +32,6 @@ export function getObj(id?: string) { }) } -export function delObjs(ids?: Object) { - return request({ - url: "/third/third-pay-order", - method: "delete", - data: ids, - }) -} - export function putObj(obj?: Object) { return request({ url: "/third/third-pay-order", diff --git a/src/views/hard/appt/canteen-dept-appt-total/components/dept-person-total-table.vue b/src/views/hard/appt/canteen-dept-appt-total/components/dept-person-total-table.vue index fafc9be4..f49ffe83 100644 --- a/src/views/hard/appt/canteen-dept-appt-total/components/dept-person-total-table.vue +++ b/src/views/hard/appt/canteen-dept-appt-total/components/dept-person-total-table.vue @@ -11,18 +11,18 @@ :show-summary="true" @sort-change="sortChangeHandle" > - + + + + diff --git a/src/views/hard/appt/canteen-dept-appt-total/index.vue b/src/views/hard/appt/canteen-dept-appt-total/index.vue index e2869bc5..f9e1b189 100644 --- a/src/views/hard/appt/canteen-dept-appt-total/index.vue +++ b/src/views/hard/appt/canteen-dept-appt-total/index.vue @@ -187,6 +187,12 @@ + @@ -198,6 +204,9 @@ import { displayPrice } from "/@/utils/formatMoney" import { useDict } from "/@/hooks/dict" import { parseTime } from "/@/utils/formatTime" import { Right } from "@element-plus/icons-vue" +import type { AsyncTaskPollingConfig, AsyncTaskProgress } from "/@/api/asyncTask" +import AsyncTaskProgressComponent from "/@/components/AsyncTaskProgress.vue" +import { downBlobFile } from "/@/utils/other" import * as hardTotalApi from "/@/api/hard/hard-total" @@ -214,8 +223,18 @@ const productTotalTableRef = ref() const queryRef = ref() const showSearch = ref(true) const activeName = ref("all") -/** 导出互斥标记,避免连续点击生成重复下载请求。 */ -const exporting = ref(false) +/** 异步导出从提交到终态的本地互斥状态,防止同一页面重复创建并覆盖当前跟踪任务。 */ +const exportSubmitting = ref(false) +/** 部门销售统计异步导出进度弹窗引用。 */ +const exportProgressRef = ref>() +/** 部门销售统计导出进度配置,与后端 Redis 业务命名空间保持一致。 */ +const exportTaskConfig: AsyncTaskPollingConfig = { + progressUrl: "/hard/async-task/progress", + redisKey: "hard:canteen-sales:export:department", + showDialogOnFinished: false, + waitingMessage: "正在按日期分批生成部门销售统计文件,请耐心等待进度达到 100%", + downloadButtonText: "下载 Excel", +} const sourceTabs = [ { name: "all", label: "全部", codes: [hardTotalApi.SALE_SOURCE.OFFLINE_PURCHASE, hardTotalApi.SALE_SOURCE.RESERVATION_VERIFIED] }, { name: hardTotalApi.SALE_SOURCE.OFFLINE_PURCHASE, label: "线下购买", codes: [hardTotalApi.SALE_SOURCE.OFFLINE_PURCHASE] }, @@ -241,7 +260,7 @@ const aggregateSourceName = computed(() => ) // table hook -const { sortChangeHandle, postDownBlobFile, tableStyle } = useTable(state) +const { sortChangeHandle, tableStyle } = useTable(state) onMounted(() => { getDataList() @@ -355,18 +374,43 @@ const getRowStatisticsDateTimeList = (row: any) => { } const exportExcel = async () => { - if (exporting.value) { - useMessage().warning("导出正在处理中,请勿重复操作") + if (exportSubmitting.value) { + useMessage().warning("已有食堂菜品部门统计导出任务正在处理") return } - exporting.value = true + exportSubmitting.value = true try { - await postDownBlobFile("/hard/hard-canteen-total-dept/export-dept", { ...state.queryForm }, "食堂菜品部门统计.xlsx") - } finally { - exporting.value = false + const response = await hardTotalApi.submitDeptExport({ ...state.queryForm }) + if (!response.data?.taskId) { + exportSubmitting.value = false + useMessage().error("导出任务提交成功,但响应中缺少任务ID") + return + } + useMessage().success(response.msg || "食堂菜品部门统计导出任务已提交") + exportProgressRef.value?.start(response.data) + } catch (error: any) { + exportSubmitting.value = false + useMessage().error(error?.msg || "食堂菜品部门统计导出任务提交失败") } } +/** 异步导出成功后下载文件中心返回的完整统计文件。 */ +const handleExportSuccess = async (progress: AsyncTaskProgress) => { + exportSubmitting.value = false + if (!progress.resultFileUrl) { + useMessage().error("导出完成,但未返回文件下载地址") + return + } + useMessage().success(progress.message || "食堂菜品部门统计导出完成") + await downBlobFile(progress.resultFileUrl, {}, progress.resultFileName || "食堂菜品部门统计.xlsx") +} + +/** 异步导出失败时展示后台任务返回的受控错误信息。 */ +const handleExportFailure = (progress: AsyncTaskProgress) => { + exportSubmitting.value = false + useMessage().error(progress.message || "食堂菜品部门统计导出失败") +} + // 搜索 const doSearch = () => { getDataList() diff --git a/src/views/hard/appt/canteen-product-appt-total/index.vue b/src/views/hard/appt/canteen-product-appt-total/index.vue index 07d9d2c3..64da1521 100644 --- a/src/views/hard/appt/canteen-product-appt-total/index.vue +++ b/src/views/hard/appt/canteen-product-appt-total/index.vue @@ -26,7 +26,7 @@ - + + + - - diff --git a/src/views/wallet/wallet-active/index.vue b/src/views/wallet/wallet-active/index.vue index db959061..db3de072 100644 --- a/src/views/wallet/wallet-active/index.vue +++ b/src/views/wallet/wallet-active/index.vue @@ -20,6 +20,10 @@