repairDetail.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617
  1. <template>
  2. <div class="addRepair">
  3. <div class="reportBody">
  4. <ul class="detailUl">
  5. <li class="detailLi">
  6. <span class="liName">当前企业</span>
  7. <span class="liInfo">{{ detail.companyName }}</span>
  8. </li>
  9. <li class="detailLi">
  10. <span class="liName">
  11. <span style="color: red;margin-right: 10rpx;">*</span>
  12. 您是想
  13. </span>
  14. <span class="liInfo">
  15. <van-radio-group :value="detail.type" disabled>
  16. <van-radio name="1">报事</van-radio>
  17. <van-radio name="2">咨询</van-radio>
  18. </van-radio-group>
  19. </span>
  20. </li>
  21. <li class="detailLi2">
  22. <span class="liName">
  23. 快捷选择
  24. </span>
  25. <div class="detailLi2Box">
  26. <div class="detailLi2BoxTop">
  27. <div class="checkItem" :class="detail.serviceType===item.label?'checked':''" v-for="item in checkList">{{item.label}}</div>
  28. </div>
  29. <van-field
  30. :value="detail.description"
  31. autosize
  32. type="textarea"
  33. placeholder="请输入文字进行报事报修描述"
  34. class="myField"
  35. maxlength="800"
  36. show-word-limit
  37. readonly
  38. />
  39. </div>
  40. </li>
  41. <li class="detailLi">
  42. <span class="liName">
  43. <span style="color: red;margin-right: 10rpx;">*</span>
  44. 位置
  45. </span>
  46. <span class="liInfo">
  47. <van-radio-group :value="detail.position" disabled>
  48. <van-radio name="1">室内</van-radio>
  49. <van-radio name="2">公区</van-radio>
  50. </van-radio-group>
  51. </span>
  52. </li>
  53. <li class="detailLi2">
  54. <span class="liName">
  55. 补充说明
  56. <span style="color: #B3B3B3;font-size: 28rpx">(支持图片/视频上传限20M内,最多6张)</span>
  57. </span>
  58. <div style="display: flex;flex-wrap: wrap;gap: 24rpx">
  59. <div class="detailLi2Box annex-item"
  60. style="margin: 24rpx 0 0 0"
  61. v-for="(item, index) in explainAnnexList"
  62. :key="index">
  63. <img :src="item.url" alt="" v-if="item.type === 'image'" class="anImg" @tap="clickImg(item.url)"/>
  64. </div>
  65. </div>
  66. <div class="detailLi2Box annex-item"
  67. style="margin: 24rpx 0 0 0"
  68. v-for="(item, index) in explainAnnexList"
  69. :key="index+999">
  70. <video
  71. :src="item.url"
  72. v-if="item.type === 'video'"
  73. style="width: 686rpx"
  74. height="100%"
  75. autoplay
  76. ></video>
  77. </div>
  78. </li>
  79. <li class="detailLi">
  80. <span class="liName">
  81. 报事人
  82. </span>
  83. <span class="liInfo">
  84. {{detail.userName}} <img src="https://www.idea-co-sf.com/gardenProduct/image/phoneIcon.png" class="phoneIcon">
  85. </span>
  86. </li>
  87. <li class="detailLi" style="border-bottom: none">
  88. <span class="liName">
  89. 报事时间
  90. </span>
  91. <span class="liInfo">
  92. {{detail.createdAt}}
  93. </span>
  94. </li>
  95. </ul>
  96. </div>
  97. <div class="handleBox">
  98. <div class="handleTitle">处理情况</div>
  99. <div class="imageBox">
  100. <div class="imageItem">
  101. <img src="https://www.idea-co-sf.com/gardenProduct/image/upImage.svg" class="handleImg">
  102. <span>上报</span>
  103. </div>
  104. <img src="https://www.idea-co-sf.com/gardenProduct/image/arrow.png" class="handleArrow">
  105. <div class="imageItem">
  106. <img :src="stepActive==='已受理'||stepActive==='已处理'?'https://www.idea-co-sf.com/gardenProduct/image/acceptance.svg':'https://www.idea-co-sf.com/gardenProduct/image/unAcceptance.svg'" class="handleImg">
  107. <span>受理</span>
  108. </div>
  109. <img src="https://www.idea-co-sf.com/gardenProduct/image/arrow.png" class="handleArrow">
  110. <div class="imageItem">
  111. <img :src="stepActive==='已处理'?'https://www.idea-co-sf.com/gardenProduct/image/handle.svg':'https://www.idea-co-sf.com/gardenProduct/image/unHandle.svg'" class="handleImg">
  112. <span>处理</span>
  113. </div>
  114. <img src="https://www.idea-co-sf.com/gardenProduct/image/arrow.png" class="handleArrow">
  115. <div class="imageItem">
  116. <img src="https://www.idea-co-sf.com/gardenProduct/image/evaluate.svg" class="handleImg">
  117. <span>评价</span>
  118. </div>
  119. </div>
  120. </div>
  121. <div class="reportBody" v-if="stepActive==='已处理'||stepActive==='已受理'">
  122. <div class="handleTitle">派单信息</div>
  123. <ul class="detailUl">
  124. <li class="detailLi">
  125. <span class="liName">
  126. 派单给
  127. </span>
  128. <span class="liInfo">
  129. 李开心
  130. </span>
  131. </li>
  132. <li class="detailLi2">
  133. <span class="liName" style="margin-bottom: 16rpx">
  134. 备注
  135. </span>
  136. <van-field
  137. :value="form.contant"
  138. autosize
  139. type="textarea"
  140. placeholder="请输入文字进行报事报修描述"
  141. class="myField2"
  142. maxlength="800"
  143. show-word-limit
  144. />
  145. </li>
  146. <li class="detailLi">
  147. <span class="liName">
  148. 派单人
  149. </span>
  150. <span class="liInfo">
  151. 李欣怡
  152. </span>
  153. </li>
  154. <li class="detailLi" style="border-bottom: none">
  155. <span class="liName">
  156. 派单时间
  157. </span>
  158. <span class="liInfo">
  159. 2024-05-18 15:30
  160. </span>
  161. </li>
  162. </ul>
  163. </div>
  164. <div class="reportBody" v-if="stepActive==='已处理'">
  165. <div class="handleTitle">处理信息</div>
  166. <ul class="detailUl">
  167. <li class="detailLi2">
  168. <span class="liName">
  169. 处理后拍照
  170. <span style="color: #B3B3B3;font-size: 28rpx">(支持图片上传限20M内,最多6张)</span>
  171. </span>
  172. <div class="detailLi2Box" style="margin: 24rpx 0 0 0">
  173. <van-uploader
  174. :max-count="6"
  175. @delete="deleteRYXXZP"
  176. :file-list="fileList"
  177. @after-read="uploadRYXXZP"
  178. :show-upload="true"
  179. />
  180. </div>
  181. </li>
  182. <li class="detailLi">
  183. <span class="liName">
  184. 处理人
  185. </span>
  186. <span class="liInfo">
  187. 李开心
  188. </span>
  189. </li>
  190. <li class="detailLi" style="border-bottom: none">
  191. <span class="liName">
  192. 处理时间
  193. </span>
  194. <span class="liInfo">
  195. 2024-05-18 15:30
  196. </span>
  197. </li>
  198. </ul>
  199. </div>
  200. <div class="reportBody" v-if="stepActive==='已处理'">
  201. <div class="evaluationBox" >
  202. <span class="evaName">您对本次服务的评价</span>
  203. <van-rate
  204. :value="value"
  205. :size="24"
  206. gutter="32rpx"
  207. void-color="#eee"
  208. bind:change="onChange"
  209. color="#fd9a63"
  210. />
  211. </div>
  212. </div>
  213. <div class="buttonBox">
  214. <button class="zcBtn" @tap="closePage" :class="stepActive==='已处理'?'btn2':'btn '">关闭</button>
  215. <button class="btn tjBtn" v-if="stepActive==='已处理'">提交</button>
  216. </div>
  217. </div>
  218. </template>
  219. <script>
  220. import {getRepairDispatchById,getUserLocalStorageInfo,getByCodes } from "@/js_sdk/http";
  221. export default {
  222. data(){
  223. return{
  224. dc_key: ['QUICK_SELECTION'],
  225. isCheck:false,
  226. isCheck2:false,
  227. detail:{
  228. },
  229. checkList:[
  230. // {name:'挂件安装',isCheck:true},
  231. // {name:'我要投诉',isCheck:false},
  232. // {name:'疏通管道',isCheck:false},
  233. // {name:'维修线路',isCheck:false},
  234. // {name:'更换灯泡',isCheck:false},
  235. // {name:'网络维修',isCheck:false},
  236. // {name:'保洁服务',isCheck:false},
  237. // {name:'其他维修',isCheck:false},
  238. ],
  239. fileList:[],
  240. optionsType:'',
  241. timeNow:'',
  242. value: "5",
  243. id:'',
  244. dic_SelectList:[],
  245. explainAnnexList:[],
  246. processedAnnexList:[],
  247. stepActive:'0'
  248. }
  249. },
  250. onLoad(options) {
  251. const item = JSON.parse(options.item)
  252. this.id = item.id
  253. console.log('11111',this.id)
  254. this.optionsType = item.type
  255. if (options.type==='待处理'){
  256. uni.setNavigationBarTitle({
  257. title: '报修处理',
  258. });
  259. }else if(options.type==='已处理'){
  260. uni.setNavigationBarTitle({
  261. title: '报修详情',
  262. });
  263. }else {
  264. uni.setNavigationBarTitle({
  265. title: '报修派单',
  266. });
  267. }
  268. this.getByCodes()
  269. },
  270. mounted(){
  271. this.getTime()
  272. },
  273. methods:{
  274. // toRecord() {
  275. // uni.navigateTo({
  276. // url:'/pages/subPackages/reportRepair/repairRecord'
  277. // })
  278. // },
  279. // 放大图片
  280. clickImg(url) {
  281. wx.previewImage({
  282. urls: [url], //接受的是一个数组,默认展示第一张
  283. current: "",
  284. success: function (res) {
  285. },
  286. fail: function (res) {
  287. },
  288. complete: function (res) {
  289. },
  290. })
  291. },
  292. async getByCodes() {
  293. let data = await getByCodes(JSON.stringify(this.dc_key));
  294. this.dic_SelectList = this.$common.handleDicList(data);
  295. this.checkList = this.dic_SelectList.QUICK_SELECTION
  296. this.getById()
  297. },
  298. getById(){
  299. const _this = this
  300. getRepairDispatchById(this.id).then(res=>{
  301. if (res.data) {
  302. const det = _this.getItemJson(res.data)
  303. this.detail = det
  304. console.log('this.detail',this.detail)
  305. this.explainAnnexList = det.fileUrlList
  306. this.processedAnnexList = det.handleUrlList
  307. this.detailStatus = det.status
  308. this.params = {
  309. id: det.id,
  310. evaluateNum: det.evaluateNum,
  311. score: det.score
  312. }
  313. this.evaluateVal = ((det.score == null ? 0 : det.score) / (det.evaluateNum == null ? 1 : det.evaluateNum))
  314. }
  315. })
  316. },
  317. getTime(){
  318. let timestamp = new Date().getTime();
  319. let dateStr = new Date().toLocaleDateString();
  320. let date = new Date();
  321. let year = date.getFullYear();
  322. let month = date.getMonth() + 1;
  323. let day = date.getDate();
  324. let hours = date.getHours();
  325. let minutes = date.getMinutes();
  326. let fullDateStr = `${year}-${month}-${day} ${hours}:${minutes}`;
  327. console.log(fullDateStr);
  328. this.timeNow = fullDateStr
  329. },
  330. getItemJson: function(item) {
  331. item.releaseTime = this.$common.transDate(item.releaseTime)
  332. item.createdAt = this.$common.transDate(item.createdAt)
  333. let transformedObject = this.dic_SelectList.QUICK_SELECTION.reduce((acc, obj) => {
  334. acc[obj.value] = obj.label;
  335. return acc;
  336. }, {});
  337. item.serviceType = transformedObject[item.serviceType]
  338. if (item.userId) {
  339. const user = item.userId.split('-')
  340. item.userPhone = user[1] + '-' + user[2]
  341. item.phone = user[2]
  342. }
  343. if (item.handleUserId) {
  344. const test = item.handleUserId.split('-')
  345. item.handleUserId = test[1] + '-' + test[2]
  346. item.hanleUserPhone = test[2]
  347. }
  348. item.handleTime = this.$common.transDate(item.handleTime)
  349. switch (item.status) {
  350. case 'unAcceptance':
  351. this.stepActive = '待受理'
  352. break
  353. case 'acceptance':
  354. this.stepActive = '已受理'
  355. break
  356. case 'evaluated':
  357. this.stepActive = '已处理'
  358. break
  359. case 'processed':
  360. this.stepActive = '暂存'
  361. break
  362. }
  363. if (item.fileUrl){
  364. console.log('item.fileUrl' ,JSON.parse(item.fileUrl))
  365. const fileUrl = JSON.parse(item.fileUrl)
  366. const newFile = []
  367. fileUrl.forEach((e=>{
  368. newFile.push({
  369. imgUrl: e.imgUrl,
  370. id: e.id,
  371. url: e.url,
  372. type: e.type,
  373. });
  374. })
  375. )
  376. console.log('newFile',newFile)
  377. item.fileUrlList = newFile
  378. }
  379. const handleUrls = JSON.parse(item.handleUrl)
  380. const handleUrl = []
  381. if (handleUrls !== null && handleUrls.length > 0) {
  382. handleUrls.forEach(item => {
  383. if (item.url) {
  384. const ul = {
  385. type: 'image',
  386. url: item.url.replace('/server', '/smartParkH5Server')
  387. }
  388. handleUrl.push(ul)
  389. }
  390. })
  391. }
  392. item.handleUrlList = handleUrl
  393. console.log('item',item)
  394. return item
  395. },
  396. closePage() {
  397. uni.navigateBack({})
  398. },
  399. deleteRYXXZP(event) {
  400. this.fileList.splice(event.detail.index, 1);
  401. this.$forceUpdate();
  402. },
  403. uploadRYXXZP(event) {
  404. console.log(event)
  405. let that = this;
  406. const { file } = event.detail;
  407. uni.uploadFile({
  408. url: that.$constant.BASE_URI + "/wx/fileController/upload",
  409. filePath: file.url,
  410. name: "file",
  411. formData: { user: "test" },
  412. success(res) {
  413. // 上传完成需要更新 fileList
  414. let data = JSON.parse(res.data);
  415. that.fileList.push({
  416. imgUrl: "/FileController/download/" + data.data[0],
  417. id: data.data[0],
  418. url:
  419. that.$constant.BASE_URI +
  420. "/FileController/download/" +
  421. data.data[0],
  422. isImage: true,
  423. });
  424. },
  425. fail(res) {},
  426. });
  427. },
  428. }
  429. }
  430. </script>
  431. <style lang="scss">
  432. .addRepair{
  433. .reportBody{
  434. margin-top: 24rpx;
  435. padding: 38rpx 36rpx;
  436. background: white;
  437. //height: 1416rpx;
  438. box-sizing: border-box;
  439. .record {
  440. display: flex;
  441. align-items: center;
  442. justify-content: flex-end;
  443. color: #0365F9;
  444. font-size: 32rpx;
  445. .recordImg{
  446. width: 36rpx;
  447. height: 36rpx;
  448. padding: 5rpx 0 0 10rpx;
  449. }
  450. }
  451. .detailUl{
  452. margin-top: 20rpx;
  453. .liName{
  454. font-size: 32rpx;
  455. color: rgba(51, 51, 51, 1);
  456. white-space: nowrap;
  457. }
  458. .detailLi{
  459. display: flex;
  460. justify-content: space-between;
  461. align-items: center;
  462. padding: 32rpx 0;
  463. border-bottom: 2rpx solid #E6E6E6;
  464. .liInfo{
  465. display: inline-block;
  466. text-align: right;
  467. max-width: 428rpx;
  468. color: rgba(102, 102, 102, 1);
  469. font-size: 32rpx;
  470. line-height: 38rpx;
  471. display: flex;
  472. align-items: center;
  473. .phoneIcon{
  474. width: 64rpx;
  475. height: 64rpx;
  476. margin-left: 24rpx;
  477. }
  478. }
  479. .van-radio-group{
  480. display: flex;
  481. align-items: center;
  482. gap: 0 32rpx;
  483. }
  484. }
  485. .detailLi2{
  486. display: flex;
  487. flex-direction: column;
  488. padding: 32rpx 0;
  489. border-bottom: 2rpx solid #E6E6E6;
  490. .detailLi2BoxTop{
  491. display: flex;
  492. flex-wrap: wrap;
  493. justify-content: space-between;
  494. margin: 12rpx 0;
  495. .checkItem{
  496. width: 160rpx;
  497. height: 64rpx;
  498. font-size: 28rpx;
  499. color: #666666;
  500. display: flex;
  501. align-items: center;
  502. justify-content: center;
  503. background: #F5F7FA;
  504. border-radius: 8rpx;
  505. margin: 12rpx 0;
  506. }
  507. .checked{
  508. background: #0365F9;
  509. color: white;
  510. }
  511. }
  512. }
  513. }
  514. }
  515. .anImg{
  516. width: 200rpx;
  517. height: 200rpx;
  518. }
  519. .van-cell {
  520. background: #F5F7FA !important;
  521. border-radius: 8rpx;
  522. font-size: 28rpx;
  523. }
  524. .buttonBox{
  525. display: flex;
  526. justify-content: center;
  527. .btn{
  528. width: 240rpx;
  529. height: 80rpx;
  530. display: flex;
  531. border-radius: 8rpx;
  532. align-items: center;
  533. justify-content: center;
  534. margin: 48rpx 16rpx 150rpx 16rpx;
  535. color: white;
  536. letter-spacing: 2rpx;
  537. text-indent: 2rpx;
  538. }
  539. .btn2{
  540. width: 654rpx;
  541. height: 96rpx;
  542. display: flex;
  543. border-radius: 8rpx;
  544. align-items: center;
  545. justify-content: center;
  546. margin: 48rpx 48rpx 150rpx 48rpx;
  547. color: white;
  548. letter-spacing: 2rpx;
  549. text-indent: 2rpx;
  550. }
  551. .zcBtn{
  552. background: rgba(0, 0, 0, 0.05);
  553. color: rgba(3, 101, 249, 1);
  554. &::after{
  555. border: none;
  556. }
  557. }
  558. .tjBtn{
  559. background: #0365F9;
  560. }
  561. }
  562. .handleBox{
  563. background: white;
  564. padding: 32rpx;
  565. margin: 24rpx 0;
  566. .imageBox{
  567. display: flex;
  568. justify-content: space-evenly;
  569. align-items: center;
  570. margin-top: 48rpx;
  571. .handleImg{
  572. width: 72rpx;
  573. height: 72rpx;
  574. margin-bottom: 8rpx;
  575. }
  576. .handleArrow{
  577. width: 64rpx;
  578. height: 20rpx;
  579. }
  580. }
  581. .imageItem{
  582. display: flex;
  583. flex-direction: column;
  584. align-items: center;
  585. color: rgba(34, 34, 34, 1);
  586. font-size: 28rpx;
  587. }
  588. }
  589. .handleTitle{
  590. color: rgba(34, 34, 34, 1);
  591. font-size: 36rpx;
  592. font-weight: 600;
  593. }
  594. .evaluationBox {
  595. width: 686rpx;
  596. height: 100rpx;
  597. padding: 0 24rpx;
  598. display: flex;
  599. align-items: center;
  600. justify-content: space-between;
  601. background: #f5f7fa;
  602. border-radius: 8rpx;
  603. box-sizing: border-box;
  604. margin-top: 24rpx;
  605. .evaName{
  606. font-size: 32rpx;
  607. color: rgba(51, 51, 51, 1);
  608. }
  609. }
  610. }
  611. </style>