艺易修小程序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.

250 lines
5.2 KiB

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