repairAcceptance.vue 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  1. <template>
  2. <div class="repairAcceptance">
  3. <div class="whiteBoard">
  4. <div class="addRepair" @tap="addRepair">新增报修 <van-icon name="add" style="margin-left: 8rpx"/></div>
  5. <div class="repairItem" v-for="item in recordList" @click="toDetail(item)">
  6. <div class="repairItemTitleRow">
  7. <span class="titleName">{{item.description}}</span>
  8. <span class="rowTags" :class="getStatus(item)==='已评价'?'yclTags':getStatus(item)==='暂存'?'zcTags':getStatus(item)==='待评价'?'dpjTags':''">{{getStatus(item)}}</span>
  9. </div>
  10. <div class="companyBox">
  11. <img src="https://www.idea-co-sf.com/gardenProduct/image/gs.svg" class="gsIcon">
  12. <span class="companyName">{{item.companyName}}</span>
  13. </div>
  14. <div class="upTimeBox">上报时间:{{ item.createdAt }}</div>
  15. </div>
  16. </div>
  17. </div>
  18. </template>
  19. <script>
  20. import { repairHandleList,getUserLocalStorageInfo,getByCodes } from "@/js_sdk/http";
  21. export default {
  22. name: "repairAcceptance",
  23. data(){
  24. return{
  25. dc_key: ['REPAIR_STATUS'],
  26. getUserLocalStorageInfo: getUserLocalStorageInfo(),
  27. recordList:[
  28. // {name:'上月水费不太对,怀疑水表异常',type:'待受理'},
  29. // {name:'空调坏了,不能使用',type:'待处理'},
  30. // {name:'空调坏了,不能使用',type:'已处理'},
  31. ],
  32. params: {
  33. pageNum: 1,
  34. pageSize: 10,
  35. // dispatchUserId: getUserLocalStorageInfo().userId,
  36. handleUserId: getUserLocalStorageInfo().userId,
  37. },
  38. checkList:[]
  39. }
  40. },
  41. onShow(){
  42. this.getByCodes()
  43. },
  44. mounted(){
  45. },
  46. methods:{
  47. getStatus(item){
  48. if (item.userType === '1') {
  49. if (item.statusName === '已处理') {
  50. return item.evaluateStatus === 1 ? '待评价' : '已评价';
  51. }
  52. }
  53. // 如果不满足上述条件,则直接返回 item.statusName
  54. return item.statusName;
  55. },
  56. onPullDownRefresh() {
  57. this.getByCodes()
  58. setTimeout(function () {
  59. uni.stopPullDownRefresh();
  60. }, 1000);
  61. },
  62. async getByCodes() {
  63. let data = await getByCodes(JSON.stringify(this.dc_key));
  64. this.dic_SelectList = this.$common.handleDicList(data);
  65. this.checkList = this.dic_SelectList.REPAIR_STATUS
  66. this.getList()
  67. },
  68. getList(){
  69. this.recordList = []
  70. const _this = this
  71. repairHandleList(this.params).then((res) => {
  72. if (res.code=='409'){
  73. uni.clearStorageSync();
  74. uni.reLaunch({
  75. url: "/pages/login/login",
  76. });
  77. }
  78. if (res.data) {
  79. res.data.forEach(function(item) {
  80. const jsonMap = _this.getItemJson(item)
  81. _this.recordList.push(jsonMap)
  82. })
  83. }
  84. })
  85. },
  86. addRepair(){
  87. uni.navigateTo({
  88. url:'/pages/subPackages/todo/addRepair'
  89. })
  90. },
  91. toDetail(item) {
  92. uni.navigateTo({
  93. url:'/pages/subPackages/todo/dispatch?item=' + JSON.stringify(item)
  94. })
  95. },
  96. getItemJson: function(item) {
  97. item.createdAt = this.$common.transServDate(item.createdAt)
  98. let transformedObject = this.checkList.reduce((acc, obj) => {
  99. acc[obj.value] = obj.label;
  100. return acc;
  101. }, {});
  102. item.statusName = transformedObject[item.status]
  103. return item
  104. },
  105. }
  106. }
  107. </script>
  108. <style lang="scss">
  109. .repairAcceptance{
  110. .whiteBoard{
  111. background: white;
  112. margin-top: 24rpx;
  113. box-sizing: border-box;
  114. padding: 32rpx;
  115. min-height: 1424rpx;
  116. .addRepair{
  117. display: flex;
  118. justify-content: flex-end;
  119. align-items: center;
  120. color: rgba(3, 101, 249, 1);
  121. }
  122. .repairItem{
  123. background: rgba(245, 247, 250, 1);
  124. border-radius: 16rpx;
  125. width: 686rpx;
  126. height: 224rpx;
  127. padding: 32rpx 0 24rpx 0;
  128. box-sizing: border-box;
  129. margin-top: 24rpx;
  130. .repairItemTitleRow{
  131. display: flex;
  132. justify-content: space-between;
  133. padding: 0 32rpx;
  134. .titleName{
  135. color: rgba(34, 34, 34, 1);
  136. font-size: 32rpx;
  137. font-weight: 600;
  138. }
  139. .rowTags{
  140. display: flex;
  141. align-items: center;
  142. justify-content: center;
  143. color: #0365F9;
  144. font-size: 28rpx;
  145. width: 112rpx;
  146. height: 48rpx;
  147. background: rgba(3, 101, 249, 0.20);
  148. border-radius: 4rpx;
  149. }
  150. .yclTags{
  151. color: rgba(34, 181, 101, 1);
  152. background: rgba(34, 181, 101, 0.20);
  153. }
  154. .zcTags{
  155. color: rgba(255, 107, 24, 1);
  156. background: rgba(254, 134, 67, 0.20);
  157. }
  158. .dpjTags{
  159. color: rgb(151, 24, 255);
  160. background: rgba(151, 24, 255, 0.20);
  161. }
  162. }
  163. .companyBox{
  164. display: flex;
  165. align-items: center;
  166. padding: 8rpx 32rpx 24rpx 32rpx;
  167. .gsIcon{
  168. width: 32rpx;
  169. height: 32rpx;
  170. }
  171. .companyName{
  172. font-size: 28rpx;
  173. color: rgba(102, 102, 102, 1);
  174. margin-left: 8rpx;
  175. }
  176. }
  177. .upTimeBox{
  178. padding: 16rpx 32rpx 0 32rpx;
  179. border-top: 1px solid rgba(230, 230, 230, 1);
  180. color: rgba(102, 102, 102, 1);
  181. font-size: 28rpx;
  182. }
  183. }
  184. }
  185. }
  186. </style>