mirror of
https://gitee.com/qqtt-ah/ecom-dmb.git
synced 2026-11-25 09:49:20 +08:00
refactor: 重构电商模块目录结构
This commit is contained in:
+352
@@ -0,0 +1,352 @@
|
||||
<script lang="ts" setup>
|
||||
import type { OrderDTO, OrderVO } from '#/api/ecommerce/order';
|
||||
import type { OrderStatusVO } from '#/api/ecommerce/order-status';
|
||||
import type { ShopVO } from '#/api/shop/shop/types';
|
||||
|
||||
import { ref } from 'vue';
|
||||
|
||||
import { useVbenModal } from '@vben/common-ui';
|
||||
|
||||
import {
|
||||
DatePicker,
|
||||
Form,
|
||||
Input,
|
||||
InputNumber,
|
||||
message,
|
||||
Select,
|
||||
} from 'ant-design-vue';
|
||||
import dayjs from 'dayjs';
|
||||
|
||||
import { createOrderApi, updateOrderApi } from '#/api/ecommerce/order';
|
||||
import { getActiveOrderStatusListApi } from '#/api/ecommerce/order-status';
|
||||
import { getShopPageApi } from '#/api/shop/shop';
|
||||
|
||||
const emit = defineEmits<{
|
||||
cancel: [];
|
||||
success: [];
|
||||
}>();
|
||||
|
||||
// 创建 vben modal
|
||||
const [Modal, modalApi] = useVbenModal({
|
||||
draggable: true,
|
||||
class: 'w-[600px]',
|
||||
onCancel() {
|
||||
close();
|
||||
},
|
||||
onConfirm() {
|
||||
handleSubmit();
|
||||
},
|
||||
});
|
||||
|
||||
// 响应式数据
|
||||
const loading = ref(false);
|
||||
const isEdit = ref(false);
|
||||
const currentRecord = ref<null | OrderVO.Info>(null);
|
||||
|
||||
// 表单数据
|
||||
const formData = ref<Partial<OrderDTO.Create>>({
|
||||
shopId: undefined,
|
||||
platformOrderNo: '',
|
||||
statusId: undefined,
|
||||
receivedAmount: 0,
|
||||
orderDate: dayjs().format('YYYY-MM-DD'),
|
||||
productId: undefined,
|
||||
productSpecId: undefined,
|
||||
productName: '',
|
||||
specName: '',
|
||||
quantity: 1,
|
||||
unitPrice: 0,
|
||||
costPrice: 0,
|
||||
});
|
||||
|
||||
// 下拉选项数据
|
||||
const shopOptions = ref<{ label: string; value: number }[]>([]);
|
||||
const orderStatusOptions = ref<{ label: string; value: number }[]>([]);
|
||||
|
||||
// 表单验证规则
|
||||
const rules = {
|
||||
shopId: [{ required: true, message: '请选择店铺', trigger: 'change' }],
|
||||
statusId: [{ required: true, message: '请选择订单状态', trigger: 'change' }],
|
||||
receivedAmount: [
|
||||
{ required: true, message: '请输入实收金额', trigger: 'blur' },
|
||||
],
|
||||
orderDate: [{ required: true, message: '请选择下单时间', trigger: 'change' }],
|
||||
productId: [{ required: true, message: '请输入商品ID', trigger: 'blur' }],
|
||||
productName: [{ required: true, message: '请输入商品名称', trigger: 'blur' }],
|
||||
quantity: [{ required: true, message: '请输入数量', trigger: 'blur' }],
|
||||
unitPrice: [{ required: true, message: '请输入销售单价', trigger: 'blur' }],
|
||||
costPrice: [{ required: true, message: '请输入成本价', trigger: 'blur' }],
|
||||
};
|
||||
|
||||
// 表单引用
|
||||
const formRef = ref();
|
||||
|
||||
// 获取店铺选项
|
||||
async function fetchShopOptions() {
|
||||
try {
|
||||
const params: any = {
|
||||
page: 1,
|
||||
pageSize: 1000,
|
||||
filters: {},
|
||||
};
|
||||
const data = await getShopPageApi(params);
|
||||
shopOptions.value = data.records.map((shop: ShopVO.Info) => ({
|
||||
label: shop.name,
|
||||
value: shop.id,
|
||||
}));
|
||||
} catch (error) {
|
||||
console.error('获取店铺列表失败:', error);
|
||||
}
|
||||
}
|
||||
|
||||
// 获取订单状态选项
|
||||
async function fetchOrderStatusOptions() {
|
||||
try {
|
||||
const data = await getActiveOrderStatusListApi();
|
||||
orderStatusOptions.value = data.map((status: OrderStatusVO.Info) => ({
|
||||
label: status.statusName,
|
||||
value: status.id,
|
||||
}));
|
||||
} catch (error) {
|
||||
console.error('获取订单状态列表失败:', error);
|
||||
}
|
||||
}
|
||||
|
||||
// 打开模态框
|
||||
function open(edit: boolean, record?: OrderVO.Info) {
|
||||
isEdit.value = edit;
|
||||
currentRecord.value = record || null;
|
||||
|
||||
// 加载下拉选项数据
|
||||
fetchShopOptions();
|
||||
fetchOrderStatusOptions();
|
||||
|
||||
modalApi.open();
|
||||
|
||||
// 根据模式填充表单数据
|
||||
formData.value =
|
||||
edit && record
|
||||
? {
|
||||
shopId: record.shopId,
|
||||
platformOrderNo: record.platformOrderNo || '',
|
||||
statusId: record.statusId,
|
||||
receivedAmount: record.receivedAmount,
|
||||
orderDate: record.orderDate
|
||||
? dayjs(record.orderDate).format('YYYY-MM-DD')
|
||||
: dayjs().format('YYYY-MM-DD'),
|
||||
productId: record.productId,
|
||||
productSpecId: record.productSpecId,
|
||||
productName: record.productName,
|
||||
specName: record.specName,
|
||||
quantity: record.quantity,
|
||||
unitPrice: record.unitPrice,
|
||||
costPrice: record.costPrice,
|
||||
}
|
||||
: {
|
||||
shopId: undefined,
|
||||
platformOrderNo: '',
|
||||
statusId: undefined,
|
||||
receivedAmount: 0,
|
||||
orderDate: dayjs().format('YYYY-MM-DD'),
|
||||
productId: undefined,
|
||||
productSpecId: undefined,
|
||||
productName: '',
|
||||
specName: '',
|
||||
quantity: 1,
|
||||
unitPrice: 0,
|
||||
costPrice: 0,
|
||||
};
|
||||
}
|
||||
|
||||
// 关闭模态框
|
||||
function close() {
|
||||
modalApi.close();
|
||||
formRef.value?.resetFields();
|
||||
emit('cancel');
|
||||
}
|
||||
|
||||
// 提交表单
|
||||
async function handleSubmit() {
|
||||
try {
|
||||
await formRef.value?.validate();
|
||||
loading.value = true;
|
||||
|
||||
if (isEdit.value && currentRecord.value) {
|
||||
// 更新订单
|
||||
const updateData: OrderDTO.Update = {
|
||||
shopId: formData.value.shopId!,
|
||||
platformOrderNo: formData.value.platformOrderNo,
|
||||
statusId: formData.value.statusId,
|
||||
receivedAmount: formData.value.receivedAmount!,
|
||||
orderDate: formData.value.orderDate!,
|
||||
productId: formData.value.productId,
|
||||
productSpecId: formData.value.productSpecId,
|
||||
productName: formData.value.productName,
|
||||
specName: formData.value.specName,
|
||||
quantity: formData.value.quantity,
|
||||
unitPrice: formData.value.unitPrice,
|
||||
costPrice: formData.value.costPrice,
|
||||
};
|
||||
await updateOrderApi(currentRecord.value.id, updateData);
|
||||
message.success('更新订单成功');
|
||||
} else {
|
||||
// 创建订单
|
||||
const createData: OrderDTO.Create = {
|
||||
shopId: formData.value.shopId!,
|
||||
platformOrderNo: formData.value.platformOrderNo,
|
||||
statusId: formData.value.statusId!,
|
||||
receivedAmount: formData.value.receivedAmount!,
|
||||
orderDate: formData.value.orderDate!,
|
||||
productId: formData.value.productId!,
|
||||
productSpecId: formData.value.productSpecId,
|
||||
productName: formData.value.productName!,
|
||||
specName: formData.value.specName,
|
||||
quantity: formData.value.quantity!,
|
||||
unitPrice: formData.value.unitPrice!,
|
||||
costPrice: formData.value.costPrice!,
|
||||
};
|
||||
await createOrderApi(createData);
|
||||
message.success('创建订单成功');
|
||||
}
|
||||
|
||||
emit('success');
|
||||
close();
|
||||
} catch (error) {
|
||||
console.error('提交订单失败:', error);
|
||||
message.error('提交订单失败');
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
// 暴露方法
|
||||
defineExpose({
|
||||
open,
|
||||
close,
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Modal :title="isEdit ? '编辑订单' : '添加订单'" :confirm-loading="loading">
|
||||
<Form
|
||||
ref="formRef"
|
||||
:model="formData"
|
||||
:rules="rules as any"
|
||||
layout="vertical"
|
||||
>
|
||||
<div class="grid grid-cols-2 gap-4">
|
||||
<Form.Item label="店铺" name="shopId">
|
||||
<Select
|
||||
v-model:value="formData.shopId"
|
||||
placeholder="请选择店铺"
|
||||
:options="shopOptions"
|
||||
/>
|
||||
</Form.Item>
|
||||
|
||||
<Form.Item label="订单状态" name="statusId">
|
||||
<Select
|
||||
v-model:value="formData.statusId"
|
||||
placeholder="请选择订单状态"
|
||||
:options="orderStatusOptions"
|
||||
/>
|
||||
</Form.Item>
|
||||
</div>
|
||||
|
||||
<div class="grid grid-cols-2 gap-4">
|
||||
<Form.Item label="平台订单号" name="platformOrderNo">
|
||||
<Input
|
||||
v-model:value="formData.platformOrderNo"
|
||||
placeholder="请输入平台订单号(可选)"
|
||||
/>
|
||||
</Form.Item>
|
||||
|
||||
<Form.Item label="下单时间" name="orderDate">
|
||||
<DatePicker
|
||||
v-model:value="formData.orderDate"
|
||||
placeholder="请选择下单时间"
|
||||
style="width: 100%"
|
||||
format="YYYY-MM-DD"
|
||||
value-format="YYYY-MM-DD"
|
||||
/>
|
||||
</Form.Item>
|
||||
</div>
|
||||
|
||||
<div class="grid grid-cols-2 gap-4">
|
||||
<Form.Item label="商品ID" name="productId">
|
||||
<InputNumber
|
||||
v-model:value="formData.productId"
|
||||
placeholder="请输入商品ID"
|
||||
style="width: 100%"
|
||||
:min="1"
|
||||
/>
|
||||
</Form.Item>
|
||||
|
||||
<Form.Item label="商品规格ID" name="productSpecId">
|
||||
<InputNumber
|
||||
v-model:value="formData.productSpecId"
|
||||
placeholder="请输入商品规格ID(可选)"
|
||||
style="width: 100%"
|
||||
:min="1"
|
||||
/>
|
||||
</Form.Item>
|
||||
</div>
|
||||
|
||||
<div class="grid grid-cols-2 gap-4">
|
||||
<Form.Item label="商品名称" name="productName">
|
||||
<Input
|
||||
v-model:value="formData.productName"
|
||||
placeholder="请输入商品名称"
|
||||
/>
|
||||
</Form.Item>
|
||||
|
||||
<Form.Item label="规格名称" name="specName">
|
||||
<Input
|
||||
v-model:value="formData.specName"
|
||||
placeholder="请输入规格名称(可选)"
|
||||
/>
|
||||
</Form.Item>
|
||||
</div>
|
||||
|
||||
<div class="grid grid-cols-3 gap-4">
|
||||
<Form.Item label="数量" name="quantity">
|
||||
<InputNumber
|
||||
v-model:value="formData.quantity"
|
||||
placeholder="请输入数量"
|
||||
style="width: 100%"
|
||||
:min="1"
|
||||
/>
|
||||
</Form.Item>
|
||||
|
||||
<Form.Item label="销售单价" name="unitPrice">
|
||||
<InputNumber
|
||||
v-model:value="formData.unitPrice"
|
||||
placeholder="请输入销售单价"
|
||||
style="width: 100%"
|
||||
:min="0"
|
||||
:precision="2"
|
||||
/>
|
||||
</Form.Item>
|
||||
|
||||
<Form.Item label="成本价" name="costPrice">
|
||||
<InputNumber
|
||||
v-model:value="formData.costPrice"
|
||||
placeholder="请输入成本价"
|
||||
style="width: 100%"
|
||||
:min="0"
|
||||
:precision="2"
|
||||
/>
|
||||
</Form.Item>
|
||||
</div>
|
||||
|
||||
<Form.Item label="实收金额" name="receivedAmount">
|
||||
<InputNumber
|
||||
v-model:value="formData.receivedAmount"
|
||||
placeholder="请输入实收金额"
|
||||
style="width: 100%"
|
||||
:min="0"
|
||||
:precision="2"
|
||||
/>
|
||||
</Form.Item>
|
||||
</Form>
|
||||
</Modal>
|
||||
</template>
|
||||
@@ -0,0 +1,361 @@
|
||||
<script lang="ts" setup>
|
||||
import type { VxeGridProps } from '#/adapter/vxe-table';
|
||||
import type { OrderDTO, OrderVO } from '#/api/ecommerce/order';
|
||||
import type { OrderStatusVO } from '#/api/ecommerce/order-status';
|
||||
import type { ShopVO } from '#/api/shop/shop/types';
|
||||
import type { PageQueryDTO } from '#/types/common';
|
||||
|
||||
import { computed, onMounted, ref } from 'vue';
|
||||
|
||||
import { Page } from '@vben/common-ui';
|
||||
import { createIconifyIcon } from '@vben/icons';
|
||||
|
||||
import { Button, message, Space, Tag } from 'ant-design-vue';
|
||||
|
||||
import { useVbenVxeGrid } from '#/adapter/vxe-table';
|
||||
import { deleteOrderApi, getOrderPageApi } from '#/api/ecommerce/order';
|
||||
import { getActiveOrderStatusListApi } from '#/api/ecommerce/order-status';
|
||||
import { getShopPageApi } from '#/api/shop/shop';
|
||||
|
||||
import OrderFormModal from './components/OrderFormModal.vue';
|
||||
|
||||
defineOptions({ name: 'OrderManagement' });
|
||||
// 创建图标组件
|
||||
const PlusIcon = createIconifyIcon('lucide:plus');
|
||||
const UploadIcon = createIconifyIcon('lucide:upload');
|
||||
|
||||
// 响应式数据
|
||||
const loading = ref(false);
|
||||
const orderFormModalRef = ref();
|
||||
|
||||
// 下拉选项数据
|
||||
const shopOptions = ref<{ label: string; value: number }[]>([]);
|
||||
const orderStatusOptions = ref<{ label: string; value: number }[]>([]);
|
||||
|
||||
// 搜索表单
|
||||
const searchForm = ref({
|
||||
platformOrderNo: '',
|
||||
shopId: undefined as number | undefined,
|
||||
statusId: undefined as number | undefined,
|
||||
});
|
||||
|
||||
// VbenVxeGrid 表格配置
|
||||
const gridOptions: VxeGridProps<any> = {
|
||||
columns: [
|
||||
{
|
||||
type: 'seq' as const,
|
||||
minWidth: 'auto',
|
||||
title: '序号',
|
||||
},
|
||||
{
|
||||
field: 'platformOrderNo',
|
||||
title: '平台订单号',
|
||||
minWidth: 'auto',
|
||||
showOverflow: 'tooltip' as const,
|
||||
},
|
||||
{
|
||||
field: 'shopName',
|
||||
title: '店铺名称',
|
||||
minWidth: 'auto',
|
||||
showOverflow: 'tooltip' as const,
|
||||
},
|
||||
{
|
||||
title: '商品信息',
|
||||
minWidth: 'auto',
|
||||
slots: { default: 'productInfo' },
|
||||
},
|
||||
{
|
||||
title: '数量',
|
||||
minWidth: 'auto',
|
||||
slots: { default: 'quantity' },
|
||||
},
|
||||
{
|
||||
title: '实收金额',
|
||||
minWidth: 'auto',
|
||||
slots: { default: 'receivedAmount' },
|
||||
},
|
||||
{
|
||||
title: '订单状态',
|
||||
minWidth: 'auto',
|
||||
slots: { default: 'orderStatus' },
|
||||
},
|
||||
{
|
||||
field: 'orderDate',
|
||||
title: '下单时间',
|
||||
minWidth: 'auto',
|
||||
},
|
||||
{
|
||||
field: 'createTime',
|
||||
title: '创建时间',
|
||||
minWidth: 'auto',
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
minWidth: 'auto',
|
||||
fixed: 'right' as const,
|
||||
slots: { default: 'action' },
|
||||
},
|
||||
],
|
||||
height: 'auto',
|
||||
border: true,
|
||||
stripe: true,
|
||||
highlightHoverRow: true,
|
||||
showOverflow: true,
|
||||
size: 'small',
|
||||
toolbarConfig: {
|
||||
custom: true,
|
||||
refresh: true,
|
||||
zoom: true,
|
||||
},
|
||||
data: [],
|
||||
pagerConfig: {
|
||||
enabled: true,
|
||||
pageSizes: [10, 20, 50, 100],
|
||||
layouts: [
|
||||
'PrevJump',
|
||||
'PrevPage',
|
||||
'Number',
|
||||
'NextPage',
|
||||
'NextJump',
|
||||
'Sizes',
|
||||
'FullJump',
|
||||
'Total',
|
||||
] as (
|
||||
| 'FullJump'
|
||||
| 'NextJump'
|
||||
| 'NextPage'
|
||||
| 'Number'
|
||||
| 'PrevJump'
|
||||
| 'PrevPage'
|
||||
| 'Sizes'
|
||||
| 'Total'
|
||||
)[],
|
||||
},
|
||||
// 配置远程加载
|
||||
proxyConfig: {
|
||||
ajax: {
|
||||
query: async ({ page }) => {
|
||||
try {
|
||||
loading.value = true;
|
||||
const params: PageQueryDTO<OrderDTO.Filters> = {
|
||||
page: page.currentPage,
|
||||
pageSize: page.pageSize,
|
||||
filters: {
|
||||
platformOrderNo: searchForm.value.platformOrderNo || undefined,
|
||||
shopId: searchForm.value.shopId,
|
||||
statusId: searchForm.value.statusId,
|
||||
},
|
||||
};
|
||||
const data = await getOrderPageApi(params);
|
||||
return {
|
||||
items: data.records,
|
||||
total: data.total,
|
||||
};
|
||||
} catch (error) {
|
||||
console.error('获取订单列表失败:', error);
|
||||
message.error('获取订单列表失败');
|
||||
return {
|
||||
items: [],
|
||||
total: 0,
|
||||
};
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
// 搜索表单配置
|
||||
const formOptions = computed(() => ({
|
||||
schema: [
|
||||
{
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
placeholder: '请输入平台订单号',
|
||||
},
|
||||
fieldName: 'platformOrderNo',
|
||||
label: '平台订单号',
|
||||
},
|
||||
{
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
placeholder: '请选择店铺',
|
||||
options: shopOptions.value,
|
||||
allowClear: true,
|
||||
},
|
||||
fieldName: 'shopId',
|
||||
label: '店铺',
|
||||
},
|
||||
{
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
placeholder: '请选择状态',
|
||||
options: orderStatusOptions.value,
|
||||
allowClear: true,
|
||||
},
|
||||
fieldName: 'statusId',
|
||||
label: '订单状态',
|
||||
},
|
||||
],
|
||||
showDefaultActions: true,
|
||||
collapsed: true,
|
||||
collapsedRows: 1,
|
||||
}));
|
||||
|
||||
// 刷新表格数据
|
||||
function refreshTable() {
|
||||
if (gridApi) {
|
||||
gridApi.reload();
|
||||
}
|
||||
}
|
||||
|
||||
// 获取店铺选项
|
||||
async function fetchShopOptions() {
|
||||
try {
|
||||
const params: PageQueryDTO<any> = {
|
||||
page: 1,
|
||||
pageSize: 1000, // 获取所有店铺
|
||||
filters: {},
|
||||
};
|
||||
const data = await getShopPageApi(params);
|
||||
shopOptions.value = data.records.map((shop: ShopVO.Info) => ({
|
||||
label: shop.name,
|
||||
value: shop.id,
|
||||
}));
|
||||
} catch (error) {
|
||||
console.error('获取店铺列表失败:', error);
|
||||
}
|
||||
}
|
||||
|
||||
// 获取订单状态选项
|
||||
async function fetchOrderStatusOptions() {
|
||||
try {
|
||||
const data = await getActiveOrderStatusListApi();
|
||||
orderStatusOptions.value = data.map((status: OrderStatusVO.Info) => ({
|
||||
label: status.statusName,
|
||||
value: status.id,
|
||||
}));
|
||||
} catch (error) {
|
||||
console.error('获取订单状态列表失败:', error);
|
||||
}
|
||||
}
|
||||
|
||||
// 创建 VbenVxeGrid 实例
|
||||
const [Grid, gridApi] = useVbenVxeGrid({
|
||||
gridOptions,
|
||||
formOptions: formOptions.value,
|
||||
showSearchForm: true,
|
||||
tableTitle: '订单管理',
|
||||
});
|
||||
|
||||
// 处理添加订单
|
||||
function handleAdd() {
|
||||
orderFormModalRef.value?.open(false);
|
||||
}
|
||||
|
||||
// 处理编辑订单
|
||||
function handleEdit(record: OrderVO.Info) {
|
||||
orderFormModalRef.value?.open(true, record);
|
||||
}
|
||||
|
||||
// 处理删除订单
|
||||
async function handleDelete(record: OrderVO.Info) {
|
||||
try {
|
||||
await deleteOrderApi(record.id);
|
||||
message.success('删除成功');
|
||||
refreshTable();
|
||||
} catch (error) {
|
||||
console.error('删除订单失败:', error);
|
||||
message.error('删除订单失败');
|
||||
}
|
||||
}
|
||||
|
||||
// 处理批量导入
|
||||
function handleBatchImport() {
|
||||
// 跳转到数据导入页面
|
||||
window.open('/data-import', '_blank');
|
||||
}
|
||||
|
||||
// 处理模态框成功
|
||||
function handleModalSuccess() {
|
||||
refreshTable();
|
||||
}
|
||||
|
||||
// 初始化
|
||||
onMounted(async () => {
|
||||
await Promise.all([fetchShopOptions(), fetchOrderStatusOptions()]);
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Page title="订单管理" auto-content-height>
|
||||
<template #description>
|
||||
<div class="text-foreground/80 mt-2">
|
||||
管理电商订单信息,包括订单创建、编辑、删除和状态管理
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<!-- VbenVxeGrid 表格 -->
|
||||
<Grid :loading="loading">
|
||||
<!-- 工具栏工具 -->
|
||||
<template #toolbar-tools>
|
||||
<Space>
|
||||
<Button @click="handleBatchImport">
|
||||
<UploadIcon />
|
||||
批量导入
|
||||
</Button>
|
||||
<Button type="primary" @click="handleAdd">
|
||||
<PlusIcon />
|
||||
添加订单
|
||||
</Button>
|
||||
</Space>
|
||||
</template>
|
||||
|
||||
<!-- 商品信息列 -->
|
||||
<template #productInfo="{ row }: { row: any }">
|
||||
<div v-if="row.productName">
|
||||
<div style="font-weight: bold">{{ row.productName }}</div>
|
||||
<div v-if="row.specName" style="color: #666; font-size: 12px">
|
||||
{{ row.specName }}
|
||||
</div>
|
||||
</div>
|
||||
<span v-else style="color: #999">暂无商品信息</span>
|
||||
</template>
|
||||
|
||||
<!-- 数量列 -->
|
||||
<template #quantity="{ row }: { row: any }">
|
||||
{{ row.quantity || 0 }}
|
||||
</template>
|
||||
|
||||
<!-- 实收金额列 -->
|
||||
<template #receivedAmount="{ row }: { row: any }">
|
||||
<span style="color: #52c41a; font-weight: bold">
|
||||
¥{{ (row.receivedAmount || 0).toFixed(2) }}
|
||||
</span>
|
||||
</template>
|
||||
|
||||
<!-- 订单状态列 -->
|
||||
<template #orderStatus="{ row }: { row: any }">
|
||||
<Tag color="blue">
|
||||
{{
|
||||
orderStatusOptions.find((s) => s.value === row.statusId)?.label ||
|
||||
row.statusName ||
|
||||
'未知状态'
|
||||
}}
|
||||
</Tag>
|
||||
</template>
|
||||
|
||||
<!-- 操作列 -->
|
||||
<template #action="{ row }: { row: any }">
|
||||
<Space>
|
||||
<Button size="small" @click="handleEdit(row)"> 编辑 </Button>
|
||||
<Button size="small" danger @click="handleDelete(row)"> 删除 </Button>
|
||||
</Space>
|
||||
</template>
|
||||
</Grid>
|
||||
|
||||
<!-- 订单表单模态框 -->
|
||||
<OrderFormModal ref="orderFormModalRef" @success="handleModalSuccess" />
|
||||
</Page>
|
||||
</template>
|
||||
Reference in New Issue
Block a user