<template>
	<view class="shiftDetails">
		<view class="container">
			<custom-tabs type="c1" :value="value" @change="changeIndex">
				<custom-tab-pane label="工班信息" name="c1_1">
					<view></view>
					<view class="ul">
						<view class="li">
							<p>船名：</p>
							<text>{{shipInfo.voyageScheduleDataList[0].spmName}}</text>
						</view>
						<view class="li">
							<p>航次：</p>
							<text>{{shipInfo.voyageScheduleDataList[0].vvyName}}</text>
						</view>
						<view class="li">
							<p>进出口：</p>
							<text>{{shipInfo.voyageScheduleDataList[0].importExportFlagName}}</text>
						</view>
						<view class="li">
							<p>贸易类型：</p>
							<text>{{shipInfo.voyageScheduleDataList[0].tradeTypeName}}</text>
						</view>
						<view class="li">
							<p>装卸类型：</p>
							<text> {{dataInfo.loadTypeName}}</text>
						</view>
					</view>
					<view class="ul bUl borTop" v-for="(item,index) in dataInfo.shiftList" :key="index + 'a'">
						<view class="li">
							<p>工班：</p>
							<text> {{item.gbTextValue}}</text>
						</view>
						<view class="li">
							<p>作业时间：</p>
							<text> {{item.startTime}} - {{item.endTime}}</text>
						</view>
						<view class="ul bUl" v-for="(item2,index2) in item.ulList2" :key="index2 + 'b'">
							<view class="li">
								<p>车型：</p>
								<text>{{item2.cxTextValue}}</text>
							</view>
							<view class="li">
								<p>数量：</p>
								<text>{{item2.numValue}}</text>
							</view>
							<view class="li wLi">
								<p>备注：</p>
								<text>{{item2.notes}}</text>
							</view>
						</view>
					</view>
				</custom-tab-pane>
				<custom-tab-pane label="翻仓信息" name="c1_2">
					<view class="fcInfo" v-for="(item,index) in dataInfo.fcList" :key="index + 'fc'">
						<view class="fcBox">
							<p>翻舱类型：</p>
							<text>{{item.fcTextValue}}</text>
						</view>
						<view class="ul" v-for="(item2,index2) in item.fcUlList2" :key="index2 + 'info'">
							<view class="li">
								<p>航次：</p>
								<text>{{shipInfo.voyageScheduleDataList[0].vvyName}}</text>
							</view>
							<view class="li">
								<p>翻舱起点：</p>
								<text>{{item2.qdValue}}</text>
							</view>
							<view class="li">
								<p>翻舱终点：</p>
								<text>{{item2.zdValue}}</text>
							</view>
							<view class="li">
								<p>作业时间：</p>
								<text>{{item2.startTime}} - {{item2.endTime}}</text>
							</view>
							<view class="li">
								<p>数量：</p>
								<text>{{item2.numValue}}</text>
							</view>
							<view class="li">
								<p>体积：</p>
								<text>{{item2.tjValue}}</text>
							</view>
							<view class="li">
								<p>重量：</p>
								<text>{{item2.zlValue}}</text>
							</view>
						</view>
					</view>
				</custom-tab-pane>
				<custom-tab-pane label="其他信息" name="c1_3">
					<view class="otherInfo">
						<p class="title">辅助作业</p>
						<view class="ul">
							<view class="li">
								<p>技术工人：</p>
								<text>{{dataInfo.otherList.jsWorker}}</text>
							</view>
							<view class="li">
								<p>普通工人：</p>
								<text>{{dataInfo.otherList.ptworker}}</text>
							</view>
							<view class="li">
								<p>作业时间：</p>
								<text>{{dataInfo.otherList.startTime}} - {{dataInfo.otherList.endTime}}</text>
							</view>
							<view class="li">
								<p>重量：</p>
								<text>{{dataInfo.otherList.zlValue}}</text>
							</view>
							<view class="li">
								<p>体积：</p>
								<text>{{dataInfo.otherList.tjValue}}</text>
							</view>
							<view class="li wLi">
								<p>描述：</p>
								<text>{{dataInfo.otherList.describe}}</text>
							</view>
						</view>
						<p class="title">待工作业</p>
						<view class="ul">
							<view class="li wLi">
								<p>描述：</p>
								<text>{{dataInfo.otherList.dgWork}}</text>
							</view>
						</view>
						<p class="title">作业备注</p>
						<view class="ul">
							<view class="li wLi">
								<p>描述：</p>
								<text>{{dataInfo.otherList.notes}}</text>
							</view>
						</view>
					</view>
				</custom-tab-pane>
			</custom-tabs>
			<uni-popup ref="popup" type="dialog">
				<uni-popup-dialog type="error" confirmText="确定" title="通知" content="是否删除此条数据"
					@confirm="delConfirm"></uni-popup-dialog>
			</uni-popup>
			<view class="btnList">
				<van-button type="default" @click="cancel">取消</van-button>
				<van-button type="danger" @click="del">删除</van-button>
				<van-button type="info" @click="edit('edit')">编辑</van-button>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				value: 0,
				shipInfo: {
					voyageScheduleDataList: [{
						spmName: "",
						importExportFlagName: "",
						tradeTypeName: ""
					}]
				},
				dataInfo: {
					otherList: {}
				},
				shiftRowIndex: 0,
			}
		},
		mounted() {
			this.shipInfo = uni.getStorageSync('shipInfo')
			this.dataInfo = uni.getStorageSync('shiftRow')
			this.shiftRowIndex = uni.getStorageSync('shiftRowIndex')
		},
		methods: {
			changeIndex(e) {
				// console.log('选中:', e)
			},
			// 取消
			cancel() {
				uni.setStorageSync('tabsType', 1);
				uni.navigateTo({
					url: '/pages/shipWork/mixWork'
				})
			},
			// 弹框删除
			delConfirm() {
				let addShiftArr = uni.getStorageSync('addShiftArr')
				addShiftArr.splice(this.shiftRowIndex, 1)
				uni.setStorageSync('addShiftArr', addShiftArr);
				uni.setStorageSync('tabsType', 1);
				uni.navigateTo({
					url: '/pages/shipWork/mixWork'
				})
			},
			// 删除
			del() {
				this.$refs.popup.open()
			},
			// 编辑
			edit(state) {
				this.obj = {
					state: state
				};
				const params = encodeURIComponent(JSON.stringify(this.obj));
				uni.navigateTo({
					url: `/pages/shipWork/shiftAdd?params=${params}`
				})
			},
			onBackPress(event) {
				uni.setStorageSync('tabsType', 1);
				uni.navigateTo({
					url: '/pages/shipWork/mixWork'
				})
				return true;
			},
		}
	}
