<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="vendorName">
                <el-select
                  v-model="parameter.vendorName"
                  filterable
                  style="width: 100%"
                  placeholder="请选择收货公司"
                >
                  <el-option
                    v-for="item in companyList"
                    :key="item.vendorId"
                    :label="item.vendorName"
                    :value="item.vendorId"
                  >
                  </el-option>
                </el-select>
                
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="发货单选择" prop="arrivalCode">
                <el-input
                  v-model="parameter.arrivalCode"
                  @focus="openOrder"
                  prefix-icon="el-icon-search"
                  placeholder="请选择发货单"
                ></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="收货公司" prop="matCompanyName">
                <el-input
                  clearable
                  v-model="parameter.matCompanyName"
                  placeholder="请输入收货公司"
                ></el-input>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row :gutter="24">
            <el-col :span="8">
              <el-form-item label="收货人" prop="matUserName">
                <el-input
                  clearable
                  v-model="parameter.matUserName"
                  placeholder="请输入收货人"
                ></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="收货人联系方式" prop="matUserPhone">
                <el-input
                  clearable
                  type="number"
                  v-model="parameter.matUserPhone"
                  placeholder="请输入收货人联系方式"
                ></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="收货时间" prop="receiptDate">
                <el-date-picker
                  v-model="parameter.receiptDate"
                  type="datetime"
                  value-format="yyyy-MM-dd HH:mm:ss"
                  placeholder="请选择收货时间"
                  style="width: 100%"
                />
              </el-form-item>
            </el-col>
          </el-row>
          <el-row :gutter="24"> </el-row>
          <el-row :gutter="24">
            <el-col
              :span="8"
              v-if="this.breadcrumbOpt[1].breadcrumbName === '编辑'"
            >
              <el-form-item label="收货单号" prop="arrivalCode">
                <el-input
                  :readonly="true"
                  v-model="parameter.arrivalCode"
                ></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="货物金额" prop="amount">
                <el-input
                  :readonly="true"
                  clearable
                  v-model="parameter.amount"
                  placeholder="请输入货物金额"
                ></el-input>
              </el-form-item>
            </el-col>
          
          <el-col :span="8">
              <el-form-item label="收货状态" prop="status">
                <el-tag v-if="parameter.status == 1" type="success">已收货</el-tag>
                <el-tag type="danger" v-if="parameter.status == 2"
                  >已对账</el-tag
                >
              </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%"
          border
          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="arrivalNum">
          </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="price"
          >
          </el-table-column>
          <el-table-column
            label="不含税金额(元)"
            min-width="130"
            prop="amount"
          >
          </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="110"
              prop="purNote"
              show-overflow-tooltip
            >
            </el-table-column>
            <el-table-column
              label="供货方补充说明"
              min-width="110"
              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.selectTwo(row)
    }
  },
  mounted() {},
  methods: {
    selectTwo(row) {
      this.$http.post('${portal}/bizReceipt/v1/selectOne?id='+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
          })
        }
      })
    },

    // 关闭//面包屑点击
    handleClose() {
      this.$router.push({
        name: 'afterSalesManagement',
        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;

  font-weight: 500;
}

::v-deep .el-form-item__content span {
  font-size: 14px;

  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>
