financing-trial.vue 12.6 KB
Newer Older
786817560's avatar
786817560 committed
1 2 3 4
<!--
 * @Descrip 融资试算
 * @Author: your name
 * @Date: 2019-09-29 17:09:49
5
 * @LastEditTime: 2019-12-17 11:21:41
786817560's avatar
786817560 committed
6 7 8 9 10 11 12 13 14 15 16
 * @LastEditors: Please set LastEditors
   -->
<template>
  <h-view id="trial" class="public-style">
    <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>

786817560's avatar
786817560 committed
17
    <!-- 搜索 -->
李晓兵's avatar
李晓兵 committed
18
    <div class="search has-header">
786817560's avatar
786817560 committed
19
      <input v-model="searchInput" type="text" placeholder="请输入产品名称">
786817560's avatar
786817560 committed
20
    </div>
786817560's avatar
786817560 committed
21 22 23 24
    <scroll
      ref="scroll"
      :updateData="[lists]"
      :pullUp="true"
786817560's avatar
786817560 committed
25
      @pullingUp="loadMore"
786817560's avatar
786817560 committed
26 27 28 29 30 31 32
    >
      <section v-for="(item,index) in lists" :key="index">
        <div class="descript" @click="goDetails(item.product_plan_id)">
          <img src="@/assets/trial/product.png" alt="">
          <p class="produc">{{ item.product_plan_id_n }}</p>
          <img class="linkPic" src="@/assets/distributorSign/righticon.png" alt="">
        </div>
linxin's avatar
linxin committed
33

786817560's avatar
786817560 committed
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
        <div class="tario">
          <div class="wrap">
            <p class="ratio">
              <span>保证金比例</span>
              <span>{{ item.deposit_ratio_n }}</span>
            </p>
            <p>
              <span>手续费比例</span>
              <span>{{ item.lease_charge_ratio_n }}</span>
            </p>
          </div>
          <div class="wrap">
            <p>
              <span>年利率</span>
              <span>{{ item.int_rate_n }}</span>
            </p>
            <p>
linxin's avatar
linxin committed
51 52
              <span>首付款比例</span>
              <span>{{ item.down_payment_ratio_n }}</span>
786817560's avatar
786817560 committed
53
            </p>
786817560's avatar
786817560 committed
54
          </div>
786817560's avatar
786817560 committed
55 56 57
        </div>
      </section>
    </scroll>
786817560's avatar
786817560 committed
58 59
  </h-view>
