<template>
</template>

<script setup lang="ts">
	import { onLoad } from "@dcloudio/uni-app";
	import { reactive } from "vue";
	const state = reactive({
		qdOrderNo: "", //渠道订单编号
		orderId: "",
		isPay: "",
		openId: "",
		id: "",
		clientFee: "",
		code: "",
		token: ""
	});
	onLoad((option : any) => {
		state.orderId = option.orderId;
		state.qdOrderNo = option.qdOrderNo;
		state.isPay = option.isPay;
		state.token = option.token;
		state.openId = option.openId;
		console.log("option1111111111", option)
		if (state.isPay == "1") {
			// 为1时跳转到2小程序支付
			my.navigateToMiniProgram({
				appId: '2021004124602167', // 16 位
				path: `/subpackage/orders/payment/payment?qdOrderNo=${state.qdOrderNo}&openId=${state.openId}&token=${state.token}&type=3&orderId=${state.orderId}&isPay=${state.isPay}`,
				query: {
					a: 'foo',
					b: 'bar',
				},
				envVersion: "develop",
				extraData: {
					x: {
						y: 'z',
					},
				},
				success: function (res) {
					console.log(res);
				},
				fail: function (err) {
					console.log(err);
				}
			});
		} else {
			const param = `https://qtzl.etcjz.cn/order/#/pages/payment/payment?qdOrderNo=${state.qdOrderNo}&type=3`
			const params = encodeURIComponent(JSON.stringify(param))
			console.log('支付结果查询params', params)
			uni.navigateTo({
				url: `/subpackage/personal-center/webview?url=` + params
			})
		}

	});
</script>

<style>
</style>