From 25ee0fc249a081bb7bc4b485708c3e1afd3b07d1 Mon Sep 17 00:00:00 2001
From: peng <peng.com>
Date: 星期四, 18 九月 2025 14:13:17 +0800
Subject: [PATCH] 商品兑换卷调整以及绑定电话号码调整

---
 pages/order/claim-coupon/claim-coupon.vue |   45 ++++++++++++++++++++++++++++++++++++---------
 1 files changed, 36 insertions(+), 9 deletions(-)

diff --git a/pages/order/claim-coupon/claim-coupon.vue b/pages/order/claim-coupon/claim-coupon.vue
index 4e26ca6..0f7a359 100644
--- a/pages/order/claim-coupon/claim-coupon.vue
+++ b/pages/order/claim-coupon/claim-coupon.vue
@@ -2,8 +2,8 @@
 	<view class="container">
 		<!-- 椤堕儴鏍囬 -->
 		<view class="header">
-			<text class="title">浼樻儬鍒搁鍙�</text>
-			<text class="subtitle">棰嗗彇鎮ㄧ殑涓撳睘浼樻儬鍒�</text>
+			<text class="title">鍟嗗搧鍏戞崲鍒搁鍙�</text>
+			<text class="subtitle">棰嗗彇鎮ㄧ殑涓撳睘鍟嗗搧鍏戞崲鍒�</text>
 		</view>
 		
 		<!-- 鍗曚釜浼樻儬鍒稿睍绀� -->
@@ -104,15 +104,42 @@
 			if (options.id) {
 				this.cardId = options.id
 				this.loadCouponInfo(options.id);
-			} else {
+			}else if(options.q) {
+					// 鍙岄噸瑙g爜锛氬井淇″URL杩涜浜嗕袱娆$紪鐮�
+					const decodedUrl = decodeURIComponent(decodeURIComponent(options.q));
+					console.log('鍘熷URL:', decodedUrl);
+				
+					// 瑙f瀽URL涓殑鏌ヨ鍙傛暟
+					const params = this.parseUrlParams(decodedUrl);
+					this.cardId =  params.id;
+					this.loadCouponInfo(this.cardId);
+				}
+			 else {
 				// 濡傛灉娌℃湁浼犻�扞D锛屾樉绀虹┖鐘舵��
 				uni.showToast({
-					title: '缂哄皯浼樻儬鍒窱D鍙傛暟',
+					title: '缂哄皯鍏戞崲鍒窱D鍙傛暟',
 					icon: 'none'
 				});
 			}
 		},
 		methods: {
+			// 瑙f瀽URL鍙傛暟
+			parseUrlParams(url) {
+				const params = {};
+				// 澶勭悊鍙兘瀛樺湪鐨刪ash锛堝鏋滄湁鐨勮瘽锛�
+				const cleanUrl = url.split('#')[0];
+				const queryStr = cleanUrl.split('?')[1] || '';
+			
+				queryStr.split('&').forEach(pair => {
+					const [key, value] = pair.split('=');
+					if (key) {
+						// 濡傛灉鍊煎瓨鍦紝鍒欒В鐮侊紝鍚﹀垯璁句负绌哄瓧绗︿覆
+						params[key] = value ? decodeURIComponent(value) : '';
+					}
+				});
+			
+				return params;
+			},
 			// 鍔犺浇鎸囧畾ID鐨勪紭鎯犲埜淇℃伅
 			async loadCouponInfo(id) {
 				if (this.loading) return;
@@ -125,12 +152,12 @@
 					if (res.data.code===200) {
 						this.couponInfo = res.data.data;
 					} else {
-						throw new Error(res.message || '鑾峰彇浼樻儬鍒稿け璐�');
+						throw new Error(res.message || '鑾峰彇鍏戞崲鍒稿け璐�');
 					}
 				} catch (err) {
-					console.error('鑾峰彇浼樻儬鍒镐俊鎭け璐�:', err);
+					console.error('鑾峰彇鍏戞崲鍒镐俊鎭け璐�:', err);
 					uni.showToast({
-						title: err.message || '鑾峰彇浼樻儬鍒稿け璐�',
+						title: err.message || '鑾峰彇鍏戞崲鍒稿け璐�',
 						icon: 'none'
 					});
 				} finally {
@@ -142,7 +169,7 @@
 			async claimCoupon() {
 				if (!this.couponInfo || this.couponInfo.claimStatus === 'CLAIM') {
 					uni.showToast({
-						title: '璇ヤ紭鎯犲埜宸查鍙�',
+						title: '璇ュ厬鎹㈠埜宸查鍙�',
 						icon: 'none'
 					});
 					return;
@@ -174,7 +201,7 @@
 					}
 				} catch (err) {
 					uni.hideLoading();
-					console.error('棰嗗彇浼樻儬鍒稿け璐�:', err);
+					console.error('棰嗗彇鍏戞崲鍒稿け璐�:', err);
 					uni.showToast({
 						title: err.message || '棰嗗彇澶辫触',
 						icon: 'none'

--
Gitblit v1.8.0