feat(shopOrder): 新增确认线下收款上传支付凭证功能

- 重构确认线下收款为独立组件 OfflinePaymentModal.vue
- 新增支付凭证字段 paymentVoucher,支持图片上传与预览
- 上传限制为 jpg/png 格式,单张图片最大 10MB
- API confirmOfflinePayment 新增 paymentVoucher 参数
- 页面移除原 Modal.confirm 逻辑,改为调用新组件弹窗
- 修复 buyerRemarks 和 merchantRemarks 类型错误
- 后端 shop_order 表待新增 payment_voucher 字段和接口支持
- 同步更新相关接口模型与视图交互逻辑

feat(shopGoodsBrowse): 新增用户商品浏览记录管理功能

- 新增 ShopGoodsBrowse 接口模型及分页查询、删除接口
- 前端新增浏览记录管理页面,实现列表展示和删除
- 支持基于用户ID、商品ID、浏览来源和日期范围搜索
- 列表显示商品图片、名称、价格、浏览次数及时间等信息
- 添加图片预览和操作确认弹窗,保障操作体验和安全
This commit is contained in:
2026-07-15 13:30:14 +08:00
parent 9e65007e65
commit a59d428e78
9 changed files with 636 additions and 31 deletions
+196
View File
@@ -0,0 +1,196 @@
<template>
<a-card :bordered="false" :body-style="{ padding: '16px' }">
<ele-pro-table
ref="tableRef"
row-key="id"
:columns="columns"
:datasource="datasource"
tool-class="ele-toolbar-form"
class="shop-goods-browse-table"
>
<template #toolbar>
<search @search="reload" />
</template>
<template #bodyCell="{ column, record }">
<template v-if="column.key === 'goodsImage'">
<a-image
v-if="record.goodsImage"
:src="record.goodsImage"
:width="50"
:height="50"
style="border-radius: 4px; object-fit: cover"
/>
<span v-else class="ele-text-placeholder">无图</span>
</template>
<template v-if="column.key === 'browseSource'">
<a-tag v-if="record.browseSource === 'detail'" color="blue">商品详情</a-tag>
<a-tag v-else-if="record.browseSource === 'home'" color="green">首页</a-tag>
<a-tag v-else-if="record.browseSource === 'category'" color="cyan">分类</a-tag>
<a-tag v-else-if="record.browseSource === 'search'" color="orange">搜索</a-tag>
<a-tag v-else-if="record.browseSource === 'share'" color="purple">分享</a-tag>
<span v-else>{{ record.browseSource || '-' }}</span>
</template>
<template v-if="column.key === 'visitCount'">
<a-tag color="red">{{ record.visitCount || 1 }}</a-tag>
</template>
<template v-if="column.key === 'lastVisitTime'">
{{ toDateString(record.lastVisitTime, 'yyyy-MM-dd HH:mm') }}
</template>
<template v-if="column.key === 'createTime'">
{{ toDateString(record.createTime, 'yyyy-MM-dd HH:mm') }}
</template>
<template v-if="column.key === 'action'">
<a-popconfirm
title="确定要删除此浏览记录吗?"
@confirm="remove(record)"
>
<a class="ele-text-danger">删除</a>
</a-popconfirm>
</template>
</template>
</ele-pro-table>
</a-card>
</template>
<script lang="ts" setup>
import { ref } from 'vue';
import { message } from 'ant-design-vue';
import type { EleProTable } from 'ele-admin-pro';
import { toDateString } from 'ele-admin-pro';
import type {
DatasourceFunction,
ColumnItem
} from 'ele-admin-pro/es/ele-pro-table/types';
import Search from './components/search.vue';
import {
pageShopGoodsBrowse,
removeShopGoodsBrowse
} from '@/api/shop/shopGoodsBrowse';
import type {
ShopGoodsBrowse,
ShopGoodsBrowseParam
} from '@/api/shop/shopGoodsBrowse/model';
// 表格实例
const tableRef = ref<InstanceType<typeof EleProTable> | null>(null);
// 表格数据源
const datasource: DatasourceFunction = ({
page,
limit,
where,
orders
}) => {
return pageShopGoodsBrowse({
...where,
...orders,
page,
limit
});
};
// 表格列配置
const columns = ref<ColumnItem[]>([
{
title: 'ID',
dataIndex: 'id',
key: 'id',
align: 'center',
width: 70
},
{
title: '用户ID',
dataIndex: 'userId',
key: 'userId',
align: 'center',
width: 90
},
{
title: '商品图片',
key: 'goodsImage',
align: 'center',
width: 80
},
{
title: '商品名称',
dataIndex: 'goodsName',
key: 'goodsName',
align: 'center',
ellipsis: true
},
{
title: '商品价格',
dataIndex: 'price',
key: 'price',
align: 'center',
width: 100,
customRender: ({ text }) => (text ? `¥${text}` : '-')
},
{
title: '浏览次数',
dataIndex: 'visitCount',
key: 'visitCount',
align: 'center',
width: 90,
sorter: true
},
{
title: '浏览来源',
dataIndex: 'browseSource',
key: 'browseSource',
align: 'center',
width: 100
},
{
title: '最后浏览时间',
dataIndex: 'lastVisitTime',
key: 'lastVisitTime',
align: 'center',
width: 160,
sorter: true
},
{
title: '首次浏览',
dataIndex: 'createTime',
key: 'createTime',
align: 'center',
width: 160
},
{
title: '操作',
key: 'action',
width: 100,
fixed: 'right',
align: 'center',
hideInSetting: true
}
]);
/* 搜索 */
const reload = (where?: ShopGoodsBrowseParam) => {
tableRef?.value?.reload({ where: where });
};
/* 删除单条 */
const remove = (row: ShopGoodsBrowse) => {
const hide = message.loading('请求中..', 0);
removeShopGoodsBrowse(row.id)
.then((msg) => {
hide();
message.success(msg);
reload();
})
.catch((e) => {
hide();
message.error(e.message);
});
};
</script>
<script lang="ts">
export default {
name: 'ShopGoodsBrowse'
};
</script>
<style lang="less" scoped></style>