购物车和订单中心以及优惠券相关功能初版
This commit is contained in:
@@ -217,6 +217,7 @@
|
||||
placeholder="请选择优惠券"
|
||||
style="width: 100%"
|
||||
:loading="loadingCoupons"
|
||||
:disabled="!isShopOwner()"
|
||||
>
|
||||
<a-select-option
|
||||
v-if="coupons.length === 0"
|
||||
@@ -331,6 +332,11 @@ const getCurrentUserInfo = () => {
|
||||
return null
|
||||
}
|
||||
|
||||
const isShopOwner = () => {
|
||||
const userInfo = getCurrentUserInfo()
|
||||
return userInfo && userInfo.type === 2
|
||||
}
|
||||
|
||||
const fetchShops = async () => {
|
||||
loadingShops.value = true
|
||||
try {
|
||||
@@ -397,7 +403,8 @@ const fetchCoupons = async () => {
|
||||
loadingCoupons.value = true
|
||||
try {
|
||||
const res = await adminCouponApi.listAllCoupons()
|
||||
coupons.value = res || []
|
||||
// 处理后端返回的分页数据结构
|
||||
coupons.value = res?.list || []
|
||||
} catch (error) {
|
||||
console.error('获取优惠券列表失败', error)
|
||||
message.error('获取优惠券列表失败')
|
||||
|
||||
Reference in New Issue
Block a user