<style>
  .ComplaintsDetail {
    width: 800px;
    height: auto;
    margin: 50px auto;
    overflow: hidden;
    padding: 50px 20px 20px;
    font-size: 14px;
    background-color: #fff;
    border: 1px solid #ccc;
    position: relative;
  }

  .ComplaintsDetail .CD_Nav {
    position: absolute;
    width: 800px;
    height: 40px;
    line-height: 40px;
    left: 0;
    top: 0;
    color: #666;
    background: #eee;
    text-align: center;
    font-size: 16px;
    font-weight: bold;
    border-bottom: 1px solid #ccc;
  }

  .ComplaintsDetail .CD_Detail > p {
    background: #ccc;
    color: #333;
    padding: 5px 0;
    text-indent: 11px;
  }

  .ComplaintsDetail .CD_OrderList {
    overflow: hidden;
    width: 800px;
  }

  .ComplaintsDetail .CD_OrderList ul {
    overflow: hidden;
  }

  .ComplaintsDetail .CD_OrderList ul li {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    float: left;
    width: 380px;
    height: 36px;
    line-height: 36px;
    border-bottom: 1px solid #ccc;
  }

  .ComplaintsDetail .CD_OrderList ul li:nth-child(2n + 1) {
    border-right: 1px solid #ccc;
    box-sizing: border-box;
  }

  .ComplaintsDetail .CD_OrderList ul li span {
    display: inline-block;
    width: 80px;
    text-align: right;
  }

  .ComplaintsDetail .CD_Messagebox {
    clear: both;
    border: 1px solid #ccc;
    height: auto;
    background: #eee;
    overflow: hidden;
    padding: 10px 20px;
    margin: 0 0 10px 0;
  }

  .ComplaintsDetail .CD_Messagebox p.t {
    border-bottom: 1px solid #ccc;
    font-weight: bold;
    height: 28px;
    color: #666;
    line-height: 28px;
    margin: 0 0 10px 0;
  }

  .ComplaintsDetail .CD_Messagebox p.t > span {
    float: right;
  }

  .ComplaintsDetail .CD_Messagebox p.f {
    border-top: 1px solid #ccc;
    font-weight: bold;
    height: 28px;
    line-height: 28px;
    margin: 10px 0 0 0;
    padding-top: 5px;
    color: #666;
  }

  .ComplaintsDetail .CD_Messagebox p.f > span {
    float: right;
  }

  .ComplaintsDetail .CD_aboutList {
    overflow: hidden;
    width: 800px;
  }

  .ComplaintsDetail .CD_aboutList ul li {
    float: left;
    width: 380px;
    height: 36px;
    line-height: 36px;
    border-bottom: 1px dashed #ccc;
  }

  .ComplaintsDetail .CD_aboutList ul li:nth-child(1) {
    width: 760px;
  }

  .ComplaintsDetail .CD_aboutList ul li span {
    display: inline-block;
    width: 80px;
    text-align: right;
  }

  .CD_OrderList > a {
    color: #3980c8 !important;
    cursor: pointer;
  }

  .CD_OrderList > a:hover {
    color: #bd2e40 !important;
    text-decoration: underline !important;
  }

  .CP_redType {
    color: red;
  }

  .CP_Chuli {
    margin: 20px 0;
    background: #eee !important;
  }

  .CD_Complaints {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .CD_Conditions {
    background: #fff;
    margin: 5px 0;
    padding: 5px 10px 10px 10px;
    text-indent: 0;
    border-bottom: 1px solid #ccc;
  }

  .CD_dealResult {
    color: #3980C8;
    display: inherit;
  }

  .CD_dealResult:hover {
    /* text-decoration: underline; */
    /* color: #E95252; */
  }
  .CD_dealResultf{
    border-radius: 3px;
    background-color: #33B3FF;
    color: #fff;
    cursor: pointer;
  }
  .CD_dealResultf:hover {
    /* text-decoration: underline; */
    background-color: #E95252;
    color: #fff;
  }
  .ComplaintsDetail .CD_aboutList ul li span.CD_dealResult,.ComplaintsDetail .CD_aboutList ul li span.CD_dealResultf{
    width: auto;
  }

  .CD_ListLi li {
    border: 1px solid #ccc;
    padding: 4px 8px;
    float: left;
    margin: 0 5px 5px 0;
    cursor: pointer;
  }

  .addComComplain {
    width: 500px;
  }

  .CD_ComplainTable tr {
    height: 50px;
  }

  .CD_ListLi li.checked {
    border: 1px #d81e06 solid;
  }
  .CD_dealResultfZD{
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
  }
  .CD_dealResultfZD span{
    width: auto;
  }
  .CD_dealResultfZD div span{
    height: 20px;
    line-height: 20px;
    margin-left: 3px;
    padding: 0 2px;
  }
</style>
<template>
  <div v-loading="loading">
    <div id="printComplaintDetial" class="ComplaintsDetail" v-if="isGetData">
      <p class="CD_Nav">{{ComplainInfo.ID}}{{$t('objFill.toushuxiangqing')}}</p>
      <div class="CD_Detail">
        <p class="CP_Chuli">
          {{$t('objFill.v101.Complaints.chulijg')}}:
          <span class="CP_redType">{{ComplainInfo.DisposeStatusStr}}</span>
          <span v-if="ComplainInfo.DisposeStatus===4" style="margin: 0 0 0 270px;">{{$t('objFill.v101.Complaints.yingpje')}}:<span class="CP_redType">{{getCompensateMoney()}}</span></span>
        </p>
        <p>{{$t('commonPickUp.Pick_TeamInfo')}}</p>
        <div class="CD_OrderList">
          <ul>
            <li><span>{{$t('advmanager.v_line')}}:</span>{{PriceInfo.LineName}}</li>
            <li><span>{{$t('advmanager.v_xilie')}}:</span>{{PriceInfo.LtName}}</li>
            <li><span>{{$t('scen.sc_temID')}}:</span><a style="text-decoration:underline;cursor:pointer;"
                                     @click="goTeamBalancePayment('团队收支','TeamBalancePayment',PriceInfo.TCID,PriceInfo.OutBranchId)">{{PriceInfo.TCID}}</a>
            </li>
            <li><span>{{$t('visa.v_xcdays')}}:</span>{{PriceInfo.DayNum}}</li>
            <li><span>{{$t('hotel.hotel_StarDate')}}:</span>{{PriceInfo.StartDate}}</li>
            <li><span>{{$t('sm.fanhuiDate')}}:</span>{{PriceInfo.BackDate}}</li>
            <li><span>{{$t('hotel.order_Number')}}:</span><a style="text-decoration:underline;cursor:pointer;"
                                    @click="goEnrollTotal('报名统计','enrollTotal',PriceInfo.OrderId)">{{PriceInfo.OrderId}}</a>
            </li>
            <li><span>{{$t('visa.v_yewuyuan')}}:</span>{{PriceInfo.Salesman}}</li>
            <li><span>{{$t('fnc.xiankong')}}:</span>{{PriceInfo.DriveByWire}}</li>
            <li><span>{{$t('Operation.Op_caozuoop')}}:</span>{{PriceInfo.OpName}}</li>
            <li><span>{{$t('leader.leader_Leader')}}:</span>{{PriceInfo.LeaderName}}</li>
            <li><span>{{$t('leader.leader_Guide')}}:</span>{{PriceInfo.GuideName}}</li>
          </ul>
        </div>
        <p>{{$t('objFill.v101.Complaints.toushuqk')}}</p>
        <div class="CD_aboutList">
          <ul>
            <li class="CD_Complaints">
              <span>{{$t('objFill.v101.Complaints.zhutinr')}}:</span>{{ComplainInfo.Contentrs}}
            </li>
            <li><span>{{$t('objFill.v101.Complaints.yanzhongcd')}}:</span>{{ComplainInfo.SeverityLevelStr}}</li>
            <li><span>{{$t('objFill.v101.Complaints.jilury')}}:</span>{{ComplainInfo.RecordEmpName}}</li>
            <li><span>{{$t('objFill.v101.Complaints.jilusj')}}:</span>{{ComplainInfo.RecordDateTime}}</li>
            <li><span>{{$t('objFill.v101.Complaints.shangbaosj')}}:</span>{{ComplainInfo.ReportDateTime}}</li>
            <li v-if="ComplainInfo.DisposeStatus===4">
              <span>{{$t('objFill.v101.Complaints.yingpje')}}:</span>{{getCompensateMoney()}}
            </li>
            <li v-if="ComplainInfo.DisposeStatus===4">
              <span>{{$t('objFill.v101.Complaints.yipeije')}}:</span>{{getBackMoney()}}
            </li>
            <li style="display: flex;width: 100%;"
              v-if="ComplainInfo.DisposeStatus===4&&(getLocalStorage().EmployeeId===ComplainInfo.CreateBy || getLocalStorage().EmployeeId===ComplainDetial[ComplainDetial.length-1].CreateBy||authority.indexOf('S_Complain_Finance')!=-1)">
              <span style="flex-shrink: 0;">{{$t('objFill.v101.Complaints.lijizhid')}}:</span>
              <div class="CD_dealResultfZD" v-for="(compensation,index) in ComplainCompensation"
              :style="{'margin-left':index!=0?'20px':''}">
                  <span class="CD_dealResult"
                    >{{compensation.CompensateMoney}}
                  </span>
                  <div>
                    <span class="CD_dealResultf" @click="setFinance(compensation)">
                      {{compensation.FinanceID?compensation.FinanceID:$t('objFill.v101.Complaints.zhuanzfk')}}
                    </span>
                    <span v-if="!compensation.FinanceID" class="CD_dealResultf" @click="setFinanceYL(compensation)">
                      {{$t('objFill.originalrefund')}}
                    </span>

                  </div>

                </div>

            </li>
            <li
              v-if="ComplainInfo.DisposeStatus===4&&getLocalStorage().EmployeeId===ComplainDetial[ComplainDetial.length-1].CreateBy">
            </li>
            <li></li>
          </ul>
          <ul>
            <li style="height:auto;line-height: 20px;padding:5px 0;">
              <p>{{ComplainInfo.Description}}</p>
            </li>
          </ul>
        </div>
        <div class="CD_Conditions">
        </div>
        <p>{{$t('objFill.v101.Complaints.chuliqk')}}</p>
        <div class="CD_Messagebox" v-for="item in ComplainDetial">
          <p class="t">{{item.EmpName}}
            <span v-if="item.Level!=0">{{$t('op.CostTime')}} {{getTimeConsuming(item)}}</span>
            <span v-else>{{$t('visa.v_chulizhong')}}</span>
          </p>
          <p v-if="item.Level!=0">
            {{item.Description}}
          </p>
          <p class="f" v-if="item.Level!=0">{{item.LevelStr}}<span>{{item.DealTime}}</span></p>
          <a class="CD_dealResult" v-if="getLocalStorage().EmployeeId===item.CreateBy&&item.Level===0"
             href="javascript:void(0)"
             @click="setResult(item)">{{$t('objFill.v101.Complaints.dianjtxcljg')}}</a>
        </div>
      </div>
      <p style="text-align: center;margin-top:20px;" v-if="ishowBtn">
        <input type="button" v-if="getLocalStorage().EmployeeId===ComplainDetial[ComplainDetial.length-1].CreateBy"
               class="normalBtn" @click="showChangeResult = true" :value="$t('objFill.v101.Complaints.genggtsjg')"/>
        <input
          v-if="ComplainInfo.DisposeStatus===4&&getLocalStorage().EmployeeId===ComplainDetial[ComplainDetial.length-1].CreateBy"
          type="button" class="normalBtn" @click="showAppendMoney = true"
          :value="$t('objFill.v101.Complaints.zuijiapeik')">
        <input type="button" class="hollowFixedBtn" :value="$t('ground.dayin')" @click.prevent="doPrint">
      </p>
    </div>

    <el-dialog custom-class='addComComplain' :title="$t('objFill.v101.Complaints.tianxtscljg')" :visible.sync="showDealModal" center>
      <table class="CD_ComplainTable">
        <tr>
          <td style="padding-left:15px;">{{$t('op.DealPeople')}}:</td>
          <td>{{DealEmpName}}</td>
        </tr>
        <tr style="height:70px;vertical-align:top;">
          <td colspan="2">
            <el-input type="textarea" class="w450" v-model="EditMsg.Description" :placeholder="$t('objFill.v101.Complaints.qingtxcljg')"></el-input>
          </td>
        </tr>
        <tr>
          <td>{{$t('objFill.v101.Complaints.yanzhongcd')}}:</td>
          <td>
            <ul class="CD_ListLi">
              <li v-for="subItem in severityList" @click="getServerity(subItem)" :class="{'checked':subItem.isCheck}">
                {{subItem.Name}}
              </li>
            </ul>
          </td>
        </tr>
        <tr>
          <td>{{$t('objFill.v101.Complaints.chulijg')}}:</td>
          <td>
            <ul class="CD_ListLi">
              <li v-for="subItem in processResult" @click="getResult(subItem)" :class="{'checked':subItem.isCheck}">
                {{subItem.name}}
              </li>
            </ul>
          </td>
        </tr>
        <tr v-if="isShowDealWay">
          <td>{{$t('objFill.v101.Complaints.jiejuefs')}}:</td>
          <td>
            <ul class="CD_ListLi">
              <li v-for="subItem in solutionList" @click="getSolution(subItem)" :class="{'checked':subItem.isCheck}">
                {{subItem.name}}
              </li>
            </ul>
          </td>
        </tr>
        <tr v-if="isShowMoney">
          <td>{{$t('objFill.v101.Complaints.peichangje')}}:</td>
          <td>
            <el-input type="text" v-model="EditMsg.CompensateMoney" class="w160"  @keyup.native="checkPrice(EditMsg,'CompensateMoney')"></el-input>
          </td>
        </tr>
        <tr v-if="isShowNextPersion">
          <td>{{$t('objFill.v101.Complaints.xiayigclr')}}:</td>
          <td>
            <el-select class="w160" v-model="EditMsg.NextPersion" filterable :placeholder="$t('pub.pleaseSel')">
              <el-option v-for="(item,index) in EmployeeList" :label="item.EmName" :value="item.EmployeeId"
                         :key="index"></el-option>
            </el-select>
          </td>
        </tr>
      </table>
      <div slot="footer" class="dialog-footer">
        <button class="normalBtn" @click="saveResult()" type="primary">{{$t('pub.saveBtn')}}</button> &nbsp;
        <button class="hollowFixedBtn" @click="showDealModal = false">{{$t('pub.cancelBtn')}}</button>
      </div>
    </el-dialog>
    <el-dialog custom-class='addComComplain' :title="$t('objFill.v101.Complaints.genggclr')" :visible.sync="showChangeResult" center>
      <table class="CD_ComplainTable">
        <tr>
          <td>{{$t('objFill.v101.Complaints.zhidxdclr')}}:</td>
          <td>
            <el-select class="w160" v-model="ChangeMsg.NextPersion" filterable :placeholder="$t('pub.pleaseSel')">
              <el-option v-for="(item,index) in EmployeeList" :label="item.EmName" :value="item.EmployeeId"
                         :key="index"></el-option>
            </el-select>
          </td>
        </tr>
      </table>
      <div slot="footer" class="dialog-footer">
        <button class="normalBtn" @click="saveChangeResult()" type="primary">{{$t('pub.saveBtn')}}</button> &nbsp;
        <button class="hollowFixedBtn" @click="showChangeResult = false">{{$t('pub.cancelBtn')}}</button>
      </div>
    </el-dialog>
    <el-dialog custom-class='addComComplain' :title="$t('objFill.v101.Complaints.zuijiapck')" :visible.sync="showAppendMoney" center>
      <table class="CD_ComplainTable">
        <tr>
          <td>{{$t('objFill.v101.Complaints.peichangje')}}:</td>
          <td>
            <el-input type="text" v-model="ZuiMsg.CompensateMoney" class="w160"  @keyup.native="checkPrice(ZuiMsg,'CompensateMoney')"></el-input>
          </td>
        </tr>
      </table>
      <div slot="footer" class="dialog-footer">
        <button class="normalBtn" @click="appendCompensateMoney()" type="primary">{{$t('pub.saveBtn')}}</button> &nbsp;
        <button class="hollowFixedBtn" @click="showAppendMoney = false">{{$t('pub.cancelBtn')}}</button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
  export default {
    data () {
      return {
        //员工
        EmployeeList: [],
        queryMsg: {
          ID: 0,
          OrderId: 0,
        },
        PriceInfo: '',//	团控详情
        ComplainInfo: '',//投诉详情
        ComplainDetial: [],//处理情况列表
        loading: false,
        showDealModal: false,
        //严重程度选中数组
        severityCked: [],
        //严重程度
        severityList: [],
        //处理结果
        processResult: [
          {
            Id: 1,
            name: this.$t('objFill.v101.Complaints.touswjj'),
            isCheck: false
          }, {
            Id: 2,
            name: this.$t('objFill.v101.Complaints.tousyjj'),
            isCheck: false
          }
        ],
        //解决选中数组
        solutionArr: [],
        //解决方式
        solutionList: [{
          Id: 3,
          name: this.$t('objFill.v101.Complaints.duifqxts'),
          isCheck: false
        }, {
          Id: 4,
          name: this.$t('objFill.peichang'),
          isCheck: false
        }, {
          Id: 5,
          name: this.$t('objFill.v101.Complaints.hejie'),
          isCheck: false
        }],
        //处理结果选取数组
        resultArr: [],
        //是否显示解决方式
        isShowDealWay: false,
        //是否显示赔偿金额
        isShowMoney: false,
        isShowNextPersion: false,//显示下一个处理人
        EditMsg: {
          ID: 0,
          Level: 0,//	严重程度
          ComplainID: 0,//	投诉id
          Description: '',//	描述
          Time: '',//	耗时
          DealResult: false,//处理结果 true:已解决,false:未解决
          DealWay: 0,//	解决方式
          CompensateMoney: 0,//赔偿金额
          NextPersion: '',//	下一个处理人
          CreateTime: '',//	创建时间
        },
        isGetData: false,
        showChangeResult: false,
        ChangeMsg: {
          ID: 0,
          ComplainID: 0,//	投诉id
          IsCreateNew: false,
          NextPersion: ''//	下一个处理人
        },
        DealEmpName: '',
        ishowBtn: true,
        showAppendMoney: false,
        ZuiMsg:{
           CompensateMoney: 0,//赔偿金额
        },
        ComplainCompensation: [],//赔款列表
        authority: [],
      }
    },
    methods: {
      getDetial () {
        this.loading = true
        this.apipost('conplain_get_GetComplainDetial', this.queryMsg, res => {
          this.loading = false
          this.isGetData = true
          if (res.data.resultCode == 1) {
            this.PriceInfo = res.data.data.PriceInfo;
            this.ComplainInfo = res.data.data.ComplainInfo
            this.ComplainDetial = res.data.data.ComplainDetial
            this.DealEmpName = this.ComplainDetial[this.ComplainDetial.length - 1].EmpName
            this.ComplainCompensation = res.data.data.ComplainCompensation
          } else {
            this.Error(res.data.message)
          }
        }, err => {
        })
      },
      //获取投诉枚举集合
      getEnumeration () {
        this.apipost('conplain_get_GetComplainEnumList', {}, res => {
          if (res.data.resultCode == 1) {
            this.severityList = []
            res.data.data.ComplainDealLevelList.forEach(x => {
              x['isCheck'] = false
              this.severityList.push(x)
            })
          } else {
            this.Error(res.data.message)
          }
        })
      },
      //根据当前员工所在部门获取该部门及子部门员工信息
      getEmployeeList () {
        let userInfo = this.getLocalStorage()
        let msg = {
          GroupId: userInfo.RB_Group_id,
          BranchId: '-1',
          DepartmentId: '-1',
          PostId: '-1',
          IsLeave: '0'
        }
        this.apipost(
          'admin_get_EmployeeGetList', {},
          res => {
            if (res.data.resultCode == 1) {
              this.EmployeeList = res.data.data
            }
          },
          err => {
          }
        )
      },
      //获取耗时
      getTimeConsuming (item) {
        var endDate = new Date()//获取系统当前时间
        let resultStr = ''
        if (item.Level === 0) {
          resultStr = this.$commonUtils.getDateTimeInterval(new Date(this.$commonUtils.getDateStr(item.CreateTime)), endDate)
        } else {
          resultStr = this.$commonUtils.getDateTimeInterval(new Date(this.$commonUtils.getDateStr(item.CreateTime)), new Date(this.$commonUtils.getDateStr(item.DealTime)))
        }
        return resultStr
      },
      //将yyyy年mm月dd日 hh:mm:ss 转换为 yyyy-mm-dd hh:mm:ss
      getDateStr (date) {
        let dateStr = ''
        if (date != '') {
          let dateArr = date.split(' ')
          let str = dateArr[0].replace(/[^\d]/g, '-')
          dateStr = str.substr(0, str.length - 1) + ' ' + dateArr[1]
        }
        return dateStr
      },
      //选择严重程度
      getServerity (item) {
        this.severityCked = []
        this.severityList.forEach(x => {
          x.isCheck = false
        })
        item.isCheck = !item.isCheck
        this.severityList.forEach(x => {
          if (x.isCheck) {
            this.severityCked.push(x.Id)
          }
        })
      },
      //处理结果
      getResult (item) {
        this.resultArr = []
        this.processResult.forEach(x => {
          x.isCheck = false
        })
        item.isCheck = !item.isCheck
        this.processResult.forEach(x => {
          if (x.isCheck) {
            this.resultArr.push(x.Id)
          }
        })
        this.isShowDealWay = false
        this.isShowNextPersion = false
        this.isShowMoney = false
        if (this.resultArr[0] === 1) {
          this.isShowNextPersion = true
          this.EditMsg.DealResult = false
        } else if (this.resultArr[0] === 2) {
          this.EditMsg.DealResult = true
          this.isShowDealWay = true
        }
      },
      //解决方式
      getSolution (item) {
        this.solutionArr = []
        this.solutionList.forEach(x => {
          x.isCheck = false
        })
        item.isCheck = !item.isCheck
        this.solutionList.forEach(x => {
          if (x.isCheck) {
            this.solutionArr.push(x.Id)
          }
        })
        if (this.solutionArr[0] === 4) {
          this.isShowMoney = true
        } else {
          this.isShowMoney = false
        }
      },
      setResult (item) {
        this.showDealModal = true
        this.EditMsg.ID = item.ID
        this.EditMsg.ComplainID = item.ComplainID
        this.EditMsg.CreateTime = item.CreateTime
      },
      //设置财务单据
      setFinance (compensation) {
        let id = [11, 16];
        //TODO跳转到财务单据
        if (compensation.FinanceID === 0) {
          var TCArr = [this.PriceInfo.TCID]
          let orderObj = {
            OrderID: this.PriceInfo.OrderId,
            OrderSource: 11,
            Obj: {},
            SourceID: compensation.ID,
            TCIDList: TCArr
          }
          this.$router.push({
            name: 'ChoiceAddFinancialDocuments',
            query: {
              Type: 2,
              templateID: JSON.stringify(id),
              companyID: this.PriceInfo.OutBranchId,
              'blank': 'y',
              'orderObj': JSON.stringify(orderObj)
            }
          })
        } else if (compensation.FinanceID > 0) {
          this.$router.push({
            name: 'FinancialDocumentsDetail',
            query: {
              id: compensation.FinanceID,
              blank: 'y',
              tab: '单据详情'
            }
          })
        }

      },
      //设置财务单据
      setFinanceYL (compensation) {
        let id = [252];//团费原路退款
        //TODO跳转到财务单据
        if (compensation.FinanceID === 0) {
          var TCArr = [this.PriceInfo.TCID]
          let orderObj = {
            OrderID: this.PriceInfo.OrderId,
            OrderSource: 11,
            Obj: {},
            SourceID: compensation.ID,
            TCIDList: TCArr
          }
          this.$router.push({
            name: 'ChoiceAddFinancialDocuments',
            query: {
              Type: 1,
              templateID: JSON.stringify(id),
              companyID: this.PriceInfo.OutBranchId,
              'blank': 'y',
              'orderObj': JSON.stringify(orderObj)
            }
          })
        } else if (compensation.FinanceID > 0) {
          this.$router.push({
            name: 'FinancialDocumentsDetail',
            query: {
              id: compensation.FinanceID,
              blank: 'y',
              tab: '单据详情'
            }
          })
        }

      },
      //保存结果
      saveResult () {
        if (this.severityCked.length === 0) {
          this.Error(this.$t('objFill.v101.Complaints.qingxzyzcd'))
          return false
        } else {
          this.EditMsg.Level = this.severityCked[0]
        }
        if (this.resultArr.length === 0) {
          this.Error(this.$t('objFill.v101.Complaints.qingxcljg'))
          return false
        }
        if (this.resultArr[0] === 1 && !(this.EditMsg.NextPersion > 0)) {
          this.Error(this.$t('objFill.v101.Complaints.qingxclr'))
          return false
        }
        if (this.resultArr[0] === 2 && this.solutionArr.length === 0) {
          this.Error(this.$t('objFill.v101.Complaints.qiingxjjfs'))
          return false
        } else {
          this.EditMsg.DealWay = this.solutionArr[0]
        }
        this.EditMsg.Time = this.getTimeConsuming({Level: 0, CreateTime: this.EditMsg.CreateTime})
        if (this.EditMsg.NextPersion == '') {
          this.EditMsg.NextPersion = 0
        }
        this.apipost('conplain_post_UpdateComplainDetial', this.EditMsg, res => {
          if (res.data.resultCode == 1) {
            this.Success(this.$t('objFill.v101.administrative.xiugaichenggong'))
            this.showDealModal = false
            this.getDetial()
          } else {
            this.Error(res.data.message)
          }
        }, err => {
        })
      },
      //更改投诉处理
      saveChangeResult () {
        if (!(this.ChangeMsg.NextPersion > 0)) {
          this.Error(this.$t('objFill.v101.Complaints.qingxclr'))
          return false
        }
        let changeItem = this.ComplainDetial[this.ComplainDetial.length - 1]
        this.ChangeMsg.ID = changeItem.ID
        this.ChangeMsg.ComplainID = changeItem.ComplainID
        if (changeItem.Level === 0) {
          this.ChangeMsg.IsCreateNew = false
        } else {
          this.ChangeMsg.IsCreateNew = true
        }
        this.apipost('conplain_post_ChangeDealWithPeople', this.ChangeMsg, res => {
          if (res.data.resultCode == 1) {
            this.Success(this.$t('objFill.v101.administrative.xiugaichenggong'))
            this.showChangeResult = false
            this.EditMsg.NextPersion = 0
            this.getDetial()
          } else {
            this.Error(res.data.message)
          }
        }, err => {
        })
      },
      //追加赔偿金额
      appendCompensateMoney () {
        if (!(this.ZuiMsg.CompensateMoney > 0)) {
          this.Error(this.$t('objFill.v101.Complaints.peicjebxdyn'))
          return false
        }
        let msg = {ID: this.queryMsg.ID, CompensateMoney: this.ZuiMsg.CompensateMoney}
        this.apipost('conplain_post_AppendCompensateMoney', msg, res => {
          if (res.data.resultCode == 1) {
            this.Success(this.$t('objFill.v101.Complaints.zuijpccg'))
            this.showAppendMoney = false
            this.ZuiMsg.CompensateMoney = 0
            this.getDetial()
          } else {
            this.Error(res.data.message)
          }
        }, err => {
        })
      },
      //打印
      doPrint () {
        this.ishowBtn = false
        setTimeout(this.getPrint, 500)
      },
      getPrint () {
        let subOutputRankPrint = document.getElementById('printComplaintDetial')
        let newContent = subOutputRankPrint.innerHTML
        let oldContent = document.body.innerHTML
        document.body.innerHTML = newContent
        window.print()
        window.location.reload()
        document.body.innerHTML = oldContent
        return false
      },
      //应赔金额
      getCompensateMoney () {
        let money = 0
        this.ComplainCompensation.forEach(x => {
          money += x.CompensateMoney
        })
        return money.toFixed(2);
      },
      //已赔金额
      getBackMoney () {
        let money = 0
        this.ComplainCompensation.forEach(x => {
          if(x.BackMoney<0){
            money += (x.BackMoney*-1)
          }
          else{
            money += x.BackMoney
          }

        })
        return money
      },
      goEnrollTotal (name, path, orderId) {
        this.$router.push({
          name: path,
          query: {orderId: orderId, blank: 'y', tab: name}
        })
      },
      goTeamBalancePayment (name, path, id, outBranchId) {
        this.$router.push({
          name: path,
          query: {id: id, outBranchId: outBranchId, blank: 'y', tab: name}
        })
      },
      initAuthor() {
        let msg = {
          MenuUrl: "/ChoiceAddFinancialDocuments"
        };
        this.apipost("admin_get_GetActionCodeForUrlAndUser", msg, r => {
          this.authority = r.data.data;
        });
      },
    },
    mounted () {
      this.queryMsg.ID = this.$route.query.id
      this.queryMsg.OrderId = this.$route.query.orderId
      this.getEnumeration()
      this.getEmployeeList()
      this.getDetial()
      this.initAuthor();
    }
  }

</script>