From c8cef398fbf1f9b63dbf23637ef520b421515dc9 Mon Sep 17 00:00:00 2001
From: zxl <763096477@qq.com>
Date: 星期四, 20 十一月 2025 10:13:08 +0800
Subject: [PATCH] 领劵中心修改显示,售后修改银行信息非必填
---
pages/order/claim-coupon/claim-coupon.vue | 59 +++++++++++++++++++++++++++++++++++++++++++++--------------
1 files changed, 45 insertions(+), 14 deletions(-)
diff --git a/pages/order/claim-coupon/claim-coupon.vue b/pages/order/claim-coupon/claim-coupon.vue
index 2acfa09..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>
<!-- 鍗曚釜浼樻儬鍒稿睍绀� -->
@@ -12,12 +12,12 @@
<!-- 鍟嗗搧鍥剧墖 -->
<view class="goods-image-container">
<u-image
- :src="couponInfo.goodsImage || '/static/default_goods.png'"
+ :src="couponInfo.goodsUrl"
width="100%"
height="300rpx"
mode="aspectFit"
border-radius="16"
- @click="previewImage(couponInfo.goodsImage)"
+ @click="previewImage(couponInfo.goodsUrl)"
></u-image>
</view>
@@ -89,26 +89,57 @@
couponInfo: null, // 鍗曚釜浼樻儬鍒镐俊鎭�
loading: false,
showShoppingModal: false ,// 鎺у埗鍘昏喘鐗╁脊绐楁樉绀�
- couponId:''
+ couponId:'',
+ cardId:''
}
+ },
+ onShow() {
+ this.loadCouponInfo(this.cardId);
},
onLoad(options) {
// 閫氳繃鍙傛暟浼犻�掍紭鎯犲埜ID
// 渚嬪: /pages/order/claim-coupon/claim-coupon?id=123
- options.id = '1966390012058017794'
this.couponId = ''
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;
@@ -121,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 {
@@ -138,7 +169,7 @@
async claimCoupon() {
if (!this.couponInfo || this.couponInfo.claimStatus === 'CLAIM') {
uni.showToast({
- title: '璇ヤ紭鎯犲埜宸查鍙�',
+ title: '璇ュ厬鎹㈠埜宸查鍙�',
icon: 'none'
});
return;
@@ -148,7 +179,7 @@
uni.showLoading({
title: '棰嗗彇涓�...'
});
-
+ console.log(this.couponInfo)
// 璋冪敤棰嗗彇浼樻儬鍒告帴鍙�
const res = await claimVirtualCoupon(this.couponInfo.id);
@@ -170,7 +201,7 @@
}
} catch (err) {
uni.hideLoading();
- console.error('棰嗗彇浼樻儬鍒稿け璐�:', err);
+ console.error('棰嗗彇鍏戞崲鍒稿け璐�:', err);
uni.showToast({
title: err.message || '棰嗗彇澶辫触',
icon: 'none'
--
Gitblit v1.8.0