艺易修小程序24.08.21
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

231 lines
4.6 KiB

  1. <template>
  2. <view class="repairList reserveSpace">
  3. <view class="tab">
  4. <uv-tabs :list="list" lineWidth="60" lineHeight="10" @click="selectTag"></uv-tabs>
  5. </view>
  6. <view class="repairList-main">
  7. <view v-for="item in repairList" :key="item.id" class="repairItem">
  8. <view class="repairMain">
  9. <!-- <view class="userName">用户名</view> -->
  10. <view class="build">
  11. <view>
  12. <text style="margin-right: 10rpx;">{{ item.building }}</text>
  13. <text> {{ item.room }}</text>
  14. </view>
  15. <text style="font-size: 26rpx;">{{ item.createTime }}</text>
  16. </view>
  17. <view class="desc">
  18. <uv-read-more :shadowStyle="shadowStyle" show-height="80rpx" fontSize="30rpx" :toggle="true">
  19. <view>
  20. {{ item.context }}
  21. </view>
  22. </uv-read-more>
  23. </view>
  24. <view class="repairImages">
  25. <view v-for="(image,index) in item.image" :key="index" class="image-item">
  26. <image @click="viewImageAsList(index,item.image)" :src="image" mode="widthFix"></image>
  27. </view>
  28. </view>
  29. <view class="btns">
  30. <view v-if="userInfo.isDai == '1' && !item.cleckState" @click="toReject(item.id)" class="btn">驳回
  31. </view>
  32. <view v-if="userInfo.isDai == '1' && !item.cleckState" @click="toFinish(item.id)" class="btn">结单
  33. </view>
  34. </view>
  35. </view>
  36. </view>
  37. </view>
  38. </view>
  39. </template>
  40. <script>
  41. import {
  42. mapState,
  43. } from 'vuex'
  44. export default {
  45. data() {
  46. return {
  47. list: [{
  48. name: '待完成',
  49. }, {
  50. name: '已完成',
  51. }],
  52. current: 0,
  53. currentIndex: 0,
  54. repairList: [], //报修列表
  55. queryParams: {
  56. pageNo: 1,
  57. pageSize: 3,
  58. state: 0
  59. },
  60. total: 0
  61. }
  62. },
  63. onShow() {
  64. this.getRepairList()
  65. },
  66. //滚动到屏幕底部
  67. onReachBottom() {
  68. if (this.queryParams.pageSize <= this.total) {
  69. this.queryParams.pageSize += 3
  70. this.getRepairList()
  71. }
  72. },
  73. methods: {
  74. //跳转驳回
  75. toReject(id) {
  76. uni.navigateTo({
  77. url: `/pages/reject/reject?orderId=${id}`
  78. })
  79. },
  80. //跳转结单页面
  81. toFinish(id) {
  82. uni.navigateTo({
  83. url: `/pages/finish/finish?orderId=${id}`
  84. })
  85. },
  86. //查看图片
  87. viewImageAsList(index, imgArr) {
  88. this.currentIndex = index
  89. this.$utils.previewImage({
  90. current: this.currentIndex,
  91. urls: imgArr
  92. })
  93. },
  94. //选择了顶部的标签
  95. selectTag(tag) {
  96. this.queryParams.state = tag.index
  97. this.getRepairList()
  98. },
  99. //获取报修列表
  100. getRepairList() {
  101. this.$api('getSchoolOrderList', this.queryParams, res => {
  102. if (res.code == 200) {
  103. res.result.records.forEach(item => {
  104. item.image ? item.image = item.image.split(',') : item.image = []
  105. })
  106. this.repairList = res.result.records
  107. this.total = res.result.total
  108. }
  109. })
  110. }
  111. },
  112. computed: {
  113. shadowStyle() {
  114. return {
  115. // #ifndef APP-NVUE
  116. backgroundImage: "linear-gradient(-180deg, rgba(255, 255, 255, 0) 0%, #fff 80%)",
  117. // #endif
  118. // #ifdef APP-NVUE
  119. // nvue上不支持设置复杂的backgroundImage属性
  120. backgroundImage: "linear-gradient(to top, #fff, rgba(255, 255, 255, 0.5))",
  121. // #endif
  122. paddingTop: "50px",
  123. marginTop: "-50px",
  124. }
  125. },
  126. ...mapState(['userInfo']),
  127. }
  128. }
  129. </script>
  130. <style scoped>
  131. .repairList {
  132. background: #f8f8f8;
  133. }
  134. .tab {
  135. display: flex;
  136. align-items: center;
  137. height: 80rpx;
  138. background: white;
  139. margin-bottom: 20rpx;
  140. }
  141. .repairList-main {
  142. min-height: 100vh;
  143. }
  144. .repairItem {
  145. display: flex;
  146. background: white;
  147. width: 96%;
  148. margin: 0rpx auto;
  149. border-radius: 20rpx;
  150. margin-bottom: 20rpx;
  151. }
  152. .repairMain {
  153. width: 100%;
  154. box-sizing: border-box;
  155. padding-left: 20rpx;
  156. }
  157. /*
  158. .userName {
  159. font-size: 32rpx;
  160. margin: 10rpx 0rpx;
  161. } */
  162. .build {
  163. display: flex;
  164. justify-content: space-between;
  165. font-size: 28rpx;
  166. margin: 20rpx 0rpx;
  167. }
  168. .desc {
  169. overflow-y: scroll;
  170. margin-bottom: 20rpx;
  171. }
  172. .repairImages {
  173. display: flex;
  174. flex-wrap: wrap;
  175. margin: 10rpx 0rpx;
  176. }
  177. .image-item {
  178. width: 24%;
  179. margin-left: 1%;
  180. height: 180rpx;
  181. overflow: hidden;
  182. display: flex;
  183. align-items: center;
  184. justify-content: center;
  185. padding: 20rpx;
  186. background: #f5f5f5;
  187. border-radius: 20rpx;
  188. }
  189. .image-item image {
  190. width: 100%;
  191. }
  192. .btns {
  193. margin: 20rpx 0rpx;
  194. display: flex;
  195. justify-content: flex-end;
  196. }
  197. .btn {
  198. width: 200rpx;
  199. height: 50rpx;
  200. display: flex;
  201. align-items: center;
  202. justify-content: center;
  203. border-radius: 50rpx;
  204. margin-left: 15rpx;
  205. font-size: 30rpx;
  206. color: white;
  207. background: #f9ae3d;
  208. }
  209. .btn:nth-child(2) {
  210. background: #3c9cff;
  211. }
  212. </style>