From 8771da2ccf6f7c3fd2a8c89a1a0e230c6386db7f Mon Sep 17 00:00:00 2001
From: 石广澎 <shiguangpeng@163.com>
Date: 星期一, 17 十一月 2025 15:40:48 +0800
Subject: [PATCH] feat(api): 新增多个API接口并优化配置

---
 pages/pay/scanRes.vue |  116 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 116 insertions(+), 0 deletions(-)

diff --git a/pages/pay/scanRes.vue b/pages/pay/scanRes.vue
new file mode 100644
index 0000000..3e71035
--- /dev/null
+++ b/pages/pay/scanRes.vue
@@ -0,0 +1,116 @@
+<template>
+	<view>
+		<movable-area :style="'width: ' + windowWidth + 'px;height:' + windowHeight + 'px'">
+			<web-view :src="url">
+			</web-view>
+			<movable-view direction="all" x="553rpx" :y="windowHeight/2-hf" v-if="cid" @click="openPay" class="pay-btn">
+				<image class="pay-img" src="/static/pay-btn.jpeg" mode=""></image>
+			</movable-view>
+		</movable-area>
+
+	</view>
+</template>
+
+<script>
+	import {
+		ACCESSTOKEN,
+		config
+	} from '@/common/config.js';
+	import {
+		getWechatInfo,
+		getOpenId,
+		getOpenIdBase
+	} from '@/common/api/index'
+	export default {
+		data() {
+			return {
+				hf: uni.upx2px(81),
+				cid: '',
+				windowHeight: 724,
+				windowWidth: 0,
+				url: ''
+			};
+		},
+		onLoad(opt) {
+			let sysInfo = uni.getSystemInfoSync();
+			this.windowHeight = sysInfo.windowHeight;
+			this.windowWidth = sysInfo.windowWidth;
+			if (opt.cid) {
+				uni.setStorageSync('CID', opt.cid)
+				if (opt.cid == '1285474127884455937') {
+					this.url =
+						"https://fxm.xintoucloud.com/scene-user-fillin?sceneCode=DE88783ECF1D4DC2BCBF25A1A683651AFA4A9523573FF4080F2086B00E00E78A1235219708A15E8B223AAC2D243884DE"
+				} else if (opt.cid == '1586530233928945664') {
+					this.url =
+						"https://fxm.xintoucloud.com/scene-user-fillin?sceneCode=622C5D9E30E54D07BCB3BF280DBEE266F4C88598A368881C81D0D8CECA02C3DB1235219708A15E8B223AAC2D243884DE"
+				}
+				this.cid = opt.cid
+			}
+			if (opt.code) {
+				uni.showLoading()
+				getOpenId({
+					params: {
+						code: opt.code
+					}
+				}).then(res => {
+					uni.setStorageSync(ACCESSTOKEN, res.token.accessToken)
+					uni.setStorageSync('IS_NEW', res.isNew)
+					let url = '/pages/pay/scanpay?cid=' + this.cid
+					if (res.isNew) {
+						url = '/pages/pay/wxpay?cid=' + this.cid
+					}
+					uni.hideLoading()
+					uni.redirectTo({
+						url: url
+					})
+				}).catch(() => {
+					uni.hideLoading()
+				})
+			}
+		},
+		methods: {
+			openPay() {
+				const TOKEN = uni.getStorageSync(ACCESSTOKEN) || null;
+				if (TOKEN) {
+					const IS_NEW = uni.getStorageSync('IS_NEW') || null;
+					let url = '/pages/pay/scanpay?cid=' + this.cid
+					if (IS_NEW) {
+						url = '/pages/pay/wxpay?cid=' + this.cid
+					}
+					uni.redirectTo({
+						url: url
+					})
+				} else {
+					uni.showLoading()
+					getWechatInfo().then(res => {
+						const redirect_uri = encodeURIComponent(
+							`${config.webURL}/pages/pay/scanRes?cid=${this.cid}`)
+						window.location.href =
+							`https://open.weixin.qq.com/connect/oauth2/authorize?appid=${res}&redirect_uri=${redirect_uri}&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect`
+					})
+				}
+			}
+
+		}
+	}
+</script>
+
+<style lang="scss">
+	.pay-btn {
+		position: fixed;
+		z-index: 99999;
+		width: 162rpx;
+		height: 162rpx;
+		display: flex;
+		align-items: center;
+		justify-content: center;
+		color: #fff;
+		border-radius: 15rpx;
+		overflow: hidden;
+	}
+
+	.pay-img {
+		width: 162rpx;
+		height: 162rpx;
+	}
+</style>

--
Gitblit v1.9.1