<!--销售合同-->
<!--2019年5月30日 20:25:16 by jlx-->
<template>
  <div class="container">
    <el-row>
      <el-col :span="12">
        <h2 class="bg-left title">查看合同详情</h2>
      </el-col>
      <el-col :span="12" class="bg-right">
        <el-button
          class="bg-bottom"
          type="primary"
          size="small"
          @click="returnsales()"
          ><img
            width="6"
            height="10"
            style="vertical-align: bottom; margin-right: 3px"
            src="../../../public/img/lujing.png"
            alt=""
          />返回</el-button
        >
      </el-col>
    </el-row>

    <ws-form ref="deptBudgetList" :rules="mainReportAdd" :model="deptBudgetList"
      ><div style="margin-top: 20px; font-size: 24px">
        采购合同<span style="font-size: 16px"
          >【编号:{{ deptBudgetList.contractNo }}】</span
        ><span v-if="status == '待执行'" class="status-orange">{{
          status
        }}</span>
        <span v-if="status == '执行中'" class="status-bule">{{ status }}</span>
        <span v-if="status == '已完成'" class="status-green">{{ status }}</span>
      </div>
      <div class="remark">
        <h3>基本信息</h3>
      </div>
      <ws-info-table>
        <ws-form-item label="合同编号" span="1" prop="contractNo">
          {{ deptBudgetList.contractNo }}
        </ws-form-item>
        <ws-form-item label="运输方式" span="1" prop="shippingType">
          {{ deptBudgetList.shippingType }}
        </ws-form-item>
        <ws-form-item label="买方" span="1" prop="buyer">
          {{ deptBudgetList.buyer }}
        </ws-form-item>
        <ws-form-item label="结算方式" span="1" prop="settlementMethod"
          >{{ deptBudgetList.settlementMethod }}
        </ws-form-item>
        <ws-form-item label="卖方" span="1" prop="seller"
          >{{ deptBudgetList.seller }}
        </ws-form-item>
        <ws-form-item label="交货方式" span="1" prop="deliverType1"
          >{{ deptBudgetList.deliverType1 }}
        </ws-form-item>
        <ws-form-item label="买方电话" span="1" prop="buyerPhone"
          >{{ deptBudgetList.buyerPhone }}
        </ws-form-item>
        <ws-form-item label="包装方式" span="1" prop="packingMethod">
          {{ deptBudgetList.packingMethod }}
        </ws-form-item>
        <ws-form-item label="卖方电话" span="1" prop="sellerPhone">
          {{ deptBudgetList.sellerPhone }}
        </ws-form-item>
        <ws-form-item label="验收方式" span="1" prop="acceptanceMethod">
          {{ deptBudgetList.acceptanceMethod }}
        </ws-form-item>
        <ws-form-item label="重量（吨）" span="1" prop="weight">
          {{ deptBudgetList.weight }}
        </ws-form-item>
        <ws-form-item label="交货日期（起）" span="1" prop="deliveryDateStart">
          {{ deptBudgetList.deliveryDateStart }}
        </ws-form-item>
        <ws-form-item label="溢短装（%）" span="1" prop="overShort">
          {{ deptBudgetList.overShort }}
        </ws-form-item>
        <ws-form-item label="交货日期（止）" span="1" prop="deliveryDateEnd">
          {{ deptBudgetList.deliveryDateEnd }}
        </ws-form-item>
        <ws-form-item
          label="合同单价（元/吨）"
          span="1"
          prop="unitContractPrice"
        >
          {{ deptBudgetList.unitContractPrice }}
        </ws-form-item>
        <ws-form-item label="合同总价（元）" span="1" prop="totalContractPrice">
          {{ deptBudgetList.totalContractPrice }}
        </ws-form-item>
        <ws-form-item label="货源所在地区" span="1">
          {{ deptBudgetList.sourceProvince }}
          {{ deptBudgetList.sourceCity }}
          {{ deptBudgetList.sourceArea }}
        </ws-form-item>
        <ws-form-item label="货源详细地址" span="1" prop="sourceGoods">
          {{ deptBudgetList.sourceGoods }}
        </ws-form-item>
        <ws-form-item label="交货地所在地区" span="1">
          {{ deptBudgetList.deliveryProvince }}
          {{ deptBudgetList.deliveryCity }}
          {{ deptBudgetList.deliveryArea }}
        </ws-form-item>
        <ws-form-item label="交货地详细地址" span="1" prop=" placeDelivery">
          {{ deptBudgetList.placeDelivery }}
        </ws-form-item>
        <ws-form-item label="签订日期" span="1" prop="signingDate">
          {{ deptBudgetList.signingDate }}
        </ws-form-item>
        <ws-form-item label="最终实际交易量(吨)" span="1" prop="finalTradingVolume">
          {{ deptBudgetList.finalTradingVolume }}
        </ws-form-item>
        <ws-form-item label="临时仓库负责人" span="1" prop="personCharge">
          {{ deptBudgetList.personCharge }}
        </ws-form-item>
      </ws-info-table>
      <!--面试信息-->
      <div class="remark">
        <h3>货物信息</h3>
      </div>
      <ws-info-table>
        <ws-form-item label="货名" span="1" prop="waterContent">
          {{ deptBudgetList.contractGoodsInfo.goodsName }}
        </ws-form-item>
        <ws-form-item label="水分（%）<=" span="1" prop="intendedShipId">
          {{ deptBudgetList.contractGoodsInfo.waterContent }}
        </ws-form-item>
        <ws-form-item label="品级" span="1" prop="grade">
          {{ deptBudgetList.contractGoodsInfo.grade }}
        </ws-form-item>
        <ws-form-item label="杂质（%）<=" span="1" prop="impurity">
          {{ deptBudgetList.contractGoodsInfo.impurity }}
        </ws-form-item>
        <ws-form-item label="容重（克/升）<=" span="1" prop="bulkDensity">
          {{ deptBudgetList.contractGoodsInfo.bulkDensity }}
        </ws-form-item>
        <ws-form-item
          label="霉变粒（%）<="
          span="1"
          prop="mildewGrain"
          class="result"
        >
          {{ deptBudgetList.contractGoodsInfo.mildewGrain }}
        </ws-form-item>
        <ws-form-item label="热损伤（%）<=" span="1" prop="jiaorenli">
          {{ deptBudgetList.contractGoodsInfo.jiaorenli }}
        </ws-form-item>
        <ws-form-item
          label="不完善粒（%）<="
          span="1"
          prop="imperfectGrain"
          class="result"
        >
          {{ deptBudgetList.contractGoodsInfo.imperfectGrain }}
        </ws-form-item>
      </ws-info-table>
      <div class="remark">
        <h3>流程信息</h3>
      </div>
      <ws-info-table>
        <ws-form-item label="合同收入（元）" span="1" prop="goodsNameKey">
          {{ deptBudgetList.contractProcessInfo.goodsNameKey }}
        </ws-form-item>
        <ws-form-item label="已开发票（元）" span="1" prop="goodsName">
          {{ deptBudgetList.contractProcessInfo.goodsName }}
        </ws-form-item>
        <ws-form-item label="费用支出（元）" span="1" prop="waterContent"
          >{{ deptBudgetList.contractProcessInfo.waterContent }}
        </ws-form-item>
        <ws-form-item label="未开发票（元）" span="1" prop="impurity"
          >{{ deptBudgetList.contractProcessInfo.impurity }}
        </ws-form-item>
        <ws-form-item label="未回款（元）" span="1" prop="mildewGrain"
          >{{ deptBudgetList.contractProcessInfo.mildewGrain }}
        </ws-form-item>
        <ws-form-item
          label="已完成发运量（吨）"
          span="1"
          prop="imperfectGrain"
          class="result"
          >{{ deptBudgetList.contractProcessInfo.imperfectGrain }}
        </ws-form-item>
        <ws-form-item label="双章原件回收情况" span="1" prop="grade"
          >{{ deptBudgetList.contractProcessInfo.grade }}
        </ws-form-item>
      </ws-info-table>
      <div class="remark">
        <h3>备注信息</h3>
      </div>
      {{ deptBudgetList.remarks }}
      <img :src="deptBudgetList.addressUrl" alt="" />
    </ws-form>
    <div style="text-align: right; padding: 10px">
      <el-button
        class="bg-bottom"
        type="primary"
        size="small"
        @click="returnsales()"
        >关闭</el-button
      >
    </div>
  </div>
