contract-list.vue 15.5 KB
Newer Older
1
<!--
786817560's avatar
786817560 committed
2
 * @Description: 签约单列表
3 4 5 6 7
   * @Author: your name
 * @Date: 2019-09-25 10:30:46/>: your name
   -->

<template>
786817560's avatar
786817560 committed
8
  <h-view id="distribute-sign" title="经销商签约">
9 10
    <h-header :proportion="[5,1,1]" class="bar-custom">
      <div slot="left" class="h-header-btn">
786817560's avatar
786817560 committed
11
        <img src="@/assets/userBind/arrow.png" @click="$routeGo()">
12
        <span>经销商签约</span>
13 14
      </div>
    </h-header>
15 16 17 18
    <div class="tab-style has-header">
      <div :class="{'done':num === 1,'undone':num !== 1}" @click="num = 1;"><img :src="num === 1?check1:uncheck1"><span>待签约</span></div>
      <div :class="{'done':num === 2,'undone':num !== 2}" @click="num = 2;"><img :src="num === 2?check2:uncheck2"><span>已签约</span></div>
    </div>
786817560's avatar
786817560 committed
19 20 21
    <!-- 搜索 -->
    <div class="search">
      <input v-model="searchInput" type="text" placeholder="请输入合同号/承租人名称">
李晓兵's avatar
李晓兵 committed
22
    </div>
786817560's avatar
786817560 committed
23 24
    <scroll
      ref="scroll"
786817560's avatar
786817560 committed
25
      :updateData="[showLists]"
786817560's avatar
786817560 committed
26
      :pullUp="true"
786817560's avatar
786817560 committed
27
      @pullingUp="loadMore"
786817560's avatar
786817560 committed
28 29
    >
      <div class="wrap">
786817560's avatar
786817560 committed
30
        <div v-for="(item,index) in showLists" :key="index" class="contract-lists" >
786817560's avatar
786817560 committed
31 32 33 34 35 36
          <div class="pro-code" @click="goDetails(item)">
            <img src="@/assets/distributorSign/fileIcon.png" alt="" class="file-icon">
            <p>
              <span>合同号</span>
              <span>{{ item.project_number }}</span>
            </p>
786817560's avatar
786817560 committed
37
            <img src="@/assets/distributorSign/goDetails.png" alt="" class="arrow">
786817560's avatar
786817560 committed
38 39 40
          </div>
          <div class="box">
            <div><p>承租人</p><p>{{ item.bp_name }}</p></div>
786817560's avatar
786817560 committed
41
            <div><p>合同名称</p><p>{{ item.project_name }}</p></div>
786817560's avatar
786817560 committed
42
            <div><p>合同租金</p><p class="money">{{ item.total_price|currency }}</p></div>
786817560's avatar
786817560 committed
43
            <div><p>产品名称</p><p>{{ item.division_n }}</p></div>
786817560's avatar
786817560 committed
44 45 46 47 48
            <div><p>申请时间</p><p>{{ dateConverse(item.confirm_start_date) }}</p></div>
          </div>
        </div>
      </div>
    </scroll>
李晓兵's avatar
李晓兵 committed
49 50 51 52 53
    <div v-if="showLists.length === 0">
      <div class="display">
        <img src="@/assets/messageCenter/noMsg.png" alt="">
      </div>
    </div>
李晓兵's avatar
李晓兵 committed
54 55
  </h-view>
</template>
56 57