</template>
786817560's avatar
786817560 committed
60
<script>
linxin's avatar
linxin committed
61 62 63 64 65
export default {
  name: 'FinancingTrial',
  data () {
    return {
      lists: [],
786817560's avatar
786817560 committed
66
      pagenum: 1,
786817560's avatar
786817560 committed
67
      division: '', // 产品线
linxin's avatar
linxin committed
68
      plan_price: '',
786817560's avatar
786817560 committed
69
      searchInput: '',
linxin's avatar
linxin committed
70
      price_date_to: '',
786817560's avatar
786817560 committed
71
      fromProduct: false,
linxin's avatar
linxin committed
72 73 74
    }
  },
  computed: {},
786817560's avatar
786817560 committed
75 76 77 78 79 80 81
  watch: {
    searchInput () {
      let vm = this
      if (vm.timeout) {
        clearTimeout(vm.timeout)
      }
      vm.timeout = setTimeout(() => {
786817560's avatar
786817560 committed
82 83 84 85 86
        if (vm.fromProduct) {
          vm.search(vm.fromProduct)
        } else {
          vm.search()
        }
786817560's avatar
786817560 committed
87 88 89
      }, 1000)
    },
  },
linxin's avatar
linxin committed
90 91
  beforeRouteEnter (to, from, next) {
    next(vm => {
786817560's avatar
786817560 committed
92 93
      vm.searchInput = ''
      vm.pagenum = 1
786817560's avatar
786817560 committed
94 95
      vm.$refs.scroll.scrollToTop()
      vm.$refs.scroll.update(false)
linxin's avatar
linxin committed
96
      if (from.name === 'ProDetailed') {
786817560's avatar
786817560 committed
97
        vm.lists = []
linxin's avatar
linxin committed
98 99
        vm.price_date_to = vm.$route.params.price_date_to // 有效日期
        vm.plan_price = vm.$route.params.plan_price // 参考价
786817560's avatar
786817560 committed
100
        vm.division = vm.$route.params.division
linxin's avatar
linxin committed
101
        vm.calculationQuery('collect')
786817560's avatar
786817560 committed
102
        vm.fromProduct = true
邹骏's avatar
邹骏 committed
103
      } else if (from.name === 'HomePage' || from.name === 'FunctionCenter') {
786817560's avatar
786817560 committed
104
        vm.fromProduct = false
linxin's avatar
linxin committed
105 106 107
        vm.calculationQuery()
        vm.price_date_to = '' // 清除缓存(从收藏带来的数据)
        vm.plan_price = ''
786817560's avatar
786817560 committed
108
      }
linxin's avatar
linxin committed
109 110 111 112
    })
    next()
  },
  activated () {
李晓兵's avatar
李晓兵 committed
113

linxin's avatar
linxin committed
114 115
  },
  created () {
李晓兵's avatar
李晓兵 committed
116

linxin's avatar
linxin committed
117 118
  },
  methods:
李晓兵's avatar
李晓兵 committed
119
      {
linxin's avatar
linxin committed
120
        goDetails (val) {
李晓兵's avatar
李晓兵 committed
121 122 123 124 125 126 127 128 129
          this.$router.push({
            name: 'FinancingDetails',
            params: {
              product_plan_id: val,
              plan_price: this.plan_price,
              price_date_to: this.price_date_to,
            },
          })
        },
786817560's avatar
786817560 committed
130
        // 初始试算查询
linxin's avatar
linxin committed
131
        calculationQuery (val) {
李晓兵's avatar
李晓兵 committed
132 133 134 135
          let vm = this
          if (val) {
            let url = $config.basePath + 'prd_product_calculation_query'
            let param = {
786817560's avatar
786817560 committed
136 137 138
              pagesize: 10,
              searchInput: vm.searchInput,
              pagenum: vm.pagenum,
786817560's avatar
786817560 committed
139
              division: vm.division, // 收藏到试算通过产品线查询
786817560's avatar
786817560 committed
140
              bp_id: vm.$route.params.bp_id,
李晓兵's avatar
李晓兵 committed
141 142 143 144 145 146 147 148 149 150 151 152 153 154 155
            }
            vm.hlsPopup.showLoading('数据加载中')
            vm.hlsHttp.post(url, param).then(function (res) {
              vm.hlsPopup.hideLoading()
              if (res.result === 'S') {
                vm.lists = res.lists
                if (res.lists.length > 0 && res.lists.length < 10) {
                  vm.$refs.scroll.update(true)
                }
              } else {
                hlsPopup.showLongCenter(res.message)
              }
            })
          } else {
            let url = $config.basePath + 'prd_calculation_query'
786817560's avatar
786817560 committed
156 157 158 159 160
            let param = {
              pagesize: 10,
              searchInput: vm.searchInput,
              pagenum: vm.pagenum,
            }
李晓兵's avatar
李晓兵 committed
161 162 163 164 165 166 167 168 169 170 171 172 173 174
            vm.hlsPopup.showLoading('数据加载中')
            vm.hlsHttp.post(url, param).then(function (res) {
              vm.hlsPopup.hideLoading()
              if (res.result === 'S') {
                vm.lists = res.lists
                if (res.lists.length > 0 && res.lists.length < 10) {
                  vm.$refs.scroll.update(true)
                }
              } else {
                hlsPopup.showLongCenter(res.message)
              }
            })
          }
        },
786817560's avatar
786817560 committed
175 176 177

        loadMore () {
          let vm = this
786817560's avatar
786817560 committed
178 179 180 181
          if (vm.fromProduct) {
            vm.pagenum = vm.pagenum + 1
            let url = $config.basePath + 'prd_product_calculation_query'
            let param = {
linxin's avatar
linxin committed
182
              division: window.localStorage.division, // 收藏到试算通过产品线查询
786817560's avatar
786817560 committed
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
              searchInput: vm.searchInput,
              pagenum: vm.pagenum,
              pagesize: 10,
            }
            vm.hlsPopup.showLoading('数据加载中')
            vm.$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.lists.push(array[index])
                  })
                  vm.$refs.scroll.update(true)
                } else if (returnData.length === 10) {
                  returnData.forEach((data, index, array) => {
                    vm.lists.push(array[index])
                  })
                  vm.$refs.scroll.update(false)
                }
              } else {
                hlsPopup.showLongCenter(res.message)
              }
            })
          } else {
            vm.pagenum = vm.pagenum + 1
            let url = $config.basePath + 'prd_calculation_query'
            let param = {
              searchInput: vm.searchInput,
              pagenum: vm.pagenum,
              pagesize: 10,
            }
            vm.hlsPopup.showLoading('数据加载中')
            vm.$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.lists.push(array[index])
                  })
                  vm.$refs.scroll.update(true)
                } else if (returnData.length === 10) {
                  returnData.forEach((data, index, array) => {
                    vm.lists.push(array[index])
                  })
                  vm.$refs.scroll.update(false)
                }
              } else {
                hlsPopup.showLongCenter(res.message)
              }
            })