</script>

<style lang="less" scoped>
	.shiftDetails {
		.container {
			padding: 30px 20px;
			background-color: #fff;

			.fcInfo {
				padding-bottom: 20px;
				border-bottom: 1px solid #ccc;

				.fcBox {
					display: flex;
					padding: 10px 20px;
					line-height: 35px;
					font-size: 16px;
				}
			}

			.otherInfo {
				.title {
					margin: 20px 0;
					font-size: 16px;
					font-weight: bold;
					padding-left: 10px;
					border-left: 5px solid #2979ff;
				}
			}

			.ul {
				display: flex;
				justify-content: space-between;
				flex-wrap: wrap;

				.li {
					width: 45%;
					display: flex;
					padding: 10px 20px;
					line-height: 35px;
					font-size: 16px;

					p {
						min-width: 85px;
						text-align: right;
					}
				}

				.wLi {
					width: calc(100% - 150px);
				}
			}

			.bUl {
				width: 100%;
			}

			.borTop {
				border-top: 1px solid #999;
			}

			.borBtm {
				border-bottom: 1px solid #999;
			}

			.btnList {
				display: flex;
				justify-content: center;
				margin-top: 20px;

				/deep/ .van-button {
					margin: 30px 20px;
					width: 120px;
					height: 50px;
				}
			}
		}
	}
</style>