task.vue 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  1. <template>
  2. <view class="total-page page-box page-env-20 scroll_content">
  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> <view class="task-tabs m-t30">
  12. <!-- <TaskImgTab @setProductId="setProductId"></TaskImgTab>-->
  13. <task-ima-tab @setProductId="setProductId"></task-ima-tab>
  14. </view>
  15. <EnScroll ref="scroll" :navHeight="105" is_tabHeight @onRefresh="onRefresh" @onScrollBottom="onScrollBottom">
  16. <view v-if="current===1">
  17. <TaskItem :type="1" is_bottom :task-list="backlogList"></TaskItem>
  18. </view>
  19. <view v-else>
  20. <TaskItem :type="1" is_bottom :task-list="taskList"></TaskItem>
  21. </view>
  22. </EnScroll>
  23. <Tab :tab-index="1"></Tab>
  24. </view>
  25. </template>
  26. <script>
  27. // 任务列表
  28. import TaskItem from "@/common/task/task-item.vue";
  29. import TaskImaTab from "@/common/task/task_ima_tab.vue";
  30. import {getDayBacklogList, getTaskList} 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({'selectStr':this.selectStr}).then((res)=>{
  104. if(res.code===1){
  105. this.backlogList=res.data
  106. }
  107. })
  108. },
  109. getTaskReceiving() {
  110. if (this.isAjax || (this.totalNum <= this.taskList.length)) {
  111. return;
  112. }
  113. this.isAjax = true;
  114. getTaskList({
  115. 'status': this.tabsList[this.current].id,
  116. 'selectStr': this.selectStr,
  117. 'phone': this.phone,
  118. 'name': this.name,
  119. 'productId': this.productId,
  120. 'stageId': this.stageId,
  121. 'departmentId': this.departmentId,
  122. 'startDate': this.startDate,
  123. 'endDate': this.endDate,
  124. 'page': this.page,
  125. }).then((res) => {
  126. this.isAjax = false;
  127. if (res.code === 1) {
  128. this.totalNum = res.data.totalNum
  129. this.taskList.push(...res.data.items)
  130. ++this.page;
  131. }
  132. })
  133. },
  134. tabsChange(index) {
  135. if(index!==this.current){
  136. this.current = index;
  137. }
  138. },
  139. // 下拉刷新
  140. onRefresh() {
  141. // uni.showLoading({
  142. // title: '数据加载中'
  143. // })
  144. // setTimeout(() => {
  145. // uni.showToast({
  146. // title: '加载完成',
  147. // icon: 'none'
  148. // })
  149. // this.$refs.scroll.onEndPulling()
  150. // }, 1000)
  151. console.log("下拉刷新");
  152. this.startList()
  153. },
  154. // 滚动到底部
  155. onScrollBottom() {
  156. // uni.showLoading({
  157. // title: '数据加载中'
  158. // })
  159. if(this.current===1){
  160. this.getDayBacklogList()
  161. }else {
  162. this.getTaskReceiving();
  163. }
  164. // setTimeout(() => {
  165. // uni.showToast({
  166. // title: '加载完成',
  167. // icon: 'none'
  168. // })
  169. // }, 1000)
  170. console.log("到底部了");
  171. },
  172. },
  173. }
  174. </script>
  175. <style lang="scss" scoped>
  176. </style>