<template>
	<view>
		<view class="cn">
			<u-steps :list="numList" :current="current"></u-steps>
			<view class="info">
				<view class="form_group hr">
					<view class="lable">商铺名称</view>
					<input type="text" placeholder="请输入商铺名称" v-model="item.name" />
				</view>
				<view class="form_group hr">
					<view class="lable">商铺地址</view>
					<input type="text" placeholder="请输入商铺地址" v-model="item.addres" />
				</view>
				<view class="form_group hr">
					<view class="lable">老板名称</view>
					<input type="text" placeholder="请输入老板名称" v-model="item.bossName" />
				</view>
				<view class="form_group hr">
					<view class="lable">老板电话</view>
					<input type="number" placeholder="请输入老板电话" v-model="item.bossPhone" />
				</view>
				<view class="form_group hr">
					<view class="lable">商铺简介</view>
					<textarea placeholder="请输入商铺简介" v-model="item.briefContent" />
				</view>
			</view>
			<button class="btn" @click="up()">申请开通</button>
		</view>
	</view>
</template>

<script>
export default {
	data() {
		return {
			numList: [{ name: '申请开通' }, { name: '资料审核' }, { name: '商家入驻' }],
			current: 0,
			item: {}
		};
	},
	methods: {
		up() {
			let rule = [
				{ name: 'name', checkType: 'notnull', errorMsg: '请输入商铺名称' },
				{ name: 'addres', checkType: 'notnull', errorMsg: '请输入商铺地址' },
				{ name: 'bossName', checkType: 'notnull', errorMsg: '请输入老板名称' },
				{ name: 'bossPhone', checkType: 'notnull', errorMsg: '请输入老板电话' }
			];
			if (!this.$verify.check(this.item, rule)) {
				uni.showModal({ content: this.$verify.error, showCancel: false });
				return;
			}
			this.$http.request({
				method: 'POST',
				url: this.$http.urls.shopApply,
				data: this.item,
				success: res => {
					uni.showToast({ title: '提交成功' });
					setTimeout(() => {
						uni.navigateBack();
					}, 700);
				}
			});
		}
	}
};
</script>

<style lang="scss">
.steps {
	text-align: center;
	margin-top: 20px;
}
.cn {
	padding: 15px;
	.info {
		background-color: white;
		border-radius: 5px;
		margin-top: 10px;
		box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
	}
	.btn {
		margin-top: 25px;
	}
}
</style>
