repay-plans.vue 11 KB
Newer Older
linxin's avatar
linxin committed
1 2 3
<!--
 * @Author: your name
 * @Date: 2019-10-31 09:49:57
786817560's avatar
786817560 committed
4
 * @LastEditTime : 2019-12-26 16:47:18
786817560's avatar
786817560 committed
5
 * @LastEditors  : Please set LastEditors
linxin's avatar
linxin committed
6 7 8
 * @Description: 还款
 * @FilePath:
 -->
24776's avatar
24776 committed
9
<template>
786817560's avatar
786817560 committed
10
  <h-view id="repay-plans" class="public-style">
24776's avatar
24776 committed
11 12 13 14 15 16 17 18 19 20
    <h-header :proportion="[5,1,1]" class="bar-custom">
      <div slot="left" class="h-header-btn">
        <img src="@/assets/userBind/arrow.png" @click="$routeGo()">
        <span>融资明细</span>
      </div>
    </h-header>
    <div class="center">

      <div class="total">
        <div class="sum">
786817560's avatar
786817560 committed
21
          <div>租金总额</div>
786817560's avatar
786817560 committed
22
          <p>{{ info.total_rental_sum | currency }}</p>
24776's avatar
24776 committed
23
          <img src="@/assets/contractInquire/num.png" alt="">
linxin's avatar
linxin committed
24
          <h3><span>{{ info.lease_times }}</span></h3>
24776's avatar
24776 committed
25 26
        </div>
        <div class="single">
linxin's avatar
linxin committed
27 28 29
          <div><h4>保证金</h4><p>{{ info.deposit | currency }}</p></div>
          <div><h4>首付款</h4><p>{{ info.down_payment | currency }}</p></div>
          <div><h4>手续费</h4><p>{{ parseFloat(info.lease_charge).toFixed(2) | currency }}</p></div>
24776's avatar
24776 committed
30 31 32 33 34 35 36 37 38
        </div>
      </div>
      <div class="plan-name">
        <div class="header">还款计划</div>
        <img :class="{'rotate':show}" src="@/assets/contractInquire/top.png" alt="" @click="showDetails">
      </div>
    </div>
    <h-content id="content" class="plan-content">
      <!-- 已结清 black , 逾期 orange , 还款中 blue , 未还款 green -->
786817560's avatar
786817560 committed
39
      <div v-for="(item,index) in repayLists" :key="index" :class="{'plan-list':true,'or':statu==='orange','bl':statu==='blue','gr':statu==='green'}">
24776's avatar
24776 committed
40 41 42 43 44 45
        <div :class="{'period':true,'orange':statu==='orange','blue':statu==='blue','green':statu==='green'}">{{ index + 1 }}</div>
        <img v-if="statu === 'black'" src="@/assets/contractInquire/black.png" alt="" class="left">
        <img v-if="statu === 'orange'" src="@/assets/contractInquire/orange.png" alt="" class="left">
        <img v-if="statu === 'blue'" src="@/assets/contractInquire/blue.png" alt="" class="left">
        <img v-if="statu === 'green'" src="@/assets/contractInquire/green.png" alt="" class="left">
        <div class="time">
786817560's avatar
786817560 committed
46 47
          <p>{{ item.due_date.substr(0,4) }}</p>
          <span>{{ dateConverse(item.due_date).substr(5,10) }}</span>
24776's avatar
24776 committed
48
        </div>
786817560's avatar
786817560 committed
49

24776's avatar
24776 committed
50
        <div class="number">
786817560's avatar
786817560 committed
51 52 53 54 55 56 57 58 59 60
          <div>
            <span>本金</span>
            <span>{{ item.principal |currency }}</span>
          </div>
          <div>
            <span>租金</span>
            <span :class="{'orang':statu==='orange','blu':statu==='blue','gree':statu==='green'}">{{ item.rental |currency }}</span>
          </div>
        </div>
        <div class="name">
786817560's avatar
786817560 committed
61 62
          <span>利息</span>
          <span>{{ item.interest | currency }}</span>
24776's avatar
24776 committed
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85
        </div>
        <img v-if="statu === 'black'" src="@/assets/contractInquire/done.png" alt="" class="status">
        <img v-if="statu === 'orange'" src="@/assets/contractInquire/prompt.png" alt="" class="status">
      </div>
    </h-content>

  </h-view>
</template>

<script>

