修复一些问题,优化前后端交互接口格式,优化首页轮播图图的维护
This commit is contained in:
@@ -457,9 +457,15 @@ const fetchCoupons = async () => {
|
||||
const currentUser = getCurrentUserInfo()
|
||||
const shopId = (currentUser && currentUser.shopId) ? currentUser.shopId : undefined
|
||||
const res = await adminCouponApi.listAllCoupons(shopId)
|
||||
// 处理后端返回的分页数据结构
|
||||
couponList.value = res?.list || []
|
||||
pagination.total = res?.total || 0
|
||||
// 后端返回的是数组,直接使用
|
||||
if (Array.isArray(res)) {
|
||||
couponList.value = res
|
||||
pagination.total = res.length
|
||||
} else {
|
||||
// 兼容分页数据结构
|
||||
couponList.value = res?.list || []
|
||||
pagination.total = res?.total || 0
|
||||
}
|
||||
} catch (error) {
|
||||
message.error('获取优惠券列表失败')
|
||||
} finally {
|
||||
|
||||
Reference in New Issue
Block a user