</template>
<script>
import {
  packList,
  addList,
  xiala,
  addxiala,
  editxiala,
  delxiala,
  examineList,
} from '@/model/contarct/index'
import { dayjs } from 'base-core-lib'
export default {
  name: 'viewSpareMoney',
  watch: {
    vesselId(val) {
      this.getVesselData()
    },
    isShow(val) {
      this.showType = val
    },
  },
  data() {
    return {
      //弹出框
      dialogViewSpareMoney: false,
      dialogApproveFormVisible: false,
      // 船舶类型
      monetaryKey: null,
      // 表格显示数据
      tableDate: [],
      // 是否显示
      showType: true,
      // 年
      year: '',
      status: '',
      // 提交类型
      submitType: true,
      tableData: [{ date: 1111, name: 'qqqq', address: 'errrtt' }],
      ruleDeptBudget: [],
      deptBudgetList: {
        contractProcessInfo: {},
        contractGoodsInfo: {},
      },
      mainReportAdd: {},
      list: {},
    }
  },

  activated() {
    this.status = this.$route.query.status
    this.loaddata()
    this.showType = this.isShow
  },
  methods: {
    loaddata() {
      // 数据
      examineList({ id: this.$route.query.id })
        .toPromise()
        .then((response) => {
          this.deptBudgetList = response
          if (this.deptBudgetList.deliverType == 1) {
            this.deptBudgetList.deliverType1 = '我方自提'
          } else if (this.deptBudgetList.deliverType == 2) {
            this.deptBudgetList.deliverType1 = '对方送货'
          }
        })
      // 包装方式
      packList({ constId: 'CON1' })
        .toPromise()
        .then((response) => {
          this.packtypeList = response
        })
      // 验收方式
      this.getUnitList()
      // 货名
      packList({ constId: 'CON2' })
        .toPromise()
        .then((response) => {
          this.goodnameList = response
        })
      // 品级
      packList({ constId: 'CON3' })
        .toPromise()
        .then((response) => {
          this.gradeList = response
        })
      // 双章
      packList({ constId: 'CON4' })
        .toPromise()
        .then((response) => {
          this.ChapterTwoList = response
        })
    },
    getUnitList() {
      xiala({
        compId: sessionStorage.getItem('ws-pf_compId'),
        constCode: 'TYPEYAN',
      })
        .toPromise()
        .then((response) => {
          this.unitList = response
          let currItem
          this.unitList.forEach((item, index, arr) => {
            item.flag = 'delete'
            if (this.vModel == item.constKey) {
              currItem = item
            }
          })
          //
          if (currItem) {
            this.selectContract(currItem.constValue)
          }
        })
    },
    // 关闭 dialog时 处理文件url 初始化upload组件
    handleClose() {
      this.dialogViewSpareMoney = false
    },
    handleExamine() {},
    approve() {},
    returnsales() {
      this.$router.push({ path: 'purchaseContract' })
    },
  },
}
</script>
<style lang="scss" scoped>
.status-orange,
.status-bule,
.status-green {
  border: 1px solid;
  border-radius: 30px;
  padding: 3px 10px;
  font-size: 16px;
}
.status-orange {
  border-color: #ff9f24;
  color: #ff9f24;
  background: #ffedd5;
}
.status-bule {
  border-color: #5473e8;
  color: #5473e8;
  background: #f0f3fe;
}
.status-green {
  border-color: #50cad4;
  color: #50cad4;
  background: #ecfeff;
}
.el-form {
  padding: 0 15%;
}
/deep/.ws-info-table .el-form-item {
  border-right: 1px solid #cdd2dc;
  border-bottom: 1px solid #cdd2dc;
}
.readonly {
  position: relative;
}
.readonly:after {
  content: '*';
  color: #ff2727;
  position: absolute;
  right: 8px;
  z-index: 10;
  top: 21%;
  font-size: 20px;
}
.title {
  position: relative;
}
.title::before {
  content: '';
  display: inline-block;
  width: 5px;
  height: 30px;
  background: #5473e8;
  position: absolute;
  left: 0;
}
.el-button--primary {
  background-color: #5878e8;
  border-color: #5878e8;
}
.el-col {
  background: #f6f7fc;
}
/deep/.ws-info-table .el-form-item .el-form-item__content {
  padding: 0 25px;
  border-left: 1px solid #cdd2dc;
  background: #fafbfc;
}
/deep/.ws-info-table .el-form-item .el-form-item__label {
  width: 140px;
  text-align: center;
  background: #f0f2f6;
  // border: 1px solid #cdd2dc;
}
.button-container {
  display: flex;
  flex-wrap: nowrap;
  justify-content: space-between;
  align-items: center;
  background-color: #fff;
  width: 100%;
  height: 50px;
  padding: 0 10px;
  & > div {
    margin-left: 10px;
    display: flex;
    flex-wrap: nowrap;
    flex-direction: row;
    & > span {
      line-height: 50px;
    }
  }

  /deep/.auditFlow-box {
    position: unset;
    margin-left: 10px;
    &/deep/.auditFlow-icon {
      width: auto;
      padding-right: 30px;
    }
    &/deep/.auditFlow-main {
      position: absolute;
    }
  }
}
.box-app {
  display: inline-block;
  float: left;
  margin-left: 30px;
  line-height: 50px;
}
/deep/.el-dialog {
  .el-form-item {
    margin-bottom: 0 !important;
    .el-input--medium {
      textarea {
        min-height: 100px !important;
      }
    }
  }
}
.collapse-bottom {
  margin-bottom: 20px;
}
.input-main .textarea .el-textarea__inner {
  width: 100%;
  z-index: 1;
}
.bg-left {
  padding-left: 30px;
}
.bg-right {
  padding-right: 10px;
  text-align: right;
}
.bg-bottom {
  margin: 15px 0px;
}
.wenzi {
  width: 900px;
  margin: 0 auto;
}
.wenzi h3 {
  display: inline-block;
  left: 10px;
}
.wenzi p {
  display: inline-block;
}
.center {
  width: 900px;
  margin: 0 auto;
}
.el-form-item {
  width: 50%;
}
.el-form-item__label {
  text-align: center;
}
.ce {
  width: 900px;
  margin: 0 auto;
}
/*.crt-main .textarea /deep/ .el-form-item__label {*/
/*  height: 82px;*/
/*}*/
// 控制select为只读的时候显示样式