export default {
  name: 'RepayPlan',
  components: {
  },
  data () {
    return {
      //  已结清 black , 逾期 orange , 还款中 blue , 未还款 green
      statu: 'orange',
      show: false,
      height: 0,
      oldHeight: 0,
      newHeight: 0,
linxin's avatar
linxin committed
86
      info: {},
786817560's avatar
786817560 committed
87 88
      repayLists: [],
      lease_num: this.$route.params.lease_num,
24776's avatar
24776 committed
89 90 91 92
    }
  },
  computed: {},
  watch: {},
linxin's avatar
linxin committed
93 94 95 96 97 98 99
  beforeRouteEnter (to, from, next) {
    next(vm => {
      if (from.name === 'RepayDetail') {
        vm.repayPlan()
      }
    })
  },
24776's avatar
24776 committed
100
  methods: {
786817560's avatar
786817560 committed
101 102 103 104 105 106 107 108 109 110 111
    dateConverse (date) {
      return date.replace(/\//g, '-')
    },
    // 根据还款期排序
    arrSort (property) {
      return function (a, b) {
        var value1 = a[property]
        var value2 = b[property]
        return value1 - value2
      }
    },
24776's avatar
24776 committed
112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134
    showDetails () {
      if (!this.flag) {
        this.flag = true
        this.height = document.getElementsByClassName('total')[0].clientHeight
        this.oldHeight = document.getElementById('content').clientHeight
        this.newHeight = this.height + this.oldHeight
      }
      if (!this.show) {
        this.show = !this.show
        document.getElementById('content').style.height = this.newHeight + 'px'
        document.getElementsByClassName('center')[0].style.transition = 'all .3s cubic-bezier(0.165, 0.84, 0.44, 1) 0s'
        document.getElementsByClassName('center')[0].style.transform = 'translate(0px, -' + this.height + 'px) scale(1) translateZ(0px)'
        document.getElementById('content').style.transition = 'all .3s cubic-bezier(0.165, 0.84, 0.44, 1) 0s'
        document.getElementById('content').style.transform = 'translate(0px, -' + this.height + 'px) scale(1) translateZ(0px)'
      } else {
        this.show = !this.show
        document.getElementById('content').style.height = this.oldHeight + 'px'
        document.getElementsByClassName('center')[0].style.transition = 'all .3s cubic-bezier(0.165, 0.84, 0.44, 1) 0s'
        document.getElementsByClassName('center')[0].style.transform = 'translate(0px, -' + 0 + 'px) scale(1) translateZ(0px)'
        document.getElementById('content').style.transition = 'all .3s cubic-bezier(0.165, 0.84, 0.44, 1) 0s'
        document.getElementById('content').style.transform = 'translate(0px, -' + 0 + 'px) scale(1) translateZ(0px)'
      }
    },
linxin's avatar
linxin committed
135 136 137 138 139 140 141 142 143 144 145 146
    repayPlan () {
      let vm = this
      let url = $config.basePath + 'con_equip_cashflow_query'
      let param = {
        contract_id: vm.$route.params.contract_id,
      }
      vm.hlsPopup.showLoading('数据加载中')
      vm.hlsHttp.post(url, param).then(function (res) {
        console.log(res)
        vm.hlsPopup.hideLoading()
        if (res.result === 'S') {
          vm.info = res.info
786817560's avatar
786817560 committed
147
          vm.repayLists = res.lists.sort(vm.arrSort('times')) // 根据还款期排序
linxin's avatar
linxin committed
148 149 150 151 152
        } else {
          hlsPopup.showLongCenter(res.message)
        }
      })
    },
24776's avatar
24776 committed
153 154 155
  },
}
</script>
786817560's avatar
786817560 committed
156 157
<style lang='less'>
#repay-plans {
786817560's avatar
786817560 committed
158

24776's avatar
24776 committed
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 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 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287
  .total {
    position: relative;
    background-color: #1D3FFF;
    height: 138px;
    color: #fff;
    background-image: url(../../assets/contractInquire/background.png);
    background-size: cover;

    .sum {
    padding: 0 20px;
      div {
        font-family: PingFangSC-Semibold;
        font-size: 14px;
        padding-top: 12px;
        padding-bottom: 10px;
      }

      p {
        font-family: Verdana-BoldItalic;
        font-size: 20px;
        font-weight: 700;
        font-style: italic;
        margin-left: -4px;
      }

      img {
        width: 75px;
        position: absolute;
        right: 20px;
        top: 25px;
      }

      h3 {
        position: absolute;
        font-weight: 700;
        margin: 0;
        right: 42px;
        top: 32px;
        color: #1D3FFF;
        font-family: PingFangSC-Semibold;
        font-size: 14px;

        span {
          font-style: italic;
          margin-right: 5px;
        }
      }
    }

    .single {
      display: flex;
      margin-top: 28px;

      div {
        flex: auto;
        text-align: center;

        h4 {
          opacity: 0.8;
          margin: 0;
          font-family: PingFangSC-Regular;
          font-size: 12px;
          color: #FFFFFF;
          margin-bottom: 8px;
        }

        p {
          font-family: Verdana;
          font-size: 14px;
          color: #FFFFFF;
          font-weight: 700;
        }
      }
    }

  }

  .plan-name {
    position: relative;
    background-color: #1D3FFF;
    margin-top: -2px;

    img {
      position: absolute;
      right: 30px;
      top: 12px;
      height: 20px;
      transition: 0s;
    }

    .rotate {
      transform: rotate(180deg);
    }

    .header {
      position: relative;
      height: 48px;
      line-height: 48px;
      background-color: #fff;
      font-family: PingFangSC-Semibold;
      font-size: 14px;
      color: #21254C;
      font-weight: 700;
      text-indent: 2em;
      border-radius: 24px 0 0 0 ;

      &:before {
        content: "";
        position: absolute;
        top: 16px;
        left: 15px;
        width: 4px;
        height: 16px;
        background: #1D3FFF;
      }
    }
  }

  .plan-content {
    background-color: #fff;
    padding: 0px 11px;

    .plan-list {
      position:relative;
      background-color: #f7f7f7;
      height: 78px;
      display: flex;
      padding-right: 20px;
      padding-left: 10px;
786817560's avatar
786817560 committed
288
      padding-top: 20px;
24776's avatar
24776 committed
289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310
      margin-bottom: 10px;

      .left {
        height: 30px;
        position: absolute;
        left: -8px;
        top: 24px;
      }

      .status {
        position: absolute;
        width:18px;
        right: -3px;
        top: -5px;
      }

      .period {
        position: absolute;
        top: 0;
        left: 0;
        background: rgba(75,74,75,.5);
        border-radius: 4px 0 4px 0;
786817560's avatar
786817560 committed
311 312 313
        // width: 30px;
        padding: 1px 2px;
        height: 20px;
24776's avatar
24776 committed
314 315 316 317
        color: #fff;
        font-family: PingFangSC-Semibold;
        font-size: 12px;
        letter-spacing: 1.09px;
786817560's avatar
786817560 committed
318
        line-height: 20px;
24776's avatar
24776 committed
319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340
        text-align: center;
      }

      .orange {
        background: rgba(253, 182, 47,.5);
      }

      .blue {
        background-color: rgba(29, 63, 255,.5);
      }

      .green {
        background-color: rgba(27, 162, 97,.5);
      }

      .time {

        p {
          font-family: DIN-Regular;
          font-size: 12px;
          color: rgba(56,63,69,0.60);
          margin-bottom: 4px;
786817560's avatar
786817560 committed
341
          margin-top: 8px;
24776's avatar
24776 committed
342 343 344 345 346 347 348 349 350 351 352
        }

        span {
          font-family: DIN-Bold;
          font-weight: 700;
          font-size: 14px;
          color: #21254C;
        }
      }

      .name {
786817560's avatar
786817560 committed
353
        // flex: 9;
24776's avatar
24776 committed
354 355 356
        font-family: PingFangSC-Regular;
        font-size: 13px;
        color: #4B4A4B;
786817560's avatar
786817560 committed
357
        //padding-top: 20px;
786817560's avatar
786817560 committed
358 359 360 361 362 363
        margin-left: 22px;
        span:nth-of-type(2) {
          margin-left: 8px;
        }
        span:nth-of-type(1) {
          opacity: 0.6;
24776's avatar
24776 committed
364 365 366 367
        }
      }

      .number {
786817560's avatar
786817560 committed
368
        // flex: 9;
786817560's avatar
786817560 committed
369 370
        display: flex;
        flex-direction: column;
24776's avatar
24776 committed
371 372 373
        font-family: PingFangSC-Regular;
        font-size: 13px;
        color: #4B4A4B;
786817560's avatar
786817560 committed
374 375 376 377
        margin-left: 20px;
        div:nth-of-type(2) {
          margin-top: 12px;
        }
786817560's avatar
786817560 committed
378 379
        span:nth-of-type(2) {
          margin-left: 8px;
24776's avatar
24776 committed
380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409
        }
        span.orang {
          color: rgb(253, 182, 47);
          font-weight: 700;
          font-family: PingFangSC-Semibold;
        }
        span.blu {
          color: #1D3FFF;
          font-weight: 700;
          font-family: PingFangSC-Semibold;
        }
        span.gree {
          color: #1BA261;
        }
      }
    }

    .or {
        background-color:rgba(253, 182, 47,.05);
    }

    .bl,.gr {
      background: #FFFFFF;
      box-shadow: 0 1px 5px 0 rgba(219,219,219,0.69);
    }

  }

}
</style>