<template>
	<page-container title="友达赏" :showBack="false">
		<img src="https://image.zfunbox.cn/icon/zfb-bj.png" style="width: 100vw;min-height: 100vh;" />
	</page-container>

</template>

<script>
import PageContainer from '@/components/page-container/page-container.vue'
import { createWebPayOrder } from '@/common/server/order'
import { platform } from '../../common/platform/PlatformFactory'

export default {
	components: {
		PageContainer
	},
	data() {
		return {
			order_num: ''
		}
	},
	onLoad(options) {
		console.log(options, "options");
		if (options.order_num) {
			this.order_num = options.order_num;
			this.load();
		}
	},
	methods: {
		isWeixin() {
			const ua = window.navigator.userAgent.toLowerCase();
			return ua.indexOf('micromessenger') !== -1;
		},
		async load() {
			// 判断是否在微信浏览器中
			if (this.isWeixin()) {
				return;
			}
			const res = await createWebPayOrder({
				order_num: this.order_num
			});
			console.log(res, "res");
			if (res.status == 1) {
				console.log(platform, 'status');
				const status = await platform.pay({
					data: res.data.res
				}, this);
			}
		},
	}
}
</script>

<style lang="scss" scoped></style>