ann0707
2018-08-16 c9bc8ec61cff4076132f6396d99d383a2cdf5a03
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
<template>
    <div>
        <CardList :prodList="prodList" :showNone="showNone" @on-click-prodItem="handleProductJump"></CardList>
        <!--<divider v-show="prodList.length">我们也是有底线的</divider>-->
    </div>
</template>
 
<script>
/**
 * Created by c.y on 2018/3/22.
 * 贷款--信用卡贷款
 */
import CardList from '../../components/CardList.vue';
import systemApi from '../../api/api';
import statusCodeManage from '../../api/statusCodeManage';
import { Divider } from 'vux';
export default {
    name: 'f-credit-loan',
    data() {
        return {
            prodList: [], // 产品列表
            showNone: false //产品列表空白页
        };
    },
    components: {
        CardList,
        Divider
    },
    methods: {
        // 处理产品跳转
        handleProductJump(item) {
            // 极速贷款或者银行卡
            if (
                item.productType === 40000005 ||
                item.productType === 40000006
            ) {
                this.$router.push({
                    path: '/f-loan-detail',
                    query: {
                        id: item.prodId
                    }
                });
                // 信用卡
            } else if (item.productType === 40000007) {
                this.$router.push({
                    path: '/f-credit-detail',
                    query: {
                        id: item.prodId
                    }
                });
            }
        },
        // 获取Attr的列表, prodElements产品组件的元素列表
        getAttrList(prodElements) {
            // 获取用户修改的数据
            let attrList = [];
            if (prodElements instanceof Array) {
                prodElements.map(function(listItem) {
                    listItem.attrs.forEach(function(item) {
                        attrList.push(item.value);
                    });
                });
            }
            return attrList;
        },
        init() {
            let _this = this;
            let submitInfo = {
                prodType: 40000007 // 信用卡
            };
            this.showNone = false;
            systemApi.fetchProdTypeList(submitInfo).then(
                res => {
                    _this.prodList = [];
 
                    res.body.forEach(function(item) {
                        _this.prodList.push({
                            prodId: item.unit.prodId,
                            content: _this.getAttrList(item.showEles),
                            productType: item.unit.prodType,
                            applyNumber: item.unit.showNum
                        });
                    });
                    if (!_this.prodList.length) _this.showNone = true;
                },
                error => {
                    statusCodeManage.showTipOfStatusCode(error,_this);
                }
            );
        }
    },
    activated() {
        this.$store.commit('UPDATE_ACTIVE_TAB', { loanActiveTab: 2 });
        this.init();
    },
    deactivated() {
        this.prodList = [];
    }
};
</script>
 
<style lang="less">
 
</style>