786817560's avatar
786817560 committed
241
          }
786817560's avatar
786817560 committed
242 243 244 245 246 247 248 249 250 251 252
        },

        search (val) {
          let vm = this
          if (val) {
            vm.pagenum = 1
            let url = $config.basePath + 'prd_product_calculation_query'
            let param = {
              pagesize: 10,
              pagenum: 1,
              searchInput: vm.searchInput,
linxin's avatar
linxin committed
253
              division: window.localStorage.division, // 收藏到试算通过产品线查询
786817560's avatar
786817560 committed
254 255 256 257 258 259
            }
            vm.hlsPopup.showLoading('数据加载中')
            vm.hlsHttp.post(url, param).then(function (res) {
              vm.hlsPopup.hideLoading()
              vm.lists = res.lists
              if (vm.lists.length >= 0 && vm.lists.length < 10) {
786817560's avatar
786817560 committed
260
                vm.$refs.scroll.update(true)
786817560's avatar
786817560 committed
261
              } else if (vm.lists.length === 10) {
786817560's avatar
786817560 committed
262 263
                vm.$refs.scroll.update(false)
              }
786817560's avatar
786817560 committed
264 265 266 267 268 269 270 271
            })
          } else {
            vm.pagenum = 1
            let url = $config.basePath + 'prd_calculation_query'
            let param = {
              pagesize: 10,
              pagenum: 1,
              searchInput: vm.searchInput,
786817560's avatar
786817560 committed
272
            }
786817560's avatar
786817560 committed
273 274 275 276 277 278 279 280 281 282
            vm.hlsPopup.showLoading('数据加载中')
            vm.hlsHttp.post(url, param).then(function (res) {
              vm.hlsPopup.hideLoading()
              vm.lists = res.lists
              if (vm.lists.length >= 0 && vm.lists.length < 10) {
                vm.$refs.scroll.update(true)
              } else if (vm.lists.length === 10) {
                vm.$refs.scroll.update(false)
              }
            })
786817560's avatar
786817560 committed
283 284
          }
        },
786817560's avatar
786817560 committed
285

李晓兵's avatar
李晓兵 committed
286
      },
linxin's avatar
linxin committed
287
}
786817560's avatar
786817560 committed
288
</script>
李晓兵's avatar
李晓兵 committed
289
<style lang='less'>
李晓兵's avatar
李晓兵 committed
290 291 292 293 294
  #trial {
    .search {
      background-color: #fff;
      padding: 8px 12px;
      position: absolute;
786817560's avatar
786817560 committed
295
      width: 100%;
李晓兵's avatar
李晓兵 committed
296 297
      z-index: 100;
      margin-bottom: 8px;
786817560's avatar
786817560 committed
298

李晓兵's avatar
李晓兵 committed
299
      input {
786817560's avatar
786817560 committed
300 301 302
        background: url("../../assets/contractStart/search1.png") 320px no-repeat;
        background-size: 16px 16px;
        background-color: rgba(239, 239, 239, 0.55);
李晓兵's avatar
李晓兵 committed
303 304 305 306 307 308 309
        padding-left: 12px;
        border-radius: 4px;
        height: 36px;
        width: 100%;
        font-family: PingFangSC-Regular;
        font-size: 14px;
        color: #888C8F;
310
        line-height: 36px;
李晓兵's avatar
李晓兵 committed
311
      }
linxin's avatar
linxin committed
312

李晓兵's avatar
李晓兵 committed
313
      input::placeholder {
786817560's avatar
786817560 committed
314
        font-family: PingFangSC-Regular;
李晓兵's avatar
李晓兵 committed
315 316
        font-size: 14px;
        color: #888C8F;
786817560's avatar
786817560 committed
317
        letter-spacing: 0;
李晓兵's avatar
李晓兵 committed
318 319
      }

786817560's avatar
786817560 committed
320 321 322 323 324 325
      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
326
    }
