<template>
	<view class="lists">
		<view class="status_bar" :style="navHeight">
		</view>
		<scroll-view class="scroll-area view" :scroll-top="scrollTop" show-scrollbar='false' scroll-y="true">
			<view class="main">
				<view class="middle view">
					<view class="text-block">
						<text class="middle-date">是否分流</text>
						<view class="middle-date-des uni-list picker-year">
							<view class="uni-list-cell">
								<view class="uni-list-cell-db">
									<picker class="picker-block" @change="bindPickerChange" :value="index"
										:range="array">
										<text class="uni-input">{{array[index]}}</text>
									</picker>
								</view>
							</view>
							<image class="icon-arrow" src="@/static/image/arrow_r@3x.png" mode=""></image>
						</view>
					</view>
					<view class="text-block">
						<text class="middle-date">分流经销商</text>
						<view class="middle-date-des uni-list picker-year">
							<view class="uni-list-cell">
								<view class="uni-list-cell-db">
									<picker class="picker-block" @change="bindPickerChange" :value="index"
										:range="array">
										<text class="uni-input">{{array[index]}}</text>
									</picker>
								</view>
							</view>
							<image class="icon-arrow" src="@/static/image/arrow_r@3x.png" mode=""></image>
						</view>
					</view>
					<view class="text-block text-block-last">
						<text class="middle-date">分流经渠道</text>
						<view class="middle-date-des uni-list picker-year">
							<view class="uni-list-cell">
								<view class="uni-list-cell-db">
									<picker class="picker-block" @change="bindPickerChange" :value="index"
										:range="array">
										<text class="uni-input">{{array[index]}}</text>
									</picker>
								</view>
							</view>
							<image class="icon-arrow" src="@/static/image/arrow_r@3x.png" mode=""></image>
						</view>
					</view>
				</view>

				<view class="middle view">
					<view class="text-block">
						<text class="middle-date">分流收货单位</text>
						<view class="middle-date-des uni-list picker-year">
							<view class="uni-list-cell">
								<view class="uni-list-cell-db">
									<picker class="picker-block" @change="bindPickerChange" :value="index"
										:range="array">
										<text class="uni-input">{{array[index]}}</text>
									</picker>
								</view>
							</view>
							<image class="icon-arrow" src="@/static/image/arrow_r@3x.png" mode=""></image>
						</view>
					</view>
					<view class="text-block">
						<text class="middle-date">收货单位</text>
						<view class="middle-date-des uni-list picker-year">
							<view class="uni-list-cell">
								<view class="uni-list-cell-db">
									<picker class="picker-block" @change="bindPickerChange" :value="index"
										:range="array">
										<text class="uni-input">{{array[index]}}</text>
									</picker>
								</view>
							</view>
							<image class="icon-arrow" src="@/static/image/arrow_r@3x.png" mode=""></image>
						</view>
					</view>
					<view class="text-block">
						<text class="middle-date">喷码单位</text>
						<view class="middle-date-des uni-list picker-year">
							<view class="uni-list-cell">
								<view class="uni-list-cell-db">
									<picker class="picker-block" @change="bindPickerChange" :value="index"
										:range="array">
										<text class="uni-input">{{array[index]}}</text>
									</picker>
								</view>
							</view>
							<image class="icon-arrow" src="@/static/image/arrow_r@3x.png" mode=""></image>
						</view>
					</view>
					<view class="text-block text-block-last">
						<text class="middle-date">收货联系人</text>
						<text class="middle-date-des">500,000.00</text>
					</view>
				</view>

				<view class="middle view">
					<view class="text-block">
						<text class="middle-date">联系人电话</text>
						<input class="middle-date-des" type="text" v-model="quantity" placeholder="请输入" />
					</view>
					<view class="text-block">
						<text class="middle-date">收货地址</text>
						<input class="middle-date-des" type="text" v-model="quantity" placeholder="请输入" />
					</view>
					<view class="text-block text-block-last">
						<text class="middle-date">备注</text>
					</view>
					<view class="remark">
						<textarea class="remark-text" v-model="remark" />
					</view>

					<view class="text-block title-first">
						<text class="middle-date title-first__text">上传文件</text>
					</view>
					<view class="upload-block">
						<uni-file-picker ref='files' :auto-upload='false' v-model="fileList" file-mediatype="image"
							:imageStyles="imageStyles" @select="select" @progress="progress" @success="success"
							@fail='fail'>
							<text>+</text>
						</uni-file-picker>
					</view>
				</view>

				<text class="receive-record">历史收货信息</text>
				<view class="middle view receive-record-view">
					<view class="text-block text-block-last receive-record-info">
						<text class="record-info-title">唐伟 133****9732</text>
						<text class="record-info-des">广东省云浮市罗定市银霄街294号</text>
					</view>
				</view>

				<view class="bottom-area"></view>
				<view class="bottom">
					<button class="btn btn-l" type="default" @tap="preStep">
						<text class="btn-text btn-text-l">上一步</text>
					</button>
					<button class="btn" type="default" @tap="nextStep">
						<text class="btn-text">提交</text>
					</button>
				</view>
			</view>
		</scroll-view>
	</view>
