From 3f9032e92fdd383bfefc87a0bec9b242e1223851 Mon Sep 17 00:00:00 2001
From: MrShi <1878285526@qq.com>
Date: 星期二, 09 六月 2026 17:08:44 +0800
Subject: [PATCH] 改bug

---
 small-program/pages/payment-success/payment-success.vue |   73 +++++++++++++++++++++++++-----------
 1 files changed, 51 insertions(+), 22 deletions(-)

diff --git a/small-program/pages/payment-success/payment-success.vue b/small-program/pages/payment-success/payment-success.vue
index 17726d7..889aa83 100644
--- a/small-program/pages/payment-success/payment-success.vue
+++ b/small-program/pages/payment-success/payment-success.vue
@@ -16,13 +16,13 @@
 			</view>
 
 			<view class="pickup-card">
-				<text class="pickup-title">鑷彁鐮�</text>
+				<text class="pickup-title">鏍搁攢鐮�</text>
 				<view class="qrcode-box">
-					<canvas canvas-id="qrcodeCanvas" id="qrcodeCanvas"></canvas>
-					<image class="qrcode-image" :src="qrcodeImage" mode="aspectFit"></image>
+					<canvas v-if="!qrcodeImage" canvas-id="qrcodeCanvas" id="qrcodeCanvas" :style="'width: '+width+'px; height:'+height+'px;'+'opacity: 0;'"></canvas>
+					<image v-else class="qrcode-image" :src="qrcodeImage" mode="widthFix"></image>
 				</view>
 				<text class="pickup-code">{{ orderDetail.memberVerifyCode }}</text>
-				<text class="pickup-tip" @tap="copyCode">鐐瑰嚮澶嶅埗鑷彁鐮�</text>
+				<text class="pickup-tip" @tap="copyCode">鐐瑰嚮澶嶅埗鏍搁攢鐮�</text>
 			</view>
 		</view>
 	</view>
@@ -33,7 +33,10 @@
 
 	export default {
 		data() {
+			
 			return {
+				height:180,
+				width:180,
 				orderId: '',
 				orderDetail: null,
 				qrcodeImage: ''
@@ -45,6 +48,8 @@
 				title: '鏀粯鎴愬姛'
 			})
 			this.getOrderDetail()
+			this.width = this.rpxToPx(200)
+			this.height = this.rpxToPx(200)
 		},
 		methods: {
 			async getOrderDetail() {
@@ -56,22 +61,38 @@
 					}
 				}
 			},
+			rpxToPx(rpx) {
+			  return rpx * wx.getSystemInfoSync().windowWidth / 750
+			},
 			generateQrcode(code) {
-				drawQrcode({
-					canvasId: 'qrcodeCanvas',
-					text: code,
-					width: 200,
-					height: 200,
-					correctLevel: drawQrcode.CorrectLevel.H
-				})
-				setTimeout(() => {
-					uni.canvasToTempFilePath({
+				this.$nextTick(() => {
+					drawQrcode({
 						canvasId: 'qrcodeCanvas',
-						success: (res) => {
-							this.qrcodeImage = res.tempFilePath
-						}
-					}, this)
-				}, 100)
+						text: code,
+						width: this.width,
+						height: this.height,
+						correctLevel: 2
+					})
+					setTimeout(() => {
+						uni.canvasToTempFilePath({
+							canvasId: 'qrcodeCanvas',
+							x: 0,
+							y: 0,
+							width: this.width,
+							height: this.height,
+							destWidth: this.width,
+							destHeight: this.height,
+							success: (res) => {
+								this.qrcodeImage = res.tempFilePath
+							},
+							fail: (err) => {
+								console.error('鐢熸垚浜岀淮鐮佸浘鐗囧け璐�:', err)
+								// 濡傛灉澶辫触锛屼娇鐢� canvas 鐩存帴鏄剧ず
+								this.qrcodeImage = ''
+							}
+						}, this)
+					}, 300)
+				})
 			},
 			goHome() {
 				uni.switchTab({
@@ -79,8 +100,8 @@
 				})
 			},
 			viewOrder() {
-				uni.redirectTo({
-					url: '/pages/itinerary/itinerary?orderId=' + this.orderId
+				uni.navigateTo({
+					url:'/pages/delivery-order-detail/delivery-order-detail?userType=0&id='+this.orderId
 				})
 			},
 			copyCode() {
@@ -96,7 +117,7 @@
 						})
 					}
 				})
-			}
+			} 
 		}
 	}
 </script>
@@ -201,12 +222,20 @@
 		height: 360rpx;
 		border-radius: 8rpx;
 		box-sizing: border-box;
+		position: relative;
+		overflow: hidden;
+		display: flex;
+		align-items: center;
+		justify-content: center;
+		canvas {
+			width: 200px;
+			height: 200px;
+		}
 	}
 
 	.qrcode-image {
 		width: 100%;
 		height: 100%;
-		background: #f4f6fa;
 	}
 
 	.pickup-code {

--
Gitblit v1.9.3