shish há 11 meses atrás
pai
commit
b66baeb55b
3 ficheiros alterados com 1 adições e 926 exclusões
  1. 0 389
      hdh5/admin/ghs/demo.vue
  2. 0 516
      hdh5/admin/ghs/scan.vue
  3. 1 21
      hdh5/pages.json

+ 0 - 389
hdh5/admin/ghs/demo.vue

@@ -1,389 +0,0 @@
-<template>
-	<view class="demo-container">
-		<!-- 顶部导航栏 -->
-		<view class="nav-bar">
-			<view class="nav-left" @click="goBack">
-				<text class="iconfont icon-back">&#xe679;</text>
-			</view>
-			<view class="nav-title">扫码支付演示</view>
-			<view class="nav-right"></view>
-		</view>
-
-		<!-- 演示内容 -->
-		<view class="demo-content">
-			<!-- 功能说明 -->
-			<view class="demo-section">
-				<view class="section-title">功能说明</view>
-				<view class="section-content">
-					<view class="feature-item">
-						<text class="feature-icon">📱</text>
-						<text class="feature-text">扫码支付:扫描二维码进行支付</text>
-					</view>
-					<view class="feature-item">
-						<text class="feature-icon">💰</text>
-						<text class="feature-text">数字键盘:支持金额输入和编辑</text>
-					</view>
-					<view class="feature-item">
-						<text class="feature-icon">💳</text>
-						<text class="feature-text">支付方式:支持支付宝支付</text>
-					</view>
-					<view class="feature-item">
-						<text class="feature-icon">✅</text>
-						<text class="feature-text">支付结果:实时显示支付状态</text>
-					</view>
-				</view>
-			</view>
-
-			<!-- 测试二维码 -->
-			<view class="demo-section">
-				<view class="section-title">测试二维码</view>
-				<view class="section-content">
-					<view class="qr-code-container">
-						<view class="qr-code">
-							<text class="qr-text">测试二维码</text>
-							<text class="qr-amount">¥99.99</text>
-						</view>
-						<view class="qr-info">
-							<text class="qr-desc">扫描此二维码测试支付功能</text>
-							<text class="qr-url">https://example.com/pay?orderId=ORDER123456&amount=99.99&description=测试订单&merchantId=MERCHANT001</text>
-						</view>
-					</view>
-				</view>
-			</view>
-
-			<!-- 操作按钮 -->
-			<view class="demo-section">
-				<view class="section-title">开始测试</view>
-				<view class="section-content">
-					<view class="button-group">
-						<button class="demo-btn primary" @click="startScan">
-							<text class="iconfont">📷</text>
-							<text>开始扫码</text>
-						</button>
-						<button class="demo-btn secondary" @click="goToPay">
-							<text class="iconfont">💳</text>
-							<text>直接支付</text>
-						</button>
-					</view>
-					<view class="button-group" style="margin-top: 20rpx;">
-
-					</view>
-				</view>
-			</view>
-
-			<!-- 测试数据 -->
-			<view class="demo-section">
-				<view class="section-title">测试数据</view>
-				<view class="section-content">
-					<view class="test-data">
-						<view class="data-item">
-							<text class="data-label">订单ID:</text>
-							<text class="data-value">ORDER123456</text>
-						</view>
-						<view class="data-item">
-							<text class="data-label">支付金额:</text>
-							<text class="data-value">¥99.99</text>
-						</view>
-						<view class="data-item">
-							<text class="data-label">订单描述:</text>
-							<text class="data-value">测试订单</text>
-						</view>
-						<view class="data-item">
-							<text class="data-label">商户ID:</text>
-							<text class="data-value">MERCHANT001</text>
-						</view>
-					</view>
-				</view>
-			</view>
-		</view>
-
-		<!-- 使用说明 -->
-		<view class="demo-footer">
-			<view class="footer-title">使用说明</view>
-			<view class="footer-content">
-				<text class="footer-text">1. 点击"开始扫码"进入扫码页面</text>
-				<text class="footer-text">2. 扫描上方测试二维码或选择相册图片</text>
-				<text class="footer-text">3. 确认订单信息后进入支付页面</text>
-				<text class="footer-text">4. 输入支付金额并选择支付方式</text>
-				<text class="footer-text">5. 完成支付并查看结果</text>
-			</view>
-		</view>
-	</view>
-</template>
-
-<script>
-export default {
-	name: 'DemoPage',
-	data() {
-		return {
-			testOrderData: {
-				orderId: 'ORDER123456',
-				amount: '99.99',
-				description: '测试订单',
-				merchantId: 'MERCHANT001'
-			}
-		}
-	},
-	methods: {
-		// 返回上一页
-		goBack() {
-			uni.navigateBack();
-		},
-
-		// 开始扫码
-		startScan() {
-			uni.navigateTo({
-				url: '/admin/ghs/scan'
-			});
-		},
-
-		// 直接进入支付页面
-		goToPay() {
-			uni.navigateTo({
-				url: `/admin/ghs/pay?amount=${this.testOrderData.amount}&orderId=${this.testOrderData.orderId}&description=${encodeURIComponent(this.testOrderData.description)}`
-			});
-		},
-
-		// 进入图标测试页面
-
-	}
-}
-</script>
-
-<style lang="scss" scoped>
-.demo-container {
-	min-height: 100vh;
-	background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
-	position: relative;
-}
-
-.nav-bar {
-	display: flex;
-	align-items: center;
-	justify-content: space-between;
-	padding: 20rpx 30rpx;
-	background: rgba(255, 255, 255, 0.1);
-	backdrop-filter: blur(10px);
-	
-	.nav-left, .nav-right {
-		width: 60rpx;
-		height: 60rpx;
-		display: flex;
-		align-items: center;
-		justify-content: center;
-	}
-	
-	.nav-title {
-		color: #fff;
-		font-size: 36rpx;
-		font-weight: 600;
-	}
-	
-	.icon-back {
-		color: #fff;
-		font-size: 40rpx;
-	}
-}
-
-.demo-content {
-	padding: 40rpx 30rpx;
-}
-
-.demo-section {
-	background: rgba(255, 255, 255, 0.95);
-	border-radius: 20rpx;
-	margin-bottom: 30rpx;
-	overflow: hidden;
-	
-	.section-title {
-		padding: 30rpx;
-		font-size: 32rpx;
-		font-weight: 600;
-		color: #333;
-		border-bottom: 1rpx solid #f0f0f0;
-	}
-	
-	.section-content {
-		padding: 30rpx;
-	}
-}
-
-.feature-item {
-	display: flex;
-	align-items: center;
-	margin-bottom: 20rpx;
-	
-	&:last-child {
-		margin-bottom: 0;
-	}
-	
-	.feature-icon {
-		font-size: 40rpx;
-		margin-right: 20rpx;
-	}
-	
-	.feature-text {
-		font-size: 28rpx;
-		color: #666;
-	}
-}
-
-.qr-code-container {
-	display: flex;
-	flex-direction: column;
-	align-items: center;
-	
-	.qr-code {
-		width: 300rpx;
-		height: 300rpx;
-		background: #f8f9fa;
-		border: 2rpx solid #e9ecef;
-		border-radius: 20rpx;
-		display: flex;
-		flex-direction: column;
-		align-items: center;
-		justify-content: center;
-		margin-bottom: 30rpx;
-		
-		.qr-text {
-			font-size: 24rpx;
-			color: #666;
-			margin-bottom: 10rpx;
-		}
-		
-		.qr-amount {
-			font-size: 48rpx;
-			font-weight: 700;
-			color: #667eea;
-		}
-	}
-	
-	.qr-info {
-		text-align: center;
-		
-		.qr-desc {
-			display: block;
-			font-size: 28rpx;
-			color: #333;
-			margin-bottom: 10rpx;
-		}
-		
-		.qr-url {
-			display: block;
-			font-size: 20rpx;
-			color: #999;
-			word-break: break-all;
-		}
-	}
-}
-
-.button-group {
-	display: flex;
-	gap: 20rpx;
-	
-	.demo-btn {
-		flex: 1;
-		height: 100rpx;
-		border-radius: 50rpx;
-		border: none;
-		font-size: 32rpx;
-		font-weight: 600;
-		display: flex;
-		align-items: center;
-		justify-content: center;
-		transition: all 0.3s ease;
-		
-		.iconfont {
-			margin-right: 10rpx;
-			font-size: 36rpx;
-		}
-		
-		&.primary {
-			background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
-			color: #fff;
-			
-			&:active {
-				transform: scale(0.98);
-			}
-		}
-		
-		&.secondary {
-			background: rgba(102, 126, 234, 0.1);
-			color: #667eea;
-			border: 2rpx solid #667eea;
-			
-			&:active {
-				transform: scale(0.98);
-			}
-		}
-		
-		&.tertiary {
-			background: rgba(255, 193, 7, 0.1);
-			color: #ffc107;
-			border: 2rpx solid #ffc107;
-			
-			&:active {
-				transform: scale(0.98);
-			}
-		}
-	}
-}
-
-.test-data {
-	.data-item {
-		display: flex;
-		align-items: center;
-		margin-bottom: 15rpx;
-		
-		&:last-child {
-			margin-bottom: 0;
-		}
-		
-		.data-label {
-			font-size: 28rpx;
-			color: #666;
-			width: 160rpx;
-		}
-		
-		.data-value {
-			font-size: 28rpx;
-			color: #333;
-			font-weight: 600;
-		}
-	}
-}
-
-.demo-footer {
-	position: fixed;
-	bottom: 0;
-	left: 0;
-	right: 0;
-	background: rgba(255, 255, 255, 0.95);
-	backdrop-filter: blur(10px);
-	padding: 30rpx;
-	border-top: 1rpx solid rgba(255, 255, 255, 0.2);
-	
-	.footer-title {
-		font-size: 32rpx;
-		font-weight: 600;
-		color: #333;
-		margin-bottom: 20rpx;
-	}
-	
-	.footer-content {
-		.footer-text {
-			display: block;
-			font-size: 24rpx;
-			color: #666;
-			line-height: 1.6;
-			margin-bottom: 8rpx;
-			
-			&:last-child {
-				margin-bottom: 0;
-			}
-		}
-	}
-}
-
-
-</style>

