<template>
	<view class="process">
		<view class="process-header">
			<view class="process-header-text">
				<view class="process-header-text-icon" @click="topgi">
					<image src="https://cdn.bjtdba.com/vod/image/2022-08-11/20220811133828415.png" mode="widthFix">
					</image>
				</view>
				<view class="process-header-text-title">
					店铺入驻
				</view>
			</view>
		</view>
		<view class="process-zhuti">
			<!-- 提交资料 -->
			<view class="process-audit" v-if="submitCode == 1">
				<image class="process-auditimg" src="https://cdn.bjtdba.com/vod/image/2022-08-22/20220822183048362.png"
					mode=""></image>
				<view class="process-audittitle">恭喜，您的资料提交成功！</view>
				<view class="process-auditintroduce">预计15个工作日内审核完毕，平台客服会及时与您联系！</view>
			</view>
			<!-- 审核中 -->
			<view class="process-audit" v-else-if="submitCode == 3">
				<image class="process-auditimg" src="https://cdn.bjtdba.com/vod/image/2022-08-22/20220822182939278.png"
					mode=""></image>
				<view class="process-audittitle">店铺审核中！</view>
				<view class="process-auditintroduce">提交日期：{{selectmerchant.merchantIntention.create_time}}，5个工作日内审核完毕！
				</view>
			</view>
			<!-- 审核失败 -->
			<view class="process-audit" v-else>
				<image class="process-auditimg" src="https://cdn.bjtdba.com/vod/image/2022-08-22/20220822183146760.png"
					mode=""></image>
				<view class="process-audittitle">审核失败</view>
				<view class="process-auditintroduce">原因：{{selectmerchant.merchantIntention.check_result}}</view>
				<view class="process-audit-update" @click="amendMerchants">点击修改信息</view>
			</view>
			<view class="process-audit-service">
				<view class="process-audit-serviceimg">
					<image src="https://cdn.bjtdba.com/vod/image/2022-09-02/20220902132546705.png" mode="widthFix">
					</image>
				</view>
				<view class="process-audit-servicetext">专属客服微信</view>
			</view>
		</view>

	</view>
</template>

<script>
	import {
		selectMerchant
	} from '@/commit/api.js'
	export default {
		data() {
			return {
				value: 0,
				submitCode: 1,
				selectmerchant: [],
				authorization: ""
			}
		},
		onLoad(opsition) {
			uni.showLoading({
				title: '加载中',
				mask: true
			});
			this.submitCode = opsition.submitCode;
			this.selectmerchant = uni.getStorageSync('selectmerchant')
			setTimeout(function() {
				uni.hideLoading();
			}, 700);
		},
		onShow() {
			let userinfo = uni.getStorageSync('userinfo')
			this.authorization = uni.getStorageSync('authorization')
			this.panduanshuhju(userinfo.uid)
		},

		methods: {
			panduanshuhju(e) {
				selectMerchant({
					uid: e
				}).then(data => {
					if (data.data.status == 200) {
						let selectmerchant = data.data.data
						uni.setStorageSync('selectmerchant', selectmerchant)
						if (this.authorization && e) {
							if (selectmerchant.merId >= 0 && selectmerchant.status == -1) {
								uni.redirectTo({
									url: "/openmerchant/guide/index" //有或者没有商户 没有金额支付and激活码支付
								});
								return
							} else if (selectmerchant.merId > 0 && (selectmerchant.status == 1 || selectmerchant.status == 5)) {
								uni.switchTab({
									url: '/pages/cashier/index' //已开通商户
								});
								return
							} else if (selectmerchant.merId >= 0 && (selectmerchant.status == 3 || selectmerchant.status == 4)) {
								uni.redirectTo({
									url: '/openmerchant/shopentry/process?mer_id=' + selectmerchant
										.merId //已开通商户未填写资料
								});
								return
							}
						} else {
							uni.redirectTo({
								url: "/pages/user/login/index"
							});
						}
					}
				}, fail => {
					uni.showToast({
						title: fail,
						icon: "none"
					})
				}).catch(err => {
					console.log(err)
				})
			},
			topgi() {
				uni.showToast({
					title: "请耐心等待...",
					icon: "none"
				});
			},
			amendMerchants() {
				this.$store.commit('changeMerchantsStatus', 1);
				uni.navigateTo({
					url: './process?mer_id=' + this.selectmerchant.merId + '&is=' + 1
				});
			}
		}
	}
</script>

<style>
	page {
		background-color: #F7F8FC;
	}
</style>
<style lang="scss" scoped>
	.process {
		width: 100%;
		height: 100%;
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;

		.process-header {
			position: fixed;
			top: 0;
			left: 0;
			z-index: 111;
			width: 100%;
			height: 176rpx;
			background: #FFFFFF;
			display: flex;
			justify-content: center;

			.process-header-text {
				width: 686rpx;
				font-size: 36rpx;
				font-weight: 500;
				color: #333333;
				display: flex;
				margin-top: 107rpx;
				align-items: center;

				.process-header-text-icon {
					width: 36rpx;
					height: 36rpx;
					margin-right: 26rpx;
					line-height: 36rpx;

					image {
						width: 100%;
						height: 100%;
					}
				}
			}
		}

		.process-zhuti {
			width: 100%;
			height: 100%;
			position: fixed;
			top: 0;
			left: 0;
			margin-top: 202rpx;
			display: flex;
			flex-direction: column;
			align-items: center;
			// padding: 32rpx 0 40rpx;
			padding-bottom: 40rpx;
			background: #FFFFFF;
			text-align: center;

			.process-audit {
				padding: 0 97rpx 0 98rpx;

				.process-auditimg {
					margin: 101rpx 0 20rpx 0;
					width: 199rpx;
					height: 226rpx;
				}

				.process-audittitle {
					font-size: 38rpx;
				}

				.process-auditintroduce {
					font-size: 28rpx;
					color: #B6B6B6;
					margin-top: 70rpx;
				}

				.process-audit-update {
					width: 330rpx;
					height: 98rpx;
					line-height: 98rpx;
					color: #FFFFFF;
					background: #1F7CFF;
					margin: auto;
					margin-top: 108rpx;
				}
			}

			.process-audit-service {
				.process-audit-serviceimg {
					width: 210rpx;
					height: 210rpx;
					margin: 50rpx 0 20rpx 0;

					image {
						width: 100%;
						height: 100%;
					}
				}
			}
		}
	}
</style>
