feat:【mall 商城】交易订单(30% antd list 优化代码风格)
This commit is contained in:
@@ -4,13 +4,11 @@ import type { MallDeliveryPickUpStoreApi } from '#/api/mall/trade/delivery/pickU
|
||||
|
||||
import { ref } from 'vue';
|
||||
|
||||
import { DeliveryTypeEnum } from '@vben/constants';
|
||||
import { DeliveryTypeEnum, DICT_TYPE } from '@vben/constants';
|
||||
import { getDictOptions } from '@vben/hooks';
|
||||
|
||||
import { getSimpleDeliveryExpressList } from '#/api/mall/trade/delivery/express';
|
||||
import { getSimpleDeliveryPickUpStoreList } from '#/api/mall/trade/delivery/pickUpStore';
|
||||
import { DICT_TYPE } from '@vben/constants';
|
||||
import { getDictOptions } from '@vben/hooks';
|
||||
|
||||
import { getRangePickerDefaultProps } from '#/utils';
|
||||
|
||||
const pickUpStoreList = ref<MallDeliveryPickUpStoreApi.PickUpStore[]>([]);
|
||||
@@ -28,6 +26,8 @@ export function useGridFormSchema(): VbenFormSchema[] {
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
options: getDictOptions(DICT_TYPE.TRADE_ORDER_STATUS, 'number'),
|
||||
placeholder: '请选择订单状态',
|
||||
allowClear: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -36,13 +36,10 @@ export function useGridFormSchema(): VbenFormSchema[] {
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
options: getDictOptions(DICT_TYPE.PAY_CHANNEL_CODE, 'number'),
|
||||
placeholder: '请选择支付方式',
|
||||
allowClear: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'name',
|
||||
label: '品牌名称',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
fieldName: 'createTime',
|
||||
label: '创建时间',
|
||||
@@ -58,6 +55,8 @@ export function useGridFormSchema(): VbenFormSchema[] {
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
options: getDictOptions(DICT_TYPE.TERMINAL, 'number'),
|
||||
placeholder: '请选择订单来源',
|
||||
allowClear: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -66,6 +65,8 @@ export function useGridFormSchema(): VbenFormSchema[] {
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
options: getDictOptions(DICT_TYPE.TRADE_DELIVERY_TYPE, 'number'),
|
||||
placeholder: '请选择配送方式',
|
||||
allowClear: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -78,6 +79,8 @@ export function useGridFormSchema(): VbenFormSchema[] {
|
||||
label: 'name',
|
||||
value: 'id',
|
||||
},
|
||||
placeholder: '请选择快递公司',
|
||||
allowClear: true,
|
||||
},
|
||||
dependencies: {
|
||||
triggerFields: ['deliveryType'],
|
||||
@@ -94,6 +97,8 @@ export function useGridFormSchema(): VbenFormSchema[] {
|
||||
label: 'name',
|
||||
value: 'id',
|
||||
},
|
||||
placeholder: '请选择自提门店',
|
||||
allowClear: true,
|
||||
},
|
||||
dependencies: {
|
||||
triggerFields: ['deliveryType'],
|
||||
@@ -104,11 +109,51 @@ export function useGridFormSchema(): VbenFormSchema[] {
|
||||
fieldName: 'deliveryType',
|
||||
label: '核销码',
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
placeholder: '请输入核销码',
|
||||
allowClear: true,
|
||||
},
|
||||
dependencies: {
|
||||
triggerFields: ['deliveryType'],
|
||||
show: (values) => values.deliveryType === DeliveryTypeEnum.PICK_UP.type,
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'no',
|
||||
label: '订单号',
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
placeholder: '请输入订单号',
|
||||
allowClear: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'userId',
|
||||
label: '用户 UID',
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
placeholder: '请输入用户 UID',
|
||||
allowClear: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'userNickname',
|
||||
label: '用户昵称',
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
placeholder: '请输入用户昵称',
|
||||
allowClear: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'userMobile',
|
||||
label: '用户电话',
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
placeholder: '请输入用户电话',
|
||||
allowClear: true,
|
||||
},
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -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