fix: handlePickup prompt

This commit is contained in:
xingyu4j
2025-10-20 14:13:49 +08:00
parent 27eb3e6d21
commit eb61ac3adb

View File

@@ -2,21 +2,14 @@
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
import type { MallOrderApi } from '#/api/mall/trade/order';
import { h, ref } from 'vue';
import { ref } from 'vue';
import { Page, prompt, SummaryCard } from '@vben/common-ui';
import { DeliveryTypeEnum } from '@vben/constants';
import { $t } from '@vben/locales';
import { fenToYuan } from '@vben/utils';
import {
ElCard,
ElImage,
ElInput,
ElLoading,
ElMessage,
ElTag,
} from 'element-plus';
import { ElCard, ElImage, ElLoading, ElMessage, ElTag } from 'element-plus';
import { TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
import {
@@ -44,36 +37,41 @@ async function getOrderSum() {
/** 核销订单 */
async function handlePickup(pickUpVerifyCode?: string) {
// 如果没有传核销码,则弹窗输入
// TODO @xingyu这个貌似不太行帮忙看看~
if (!pickUpVerifyCode) {
await prompt({
component: () => {
return h(ElInput, {});
},
content: '请输入核销码',
if (pickUpVerifyCode) {
// 执行核销
const loadingInstance = ElLoading.service({
text: '订单核销中 ...',
});
try {
await pickUpOrderByVerifyCode(pickUpVerifyCode);
ElMessage.success($t('ui.actionMessage.operationSuccess'));
handleRefresh();
} finally {
loadingInstance.close();
}
} else {
prompt<string>({
componentProps: { placeholder: '输入核销码' },
content: '输入核销码',
title: '核销订单',
modelPropName: 'value',
}).then(async (val) => {
if (val) {
pickUpVerifyCode = val;
icon: 'question',
overlayBlur: 3,
}).then(async (res) => {
if (res) {
// 执行核销
const loadingInstance = ElLoading.service({
text: '订单核销中 ...',
});
try {
await pickUpOrderByVerifyCode(res);
ElMessage.success($t('ui.actionMessage.operationSuccess'));
handleRefresh();
} finally {
loadingInstance.close();
}
}
});
}
if (!pickUpVerifyCode) {
return;
}
// 执行核销
const loadingInstance = ElLoading.service({
text: '订单核销中 ...',
});
try {
await pickUpOrderByVerifyCode(pickUpVerifyCode);
ElMessage.success($t('ui.actionMessage.operationSuccess'));
handleRefresh();
} finally {
loadingInstance.close();
}
}
const port = ref('');