repairDetail.vue 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658
  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-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-sf.com/gardenProduct/image/upImage.svg" class="handleImg">
  102. <span>上报</span>
  103. </div>
  104. <img src="https://www.idea-sf.com/gardenProduct/image/arrow.png" class="handleArrow">
  105. <div class="imageItem">
  106. <img :src="stepActive==='已受理'||stepActive==='已处理'?'https://www.idea-sf.com/gardenProduct/image/acceptance.svg':'https://www.idea-sf.com/gardenProduct/image/unAcceptance.svg'" class="handleImg">
  107. <span>受理</span>
  108. </div>
  109. <img src="https://www.idea-sf.com/gardenProduct/image/arrow.png" class="handleArrow">
  110. <div class="imageItem">
  111. <img :src="stepActive==='已处理'?'https://www.idea-sf.com/gardenProduct/image/handle.svg':'https://www.idea-sf.com/gardenProduct/image/unHandle.svg'" class="handleImg">
  112. <span>处理</span>
  113. </div>
  114. <img src="https://www.idea-sf.com/gardenProduct/image/arrow.png" class="handleArrow">
  115. <div class="imageItem">
  116. <img :src="detail.evaluateStatus===2?'https://www.idea-sf.com/gardenProduct/image/unEvaluate.svg':'https://www.idea-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. {{detail.handleUserName}}
  130. </span>
  131. </li>
  132. <li class="detailLi2">
  133. <span class="liName" style="margin-bottom: 16rpx">
  134. 备注
  135. </span>
  136. <van-field
  137. :value="detail.remark"
  138. autosize
  139. type="textarea"
  140. placeholder=" "
  141. class="myField2"
  142. readonly
  143. />
  144. </li>
  145. <li class="detailLi">
  146. <span class="liName">
  147. 派单人
  148. </span>
  149. <span class="liInfo">
  150. {{detail.dispatchUserName}}
  151. </span>
  152. </li>
  153. <li class="detailLi" style="border-bottom: none">
  154. <span class="liName">
  155. 派单时间
  156. </span>
  157. <span class="liInfo">
  158. {{detail.dispatchTime}}
  159. </span>
  160. </li>
  161. </ul>
  162. </div>
  163. <div class="reportBody" v-if="stepActive==='已处理'">
  164. <div class="handleTitle">处理信息</div>
  165. <ul class="detailUl">
  166. <li class="detailLi2">
  167. <span class="liName">
  168. 处理后拍照
  169. <span style="color: #B3B3B3;font-size: 28rpx">(支持图片上传限20M内,最多6张)</span>
  170. </span>
  171. <div style="display: flex;flex-wrap: wrap;gap: 24rpx">
  172. <div class="detailLi2Box annex-item"
  173. style="margin: 24rpx 0 0 0;"
  174. v-for="(item, index) in handleUrlList"
  175. :key="index">
  176. <img :src="item.url" alt="" class="anImg" @tap="clickImg(item.url)"/>
  177. </div>
  178. </div>
  179. </li>
  180. <li class="detailLi">
  181. <span class="liName">
  182. 处理人
  183. </span>
  184. <span class="liInfo">
  185. {{detail.handleUserName}}
  186. </span>
  187. </li>
  188. <li class="detailLi" style="border-bottom: none">
  189. <span class="liName">
  190. 处理时间
  191. </span>
  192. <span class="liInfo">
  193. {{detail.handleTime}}
  194. </span>
  195. </li>
  196. </ul>
  197. </div>
  198. <div class="reportBody" v-if="stepActive==='已处理'">
  199. <div class="evaluationBox" >
  200. <span class="evaName">您对本次服务的评价</span>
  201. <van-rate
  202. :value="detail.evaluateNum"
  203. :size="24"
  204. gutter="32rpx"
  205. void-color="#eee"
  206. @change="changeStar"
  207. color="#fd9a63"
  208. :disabled="detail.evaluateStatus===2"
  209. disabled-color="#fd9a63"
  210. />
  211. </div>
  212. </div>
  213. <div class="buttonBox">
  214. <button class="zcBtn" @tap="closePage" :class="stepActive==='已处理'&&detail.evaluateStatus===1?'btn2':'btn '">关闭</button>
  215. <button class="btn tjBtn" v-if="stepActive==='已处理'&&detail.evaluateStatus===1" @tap="submit">提交</button>
  216. </div>
  217. </div>
  218. </template>
  219. <script>
  220. import {getRepairDispatchById,getUserLocalStorageInfo,getByCodes,editRepair } 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. stepActive:'0',
  247. pingParams: {
  248. id: '',
  249. evaluateNum: '5',
  250. score: '',
  251. evaluateStatus:2
  252. },
  253. handleUrlList:[]
  254. }
  255. },
  256. onLoad(options) {
  257. const item = JSON.parse(options.item)
  258. this.id = item.id
  259. this.optionsType = item.type
  260. if (options.type==='待处理'){
  261. uni.setNavigationBarTitle({
  262. title: '报修处理',
  263. });
  264. }else if(options.type==='已处理'){
  265. uni.setNavigationBarTitle({
  266. title: '报修详情',
  267. });
  268. }else {
  269. uni.setNavigationBarTitle({
  270. title: '报修派单',
  271. });
  272. }
  273. this.getByCodes()
  274. },
  275. mounted(){
  276. this.getTime()
  277. },
  278. methods:{
  279. changeStar(e){
  280. console.log(e)
  281. this.pingParams.evaluateNum = e.detail
  282. },
  283. submit(){
  284. this.pingParams.id = this.id
  285. this.pingParams.evaluateStatus = '2'
  286. console.log(this.pingParams)
  287. editRepair(this.pingParams).then((res) => {
  288. if (res.code == 200) {
  289. uni.showToast({
  290. title: '提交成功',
  291. icon: 'none',
  292. mask: true,
  293. duration: 1000
  294. });
  295. uni.navigateBack()
  296. }
  297. })
  298. },
  299. // toRecord() {
  300. // uni.navigateTo({
  301. // url:'/pages/subPackages/reportRepair/repairRecord'
  302. // })
  303. // },
  304. // 放大图片
  305. clickImg(url) {
  306. wx.previewImage({
  307. urls: [url], //接受的是一个数组,默认展示第一张
  308. current: "",
  309. success: function (res) {
  310. },
  311. fail: function (res) {
  312. },
  313. complete: function (res) {
  314. },
  315. })
  316. },
  317. async getByCodes() {
  318. let data = await getByCodes(JSON.stringify(this.dc_key));
  319. this.dic_SelectList = this.$common.handleDicList(data);
  320. this.checkList = this.dic_SelectList.QUICK_SELECTION
  321. this.getById()
  322. },
  323. getById(){
  324. const _this = this
  325. getRepairDispatchById(this.id).then(res=>{
  326. if (res.data) {
  327. const det = _this.getItemJson(res.data)
  328. this.detail = det
  329. console.log('this.detail',this.detail)
  330. this.explainAnnexList = det.fileUrlList
  331. this.handleUrlList = det.handleUrlList
  332. this.detailStatus = det.status
  333. this.params = {
  334. id: det.id,
  335. evaluateNum: det.evaluateNum,
  336. score: det.score
  337. }
  338. this.evaluateVal = ((det.score == null ? 0 : det.score) / (det.evaluateNum == null ? 1 : det.evaluateNum))
  339. }
  340. })
  341. },
  342. getTime(){
  343. let timestamp = new Date().getTime();
  344. let dateStr = new Date().toLocaleDateString();
  345. let date = new Date();
  346. let year = date.getFullYear();
  347. let month = date.getMonth() + 1;
  348. let day = date.getDate();
  349. let hours = date.getHours();
  350. let minutes = date.getMinutes();
  351. let fullDateStr = `${year}-${month}-${day} ${hours}:${minutes}`;
  352. console.log(fullDateStr);
  353. this.timeNow = fullDateStr
  354. },
  355. getItemJson: function(item) {
  356. item.releaseTime = this.$common.transDate(item.releaseTime)
  357. item.createdAt = this.$common.transDate(item.createdAt)
  358. let transformedObject = this.dic_SelectList.QUICK_SELECTION.reduce((acc, obj) => {
  359. acc[obj.value] = obj.label;
  360. return acc;
  361. }, {});
  362. item.serviceType = transformedObject[item.serviceType]
  363. if (item.userId) {
  364. const user = item.userId.split('-')
  365. item.userPhone = user[1] + '-' + user[2]
  366. item.phone = user[2]
  367. }
  368. if (item.handleUserId) {
  369. const test = item.handleUserId.split('-')
  370. item.handleUserId = test[1] + '-' + test[2]
  371. item.hanleUserPhone = test[2]
  372. }
  373. item.handleTime = this.$common.transDate(item.handleTime)
  374. switch (item.status) {
  375. case 'unAcceptance':
  376. this.stepActive = '待受理'
  377. break
  378. case 'acceptance':
  379. this.stepActive = '已受理'
  380. break
  381. case 'processed':
  382. this.stepActive = '已处理'
  383. break
  384. case 'unSubmit':
  385. this.stepActive = '暂存'
  386. break
  387. }
  388. if (item.fileUrl){
  389. console.log('item.fileUrl' ,JSON.parse(item.fileUrl))
  390. const fileUrl = JSON.parse(item.fileUrl)
  391. const newFile = []
  392. fileUrl.forEach((e=>{
  393. newFile.push({
  394. imgUrl: e.imgUrl,
  395. id: e.id,
  396. url: e.url,
  397. type: e.type,
  398. });
  399. })
  400. )
  401. console.log('newFile',newFile)
  402. item.fileUrlList = newFile
  403. }
  404. if (item.handleUrl ){
  405. // console.log('item.fileUrl' ,JSON.parse(item.fileUrl))
  406. const fileUrl = JSON.parse(item.handleUrl)
  407. const newFile = []
  408. fileUrl.forEach((e=>{
  409. newFile.push({
  410. imgUrl: e.imgUrl,
  411. id: e.id,
  412. url: e.url,
  413. type: e.type,
  414. });
  415. })
  416. )
  417. // console.log('newFile',newFile)
  418. item.handleUrlList = newFile
  419. }
  420. const handleUrls = JSON.parse(item.handleUrl)
  421. const handleUrl = []
  422. if (handleUrls !== null && handleUrls.length > 0) {
  423. handleUrls.forEach(item => {
  424. if (item.url) {
  425. const ul = {
  426. type: 'image',
  427. url: item.url.replace('/server', '/smartParkH5Server')
  428. }
  429. handleUrl.push(ul)
  430. }
  431. })
  432. }
  433. item.handleUrlList = handleUrl
  434. console.log('item',item)
  435. return item
  436. },
  437. closePage() {
  438. uni.navigateBack({})
  439. },
  440. deleteRYXXZP(event) {
  441. this.fileList.splice(event.detail.index, 1);
  442. this.$forceUpdate();
  443. },
  444. uploadRYXXZP(event) {
  445. console.log(event)
  446. let that = this;
  447. const { file } = event.detail;
  448. uni.uploadFile({
  449. url: that.$constant.BASE_URI + "/wx/fileController/upload",
  450. filePath: file.url,
  451. name: "file",
  452. formData: { user: "test" },
  453. success(res) {
  454. // 上传完成需要更新 fileList
  455. let data = JSON.parse(res.data);
  456. that.fileList.push({
  457. imgUrl: "/FileController/download/" + data.data[0],
  458. id: data.data[0],
  459. url:
  460. that.$constant.BASE_URI +
  461. "/FileController/download/" +
  462. data.data[0],
  463. isImage: true,
  464. });
  465. },
  466. fail(res) {},
  467. });
  468. },
  469. }
  470. }
  471. </script>
  472. <style lang="scss">
  473. .addRepair{
  474. .reportBody{
  475. margin-top: 24rpx;
  476. padding: 38rpx 36rpx;
  477. background: white;
  478. //height: 1416rpx;
  479. box-sizing: border-box;
  480. .record {
  481. display: flex;
  482. align-items: center;
  483. justify-content: flex-end;
  484. color: #0365F9;
  485. font-size: 32rpx;
  486. .recordImg{
  487. width: 36rpx;
  488. height: 36rpx;
  489. padding: 5rpx 0 0 10rpx;
  490. }
  491. }
  492. .detailUl{
  493. margin-top: 20rpx;
  494. .liName{
  495. font-size: 32rpx;
  496. color: rgba(51, 51, 51, 1);
  497. white-space: nowrap;
  498. }
  499. .detailLi{
  500. display: flex;
  501. justify-content: space-between;
  502. align-items: center;
  503. padding: 32rpx 0;
  504. border-bottom: 2rpx solid #E6E6E6;
  505. .liInfo{
  506. display: inline-block;
  507. text-align: right;
  508. max-width: 428rpx;
  509. color: rgba(102, 102, 102, 1);
  510. font-size: 32rpx;
  511. line-height: 38rpx;
  512. display: flex;
  513. align-items: center;
  514. .phoneIcon{
  515. width: 64rpx;
  516. height: 64rpx;
  517. margin-left: 24rpx;
  518. }
  519. }
  520. .van-radio-group{
  521. display: flex;
  522. align-items: center;
  523. gap: 0 32rpx;
  524. }
  525. }
  526. .detailLi2{
  527. display: flex;
  528. flex-direction: column;
  529. padding: 32rpx 0;
  530. border-bottom: 2rpx solid #E6E6E6;
  531. .detailLi2BoxTop{
  532. display: flex;
  533. flex-wrap: wrap;
  534. justify-content: space-between;
  535. margin: 12rpx 0;
  536. .checkItem{
  537. width: 160rpx;
  538. height: 64rpx;
  539. font-size: 28rpx;
  540. color: #666666;
  541. display: flex;
  542. align-items: center;
  543. justify-content: center;
  544. background: #F5F7FA;
  545. border-radius: 8rpx;
  546. margin: 12rpx 0;
  547. }
  548. .checked{
  549. background: #0365F9;
  550. color: white;
  551. }
  552. }
  553. }
  554. }
  555. }
  556. .anImg{
  557. width: 200rpx;
  558. height: 200rpx;
  559. }
  560. .van-cell {
  561. background: #F5F7FA !important;
  562. border-radius: 8rpx;
  563. font-size: 28rpx;
  564. }
  565. .buttonBox{
  566. display: flex;
  567. justify-content: center;
  568. .btn{
  569. width: 240rpx;
  570. height: 80rpx;
  571. display: flex;
  572. border-radius: 8rpx;
  573. align-items: center;
  574. justify-content: center;
  575. margin: 48rpx 16rpx 150rpx 16rpx;
  576. color: white;
  577. letter-spacing: 2rpx;
  578. text-indent: 2rpx;
  579. }
  580. .btn2{
  581. width: 240rpx;
  582. height: 80rpx;
  583. display: flex;
  584. border-radius: 8rpx;
  585. align-items: center;
  586. justify-content: center;
  587. margin: 48rpx 48rpx 150rpx 48rpx;
  588. color: white;
  589. letter-spacing: 2rpx;
  590. text-indent: 2rpx;
  591. }
  592. .zcBtn{
  593. background: rgba(0, 0, 0, 0.05);
  594. color: rgba(3, 101, 249, 1);
  595. &::after{
  596. border: none;
  597. }
  598. }
  599. .tjBtn{
  600. background: #0365F9;
  601. width: 654rpx;
  602. }
  603. }
  604. .handleBox{
  605. background: white;
  606. padding: 32rpx;
  607. margin: 24rpx 0;
  608. .imageBox{
  609. display: flex;
  610. justify-content: space-evenly;
  611. align-items: center;
  612. margin-top: 48rpx;
  613. .handleImg{
  614. width: 72rpx;
  615. height: 72rpx;
  616. margin-bottom: 8rpx;
  617. }
  618. .handleArrow{
  619. width: 64rpx;
  620. height: 20rpx;
  621. }
  622. }
  623. .imageItem{
  624. display: flex;
  625. flex-direction: column;
  626. align-items: center;
  627. color: rgba(34, 34, 34, 1);
  628. font-size: 28rpx;
  629. }
  630. }
  631. .handleTitle{
  632. color: rgba(34, 34, 34, 1);
  633. font-size: 36rpx;
  634. font-weight: 600;
  635. }
  636. .evaluationBox {
  637. width: 686rpx;
  638. height: 100rpx;
  639. padding: 0 24rpx;
  640. display: flex;
  641. align-items: center;
  642. justify-content: space-between;
  643. background: #f5f7fa;
  644. border-radius: 8rpx;
  645. box-sizing: border-box;
  646. margin-top: 24rpx;
  647. .evaName{
  648. font-size: 28rpx;
  649. color: rgba(51, 51, 51, 1);
  650. }
  651. }
  652. }
  653. </style>