<template>
  <ElDialog v-model="showDialog"
    destroy-on-close
    width="fit-content"
    @close="dialogCloseHandler">
    <ElDescriptions title="收/销订单" border>
       <ElDescriptionsItem label="Id" prop="id">
        {{ detailData.id }}
      </ElDescriptionsItem>
       <ElDescriptionsItem label="订单编号" prop="sn">
        {{ detailData.sn }}
      </ElDescriptionsItem>
       <ElDescriptionsItem label="项目 Id" prop="projectId">
        {{ detailData.projectId }}
      </ElDescriptionsItem>
       <ElDescriptionsItem label="下单人 Id；sys_user.id" prop="userId">
        {{ detailData.userId }}
      </ElDescriptionsItem>
       <ElDescriptionsItem label="下单人客户 Id；cst_customer.id" prop="customerId">
        {{ detailData.customerId }}
      </ElDescriptionsItem>
       <ElDescriptionsItem label="下单人姓名" prop="contacts">
        {{ detailData.contacts }}
      </ElDescriptionsItem>
       <ElDescriptionsItem label="下单人联系方式" prop="phone">
        {{ detailData.phone }}
      </ElDescriptionsItem>
       <ElDescriptionsItem label="下单时间" prop="orderTime">
        {{ detailData.orderTime }}
      </ElDescriptionsItem>
       <ElDescriptionsItem label="订单类型；字典代码：order_category，HuiShouYuYue-->回收预约单、XiaoShouYuYue-->销售预约单、DuanBoRu-->短驳入、DuanBoChu-->短驳出" prop="orderCategory">
        {{ detailData.orderCategory }}
      </ElDescriptionsItem>
       <ElDescriptionsItem label="订单状态；字典代码：order_status，YiYuYue-->已预约、JinXingZhong-->进行中、YiWanCheng-->已完成、YiQuXiao-->已取消" prop="orderStatus">
        {{ detailData.orderStatus }}
      </ElDescriptionsItem>
       <ElDescriptionsItem label="完结时间" prop="finishTime">
        {{ detailData.finishTime }}
      </ElDescriptionsItem>
       <ElDescriptionsItem label="运输组织 Id；cst_org.id" prop="transOrgId">
        {{ detailData.transOrgId }}
      </ElDescriptionsItem>
       <ElDescriptionsItem label="运输方客户 Id" prop="transCustomerId">
        {{ detailData.transCustomerId }}
      </ElDescriptionsItem>
       <ElDescriptionsItem label="指派清运公司时间" prop="assignmentTransTime">
        {{ detailData.assignmentTransTime }}
      </ElDescriptionsItem>
       <ElDescriptionsItem label="站点 Id；cst_station.id" prop="stationId">
        {{ detailData.stationId }}
      </ElDescriptionsItem>
       <ElDescriptionsItem label="站点名称；cst_station.station.name" prop="stationName">
        {{ detailData.stationName }}
      </ElDescriptionsItem>
       <ElDescriptionsItem label="运距；单位：米" prop="transDistance">
        {{ detailData.transDistance }}
      </ElDescriptionsItem>
       <ElDescriptionsItem label="预估量" prop="estimatedQuantity">
        {{ detailData.estimatedQuantity }}
      </ElDescriptionsItem>
       <ElDescriptionsItem label="预估车数" prop="estimatedTrainNum">
        {{ detailData.estimatedTrainNum }}
      </ElDescriptionsItem>
       <ElDescriptionsItem label="产品 Id" prop="goodsId">
        {{ detailData.goodsId }}
      </ElDescriptionsItem>
       <ElDescriptionsItem label="产品名称" prop="goodsName">
        {{ detailData.goodsName }}
      </ElDescriptionsItem>
       <ElDescriptionsItem label="计量单位；字典代码：unit" prop="unit">
        {{ detailData.unit }}
      </ElDescriptionsItem>
       <ElDescriptionsItem label="客户备注" prop="customerMemo">
        {{ detailData.customerMemo }}
      </ElDescriptionsItem>
       <ElDescriptionsItem label="创建人 Id； sys_user.id" prop="creatorId">
        {{ detailData.creatorId }}
      </ElDescriptionsItem>
       <ElDescriptionsItem label="修改人 Id； sys_user.id" prop="modifierId">
        {{ detailData.modifierId }}
      </ElDescriptionsItem>
       <ElDescriptionsItem label="创建时间" prop="createTime">
        {{ detailData.createTime }}
      </ElDescriptionsItem>
       <ElDescriptionsItem label="修改时间" prop="modifyTime">
        {{ detailData.modifyTime }}
      </ElDescriptionsItem>
       <ElDescriptionsItem label="是否删除； 0-->未删除、1-->已删除" prop="deleted">
        {{ detailData.deleted }}
      </ElDescriptionsItem>
    </ElDescriptions>
    <template #footer>
      <ElButton @click="showDialog = false" type="primary">关闭</ElButton>
    </template>
  </ElDialog>
</template>

<script lang="ts" setup>
import OrderApi from '@/pages/order/book-order/order-api.ts'
import Utils from '@/common/utils'

const showDialog = ref(false)

const detailData = Utils.resetAble(reactive<OrderTypes.SearchOrderResult>({}))

function dialogCloseHandler() {
  detailData.$reset()
}

defineExpose({
  open(data: OrderTypes.SearchOrderResult) {
    showDialog.value = true
    OrderApi.detail(data.id!)
      .then(res => {
        detailData.$reset(res.data)
      })
  }
})
</script>

<style lang="stylus" scoped>

</style>
