<!--采购合同查看-->
<!--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 class="title-top">
        采购合同<span class="title-number">【编号:{{ deptBudgetList.contractNo }}】</span>
        <div class="icon" v-if="deptBudgetList.status">
          <template>
            <el-popover placement="right" :width="285" trigger="click" visible-arrow="false"
              @show="history(deptBudgetList.id)">
              <template>
                <div slot="reference"> {{deptBudgetList.status }}</div>
              </template>
              <div>
                <p style="margin-top: 0; padding-left: 10px">操作历史</p>
                <div v-for="(item, index) in historyList" class="flex">
                  <div class="vertical-text vertical-text-left">
                    {{ item.updateDate }}
                  </div>
                  <div>
                    <div class="vertical-circle"></div>
                    <div v-if="index != historyList.length - 1" class="vertical-line"></div>
                  </div>
                  <div class="vertical-text">
                    {{ item.operateUser }}<br />{{ item.dealMsg }}
                  </div>
                </div>
              </div>
            </el-popover>
          </template>
        </div>
      </div>
      <div class="remark">
        <h3>基本信息</h3>
      </div>
      <ws-info-table>
        <ws-form-item label="合同类型" span="1" prop="agreementType">
          {{ deptBudgetList.agreementType }}
        </ws-form-item>
        <ws-form-item label="合同编号" v-if="deptBudgetList.agreementType=='采购合同'" span="1" prop="contractNo">
          {{ deptBudgetList.contractNo }}
        </ws-form-item>
        <ws-form-item label="交易主体" span="1" prop="transactionSubject" class="readonly">
          {{deptBudgetList.transactionSubject}}
        </ws-form-item>
        <ws-form-item v-if="deptBudgetList.transactionSubject == '合营'" label="合营加价" span="1" prop="seller" class="readonly">
          {{ deptBudgetList.jointVentureMarkup }}
        </ws-form-item>
        <ws-form-item label="关联合同" v-if="deptBudgetList.agreementType=='补充协议'" span="1" prop="agreementNo">
          {{ deptBudgetList.agreementNo }}
        </ws-form-item>
        <ws-form-item label="补充协议编号" v-if="deptBudgetList.agreementType=='补充协议'" 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="feedbackLeader" v-if="deptBudgetList.deliverType1 == '对方送货'">{{ deptBudgetList.feedbackLeader }}
        </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="priceType">
          {{ deptBudgetList.priceType }}
        </ws-form-item>
        <ws-form-item label="合同单价（元/吨）" span="1" prop="unitContractPrice" v-if="deptBudgetList.priceType == '定价采购'">
          {{ deptBudgetList.unitContractPrice }}
        </ws-form-item>
        <ws-form-item label="合同总价（元）" span="1" prop="totalContractPrice" v-if="deptBudgetList.priceType == '定价采购'">
          {{ 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" v-if="deptBudgetList.deliverType != 2">
          {{ deptBudgetList.personCharge }}
        </ws-form-item>
        <ws-form-item class="readonly" label="结算重量方式" span="1" prop="settlementWeightMethod" v-if="deptBudgetList.deliverType==1">
          {{ deptBudgetList.settlementWeightMethod==1?'按出库重量结算':'按入库重量结算' }}
        </ws-form-item>
        <ws-form-item label="结算单价（元/吨）" span="1" prop="settlementPrice" >
          {{ deptBudgetList.settlementPrice?deptBudgetList.settlementPrice:'自动结算，不可编辑'}}
        </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="mildewGrain">
          {{deptBudgetList.contractProcessInfo.mildewGrain}}
        </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="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>
    <div style=" color: #afb5cb;margin-left: 20px;">
        {{ deptBudgetList.remarks }}
      </div>
      <ws-upload ref="upload" :comp-id="compId" :appendix-ids="deptBudgetList.addressUrl" :editable="false"
        accept=".jpg, .jpeg, .png, .pdf, .doc, .zip, .rar" />
      <el-table class="wenzi" :data="taskhistories" style="width: 100%">
        <el-table-column prop="operatorMajorRoleName" label="审核人">
          <template scope="scope">
            {{scope.row.operatorMajorRoleName}}{{scope.row.operatorName}}
          </template>
        </el-table-column>
        <el-table-column prop="inOutTaskNo" label="审核结果">
          <template scope="scope">
            <span v-if='scope.row.approved'>通过</span>
            <span v-if='!scope.row.approved'>驳回</span>
          </template>
        </el-table-column>
        <el-table-column prop="endTime" label="审核时间"></el-table-column>
        <el-table-column prop="auditMind" label="审核意见"></el-table-column>
      </el-table>
    </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,
    xiala,
    examineList,
    billoperatehis,
  } from '@/model/contarct/index'
  import {
    gettaskhistories
  } from '@/model/tasksport/index'
  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,
        historyList: [],
        tableData: [{
          date: 1111,
          name: 'qqqq',
          address: 'errrtt'
        }],
        ruleDeptBudget: [],
        taskhistories: [],
        deptBudgetList: {
          contractProcessInfo: {},
          contractGoodsInfo: {},
        },
        mainReportAdd: {},
        list: {},
        compId: localStorage.getItem('ws-pf_compId'),
      }
    },

    activated() {
      this.status = this.$route.query.status
      this.loaddata()
      this.showType = this.isShow
    },
    methods: {
      loaddata() {
        gettaskhistories({
            businessKey: this.$route.query.id,
            workflowId: this.$route.query.workflowId
          }).toPromise()
          .then((response) => {
            this.taskhistories = response
          })
        // 数据
        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 = '对方送货'
            }
            else if (this.deptBudgetList.deliverType == 3) {
              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: localStorage.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)
            }
          })
      },
      history(id1) {
        billoperatehis({
            id: id1
          })
          .toPromise()
          .then((response) => {
            this.historyList = response
          })
      },
      // 关闭 dialog时 处理文件url 初始化upload组件
      handleClose() {
        this.dialogViewSpareMoney = false
      },
      returnsales() {
        this.$router.go(-1)
      },
    },
  }
</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;
    color: #afb5cb;
  }

  /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;
  }

  .vertical-text-left {
    width: 62px;
    text-align: right;
  }

  .vertical-text {
    margin: 0 10px;
    color: #8890b1;
    font-size: 12px;
    margin-top: -4px;
  }

  .vertical-line {
    height: 100px;
    border-left: 2px solid #e9ecf7;
    margin-left: 4px;
    padding: 0 3px;
  }

  .vertical-circle {
    width: 10px;
    height: 10px;
    border: 2px solid #5878e8;
    background-color: #ffffff;
    -webkit-border-radius: 100px;
  }

  .vertical-circle:first-child {
    color: red;
  }

  .icon {
    display: inline-block;
    width: 60px;
    background: #ecfeff;
    border-radius: 12px;
    border: 1px solid #50cad4;
    position: relative;
    font-size: 14px;
    color: #50cad4;
    padding: 1px 7px;
  }

  .title-top {
    margin-top: 20px;
    font-size: 21px;
    font-weight: 600;
  }

  .title-number {
    font-size: 14px;
    font-weight: 400;
  }
</style>