李晓兵's avatar
李晓兵 committed
327 328 329 330

    section {
      width: 95%;
      margin: 0 auto;
786817560's avatar
786817560 committed
331
      margin-top: 8px;
李晓兵's avatar
李晓兵 committed
332
      border-radius: 2px;
786817560's avatar
786817560 committed
333
    }
李晓兵's avatar
李晓兵 committed
334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351

    .descript {
      width: 100%;
      height: 44px;
      display: flex;
      flex-direction: row;
      background: #fff;

      img {
        width: 30px;
        height: 30px;
        margin-left: 10px;
        margin-top: 8px;
        // margin-right: 8px;
      }

      .linkPic {
        width: 16px;
786817560's avatar
786817560 committed
352 353 354 355
        height: 16px;
        margin-top: 15px;
        margin-left: -7px;
        margin-right: 10px;
李晓兵's avatar
李晓兵 committed
356 357 358
      }

      .produc {
786817560's avatar
786817560 committed
359 360 361 362 363 364 365
        height: 44px;
        display: flex;
        flex: 1;
        font-size: 15px;
        color: #4B4A4B;
        line-height: 44px;
        font-weight: 500;
786817560's avatar
786817560 committed
366
        letter-spacing: 0;
786817560's avatar
786817560 committed
367 368 369
        margin-left: 10px;
        font-family: PingFangSC-Semibold;
        border-bottom: 1px solid #F3F3F7;
李晓兵's avatar
李晓兵 committed
370
      }
786817560's avatar
786817560 committed
371
    }
李晓兵's avatar
李晓兵 committed
372 373 374 375 376 377 378 379

    .tario {
      width: 100%;
      height: 60px;
      position: relative;
      background: #fff;
      // margin-bottom: 8px;
      .wrap:nth-of-type(1) {
linxin's avatar
linxin committed
380 381 382
        height: 60px;
        position: absolute;
        left: 50px;
李晓兵's avatar
李晓兵 committed
383 384 385
      }

      .wrap:nth-of-type(2) {
786817560's avatar
786817560 committed
386
        height: 60px;
linxin's avatar
linxin committed
387 388
        position: absolute;
        right: 30px;
李晓兵's avatar
李晓兵 committed
389 390 391
      }

      p {
786817560's avatar
786817560 committed
392 393 394 395
        height: 30px;
        line-height: 30px;
        font-family: PingFangSC-Regular;
        font-size: 13px;
李晓兵's avatar
李晓兵 committed
396 397
        color: rgba(56, 63, 69, 0.60);

786817560's avatar
786817560 committed
398
        span:nth-of-type(2) {
李晓兵's avatar
李晓兵 committed
399 400 401 402
          margin-left: 16px;
          color: rgb(56, 63, 69);
        }
      }
786817560's avatar
786817560 committed
403
    }
李晓兵's avatar
李晓兵 committed
404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436
    .content{
      position: absolute;
      top:0;
    }
    .scrollContent{
     padding-top: 1.92rem;
      padding-bottom: 20px;
    }
  }
  .platform-ios {
    #trial {
      .scrollContent {
        padding-top: 2.32rem;
      }
    }
  }
  // iPhoneX适配
  @media (device-width: 375px) and (device-height: 812px) and (-webkit-min-device-pixel-ratio: 3) {
    .platform-ios {
      #trial {
        .scrollContent {
          padding-top: 2.72rem;
        }
      }
    }
  }
  // iPhoneXR适配
  @media (device-width: 414px) and (device-height: 896px) {
    .platform-ios {
      #trial {
        .scrollContent {
          padding-top: 2.72rem;
        }
437 438 439 440 441 442 443 444 445 446 447 448 449 450
        .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;
        }
      }
李晓兵's avatar
李晓兵 committed
451 452 453
      }
    }
  }
786817560's avatar
786817560 committed
454
</style>