order.vue 6.0 KB

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