order.vue 4.8 KB

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