<template>
  <div id="marketingqueryId" class="content">
    <div class="search">
      <mobile-input label-width="10px" :reset="resetvalue" input-align="left" name="searchContent" v-model="searchContent" placeholder="请输入关键字" size="small" />
      <div style="width: 200px; display: flex;justify-content: space-evenly;align-items: self-start">
        <van-button color="#FF574C" type="primary" @click="reset" plain style="width: 70px;height: 34px" size="small">重置</van-button>
        <van-button color="#FF574C" type="primary" @click="selectGDYXJHCX" style="width: 70px;height: 34px" size="small">查询</van-button>
      </div>
    </div>
    <div class="Managementdata">
      <scroller-view v-if="nodata" v-calculate-height :pulldown="pulldown" :pullup="pullup" :refresh-data="onrefreshdata" :load-data="onloaddata">
        <div v-for="(item, index) in itemDataList" :key="index" class="customer-bottom-list">
          <div class="faceSign-sty">
            <div class="customer-list-left">
              <div>
                <svg class="icon svg-sty" aria-hidden="true">
                  <use xlink:href="#icon-gongsimingcheng"></use>
                </svg>
              </div>
            </div>
            <div class="customer-list-right">
              <div>
                <span>【随意分】     {{ item.CUSTOMERNAME }}</span>
                <span style="margin-left: 10px">{{ item.BUSINESSDATE }}</span>
              </div>
              <div class="list-right-bottom">
                <span>
                  <svg class="icon" aria-hidden="true">
                    <use xlink:href="#icon-shoujizhanghao"></use>
                  </svg>
                </span>
                <span>{{ item.TELPHONE }}</span>
                <span>{{ item.COMPANYADD }}</span>
              </div>
            </div>
          </div>
          <div class="btn-sty">
            <van-button @click="invalidPopShow(item)" round color="#FF574C" plain size="small">复核</van-button>
          </div>
        </div>
      </scroller-view>
    </div>
  </div>
</template>

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

Vue.use(Popup);
Vue.use(Radio);
Vue.use(RadioGroup);
Vue.use(Search);
/**
 * @Description 电话营销
 * @Author JiangTao
 * @Date 2022-01-18 下午 04:06
 */
@Component({
  name: "FaceSignList",
  components: { BasePopup },
})
export default class FaceSignList extends Vue {
  itemDataList = [];
  searchContent = ''; //搜索内容
  resetvalue = false;
  pageNo = 1;
  pullup = true;
  pulldown = true;
  nodata = true;
  signPopupShow = false;
  invalidReason = '';
  taskInfo = {
    BUSINESSDATE: '',
    BUSINESSSUM: '',
    CERTID: '',
    COMPANYADD: '',
    COMPANYNAME: '',
    CUSTOMERID: '',
    CUSTOMERNAME: '',
    GJJTYPE: '',
    SERIALNO: '',
    SEX: '',
    SIGNSTATUS: '',
    SIGNYPE: '',
    TELPHONE: '',
    OBJECTNO: ''
  };

  //重置功能
  reset() {
    this.resetvalue = true;
    this.searchContent = '';
  }
  created() {
    this.selectGDYXJHCX();
  }
  /**
   * @Description 跳转面签流程
   * @Author XWH
   * @Date 2022-02-11 下午 17:02
   */
  toFaceSignProcess(item: any) {
    this.$store.commit("setFaceSignInfo",item);
    this.$router.push({
      path: "/FaceSignView",
    });
  }
  //上拉加载
  onloaddata() {
  }
  /**
   * @Description 下拉刷新
   * @Author JiangTao
   * @Date 2022-01-17 下午 05:14
   */;
  onrefreshdata() {
  }
  selectGDYXJHCX(pageNo = 1) {
    const param = {
        USERCODE: sessionStorage.getItem("user_code"),
        ORGCODE: sessionStorage.getItem("org_code"),
        QUERYFLAG: 2,
        tc: nettyApi.TRADE_CODE.selectFaceSignTaskList
      },
      _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.itemDataList = res.ARRAY;
        }
        if (res.ARRAY && res.ARRAY.length < 10) {
          this.pullup = false;
        }
        if (this.itemDataList.length == 0) {
          this.nodata = false;
          this.pulldown = false;
        }
      }else{
        NativeUI.toast(res.msg);
      }
    });
  }
  invalidPopShow(item: any){
    this.$router.push({
      path: "/FaceSignReviewView",
      query: {
        custInfo: item
      }
    });
  }
  /**
   * @Description 面签任务作废
   * @Author xwh
   * @Date 2022-02-16 下午 03:13
   */
  becomeInvalid(){
    const item = this.taskInfo;
    const param = {
        USERCODE: sessionStorage.getItem("user_code"),
        ORGCODE: sessionStorage.getItem("org_code"),
        USERNAME: sessionStorage.getItem("ORGNAME"),
        ORGNAME: sessionStorage.getItem("USERNAME"),
        QUERYFLAG: 1,
        SERIALNO: item.SERIALNO,
        OBJECTNO: item.OBJECTNO,
        OBJECTMODEL: '3', //1面签岗提交、2面签岗转让、3面签岗作废、4面签复核岗退回、5面签复核岗提交
        SIGNYPE: '2',
        BACKREASON: this.invalidReason,
        tc: nettyApi.TRADE_CODE.faceSignTaskProcess
      },
      _this = this;
    NativeUI.showWaiting('正在查询...');
    return IF.transferDataInter(nettyApi.commonRq, param).then((res: any) => {
      NativeUI.closeWaiting();
      console.log('面签作废',res)
      if(res.rc == 1){
        this.signPopupShow = false;
        _this.selectGDYXJHCX();
      }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: '2',//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){
      // }else{
      //   NativeUI.toast(res.msg);
      // }
    });
  }
}
</script>

