//客户操作记录
<template>
  <div class="container">
    <el-row class="row_top">
      <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="vertion-align: bottom; margin-right: 3px" src="../../../public/img/lujing.png" alt="" />返回
        </el-button></el-col>
    </el-row>
    <div class="center">
      <el-row style='margin-bottom:10px;'>
        <el-col :span="6">
          <!-- <el-button style="margin-left:10px" @click="typeChange('')" type="primary">导出</el-button> -->
        </el-col>
        <el-col :span="18">
          <div style='margin-left:10px;' class="datascreen">
            <div style="display:inline-block;width:50;">
              <el-date-picker value-format='yyyy-MM-dd' v-model="value" type="daterange" align="right" unlink-panels range-separator="至"
              start-placeholder="开始日期" end-placeholder="结束日期" :picker-options="pickerOptions" class="data_css" @change="changeDate" >
            </el-date-picker></div>
            <el-input placeholder="可按业务编号、合同编号、客户查找" class="input_css" v-model="searchKeyWord"></el-input>
            <el-button class="find" type="primary" @click="find()"><img width="16" height="16" style="left: -8px;"
                src="../../../public/img/sousuo.png" alt="" /></el-button>
          </div>
        </el-col>
      </el-row>
      <div class="fromdata">
        <el-table :data="tableData" stripe style="width: 100%" @selection-change="handleSelectionChange">
          <el-table-column type="index" label="序号">
            <template scope="scope">
              <span v-if="scope.$index < 9">0{{ scope.$index + 1 }}</span>
              <span v-else>{{ scope.$index + 1 }}</span>
            </template>
          </el-table-column>
          <el-table-column prop="relationReceiveNo" label="我司业务编号">
          </el-table-column>
          <el-table-column prop="transferOutNo" label="客户业务编号">
          </el-table-column>
          <el-table-column prop="outContractNo" label="客户销售合同编号"></el-table-column>
          <el-table-column prop="customer" label="客户"></el-table-column>
          <el-table-column width="200" prop="agent" label="期初粮款数据（元）">
            <template scope="scope">
              应付{{scope.row.amountIngPayable}}-已付{{scope.row.amountEdPayable}}=未付{{scope.row.amountNotPayable}}
            </template>
          </el-table-column>
          <el-table-column width="120" prop="transferOutWeight" label="重量（吨）">
          </el-table-column>
          <el-table-column width="120" prop="salePrice" label="售价（元/吨）">
          </el-table-column>
          <el-table-column width="120" prop="updateDate" label="日期">
          </el-table-column>
          <el-table-column width="120" prop="status" label="状态">
          </el-table-column>
          <el-table-column width="120" label="操作">
            <template scope="scope">
              <el-button v-if="scope.row.status=='待接收'" @click="rejection(scope.row)" type="text">拒收</el-button>
            </template>
          </el-table-column>
        </el-table>
      </div>
      <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="currentPage"
        style="text-align:center" :page-size="pageSize"
        layout="total, sizes, prev, pager, next, jumper" :total="deptBudgetTotal">
      </el-pagination>
    </div>
  </div>
</template>
<script>

import {
  getcusationinfo,
  rejectcusationinfo
} from '@/model/warehouse/index'
  export default {
    components: {},
    data() {
      return {
        value: '',
        tableData: [],
        show:false,
        deptBudgetTotal: 0,
        currentPage: 1,
        pageSize: 10,
        agreementType:'',
        deptCircularPage: {},
        searchType:'',
        searchKeyWord:'',
        startDate:'',
        endDate:'',
        tableData:{},
        datalist:{},
        currectData:{},
        compId:localStorage.getItem('ws-pf_compId'),
        binNumbershow:false,
      }
    },
    activated() {
      this.getList()
    },
    methods: {
      lookbinNumber(item){
        this.currectData=item
        this.binNumbershow=true
      },
      handleClose1(){
        this.show=false
      },
      returnsales(){
        this.$router.go(-1)
      },
      rejection(row){
        this.$confirm('确定拒收该笔货权？', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning',
      })
        .then(() => {
          rejectcusationinfo({id:row.id}).toPromise().then((response) => {
              this.$message.success('操作成功！')
              // row.weightedit=false
              this.getList()
            })
        })
      },
      async getList() {
         var response=await getcusationinfo({
            // warehouseType: 1,
            startDate:this.startDate,
            endDate:this.endDate,
            searchKeyWord:this.searchKeyWord,
            currentPage: this.currentPage,
            pageSize:this.pageSize ,
            compId:localStorage.getItem('ws-pf_compId'),
          })
          .toPromise()
            this.tableData = response.records
           this.deptBudgetTotal = response.total
      },

      changeDate(){
        if(this.value){
          this.startDate = this.value[0]
          this.endDate = this.value[1]
        }
        this.getList()
      },
      pickerOptions() {},
      find() {
        this.getList()

      },
      handleSizeChange(val) {
        console.log(`每页 ${val} 条`)
        this.pageSize = val
        this.getList()
      },
      handleCurrentChange(val) {
        this.currentPage = val
        console.log(`当前页: ${val}`)
        this.getList()
      },
    },
  }
</script>
<style lang="scss" scoped>
 table,
      table tr th,
      table tr td {
        border: 2px solid #333333;
        padding: 5px 0;
        height: 55px;
      }

      .content {
        width: 1000px;
        padding: 70px 20px 20px 20px;
        font-size: 22px;
        position: absolute;
        top: 0;
        bottom: 0;
        left: 0;
        right: 0;
      }

      table {
        width: 100%;
        text-align: center;
        border-collapse: collapse;
        border: 3px solid #333333;
      }

      .col-bgc {
        background: #f6f7fb;
      }

  .container {
    background: #E8ECF6;
  }

  .center {
    margin: 0 auto;
    background: #ffffff;
    height: calc(100vh - 13vh);
    border-radius: 4px;
    padding: 20px 0;

    /deep/.el-table td,
    /deep/.el-table th {
      text-align: center;
    }
  }

  .row_top {
    background: #F6F7FC;
    border-radius: 4px;
    margin-bottom: 10px;

    .bg-left {
      padding-left: 30px;
    }

    .bg-right {
      padding-right: 10px;
      text-align: right;
    }

    .title {
      position: relative;
    }

    .title::before {
      content: '';
      display: inline-block;
      width: 5px;
      height: 30px;
      background: #5473e8;
      position: absolute;
      left: 0;
    }
  }

  .datascreen {
    display: flex;

    .data_css {
      width: 40%;
    }

    .input_css {
      width: 50%;
      margin: 0 10px;
    }

    .find {
      margin-right: 10px;
    }
  }

  .fromdata {
    margin: 20px 0;
    overflow-y: scroll;
    height: 546px;
  }
  .top_info{
    margin: 10px 0 0 10px;
    min-width: 712px;
    .info_css{
      margin-right: 20px;
    }
  }
  .bg-right{
    padding-top:15px;
  }
  .el-icon-connection{
    color:#409eff;
  }
  .flex{
    display:flex;justify-content: space-between;
  }
</style>