task.vue 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  1. <template>
  2. <view class="total-page page-box page-env-20 scroll_content task-bg">
  3. <Nav :title="'任务'" :genre="1" :back="false" :fixedHeight="105"></Nav>
  4. <view class="task-tabs" :style="{top:`${$tools.topHeight()}px`}">
  5. <Search :placeholder="'贷款人姓名或电话'"></Search>
  6. <view style="height: 100rpx;">
  7. <z-tabs ref="tabs" :list="tabsList" :active-style="{color:'#10B261',fontWeight:'bold',fontSize:'28rpx'}"
  8. :bar-style="{background:'#10B261'}" :inactive-style="{fontWeight:'bold',fontSize:'28rpx'}"
  9. :current="current" :bar-animate-mode="'worm'" @change="tabsChange" />
  10. </view>
  11. </view>
  12. <view class="task-tabs m-t30">
  13. <!-- <TaskImgTab @setProductId="setProductId"></TaskImgTab>-->
  14. <task-ima-tab @setProductId="setProductId"></task-ima-tab>
  15. </view>
  16. <EnScroll ref="scroll" :navHeight="105" is_tabHeight @onRefresh="onRefresh" @onScrollBottom="onScrollBottom">
  17. <view v-if="current===1">
  18. <TaskItem :type="1" is_bottom :task-list="backlogList"></TaskItem>
  19. </view>
  20. <view v-else>
  21. <TaskItem :type="1" is_bottom :task-list="taskList"></TaskItem>
  22. </view>
  23. </EnScroll>
  24. <Tab :tab-index="1"></Tab>
  25. </view>
  26. </template>
  27. <script>
  28. // 任务列表
  29. import TaskItem from "@/common/task/task-item.vue";
  30. import TaskImaTab from "@/common/task/task_ima_tab.vue";
  31. import {
  32. getDayBacklogList,
  33. getTaskList
  34. } from "@/api/task";
  35. export default {
  36. components: {
  37. TaskImaTab,
  38. TaskItem,
  39. },
  40. data() {
  41. return {
  42. tabHeight: uni.getStorageSync('tab_height'),
  43. current: 0,
  44. swiperCurrent: 0,
  45. tabsList: [{
  46. name: '全部',
  47. dot_color: 'red',
  48. disabled: false,
  49. 'id': 0,
  50. }, {
  51. name: '新进',
  52. dot_color: 'yellow',
  53. disabled: false,
  54. 'id': 6,
  55. }, {
  56. 'id': 1,
  57. name: '待办',
  58. dot_color: '',
  59. disabled: false
  60. }, {
  61. 'id': 2,
  62. name: '完成',
  63. dot_color: '',
  64. disabled: false
  65. }, {
  66. 'id': 3,
  67. name: '拒绝',
  68. dot_color: '',
  69. disabled: false
  70. }],
  71. selectStr: '',
  72. startDate: '',
  73. endDate: '',
  74. phone: '',
  75. name: '',
  76. productId: 0,
  77. stageId: [],
  78. departmentId: [],
  79. totalNum: 99999,
  80. taskList: [],
  81. page: 1,
  82. isAjax: false,
  83. backlogList: [],
  84. }
  85. },
  86. mounted() {
  87. this.startList()
  88. },
  89. methods: {
  90. setProductId(productId) {
  91. console.log('productId:' + productId)
  92. this.productId = productId
  93. this.startList()
  94. },
  95. startList() {
  96. if (this.current === 1) {
  97. this.getDayBacklogList()
  98. } else {
  99. this.totalNum = 999;
  100. this.taskList = [];
  101. this.page = 1;
  102. this.isAjax = false;
  103. this.getTaskReceiving();
  104. }
  105. },
  106. getDayBacklogList() {
  107. getDayBacklogList({
  108. 'selectStr': this.selectStr
  109. }).then((res) => {
  110. if (res.code === 1) {
  111. this.backlogList = res.data
  112. }
  113. })
  114. },
  115. getTaskReceiving() {
  116. if (this.isAjax || (this.totalNum <= this.taskList.length)) {
  117. return;
  118. }
  119. this.isAjax = true;
  120. getTaskList({
  121. 'status': this.tabsList[this.current].id,
  122. 'selectStr': this.selectStr,
  123. 'phone': this.phone,
  124. 'name': this.name,
  125. 'productId': this.productId,
  126. 'stageId': this.stageId,
  127. 'departmentId': this.departmentId,
  128. 'startDate': this.startDate,
  129. 'endDate': this.endDate,
  130. 'page': this.page,
  131. }).then((res) => {
  132. this.isAjax = false;
  133. if (res.code === 1) {
  134. this.totalNum = res.data.totalNum
  135. this.taskList.push(...res.data.items)
  136. ++this.page;
  137. }
  138. })
  139. },
  140. tabsChange(index) {
  141. if (index !== this.current) {
  142. this.current = index;
  143. }
  144. },
  145. // 下拉刷新
  146. onRefresh() {
  147. // uni.showLoading({
  148. // title: '数据加载中'
  149. // })
  150. // setTimeout(() => {
  151. // uni.showToast({
  152. // title: '加载完成',
  153. // icon: 'none'
  154. // })
  155. // this.$refs.scroll.onEndPulling()
  156. // }, 1000)
  157. console.log("下拉刷新");
  158. this.startList()
  159. },
  160. // 滚动到底部
  161. onScrollBottom() {
  162. // uni.showLoading({
  163. // title: '数据加载中'
  164. // })
  165. if (this.current === 1) {
  166. this.getDayBacklogList()
  167. } else {
  168. this.getTaskReceiving();
  169. }
  170. // setTimeout(() => {
  171. // uni.showToast({
  172. // title: '加载完成',
  173. // icon: 'none'
  174. // })
  175. // }, 1000)
  176. console.log("到底部了");
  177. },
  178. },
  179. }
  180. </script>
  181. <style lang="scss" scoped>
  182. </style>