<style scoped lang="scss">
::v-deep .van-cell__title,
::v-deep .van-field__label {
  display: flex;
  align-items: center;
}
.content {
  width: 100%;
}
.search {
  width: 100%;
  height: 70px;
  border: 1px solid #e1e2e3;
  display: flex;
  align-items: center;
  justify-content: center;
}
::v-deep .d-form-field {
  padding-bottom: 0;
  width: 70%;
}
::v-deep .van-field__control {
  height: 30px;
}
.customer-bottom-list {
  border-radius: 10px;
  box-shadow: 0 0 6px #d7d7d7;
  margin: 0 10px 16px 10px;
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.customer-bottom-list > div:nth-child(1) {
  width: 65%;
}
.customer-bottom-list > div:nth-child(2) {
  width: 35%;
  display: flex;
  justify-content: space-around;
}
.customer-bottom-list > div:nth-child(2) button {
  width: 70px !important;
}
.Managementdata {
  padding: 0 20px;
}
::v-deep .screenbutton button {
  margin: 20px auto;
}
::v-deep .screenbutton .van-button__content {
  font-size: 18px;
}
::v-deep .van-picker {
  width: 75%;
  margin-left: 25%;
  border-top-left-radius: 15px;
}
::v-deep  .van-popup--bottom .van-popup--round {
  width: 75% !important;
  margin-left: 25% !important;
}
::v-deep .van-popup--round {
  background-color: rgba(0, 0, 0, 0);
}
.searchStyle {
  display: grid;
  align-items: center;
  grid-template-columns: 1fr 1fr;
}
.searchStyle div {
  width: 90%;
}
::v-deep .scroller {
  margin-top: 10px;
}
::v-deep .van-popup--center {
  height: 50% !important;
  width: 60% !important;
  left: 62.5%;
}
.popup-data {
  width: 60%;
  height: 100%;
  margin: 0 auto;
}
::v-deep .popup-content {
  height: 100%;
}
::v-deep .popup-data .d-form-field {
  width: 100% !important;
  padding-bottom: 20px;
}
::v-deep .van-field__label {
  width: 4.5em;
}
.popup-data > div:nth-child(1) {
  font-size: 20px;
  font-weight: bold;
  padding-left: 1rem;
  margin-bottom: 5px;
}
.shortMessageContent {
  font-size: 18px;
  padding-top: 20px;
}
.labelData {
  width: auto;
  padding: 2px 5px !important;
  margin-left: 10px;
  font-size: 12px;
  color: #ff6e0d;
  background-color: #fff7cc;
  border-radius: 2px;
}
.svg-sty{
  width: 50px;
  height: 50px;
}
.faceSign-sty{
  display: flex;
  align-items: center;
  height: 100px;
}
.customer-list-right{
  display: flex;
  flex-direction: column;
}
div > span:nth-child(1){
  font-size: 16px;
}
div > span:nth-child(2){
  font-size: 14px;
  color: #a19b9b;
}
.list-right-bottom{
  margin-top: 8px;
  color: #a19b9b;
}
.list-right-bottom > span:nth-child(1) > svg{
  width: 20px;
  height: 20px;
}
.list-right-bottom > span:nth-child(2){
  margin-right: 20px;
}
.list-right-bottom > span:nth-child(3){
  font-size: 16px;
}
::v-deep .van-button{
  text-align: center;
}
.popup-sign-sty{
  background-color: white;
  .signTitle-sty{
    padding: 10px 0 20px 20px;
    font-size: 20px;
    height: 50px;
    border-bottom: 1px solid #C9C9C9;
  }
}
.sign-btn-sty{
  display: flex;
  justify-content: space-around;
  width: 60%;
  .item-sty{
    width: 130px;
    border: none;
    color: white;
  }
}
.reason-sty{
  width: 70%;
}
.bottom-sty{
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  align-items: center;
  height: 300px;
}
::v-deep .van-field__control{
  width: 500px;
  height: 70%;
}
.reason-sty > div:nth-child(1){
  font-size: 18px;
  height: 50px;
  line-height: 50px;
}
.radio-sty{
  height: 40px;
  margin: 0 10px 15px 0;
  font-size: 20px;
}
</style>