<template>
  <div style="height: 100%">
    <title-bar title="面签复核" @clickLeft="onClick">
      <van-icon slot="left" name="cross" size="24" />
    </title-bar>
    <div class="custInfo-sty">
      <svg class="icon svg-sty" aria-hidden="true">
        <use xlink:href="#icon-nanxing-gerentouxiangxpx"></use>
      </svg>
      <div>{{ faceSignInfo.CUSTOMERNAME}}</div>
      <div>客户编号：{{ faceSignInfo.CUSTOMERID}}</div>
    </div>
    <van-form class="form-sty" @submit="conmitReview">
      <div class="container-sty">
        <div class="middle-sty">
          <van-image
            fit="cover"
            position="left"
            :src="imgPath"
          />
          <div style="margin-left: 50px">
            <sub-title :customizedSty="customizedSty">
              <div style="font-size: 20px;font-weight: bold">面签复核-意见摘要</div>
            </sub-title>
            <div style="font-size: 18px;font-weight: bold;margin-left: 23px">复核意见</div>
            <van-radio-group v-model="checked">
              <van-radio icon-size="20px" class="radio-sty" checked-color="#ee0a24" name="1">同意</van-radio>
              <van-radio icon-size="20px" class="radio-sty" checked-color="#ee0a24" name="2">拒绝</van-radio>
            </van-radio-group>
            <div style="font-size: 18px;font-weight: bold;margin-left: 23px">意见描述</div>
            <mobile-input
              :rules="[{ required: true, message: '备注说明不能为空' }]"
              type="textarea"
              :maxlength="500"
              :rows="7"
              input-align="left"
              name="REMAKE"
              v-model="invalidReason"
              class="input-sty"
              size="small"
            />
          </div>
        </div>
        <van-button round color="#FF0000" class="btn-sty"  ative-type="submit">提交复核</van-button>
      </div>
    </van-form>
    <base-popup showCancel="true" showConfirm="true" @cancel="transferPopupShow = false" @confirm="conmitReview" v-model="transferPopupShow" title="人员列表">
      <div class="bottom-sty">
        <div class="reason-sty">
          <van-radio-group v-model="checked1" direction="horizontal">
            <van-radio v-for="(item, index) in customerList" :key="index" icon-size="25px" class="radio-sty" checked-color="#ee0a24" :name="index+1">{{ item.USERNAME }}</van-radio>
          </van-radio-group>
        </div>
      </div>
    </base-popup>
  </div>
</template>

<script lang="ts">
import { Vue, Component } from "vue-property-decorator";
import nettyApi from "@/constants/api/ms-netty/netty.api";
import {NativeUI} from "@/public/ts/NativeUI";
import IF from "@/public/factory/InterFaceFactory";
import {Image as VanImage } from 'vant';
import BasePopup from "@/components/general/BasePopup.vue";

Vue.use(VanImage);
/**
 * @Description:客户查询
 * @author pd
 * @date 2021-11-06 16:43:27
 */
@Component({
  name: "FaceSignReviewView",
  components: { BasePopup }
})
export default class FaceSignReviewView extends Vue {
  imgPath = require('@/assets/images/protocol.png');
  customizedSty = {
    width: '7px',
    height: '23px'
  };
  checked = 0
  checked1 = 0;
  invalidReason = '';
  transferPopupShow = false;
  customerList: any = [];
  faceSignInfo: any;

  created(){
    console.log(this.$route.query.custInfo);
    this.faceSignInfo = this.$route.query.custInfo;
  }
  onClick(){}
  conmitReview(){
    const faceSignInfo = this.faceSignInfo;
    const param = {
        USERCODE: sessionStorage.getItem("user_code"),
        ORGCODE: sessionStorage.getItem("org_code"),
        USERNAME: sessionStorage.getItem("ORGNAME"),
        ORGNAME: sessionStorage.getItem("USERNAME"),
        SERIALNO: faceSignInfo.SERIALNO,
        OBJECTMODEL: this.checked == 1 ? '5' : this.checked == 2 ? '4': '', //1面签岗提交、2面签岗转让、3面签岗作废、4面签复核岗退回、5面签复核岗提交
        SIGNYPE: faceSignInfo.SIGNYPE,
        REMARK: this.invalidReason,
        tc: nettyApi.TRADE_CODE.faceSignTaskProcess
      },
      _this = this;
    console.log(param);
    NativeUI.showWaiting('正在提交...');
    return IF.transferDataInter(nettyApi.commonRq, param).then((res: any) => {
      NativeUI.closeWaiting();
      console.log("提交成功",res);
      if(res.rc == 1){
        _this.$router.go(-1);
      }else{
        NativeUI.toast(res.msg);
      }
    });
  }
  /**
   * @Description 面签人员查询
   * @Author xwh
   * @Date 2022-02-16 下午 18:13
   */
  selectSignPeople(){
    const param = {
        USERCODE: sessionStorage.getItem("user_code"),
        ORGCODE: sessionStorage.getItem("org_code"),
        ROLEID: 'R1016',
        OBJECTMODEL: '1',//1流程提交用户查询、2总行面签岗人员查询
        tc: nettyApi.TRADE_CODE.selectSignPerson
      },
      _this = this;
    NativeUI.showWaiting('正在查询...');
    return IF.transferDataInter(nettyApi.commonRq, param).then((res: any) => {
      NativeUI.closeWaiting();
      console.log('查询用户列表',res)
      if(res.rc == 1){
        if(res.ARRAY.length > 0){
          _this.transferPopupShow = true;
          _this.customerList = res.ARRAY;
        }else{
          NativeUI.toast('未查询到可移交人员信息');
        }
      }else{
        NativeUI.toast(res.msg);
      }
    });
  }
}
</script>

<style lang="scss" scoped>
.custInfo-sty{
  width: 100%;
  height: 50px;
  display: flex;
  align-items: center;
  background-color: #FFFAFA;
  padding-left: 30px;
  div:nth-child(2){
    font-size: 20px;
    margin-right: 50px;
  }
  div:nth-child(3){
    font-size: 18px;

  }
}
.svg-sty{
  width: 35px;
  height: 35px;
}
.container-sty{
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-around;
  height: 80%;
}
.btn-sty{
  width: 300px;
}
.middle-sty{
  display: flex;
  width: 80%;
}
.radio-sty{
  height: 40px;
  margin: 0 10px 15px 23px;
  font-size: 18px;
}
::v-deep .van-field__control{
  width: 450px;
  height: 130px;
}
.input-sty{
  margin-left: 10px;
  margin-top: 20px;
}
.form-sty{
  height: calc(100vh - 110px);
}
.bottom-sty{
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  align-items: center;
  height: 100%;
}
::v-deep .van-field__control{
  width: 400px;
  height: 70%;
}
.radio-sty{
  height: 40px;
  margin: 0 15px 15px 0;
  font-size: 20px;
}
</style>
