From a101cdf2f8b9e5783963448b8dd8258040b6ac9c Mon Sep 17 00:00:00 2001 From: YunaiV Date: Wed, 15 Oct 2025 09:12:51 +0800 Subject: [PATCH] =?UTF-8?q?feat=EF=BC=9A=E3=80=90mall=20=E5=95=86=E5=9F=8E?= =?UTF-8?q?=E3=80=91=E4=BA=A4=E6=98=93=E8=AE=A2=E5=8D=95=EF=BC=8830%=20ant?= =?UTF-8?q?d=20remark=20=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81=E9=A3=8E?= =?UTF-8?q?=E6=A0=BC=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/views/mall/trade/order/data.ts | 23 +++++++++ .../views/mall/trade/order/detail/index.vue | 10 ++-- .../src/views/mall/trade/order/index.vue | 50 +++++++++++++++++-- ...update-remark-form.vue => remark-form.vue} | 30 +++-------- 4 files changed, 79 insertions(+), 34 deletions(-) rename apps/web-antd/src/views/mall/trade/order/modules/{update-remark-form.vue => remark-form.vue} (74%) diff --git a/apps/web-antd/src/views/mall/trade/order/data.ts b/apps/web-antd/src/views/mall/trade/order/data.ts index 77e4c9e12..aa1e1dfc1 100644 --- a/apps/web-antd/src/views/mall/trade/order/data.ts +++ b/apps/web-antd/src/views/mall/trade/order/data.ts @@ -261,3 +261,26 @@ export function useGridColumns(): VxeGridPropTypes.Columns { }, ]; } + +/** 订单备注表单配置 */ +export function useRemarkFormSchema(): VbenFormSchema[] { + return [ + { + component: 'Input', + fieldName: 'id', + dependencies: { + triggerFields: [''], + show: () => false, + }, + }, + { + fieldName: 'remark', + label: '备注', + component: 'Input', + componentProps: { + type: 'textarea', + rows: 3, + }, + }, + ]; +} diff --git a/apps/web-antd/src/views/mall/trade/order/detail/index.vue b/apps/web-antd/src/views/mall/trade/order/detail/index.vue index e3c6c0b0d..634655c23 100644 --- a/apps/web-antd/src/views/mall/trade/order/detail/index.vue +++ b/apps/web-antd/src/views/mall/trade/order/detail/index.vue @@ -25,10 +25,10 @@ import { useDescription } from '#/components/description'; import { DictTag } from '#/components/dict-tag'; import { TableAction } from '#/components/table-action'; -import DeliveryForm from '../modules/delevery-form.vue'; +import DeliveryForm from '../modules/delivery-form.vue'; +import RemarkForm from '../modules/remark-form.vue'; import OrderUpdateAddressForm from '../modules/update-address-form.vue'; import OrderUpdatePriceForm from '../modules/update-price-form.vue'; -import OrderUpdateRemarkForm from '../modules/update-remark-form.vue'; import { useDeliveryInfoSchema, useExpressTrackColumns, @@ -146,8 +146,8 @@ const [DeliveryFormModal, deliveryFormModalApi] = useVbenModal({ destroyOnClose: true, }); -const [OrderUpdateRemarkFormModal, remarkFormModalApi] = useVbenModal({ - connectedComponent: OrderUpdateRemarkForm, +const [RemarkFormModal, remarkFormModalApi] = useVbenModal({ + connectedComponent: RemarkForm, destroyOnClose: true, }); @@ -298,7 +298,7 @@ onMounted(async () => { - + diff --git a/apps/web-antd/src/views/mall/trade/order/index.vue b/apps/web-antd/src/views/mall/trade/order/index.vue index 399500b35..4661182a1 100644 --- a/apps/web-antd/src/views/mall/trade/order/index.vue +++ b/apps/web-antd/src/views/mall/trade/order/index.vue @@ -2,6 +2,7 @@ import type { VxeTableGridOptions } from '#/adapter/vxe-table'; import type { MallOrderApi } from '#/api/mall/trade/order'; +import { ref } from 'vue'; import { useRouter } from 'vue-router'; import { DocAlert, Page, useVbenModal } from '@vben/common-ui'; @@ -21,7 +22,7 @@ import { $t } from '#/locales'; import { useGridColumns, useGridFormSchema } from './data'; import DeliveryForm from './modules/delivery-form.vue'; -import UpdateRemarkForm from './modules/update-remark-form.vue'; +import RemarkForm from './modules/remark-form.vue'; const { push } = useRouter(); @@ -30,8 +31,8 @@ const [DeliveryFormModal, deliveryFormModalApi] = useVbenModal({ destroyOnClose: true, }); -const [UpdateRemarkFormModal, updateRemarkFormModalApi] = useVbenModal({ - connectedComponent: UpdateRemarkForm, +const [RemarkFormModal, remarkFormModalApi] = useVbenModal({ + connectedComponent: RemarkForm, destroyOnClose: true, }); @@ -52,7 +53,35 @@ function handleDelivery(row: MallOrderApi.Order) { /** 备注 */ function handleRemark(row: MallOrderApi.Order) { - updateRemarkFormModalApi.setData(row).open(); + remarkOrderId.value = row.id; + 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({ @@ -105,7 +134,18 @@ const [Grid, gridApi] = useVbenVxeGrid({ - + + + + +