refund.vue 9.5 KB
Newer Older
1 2 3 4 5 6 7 8 9 10
<!--
 * @Author: your name
 * @Date: 2019-10-31 09:49:57
 * @LastEditTime: 2019-11-01 09:36:50
 * @LastEditors: Please set LastEditors
 * @Description: 还款
 * @FilePath:
 -->
<template>
  <h-view id="repay-plan" class="public-style">
linxin's avatar
linxin committed
11
    <transition name="trans">
linxin's avatar
linxin committed
12
      <div v-show="show" class="modal-show" @click="show=false">
linxin's avatar
linxin committed
13 14 15 16 17 18 19 20 21 22
        <div class="down">
          <table>
            <tr>
              <th>款项</th>
              <th>应还金额</th>
              <th>还款金额</th>
              <th>支付方式</th>
            </tr>
            <tr>
              <td>本金</td>
linxin's avatar
linxin committed
23 24 25
              <td>{{ pop.principal|currency }}</td>
              <td>{{ pop.received_principal|currency }}</td>
              <td>{{ pop.pay_method }}</td>
linxin's avatar
linxin committed
26 27
            </tr>
            <tr>
linxin's avatar
linxin committed
28
              <td>利息</td>
linxin's avatar
linxin committed
29 30 31
              <td>{{ pop.interest|currency }}</td>
              <td>{{ pop.received_interest|currency }}</td>
              <td>{{ pop.pay_method }}</td>
linxin's avatar
linxin committed
32 33 34 35 36
            </tr>
          </table>
        </div>
      </div>
    </transition>
37 38 39 40 41 42 43 44 45 46 47 48 49
    <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="plan-name">
        <div class="header">还款计划</div>
      </div>
    </div>
    <h-content id="content" class="plan-content">
      <!-- 已结清 black , 逾期 orange , 还款中 blue , 未还款 green -->
linxin's avatar
linxin committed
50

linxin's avatar
linxin committed
51 52 53 54 55 56
      <div
        v-for="(item,index) in lists"
        :key="index"
        :class="{'plan-list':true,'or':statu==='orange','bl':statu==='blue','gr':statu==='green'}"
        @click="showModel(item)"
      >
57
        <div
linxin's avatar
linxin committed
58 59 60 61 62 63 64 65 66 67 68
          :class="{'period':true,'orange':statu==='orange','blue':statu==='blue','green':statu==='green'}"
        >{{ item.times }}</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">
          <p>{{ selectYear(item.repayment_date) }}</p>
          <span>{{ selectMonth(item.repayment_date) }}</span>
        </div>
        <div class="message">
linxin's avatar
linxin committed
69 70 71 72 73 74 75 76 77 78
          <div class="name">
            <p>
              现金流项目
              <span>支付方式</span>
            </p>
            <p>
              {{ item.cf_item_name }}
              <span>{{ item.pay_method }}</span>
            </p>
          </div>
linxin's avatar
linxin committed
79 80 81 82 83 84
          <div class="name">
            <p>
              应还金额
              <span>已还金额</span>
            </p>
            <p>
linxin's avatar
linxin committed
85
              {{ parseFloat(item.due_amount).toFixed(2)|currency }}
linxin's avatar
linxin committed
86 87 88
              <span
                :class="{'orang':statu==='orange','blu':statu==='blue','gree':statu==='green'}"
              >{{ item.received_amount|currency }}</span>
linxin's avatar
linxin committed
89
            </p>
90
          </div>
linxin's avatar
linxin committed
91
        </div>
linxin's avatar
linxin committed
92 93 94 95 96

        <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>
97 98 99 100 101 102 103 104 105
  </h-view>
</template>

<script>
export default {
  components: {},
  data () {
    return {
      //  已结清 black , 逾期 orange , 还款中 blue , 未还款 green
linxin's avatar
linxin committed
106 107
      statu: 'blue',
      show: false,
linxin's avatar
linxin committed
108
      pop: {},
109
      info: {},
linxin's avatar
linxin committed
110
      lists: [],
111 112 113 114
    }
  },
  beforeRouteEnter (to, from, next) {
    next(vm => {
115
      vm.show = false
116 117 118 119
      vm.getRefund()
    })
  },
  methods: {
linxin's avatar
linxin committed
120 121 122
    showModel (e) {
      if (e.cf_item_name === '租金') {
        this.show = true
linxin's avatar
linxin committed
123
        this.pop = e
linxin's avatar
linxin committed
124
      }
linxin's avatar
linxin committed
125
    },
126
    selectMonth (e) {
linxin's avatar
linxin committed
127
      return e.substring(5, 10)
128 129 130 131
    },
    selectYear (e) {
      return e.substring(0, 4)
    },
linxin's avatar
linxin committed
132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147
    insertRank () { // 插入排序法,根据期数升序排序
      let vm = this
      let len = vm.lists.length
      // 从第二个元素开始比较
      for (let i = 1; i < len; i++) {
        let tempTime = parseInt(vm.lists[i].times)
        let temp = vm.lists[i]
        let j = i - 1
        // 若后面的元素小于前面的元素,进入while循环,直到后面元素大于前面元素,跳出循环
        while (j >= 0 && parseInt(vm.lists[j].times) > tempTime) {
          vm.lists[j + 1] = vm.lists[j]
          j--
        }
        vm.lists[j + 1] = temp
      }
    },
148 149 150 151 152 153 154 155 156 157 158
    getRefund () {
      let vm = this
      let url = process.env.basePath + 'con_equip_repayment_plan'
      let param = {
        contract_id: this.$route.params.contract_id,
      }
      hlsPopup.showLoading('请稍候')
      vm.$post(url, param).then(function (res) {
        vm.hlsPopup.hideLoading()
        if (res.result === 'S') {
          vm.lists = res.lists
linxin's avatar
linxin committed
159
          vm.insertRank()
160 161 162 163 164 165 166 167 168 169
        } else {
          hlsPopup.showLongCenter(res.message)
        }
      })
    },
  },
}
</script>
<style lang='less' >
#repay-plan {
linxin's avatar
linxin committed
170 171 172 173 174 175 176 177
  .trans-enter-active,
  .trans-leave-active {
    transition: opacity 0.5s;
  }
  .trans-enter,
  .trans-leave-active {
    opacity: 0;
  }
