| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130 |
- <template>
- <view class="m-lr20 r-20">
- <k-tabs-swiper class="r-20" v-model="current" :tabs="navList" :field="'name'" bgColor="#fff" color="#444444"
- activeColor="#10B261" fontSize="28rpx" :bold="true" :scroll="true" height="100rpx" lineHeight="10rpx"
- @change="changeTab" paddingItem="0 50rpx">
- </k-tabs-swiper>
- </view>
- </template>
- <script>
- import {
- getTaskType
- } from "@/api/task";
- export default {
- name: 'task-ima-tab',
- props: {
- listType: {
- default: 0
- },
- numType: {
- default: 0
- }
- },
- data() {
- return {
- current: 0,
- navList: [{
- id: 0,
- name: '全部',
- product_name: '全部',
- icon: 'https://wealfavor-1257406827.cos.ap-beijing.myqcloud.com/new-xcx/task/task-all.png',
- num: 0
- },
- {
- id: 2,
- name: '住宅',
- icon: 'https://wealfavor-1257406827.cos.ap-beijing.myqcloud.com/new-xcx/task/task-refund.png'
- },
- {
- id: 1,
- name: '公建',
- icon: 'https://wealfavor-1257406827.cos.ap-beijing.myqcloud.com/new-xcx/task/task-loan.png'
- },
- {
- id: 3,
- name: '土地',
- icon: 'https://wealfavor-1257406827.cos.ap-beijing.myqcloud.com/new-xcx/task/task-financial.png'
- },
- {
- id: 4,
- name: '工业用房',
- icon: 'https://wealfavor-1257406827.cos.ap-beijing.myqcloud.com/new-xcx/task/task-else.png'
- }
- ],
- typeList: [{
- id: 2,
- name: '垫资还款',
- icon: 'https://wealfavor-1257406827.cos.ap-beijing.myqcloud.com/new-xcx/task/task-refund.png'
- },
- {
- id: 1,
- name: '房抵业务',
- icon: 'https://wealfavor-1257406827.cos.ap-beijing.myqcloud.com/new-xcx/task/task-loan.png'
- },
- {
- id: 3,
- name: '消费金融',
- icon: 'https://wealfavor-1257406827.cos.ap-beijing.myqcloud.com/new-xcx/task/task-financial.png'
- },
- {
- id: 4,
- name: '其他服务',
- icon: 'https://wealfavor-1257406827.cos.ap-beijing.myqcloud.com/new-xcx/task/task-else.png'
- }
- ]
- }
- },
- watch: {
- },
- mounted() {
- if (this.listType === 1) {
- this.navList = this.typeList
- } else {
- // this.getTaskType()
- }
- },
- methods: {
- getTaskType() {
- getTaskType({
- 'numType': this.numType,
- 'listType': this.listType
- }).then(res => {
- if (res.code === 1) {
- this.navList[0].num = 0
- res.data.forEach(item => {
- this.navList[0].num += item.num
- if (this.numType > 0) {
- item.name = item.product_name + '(' + item.num + ')'
- this.navList[0].name = this.navList[0].product_name + '(' + this.navList[0]
- .num + ')'
- } else {
- item.name = item.product_name
- }
- this.setNavItem(item)
- })
- }
- })
- },
- setNavItem(item) {
- for (const navItemKey in this.navList) {
- if (this.navList[navItemKey].id === item.id) {
- this.navList[navItemKey] = item
- return
- }
- }
- this.navList.push(item)
- },
- changeTab(current) {
- // this.$emit('setProductId', this.navList[current].id)
- },
- }
- }
- </script>
- <style lang="scss" scoped>
- </style>
|