panyong hace 3 años
padre
commit
9eb676fd7d

+ 9 - 0
htmldev/loan/src/router/index.js

@@ -58,6 +58,15 @@ const routes = [
           keepAlive: true
         }
       },
+      {
+        path: '/loan/recommend', // 贷款计算器推荐产品
+        name: 'loanRecommend',
+        component: _import('views/loan/recommend/index'),
+        meta: {
+          isUseCache: false,
+          keepAlive: true
+        }
+      },
       {
         path: '/loan/mine', // 我的
         name: 'loanMine',

+ 4 - 2
htmldev/loan/src/views/loan/calculator/api/index.js

@@ -1,7 +1,9 @@
 import request from '@/api/request'
 
 export const getRecommendProduct = (postData) => request({
-  method: 'POST',
+  method: 'GET',
   url: '/home/product/recommend',
-  data: postData
+  params: {
+    ...postData
+  }
 })

+ 13 - 7
htmldev/loan/src/views/loan/calculator/index.vue

@@ -174,10 +174,11 @@
           </p>
         </template>
       </van-field>
-      <div class="footer">
-        <p>
+      <div class="footer"
+           @click="$router.push({name: 'loanRecommend'})">
+        <p v-if="recommendedProduct.length">
           <span>妥妥可帮您节省利息</span>
-          <span>23,847.84</span>
+          <span>{{ recommendedProduct[0].lixi }}</span>
           <span>元</span>
         </p>
         <a href="javascript:;">点击查看详情></a>
@@ -493,13 +494,13 @@ export default {
     fetchRecommendProduct (moneyRate) {
       let totalMoney = 0
       let productMmaxYear = 0
-      if (loanType.value === 1) {
+      if (this.loanType.value === 1) {
         totalMoney = parseFloat(this.sdjine) * 10000
         productMmaxYear = this.sdnianxian.value
-      } else if (loanType.value === 2) {
+      } else if (this.loanType.value === 2) {
         totalMoney = parseFloat(this.gjjjine) * 10000
         productMmaxYear = this.gjjnianxian.value
-      } else if (loanType.value === 3) {
+      } else if (this.loanType.value === 3) {
         totalMoney = parseFloat(this.gjjjine) * 10000 + parseFloat(this.sdjine) * 10000
         productMmaxYear = this.gjjnianxian.value + this.sdnianxian.value
       }
@@ -511,7 +512,12 @@ export default {
       }
       getRecommendProduct(postData).then(res => {
         if (res.status) {
-          this.recommendedProduct = res.data
+          if (Object.prototype.toString.call(res.data) === '[object Array]') {
+            // 查找最大优惠值
+            this.recommendedProduct = JSON.parse(JSON.stringify(res.data)).sort((a, b) => {
+              return b.lixi - a.lixi
+            })
+          }
           return
         }
         Toast(res.msg)

+ 5 - 3
htmldev/loan/src/views/loan/mall/index.vue

@@ -11,8 +11,10 @@
         <span>销售</span>
       </router-link>
       <router-link :to="{path: '/loan/calculator'}" replace>
-        <img src="./image/tab_jisuanqi_nor@2x.png" alt="" v-show="$route.name !== 'loanCalculator'">
-        <img src="./image/tab_jisuanqi_sel@2x.png" alt="" v-show="$route.name === 'loanCalculator'">
+        <img src="./image/tab_jisuanqi_nor@2x.png" alt=""
+             v-show="$route.name !== 'loanCalculator' && $route.name !== 'loanRecommend'">
+        <img src="./image/tab_jisuanqi_sel@2x.png" alt=""
+             v-show="$route.name === 'loanCalculator' || $route.name === 'loanRecommend'">
         <span>贷款工具</span>
       </router-link>
       <router-link :to="{path: '/loan/mine'}" replace>
@@ -64,7 +66,7 @@ export default {
 
 <style lang="scss" scoped>
 .ttyf-container {
-  padding-bottom: 200px;
+  padding-bottom: 60px;
 }
 
 .footer {

+ 38 - 0
htmldev/loan/src/views/loan/recommend/index.vue

@@ -0,0 +1,38 @@
+<template>
+  <div class="ttyf-container">
+    <Goods class="margin-top-30"
+           :subtitle="'推荐'"
+           :products="recommendedProduct"
+           @funJump="funJump"/>
+  </div>
+</template>
+
+<script>
+import Goods from '../index/child/goods'
+
+export default {
+  name: 'index',
+  components: {
+    Goods
+  },
+  data () {
+    return {}
+  },
+  computed: {
+    recommendedProduct () {
+      return this.$store.state.loan.recommendedProduct
+    }
+  },
+  methods: {
+    funJump (item) {
+      this.$router.push({ name: 'loanExplain', params: { orderProductId: item.id } })
+    }
+  }
+}
+</script>
+
+<style lang="scss" scoped>
+.ttyf-container {
+  padding-top: 24px;
+}
+</style>