浏览代码

【功能修复】商城:商品列表,导出会报错的问题

YunaiV 5 月之前
父节点
当前提交
6a6f52c4c4
共有 2 个文件被更改,包括 3 次插入3 次删除
  1. 1 1
      src/api/mall/product/spu.ts
  2. 2 2
      src/views/mall/product/spu/index.vue

+ 1 - 1
src/api/mall/product/spu.ts

@@ -101,7 +101,7 @@ export const deleteSpu = (id: number) => {
 }
 
 // 导出商品 Spu Excel
-export const exportSpu = async (params) => {
+export const exportSpu = async (params: any) => {
   return await request.download({ url: '/product/spu/export', params })
 }
 

+ 2 - 2
src/views/mall/product/spu/index.vue

@@ -411,7 +411,7 @@ const handleExport = async () => {
     await message.exportConfirm()
     // 发起导出
     exportLoading.value = true
-    const data = await ProductSpuApi.exportSpu(queryParams)
+    const data = await ProductSpuApi.exportSpu(queryParams.value)
     download.excel(data, '商品列表.xls')
   } catch {
   } finally {
@@ -434,7 +434,7 @@ onActivated(() => {
 onMounted(async () => {
   // 解析路由的 categoryId
   if (route.query.categoryId) {
-    queryParams.value.categoryId = Number(route.query.categoryId)
+    queryParams.value.categoryId = route.query.categoryId
   }
   // 获得商品信息
   await getTabsCount()