repairRecord.vue 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  1. <template>
  2. <div class="repair-record-box">
  3. <ul class="custom-list-box">
  4. <li class="customLi" v-for="item in recordList" @tap="toDetail(item)">
  5. <div class="firstRow">
  6. <span class="rowTitle">{{ item.description }}</span>
  7. <span class="rowTags" :class="getStatus(item)==='已评价'?'yclTags':getStatus(item)==='暂存'?'zcTags':getStatus(item)==='待评价'?'dpjTags':''">{{getStatus(item)}}</span>
  8. </div>
  9. <div class="secondRow">
  10. <img src="https://www.idea-co-sf.com/gardenProduct/image/componeyIcon.png" class="componeyIcon">
  11. {{item.companyName}}
  12. </div>
  13. <div class="lastRow">上报时间:{{item.createdAt}}</div>
  14. </li>
  15. </ul>
  16. </div>
  17. </template>
  18. <script>
  19. import {repairList,getUserLocalStorageInfo,getByCodes } from "@/js_sdk/http";
  20. import {isImageFile} from "../../../wxcomponents/weapp/lib/uploader/utils";
  21. export default {
  22. data(){
  23. return{
  24. recordList:[
  25. // {title:'上月水费不太对,怀疑水表异常',type:'已受理'},
  26. // {title:'空调坏了,不能使用',type:'已受理'},
  27. // {title:'办公室灯泡坏了2个',type:'已处理'},
  28. // {title:'厕所水龙头坏了,不出水',type:'暂存'},
  29. ],
  30. dc_key: ['REPAIR_STATUS'],
  31. dic_SelectList:[],
  32. params: {
  33. pageNum: 1,
  34. pageSize: 5,
  35. userId: getUserLocalStorageInfo().userId
  36. },
  37. }
  38. },
  39. onPullDownRefresh() {
  40. this.getByCodes()
  41. setTimeout(function () {
  42. uni.stopPullDownRefresh();
  43. }, 1000);
  44. },
  45. onShow(){
  46. this.getByCodes()
  47. },
  48. methods:{
  49. getStatus(item){
  50. if (item.userType === '1') {
  51. if (item.statusName === '已处理') {
  52. return item.evaluateStatus === 1 ? '待评价' : '已评价';
  53. }
  54. }
  55. // 如果不满足上述条件,则直接返回 item.statusName
  56. return item.statusName;
  57. },
  58. async getByCodes() {
  59. let data = await getByCodes(JSON.stringify(this.dc_key));
  60. this.dic_SelectList = this.$common.handleDicList(data);
  61. this.getList()
  62. },
  63. getList(){
  64. this.recordList = []
  65. const _this = this
  66. repairList(this.params).then(res=>{
  67. // console.log(res.code)
  68. if (res.code == '409'){
  69. // console.log(222)
  70. uni.navigateTo({
  71. url: "/pages/login2/login",
  72. success: function (e) {
  73. },
  74. });
  75. }
  76. if (res.data) {
  77. res.data.forEach(function(item) {
  78. const jsonMap = _this.getItemJson(item)
  79. _this.recordList.push(jsonMap)
  80. })
  81. }
  82. })
  83. },
  84. toDetail(item){
  85. // console.log('item',item)
  86. if (item.statusName==="暂存"){
  87. uni.redirectTo({
  88. url:'/pages/subPackages/reportRepair/index?item=' + JSON.stringify(item)
  89. })
  90. }else{
  91. uni.navigateTo({
  92. url:'/pages/subPackages/reportRepair/repairDetail?item=' + JSON.stringify(item)
  93. })
  94. }
  95. },
  96. getItemJson(item) {
  97. console.log('item',item)
  98. // if (item.fileUrl){
  99. // const fileUrl = item.fileUrl.split(',')
  100. // const newFile = []
  101. // fileUrl.forEach((e=>{
  102. // newFile.push({
  103. // imgUrl: "/FileController/download/" + e,
  104. // id: e,
  105. // url: this.$constant.BASE_URI +
  106. // "/FileController/download/" +
  107. // e,
  108. // isImage: true,
  109. // });
  110. // })
  111. // )
  112. // item.fileUrl = newFile
  113. // }
  114. // fileUrls.forEach((item) => {
  115. // item = item.replace('/server', '/smartParkH5Server')
  116. // fileUrl.push(item)
  117. // })
  118. item.createdAt = this.$common.transServDate(item.createdAt)
  119. let transformedObject = this.dic_SelectList.REPAIR_STATUS.reduce((acc, obj) => {
  120. acc[obj.value] = obj.label;
  121. return acc;
  122. }, {});
  123. item.statusName = transformedObject[item.status]
  124. return item
  125. },
  126. }
  127. }
  128. </script>
  129. <style lang="scss" scoped>
  130. .repair-record-box {
  131. .custom-list-box{
  132. display: flex;
  133. flex-direction: column;
  134. align-items: center;
  135. padding-bottom: 36rpx;
  136. .customLi{
  137. background: white;
  138. width: 686rpx;
  139. height: 224rpx;
  140. border-radius: 16rpx;
  141. box-sizing: border-box;
  142. padding: 24rpx 0;
  143. margin-top: 24rpx;
  144. .componeyIcon{
  145. width: 32rpx;
  146. height: 32rpx;
  147. margin-right: 5rpx;
  148. }
  149. .firstRow{
  150. display: flex;
  151. justify-content: space-between;
  152. padding: 12rpx 32rpx;
  153. .rowTitle{
  154. color:#222222;
  155. font-size: 32rpx;
  156. font-weight: 600;
  157. }
  158. .rowTags{
  159. display: flex;
  160. align-items: center;
  161. justify-content: center;
  162. color: #0365F9;
  163. font-size: 28rpx;
  164. width: 112rpx;
  165. height: 48rpx;
  166. background: rgba(3, 101, 249, 0.20);
  167. border-radius: 4rpx;
  168. }
  169. .yclTags{
  170. color: rgba(34, 181, 101, 1);
  171. background: rgba(34, 181, 101, 0.20);
  172. }
  173. .zcTags{
  174. color: rgba(255, 107, 24, 1);
  175. background: rgba(254, 134, 67, 0.20);
  176. }
  177. .dpjTags{
  178. color: rgb(151, 24, 255);
  179. background: rgba(151, 24, 255, 0.20);
  180. }
  181. }
  182. .secondRow{
  183. display: flex;
  184. align-items: center;
  185. color: rgba(102, 102, 102, 1);
  186. font-size: 28rpx;
  187. padding:0 32rpx 24rpx 32rpx;
  188. border-bottom: 2rpx solid rgba(230, 230, 230, 1);
  189. }
  190. .lastRow{
  191. color: rgba(102, 102, 102, 1);
  192. font-size: 28rpx;
  193. padding: 20rpx 32rpx;
  194. }
  195. }
  196. }
  197. }
  198. </style>