<template>
	<!-- 运单详情 -->
	<view>
		<u-navbar title="" autoBack placeholder></u-navbar>
		<view class="card_order_detail">
			<view class="orderNumber">
				<view class="card_order_title">
					<span>运单号:</span>{{orderList.waybillNo}}
				</view>
				<span class="card_state"
					:style="{color:getState(orderList.status)}">{{orderStatus(orderList.status)}}</span>
			</view>
			<view class="title_delivery">收件人:</view>
			<x-orderCard :list="consigneeList"></x-orderCard>
			<view class="title_delivery">配送人:</view>
			<x-orderCard :list="delivererList" :deliverer="false"></x-orderCard>
			<view class="title_delivery">复核人:</view>
			<x-orderCard :list="senderList" :deliverer="false"></x-orderCard>
			<view class="card_humiture">
				<view class="title_claim" v-if="orderList.coolerBox.id">
					<span>保温箱:</span>
					<view style="width: auto;">
						<u-tag :text="orderList.coolerBox.name" plain size="mini" type="success"></u-tag>
					</view>
				</view>
				<view class="title_claim">
					<span>冰排:</span>
					<view style="width: auto;margin-left: 10rpx;" v-for="(item1,index1) in orderList.iceRaftCode">
						<u-tag :text="item1" plain size="mini"></u-tag>
					</view>
				</view>
				<!-- <view class="card_ice_list" v-if="orderList.iceRaftCode">
					<view class="card_ice_item" v-for="(item1,index1) in orderList.iceRaftCode">
						<view style="display: flex;align-items: center;">
							<span class="iconfont icon-bingpaiguanli icon_ice"></span>
							<view class="ice_title">冰排12</view>
						</view>
						<view class="ice_code">{{item1}}</view>
					</view>
				</view> -->
				<view class="card_anti_dismantle" v-if="orderList.tamperProofLabelImg">
					<span>防拆标签图片:</span>
					<view style="display: flex;">
						<view style="margin-right: 20rpx;" v-for="(item,index) in getimagetamper(orderList)"
							:key="index">
							<u-image radius="4" :showLoading="true" :src="item" width="80px" height="80px"></u-image>
						</view>
					</view>
				</view>
				<view class="title_claim" v-if="orderList.tamperProofLabel">
					<span>防拆标签码:</span>
					<view style="width: auto;font-size: 28rpx;">
						{{orderList.tamperProofLabel}}
					</view>
				</view>
				<view class="title_claim"><span>备注:</span>{{orderList.remark}}</view>
			</view>
			<view class="card_examine" v-if="orderList.status != 1">
				<view class="examine_title center_in">
					<view class="line_back" @click="logistics">查看物流详情</view>
				</view>
				<view class="examine_title center_in">
					<view class="line_back" @click="goHumiture">查看温湿度</view>
				</view>
			</view>
			<view class="card_humiture1" v-if="orderList.status == 8">
				<view class="order_iamge_item" v-for="(item,index) in srcList" :key="index">
					<u-image :showLoading="true" :src="item.url" width="80px" height="80px" radius="2"></u-image>
					<view class="order_item_title">{{item.title}}</view>
				</view>
			</view>
			<!-- <view v-if="orderList.status != 1">
				<view class="line_back" style="margin-top: 40rpx;" @click="logistics">查看物流详情</view>
				<view class="line_back" @click="goHumiture">查看温湿度</view>
			</view> -->
			<view style="width: 100%;height: 80rpx;"></view>
		</view>
		<!-- <view class="btn_print" v-if="type == 'details' && orderList.status == 2 || orderList.status == 3">
			<u-button type="primary" text="打印条码"></u-button>
		</view> -->
	</view>
</template>