<script>
58 59 60 61
import Check1 from '@/assets/constractSigning/no-done.png'
import Check2 from '@/assets/constractSigning/yes-done.png'
import unCheck1 from '@/assets/constractSigning/no-undone.png'
import unCheck2 from '@/assets/constractSigning/yes-undone.png'
62 63 64 65
export default {
  name: 'ContractList',
  data () {
    return {
66 67 68 69 70 71 72 73
      num: 1,
      submitPagenum: 1, // 待签约页码
      approvedPagenum: 1, // 已签约页码
      searchInput: '', // 搜索内容
      check1: Check1,
      check2: Check2,
      uncheck1: unCheck1,
      uncheck2: unCheck2,
74
      lists: [],
786817560's avatar
786817560 committed
75
      showLists: [],
76 77
      submitLists: [], // 待签约列表
      approvedLists: [], // 已签约列表
786817560's avatar
786817560 committed
78
      approvedFlag: false,
79 80
    }
  },
786817560's avatar
786817560 committed
81
  watch: {
786817560's avatar
786817560 committed
82 83
    'num': {
      handler (newVal, oldVal) {
786817560's avatar
786817560 committed
84
        // this.$refs.scroll.update(false)
786817560's avatar
786817560 committed
85
        this.$refs.scroll.scrollToTop()
786817560's avatar
786817560 committed
86 87 88 89 90 91 92 93 94
        if (newVal === 2) {
          if (!this.approvedFlag) {
            this.getLists()
          }
          this.$refs.scroll.scrollToTop()
          this.showLists = this.approvedLists
        } else if (newVal === 1) {
          this.showLists = this.submitLists
          this.$refs.scroll.scrollToTop()
786817560's avatar
786817560 committed
95
        }
786817560's avatar
786817560 committed
96
      },
786817560's avatar
786817560 committed
97
      // immediate: true,
786817560's avatar
786817560 committed
98 99 100 101 102 103 104 105 106 107 108
    },
    searchInput () {
      let vm = this
      if (vm.timeout) {
        clearTimeout(vm.timeout)
      }
      vm.timeout = setTimeout(() => {
        vm.search()
      }, 1000)
    },
  },
109
  created () {
110 111 112 113 114 115 116 117 118 119 120 121

  },
  beforeRouteEnter (to, from, next) {
    next(vm => {
      if (from.name === 'MyInfo') {
        vm.num = 1
        vm.submitPagenum = 1
        vm.approvedPagenum = 1
        vm.searchInput = ''
        vm.approvedFlag = false
        vm.submitLists = []
        vm.approvedLists = []
786817560's avatar
786817560 committed
122
        // vm.$refs.scroll.update(false)
786817560's avatar
786817560 committed
123
        vm.$refs.scroll.scrollToTop()
124 125
        vm.getLists()
      } else if (from.name === 'ContractDetails') {
786817560's avatar
786817560 committed
126
        if (window.localStorage.backflag === 'true') {
127 128 129 130 131 132 133 134
          vm.searchInput = ''
          vm.submitPagenum = 1
          vm.approvedPagenum = 1
          vm.approvedFlag = false
          vm.getLists()
        }
      }
    })
135 136 137 138 139
  },
  methods: {
    // 查询签约列表
    getLists () {
      let vm = this
140
      if (vm.num === 1) {
786817560's avatar
786817560 committed
141 142 143 144 145 146 147 148 149 150 151 152 153 154
        let url = $config.basePath + 'prj_confirm_list_query'
        let param = {
          pagesize: 10,
          pagenum: vm.submitPagenum,
          searchInput: vm.searchInput,
          confirm_status: 'SUBMIT',
          user_phone: window.localStorage.user_phone,
        }
        vm.hlsPopup.showLoading('数据加载中')
        vm.hlsHttp.post(url, param).then(function (res) {
          vm.hlsPopup.hideLoading()
          if (res.result === 'S') {
            console.log(res.lists)
            vm.submitLists = res.lists
786817560's avatar
786817560 committed
155
            vm.showLists = vm.submitLists
786817560's avatar
786817560 committed
156 157 158 159 160 161 162
            if (res.lists.length > 0 && res.lists.length < 10) {
              vm.$refs.scroll.update(true)
            } else if (res.lists.length === 10) {
              vm.$refs.scroll.update(false)
            }
          } else {
            hlsPopup.showLongCenter(res.message)
163
          }
786817560's avatar
786817560 committed
164
        })
165
      } else if (vm.num === 2) {
786817560's avatar
786817560 committed
166 167 168 169 170 171 172
        let url = $config.basePath + 'prj_confirm_list_query'
        let param = {
          pagesize: 10,
          pagenum: vm.approvedPagenum,
          searchInput: vm.searchInput,
          confirm_status: 'APPROVED',
          user_phone: window.localStorage.user_phone,
786817560's avatar
786817560 committed
173
        }
786817560's avatar
786817560 committed
174 175 176 177 178 179 180
        vm.hlsPopup.showLoading('数据加载中')
        vm.hlsHttp.post(url, param).then(function (res) {
          vm.hlsPopup.hideLoading()
          if (res.result === 'S') {
            console.log(res.lists)
            vm.approvedLists = res.lists
            vm.approvedFlag = true
786817560's avatar
786817560 committed
181
            vm.showLists = vm.approvedLists
786817560's avatar
786817560 committed
182
            if (res.lists.length > 0 && res.lists.length < 10) {
786817560's avatar
786817560 committed
183
              vm.$refs.scroll.update(true)
786817560's avatar
786817560 committed
184
            } else if (res.lists.length === 10) {
786817560's avatar
786817560 committed
185
              vm.$refs.scroll.update(false)
786817560's avatar
786817560 committed
186 187 188 189 190 191
            }
          } else {
            hlsPopup.showLongCenter(res.message)
          }
        })
      }
786817560's avatar
786817560 committed
192 193
    },
    loadMore () {
786817560's avatar
786817560 committed
194
      // debugger
786817560's avatar
786817560 committed
195
      let vm = this
196
      if (vm.num === 1) {
786817560's avatar
786817560 committed
197 198 199 200 201 202 203 204 205
        vm.submitPagenum++
        let url = $config.basePath + 'prj_confirm_list_query'
        let param = {
          user_phone: window.localStorage.user_phone,
          pagesize: 10,
          pagenum: vm.submitPagenum,
          confirm_status: 'SUBMIT',
          searchInput: vm.searchInput,
        }
786817560's avatar
786817560 committed
206
        vm.hlsPopup.showLoading('请稍后')
786817560's avatar
786817560 committed
207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224
        vm.hlsHttp.post(url, param).then(function (res) {
          vm.hlsPopup.hideLoading()
          let returnData = []
          if (res.result === 'S') {
            returnData = res.lists
            if (returnData.length === 0) {
              vm.$refs.scroll.update(true)
            } else if (returnData.length > 0 && returnData.length < 10) {
              returnData.forEach((data, index, array) => {
                vm.submitLists.push(array[index])
              })
              vm.$refs.scroll.update(true)
            } else if (returnData.length === 10) {
              returnData.forEach((data, index, array) => {
                vm.submitLists.push(array[index])
              })
              vm.$refs.scroll.update(false)
            }
786817560's avatar
786817560 committed
225
            vm.showLists = vm.submitLists
786817560's avatar
786817560 committed
226 227 228 229
          } else {
            hlsPopup.showLongCenter(res.message)
          }
        })
230
      } else if (vm.num === 2) {
786817560's avatar
786817560 committed
231 232 233 234 235 236 237 238 239
        vm.approvedPagenum++
        let url = $config.basePath + 'prj_confirm_list_query'
        let param = {
          user_phone: window.localStorage.user_phone,
          pagesize: 10,
          pagenum: vm.approvedPagenum,
          confirm_status: 'APPROVED',
          searchInput: vm.searchInput,
        }
786817560's avatar
786817560 committed
240
        vm.hlsPopup.showLoading('请稍后')
786817560's avatar
786817560 committed
241 242 243 244 245 246
        vm.hlsHttp.post(url, param).then(function (res) {
          vm.hlsPopup.hideLoading()
          let returnData = []
          if (res.result === 'S') {
            returnData = res.lists
            if (returnData.length === 0) {
786817560's avatar
786817560 committed
247
              vm.$refs.scroll.update(true)
786817560's avatar
786817560 committed
248 249 250 251
            } else if (returnData.length > 0 && returnData.length < 10) {
              returnData.forEach((data, index, array) => {
                vm.approvedLists.push(array[index])
              })
786817560's avatar
786817560 committed
252
              vm.$refs.scroll.update(true)
786817560's avatar
786817560 committed
253 254 255 256
            } else if (returnData.length === 10) {
              returnData.forEach((data, index, array) => {
                vm.approvedLists.push(array[index])
              })
786817560's avatar
786817560 committed
257
              vm.$refs.scroll.update(false)
786817560's avatar
786817560 committed
258
            }
786817560's avatar
786817560 committed
259
            vm.showLists = vm.approvedLists
786817560's avatar
786817560 committed
260 261 262 263 264 265
          } else {
            hlsPopup.showLongCenter(res.message)
          }
        })
      }
    },
786817560's avatar
786817560 committed
266
    submitSearch () {
786817560's avatar
786817560 committed
267 268
      let vm = this
      vm.submitPagenum = 1
786817560's avatar
786817560 committed
269 270 271 272
      let url = $config.basePath + 'prj_confirm_list_query'
      let param = {
        user_phone: window.localStorage.user_phone,
        pagesize: 10,
786817560's avatar
786817560 committed
273 274
        pagenum: vm.submitPagenum,
        confirm_status: 'SUBMIT',
786817560's avatar
786817560 committed
275 276
        searchInput: vm.searchInput,
      }
277
      vm.hlsPopup.showLoading('请稍后')
786817560's avatar
786817560 committed
278
      vm.hlsHttp.post(url, param).then(function (res) {
279
        vm.hlsPopup.hideLoading()
786817560's avatar
786817560 committed
280
        vm.submitLists = res.lists
786817560's avatar
786817560 committed
281 282 283
        if (vm.num === 1) {
          vm.showLists = vm.submitLists
        }
786817560's avatar
786817560 committed
284 285 286 287
        if (res.lists.length >= 0 && res.lists.length < 10) {
          vm.$refs.scroll.update(true)
        } else if (res.lists.length === 10) {
          vm.$refs.scroll.update(false)
786817560's avatar
786817560 committed
288
        }
786817560's avatar
786817560 committed
289
      })
290
    },
786817560's avatar
786817560 committed
291
    approvedearch () {
786817560's avatar
786817560 committed
292 293
      let vm = this
      let url = $config.basePath + 'prj_confirm_list_query'
786817560's avatar
786817560 committed
294
      vm.approvedPagenum = 1
786817560's avatar
786817560 committed
295 296 297
      let param = {
        user_phone: window.localStorage.user_phone,
        pagesize: 10,
786817560's avatar
786817560 committed
298 299
        pagenum: vm.approvedPagenum,
        confirm_status: 'APPROVED',
786817560's avatar
786817560 committed
300 301 302
        searchInput: vm.searchInput,
      }
      vm.hlsHttp.post(url, param).then(function (res) {
786817560's avatar
786817560 committed
303
        vm.approvedLists = res.lists
786817560's avatar
786817560 committed
304 305 306
        if (vm.num === 2) {
          vm.showLists = vm.approvedLists
        }
786817560's avatar
786817560 committed
307
        if (res.lists.length >= 0 && res.lists.length < 10) {
786817560's avatar
786817560 committed
308
          vm.$refs.scroll.update(true)
786817560's avatar
786817560 committed
309
        } else if (res.lists.length === 10) {
786817560's avatar
786817560 committed
310
          vm.$refs.scroll.update(false)
786817560's avatar
786817560 committed
311 312 313
        }
      })
    },
786817560's avatar
786817560 committed
314 315 316
    search () {
      this.submitSearch()
      setTimeout(this.approvedearch, 1000)
786817560's avatar
786817560 committed
317
    },
786817560's avatar
786817560 committed
318
    goDetails (item) {
319 320
      this.$router.push({
        name: 'ContractDetails',
321
        params: {
322
          item: item,
李晓兵's avatar
李晓兵 committed
323
          check_id: item.check_id,
324
        },
325 326
      })
    },
327 328 329
    dateConverse (date) {
      return date.replace(/\//g, '-')
    },
330 331 332
  },
}
</script>
786817560's avatar
786817560 committed
333 334
<style lang="less">
#distribute-sign {
李晓兵's avatar
李晓兵 committed
335 336 337 338 339 340 341 342 343
  .display {
    position: fixed;
    // top: 0;
    img {
      width: 100%;
      height: 100%;
      // margin-top: -70px;
    }
  }
344 345 346 347 348 349 350 351 352 353 354
  .tab-style{
    display:flex;
    width: 100%;
    justify-content: center;
    padding-top:12px;
    padding-bottom: 8px;
    align-items: center;
    background-color: #fff;
    box-shadow:0 2px 3px 0  rgba(220,220,221,0.50);
    position: absolute;
    z-index: 999;
786817560's avatar
786817560 committed
355

356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388
    div{
      position: relative;
      height: 32px;
      width: 172px;
      border-radius:16px;
      border-radius: 16px;
      font-family: PingFangSC-Semibold;
      font-size: 14px;
      letter-spacing: 0.43px;
      margin:  0 4px;
      line-height: 32px;
    }
    .undone{
      background: rgba(220,220,221,0.26);
      color: #383F45;
    }
    .done{
      background: rgba(0,70,156,0.10);
      color: #00469C;
    }

    img{
      height: 20px;
      display: block;
      float: left;
      margin: 6px 0 0 43px;
    }

    span{
      position: absolute;
      left:70px;
    }
  }
786817560's avatar
786817560 committed
389 390 391 392 393 394 395
  .search {
      background-color: #fff;
      padding: 8px 12px;
      position: absolute;
      width: 100%;
      z-index: 100;
      margin-bottom: 8px;
396
      margin-top: 52px;
786817560's avatar
786817560 committed
397
      input {
786817560's avatar
786817560 committed
398 399 400 401 402 403 404
        padding-left: 12px;
        border-radius: 4px;
        height: 36px;
        width: 100%;
        font-family: PingFangSC-Regular;
        font-size: 14px;
        color: #888C8F;
786817560's avatar
786817560 committed
405
        line-height: 36px;
406 407 408
        background: url("../../assets/contractStart/search1.png") 320px no-repeat;
        background-size: 16px 16px;
        background-color: rgba(239, 239, 239, 0.55);
786817560's avatar
786817560 committed
409 410 411 412 413
      }

      input::placeholder {
        font-size: 14px;
        color: #888C8F;
786817560's avatar
786817560 committed
414 415
        font-family: PingFangSC-Regular;
        letter-spacing: 0;
786817560's avatar
786817560 committed
416 417
      }

786817560's avatar
786817560 committed
418 419 420 421 422
      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;
786817560's avatar
786817560 committed
423
      }
786817560's avatar
786817560 committed
424 425
    }
  .wrap {
786817560's avatar
786817560 committed
426
      width: 100%;
786817560's avatar
786817560 committed
427
      padding: 8px;
786817560's avatar
786817560 committed
428 429 430 431 432 433 434 435 436 437
      .contract-lists {
        width: 100%;
        background: #fff;
        margin-bottom: 8px;
        .pro-code {
          height: 44px;
          width: 100%;
          display: flex;
          flex-direction: row;
          align-items: center;
李晓兵's avatar
李晓兵 committed
438

786817560's avatar
786817560 committed
439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466
          .file-icon {
            width: 30px;
            height: 30px;
            margin-left: 10px;
          }
          p {
            height: 44px;
            line-height: 44px;
            margin-left: 10px;
            flex: 1;
            font-family: PingFangSC-Semibold;
            font-size: 15px;
            color: #4B4A4B;
            letter-spacing: 0;
            border-bottom: 1px solid #F3F3F7
          }
          .arrow {
            height: 16px;
            width: 16px;
            margin-right: 10px;
            margin-left: -8px;
          }
        }
        .box {
          margin-left: 50px;
          margin-right: 19px;
          div {
            width: 100%;
李晓兵's avatar
李晓兵 committed
467 468 469 470
            padding: 8px 0;
            line-height: 18px;
            display: flex;
            justify-content: space-between;
786817560's avatar
786817560 committed
471 472 473 474 475 476 477 478 479 480 481 482
            position: relative;
            .money {
              font-family: Verdana-Bold;
              font-size: 14px;
              color: #4B4A4B;
              letter-spacing: 0;
              font-weight: 600;
            }
            p {
              font-family: PingFangSC-Regular;
              font-size: 14px;
              letter-spacing: 0;
李晓兵's avatar
李晓兵 committed
483 484 485
              word-break: break-all;
              word-wrap: break-word;
              white-space: normal;
786817560's avatar
786817560 committed
486 487
            }
            p:nth-of-type(1){
李晓兵's avatar
李晓兵 committed
488
              width: 32%;
786817560's avatar
786817560 committed
489 490 491 492 493 494 495 496 497
              left: 0;
              color: rgba(75,74,75,0.60);
            }
            p:nth-of-type(2){
              right: 0;
              color: #4B4A4B;
            }
          }
        }
498
      }
李晓兵's avatar
李晓兵 committed
499
  }
