task_ima_tab.vue 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. <template>
  2. <view class="m-lr20 r-20">
  3. <k-tabs-swiper class="r-20" v-model="current" :tabs="navList" :field="'name'" bgColor="#fff" color="#444444"
  4. activeColor="#10B261" fontSize="28rpx" :bold="true" :scroll="true" height="100rpx" lineHeight="10rpx"
  5. @change="changeTab" paddingItem="0 50rpx">
  6. </k-tabs-swiper>
  7. </view>
  8. </template>
  9. <script>
  10. import {
  11. getTaskType
  12. } from "@/api/task";
  13. export default {
  14. name: 'task-ima-tab',
  15. props: {
  16. listType: {
  17. default: 0
  18. },
  19. numType: {
  20. default: 0
  21. }
  22. },
  23. data() {
  24. return {
  25. current: 0,
  26. navList: [{
  27. id: 0,
  28. name: '全部',
  29. product_name: '全部',
  30. icon: 'https://wealfavor-1257406827.cos.ap-beijing.myqcloud.com/new-xcx/task/task-all.png',
  31. num: 0
  32. },
  33. {
  34. id: 2,
  35. name: '住宅',
  36. icon: 'https://wealfavor-1257406827.cos.ap-beijing.myqcloud.com/new-xcx/task/task-refund.png'
  37. },
  38. {
  39. id: 1,
  40. name: '公建',
  41. icon: 'https://wealfavor-1257406827.cos.ap-beijing.myqcloud.com/new-xcx/task/task-loan.png'
  42. },
  43. {
  44. id: 3,
  45. name: '土地',
  46. icon: 'https://wealfavor-1257406827.cos.ap-beijing.myqcloud.com/new-xcx/task/task-financial.png'
  47. },
  48. {
  49. id: 4,
  50. name: '工业用房',
  51. icon: 'https://wealfavor-1257406827.cos.ap-beijing.myqcloud.com/new-xcx/task/task-else.png'
  52. }
  53. ],
  54. typeList: [{
  55. id: 2,
  56. name: '垫资还款',
  57. icon: 'https://wealfavor-1257406827.cos.ap-beijing.myqcloud.com/new-xcx/task/task-refund.png'
  58. },
  59. {
  60. id: 1,
  61. name: '房抵业务',
  62. icon: 'https://wealfavor-1257406827.cos.ap-beijing.myqcloud.com/new-xcx/task/task-loan.png'
  63. },
  64. {
  65. id: 3,
  66. name: '消费金融',
  67. icon: 'https://wealfavor-1257406827.cos.ap-beijing.myqcloud.com/new-xcx/task/task-financial.png'
  68. },
  69. {
  70. id: 4,
  71. name: '其他服务',
  72. icon: 'https://wealfavor-1257406827.cos.ap-beijing.myqcloud.com/new-xcx/task/task-else.png'
  73. }
  74. ]
  75. }
  76. },
  77. watch: {
  78. },
  79. mounted() {
  80. if (this.listType === 1) {
  81. this.navList = this.typeList
  82. } else {
  83. // this.getTaskType()
  84. }
  85. },
  86. methods: {
  87. getTaskType() {
  88. getTaskType({
  89. 'numType': this.numType,
  90. 'listType': this.listType
  91. }).then(res => {
  92. if (res.code === 1) {
  93. this.navList[0].num = 0
  94. res.data.forEach(item => {
  95. this.navList[0].num += item.num
  96. if (this.numType > 0) {
  97. item.name = item.product_name + '(' + item.num + ')'
  98. this.navList[0].name = this.navList[0].product_name + '(' + this.navList[0]
  99. .num + ')'
  100. } else {
  101. item.name = item.product_name
  102. }
  103. this.setNavItem(item)
  104. })
  105. }
  106. })
  107. },
  108. setNavItem(item) {
  109. for (const navItemKey in this.navList) {
  110. if (this.navList[navItemKey].id === item.id) {
  111. this.navList[navItemKey] = item
  112. return
  113. }
  114. }
  115. this.navList.push(item)
  116. },
  117. changeTab(current) {
  118. // this.$emit('setProductId', this.navList[current].id)
  119. },
  120. }
  121. }
  122. </script>
  123. <style lang="scss" scoped>
  124. </style>