task.vue 4.1 KB

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