<template>
	<view class="container">
		
		<view class="step">
			<uni-steps active-color="#07c160" 
			:options="options" :active="0"></uni-steps>
		</view>
		<view  style="height: 130rpx;"></view>
		
		<form @submit="onSubmit">
			
			<view class="content">
				
				<view class="content-tips">
					请商家法人先关注“微信公众平台安全助手”
				</view>
				
				<view class="item flex flex-y-center">
					<view class="title-block required">
						<text>企业名称:</text>
					</view>
					<view class="desc">
						<input type="text" :value="info.name" name="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.code" name="code" 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 class="item flex flex-y-center">
					<view class="title-block required">
						<text>法人微信号:</text>
					</view>
					<view class="desc">
						<input type="text" :value="info.legal_persona_wechat" name="legal_persona_wechat"
							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.legal_persona_name" name="legal_persona_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="number" :value="info.component_phone" name="component_phone" class="input-box"
							placeholder="请输入第三方联系电话" placeholder-class="desc-placeholder">
					</view>
				</view>

			</view>
			<button class="sub-btn" hover-class="none" form-type="submit">
				立即提交
			</button>

		</form>
	</view>
</template>

<script>
	import optionsData from './data.js'
	export default {
		data() {
			return {
				info: {},

				ali_arr: [
					'关闭', '开启'
				],
				is_coupon: 0,
				setColor: "",
				code_type: 1,
				codeStatus: '统一社会代码',
				options:optionsData.options
			}
		},

		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: "Smdcshop/xcx_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.code_type;
						this.codeStatus = res.data.code_type == 1 ? '统一社会代码' : res.data.code_type == 2 ? '组织机构代码' :
							'营业执照注册号';
					}
				});
			},

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

		}
	}
</script>

<style>
	page {
		background-color: #F4F5F7;
	}
	.content-tips{
		text-align: right;
		font-size: 26rpx;
		color: red;
		padding: 20rpx;
	}
	.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, #07c160 2%, #07c160 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: #07c160;
		-webkit-transform: rotate(45deg) scaleY(1);
		transform: rotate(45deg) scaleY(1);
	}

	.act_border {
		border: 1rpx solid #07c160;
	}

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