repairDetail.vue 20 KB

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