<script>
	export default {
		data() {
			return {
				type: 'details',
				delivererList: {
					name: '',
					phone: '',
				},
				senderList: {
					name: '',
					phone: '',
				},
				consigneeList: {
					name: '',
					phone: '',
					address: '',
				},
				orderList: {},
				srcList: [{
					title: '运单签收图片',
					url: '',
				}, {
					title: '随货通行单图片',
					url: '',
				}, {
					title: '冷链交接单图片',
					url: '',
				}],
				userInfo: {},
			}
		},
		onLoad(value) {
			var userInfo = this.$cache.getCache('userInfo')
			this.userInfo = userInfo
			this.type = value.type
		},
		onShow() {
			var orderList = this.$cache.getCache('orderDetails')
			this.orderList = orderList
			this.senderList.name = orderList.reCheck.nickName
			this.senderList.phone = orderList.reCheck.phone
			this.consigneeList.name = orderList.consigneeAddressName
			this.consigneeList.phone = orderList.consigneeAddressPhone
			this.consigneeList.address = orderList.consigneeAddressDetails
			this.delivererList.name = orderList.delivery.nickName
			this.delivererList.phone = orderList.delivery.phone
			if (orderList.status == 8) {
				const arr = orderList.ReceiptImg.split(',')
				this.srcList[0].url = arr[0]
				this.srcList[1].url = arr[1]
				this.srcList[2].url = arr[2]
			}
		},
		methods: {
			// 物流详情
			logistics() {
				uni.navigateTo({
					url: '/pages/order/logisticsDetails'
				});
			},
			// 温湿度记录
			goHumiture() {
				uni.navigateTo({
					url: '/pages/order/humiture'
				});
			},
			// 运单状态
			orderStatus(value) {
				if (value == 3) {
					return '待配送'
				} else if (value == 4) {
					return '配送中'
				} else if (value == 5) {
					return '已送达'
				} else if (value == 6) {
					return '已拒收'
				}
			},
			// 运单文字颜色
			getState(value) {
				if (value == 3) {
					return '#9ddd54'
				} else if (value == 4) {
					return '#4bc7fc'
				} else if (value == 5) {
					return '#1cc723'
				} else if (value == 6) {
					return '#fe880e'
				}
			},
			getimagetamper(value) {
				let arr = value.tamperProofLabelImg.split(',')
				return arr
			}
		}
	}
</script>

<style lang="scss" scoped>
	.card_order_detail {
		margin: 20rpx;
	}

	.orderNumber {
		display: flex;
		justify-content: space-between;
		align-items: center;
		background-color: #fff;
		border-radius: 10rpx;
		padding: 15rpx;
	}

	.card_order_title {
		span {
			font-size: 28rpx;
			color: #909399;
			margin-right: 10rpx;
		}
	}

	.card_state {
		color: #606266;
		font-size: 30rpx;
	}

	.title_delivery {
		font-size: 30rpx;
		font-weight: 600;
		margin: 10rpx 0rpx 10rpx 10rpx;
	}

	.card_humiture {
		margin-top: 30rpx;
		// border-radius: 20rpx;
		padding: 1rpx 20rpx;
		background-color: #fff;
		border-top-right-radius: 10rpx;
		border-top-left-radius: 10rpx;
	}

	.card_humiture1 {
		display: flex;
		justify-content: space-around;
		align-items: center;
		flex-wrap: wrap;
		margin-top: 10rpx;
		border-radius: 10rpx;
		padding: 20rpx;
		background-color: #fff;
	}

	.order_iamge_item {
		display: flex;
		flex-direction: column;
		align-items: center;
	}

	.order_item_title {
		font-weight: 600;
		margin-top: 10rpx;
		font-size: 26rpx;
	}

	.title_claim {
		display: flex;
		margin: 20rpx 0rpx 6rpx 0rpx;

		span {
			display: flex;
			align-items: center;
			font-size: 28rpx;
			color: #909399;
			margin-right: 10rpx;
		}
	}

	.line_back {
		font-size: 30rpx;
		margin: 20rpx 0rpx;
		color: #3c9cff;
	}

	.card_anti_dismantle {
		display: flex;
		flex-direction: column;

		span {
			font-size: 28rpx;
			color: #909399;
			margin-bottom: 10rpx;
		}
	}

	.card_ice_list {
		display: flex;
		flex-direction: row;
		flex-wrap: wrap;
	}

	.card_ice_item {
		margin-right: 10rpx;
		margin-bottom: 10rpx;
		padding: 6rpx 10rpx;
		border-radius: 6rpx;
		border: 1rpx solid #e7e6e4;
	}

	.ice_title {
		font-size: 28rpx;
	}

	.icon_ice {
		font-size: 34rpx;
		color: #19be6b;
		margin-right: 5rpx;
	}

	.ice_code {
		font-size: 24rpx;
	}

	.card_examine {
		display: flex;
		align-items: center;
		border-top: 1rpx solid #e7e6e4;
		background-color: #fff;
		border-bottom-left-radius: 10rpx;
		border-bottom-right-radius: 10rpx;
	}

	.examine_title {
		flex: 1;
		height: 80rpx;
	}

	.examine_title:nth-child(1) {
		border-right: 1rpx solid #e7e6e4;
	}
</style>