feat:【mall 商城】交易订单(30% antd remark 优化代码风格)
This commit is contained in:
@@ -2,7 +2,6 @@
|
|||||||
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
|
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
|
||||||
import type { MallOrderApi } from '#/api/mall/trade/order';
|
import type { MallOrderApi } from '#/api/mall/trade/order';
|
||||||
|
|
||||||
import { ref } from 'vue';
|
|
||||||
import { useRouter } from 'vue-router';
|
import { useRouter } from 'vue-router';
|
||||||
|
|
||||||
import { DocAlert, Page, useVbenModal } from '@vben/common-ui';
|
import { DocAlert, Page, useVbenModal } from '@vben/common-ui';
|
||||||
@@ -53,35 +52,7 @@ function handleDelivery(row: MallOrderApi.Order) {
|
|||||||
|
|
||||||
/** 备注 */
|
/** 备注 */
|
||||||
function handleRemark(row: MallOrderApi.Order) {
|
function handleRemark(row: MallOrderApi.Order) {
|
||||||
remarkOrderId.value = row.id;
|
remarkFormModalApi.setData(row).open();
|
||||||
remarkFormVisible.value = true;
|
|
||||||
remarkFormApi.setValues(row);
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 提交备注 */
|
|
||||||
async function handleRemarkSubmit() {
|
|
||||||
const { valid } = await remarkFormApi.validate();
|
|
||||||
if (!valid) return;
|
|
||||||
|
|
||||||
remarkFormLoading.value = true;
|
|
||||||
try {
|
|
||||||
const data =
|
|
||||||
(await remarkFormApi.getValues()) as MallOrderApi.RemarkRequest;
|
|
||||||
await updateOrderRemark(data);
|
|
||||||
message.success($t('ui.actionMessage.operationSuccess'));
|
|
||||||
remarkFormVisible.value = false;
|
|
||||||
handleRefresh();
|
|
||||||
} catch (error) {
|
|
||||||
console.error('更新订单备注失败:', error);
|
|
||||||
} finally {
|
|
||||||
remarkFormLoading.value = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 取消备注 */
|
|
||||||
function handleRemarkCancel() {
|
|
||||||
remarkFormVisible.value = false;
|
|
||||||
remarkOrderId.value = undefined;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const [Grid, gridApi] = useVbenVxeGrid({
|
const [Grid, gridApi] = useVbenVxeGrid({
|
||||||
@@ -134,18 +105,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<DeliveryFormModal @success="handleRefresh" />
|
<DeliveryFormModal @success="handleRefresh" />
|
||||||
|
<RemarkFormModal @success="handleRefresh" />
|
||||||
<!-- 订单备注弹窗 -->
|
|
||||||
<Modal
|
|
||||||
v-model:open="remarkFormVisible"
|
|
||||||
title="订单备注"
|
|
||||||
:confirm-loading="remarkFormLoading"
|
|
||||||
@ok="handleRemarkSubmit"
|
|
||||||
@cancel="handleRemarkCancel"
|
|
||||||
width="33.33%"
|
|
||||||
>
|
|
||||||
<RemarkForm class="mx-4" />
|
|
||||||
</Modal>
|
|
||||||
<Grid table-title="订单列表">
|
<Grid table-title="订单列表">
|
||||||
<template #expand_content="{ row }">
|
<template #expand_content="{ row }">
|
||||||
<List item-layout="vertical" :data-source="row.items">
|
<List item-layout="vertical" :data-source="row.items">
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ const [OrderDeliveryFormModal, formModalApi] = useVbenModal({
|
|||||||
destroyOnClose: true,
|
destroyOnClose: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
const [OrderUpdateRemarkFormModal, remarkFormModalApi] = useVbenModal({
|
const [RemarkFormModal, remarkFormModalApi] = useVbenModal({
|
||||||
connectedComponent: OrderUpdateRemarkForm,
|
connectedComponent: OrderUpdateRemarkForm,
|
||||||
destroyOnClose: true,
|
destroyOnClose: true,
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user