
<template>
  <view class="content">
    <view v-for="(item, index) in wlData"
          :key="index">
      <view class="tab">
        <view @click="isClick = index"
              class="tab_i">
          <view>{{'快递包裹'}}{{index+1 }}</view>
          <view :class="[isClick===index?'heng':'heng1']">
          </view>
        </view>
      </view>
      <view class="hui"></view>
      <view class="head_t">
        <view class="disflex">
          <img src="@/static/images/wl.png"
               alt="">
          <view>{{ item.expressName }}{{'快递包裹'}} {{ item.expressCode }}</view>
        </view>
        <view @click="onCopy(item.expressCode)">{{'复制'}}</view>
      </view>
      <view class="wl_tree"
            v-for="ctem,cndex in item.detailList"
            :key="cndex">
        <view class="zhong">
          <view :class="cndex==0?'red1':'qiu'"></view>
          <view class="gun"></view>
        </view>
        <view class="tree_r">
          <view :class="cndex==0?'red2':'tree_t'">{{ ctem.time }}</view>
          <view :class="cndex==0?'red3':'tree_t'">{{ ctem.context }}</view>
        </view>
      </view>
    </view>
  </view>
</template>

<script>
import * as api from '@/config/order.js'

export default {
  data() {
    return {
      wlData: [],
      isClick: 0,
    }
  },
  onLoad(options) {
    this.openWl(options.id)
  },
  onShow() {},
  methods: {
    openWl(id) {
      api.expressList(id).then((res) => {
        if (res.code == 200) {
          this.wlData = res.data
        }
      })
    },
    onCopy(code) {
      let text = code + ''
      this.$copyText(text).then((res) => {
        uni.showToast({
          title: '复制成功',
          icon: 'none',
        })
      })
    },
  },
}
</script>

<style lang="scss" scoped>
.tab {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24rpx;
  margin-top: 20rpx;
  margin-bottom: 6rpx;
}
.tab_i {
  // width: 120rpx;
  text-align: center;
  font-size: 28rpx;
  font-family: PingFang SC;
  font-weight: 400;
  color: #333333;
  // margin-right: 28rpx;
  white-space: nowrap;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.heng {
  width: 24px;
  height: 2px;
  background: #ed1d25;
  border-radius: 1px 1px 1px 1px;
  margin-top: 4rpx;
}
.heng1 {
  width: 24px;
  height: 2px;
  background: #fff;
  border-radius: 1px 1px 1px 1px;
  margin-top: 4rpx;
}
.hui {
  height: 24rpx;
  background: #eee;
}
.head_t {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  font-family: PingFang SC-Regular, PingFang SC;
  font-weight: 400;
  color: #666666;
  border-bottom: 1px solid #ccc;
  margin: 0 20rpx;
  padding: 20rpx;
  margin-bottom: 40rpx;
  img {
    width: 44px;
    height: 44px;
    margin-right: 10px;
  }
}
.disflex {
  display: flex;
  align-items: center;
}
.wl_tree {
  display: flex;
  padding-right: 40rpx;
  .zhong {
    // flex: 1;
    margin: 0 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    .qiu {
      width: 10px;
      height: 10px;
      background: #cccccc;
      border-radius: 50%;
      // margin: 10px 0;
      // margin: 3px 0 10px 0;
    }
    .gun {
      background: #ccc;
      width: 1px;
      min-height: 110px;
    }
  }
  .tree_r {
    // width: 60%;
    font-size: 24rpx;
    color: #999;
    .tree_t {
      color: #999;
    }
  }
}
.red1 {
  width: 10px;
  height: 10px;
  background: #005BAC;
  border-radius: 50%;
}
.red2 {
  color: #005BAC;
}
.red3 {
  color: #333;
}
</style>