linxin's avatar
linxin committed
178
  .modal-show {
linxin's avatar
linxin committed
179 180 181
    width: 100%;
    height: 100%;
    position: absolute;
linxin's avatar
linxin committed
182
    z-index: 666;
linxin's avatar
linxin committed
183 184 185 186 187 188 189 190
    background-color: rgba(56, 63, 69, 0.3);
    display: flex;
    justify-content: center;
    align-items: center;
    .down {
      position: relative;
      width: 314px;
      height: 119px;
linxin's avatar
linxin committed
191
      z-index: 999;
linxin's avatar
linxin committed
192 193
      background-size: 301px 24.7px;
      background-color: #fff;
linxin's avatar
linxin committed
194 195
      table {
        width: 100%;
linxin's avatar
linxin committed
196
        text-align: center;
linxin's avatar
linxin committed
197
        text-indent: 10px;
linxin's avatar
linxin committed
198 199
        tr:first-child {
          height: 46px;
linxin's avatar
linxin committed
200 201
          line-height: 46px;
          font-family: PingFangSC-Semibold;
linxin's avatar
linxin committed
202 203 204
          font-size: 14px;
          color: #1d3fff;
          font-weight: 600;
linxin's avatar
linxin committed
205
          border-bottom: 1px solid #d9dbdf;
linxin's avatar
linxin committed
206
        }
linxin's avatar
linxin committed
207 208 209
        tr {
          width: 100%;
          height: 36px;
linxin's avatar
linxin committed
210
          line-height: 36px;
linxin's avatar
linxin committed
211 212
          text-align: center;
        }
linxin's avatar
linxin committed
213
        td {
linxin's avatar
linxin committed
214
          font-family: PingFangSC-Regular;
linxin's avatar
linxin committed
215 216
          font-size: 13px;
          color: #4b4a4b;
linxin's avatar
linxin committed
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
      }
    }
  }
  .plan-name {
    position: relative;
    background-color: #1d3fff;
    width: 100%;
    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;
linxin's avatar
linxin committed
263
    // padding: 0px 11px;
264 265 266
    .plan-list {
      position: relative;
      background-color: #f7f7f7;
linxin's avatar
linxin committed
267 268 269
      box-shadow: 0 0 15px #ccc;
      width:349px;
      margin:0 auto;
李晓兵's avatar
李晓兵 committed
270
      //height: 126px;
271 272 273 274 275
      display: flex;
      padding-right: 20px;
      padding-left: 10px;
      padding-top: 16px;
      margin-bottom: 10px;
linxin's avatar
linxin committed
276
      padding-bottom: 20px;
277 278
      .message {
        flex: 12;
李晓兵's avatar
李晓兵 committed
279
        //height: 85%;
linxin's avatar
linxin committed
280 281
        display: flex;
        justify-content: space-between;
282 283 284 285 286
      }
      .left {
        height: 30px;
        position: absolute;
        left: -8px;
linxin's avatar
linxin committed
287
        top: 34px;
288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325
      }

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

      .period {
        position: absolute;
        top: 0;
        left: 0;
        background: rgba(75, 74, 75, 0.5);
        border-radius: 4px 0 4px 0;
        width: 30px;
        height: 15px;
        color: #fff;
        font-family: PingFangSC-Semibold;
        font-size: 12px;
        letter-spacing: 1.09px;
        line-height: 15px;
        text-align: center;
      }

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

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

      .green {
        background-color: rgba(27, 162, 97, 0.5);
      }
      .time {
        flex: 3;
linxin's avatar
linxin committed
326
        height: 85%;
327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347
        p {
          font-family: DIN-Regular;
          font-size: 12px;
          color: rgba(56, 63, 69, 0.6);
          margin-bottom: 4px;
          margin-top: 5px;
        }

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

      .name {
        opacity: 0.6;
        font-family: PingFangSC-Regular;
        font-size: 13px;
        color: #4b4a4b;
linxin's avatar
linxin committed
348 349
        display: flex;
        justify-content: space-between;
linxin's avatar
linxin committed
350 351 352
        p:nth-of-type(2){
          padding-left:10px;
        }
353
        p {
linxin's avatar
linxin committed
354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370
          span {
            display: block;
            margin-top: 18px;
          }
          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;
          }
linxin's avatar
linxin committed
371
        }
372 373 374 375 376 377 378 379 380 381 382 383 384 385 386
      }
    }

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

    .bl,
    .gr {
      background: #ffffff;
      box-shadow: 0 1px 5px 0 rgba(219, 219, 219, 0.69);
    }
  }
}
</style>