后台管理功能进行一些优化
This commit is contained in:
@@ -58,11 +58,11 @@
|
||||
</div>
|
||||
</a-col>
|
||||
<a-col :span="8">
|
||||
<div class="stat-item">
|
||||
<div class="stat-item" @click="handleCouponClick" style="cursor: pointer;">
|
||||
<div class="stat-icon" style="background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);">
|
||||
<CreditCardOutlined />
|
||||
</div>
|
||||
<a-statistic title="优惠券" :value="3" />
|
||||
<a-statistic title="优惠券" :value="couponCount" />
|
||||
</div>
|
||||
</a-col>
|
||||
</a-row>
|
||||
@@ -252,6 +252,7 @@ const orders = ref<any[]>([])
|
||||
const coupons = ref<any[]>([])
|
||||
const loading = ref(false)
|
||||
const orderCount = ref(0)
|
||||
const couponCount = ref(0)
|
||||
|
||||
const editForm = ref({
|
||||
nickname: '',
|
||||
@@ -411,6 +412,7 @@ const loadCoupons = async () => {
|
||||
try {
|
||||
const data = await couponApi.listUserCoupons()
|
||||
coupons.value = data
|
||||
couponCount.value = data.length
|
||||
} catch (error) {
|
||||
message.error('获取优惠券列表失败')
|
||||
} finally {
|
||||
@@ -418,6 +420,12 @@ const loadCoupons = async () => {
|
||||
}
|
||||
}
|
||||
|
||||
// 处理优惠券点击
|
||||
const handleCouponClick = () => {
|
||||
activeTab.value = 'coupons'
|
||||
loadCoupons()
|
||||
}
|
||||
|
||||
// 处理取消订单
|
||||
const handleCancelOrder = async (orderId: number) => {
|
||||
Modal.confirm({
|
||||
@@ -500,6 +508,7 @@ const getRandomColor = () => {
|
||||
onMounted(() => {
|
||||
fetchUserInfo()
|
||||
loadOrders()
|
||||
loadCoupons()
|
||||
})
|
||||
</script>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user