task_ima_tab.vue 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  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. typeList: [{
  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. }
  55. },
  56. watch: {
  57. },
  58. mounted() {
  59. if (this.listType === 1) {
  60. this.navList = this.typeList
  61. } else {
  62. this.getTaskType()
  63. }
  64. },
  65. methods: {
  66. getTaskType() {
  67. getTaskType({
  68. 'numType': this.numType,
  69. 'listType': this.listType
  70. }).then(res => {
  71. if (res.code === 1) {
  72. this.navList[0].num=0
  73. res.data.forEach(item => {
  74. this.navList[0].num += item.num
  75. if (this.numType > 0) {
  76. item.name = item.product_name + '(' + item.num + ')'
  77. this.navList[0].name = this.navList[0].product_name + '(' + this.navList[0]
  78. .num + ')'
  79. } else {
  80. item.name = item.product_name
  81. }
  82. this.navList.push(item)
  83. })
  84. }
  85. })
  86. },
  87. changeTab(current) {
  88. this.$emit('setProductId', this.navList[current].id)
  89. },
  90. }
  91. }
  92. </script>
  93. <style lang="scss" scoped>
  94. </style>