<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>
|