<!--
 * @Author: Fly
 * @Date: 2025-12-10 10:06:13
 * @LastEditTime: 2025-12-23 10:07:01
 * @Description: 
-->
<template>
  <el-dialog top="5vh" title="物流信息" width="30%" :close-on-click-modal="false" :visible.sync="visible" :before-close="close">
    <div v-loading="loading">
      <el-steps direction="vertical" finish-status="success" :active="info.traces.length" v-if="info.traces&&info.traces.length">
        <el-step v-for="(item, i) in tracesList" :key="i" :title="item.acceptTime" :description="item.acceptStation"></el-step>
      </el-steps>
      <div class="no-data" v-if="!info.traces||info.traces.length == 0">
        {{ info.reason||'暂无信息' }}
      </div>
    </div>
  </el-dialog>
</template>

<script>
import { shopOrderPackageSelectExpress } from '@/api/order.js'
export default {
  props: {},
  data () {
    return {
      visible: true,
      info: {
        traces: [],
        reason: '暂无信息'
      },
      tracesList: [],
      loading: false
    }
  },
  methods: {
    init (obj) {
      this.searchDetail(obj.orderId, obj.packageId)
    },
    searchDetail (orderId, packageId) {
      this.loading = true
      shopOrderPackageSelectExpress(packageId).then(res => {
        if (res && res.code == 200) {
          if (res.data) {
            this.info = res.data
            if (res.data.traces && res.data.traces.length > 0) {
              this.tracesList = res.data.traces.reverse()
            }
          }
        } else {
          this.$message.error(res.msg)
        }
        this.loading = false
      }).then(res => {
        this.loading = false
      })
    },
    close (e) {
      this.$emit('result')
    }
  }
}
</script>

 
