优惠券更改
This commit is contained in:
82
src/views/CouponManage.vue
Normal file
82
src/views/CouponManage.vue
Normal file
@@ -0,0 +1,82 @@
|
||||
<template>
|
||||
<div class="coupon-container">
|
||||
<div class="header">
|
||||
<div class="back-btn" @click="$router.go(-1)"><</div>
|
||||
<div class="text">
|
||||
优惠券包
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { onMounted, ref } from 'vue'
|
||||
import { useUserStore } from '@/stores/user'
|
||||
import api from '@/utils/api'
|
||||
import { ElMessage } from 'element-plus'
|
||||
|
||||
const userStore = useUserStore()
|
||||
|
||||
const getCoupon = async () => {
|
||||
try {
|
||||
console.log(userStore)
|
||||
const {data} = await api.get(`/coupon/${userStore.user.id}`,{
|
||||
params: {
|
||||
coupon_id: coupon_id
|
||||
}
|
||||
})
|
||||
if (data.success) {
|
||||
ElMessage.success('优惠券领取成功')
|
||||
} else {
|
||||
ElMessage.error(data.msg || '优惠券领取失败')
|
||||
}
|
||||
} catch (error) {
|
||||
ElMessage.error('优惠券领取失败')
|
||||
console.error('优惠券领取失败:', error)
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
getCoupon()
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding-left: 20px;
|
||||
position: relative;
|
||||
margin-top: 25px;
|
||||
}
|
||||
|
||||
.back-btn {
|
||||
font-size: 15px;
|
||||
width: 26px;
|
||||
height: 26px;
|
||||
color: #000000;
|
||||
background: transparent;
|
||||
border: none;
|
||||
position: absolute;
|
||||
left: 0;
|
||||
margin-left: 30px;
|
||||
margin-top: 5px;
|
||||
}
|
||||
|
||||
.text {
|
||||
width: 80px;
|
||||
height: 28px;
|
||||
angle: 0 deg;
|
||||
opacity: 1;
|
||||
font-family: SF Pro;
|
||||
font-weight: 650;
|
||||
font-style: Expanded Semibold;
|
||||
font-size: 20px;
|
||||
leading-trim: NONE;
|
||||
line-height: 28px;
|
||||
letter-spacing: 0%;
|
||||
color: #2F4FB5;
|
||||
text-align: center;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user