order.vue 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287
  1. <template>
  2. <view>
  3. <uni-nav-bar fixed="true" statusBar="true" left-icon="back" title="巡点检工单" @clickLeft="back"></uni-nav-bar>
  4. <!-- <template>
  5. <view class="tab-title">
  6. <view v-for="(item, index) in tabList" :key="index" class="tab-item" :class="index === pickTabIndex ? 'active' : ''" @click="changeChartsTab(index)">
  7. {{ item.label }}
  8. <text v-if="item.number > 0" class="title-red">{{ item.number }}</text>
  9. </view>
  10. </view>
  11. <view class="tab-title__placeholder"></view>
  12. </template> -->
  13. <view class="top-wrapper">
  14. <view class="tab_box rx-sc">
  15. <view class="tab_item" v-for="(item,index) in tabList" :key="index"
  16. :class="{active: pickTabIndex == index}">
  17. <view @click="changeChartsTab(index)">
  18. {{item.label}}
  19. </view>
  20. </view>
  21. </view>
  22. </view>
  23. <OrderTask v-for="(item, index) in tabList" :key="index" v-show="index === pickTabIndex" :list="item.list"
  24. :type="tabList.value"></OrderTask>
  25. </view>
  26. </template>
  27. <script>
  28. import {
  29. getWorkOrderList
  30. } from '@/api/myTicket'
  31. import OrderTask from './OrderTask.vue'
  32. import {
  33. post,
  34. postJ
  35. } from '@/utils/api.js'
  36. let [page, size, isEnd] = [1, 10, true]
  37. export default {
  38. components: {
  39. OrderTask
  40. },
  41. data() {
  42. return {
  43. tabList: [{
  44. value: 0,
  45. label: '待接收',
  46. list: [],
  47. number: 0
  48. },
  49. {
  50. value: 2,
  51. label: '执行中',
  52. list: [],
  53. number: 0
  54. },
  55. {
  56. value: 3,
  57. label: '已完成',
  58. list: [],
  59. number: 0
  60. }
  61. ],
  62. pickTabIndex: 0,
  63. qrContent: null,
  64. barType: 0
  65. }
  66. },
  67. onShow() {
  68. this.getFirstList()
  69. this.getStatus()
  70. },
  71. onReachBottom: function() {
  72. if (isEnd) {
  73. return
  74. }
  75. // 显示加载图标
  76. uni.showLoading({
  77. title: '数据加载中'
  78. })
  79. this.getMoreLists()
  80. },
  81. methods: {
  82. getStatus() {
  83. getWorkOrderList({
  84. orderStatus: [0],
  85. type: 1,
  86. pageNum: 1,
  87. size: 1
  88. }).then(res => {
  89. this.tabList[0].number = res.count
  90. })
  91. getWorkOrderList({
  92. orderStatus: [2],
  93. type: 1,
  94. pageNum: 1,
  95. size: 1
  96. }).then(res => {
  97. this.tabList[1].number = res.count
  98. })
  99. getWorkOrderList({
  100. orderStatus: [3],
  101. type: 1,
  102. pageNum: 1,
  103. size: 1
  104. }).then(res => {
  105. this.tabList[2].number = res.count
  106. })
  107. getWorkOrderList({
  108. orderStatus: [4],
  109. type: 1,
  110. pageNum: 1,
  111. size: 1
  112. }).then(res => {
  113. this.tabList[3].number = res.count
  114. })
  115. },
  116. getCount() {
  117. statistics().then(data => {
  118. console.log('onsole.log(data)-----------')
  119. console.log(data)
  120. this.tabList = this.tabList.map(item => {
  121. switch (item.value) {
  122. case '0':
  123. return {
  124. ...item, badge: {
  125. value: data.maintenanceNum
  126. }
  127. }
  128. case '2':
  129. return {
  130. ...item, badge: {
  131. value: data.patrolInspection
  132. }
  133. }
  134. case '3':
  135. return {
  136. ...item, badge: {
  137. value: data.quantityNum
  138. }
  139. }
  140. case '4':
  141. return {
  142. ...item, badge: {
  143. value: data.repairsNum
  144. }
  145. }
  146. }
  147. })
  148. })
  149. },
  150. getFirstList: function() {
  151. page = 1
  152. isEnd = true
  153. this.getList()
  154. },
  155. getMoreLists: function() {
  156. //获取更多数据
  157. page++
  158. this.getList()
  159. },
  160. getList() {
  161. uni.showLoading({
  162. title: '数据加载中'
  163. })
  164. let params = {
  165. orderStatus: [this.tabList[this.pickTabIndex].value],
  166. type: 1,
  167. pageNum: page,
  168. size
  169. }
  170. getWorkOrderList(params)
  171. .then(res => {
  172. this.tabList[this.pickTabIndex].list = res.list
  173. isEnd = this.tabList[this.pickTabIndex].list >= res.count
  174. uni.hideLoading()
  175. })
  176. .catch(() => {
  177. uni.hideLoading()
  178. })
  179. },
  180. changeChartsTab(index) {
  181. this.pickTabIndex = index
  182. this.getFirstList()
  183. }
  184. }
  185. }
  186. </script>
  187. <style lang="scss" scoped>
  188. .top-wrapper {
  189. display: flex;
  190. align-items: center;
  191. background-color: #fff;
  192. position: relative;
  193. .tab_box {
  194. width: 100%;
  195. height: 68rpx;
  196. .tab_item {
  197. height: 68rpx;
  198. line-height: 68rpx;
  199. padding: 0 20rpx;
  200. font-size: 32rpx;
  201. // color: #979C9E;
  202. }
  203. .active {
  204. box-sizing: border-box;
  205. border-bottom: 6rpx solid $theme-color;
  206. color: $theme-color;
  207. }
  208. }
  209. }
  210. .tab-title {
  211. position: fixed;
  212. z-index: 99;
  213. width: 100%;
  214. padding: 10rpx;
  215. // display: flex;
  216. // justify-content: space-between;
  217. height: $tab-height;
  218. line-height: $tab-height;
  219. background-color: #ffffff;
  220. border-bottom: 1px solid #f2f2f2;
  221. // box-sizing: border-box;
  222. white-space: nowrap;
  223. overflow: auto hidden;
  224. display: flex;
  225. &::-webkit-scrollbar {
  226. /*滚动条整体样式*/
  227. width: 10px;
  228. /*高宽分别对应横竖滚动条的尺寸*/
  229. height: 1px;
  230. }
  231. &::-webkit-scrollbar-thumb {
  232. /*滚动条里面小方块*/
  233. border-radius: 10px;
  234. -webkit-box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
  235. background: #535353;
  236. }
  237. &::-webkit-scrollbar-track {
  238. /*滚动条里面轨道*/
  239. -webkit-box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
  240. border-radius: 10px;
  241. background: #ededed;
  242. }
  243. .tab-item {
  244. flex: 1;
  245. text-align: center;
  246. display: inline-block;
  247. font-size: 32rpx;
  248. color: $uni-text-color-grey;
  249. }
  250. .tab-item.active {
  251. color: $j-primary-border-green;
  252. border-bottom: 1px solid $j-primary-border-green;
  253. }
  254. .title-num {
  255. font-size: 26rpx;
  256. }
  257. .title-red {
  258. display: inline-block;
  259. font-size: 22rpx;
  260. padding: 0 10rpx;
  261. border-radius: 50rpx;
  262. color: #ffffff;
  263. background: red;
  264. line-height: 38rpx;
  265. position: absolute;
  266. top: 10rpx;
  267. min-width: 18rpx;
  268. }
  269. }
  270. </style>