<template>
	<view class="container">
		<form @submit="onSubmit">
			<view class="page-block">
				<view class="content">
					<view class="cell flex flex-y-center box-pack-between">
						<view class="title-block required">
							<text>合伙人:</text>
						</view>
						<navigator url="./userList" class="">
							{{user_name}}
							<text class="iconfont icongengduo"></text>
						</navigator>
					</view>
					
					<view class="cell flex flex-y-center">
						<view class="title-block required">
							<text>合伙人等级:</text>
						</view>
						<view class="desc">
							<picker mode="selector" :range="tableTypeList" range-key="name"
								@change="onTableTypeChange">
								<view class="box-pack-between">
									<text>{{tableTypeActive}}</text>
									<text class="iconfont icongengduo"></text>
								</view>
							</picker>
						</view>
					</view>


					<view class="cell flex flex-y-center">
						<view class="title-block">
							<text>结算方式:</text>
						</view>
						<view class="desc">
							<input type="text"  name="content" class="input-box" 
								placeholder="请输入结算方式" placeholder-class="desc-placeholder">
						</view>
					</view>
					
					
				</view>
			</view>

			<view class="footer-bar">
				<view class="content flex flex-center" style="background: none;">
					<button class="btn" hover-class="none" form-type="submit">
						立即添加
					</button>
				</view>
			</view>


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

<script>
	export default {
		data() {
			return {
				level_id: "",
				info: {},
				type: 2,
				user_name:'选择用户',
				user_id:'',
				admin_id: '',
				tableTypeList:[],
				tableTypeActive:'',
			}
		},

		onLoad(e) {
			this.admin_id = uni.getStorageSync("admin_id");
			this.shop_store_index();
		},
		
		methods: {
			
			shop_store_index() {
				this.request({
					url: 'Smdcshop/shared_users_level',
					data: {
						admin_id:this.admin_id,
					}
				}).then(res => {
					if (res.code == 200) {
						this.tableTypeList = res.data;
					}
				})
			},

			onTableTypeChange(e) {
				this.tableTypeActive = this.tableTypeList[e.detail.value].name;
				this.level_id = this.tableTypeList[e.detail.value].id
			},

			choicepay(e) {
				this.sex = e;
			},


			onSubmit(e) {
				let params = e.detail.value,
					url;
				params.admin_id=this.admin_id;
				params.level = this.level_id;
				params.user_id = this.user_id;
					url = "Smdcshop/shared_users_add";
				if (!params.user_id || !params.level ) {
					uni.showToast({
						title: "必须不能为空",
						icon: 'none'
					})
					return false
				}
				this.request({
					url: url,
					data: params
				}).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;
	}

	.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: #007aff;
		-webkit-transform: rotate(45deg) scaleY(1);
		transform: rotate(45deg) scaleY(1);
	}

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

	.act_border {
		border: 1rpx solid #007aff;
	}
	
	/*  */
		.page-block {}
	
		.page-block .page-title-block {
			padding: 20rpx 25rpx;
		}
	
		.page-block .page-title-block .title {
			font-size: 28rpx;
			line-height: 40rpx;
			color: #999;
		}
	
		.page-block .content {
			padding: 0 25rpx;
			background-color: #fff;
		}
	
		.page-block .cell {
			min-height: 100rpx;
			border-bottom: 1rpx solid #f5f5f5;
		}
	
		.page-block .cell:last-child {
			border-bottom: none;
		}
	
		.page-block .cell .title-block {
			min-width: 155rpx;
			flex: none;
			font-size: 30rpx;
			color: #333;
			font-weight: 600;
			padding-right: 20rpx;
		}
	
		.page-block .cell .required::after {
			content: "*";
			color: #f00;
		}
	
		.page-block .cell .desc {
			flex: auto;
			height: 100%;
		}
		.page-block .cell .desc .desc-info{
			padding:30rpx 0;
			font-size: 28rpx;
			color: #999;
			line-height: 40rpx;
		}
	
		.page-block .cell .input-box {
	
			height: 100rpx;
			line-height: 100rpx;
			font-size: 28rpx;
			/* color: #999; */
		}
	
		.page-block .radio-btn {
			zoom: 0.7;
		}
	
		.page-block .radio-text {
			margin: 0 40rpx 0 8rpx;
			font-size: 28rpx;
			color: #999;
		}
	
		/*  */
		.footer-bar {
			height: 160rpx;
			/*兼容 IOS<11.2*/
			padding-bottom: constant(safe-area-inset-bottom);
			/*兼容 IOS>11.2*/
			padding-bottom: env(safe-area-inset-bottom);
			box-sizing: content-box;
		}
	
		.footer-bar .content {
			width: 100%;
			height: 160rpx;
			background-color: #fff;
			position: fixed;
			left: 0;
			bottom: 0;
			z-index: 100;
			/*兼容 IOS<11.2*/
			padding-bottom: constant(safe-area-inset-bottom);
			/*兼容 IOS>11.2*/
			padding-bottom: env(safe-area-inset-bottom);
			box-sizing: content-box;
			box-shadow: 0 -5rpx 10rpx #eee;
			
		}
	
		.footer-bar .content .btn {
			width: 700rpx;
			height: 100rpx;
			background: linear-gradient(315deg, #3387ff 2%, #569bff 99%);
			border-radius: 8rpx;
			box-shadow: 0rpx 0rpx 8rpx 0rpx rgba(51, 135, 255, 0.20);
			text-align: center;
			line-height: 100rpx;
			font-size: 36rpx;
			font-weight: 500;
			color: #fff;
		}
		.footer-bar .content .detail-btn {
			width: 50%;
			height: 40rpx;
		
		}
		
		.footer-bar .content .detail-btn .btn-icon {
			flex: none;
			display: block;
			width: 32rpx;
			height: 32rpx;
			margin-right: 8rpx;
		
		}
	
</style>
