<template>
	<view class="content">
		<view class="container">
			<headers :titles="titles"><uni-icons type="arrow-left" color="#fff" size="22px"></uni-icons></headers>
			<view class="top-img">
				<view class="">开通微信交易请使用微信扫描</view>
				<view class="">以下二维码完成</view>
				<image src="/static/imgs/wx1img.jpg" v-if="type == 'wx' "
					style="height: 300px;width:200px;margin-top: 10px;"></image>
				<image src="/static/imgs/zfbimg.png" v-if="type == 'zfb' "
					style="height: 250px;width:200px;margin-top: 10px;"></image>
			</view>
			<view class="anniu" @click="yes()">保存</view>
		</view>

	</view>
</template>

<script>
	import headers from '../../components/header/headers.vue'
	import tabbar from '../../components/tabbar/tabbar.vue'
	export default {
		data() {
			return {
				titles: "二维码",
				msg: "1",
				dataList: [],
				show: false,
				status: 'loading',
				type: ''
			}
		},
		onLoad(option) {
			this.type = option.type
		},
		onPullDownRefresh() {
			console.log("刷新");
			uni.stopPullDownRefresh()
		},
		onReachBottom() {
			// this.show = true
			setTimeout(() => {
				console.log("加载执行");
			}, 2000)
		},
		components: {
			headers,
			tabbar
		},
		methods: {
			yes() {
				if (this.type == 'wx') {
					uni.saveImageToPhotosAlbum({ //保存图片到系统相册。
						filePath: '/static/imgs/wximg.jpg', //图片文件路径
						success: function() {
							uni.showToast({
								title: '图片保存成功',
								icon: 'none',
							});
						},
						fail: function(e) {
							console.log(e);
							uni.showToast({
								title: '图片保存失败',
								icon: 'none',
							});
						}
					});

				} else {
					uni.saveImageToPhotosAlbum({ //保存图片到系统相册。
						filePath: '/static/imgs/zfbimg.png', //图片文件路径
						success: function() {
							uni.showToast({
								title: '图片保存成功',
								icon: 'none',
							});
						},
						fail: function(e) {
							console.log(e);
							uni.showToast({
								title: '图片保存失败',
								icon: 'none',
							});
						}
					});
				}

			},
			goback() {
				uni.navigateBack()
			}
		}
	}
</script>

<style scoped lang="scss">
	.content {
		background: #f4f5f6;
		height: 100vh;
	}

	.container {
		width: 100%;
		background: #f4f5f6;
		box-sizing: border-box;
		padding-top: 88px;
	}

	.top-img {
		width: 95%;
		margin: 15px auto;
		border-radius: 10px;
		box-sizing: border-box;
		padding: 10px;
		text-align: center;
		background: #fff;
	}

	.anniu {
		width: 50%;
		border-radius: 50px;
		background: #E4612E;
		height: 40px;
		color: #fff;
		display: flex;
		align-items: center;
		justify-content: center;
		margin: 15px auto;
	}
</style>
