<!--
  @description: 收货订单-订单确认工作流查看详情
  @author: lxl
  @routerPath:/procurement/purOrderArrirmFlowDetail
  @date： 2021-1-19 13:50:12
-->
<template>
  <div class="p0-16">
    <section>
      <!-- 订单基本信息 -->
      <procurementOrderBasicCompDetail
        :order-info-data="detailInfoData.orderInfoList"
      />
    </section>
    <section>
      <!-- 行项目信息 -->
      <template>
        <procurementOrderLineItemCompDetail
          :line-item-info-data="detailInfoData.lineItemInfoList"
          :line-data="lineData"
        />
        <pagination :pagination-data="paginationData" @change="loadData" />
      </template>
    </section>
  </div>
</template>

<script>
/* api接口*/
import {
  queryProcurementOrderInfo, // 基本信息
  listProcurementOrderProductPages // 行项目
} from '@/api/procurement/procurementOrder'
/* 组件 */
import procurementOrderBasicCompDetail from '@/views/procurement/procurementOrder/procurementOrderInfo/procurementOrderBasicComp-detail.vue' // 订单的基本信息组件
import procurementOrderLineItemCompDetail from '@/views/procurement/procurementOrder/procurementOrderInfo/procurementOrderLineItemComp-detail.vue' // 订单行项目信息列表组件
/*  公共*/
import { ListMixin } from '@/mixins/ListMixin' // 分页
import pagination from '@comp/common/pagination/pagination' // 分页组件

export default {
  name: 'AffirmOrderFlowDetail',
  components: {
    procurementOrderBasicCompDetail, // 订单基本信息
    procurementOrderLineItemCompDetail, // 行项目列表组件
    pagination // 分页
  },
  mixins: [ListMixin],
  data() {
    return {
      // 页面数据
      detailInfoData: {
        orderInfoList: {}, // 订单基本信息
        lineItemInfoList: [] // 行项目信息
      },
      lineData: {
        orderTotalMoney: '', // 订单净总价
        orderTotalTaxMoney: '', // 订单含税总价
        currency: '' // 币种
      },
      loading: true,
      orderId: this.$route.query.bizId, // 获取路由传参 订单Id
      confirmLoading: false, // 确认按钮加载
      purchaseUnitList: [], // 计量单位字典列表
      typeList: [] // 类别
    }
  },
  computed: {
  },
  watch: {
  },
  created() {
    this.getBaseInfoData() // 基本信息
    this.loadData() // 行项目信息
  },
  methods: {
    // 基本信息
    getBaseInfoData() {
      const params = {
        orderId: this.orderId
      }
      queryProcurementOrderInfo(params).then((response) => {
        this.detailInfoData.orderInfoList = response.data
        this.lineData.currency = response.data.currency // 币种
        this.lineData.orderTotalTaxMoney = response.data.orderTotalTaxMoney // 订单含税总价
        this.lineData.orderTotalMoney = response.data.orderTotalMoney // 订单净总价
      })
    },
    // 获取行项目信息
    loadData() {
      const params = {
        orderId: this.orderId,
        pageNo: this.paginationData.pageNo,
        pageSize: this.paginationData.pageSize
      }
      listProcurementOrderProductPages(params).then(response => {
        this.loading = false
        this.detailInfoData.lineItemInfoList = response.data.records
        this.paginationData.total = response.data.total
      }).catch(() => {
      })
    }

  }
}
</script>

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