+ 0 - 516
hdh5/admin/ghs/scan.vue

@@ -1,516 +0,0 @@
-<template>
-	<view class="scan-container">
-		<!-- 顶部导航栏 -->
-		<view class="nav-bar">
-			<view class="nav-left" @click="goBack">
-				<text class="iconfont icon-back">&#xe679;</text>
-			</view>
-			<view class="nav-title">扫码支付</view>
-			<view class="nav-right">
-				<text class="iconfont icon-album" @click="chooseImage"></text>
-			</view>
-		</view>
-
-		<!-- 扫码区域 -->
-		<view class="scan-area">
-			<view class="scan-frame">
-				<view class="scan-line"></view>
-				<view class="scan-corners">
-					<view class="corner top-left"></view>
-					<view class="corner top-right"></view>
-					<view class="corner bottom-left"></view>
-					<view class="corner bottom-right"></view>
-				</view>
-			</view>
-			<view class="scan-tip">将二维码放入框内,即可自动扫描</view>
-		</view>
-
-		<!-- 底部操作区域 -->
-		<view class="bottom-actions">
-			<view class="action-item" @click="toggleFlash">
-				<view class="action-icon" :class="{ active: flashOn }">
-					<text class="iconfont icon-flashlight"></text>
-				</view>
-				<text class="action-text">{{ flashOn ? '关闭闪光灯' : '开启闪光灯' }}</text>
-			</view>
-			<view class="action-item" @click="chooseImage">
-				<view class="action-icon">
-					<text class="iconfont icon-album"></text>
-				</view>
-				<text class="action-text">相册</text>
-			</view>
-		</view>
-
-		<!-- 扫码结果弹窗 -->
-		<view class="scan-result-modal" v-if="showResultModal" @click="closeResultModal">
-			<view class="modal-content" @click.stop>
-				<view class="modal-header">
-					<text class="modal-title">扫码结果</text>
-					<text class="modal-close" @click="closeResultModal">×</text>
-				</view>
-				<view class="modal-body">
-					<view class="result-info">
-						<view class="result-item">
-							<text class="label">订单金额:</text>
-							<text class="value">¥{{ scanResult.amount || '0.00' }}</text>
-						</view>
-						<view class="result-item" v-if="scanResult.description">
-							<text class="label">订单描述:</text>
-							<text class="value">{{ scanResult.description }}</text>
-						</view>
-						<view class="result-item" v-if="scanResult.merchantId">
-							<text class="label">商户ID:</text>
-							<text class="value">{{ scanResult.merchantId }}</text>
-						</view>
-					</view>
-				</view>
-				<view class="modal-footer">
-					<button class="modal-btn cancel" @click="closeResultModal">取消</button>
-					<button class="modal-btn confirm" @click="goToPay">确认支付</button>
-				</view>
-			</view>
-		</view>
-	</view>
-</template>
-
-<script>
-import { parseScanResult } from '@/api/payment';
-
-export default {
-	name: 'ScanPage',
-	data() {
-		return {
-			flashOn: false,
-			showResultModal: false,
-			scanResult: {},
-			scanning: false
-		}
-	},
-	onLoad() {
-		this.startScan();
-	},
-	onUnload() {
-		this.stopScan();
-	},
-	methods: {
-		// 返回上一页
-		goBack() {
-			uni.navigateBack();
-		},
-
-		// 开始扫码
-		startScan() {
-			// #ifdef APP-PLUS
-			this.startCameraScan();
-			// #endif
-			
-			// #ifdef H5
-			this.startH5Scan();
-			// #endif
-		},
-
-		// 停止扫码
-		stopScan() {
-			// #ifdef APP-PLUS
-			if (this.cameraContext) {
-				this.cameraContext.stopRecord();
-			}
-			// #endif
-		},
-
-		// APP端扫码
-		startCameraScan() {
-			// #ifdef APP-PLUS
-			uni.scanCode({
-				success: (res) => {
-					this.handleScanResult(res.result);
-				},
-				fail: (err) => {
-					console.error('扫码失败:', err);
-					uni.showToast({
-						title: '扫码失败',
-						icon: 'none'
-					});
-				}
-			});
-			// #endif
-		},
-
-		// H5端扫码
-		startH5Scan() {
-			// H5端需要用户手动选择图片进行扫码
-			uni.showToast({
-				title: '请点击相册选择二维码图片',
-				icon: 'none',
-				duration: 2000
-			});
-		},
-
-		// 处理扫码结果
-		handleScanResult(result) {
-			if (this.scanning) return;
-			this.scanning = true;
-
-			try {
-				// 解析扫码结果
-				const parsedResult = parseScanResult(result);
-				
-				if (parsedResult) {
-					this.scanResult = parsedResult;
-					this.showResultModal = true;
-				} else {
-					uni.showToast({
-						title: '无效的二维码',
-						icon: 'none'
-					});
-				}
-			} catch (error) {
-				console.error('处理扫码结果失败:', error);
-				uni.showToast({
-					title: '扫码失败',
-					icon: 'none'
-				});
-			} finally {
-				this.scanning = false;
-			}
-		},
-
-		// 选择图片
-		chooseImage() {
-			uni.chooseImage({
-				count: 1,
-				sizeType: ['compressed'],
-				sourceType: ['album'],
-				success: (res) => {
-					const tempFilePath = res.tempFilePaths[0];
-					this.scanImage(tempFilePath);
-				},
-				fail: (err) => {
-					console.error('选择图片失败:', err);
-					uni.showToast({
-						title: '选择图片失败',
-						icon: 'none'
-					});
-				}
-			});
-		},
-
-		// 扫描图片中的二维码
-		scanImage(imagePath) {
-			// #ifdef APP-PLUS
-			uni.scanCode({
-				scanType: ['qrCode'],
-				path: imagePath,
-				success: (res) => {
-					this.handleScanResult(res.result);
-				},
-				fail: (err) => {
-					console.error('图片扫码失败:', err);
-					uni.showToast({
-						title: '未识别到二维码',
-						icon: 'none'
-					});
-				}
-			});
-			// #endif
-
-			// #ifdef H5
-			// H5端模拟扫码结果
-			setTimeout(() => {
-				const mockResult = 'https://example.com/pay?orderId=ORDER123456&amount=99.99&description=测试订单&merchantId=MERCHANT001';
-				this.handleScanResult(mockResult);
-			}, 1000);
-			// #endif
-		},
-
-		// 切换闪光灯
-		toggleFlash() {
-			this.flashOn = !this.flashOn;
-			// #ifdef APP-PLUS
-			if (this.cameraContext) {
-				this.cameraContext.toggleTorch({
-					success: () => {
-						console.log('闪光灯状态切换成功');
-					},
-					fail: (err) => {
-						console.error('闪光灯切换失败:', err);
-					}
-				});
-			}
-			// #endif
-		},
-
-		// 关闭结果弹窗
-		closeResultModal() {
-			this.showResultModal = false;
-			this.scanResult = {};
-		},
-
-		// 跳转到支付页面
-		goToPay() {
-			this.closeResultModal();
-			
-			// 跳转到支付页面,传递扫码结果
-			uni.navigateTo({
-				url: `/admin/ghs/pay?amount=${this.scanResult.amount || '0.00'}&orderId=${this.scanResult.orderId || ''}&description=${encodeURIComponent(this.scanResult.description || '')}`
-			});
-		}
-	}
-}
-</script>
-
-<style lang="scss" scoped>
-.scan-container {
-	min-height: 100vh;
-	background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
-	position: relative;
-}
-
-.nav-bar {
-	display: flex;
-	align-items: center;
-	justify-content: space-between;
-	padding: 20rpx 30rpx;
-	background: rgba(255, 255, 255, 0.1);
-	backdrop-filter: blur(10px);
-	
-	.nav-left, .nav-right {
-		width: 60rpx;
-		height: 60rpx;
-		display: flex;
-		align-items: center;
-		justify-content: center;
-	}
-	
-	.nav-title {
-		color: #fff;
-		font-size: 36rpx;
-		font-weight: 600;
-	}
-	
-	.icon-back, .icon-album {
-		color: #fff;
-		font-size: 40rpx;
-	}
-}
-
-.scan-area {
-	flex: 1;
-	display: flex;
-	flex-direction: column;
-	align-items: center;
-	justify-content: center;
-	padding: 100rpx 40rpx;
-	
-	.scan-frame {
-		width: 500rpx;
-		height: 500rpx;
-		position: relative;
-		margin-bottom: 60rpx;
-		
-		.scan-line {
-			position: absolute;
-			top: 0;
-			left: 0;
-			width: 100%;
-			height: 4rpx;
-			background: linear-gradient(90deg, transparent, #00ff00, transparent);
-			animation: scanMove 2s linear infinite;
-		}
-		
-		.scan-corners {
-			position: absolute;
-			top: 0;
-			left: 0;
-			width: 100%;
-			height: 100%;
-			
-			.corner {
-				position: absolute;
-				width: 60rpx;
-				height: 60rpx;
-				border: 6rpx solid #00ff00;
-				
-				&.top-left {
-					top: 0;
-					left: 0;
-					border-right: none;
-					border-bottom: none;
-				}
-				
-				&.top-right {
-					top: 0;
-					right: 0;
-					border-left: none;
-					border-bottom: none;
-				}
-				
-				&.bottom-left {
-					bottom: 0;
-					left: 0;
-					border-right: none;
-					border-top: none;
-				}
-				
-				&.bottom-right {
-					bottom: 0;
-					right: 0;
-					border-left: none;
-					border-top: none;
-				}
-			}
-		}
-	}
-	
-	.scan-tip {
-		color: rgba(255, 255, 255, 0.8);
-		font-size: 28rpx;
-		text-align: center;
-	}
-}
-
-.bottom-actions {
-	position: fixed;
-	bottom: 100rpx;
-	left: 0;
-	right: 0;
-	display: flex;
-	justify-content: space-around;
-	padding: 0 60rpx;
-	
-	.action-item {
-		display: flex;
-		flex-direction: column;
-		align-items: center;
-		
-		.action-icon {
-			width: 100rpx;
-			height: 100rpx;
-			border-radius: 50%;
-			background: rgba(255, 255, 255, 0.2);
-			display: flex;
-			align-items: center;
-			justify-content: center;
-			margin-bottom: 20rpx;
-			transition: all 0.3s ease;
-			
-			&.active {
-				background: rgba(255, 255, 255, 0.4);
-			}
-			
-			.iconfont {
-				color: #fff;
-				font-size: 50rpx;
-			}
-		}
-		
-		.action-text {
-			color: rgba(255, 255, 255, 0.8);
-			font-size: 24rpx;
-		}
-	}
-}
-
-.scan-result-modal {
-	position: fixed;
-	top: 0;
-	left: 0;
-	right: 0;
-	bottom: 0;
-	background: rgba(0, 0, 0, 0.5);
-	display: flex;
-	align-items: center;
-	justify-content: center;
-	z-index: 999;
-	
-	.modal-content {
-		background: #fff;
-		border-radius: 20rpx;
-		width: 600rpx;
-		overflow: hidden;
-		
-		.modal-header {
-			display: flex;
-			align-items: center;
-			justify-content: space-between;
-			padding: 40rpx;
-			border-bottom: 1rpx solid #f0f0f0;
-			
-			.modal-title {
-				font-size: 36rpx;
-				font-weight: 600;
-				color: #333;
-			}
-			
-			.modal-close {
-				font-size: 50rpx;
-				color: #999;
-				cursor: pointer;
-			}
-		}
-		
-		.modal-body {
-			padding: 40rpx;
-			
-			.result-info {
-				.result-item {
-					display: flex;
-					align-items: center;
-					margin-bottom: 20rpx;
-					
-					&:last-child {
-						margin-bottom: 0;
-					}
-					
-					.label {
-						font-size: 28rpx;
-						color: #666;
-						width: 160rpx;
-					}
-					
-					.value {
-						font-size: 28rpx;
-						color: #333;
-						font-weight: 600;
-					}
-				}
-			}
-		}
-		
-		.modal-footer {
-			display: flex;
-			padding: 0 40rpx 40rpx;
-			
-			.modal-btn {
-				flex: 1;
-				height: 80rpx;
-				border-radius: 40rpx;
-				border: none;
-				font-size: 32rpx;
-				margin: 0 10rpx;
-				
-				&.cancel {
-					background: #f0f0f0;
-					color: #666;
-				}
-				
-				&.confirm {
-					background: #667eea;
-					color: #fff;
-				}
-			}
-		}
-	}
-}
-
-@keyframes scanMove {
-	0% {
-		transform: translateY(0);
-	}
-	100% {
-		transform: translateY(500rpx);
-	}
-}
-
-
-</style>

+ 1 - 21
hdh5/pages.json

@@ -13,17 +13,7 @@
 		{
 			"path": "admin/ghs/pay",
 			"style": {
-				"navigationBarTitleText": "扫码付款",
-				"navigationStyle": "custom",
-				"h5": {
-					"titleNView": false
-				}
-			}
-		},
-		{
-			"path": "admin/ghs/scan",
-			"style": {
-				"navigationBarTitleText": "扫码支付",
+				"navigationBarTitleText": "付款",
 				"navigationStyle": "custom",
 				"h5": {
 					"titleNView": false
@@ -39,16 +29,6 @@
 					"titleNView": false
 				}
 			}
-		},
-		{
-			"path": "admin/ghs/demo",
-			"style": {
-				"navigationBarTitleText": "演示页面",
-				"navigationStyle": "custom",
-				"h5": {
-					"titleNView": false
-				}
-			}
 		}
 	],
 	"globalStyle": {