From 64868b47b327a05da72b6fc1aaba2b044aaf8e19 Mon Sep 17 00:00:00 2001
From: dzl <786316265@qq.com>
Date: Sat, 11 Oct 2025 17:32:43 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E6=83=A0=E5=88=B8=E6=9B=B4=E6=94=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/router/index.js | 6 ++
src/views/CouponManage.vue | 82 +++++++++++++++
src/views/ProductCategory.vue | 154 ++++-------------------------
src/views/ProductCategoryFinal.vue | 26 ++---
src/views/Shop.vue | 6 +-
5 files changed, 116 insertions(+), 158 deletions(-)
create mode 100644 src/views/CouponManage.vue
diff --git a/src/router/index.js b/src/router/index.js
index 7204c4b..a157b40 100644
--- a/src/router/index.js
+++ b/src/router/index.js
@@ -231,6 +231,12 @@ const routes = [
meta: {title: '支付确认'},
props: route => ({orderId: route.query.orderId})
},
+ {
+ path: '/coupon',
+ name: 'Coupon',
+ component: () => import('@/views/CouponManage.vue'),
+ meta: {title: '优惠券', requiresAuth: true}
+ },
{
path: '/:pathMatch(.*)*',
name: 'NotFound',
diff --git a/src/views/CouponManage.vue b/src/views/CouponManage.vue
new file mode 100644
index 0000000..ca6ec3f
--- /dev/null
+++ b/src/views/CouponManage.vue
@@ -0,0 +1,82 @@
+
+
+
+
+
+
+
+
+
diff --git a/src/views/ProductCategory.vue b/src/views/ProductCategory.vue
index bbdd0d4..a9d1e7d 100644
--- a/src/views/ProductCategory.vue
+++ b/src/views/ProductCategory.vue
@@ -3,7 +3,7 @@
-
+
你有优惠券待领取
@@ -57,11 +57,13 @@ import api from '@/utils/api'
import { getImageUrl } from '@/config'
import { useUserStore } from '@/stores/user';
-const userStore = useUserStore();
+const userStore = useUserStore();
const route = useRoute()
-const searchKeyword = ref(route.params.name)
+// const secondCategory = ref(route.params.name)
+
+const searchKeyword = ref('')
const sortBy = ref('')
const products = ref([])
@@ -70,7 +72,7 @@ const loading = ref(false)
const loadingMore = ref(false)
const page = ref(1)
const hasMore = ref(true)
-const selectedCategory = ref('all')
+const selectedCategory = ref(route.params.name)
const couponExist = ref(false)
@@ -173,22 +175,6 @@ const getProducts = async (isLoadMore = false) => {
}
}
-const getCoupon = async () => {
- try {
- console.log(userStore)
- const {data} = await api.get(`/coupon/${userStore.user.id}`)
- if (data.success) {
- ElMessage.success('优惠券领取成功')
- isCouponExist()
- } else {
- ElMessage.error(data.msg || '优惠券领取失败')
- }
- } catch (error) {
- ElMessage.error('优惠券领取失败')
- console.error('优惠券领取失败:', error)
- }
-}
-
const isCouponExist = async () => {
try {
const {data} = await api.get(`/coupon`)
diff --git a/src/views/Shop.vue b/src/views/Shop.vue
index 2ffdc57..1cd5f90 100644
--- a/src/views/Shop.vue
+++ b/src/views/Shop.vue
@@ -16,7 +16,7 @@
-
+
@@ -202,10 +202,10 @@ onMounted(() => {
.shop-tips {
align-self: center;
- margin-top: 28px;
+ margin-top: 15px;
border-radius: 5px;
height: 30px;
- width: 330px;
+ width: auto;
}
.tips-imgs {