<template>
	<view class="wrap">
		<view class="dropdown content1">
			<view class="right" @click='show1=true'>
				<view>{{status}}</view>
				<u-icon name="arrow-right"></u-icon>
				<u-picker @confirm="statuschange" range-key='name' mode="selector" v-model="show1"
					:range="statusList"></u-picker>
			</view>
		</view>
		<view class="content2">
			<view class="content2-item" v-for="(item,index) in dataList" @click="goDetail(item)">
				<view style='padding:20px 5px 13px;border-bottom:1px solid #EEEEEE;' class="row">
					<view style='font-size:14px;' class="left">{{item.processNo}}</view>
					<view style='color:#22C572;'>{{item.tranType}}</view>
				</view>
				<view style='font-size:13px;' class="row">
					<view style='color:#9698A2;' class="left">{{item.goodsName}}</view>
					<view>{{item.weight}}</view>
				</view>
				<view style='font-size:14px;' class="row">
					<view style='flex:1;color:#9698A2;' class="left">发货</view>
					<view style='flex:2;text-align:right;'>{{item.send}}</view>
				</view>
				<view style='font-size:14px;' class="row">
					<view style='flex:1;color:#9698A2;' class="left">收货</view>
					<view style='flex:2;text-align:right;'>{{item.receive}}</view>
				</view>
				<view style='font-size:14px;' class="row">
					<view style='flex:1;color:#9698A2;' class="left">运输周期</view>
					<view style='flex:2;text-align:right;'>{{item.deliveryDateStart}} ~ {{item.deliveryDateEnd}}</view>
				</view>
				<view style='font-size:14px;' class="row">
					<view style='flex:1;color:#9698A2;' class="left">{{item.feedbackStatus}}</view>
					<view style='flex:2;text-align:right;'>{{item.createDate}}</view>
				</view>
			</view>
		</view>
		<view v-show="isContent">
			<uni-load-more :status="loadStatus"></uni-load-more>
		</view>
	</view>
</template>

<script>
	import helper from '@/common/helper.js';
	export default {
		data() {
			return {
				show1: false,
				show2: false,
				currentPage: 1,
				pageSize: 10,
				positionId: "",
				isContent:false,
				binNumber: "",
				status: '执行中',
				positionName: '',
				statusList: [
					{name:'执行中',value:1},
					{name:'已完货',value:2},
					{name:'全部任务',value:3},
				],
				feedbackFlag:1,
				dataList: [],
				allWarehouse: [],
				showTime: ''
			}
		},
		onLoad() {
			this.positionId = helper.erpWarehouse.positionId
			this.warehouseId = helper.erpWarehouse.warehouseId
		},
		onShow() {
			let _data = helper.erpWarehouse
			this.warehouseList = _data.allWarehouse
			this.warehouseCWList = _data.warehouseCWList
			this.binNumber = _data.binNumber
			this.positionId = _data.positionId
			this.warehouseId = _data.warehouseId
			this.getList()
		},
		onReachBottom() {
			 this.currentPage+=1
		    this.getList(false)
			// this.getMoreNews()
		},
		methods: {
			getList() {
				this.$api.doRequest('get', '/tranProcessInfo/selectTranProcessInfo', {
					feedbackFlag: this.feedbackFlag,
					currentPage: this.currentPage,
					pageSize: this.pageSize
				}).then(res => {
					if (res.data.code == 200) {
						var data=res.data.data.records
						this.dataList = this.dataList.concat(data)
						if(res.data.data.records.length==0){
							this.isContent=true
						}
					}
				})
			},
			statuschange(e) {
				this.status = this.statusList[e[0]].name
				this.getList()
			},
			goDetail(val) {
				uni.navigateTo({
					url: '/pages/erp/deliveryfeedback/details?id=' + val.id,
				})
			}
		}
	}
</script>

<style scoped lang="scss">
	.dropdown {
		display: flex;
		margin: 20rpx 0;
		justify-content: space-between;

		.left,
		.right {
			display: flex;
			align-items: center;
		}
	}

	.content1 {
		padding: 40rpx 20rpx;
		margin: 20rpx;
		border-radius: 10rpx;
		background: #FFFFFF;
	}

	.content2 {
		// background: white;
		margin:10px 0;
		border-radius:10px;
		.row {
			display: flex;
			justify-content: space-between;
			// border-bottom: 1px solid #EEEEEE;
			padding: 18rpx 10rpx;

			.right,
			input {
				font-size: 28rpx;
				color: #333333;
			}
		}

		.row-bottom {
			.right-bottom {
				width: 300rpx;
				text-align: right;
			}
		}
	}

	.content2-item {
		// margin: 0 20rpx 20rpx 20rpx;
		margin:10px;
		background:#fff;
		padding:0 20rpx;
		border-radius:10px;
		border-bottom: 1px solid #EEEEEE;
	}
	.content2-item:last-child{
		border-bottom: 1px solid transparent;
	}
	.no-boder {
		border-bottom: none !important;
	}
	.bold{
		font-size:18px;
		font-weight:600;
	}
</style>
