add-undertake.vue 6.57 KB
Newer Older
linxin's avatar
linxin committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
<template>
  <h-view v-if="showFlag" id="add-person">
    <h-header :proportion="[1,4,1]" class="bar-custom">
      <span slot="center" style="color:#fff">添加担保人</span>
      <span slot="right" style="color:#fff" @click="showFlag=false">取消</span>
    </h-header>
    <div class="search has-header">
      <input v-model="keyWord" placeholder="请输入担保人名称/证件号码" >
    </div>
    <scroll ref="scroll" :updateData="[undertakeList]" :pullUp="true" @pullingUp="loadMore">
      <list-item :item-height="68" class="item">
        <item v-for="(item,index) in undertakeList" :key="index" @click.native="addUndertake(item)">
          <img slot="left-icon" src="@/assets/contractCreate/name.png" class="left-icon" >
          <div slot="name">
            担保人名称
            <br >证件号
          </div>
          <div slot="content">
linxin's avatar
linxin committed
19
            <input v-model="item.bp_guta_name" placeholder="暂无信息" readonly >
linxin's avatar
linxin committed
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
            <input v-model="item.id_card_no" placeholder="暂无信息" readonly >
          </div>
        </item>
      </list-item>
    </scroll>
  </h-view>
</template>
<script>
export default {
  props: {
    bp_agent_id: {
      type: String,
      default: '',
    },
  },
  data () {
    return {
      undertakeList: [], // 担保人列表
linxin's avatar
linxin committed
38
      selectUdertake: {},
linxin's avatar
linxin committed
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107
      pagenum: 1,
      keyWord: '',
      showFlag: false,
    }
  },
  watch: {

  },
  methods: {
    show () {
      this.showFlag = true
    },
    init () {
      this.undertakeList = []
      this.selectUdertake = []
      this.pagenum = 1
      this.keyWord = ''
    },
    unshow () {
      this.showFlag = false
    },
    loadMore () {
      if (this.keyWord) {
        this.searchUndertake()
      } else {
        this.getUndertake()
      }
    },
    searchUndertake () {
      let vm = this
      let randomString = Math.floor(Math.random() * 21)
      let url =
        process.env.basePath +
        'prj_bp_guta_query' +
        '&index' +
        `'${randomString}'`
      let param = {
        bp_agent_id: vm.bp_agent_id,
        pagesize: 10,
        pagenum: vm.pageNumSearch,
        searchInput: vm.keyWord,
      }
      hlsPopup.showLoading('请稍候')
      vm.$post(url, param).then(function (res) {
        vm.hlsPopup.hideLoading()
        if (res.result === 'S') {
          let returnData = []
          returnData = res.lists
          if (returnData.length === 0) {
            vm.undertakeList = returnData
            vm.$refs.scroll.update(true)
          } else if (returnData.length > 0 && returnData.length < 10) {
            vum.forEach(returnData, function (data, index, array) {
              vm.undertakeList = returnData
            })
            vm.$refs.scroll.update(true)
          } else if (returnData.length === 10) {
            vum.forEach(returnData, function (data, index, array) {
              vm.undertakeList.push(array[index])
            })
            vm.pageNumSearch++
            vm.$refs.scroll.update(false)
          }
        } else {
          hlsPopup.showLongCenter(res.message)
        }
      })
    },
    addUndertake (e) {
linxin's avatar
linxin committed
108
      this.selectUdertake = e
linxin's avatar
linxin committed
109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156
      this.$emit('addUnder', this.selectUdertake)
      setTimeout(() => {
        this.showFlag = false
      }, 100)
    },
    getUndertake () { // 担保人查询
      let vm = this
      let randomString = Math.floor(Math.random() * 21)
      let url =
        process.env.basePath +
        'prj_bp_guta_query' +
        '&index' +
        `'${randomString}'`
      let param = {
        bp_agent_id: vm.bp_agent_id,
        pagesize: 10,
        pagenum: vm.pageNum,
        searchInput: vm.keyWord,
      }
      hlsPopup.showLoading('请稍候')
      vm.$post(url, param).then(function (res) {
        vm.hlsPopup.hideLoading()
        if (res.result === 'S') {
          let returnData = []
          returnData = res.lists
          if (returnData.length === 0) {
            vm.$refs.scroll.update(true)
          } else if (returnData.length > 0 && returnData.length < 10) {
            vum.forEach(returnData, function (data, index, array) {
              vm.undertakeList.push(array[index])
            })
            vm.pagenum++
            vm.$refs.scroll.update(true)
          } else if (returnData.length === 10) {
            vum.forEach(returnData, function (data, index, array) {
              vm.undertakeList.push(array[index])
            })
            vm.pagenum++
            vm.$refs.scroll.update(false)
          }
        } else {
          hlsPopup.showLongCenter(res.message)
        }
      })
    },
  },
}
</script>
linxin's avatar
linxin committed
157
<style lang="less">
linxin's avatar
linxin committed
158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199
#add-person {
  position: absolute;
  top:0;
  z-index:999;
  .item {
    width: 359px;
    margin: 0 auto;
  }
  .search {
    background-color: #fff;
    padding: 8px 12px;
    width: 100%;
    height: 1.02rem;
    z-index: 100;
    input {
      background: url("../../assets/contractStart/search1.png") 320px no-repeat;
      background-size: 16px 16px;
      background-color: rgba(239, 239, 239, 0.55);
      padding-left: 12px;
      height: 36px;
      line-height: 36px;
      border-radius: 4px;
      width: 100%;
      font-family: PingFangSC-Regular;
      font-size: 14px;
      color: #888c8f;
    }

    input::placeholder {
      font-family: PingFangSC-Regular;
      font-size: 14px;
      color: #888c8f;
      letter-spacing: 0;
    }

    input:focus {
      background: url("../../assets/contractStart/search2.png") 320px no-repeat;
      background-size: 16px 16px;
      background-color: rgba(239, 239, 239, 0.55);
      border: 2px solid #bcc6ff;
    }
  }
linxin's avatar
linxin committed
200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251
   .content {
    position: absolute;
    top: 0;
  }
   .scrollContent {
       padding-top: 1rem;
    padding-bottom: 120px;
  }
  .tab-style {
    width: 100%;
    position: absolute;
  }
}
.platform-ios {
  #confirmList {
    .scrollContent {
      padding-top: 1.4rem;
    }
  }
}
@media (device-width: 375px) and (device-height: 812px) and (-webkit-min-device-pixel-ratio: 3) {
  .platform-ios {
    #person {
      .scrollContent {
        padding-top: 1.8rem;
      }
    }
  }
}
// iPhoneXR适配
@media (device-width: 414px) and (device-height: 896px) {
  .platform-ios {
    #person {
      .scrollContent {
        padding-top: 1.8rem;
      }
      .search {
        input {
          background: url("../../assets/contractStart/search1.png") 320px
            no-repeat;
          background-size: 16px 16px;
          background-color: rgba(239, 239, 239, 0.55);
          padding: 8px 12px;
          border-radius: 4px;
          width: 100%;
          font-family: PingFangSC-Regular;
          font-size: 14px;
          color: #888c8f;
        }
      }
    }
  }
linxin's avatar
linxin committed
252 253
}
</style>