repairDetail.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380
  1. <template>
  2. <div class="repair-detail-box">
  3. <div
  4. :class="[
  5. 'repair-content',
  6. detailStatus === 'processed' ? 'fixed-page-content' : 'page-content',
  7. ]"
  8. >
  9. <div class="white-box page-1">
  10. <div class="cell-item">
  11. <p class="label">当前企业</p>
  12. <p class="tit">{{ detail.companyName }}</p>
  13. </div>
  14. <div class="cell-item">
  15. <p class="label">您是想</p>
  16. <div class="tit">{{ detail.type==='1'?'报事':'咨询' }}</div>
  17. </div>
  18. <div class="cell-item">
  19. <p class="label">快捷选择</p>
  20. <div class="tit">{{ detail.serviceType }}</div>
  21. </div>
  22. <div class="block-cell-item">
  23. <p class="label">报事报修描述</p>
  24. <div class="tit">
  25. <div class="textarea">
  26. {{detail.description}}
  27. </div>
  28. </div>
  29. </div>
  30. </div>
  31. <div class="white-box page-2">
  32. <div class="cell-item">
  33. <p class="label">位置</p>
  34. <div class="tit">{{ detail.position==='1'?'室内':'公区' }}</div>
  35. </div>
  36. <div class="block-cell-item">
  37. <p class="label">补充说明</p>
  38. <div class="tit">
  39. <ul class="annex-list-box">
  40. <li
  41. class="annex-item"
  42. v-for="(item, index) in explainAnnexList"
  43. :key="index"
  44. >
  45. <img :src="item.url" alt="" v-if="item.type === 'image'" />
  46. <video
  47. :src="item.url"
  48. v-if="item.type === 'video'"
  49. width="100%"
  50. height="100%"
  51. ></video>
  52. </li>
  53. </ul>
  54. </div>
  55. </div>
  56. <div class="cell-item flex-item">
  57. <p class="label">报事人</p>
  58. <p class="tit tel-box">
  59. <span>{{ detail.userPhone }}</span>
  60. <TelNum :num="detail.phone" :showTel="false" />
  61. </p>
  62. </div>
  63. <div class="cell-item">
  64. <p class="label">报事时间</p>
  65. <p class="tit">{{ detail.createdAt }}</p>
  66. </div>
  67. </div>
  68. <div class="white-box page-3">
  69. <div class="custom-item-tit">
  70. <p class="tit">处理情况</p>
  71. </div>
  72. <div class="block-cell-item">
  73. <p class="label">处理进展</p>
  74. <div class="tit">
  75. <van-steps :active="stepActive" :active-color="'#6600FF'">
  76. <van-step v-for="(item, index) in processSteps" :key="index">{{
  77. item.label
  78. }}</van-step>
  79. </van-steps>
  80. </div>
  81. </div>
  82. <div class="block-cell-item">
  83. <p class="label">
  84. 处理后拍照<span class="tips">(支持图片上传限20M内,最多6张)</span>
  85. </p>
  86. <div class="tit">
  87. <ul class="annex-list-box">
  88. <li
  89. class="annex-item"
  90. v-for="(item, index) in processedAnnexList"
  91. :key="index"
  92. >
  93. <img :src="item.url" alt="" v-if="item.type === 'image'" />
  94. <video
  95. :src="item.url"
  96. v-if="item.type === 'video'"
  97. width="100%"
  98. height="100%"
  99. ></video>
  100. </li>
  101. </ul>
  102. </div>
  103. </div>
  104. <div class="cell-item flex-item">
  105. <p class="label">结案人</p>
  106. <p class="tit tel-box">
  107. <span>{{ detail.handleUserId }}</span>
  108. <TelNum :num="detail.hanleUserPhone" :showTel="false" />
  109. </p>
  110. </div>
  111. <div class="cell-item">
  112. <p class="label">结案时间</p>
  113. <p class="tit">{{detail.handleTime}}</p>
  114. </div>
  115. </div>
  116. <div class="white-box page-4" v-if="detailStatus === 'processed'||detailStatus === 'evaluated'">
  117. <div class="custom-item-tit">
  118. <p class="tit">服务评价</p>
  119. </div>
  120. <div class="custom-white-box-content">
  121. <div class="evaluate-box">
  122. <p class="evaluate-left">您对本次服务的评价</p>
  123. <div class="evaluate-right">
  124. <van-rate v-model="evaluateVal" color="#ffd21e" :readonly="detailStatus !== 'processed'"/>
  125. </div>
  126. </div>
  127. </div>
  128. </div>
  129. </div>
  130. <div class="repair-bottom bottom-button" v-if="detailStatus === 'processed'">
  131. <button class="btn" @click="onConfirm">评价提交</button>
  132. </div>
  133. </div>
  134. </template>
  135. <script>
  136. import TelNum from '@/components/tel-number'
  137. import { getById } from '../../service/api_repair'
  138. import Base from '@/pages/base/base'
  139. import { editRepair } from '@/service/api_repair'
  140. import { Toast } from 'vant'
  141. export default {
  142. components: {
  143. TelNum
  144. },
  145. data() {
  146. return {
  147. dc_key: ['QUICK_SELECTION', 'REPAIR_STATUS'],
  148. detailId: '', // 详情id
  149. detailStatus: '', // 详情状态:0、待受理 1、已受理 2、已处理 3、已评价
  150. explainAnnexList: [
  151. // {
  152. // type: 'image',
  153. // url: require('../../assets/image/reportRepair/shuibiao.jpeg')
  154. // }
  155. ], // 说明附件 type image、图片 video、视频
  156. processedAnnexList: [
  157. // {
  158. // type: 'image',
  159. // url: require('../../assets/image/reportRepair/shuibiao.jpeg')
  160. // }
  161. ], // 附件 type image、图片 video、视频
  162. stepActive: 0, // 当前处理到哪一步
  163. processSteps: [
  164. {
  165. id: 1,
  166. status: 1,
  167. label: '上报'
  168. },
  169. {
  170. id: 2,
  171. status: 1,
  172. label: '已受理'
  173. },
  174. {
  175. id: 3,
  176. status: 1,
  177. label: '已处理'
  178. },
  179. {
  180. id: 4,
  181. status: 0,
  182. label: '评价'
  183. }
  184. ], // 处理流程
  185. evaluateVal: 0, // 评分
  186. id: '',
  187. detail: {},
  188. fileUrlList: [],
  189. params: {
  190. id: '',
  191. evaluateNum: '',
  192. score: ''
  193. }
  194. }
  195. },
  196. mixins: [Base],
  197. mounted() {
  198. this.id = this.$route.query.id
  199. this.initDict(this.dc_key).then((res) => {
  200. this.getDetailById()
  201. })
  202. },
  203. methods: {
  204. onConfirm(value) {
  205. this.params.evaluateNum = this.params.evaluateNum + 1
  206. this.params.score = this.params.score + this.evaluateVal
  207. this.params.status = 'evaluated'
  208. editRepair(this.params).then((res) => {
  209. Toast.success('评价成功')
  210. this.$router.push({ path: 'repairRecord',
  211. query: { type: this.detail.type }
  212. })
  213. })
  214. },
  215. getDetailById() {
  216. const _this = this
  217. getById({ id: _this.id }).then((res) => {
  218. console.log(res.data)
  219. if (res.data) {
  220. const det = _this.getItemJson(res.data)
  221. this.detail = det
  222. this.explainAnnexList = det.fileUrlList
  223. this.processedAnnexList = det.handleUrlList
  224. this.detailStatus = det.status
  225. this.params = {
  226. id: det.id,
  227. evaluateNum: det.evaluateNum,
  228. score: det.score
  229. }
  230. this.evaluateVal = ((det.score == null ? 0 : det.score) / (det.evaluateNum == null ? 1 : det.evaluateNum))
  231. }
  232. // const item = _this.getItemJson(res)
  233. })
  234. },
  235. getItemJson: function(item) {
  236. item.releaseTime = this.$common.transDate(item.releaseTime)
  237. item.createdAt = this.$common.transDate(item.createdAt)
  238. item.serviceType = this.dc_map.QUICK_SELECTION[item.serviceType]
  239. if (item.userId) {
  240. const user = item.userId.split('-')
  241. item.userPhone = user[1] + '-' + user[2]
  242. item.phone = user[2]
  243. }
  244. if (item.handleUserId) {
  245. const test = item.handleUserId.split('-')
  246. item.handleUserId = test[1] + '-' + test[2]
  247. item.hanleUserPhone = test[2]
  248. }
  249. item.handleTime = this.$common.transDate(item.handleTime)
  250. switch (item.status) {
  251. case 'unAcceptance':
  252. this.stepActive = 0
  253. break
  254. case 'acceptance':
  255. this.stepActive = 1
  256. break
  257. case 'evaluated':
  258. this.stepActive = 3
  259. break
  260. case 'processed':
  261. this.stepActive = 2
  262. break
  263. }
  264. const fileUrls = this.$common.castEval(item.fileUrl)
  265. const fileUrl = []
  266. if (fileUrls !== null && fileUrls.length > 0) {
  267. fileUrls.forEach(item => {
  268. if (item.url) {
  269. const ul = {
  270. type: 'image',
  271. url: item.url.replace('/server', '/smartParkH5Server')
  272. }
  273. fileUrl.push(ul)
  274. }
  275. })
  276. }
  277. item.fileUrlList = fileUrl
  278. const handleUrls = this.$common.castEval(item.handleUrl)
  279. const handleUrl = []
  280. if (handleUrls !== null && handleUrls.length > 0) {
  281. handleUrls.forEach(item => {
  282. if (item.url) {
  283. const ul = {
  284. type: 'image',
  285. url: item.url.replace('/server', '/smartParkH5Server')
  286. }
  287. handleUrl.push(ul)
  288. }
  289. })
  290. }
  291. item.handleUrlList = handleUrl
  292. return item
  293. },
  294. /**
  295. *
  296. */
  297. quickSelect(item) {
  298. if (this.quickSleced.val && this.quickSleced.val === item.val) {
  299. this.quickSleced = {}
  300. } else {
  301. this.quickSleced = item
  302. }
  303. },
  304. /**
  305. * 上传文件
  306. */
  307. afterRead(file) {
  308. console.log(file)
  309. }
  310. }
  311. }
  312. </script>
  313. <style lang="scss" scoped>
  314. .repair-detail-box {
  315. width: 100%;
  316. height: 100%;
  317. .page-1 {
  318. .textarea {
  319. padding: 20px;
  320. border-radius: 10px;
  321. background: $page-color-base;
  322. box-sizing: border-box;
  323. }
  324. }
  325. .page-4 {
  326. .evaluate-box {
  327. padding: 20px 30px;
  328. background: $page-color-base;
  329. border: 1px solid #ebedf0;
  330. border-radius: 100px;
  331. display: flex;
  332. align-items: center;
  333. justify-content: space-between;
  334. box-sizing: border-box;
  335. }
  336. }
  337. .annex-list-box {
  338. display: flex;
  339. flex-wrap: wrap;
  340. justify-content: space-between;
  341. &::after {
  342. display: block;
  343. content: "";
  344. width: 30%;
  345. height: 0px;
  346. }
  347. .annex-item {
  348. width: 30%;
  349. height: 180px;
  350. border: 1px solid $text4;
  351. margin-bottom: 20px;
  352. position: relative;
  353. overflow: hidden;
  354. > img {
  355. width: 100%;
  356. position: absolute;
  357. top: 0;
  358. left: 0;
  359. right: 0;
  360. bottom: 0;
  361. margin: auto;
  362. display: block;
  363. }
  364. video {
  365. width: 100%;
  366. height: 100%;
  367. }
  368. }
  369. }
  370. .tel-box {
  371. display: flex;
  372. align-items: center;
  373. /deep/ .custom-tel-component {
  374. margin-left: 20px;
  375. }
  376. }
  377. }
  378. </style>