This commit is contained in:
xingyu4j
2025-11-02 12:17:35 +08:00
11 changed files with 280 additions and 285 deletions

View File

@@ -117,7 +117,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
<Tag
color="blue"
v-for="property in item.properties"
:key="property.id"
:key="property.propertyId"
>
{{ property.propertyName }} : {{ property.valueName }}
</Tag>

View File

@@ -20,6 +20,7 @@ import AddressList from './modules/address-list.vue';
import BalanceList from './modules/balance-list.vue';
import BasicInfo from './modules/basic-info.vue';
import ExperienceRecordList from './modules/experience-record-list.vue';
import OrderList from './modules/order-list.vue';
import PointList from './modules/point-list.vue';
import SignList from './modules/sign-list.vue';
@@ -100,10 +101,7 @@ onMounted(async () => {
<AddressList class="h-full" :user-id="userId" />
</TabPane>
<TabPane tab="订单管理" key="OrderList">
<!-- Todo: 商城模块 -->
<div class="h-full">
<h1>订单管理</h1>
</div>
<OrderList class="h-full" :user-id="userId" />
</TabPane>
<TabPane tab="售后管理" key="AfterSaleList">
<!-- Todo: 商城模块 -->

View File

@@ -8,7 +8,7 @@ import { Card } from 'ant-design-vue';
import { useDescription } from '#/components/description';
withDefaults(
const props = withDefaults(
defineProps<{
mode?: 'kefu' | 'member';
user: MemberUserApi.User;
@@ -20,6 +20,8 @@ withDefaults(
);
const [Descriptions] = useDescription({
bordered: false,
column: props.mode === 'member' ? 2 : 1,
schema: [
{
field: 'levelName',

View File

@@ -11,7 +11,7 @@ import { Avatar, Card, Col, Row } from 'ant-design-vue';
import { useDescription } from '#/components/description';
import { DictTag } from '#/components/dict-tag';
withDefaults(
const props = withDefaults(
defineProps<{ mode?: 'kefu' | 'member'; user: MemberUserApi.User }>(),
{
mode: 'member',
@@ -19,6 +19,8 @@ withDefaults(
);
const [Descriptions] = useDescription({
bordered: false,
column: props.mode === 'member' ? 2 : 1,
schema: [
{
field: 'name',
@@ -35,10 +37,10 @@ const [Descriptions] = useDescription({
{
field: 'sex',
label: '性别',
content: (data) =>
render: (val) =>
h(DictTag, {
type: DICT_TYPE.SYSTEM_USER_SEX,
value: data.sex,
value: val,
}),
},
{
@@ -52,17 +54,17 @@ const [Descriptions] = useDescription({
{
field: 'birthday',
label: '生日',
content: (data) => formatDate(data.birthday)?.toString() || '-',
render: (val) => formatDate(val)?.toString() || '-',
},
{
field: 'createTime',
label: '注册时间',
content: (data) => formatDate(data.createTime)?.toString() || '-',
render: (val) => formatDate(val)?.toString() || '-',
},
{
field: 'loginDate',
label: '最后登录时间',
content: (data) => formatDate(data.loginDate)?.toString() || '-',
render: (val) => formatDate(val)?.toString() || '-',
},
],
});

View File

@@ -0,0 +1,128 @@
<script lang="ts" setup>
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
import type { MallOrderApi } from '#/api/mall/trade/order';
import { useRouter } from 'vue-router';
import { DICT_TYPE } from '@vben/constants';
import { fenToYuan } from '@vben/utils';
import { Image, List, Tag } from 'ant-design-vue';
import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
import { getOrderPage } from '#/api/mall/trade/order';
import { DictTag } from '#/components/dict-tag';
import { $t } from '#/locales';
import {
useGridColumns,
useGridFormSchema as useOrderGridFormSchema,
} from '#/views/mall/trade/order/data';
const props = defineProps<{
userId: number;
}>();
const { push } = useRouter();
/** 列表的搜索表单(过滤掉用户相关字段) */
function useGridFormSchema() {
const excludeFields = new Set(['userId', 'userNickname']);
return useOrderGridFormSchema().filter(
(item) => !excludeFields.has(item.fieldName),
);
}
/** 详情 */
function handleDetail(row: MallOrderApi.Order) {
push({ name: 'TradeOrderDetail', params: { id: row.id } });
}
const [Grid] = useVbenVxeGrid({
formOptions: {
schema: useGridFormSchema(),
},
gridOptions: {
expandConfig: {
trigger: 'row',
expandAll: true,
padding: true,
},
columns: useGridColumns(),
keepSource: true,
pagerConfig: {
pageSize: 10,
},
proxyConfig: {
ajax: {
query: async ({ page }, formValues) => {
return await getOrderPage({
pageNo: page.currentPage,
pageSize: page.pageSize,
userId: props.userId,
...formValues,
});
},
},
},
rowConfig: {
keyField: 'id',
isHover: true,
},
toolbarConfig: {
refresh: true,
search: true,
},
} as VxeTableGridOptions<MallOrderApi.Order>,
});
</script>
<template>
<Grid table-title="订单列表">
<template #expand_content="{ row }">
<List item-layout="vertical" :data-source="row.items">
<template #renderItem="{ item }">
<List.Item>
<List.Item.Meta>
<template #title>
{{ item.spuName }}
<Tag
color="blue"
v-for="property in item.properties"
:key="property.propertyId"
>
{{ property.propertyName }} : {{ property.valueName }}
</Tag>
</template>
<template #avatar>
<Image :src="item.picUrl" :width="40" :height="40" />
</template>
<template #description>
{{
`原价:${fenToYuan(item.price)} 元 / 数量:${item.count}`
}}
|
<DictTag
:type="DICT_TYPE.TRADE_ORDER_ITEM_AFTER_SALE_STATUS"
:value="item.afterSaleStatus"
/>
</template>
</List.Item.Meta>
</List.Item>
</template>
</List>
</template>
<template #actions="{ row }">
<TableAction
:actions="[
{
label: $t('common.detail'),
type: 'link',
icon: ACTION_ICON.VIEW,
auth: ['trade:order:query'],
onClick: handleDetail.bind(null, row),
},
]"
/>
</template>
</Grid>
</template>