<template>
  <div class="edit-add-detail">
    <div class="crumbs">
      <Breadcrumb
        :breadcrumbOpt="breadcrumbOpt"
        svg-name="#icon-vehicle"
        @breadcrumb-click="handleClose"
      />
    </div>
    <div class="form-content">
      <el-form
        ref="formInfo"
        :model="parameter"
        label-width="auto"
        label-position="right"
        :rules="rules"
      >
        <div class="rows">
          <div class="rows-left">
            <div class="rows-hr"></div>
          </div>
          <div class="rows-title">
            <div class="text-overflow">基本信息</div>
          </div>
        </div>
        <el-row :gutter="24">
          <el-col :span="8">
            <el-form-item label="发货单号" prop="receiptCode">
              <el-input
                clearable
                v-model="parameter.receiptCode"
                :readonly="true"
              ></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="订单编号" prop="purchaseOrderCode">
              <el-input
                :readonly="true"
                clearable
                v-model="parameter.purchaseOrderCode"
              ></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="收货公司" prop="inManifestCompanyName">
              <el-input
                clearable
                v-model="parameter.inManifestCompanyName"
                :readonly="true"
              ></el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="24">
          <el-col :span="8">
            <el-form-item label="发货公司" prop="outManifestCompanyName">
              <el-input
                clearable
                v-model="parameter.outManifestCompanyName"
                :readonly="true"
              ></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="发货人" prop="outManifestUserName">
              <el-input
                clearable
                v-model="parameter.outManifestUserName"
              ></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="联系方式" prop="outManifestUserPhone">
              <el-input
                clearable
                v-model="parameter.outManifestUserPhone"
                :readonly="true"
              ></el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="24">
          
          <el-col :span="8">
            <el-form-item label="发货时间" prop="outManifestDate">
              <el-date-picker
                v-model="parameter.outManifestDate"
                type="date"
                value-format="yyyy-MM-dd"
                :readonly="true"
                style="width: 100%"
              />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="货物金额" prop="amount">
              <el-input
                :readonly="true"
                clearable
                v-model="parameter.amount"
              ></el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <div class="rows">
          <div class="rows-left">
            <div class="rows-hr"></div>
          </div>
          <div class="rows-title">
            <div class="text-overflow">物料信息</div>
          </div>
        </div>
        <el-table
          ref="singleTable"
          :data="parameter.detailList"
          style="width: 100%"
          highlight-current-row
          :cell-style="{'text-align': 'center'}"
          :header-cell-style="{'text-align': 'center'}"
        >
          <el-table-column fixed type="index" width="55" label="序号" />
          <el-table-column
            label="企业物料编号"
            min-width="100"
            show-overflow-tooltip
            prop="matCode"
          >
          </el-table-column>
          <el-table-column
            label="平台物料编号"
            min-width="100"
            show-overflow-tooltip
            prop="matPlatcode"
          >
          </el-table-column>
          <el-table-column
            label="物料名称"
            min-width="80"
            show-overflow-tooltip
            prop="matName"
          >
          </el-table-column>
          <el-table-column
            label="物料牌号"
            min-width="100"
            show-overflow-tooltip
            prop="matMaterial"
          >
          </el-table-column>
          <el-table-column
            label="规格型号"
            min-width="80"
            show-overflow-tooltip
            prop="matSpec"
          >
          </el-table-column>
          <el-table-column
              label="计划编号"
              min-width="100"
              show-overflow-tooltip
              prop="planCode"
            >
            </el-table-column>
          <el-table-column label="计量单位" min-width="100" prop="matUnit">
          </el-table-column>
          <el-table-column label="发货数量" min-width="130" prop="num">
          </el-table-column>
          <el-table-column label="税率(%)" min-width="110" prop="taxRate">
          </el-table-column>
          <el-table-column label="含税单价(元)" min-width="130" prop="taxInprice">
          </el-table-column>
          <el-table-column
            label="含税金额(元)"
            min-width="130"
            prop="taxInvalue"
          >
          </el-table-column>
          <el-table-column
            label="不含税单价(元)"
            min-width="130"
            prop="orderPrice"
          >
          </el-table-column>
          <el-table-column
            label="不含税金额(元)"
            min-width="130"
            prop="orderAmount"
          >
          </el-table-column>
          <el-table-column
              label="基础扩展"
              min-width="100"
              show-overflow-tooltip
              prop="matBaseExt"
            >
            </el-table-column>
            <el-table-column
              label="其他扩展"
              min-width="100"
              show-overflow-tooltip
              prop="matOtherExt"
            >
            </el-table-column>
            <el-table-column
              label="挂账时间"
              min-width="100"
              show-overflow-tooltip
              prop="pendingTime"
            >
            </el-table-column>
            <el-table-column
              label="送货地址"
              min-width="100"
              show-overflow-tooltip
              prop="unloadAddress"
            >
            </el-table-column>
            <el-table-column
              label="企业补充说明"
              min-width="80"
              prop="remarks"
              show-overflow-tooltip
            >
            </el-table-column>
            <el-table-column
              label="供货方补充说明"
              min-width="80"
              prop="vendorNote"
              show-overflow-tooltip
            >
            </el-table-column>
        </el-table>
      </el-form>
    </div>
    <div slot="footer" class="footer">
      <el-button @click="handleClose">{{ $t('domestic.cancel') }}</el-button>
    </div>
  </div>
