review:【antd】【ele】member 增加 after-sale-list 列表
This commit is contained in:
@@ -131,7 +131,6 @@ export function useGridColumns(): VxeGridPropTypes.Columns {
|
||||
{
|
||||
field: 'user.nickname',
|
||||
title: '买家',
|
||||
align: 'center',
|
||||
minWidth: 120,
|
||||
},
|
||||
{
|
||||
@@ -144,11 +143,10 @@ export function useGridColumns(): VxeGridPropTypes.Columns {
|
||||
field: 'status',
|
||||
title: '售后状态',
|
||||
width: 100,
|
||||
align: 'center',
|
||||
cellRender: {
|
||||
name: 'CellDict',
|
||||
props: {
|
||||
dictType: DICT_TYPE.TRADE_AFTER_SALE_STATUS,
|
||||
type: DICT_TYPE.TRADE_AFTER_SALE_STATUS,
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -156,11 +154,10 @@ export function useGridColumns(): VxeGridPropTypes.Columns {
|
||||
field: 'way',
|
||||
title: '售后方式',
|
||||
width: 100,
|
||||
align: 'center',
|
||||
cellRender: {
|
||||
name: 'CellDict',
|
||||
props: {
|
||||
dictType: DICT_TYPE.TRADE_AFTER_SALE_WAY,
|
||||
type: DICT_TYPE.TRADE_AFTER_SALE_WAY,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
@@ -17,6 +17,7 @@ import { $t } from '#/locales';
|
||||
import Form from '../modules/form.vue';
|
||||
import AccountInfo from './modules/account-info.vue';
|
||||
import AddressList from './modules/address-list.vue';
|
||||
import AfterSaleList from './modules/after-sale-list.vue';
|
||||
import BalanceList from './modules/balance-list.vue';
|
||||
import BasicInfo from './modules/basic-info.vue';
|
||||
import ExperienceRecordList from './modules/experience-record-list.vue';
|
||||
@@ -104,10 +105,7 @@ onMounted(async () => {
|
||||
<OrderList class="h-full" :user-id="userId" />
|
||||
</TabPane>
|
||||
<TabPane tab="售后管理" key="AfterSaleList">
|
||||
<!-- Todo: 商城模块 -->
|
||||
<div class="h-full">
|
||||
<h1>售后管理</h1>
|
||||
</div>
|
||||
<AfterSaleList class="h-full" :user-id="userId" />
|
||||
</TabPane>
|
||||
<TabPane tab="收藏记录" key="FavoriteList">
|
||||
<!-- Todo: 商城模块 -->
|
||||
|
||||
@@ -0,0 +1,155 @@
|
||||
<script lang="ts" setup>
|
||||
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
|
||||
import type { MallAfterSaleApi } from '#/api/mall/trade/afterSale';
|
||||
|
||||
import { onMounted, ref } from 'vue';
|
||||
import { useRouter } from 'vue-router';
|
||||
|
||||
import { DICT_TYPE } from '@vben/constants';
|
||||
import { getDictOptions } from '@vben/hooks';
|
||||
|
||||
import { Button, Image, Tabs, Tag } from 'ant-design-vue';
|
||||
|
||||
import { TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
|
||||
import { getAfterSalePage } from '#/api/mall/trade/afterSale';
|
||||
import {
|
||||
useGridColumns,
|
||||
useGridFormSchema,
|
||||
} from '#/views/mall/trade/afterSale/data';
|
||||
|
||||
const props = defineProps<{
|
||||
userId: number;
|
||||
}>();
|
||||
|
||||
const { push } = useRouter();
|
||||
|
||||
const statusTabs = ref([
|
||||
{
|
||||
label: '全部',
|
||||
value: '0',
|
||||
},
|
||||
]);
|
||||
const statusTab = ref(statusTabs.value[0]!.value);
|
||||
|
||||
/** 处理退款 */
|
||||
function handleOpenAfterSaleDetail(row: MallAfterSaleApi.AfterSale) {
|
||||
push({ name: 'TradeAfterSaleDetail', params: { id: row.id } });
|
||||
}
|
||||
|
||||
/** 查看订单详情 */
|
||||
function handleOpenOrderDetail(row: MallAfterSaleApi.AfterSale) {
|
||||
push({ name: 'TradeOrderDetail', params: { id: row.orderId } });
|
||||
}
|
||||
|
||||
/** 切换售后状态 */
|
||||
function handleChangeStatus(key: number | string) {
|
||||
statusTab.value = key.toString();
|
||||
gridApi.query();
|
||||
}
|
||||
|
||||
const [Grid, gridApi] = useVbenVxeGrid({
|
||||
formOptions: {
|
||||
schema: useGridFormSchema(),
|
||||
},
|
||||
gridOptions: {
|
||||
cellConfig: {
|
||||
height: 60,
|
||||
},
|
||||
columns: useGridColumns(),
|
||||
keepSource: true,
|
||||
pagerConfig: {
|
||||
pageSize: 10,
|
||||
},
|
||||
proxyConfig: {
|
||||
ajax: {
|
||||
query: async ({ page }, formValues) => {
|
||||
return await getAfterSalePage({
|
||||
pageNo: page.currentPage,
|
||||
pageSize: page.pageSize,
|
||||
userId: props.userId,
|
||||
status:
|
||||
statusTab.value === '0' ? undefined : Number(statusTab.value),
|
||||
...formValues,
|
||||
});
|
||||
},
|
||||
},
|
||||
},
|
||||
rowConfig: {
|
||||
keyField: 'id',
|
||||
isHover: true,
|
||||
},
|
||||
toolbarConfig: {
|
||||
refresh: true,
|
||||
search: true,
|
||||
},
|
||||
} as VxeTableGridOptions<MallAfterSaleApi.AfterSale>,
|
||||
});
|
||||
|
||||
/** 初始化 */
|
||||
onMounted(() => {
|
||||
for (const dict of getDictOptions(DICT_TYPE.TRADE_AFTER_SALE_STATUS)) {
|
||||
statusTabs.value.push({
|
||||
label: dict.label,
|
||||
value: dict.value.toString(),
|
||||
});
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Grid>
|
||||
<template #toolbar-actions>
|
||||
<Tabs
|
||||
v-model:active-key="statusTab"
|
||||
class="w-full"
|
||||
@change="handleChangeStatus"
|
||||
>
|
||||
<Tabs.TabPane
|
||||
v-for="tab in statusTabs"
|
||||
:key="tab.value"
|
||||
:tab="tab.label"
|
||||
/>
|
||||
</Tabs>
|
||||
</template>
|
||||
<template #orderNo="{ row }">
|
||||
<Button type="link" @click="handleOpenOrderDetail(row)">
|
||||
{{ row.orderNo }}
|
||||
</Button>
|
||||
</template>
|
||||
<template #productInfo="{ row }">
|
||||
<div class="flex items-start gap-2 text-left">
|
||||
<Image
|
||||
v-if="row.picUrl"
|
||||
:src="row.picUrl"
|
||||
:width="40"
|
||||
:height="40"
|
||||
:preview="{ src: row.picUrl }"
|
||||
/>
|
||||
<div class="flex flex-1 flex-col gap-1">
|
||||
<span class="text-sm">{{ row.spuName }}</span>
|
||||
<div class="mt-1 flex flex-wrap gap-1">
|
||||
<Tag
|
||||
v-for="property in row.properties"
|
||||
:key="property.propertyId!"
|
||||
size="small"
|
||||
color="blue"
|
||||
>
|
||||
{{ property.propertyName }}: {{ property.valueName }}
|
||||
</Tag>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<template #actions="{ row }">
|
||||
<TableAction
|
||||
:actions="[
|
||||
{
|
||||
label: '处理退款',
|
||||
type: 'link',
|
||||
onClick: handleOpenAfterSaleDetail.bind(null, row),
|
||||
},
|
||||
]"
|
||||
/>
|
||||
</template>
|
||||
</Grid>
|
||||
</template>
|
||||
Reference in New Issue
Block a user