From b806c4ad52a661a1e5f0695650ec1a7e42f01633 Mon Sep 17 00:00:00 2001
From: MrShi <1878285526@qq.com>
Date: 星期三, 20 五月 2026 23:08:48 +0800
Subject: [PATCH] 提交

---
 small-program/shop/pages/coupon-center/coupon-center.vue |   60 ++++++++++++++++++++++++++++++++++++------------------------
 1 files changed, 36 insertions(+), 24 deletions(-)

diff --git a/small-program/shop/pages/coupon-center/coupon-center.vue b/small-program/shop/pages/coupon-center/coupon-center.vue
index a5ab167..ae95eef 100644
--- a/small-program/shop/pages/coupon-center/coupon-center.vue
+++ b/small-program/shop/pages/coupon-center/coupon-center.vue
@@ -8,7 +8,7 @@
 				:class="{ active: currentTab === tab.value }"
 				@tap="currentTab = tab.value"
 			>
-				<text>{{ tab.label }}</text>
+				<text>{{ tab.label }}<text v-if="tab.value === 0 && waitClaim > 0">({{ waitClaim }})</text><text v-if="tab.value === 1 && waitUse > 0">({{ waitUse }})</text></text>
 				<view class="tab-line"></view>
 			</view>
 		</view>
@@ -22,9 +22,9 @@
 				>
 					<view class="coupon-main">
 				<view class="coupon-info">
-					<view class="coupon-title">{{ item.name }}</view>
-					<view class="coupon-time" v-if="currentTab === 0">鏈夋晥鏈焮{ item.createDate }}~{{ item.validDate }}</view>
-					<view class="coupon-time" v-else>鏈夋晥鏈焮{ item.startDate }}~{{ item.endDate }}</view>
+					<view class="coupon-title" v-if="item.couponType === 0">骞冲彴婊″噺鍒�</view>
+					<view class="coupon-time" v-if="currentTab === 0">鏈夋晥鏈焮{ formatDate(item.createDate) }}~{{ formatDate(item.validDate) }}</view>
+					<view class="coupon-time" v-else>鏈夋晥鏈焮{ formatDate(item.startDate) }}~{{ formatDate(item.endDate) }}</view>
 				</view>
 				<view class="coupon-price" :class="item.status">
 					<text class="price-value">{{ ((item.price || 0) / 100).toFixed(2) }}</text>
@@ -68,14 +68,16 @@
 				currentTab: 0,
 				tabs: [
 					{ label: '寰呴鍙�', value: 0 },
-					{ label: '宸查鍙�', value: 1 },
+					{ label: '寰呬娇鐢�', value: 1 },
 					{ label: '宸蹭娇鐢�', value: 2 },
 					{ label: '宸插け鏁�', value: 99 }
 				],
 				coupons: [],
 				page: 1,
 				capacity: 10,
-				isRequest: true
+				isRequest: true,
+				waitClaim: 0,
+				waitUse: 0
 			}
 		},
 		watch: {
@@ -88,11 +90,30 @@
 		},
 		onLoad() {
 			this.getCouponList()
+			this.getPendingCount()
 		},
 		onReachBottom() {
 			this.getCouponList()
 		},
 		methods: {
+			async getPendingCount() {
+				const res = await this.$u.api.pendingCount({})
+				console.log(res)
+				if (res.code === 200 && res.data) {
+					this.waitClaim = res.data.waitClaim || 0
+					this.waitUse = res.data.waitUse || 0
+				}
+			},
+			formatDate(dateStr) {
+				if (!dateStr) return ''
+				const date = new Date(dateStr)
+				const year = String(date.getFullYear()).slice(2)
+				const month = String(date.getMonth() + 1).padStart(2, '0')
+				const day = String(date.getDate()).padStart(2, '0')
+				const hours = String(date.getHours()).padStart(2, '0')
+				const minutes = String(date.getMinutes()).padStart(2, '0')
+				return `${year}.${month}.${day} ${hours}:${minutes}`
+			},
 			async getCouponList() {
 			if (!this.isRequest) return
 			const res = await this.$u.api.findPage({
@@ -119,28 +140,19 @@
 		},
 			async handleReceive(item) {
 				if (this.currentTab === 1) {
-					// 宸查鍙栨爣绛句笅锛岀偣鍑诲幓浣跨敤璺宠浆鍒拌鏉庡瘎瀛橀〉闈�
 					uni.navigateTo({
 						url: '/pages/luggage-storage/luggage-storage'
 					})
 				} else {
-					// 鍏朵粬鏍囩涓嬶紝鎵ц棰嗗彇鎿嶄綔
-					uni.showModal({
-						title: '鎻愮ず',
-						content: '纭畾瑕侀鍙栬浼樻儬鍒稿悧锛�',
-						success: async (res) => {
-							if (res.confirm) {
-								const result = await this.$u.api.claimCoupon({ couponId: item.id })
-								if (result.code === 200) {
-									uni.showToast({ title: '棰嗗彇鎴愬姛', icon: 'success' })
-									this.page = 1
-									this.coupons = []
-									this.isRequest = true
-									this.getCouponList()
-								}
-							}
-						}
-					})
+					const result = await this.$u.api.claimCoupon({ couponId: item.id })
+					if (result.code === 200) {
+						uni.showToast({ title: '棰嗗彇鎴愬姛', icon: 'success' })
+						this.page = 1
+						this.coupons = []
+						this.isRequest = true
+						this.getCouponList()
+						this.getPendingCount()
+					}
 				}
 			},
 			toggleRule(id) {

--
Gitblit v1.9.3