<template>
  <div style="margin: 50px;">
    <!-- 搜索工作栏 -->
    <el-form ref="queryForm" :model="queryParams" size="small" :inline="true" style="margin-top: 20px;">
      <el-row :gutter="10">
        <el-col :span="24">
          <el-form-item :label="$t('controlorder.orderNo')" prop="orderNo" required :error="$t('postorder.orderNoRules')">
            <el-input v-model="queryParams.orderNo" style="width: 250px;" :placeholder="$t('postorder.orderNoRules')" clearable />
          </el-form-item>
        </el-col>
      </el-row>
      <el-form-item>
        <el-button type="primary" icon="el-icon-search" @click="handleQuery">{{ $t('common.search') }}</el-button>
        <el-button icon="el-icon-refresh" @click="resetQuery">{{ $t('common.reload') }}</el-button>
      </el-form-item>
    </el-form>
    <span>{{ $t('orderdetail.activeSecond') }}</span>
    <el-divider />
    <div style="margin-top: 50px;">
      <el-timeline v-if="data && data.length" :reverse="true">
        <el-timeline-item v-for="(activity, index) in data" :key="index" :timestamp="activity.timestamp">
          {{ $l(activity, 'title') }}
        </el-timeline-item>
      </el-timeline>
      <el-result v-else icon="info " :title="$t('orderdetail.noData')" :sub-title="$t('orderdetail.notOrderData')" />
    </div>
  </div>
</template>

<script>
import { getLogistics } from '@/api/order'
export default {
  data() {
    return {
      reverse: true,
      queryParams: {
        page: 1,
        rows: 10,
        phone: null,
        name: null,
        company: null,
        pid: null
      },
      data: []
    }
  },
  methods: {
    handleQuery() {
      this.$refs['queryForm'].validate(v => {
        if (v) {
          getLogistics(this.queryParams).then(r => {
            this.data = r.data
          })
        }
      })
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.$refs['queryForm'].resetFields()
    }
  }
}
</script>

<style>

</style>
