list.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  1. <template>
  2. <view class="container">
  3. <z-paging ref="paging" v-model="repairs" empty-view-text="暂无维修工单" @query="getRepairs">
  4. <view slot="top">
  5. <scroll-view scroll-x class="bg-white nav" v-if="(type == 'registered') || (type == 'finish')">
  6. <view class="flex text-center text-black text-bold" style="font-size: 30rpx;">
  7. <view class="cu-item flex-sub" :class="index==tabCurrent?'text-green cur':''"
  8. v-for="(item,index) in tabList" :key="index" @tap="tabSelect" :data-id="index">
  9. {{item}}
  10. </view>
  11. </view>
  12. </scroll-view>
  13. </view>
  14. <view class="cu-bar" v-if="(type == 'pending') && (totalCount > 0)">
  15. <view class="action text-bold">
  16. 待接工单 <text class="cu-tag bg-black radius margin-left-sm">{{totalCount}}</text>
  17. </view>
  18. </view>
  19. <view class="nav-list" :class="type != 'pending' ? 'margin-top-sm' : ''">
  20. <view class="nav-li bg-white text-black" v-for="(item,index) in repairs" :key="index"
  21. @click="goInfo(item.id)">
  22. <view class="nav-title solid-bottom">工单编号:{{item.repair_code || '-'}}</view>
  23. <view class="nav-name padding-top-sm">设备信息:【{{item.equipment_code}}】{{item.archive_model}}
  24. {{item.archive_name}}
  25. </view>
  26. <view class="nav-name text-cut">故障原因:{{item.content}}</view>
  27. <view class="nav-name">报修日期:{{item.registertime}}</view>
  28. <text class="cu-tag radius bg-green">{{item.status_text}}</text>
  29. </view>
  30. </view>
  31. </z-paging>
  32. </view>
  33. </template>
  34. <script>
  35. var _self
  36. var loadFlag = false
  37. export default {
  38. data() {
  39. return {
  40. repairs: [],
  41. totalCount: 0,
  42. type: 'registered',
  43. tabCurrent: 0,
  44. tabList: ['待维修', '已完成']
  45. };
  46. },
  47. onShow() {
  48. if (loadFlag) {
  49. _self.getRepairs()
  50. }
  51. },
  52. onLoad(e) {
  53. _self = this
  54. if ('type' in e) {
  55. loadFlag = false
  56. _self.type = e.type
  57. }
  58. if (_self.type == 'pending') {
  59. uni.setNavigationBarTitle({
  60. title: '待接工单'
  61. });
  62. } else {
  63. uni.setNavigationBarTitle({
  64. title: '我的工单'
  65. });
  66. }
  67. },
  68. methods: {
  69. getRepairs(pageNo, pageSize) {
  70. _self.$api.repairs({
  71. type: _self.type,
  72. page: pageNo,
  73. pageSize
  74. }).then((res) => {
  75. loadFlag = true
  76. _self.totalCount = res.data.total_count
  77. _self.$refs.paging.complete(res.data.list)
  78. }).catch((err) => {
  79. _self.$refs.paging.complete(false);
  80. })
  81. },
  82. goInfo(id) {
  83. uni.navigateTo({
  84. url: '/pages/repair/info?id=' + id
  85. })
  86. },
  87. tabSelect(e) {
  88. let index = e.currentTarget.dataset.id
  89. _self.tabCurrent = index
  90. _self.scrollLeft = (index - 1) * 60
  91. _self.type = index == 1 ? 'finish' : 'registered'
  92. _self.$refs.paging.reload()
  93. }
  94. }
  95. }
  96. </script>
  97. <style lang="scss">
  98. .nav-list {
  99. display: flex;
  100. flex-wrap: wrap;
  101. padding: 0px 20rpx 0px;
  102. justify-content: space-between;
  103. }
  104. .nav-li {
  105. padding: 30rpx 30rpx 30rpx 38rpx;
  106. border-radius: 12rpx;
  107. width: 100%;
  108. margin: 0 0 20rpx;
  109. position: relative;
  110. z-index: 1;
  111. box-shadow: 0 0 10rpx rgba(0, 0, 0, 0.1);
  112. .tagLine {
  113. width: 8rpx;
  114. height: 100%;
  115. float: left;
  116. margin-left: -38rpx;
  117. }
  118. }
  119. .nav-li::after {
  120. content: "";
  121. position: absolute;
  122. z-index: -1;
  123. background-color: inherit;
  124. width: 100%;
  125. height: 100%;
  126. left: 0;
  127. bottom: -10%;
  128. border-radius: 10rpx;
  129. opacity: 0.2;
  130. transform: scale(0.9, 0.9);
  131. }
  132. .nav-li.cur {
  133. color: #fff;
  134. background: rgb(94, 185, 94);
  135. box-shadow: 4rpx 4rpx 6rpx rgba(94, 185, 94, 0.4);
  136. }
  137. .nav-title {
  138. font-size: 30rpx;
  139. font-weight: bold;
  140. padding-bottom: 20rpx;
  141. }
  142. .nav-name {
  143. font-size: 26rpx;
  144. text-transform: Capitalize;
  145. margin-top: 10rpx;
  146. position: relative;
  147. }
  148. .nav-li text {
  149. position: absolute;
  150. right: 30rpx;
  151. top: 20rpx;
  152. font-size: 28rpx;
  153. height: 60rpx;
  154. text-align: center;
  155. line-height: 60rpx;
  156. }
  157. .text-green {
  158. color: #25AC66;
  159. }
  160. .bg-green {
  161. background-color: #25AC66;
  162. color: #FFFFFF;
  163. }
  164. </style>