<template>
	<view class="wuliu">
		<uni-nav-bar left-icon="left" title="物流详情" color="#000000" backgroundColor="transparent" :fixed="true"
			:statusBar="true" :border="false" @clickLeft="back"></uni-nav-bar>

		<view class="status">
			<view class="status_image">
				<image :src="imgurl.goodslist_imgurl"></image>
				<!-- <view class="status_foot">共{{ imgurl.count }}件商品</view> -->
			</view>
			<view>
				<view class="sta_1">
					物流状态：
					<text>{{ imgurl.delivery_status }}</text>
				</view>
				<view class="sta_2">快递公司：{{ imgurl.courier_name }}</view>
				<view class="sta_3 flex align-center">
					快递单号：{{ imgurl.courier_number }}
					<!-- <text @click="copy(imgurl.courier_number)">复制</text> -->
					<image @click="copy(imgurl.courier_number)" :src="$img1('shangdai/copy.png')" mode="widthFix"
						style="width: 28rpx; height: 28rpx; margin-left: 20rpx;"></image>
				</view>
			</view>
		</view>

		<view v-if="tracesData.length > 0" class="news_z">
			<view v-for="(item, index) in tracesData" :key="index" class="con">
				<view class="con_l">
					<view :class="index == 0 ? 'yuan2' : 'yuan'">
						<!-- <view v-if="index == 0" class="yuan3"></view> -->
					</view>
				</view>
				<view class="con_r" :style="index == 0 ? 'color:#fff' : 'color:#ccc'">
					<view class="title" :style="index == 0 ? 'font-size:28rpx' : ''">
						{{ item.status }}
					</view>
					<view class="time" :style="index == 0 ? 'color:#fff' : 'color:#ccc'">
						{{ item.time }}
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import { getLogistics } from '@/common/server/warehouse.js';
	
	export default {
		data() {
			return {
				tracesData: [],
				imgurl: {}
			}
		},
		onLoad(e) {
			this.getData(e.id)
		},
		methods: {
			back() {
				uni.navigateBack()
			},

			async getData(e) {
				const res = await getLogistics(e);
				if (res.status == 1) {
					this.imgurl = res.data
					this.tracesData = res.data.delivery_list
				}
			},
			copy(value) {
				uni.setClipboardData({
					data: value, //要被复制的内容
					success: () => {
						//复制成功的回调函数
						uni.showToast({
							//提示
							title: '复制成功'
						})
					}
				})
			}
		}
	}
</script>

<style lang="scss">
	.qiehuan_line {
		margin: -10rpx auto;
		width: 30rpx;
		height: 20rpx;
		border-bottom: 2rpx solid #ff7514;
		border-radius: 2rpx;
	}

	.news_z {
		width: 690rpx;
		margin: 20rpx auto 0;
		background: #3B3941;
	}

	.yuan3 {
		width: 24rpx;
		height: 24rpx;
		background: #1ff7f0;
		border-radius: 50%;
	}

	.yuan2 {
		background: #d0d1ff;
		width: 24rpx;
		height: 24rpx;
		border-radius: 50%;
		display: flex;
		align-items: center;
		justify-content: center;
	}

	.time {
		color: #ffffff;
		margin-top: 20rpx;
	}

	.con_l {
		width: 120rpx;
		display: flex;
		justify-content: center;
		align-items: center;
		/* border: 1px solid red; */
	}

	.title {
		/* color: rgba(255, 255, 255, 0.6); */
		line-height: 36rpx;
	}

	.con_r {
		width: 600rpx;
		font-size: 24rpx;
		border-bottom: 1rpx solid #666666;
		padding: 20rpx 0;
		margin-right: 20rpx;
		box-sizing: border-box;
	}

	.yuan {
		width: 24rpx;
		height: 24rpx;
		background: #666666;
		border-radius: 50%;
	}

	.con {
		display: flex;
		align-items: center;
		width: 100%;

		&:last-child {
			.con_r {
				border: 0;
			}
		}
	}

	.sta_3 text {
		font-size: 20rpx;
		margin-left: 24rpx;
		padding: 2rpx 10rpx;
		color: #ffffff;
		border: 1px solid;
	}

	.sta_2,
	.sta_3 {
		font-size: 24rpx;
		color: #8A8A8A;
		margin-top: 24rpx;
	}

	.sta_1 {
		font-size: 28rpx;
		color: #333333;
		font-weight: 500;
		margin-top: 10rpx;
	}

	.status_foot {
		position: absolute;
		bottom: 0;
		left: 0;
		font-size: 24rpx;
		color: #ffffff;
		border-radius: 0 0 10rpx 10rpx;
		background: rgba(0, 0, 0, 0.8);
		width: 100%;
		height: 40rpx;
		text-align: center;
	}

	.status image {
		width: 170rpx;
		height: 170rpx;
		border-radius: 10rpx;
	}

	.status_image {
		width: 170rpx;
		height: 170rpx;
		margin-right: 34rpx;
		border-radius: 10rpx;
		position: relative;
	}

	.status {
		width: 690rpx;
		margin: 20rpx auto 0;
		background: #FFFFFF;
		border-radius: 20rpx;
		padding: 30rpx 24rpx 30rpx 24rpx;
		box-sizing: border-box;
		display: flex;
	}

	.wuliu {
		width: 100vw;
		background: #F7F7F7;
		min-height: 100vh;
		padding-top: 2rpx;
		padding-bottom: 100rpx;
		box-sizing: border-box;
		position: relative;
		background-attachment: fixed;
		background-size: 100vw 100vh;
	}
</style>