786817560's avatar
786817560 committed
500 501 502 503 504 505 506 507
  .content{
    position: absolute;
      top:0;
  }
  .scrollContent{
     padding-top: 2.88rem;
      padding-bottom: 20px;
    }
786817560's avatar
786817560 committed
508
}
786817560's avatar
786817560 committed
509
.platform-ios {
李晓兵's avatar
李晓兵 committed
510
    #distribute-sign {
786817560's avatar
786817560 committed
511 512 513 514 515 516 517 518
      .scrollContent {
        padding-top: 3.28rem;
      }
    }
  }
  // iPhoneX适配
  @media (device-width: 375px) and (device-height: 812px) and (-webkit-min-device-pixel-ratio: 3) {
    .platform-ios {
李晓兵's avatar
李晓兵 committed
519
      #distribute-sign {
786817560's avatar
786817560 committed
520
        .scrollContent {
李晓兵's avatar
李晓兵 committed
521
          padding-top: 3.68rem;
786817560's avatar
786817560 committed
522 523 524 525 526 527 528
        }
      }
    }
  }
  // iPhoneXR适配
  @media (device-width: 414px) and (device-height: 896px) {
    .platform-ios {
李晓兵's avatar
李晓兵 committed
529
      #distribute-sign {
786817560's avatar
786817560 committed
530
        .scrollContent {
李晓兵's avatar
李晓兵 committed
531
          padding-top: 3.68rem;
786817560's avatar
786817560 committed
532
        }
533 534 535 536 537 538 539 540 541 542 543 544 545 546
        .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;
        }
      }
786817560's avatar
786817560 committed
547 548 549
      }
    }
  }
550
</style>