.hide-sel {
  .el-input__inner {
    border: 0px;
  }
  .el-icon-arrow-up {
    display: none;
  }
  .el-textarea__inner {
    background-color: #fff !important;
    border: 0;
  }
  .el-date-editor {
    i {
      display: none;
    }
  }
  .is-disabled {
    .el-input__inner:hover {
      background-color: #fff !important;
      border: 0;
    }
    color: #606266;
    .el-input__inner {
      background-color: #fff !important;
      border: 0;
      color: #606266;
    }
    .el-textarea__inner {
      background-color: #fff !important;
      border: 0;
      color: #606266;
    }
  }
}

// 控制select为只读的时候显示样式
/deep/.ws-class-table-col {
  height: auto;
  padding: 0px 2px;
  /deep/.el-input__inner {
    padding: 0px 2px;
  }
}
/deep/.is-disabled {
  .el-input__prefix,
  .el-input__suffix {
    display: none;
  }
  .el-input__inner {
    background-color: #fff;
    border-color: #fff !important;
    color: #000 !important;
    font-size: 14px;
    cursor: text;
    padding: 0 !important;
  }
}
.winseaview-view {
  padding: 0 0 20px;
}
.container {
  overflow: scroll;
  height: 93vh;
}
/deep/.ws-info-table[data-v-850a44a6] .el-form-item .el-form-item__label {
  width: 130px;
}
</style>
