<template>
	<!-- 编辑综合运输 -->
	<view class="edit_synth">
		<view class="top_box">
			<view class="top_con">
				<view class="edit_item">
					<p class="left">填报日期</p>
					<!-- <p class="right">{{roadData.statisticalDate}}</p> -->
					<view class="right">
						<p>{{synthData.reportDate}}</p>
						<uni-datetime-picker type="date" v-model="synthData.reportDatetime">
							<image style="width: 49rpx;height: 49rpx;" src="../../static/icons/number-box.png" mode=""></image>
						</uni-datetime-picker>
					</view>
				</view>
				<view class="edit_item">
					<p class="left">班次</p>
					<p class="right">{{roadData.shifts}}</p>
				</view>
				<view class="edit_item">
					<p class="left">人数（万）</p>
					<p class="right">{{synthData.people}}</p>
				</view>
			</view>
		</view>
		<view class="bottom_box">
			<p class="btn_item" @click="cancelEdit">取消</p>
			<p class="btn_item" @click="confirmRoad">确认</p>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				roadTime:[],
				unitData:[],
				synthData:{
					reportPhase:'',
					reportDatetime:'',
					trafficOperationDescription:''
				}
			}
		},
		onLoad(options) {
			let row = JSON.parse(options.item);
			console.log(row)
			this.synthData = row;
			this.synthData.reportDatetime = this.synthData.reportDatetime ? this.synthData.reportDatetime.substring(0,10) : ''
			this.getRoadTime()
		},
		methods: {
			// 获取时段
			getRoadTime(){
				this.$request(getApp().globalData.baseUrl + '/api/dict/dictList?dictType=airport_time&_t=1693372307694',"GET").then(res =>{
					this.roadTime = res.data
				})
			},
			// 点击确认按钮
			confirmRoad(){
				let params = this.synthData;
				uni.showModal({
					title:"提示",
					content:"您确定，提交修改吗？",
					success:(res) =>{
						if(res.confirm){
							this.$request(getApp().globalData.baseUrl + '/api/biz/roadtransport/operation/saveOrUpdate',params,'POST').then(res =>{
								if(res.code == 200){
									uni.showToast({
										title:'修改成功',
										icon:"none"
									});
									uni.navigateBack()
								}
							})
						}else if(res.cancel){}
					}
				})
			},
			// 点击取消按钮
			cancelEdit(){
				uni.navigateBack()
			},
			
			onchange(e){
				console.log('确定===》',e)
			},
			onnodeclick(e){
				console.log('点击===》',e)
			}
		}
	}
</script>

<style lang="scss" scoped>
	.edit_synth{
		width: 100%;
		height: 100%;
		
		.top_box{
			padding-bottom: 160rpx;
			margin-top: 30rpx;
			height:100%;
			
			.top_con{
				width: 690rpx;
				height: 84%;
				overflow-y: auto;
				padding: 30rpx 0;
				display: flex;
				flex-direction: column;
				margin: 0 auto;
				background-color: #fff;
				border-radius: 20rpx;
				
				.edit_item{
					width: 100%;
					display: flex;
					justify-content: space-between;
					margin-bottom: 30rpx;
					align-items: center;
					
					&:last-child{
						margin-bottom: 0;
					}
					
					.left{
						margin-left: 30rpx;
					}
					.right{
						margin-right: 30rpx;
						display: flex;
						align-items: center;
					}
				}
			}
		}
		.bottom_box{
			width: 100%;
			height: 150rpx;
			position: fixed;
			bottom: 0;
			display: flex;
			justify-content: center;
			align-items: center;
			
			.btn_item{
				width: 320rpx;
				height: 78rpx;
				background: #FFFFFF;
				border-radius: 40rpx;
				border: 1rpx solid #D73232;
				display: flex;
				align-items: center;
				justify-content: center;
				font-size: 26rpx;
				color: #D73232;
				
				&:last-child {
					background: #D73232;
					margin-left: 50rpx;
					color: #FFFFFF;
				}
			}
		}
	}

</style>
