fix:修改商品列表分页展示
This commit is contained in:
@@ -406,9 +406,12 @@ const fetchProductList = async () => {
|
|||||||
try {
|
try {
|
||||||
const res = await getProductList(queryParams)
|
const res = await getProductList(queryParams)
|
||||||
if (res.data.code === 200) {
|
if (res.data.code === 200) {
|
||||||
productList.value = res.data.data.data || []
|
const allData = res.data.data.data || []
|
||||||
productList.value = productList.value.filter(item => item.delete == false)
|
// 过滤掉已删除的数据
|
||||||
total.value = res.data.data.all_count || 0
|
productList.value = allData.filter(item => item.delete == false)
|
||||||
|
// 计算未删除数据的总数(API返回的all_count包含已删除的,需要减去已删除的数量)
|
||||||
|
const deletedCount = allData.filter(item => item.delete == true).length
|
||||||
|
total.value = (res.data.data.data.length || 0) - deletedCount
|
||||||
productList.value = productList.value.map(item => {
|
productList.value = productList.value.map(item => {
|
||||||
item.image = item.coverId ? getFileDetail({ file_id: item.coverId }).then(res => res.data.data.url) : ''
|
item.image = item.coverId ? getFileDetail({ file_id: item.coverId }).then(res => res.data.data.url) : ''
|
||||||
return item
|
return item
|
||||||
|
|||||||
Reference in New Issue
Block a user