</template>

<script>
import Breadcrumb from '@/components/Breadcrumb/index.vue'
import salesOrder from '@/api/BasicDataManagement/salesOrder.js'
import utils from '@/utils.js'
export default {
  name: 'shipmentsDetail',
  components: {Breadcrumb},
  data() {
    return {
      breadcrumbOpt: [{breadcrumbName: '采购发货'}, {breadcrumbName: '详情'}],
      parameter: {},
    }
  },
  created() {
    if (this.$route.query.detailRows) {
      let row = JSON.parse(JSON.stringify(this.$route.query.detailRows))
      this.selectOne(row)
    }
  },
  mounted() {},
  methods: {
    selectOne(row) {
      salesOrder.selectOne(row.id).then((res) => {
        console.log(res)
        this.parameter = res.data.value
        if (!this.parameter.detailList) {
          this.parameter.detailList = []
        } else {
          this.parameter.detailList.forEach((item) => {
            item.TaxPrice = item.transactionPrice / item.num
          })
        }
      })
    },
    // 编辑
    handleEdit() {
      this.$router.push({
        name: 'shipmentsAddDialog',
        query: {editRows: this.parameter, pageBean: this.params},
      })
    },
    // 关闭//面包屑点击
    handleClose() {
      this.$router.push({
        name: 'inquiriesSales',
        params: {
          pageBean: this.$route.query.pageBean,
        },
      })
      this.parameter = {}
    },
    //详情
    detail(val) {
      if (val) {
        this.modifychoData(val)
      }
    },
    //获取详情
    modifychoData(val) {},
  },
}
</script>
<style lang="scss" scoped>
::v-deep .el-form-item__label {
  width: 80px;
  font-size: 14px;
  color: #828282;
  font-weight: 500;
}

::v-deep .el-form-item__content span {
  font-size: 14px;
  color: #000;
  font-weight: 500;
}

::v-deep .el-form-item {
  margin-bottom: 10px;
}
.rows {
  display: flex;
  align-items: center;
  border-bottom: 1px solid #ebebeb;
  margin-bottom: 16px;
  padding: 10px 0;

  .rows-left {
    margin-right: 10px;

    .rows-hr {
      width: 3px;
      height: 18px;
      background-color: #0e6eff;
      border-radius: 2px;
    }
  }

  .rows-title {
    .text-overflow {
      width: 100%;
      font-size: 16px;
    }
  }
}
</style>
