task_ima_tab.vue 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  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: '/static/img/task/task-all.png',
  31. num:0
  32. }],
  33. typeList:[
  34. {
  35. id: 2,
  36. name: '垫资还款',
  37. icon: '/static/img/task/task-refund.png'
  38. },
  39. {
  40. id: 1,
  41. name: '房抵业务',
  42. icon: '/static/img/task/task-loan.png'
  43. },
  44. {
  45. id: 3,
  46. name: '消费金融',
  47. icon: '/static/img/task/task-financial.png'
  48. },
  49. {
  50. id: 4,
  51. name: '其他服务',
  52. icon: '/static/img/task/task-else.png'
  53. }
  54. ]
  55. }
  56. },
  57. watch:{
  58. },
  59. mounted() {
  60. if(this.listType===1){
  61. this.navList=this.typeList
  62. }else {
  63. this.getTaskType()
  64. }
  65. },
  66. methods: {
  67. getTaskType() {
  68. getTaskType({'numType':this.numType,'listType':this.listType}).then(res => {
  69. if (res.code === 1) {
  70. res.data.forEach(item=>{
  71. this.navList[0].num+=item.num
  72. if(this.numType>0){
  73. item.name=item.product_name+'('+item.num+')'
  74. this.navList[0].name=this.navList[0].product_name+'('+ this.navList[0].num+')'
  75. }else {
  76. item.name=item.product_name
  77. }
  78. this.navList.push(item)
  79. })
  80. }
  81. })
  82. },
  83. changeTab(current) {
  84. this.$emit('setProductId', this.navList[current].id)
  85. },
  86. }
  87. }
  88. </script>
  89. <style lang="scss" scoped>
  90. </style>