<template>
	<view class="container">
		
		<view class="step">
			<uni-steps active-color="#FF6A69" :options="[
			{title: '注册账号',url:'./getShop'},
			{title: '扫码授权',url:'./qrCode'},
			{title: '提交支付资质',url:'./addPay'}, 
			{title: '基础信息',url:'./basics'} ]" :active="0"></uni-steps>
		</view>
		<view  style="height: 130rpx;"></view>
		<form @submit="onSubmit">
			<view class="content">
	
				<view class="item flex flex-y-center">
					<view class="title-block required">
						<text>微信号:</text>
					</view>
					<view class="desc">
						<input type="text" :value="info.wx_name" name="wx_name" class="input-box" placeholder="请输入微信号"
							placeholder-class="desc-placeholder">
					</view>
				</view>

				<view class="item flex flex-y-center">
					<view class="title-block required">
						<text>身份证姓名:</text>
					</view>
					<view class="desc">
						<input type="text" :value="info.id_card_name" name="id_card_name" class="input-box" placeholder="请输入身份证姓名"
							placeholder-class="desc-placeholder">
					</view>
				</view>
				
				<view class="item flex flex-y-center">
					<view class="title-block required">
						<text>身份证号:</text>
					</view>
					<view class="desc">
						<input type="text" :value="info.id_card_number" name="id_card_number"
							class="input-box" placeholder="请输入身份证号" placeholder-class="desc-placeholder">
					</view>
				</view>

				<view class="item flex flex-y-center">
					<view class="title-block required">
						<text>开通类型:</text>
					</view>
					<view class="desc ft30 flex-grow-1 box-pack-between" @click="onPrinterStatusChange">
						<text></text>
						<view class="flex-y-center">
							{{codeStatus}}
							<text class="iconfont icongengduo"></text>
						</view>
					</view>
				</view>
			</view>
			
			<button class="sub-btn" hover-class="none" form-type="submit">
				立即提交
			</button>
			
		</form>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				info: {},
				ali_arr: [
					'关闭', '开启'
				],
				is_coupon: 0,
				setColor: "",
				code_type: 1,
				codeStatus: '整店打包（开通小商店）',
			}
		},

		onLoad() {
			this.getdata();
		},

		methods: {
			onPrinterStatusChange() {
				let statusArr = ['整店打包（开通小商店）', '组件开放（开通小程序，并且已经完整的嵌入电商功能）',]
				uni.showActionSheet({
					itemList: statusArr,
					success: (r) => {
						console.log(r.tapIndex)
						this.code_type = Number(r.tapIndex) + 1
						this.codeStatus = statusArr[r.tapIndex]
					}
				})
			},

			bindColor(e) {
				this.setColor = e.detail.value;
			},

			choicemenber(index) {
				this.is_coupon = index;
			},

			getdata(e) {
				this.request({
					url: "Wechatstore/wechat_info_list",
					data: {
						admin_id: uni.getStorageSync("admin_id")
					},
				}).then(res => {
					console.log(res, "res")
					if (res.code === '200') {
						this.info = res.data;
						this.code_type = res.data.api_openstore_type;
						this.codeStatus = res.data.api_openstore_type == 1 ? '整店打包（开通小商店）' : res.data.api_openstore_type == 2 ? '组件开放（开通小程序，并且已经完整的嵌入电商功能）' :
							'';
					}
				});
			},

			onSubmit(e) {
				let data = e.detail.value;
				data.admin_id = uni.getStorageSync("admin_id");
				data.api_openstore_type = this.code_type;
				this.request({
					url: "Wechatstore/register_shop",
					data: data,
				}).then(res => {
					if (res.code == 200) {
						uni.showToast({
							title: res.message,
							icon: 'none'
						})
						setTimeout(() => {
							uni.redirectTo({
								url:'./qrCode'
							})
						}, 2000)
					}
				}).catch((res) => {
					uni.showToast({
						title: res.message,
						icon: 'none'
					})
				})
			},

		}
	}
</script>

<style>
	page {
		background-color: #F4F5F7;
	}

	.item {
		background-color: #FFF;
		padding: 0 25rpx;
	}

	.title-block {
		margin-right: 20rpx;
	}

	.desc {
		text-align: right;
		flex: 1;
		padding: 25rpx 0;
		border-bottom: 1rpx solid #F1F1F1;
	}

	.rund {
		width: 40rpx;
		height: 40rpx;
	}

	.red {
		color: red;
		padding: 10rpx 25rpx;
		font-size: 26rpx;
	}

	.sub-btn {
		width: 690rpx;
		height: 100rpx;
		background: linear-gradient(315deg, #FF6A69 2%, #FF6A69 99%);
		border-radius: 8rpx;
		box-shadow: 0px 0px 8rpx 0px rgba(51, 135, 255, 0.20);
		text-align: center;
		line-height: 100rpx;
		color: #fff;
		font-size: 36rpx;
		font-weight: bold;
		margin: 0 auto;
		margin-top: 30px;
	}

	.checklist-box {
		display: -webkit-box;
		display: -webkit-flex;
		display: flex;
		-webkit-box-orient: horizontal;
		-webkit-box-direction: normal;
		-webkit-flex-direction: row;
		flex-direction: row;
		-webkit-box-align: center;
		-webkit-align-items: center;
		align-items: center;
		margin: 5px 0;
		margin-right: 22px;
	}

	.radio__inner {
		-webkit-flex-shrink: 0;
		flex-shrink: 0;

		display: -webkit-box;
		display: -webkit-flex;
		display: flex;

		-webkit-box-pack: center;
		-webkit-justify-content: center;
		justify-content: center;
		-webkit-box-align: center;
		-webkit-align-items: center;
		align-items: center;
		position: relative;
		border: 1px solid #DCDFE6;
		border-radius: 2px;
		box-sizing: border-box;
		width: 16px;
		height: 16px;
		border-radius: 16px;
		background-color: #fff;
		z-index: 1;
		-webkit-transition: border-color .3s;
		transition: border-color .3s;
	}

	.radio__inner-icon {
		width: 8px;
		height: 8px;
		border-radius: 10px;
		opacity: 0;
		-webkit-transition: -webkit-transform .3s;
		transition: -webkit-transform .3s;
		transition: transform .3s;
		transition: transform .3s, -webkit-transform .3s;
	}

	.is-default-checked {
		opacity: 1;
		background-color: #FF6A69;
		-webkit-transform: rotate(45deg) scaleY(1);
		transform: rotate(45deg) scaleY(1);
	}

	.act_border {
		border: 1rpx solid #FF6A69;
	}

	.checklist-text {
		font-size: 28rpx;
		margin-left: 5px;
		-webkit-transition: color 0.2s;
		transition: color 0.2s;
		color: #000;
	}
</style>