</template>

<script>
	import {
		mapState
	} from 'vuex'

	export default {
		data() {
			return {
				array: ['2021', '2020', '2019', '2018'],
				index: 0,
				quantity: '',
				remark: '',
				fileList: [],
				scrollTop: 0
			}
		},
		computed: {
			navHeight() {
				return {
					'height': `${this.sysinfo.safeArea.top + 44}px`
				}
			},
			imageStyles() {
				return {
					width: 64,
					height: 64,
					border: {
						radius: '50%'
					}
				}
			},
			...mapState(['sysinfo'])
		},
		methods: {
			bindPickerChange(e) {
				console.log('picker发送选择改变，携带值为', e.detail.value)
				this.index = e.detail.value
			},
			submit() {
				this.$emit('submit')
			},
			// 获取上传进度
			progress(e) {
				console.log('上传进度：', e)
			},
			// 选择文件
			select(e) {
				console.log('选择文件：', e)
			},
			// 上传成功
			success(e) {
				console.log('上传成功', e)
			},
			// 上传失败
			fail(e) {
				console.log('上传失败：', e)
			},
		}
	}
</script>

<style lang="scss" scoped>
	.view {
		flex-direction: column;
	}

	/* #ifndef APP-PLUS */
	page {
		width: 100%;
		min-height: 100%;
		display: flex;
		background: #fff;
	}

	.status_bar {
		height: var(--status-bar-height);
		background: #fff;
	}

	/* #endif */

	.lists {
		flex: 1;
		flex-direction: column;
		background: #f0f4f5;
		// overflow-y: scroll;
	}

	.scroll-area {
		flex: 1;
	}

	.main {
		margin: 0 16rpx;
		flex-direction: column;
		border-radius: 16rpx;
		margin-top: 16rpx;
	}

	.middle {
		background-color: #fff;
		border-radius: 16rpx;
		padding: 32rpx 64rpx 0 48rpx;
		margin-bottom: 16rpx;
	}

	.text-block {
		overflow: hidden;
		height: 96rpx;
		margin-bottom: 14rpx;
		border-bottom: 1px solid #f4f5f6;
	}

	.text-block-last {
		margin-bottom: 0;
		border-bottom: 0;
	}

	.middle-date {
		flex: 2;
		font-size: 28rpx;
		line-height: 96rpx;
		color: #999;
		margin-bottom: 8rpx;
	}

	.middle-date-des {
		flex: 3;
		font-size: 28rpx;
		height: 96rpx;
		line-height: 96rpx;
		color: $text-base-color;
	}

	.picker-year {
		position: relative;
		align-items: center;
		padding-left: 14rpx;
	}

	.uni-list-cell {
		flex: 1;
	}

	.uni-list-cell-db {
		flex: 1;
	}

	.picker-block {
		flex: 1;
	}

	.uni-input {
		font-size: 14px;
		color: $text-base-color;
	}

	.icon-arrow {
		position: absolute;
		right: 22rpx;
		top: 40rpx;
		width: 7px;
		height: 10px;
		z-index: 10;
	}

	.remark-text {
		flex: 1;
		height: 220rpx;
		background: #f5f6f7;
		border-radius: 4px;
		padding: 12rpx 18rpx;
		margin-bottom: 40rpx;
	}

	.title-first {
		border-bottom: 0;
	}

	.title-first__text {
		font-size: 28rpx;
		color: #333333;
		font-weight: 600;
	}

	.upload-block {
		display: flex;
		align-items: center;
		width: 188rpx;
		height: 188rpx;
		background: #f5f6f7;
		border: 1px dashed #dedede;
		border-radius: 4px;
		margin-bottom: 40rpx;
	}

	.uni-file-picker {
		width: 100%;
		height: 100%;
	}

	/deep/ .uni-file-picker__container {
		width: 100%;
		height: 100%;
	}

	.receive-record-view {
		padding: 40rpx 48rpx;
	}

	.receive-record {
		color: #555555;
		font-size: 28rpx;
		margin-bottom: 8rpx;
		margin-top: 32rpx;
	}

	.receive-record-info {
		display: flex;
		flex-direction: column;
		justify-content: center;
	}

	.record-info-title {
		color: #333;
		font-size: 28rpx;
		font-weight: 500;
		margin-bottom: 16rpx;
	}

	.record-info-des {
		color: #999;
		font-size: 24rpx;
	}

	.bottom-area {
		height: 140rpx;
		margin-top: 12rpx;
	}

	.bottom {
		position: fixed;
		bottom: 0;
		left: 0;
		z-index: 10;
		width: 750rpx;
		height: 140rpx;
		padding: 0 32rpx;
		justify-content: space-between;
		align-items: center;
	}

	.btn {
		flex: 1;
		height: 92rpx;
		background: $wly-primary-color;
		border-radius: 46rpx;
	}

	.btn-l {
		margin-right: 30rpx;
		border: 1px solid $wly-primary-color;
		background-color: transparent;

	}

	.btn-text {
		color: #fff;
		font-size: 34rpx;
	}

	.btn-text-l {
		color: $wly-primary-color;
	}
</style>
