<template>
  <div class="shipment-order-detail">
    <div class="order-detail_order-info">
      <div class="order-detail_order-info--title title">发货单详情</div>
      <div class="order-detail_order-info--content">
        <div class="order-detail_order-info--content-item flex">
          <span class="order-detail_order-info__label label">收货人电话:</span>
          <span class="order-detail_order-info__value value flex-1">{{
            detail.lanshou_phone || '--'
          }}</span>
        </div>
        <div class="order-detail_order-info--content-item flex">
          <span class="order-detail_order-info__label label">收货人:</span>
          <span class="order-detail_order-info__value value flex-1">{{
            detail.lanshou_name || '--'
          }}</span>
        </div>

        <div class="order-detail_order-info--content-item flex">
          <span class="order-detail_order-info__label label">邮编:</span>
          <span class="order-detail_order-info__value value flex-1">{{
            detail.lanshou_post || '--'
          }}</span>
        </div>
        <div class="order-detail_order-info--content-item flex overflow-hidden">
          <span
            style="white-space: nowrap"
            class="order-detail_order-info__label label"
            >收货地址:</span
          >
          <span
            class="order-detail_order-info__value value flex-1 text-ellipsis"
            style="white-space: nowrap"
            :title="`${detail.lanshou_region}${detail.lanshou_address}`"
            >{{ `${detail.lanshou_region}${detail.lanshou_address}` }}</span
          >
        </div>
      </div>
    </div>
    <div class="product-detail mt-10">
      <div class="product-detail-title">
        <span>产品详情</span>
      </div>
      <div class="product-detail-content">
        <div
          v-for="item in detail.detailList"
          :key="item.id"
          class="order-list-expand_item"
        >
          <div class="order-list-expand_item_img">
            <img :src="item.variant_image" style="width: 100%; height: 100%" />
          </div>
          <div class="order-list-expand_item_info">
            <div
              :title="item.sub_order_number || ''"
              class="order-list-expand_item_info_title"
            >
              <span class="order-list-expand_item_label">生产单号:</span>
              <span class="order-list-expand_item_value"
                >{{ item.sub_order_number || '--'
                }}<el-icon
                  class="icon"
                  @click="copy(item.sub_order_number || '')"
                  ><DocumentCopy
                /></el-icon>
              </span>
            </div>
            <div
              :title="item.sub_order_number || ''"
              class="order-list-expand_item_info_title"
            >
              <span class="order-list-expand_item_label">款号:</span>
              <span class="order-list-expand_item_value"
                >{{ item.product.dbDiy.bianma || '--'
                }}
              </span>
            </div>
            <div class="order-list-expand_item_info_title">
              <span class="order-list-expand_item_label">商品SKU:</span>
              <span class="order-list-expand_item_value">{{
                item.variant_sku || '--'
              }}</span>
            </div>
            <div class="order-list-expand_item_info_title">
              <span class="order-list-expand_item_label">baseSku:</span>
              <span class="order-list-expand_item_value">{{
                item.base_sku || '--'
              }}</span>
            </div>
            <div class="order-list-expand_item_info_title">
              <span class="order-list-expand_item_label">店铺单号:</span>
              <span class="order-list-expand_item_value">{{
                item.product.shop_number || '--'
              }}</span>
            </div>
           
          </div>
          <div class="order-list-expand_item_info">
            <div class="order-list-expand_item_info_title">
              <span class="order-list-expand_item_label">已发数:</span>
              <span class="order-list-expand_item_value">{{
                item.shipment_num || 0
              }}</span>
            </div>

            <div class="order-list-expand_item_info_title">
              <span class="order-list-expand_item_label">质检(通过):</span>
              <span class="order-list-expand_item_value">{{
                item.pass_num || 0
              }}</span>
            </div>
            <div class="order-list-expand_item_info_title">
              <span class="order-list-expand_item_label">质检(不通过):</span>
              <span class="order-list-expand_item_value">{{
                item.not_pass_num || 0
              }}</span>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>
<script setup lang="ts">
import { DocumentCopy } from '@element-plus/icons-vue'

defineProps({
  detail: {
    type: Object,
    required: true,
  },
})
const copy = (text: string) => {
  navigator.clipboard.writeText(text)
  ElMessage.success('复制成功')
}
</script>
<style lang="scss" scoped>
.order-detail_order-info--title.title {
  font-size: 18px;
}
.order-detail_order-info--content {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-top: 10px;
  font-size: 14px;
}
.product-detail-title {
  font-size: 18px;
}
.product-detail-content {
  margin-top: 10px;
}
.order-list-expand_item {
  display: flex;
  font-size: 14px;
  justify-content: space-between;
}
.order-list-expand_item:not(:last-child) {
  border-bottom: 1px solid #eee;
  padding: 10px 0;
  margin-bottom: 10px;
}
.order-list-expand_item_img {
  width: 100px;
  height: 100px;
  border: 1px solid #eee;
}
.order-list-expand_item_info_title {
  height: 30px;
  line-height: 30px;
}
</style>
