<template>
  <div>

  </div>
</template>

<script setup>

import { getLogisticsListAPI } from '@/api'
const route = useRoute()

const activities = ref([]) // 物流轨迹信息
const orderId = ref('') // 订单号
const transportName = ref('') // 物流公司名称
const ddNo = ref('') // 合同编号
const sentNo = ref('') // 发货单号

const getLogisticsList = async () => {
  // 获取当前 URL 上的参数 sentNo
  const { data } = await getLogisticsListAPI({
    sentNo: route.query.sentNo
  })
  orderId.value = data.expressNo
  transportName.value = data.transportName
  ddNo.value = data.ddNo
  sentNo.value = data.bjSentNo

  // 判断 data.sentInfo 为空给 activities 空数组怎么写
  if (!data.sentInfo) {
    activities.value = [{
      content: '还未生成物流信息，请稍等',
      timestamp: new Date()
    }]
    return
  }
  activities.value = data.sentInfo.traceDetails.reverse().map(o => ({
    content: o.operateRemark,
    timestamp: o.operateTime
  }))

}
getLogisticsList()
</script>

<style lang="scss"
  scoped></style>