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