feat:【mall 商城】交易订单(30% antd list 优化代码风格)
This commit is contained in:
@@ -2,10 +2,9 @@
|
||||
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
|
||||
import type { MallOrderApi } from '#/api/mall/trade/order';
|
||||
|
||||
import { h } from 'vue';
|
||||
import { useRouter } from 'vue-router';
|
||||
|
||||
import { DocAlert, Page, prompt, useVbenModal } from '@vben/common-ui';
|
||||
import { DocAlert, Page, useVbenModal } from '@vben/common-ui';
|
||||
import {
|
||||
DeliveryTypeEnum,
|
||||
DICT_TYPE,
|
||||
@@ -13,20 +12,26 @@ import {
|
||||
} from '@vben/constants';
|
||||
import { fenToYuan } from '@vben/utils';
|
||||
|
||||
import { Image, List, Tag, Textarea } from 'ant-design-vue';
|
||||
import { Image, List, Tag } from 'ant-design-vue';
|
||||
|
||||
import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
|
||||
import { getOrderPage, updateOrderRemark } from '#/api/mall/trade/order';
|
||||
import { getOrderPage } from '#/api/mall/trade/order';
|
||||
import { DictTag } from '#/components/dict-tag';
|
||||
import { $t } from '#/locales';
|
||||
|
||||
import { useGridColumns, useGridFormSchema } from './data';
|
||||
import DeleveryForm from './modules/delevery-form.vue';
|
||||
import DeliveryForm from './modules/delivery-form.vue';
|
||||
import UpdateRemarkForm from './modules/update-remark-form.vue';
|
||||
|
||||
const { push } = useRouter();
|
||||
|
||||
const [DeleveryFormModal, deleveryFormModalApi] = useVbenModal({
|
||||
connectedComponent: DeleveryForm,
|
||||
const [DeliveryFormModal, deliveryFormModalApi] = useVbenModal({
|
||||
connectedComponent: DeliveryForm,
|
||||
destroyOnClose: true,
|
||||
});
|
||||
|
||||
const [UpdateRemarkFormModal, updateRemarkFormModalApi] = useVbenModal({
|
||||
connectedComponent: UpdateRemarkForm,
|
||||
destroyOnClose: true,
|
||||
});
|
||||
|
||||
@@ -42,30 +47,12 @@ function handleDetail(row: MallOrderApi.Order) {
|
||||
|
||||
/** 发货 */
|
||||
function handleDelivery(row: MallOrderApi.Order) {
|
||||
deleveryFormModalApi.setData(row).open();
|
||||
deliveryFormModalApi.setData(row).open();
|
||||
}
|
||||
|
||||
/** 备注 */
|
||||
function handleRemake(row: MallOrderApi.Order) {
|
||||
prompt({
|
||||
component: () => {
|
||||
return h(Textarea, {
|
||||
defaultValue: row.remark,
|
||||
rows: 3,
|
||||
});
|
||||
},
|
||||
content: '请输入订单备注',
|
||||
title: '订单备注',
|
||||
modelPropName: 'value',
|
||||
}).then(async (val) => {
|
||||
if (val) {
|
||||
await updateOrderRemark({
|
||||
id: row.id as number,
|
||||
remark: val,
|
||||
});
|
||||
handleRefresh();
|
||||
}
|
||||
});
|
||||
function handleRemark(row: MallOrderApi.Order) {
|
||||
updateRemarkFormModalApi.setData(row).open();
|
||||
}
|
||||
|
||||
const [Grid, gridApi] = useVbenVxeGrid({
|
||||
@@ -94,6 +81,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
||||
},
|
||||
rowConfig: {
|
||||
keyField: 'id',
|
||||
isHover: true,
|
||||
},
|
||||
toolbarConfig: {
|
||||
refresh: true,
|
||||
@@ -115,7 +103,9 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
||||
url="https://doc.iocoder.cn/mall/trade-cart/"
|
||||
/>
|
||||
</template>
|
||||
<DeleveryFormModal @success="handleRefresh" />
|
||||
|
||||
<DeliveryFormModal @success="handleRefresh" />
|
||||
<UpdateRemarkFormModal @success="handleRefresh" />
|
||||
<Grid table-title="订单列表">
|
||||
<template #expand_content="{ row }">
|
||||
<List item-layout="vertical" :data-source="row.items">
|
||||
@@ -173,7 +163,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
||||
{
|
||||
label: '备注',
|
||||
type: 'link',
|
||||
onClick: handleRemake.bind(null, row),
|
||||
onClick: handleRemark.bind(null, row),
|
||||
},
|
||||
]"
|
||||
/>
|
||||
|
||||
Reference in New Issue
Block a user