fix(shop): 修复商城商品导出及专区商品分页问题

- 修复专区商品抽屉分页中20/100条/页按键无效,增加动态分页参数支持
- 修复商城商品导出功能无反应问题,调整loading初始值保证导出流程执行
- 支持商品导出携带当前筛选条件,保证导出数据符合筛选结果
- 商品导出增加封面图路径列,导出URL文本方式避免跨域限制
- 优化UserSelectModal手机号码展示,改为优先展示真实号码字段
- 相关组件调整分页及导出事件参数,提升交互准确性与稳定性
This commit is contained in:
2026-08-17 11:34:39 +08:00
parent 3c4e30c227
commit 6556944ffc
5 changed files with 51 additions and 15 deletions
@@ -167,7 +167,7 @@
(e: 'imageImport'): void;
(e: 'detailImport'): void;
(e: 'convertContent'): void;
(e: 'export'): void;
(e: 'export', where?: ShopGoodsParam): void;
}>();
// 新增
@@ -207,9 +207,9 @@
emit('convertContent');
};
// 导出
// 导出(携带当前筛选条件 where
const handleExport = () => {
emit('export');
emit('export', where);
};
const handleSearch = (e) => {
+11 -7
View File
@@ -211,6 +211,7 @@
import { ShopGoodsCategory } from '@/api/shop/shopGoodsCategory/model';
import { listShopGoodsCategory } from '@/api/shop/shopGoodsCategory';
import { utils, writeFile } from 'xlsx';
import { ensureFullUrl } from '@/utils/image';
import dayjs from 'dayjs';
// 表格实例
@@ -233,7 +234,7 @@
// 是否显示批量移动弹窗
const showMove = ref(false);
// 加载状态
const loading = ref(true);
const loading = ref(false);
// 表格数据源
const datasource: DatasourceFunction = ({
@@ -429,8 +430,8 @@
: base;
};
/* 导出商品列表 */
const handleExport = async () => {
/* 导出商品列表(可携带当前筛选条件) */
const handleExport = async (where?: ShopGoodsParam) => {
if (loading.value) {
return;
}
@@ -448,11 +449,12 @@
'库存',
'状态',
'推荐',
'创建时间'
'创建时间',
'封面图'
]
];
const list = await listShopGoods({});
const list = await listShopGoods(where || {});
if (!list || list.length === 0) {
message.warning('没有数据可以导出');
loading.value = false;
@@ -471,7 +473,8 @@
`${goods.stock || 0}`,
statusMap[goods.status || 0] || '',
goods.recommend === 1 ? '是' : '否',
`${goods.createTime || ''}`
`${goods.createTime || ''}`,
ensureFullUrl(`${goods.image || ''}`)
]);
});
@@ -493,7 +496,8 @@
{ wch: 10 },
{ wch: 12 },
{ wch: 8 },
{ wch: 20 }
{ wch: 20 },
{ wch: 50 }
];
message.destroy();
@@ -101,7 +101,7 @@
{ title: '姓名', dataIndex: 'realName', key: 'realName', align: 'center' },
{ title: '手机号码', dataIndex: 'phone', key: 'phone', align: 'center', customRender: ({ text, record }: any) => text || record.mobile || '-' },
{ title: '昵称', dataIndex: 'nickname', key: 'nickname', align: 'center' },
{ title: '所属部门', dataIndex: 'organizationName', key: 'organizationName', align: 'center' },
// { title: '所属部门', dataIndex: 'organizationName', key: 'organizationName', align: 'center' },
{ title: '操作', key: 'action', align: 'center', width: 90 }
];
+7 -4
View File
@@ -148,9 +148,11 @@
:pagination="{
total: goodsTotal,
current: goodsPage,
pageSize: 10,
onChange: (page: number) => {
goodsPage = page;
pageSize: goodsPageSize,
showSizeChanger: true,
onChange: (page: number, pageSize: number) => {
goodsPage.value = page;
goodsPageSize.value = pageSize;
loadGoods(currentSectionId);
}
}"
@@ -257,6 +259,7 @@
const goodsList = ref<any[]>([]);
const goodsTotal = ref(0);
const goodsPage = ref(1);
const goodsPageSize = ref(10);
// 商品搜索/添加
const goodsSearchText = ref('');
const goodsSearchLoading = ref(false);
@@ -477,7 +480,7 @@
const loadGoods = (sectionId: number) => {
goodsLoading.value = true;
listSectionGoods(sectionId, { page: goodsPage.value, limit: 10 })
listSectionGoods(sectionId, { page: goodsPage.value, limit: goodsPageSize.value })
.then((res) => {
goodsList.value = res?.list || [];
goodsTotal.value = res?.count || 0;