detail.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616
  1. <template>
  2. <div class="repair-detail-box">
  3. <div
  4. :class="[
  5. 'repair-content',
  6. detailStatus === 'unAcceptance' ? '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 ? "暂无" : 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. {{ item }}
  46. <img :src="item" alt="" />
  47. </li>
  48. </ul>
  49. </div>
  50. </div>
  51. <div class="cell-item flex-item">
  52. <p class="label">报事人</p>
  53. <p class="tit tel-box">
  54. <span>{{ userId2 }}</span>
  55. <!-- {{ detail.phone }} -->
  56. <TelNum :num="detail.phone" :showTel="false" />
  57. </p>
  58. </div>
  59. <div class="cell-item">
  60. <p class="label">报事时间</p>
  61. <p class="tit">{{ detail.createdAt }}</p>
  62. </div>
  63. </div>
  64. <div class="white-box page-3 form-part" style="padding-bottom: 120px">
  65. <div class="custom-item-tit">
  66. <p class="tit">处理情况</p>
  67. </div>
  68. <div class="block-cell-item">
  69. <p class="label">处理进展</p>
  70. <div class="tit">
  71. <van-steps
  72. :active="stepActive"
  73. :active-color="'#6600FF'"
  74. :steps="processSteps"
  75. >
  76. </van-steps>
  77. </div>
  78. </div>
  79. <div class="cell-item">
  80. <p class="label">派单人</p>
  81. <p class="tit">{{ dispatchUserId2 }}</p>
  82. </div>
  83. <div class="cell-item">
  84. <p class="label">派单时间</p>
  85. <p class="tit">{{ detail.dispatchTime }}</p>
  86. </div>
  87. <div class="block-cell-item">
  88. <p class="label">备注</p>
  89. <div class="tit">
  90. <div class="textarea">
  91. {{ !detail.remark ? "" : detail.remark }}
  92. </div>
  93. </div>
  94. </div>
  95. <div class="block-cell-item">
  96. <p class="label">
  97. 处理后拍照<span class="tips">(支持图片上传限20M内,最多6张)</span>
  98. </p>
  99. <div class="tit" v-if="detail.status === 'acceptance'">
  100. <van-uploader
  101. @delete="deleteRYXXZP"
  102. :file-list="handleUrlList"
  103. :max-count="6"
  104. @after-read="afterRead"
  105. :show-upload="true"
  106. >
  107. </van-uploader>
  108. </div>
  109. <div class="tit" v-else>
  110. <ul class="annex-list-box">
  111. <li
  112. class="annex-item"
  113. v-for="(item, index) in handleUrlList"
  114. :key="index"
  115. >
  116. <img :src="item.url" alt="" />
  117. </li>
  118. </ul>
  119. </div>
  120. </div>
  121. <div class="cell-item">
  122. <p class="label">结案人</p>
  123. <p class="tit">{{ handleUserId2 }}</p>
  124. </div>
  125. <div class="cell-item">
  126. <p class="label">结案时间</p>
  127. <p class="tit">{{ detail.handleTime ? detail.handleTime : "" }}</p>
  128. </div>
  129. </div>
  130. <div
  131. class="white-box page-4"
  132. v-if="detailStatus === 'processed' || detailStatus === 'evaluated'"
  133. >
  134. <div class="custom-item-tit">
  135. <p class="tit">服务评价</p>
  136. </div>
  137. <div class="custom-white-box-content">
  138. <div class="evaluate-box">
  139. <p class="evaluate-left">企业对本次服务的评价</p>
  140. <div class="evaluate-right">
  141. <van-rate
  142. :value="detail.score"
  143. color="#ffd21e"
  144. :readonly="true"
  145. />
  146. </div>
  147. </div>
  148. </div>
  149. </div>
  150. </div>
  151. <div
  152. class="repair-bottom bottom-button"
  153. v-if="detail.status === 'acceptance'"
  154. >
  155. <button class="btn" @click="onConfirm">提交</button>
  156. </div>
  157. </div>
  158. </template>
  159. <script>
  160. import TelNum from "../../subPackages/components/tel-number";
  161. import vanRate from "../../../wxcomponents/weapp/dist/rate";
  162. import {
  163. editRepair,
  164. getRepairDispatchById,
  165. getByCodes,
  166. getUserLocalStorageInfo,
  167. } from "@/js_sdk/http";
  168. // import Base from '@/pages/base/base'
  169. // import { editRepair } from '@/service/api_repair'
  170. // import { Toast } from 'vant'
  171. // import auth from '@/service/auth'
  172. // import axios from 'axios'
  173. export default {
  174. components: {
  175. TelNum,
  176. vanRate,
  177. },
  178. data() {
  179. return {
  180. handleUserId2: "",
  181. userId2: "",
  182. dispatchUserId2: "",
  183. dic_key: ["QUICK_SELECTION", "REPAIR_STATUS"],
  184. dic_SelectList: {},
  185. detailId: "", // 详情id
  186. handleUrlList: [],
  187. fileUrls: [],
  188. handleUrls: [],
  189. detailStatus: "1", // 1 待派单 2已派单
  190. explainAnnexList: [], // 说明附件 type image、图片 video、视频
  191. processedAnnexList: [], // 附件 type image、图片 video、视频
  192. stepActive: 0, // 当前处理到哪一步
  193. processSteps: [
  194. {
  195. id: 1,
  196. status: 1,
  197. text: "上报",
  198. },
  199. {
  200. id: 2,
  201. status: 1,
  202. text: "已受理",
  203. },
  204. {
  205. id: 3,
  206. status: 1,
  207. text: "已处理",
  208. },
  209. {
  210. id: 4,
  211. status: 0,
  212. text: "评价",
  213. },
  214. ], // 处理流程
  215. evaluateVal: 0, // 评分
  216. id: "",
  217. detail: {},
  218. fileUrlList: [],
  219. params: {
  220. id: "",
  221. handleUrl: "",
  222. handleTime: "",
  223. status: "processed",
  224. },
  225. };
  226. },
  227. onLoad(option) {
  228. this.id = option.id;
  229. this.getByCodes();
  230. },
  231. methods: {
  232. async getByCodes() {
  233. let data = await getByCodes(JSON.stringify(this.dic_key));
  234. this.dic_SelectList = this.$common.handleDicList(data);
  235. this.getDetailById();
  236. },
  237. onSelect(val) {
  238. this.value = val.text;
  239. this.params.handleUserId = val.value + "-" + val.text;
  240. this.showPicker = false;
  241. },
  242. onConfirm(value) {
  243. this.params.id = this.id;
  244. // handleUrlList
  245. this.params.handleTime = this.detail.handleTime;
  246. // this.params.handleUrlList = this.params.handleUrlList.join(",");
  247. let handleUrlList = [];
  248. if (this.handleUrlList && this.handleUrlList.length > 0) {
  249. handleUrlList = this.handleUrlList.map((e) => {
  250. return e.id;
  251. });
  252. }
  253. this.params.updatedBy = getUserLocalStorageInfo().user.id;
  254. this.params.handleUrl = handleUrlList.join(",");
  255. editRepair(this.params).then((res) => {
  256. this.$showToast("结案成功");
  257. uni.navigateBack({});
  258. // this.$router.push({ path: "/repairprocessing-app" });
  259. });
  260. },
  261. getDetailById() {
  262. const _this = this;
  263. getRepairDispatchById(_this.id).then((res) => {
  264. console.log(res.data);
  265. if (res.data) {
  266. let det = _this.getItemJson(res.data);
  267. this.detail = det;
  268. if (det.userId != null && det.userId !== "") {
  269. const test = det.userId.split("-");
  270. this.detail.phone = test[2];
  271. this.userId2 = test[1] + "-" + test[2];
  272. }
  273. if (det.dispatchUserId != null && det.dispatchUserId !== "") {
  274. const test = det.dispatchUserId.split("-");
  275. console.log(test);
  276. this.dispatchUserId2 = test[1] + "-" + test[2];
  277. }
  278. if (det.handleUserId != null && det.handleUserId !== "") {
  279. const test = det.handleUserId.split("-");
  280. console.log(test);
  281. this.handleUserId2 = test[1] + "-" + test[2];
  282. }
  283. this.handleUrlList = det.handleUrlList;
  284. console.log("asodmqowndonq", this.handleUrlList);
  285. this.explainAnnexList = det.fileUrlViewList;
  286. // this.processedAnnexList = det.handleUrlList;
  287. this.detailStatus = det.status;
  288. this.params.remark = det.remark;
  289. }
  290. });
  291. },
  292. getItemJson: function (item) {
  293. const fileUrls = item.fileUrl ? item.fileUrl.split(",") : [];
  294. const fileUrlViews = [];
  295. if (fileUrls !== null && fileUrls.length > 0) {
  296. fileUrls.forEach((item) => {
  297. item =
  298. this.$constant.BASE_URI + "/wx/fileController/download/" + item;
  299. fileUrlViews.push(item);
  300. });
  301. }
  302. item.fileUrlViewList = fileUrlViews;
  303. if (!item.handleTime) {
  304. item.handleTime = this.$common.transServDate(new Date());
  305. }
  306. const handleUrls = item.handleUrl ? item.handleUrl.split(",") : [];
  307. const handleUrlViews = [];
  308. if (handleUrls !== null && handleUrls.length > 0) {
  309. handleUrls.forEach((item) => {
  310. handleUrlViews.push({
  311. url:
  312. this.$constant.BASE_URI + "/wx/fileController/download/" + item,
  313. isImage: true,
  314. });
  315. });
  316. }
  317. item.handleUrlList = handleUrlViews;
  318. console.log(item);
  319. item.serviceType =
  320. this.dic_SelectList.QUICK_SELECTION[item.serviceType - 1].label;
  321. switch (item.status) {
  322. case "unAcceptance":
  323. this.stepActive = 0;
  324. break;
  325. case "acceptance":
  326. this.stepActive = 1;
  327. break;
  328. case "evaluated":
  329. this.stepActive = 3;
  330. break;
  331. case "processed":
  332. this.stepActive = 2;
  333. break;
  334. }
  335. return item;
  336. },
  337. afterRead(event) {
  338. let that = this;
  339. const { file } = event.detail;
  340. try {
  341. uni.uploadFile({
  342. url: that.$constant.BASE_URI + "/wx/fileController/upload",
  343. filePath: file.url,
  344. name: "file",
  345. formData: { user: "test" },
  346. success(res) {
  347. // 上传完成需要更新 fileList
  348. let { data } = JSON.parse(res.data);
  349. console.log(data[0]);
  350. that.handleUrlList.push({
  351. id: data[0],
  352. url:
  353. that.$constant.BASE_URI + "/FileController/download/" + data[0],
  354. isImage: true,
  355. });
  356. that.handleUrlList = [...that.handleUrlList];
  357. that.$forceUpdate();
  358. console.log(that.fileUrlList);
  359. },
  360. fail(res) {},
  361. });
  362. } catch (error) {}
  363. },
  364. beforeDelete(file, detail) {
  365. // this.handleImagUrlList = []
  366. const vm = this;
  367. // name.index代表图片的索引
  368. vm.handleUrls.splice(detail.index, 1);
  369. return (file, name) => {
  370. const fileIndex = name.index;
  371. vm.handleUrls[detail.index].splice(fileIndex, 1);
  372. };
  373. },
  374. /**
  375. * 上传图片
  376. */
  377. uploadImg(file) {
  378. const _this = this;
  379. const formParam = new FormData(); // 创建form对象
  380. formParam.append("file", file.file); // 通过append向form对象添加数据
  381. console.log(formParam.get("file")); // FormData私有类对象,访问不到,可以通过get判断值是否传进去
  382. // upload(formParam).then((res) => {
  383. //
  384. // })
  385. const config = {
  386. headers: {
  387. "Content-Type": "multipart/form-data",
  388. "MVVM-Key": String(new Date().getTime()),
  389. xx: "anything",
  390. }, // 这里是重点,需要和后台沟通好请求头,Content-Type不一定是这个值
  391. }; // 添加请求头
  392. return new Promise((resolve, reject) => {
  393. axios
  394. .post(
  395. "/smartParkH5Server/wx/fileController/upload",
  396. formParam,
  397. config
  398. )
  399. .then((response) => {
  400. let files = response.data.data.substring(
  401. 1,
  402. response.data.data.length
  403. );
  404. files = files.substring(0, files.length - 1);
  405. _this.handleUrls.push(_this.$common.castEval(files));
  406. })
  407. .catch((err, x) => {
  408. reject(err, x);
  409. });
  410. });
  411. },
  412. },
  413. };
  414. </script>
  415. <style lang="scss" >
  416. .bottom-button {
  417. position: fixed;
  418. bottom: 0;
  419. left: 0;
  420. width: 100%;
  421. z-index: 100;
  422. height: 160rpx;
  423. padding: 35rpx 30rpx;
  424. background-color: #fff;
  425. display: flex;
  426. align-items: center;
  427. justify-content: center;
  428. box-sizing: border-box;
  429. .btn {
  430. height: 100%;
  431. line-height: 80rpx;
  432. width: 100%;
  433. color: #fff;
  434. background-color: #6600ff;
  435. font-size: 34rpx;
  436. border-radius: 10rpx;
  437. }
  438. }
  439. .repair-detail-box {
  440. .page-4 {
  441. .evaluate-box {
  442. padding: 20rpx 30rpx;
  443. background: $page-color-base;
  444. border: 1rpx solid #ebedf0;
  445. border-radius: 100rpx;
  446. display: flex;
  447. align-items: center;
  448. justify-content: space-between;
  449. box-sizing: border-box;
  450. }
  451. }
  452. width: 100%;
  453. height: 100%;
  454. .page-1 {
  455. .textarea {
  456. padding: 20rpx;
  457. border-radius: 10rpx;
  458. background: $page-color-base;
  459. box-sizing: border-box;
  460. }
  461. }
  462. .page-3 {
  463. padding-bottom: 100rpx;
  464. .input-item {
  465. padding: 0;
  466. }
  467. .custom-item-tit {
  468. height: 13.333vw;
  469. font-size: 4.267vw;
  470. color: #333;
  471. padding: 2.667vw 0;
  472. position: relative;
  473. display: -webkit-box;
  474. display: -ms-flexbox;
  475. display: flex;
  476. -webkit-box-pack: justify;
  477. -ms-flex-pack: justify;
  478. justify-content: space-between;
  479. -webkit-box-align: center;
  480. -ms-flex-align: center;
  481. align-items: center;
  482. -webkit-box-sizing: border-box;
  483. box-sizing: border-box;
  484. .tit {
  485. &::after {
  486. content: "";
  487. width: 0.8vw;
  488. height: 90%;
  489. background-color: #976dec;
  490. border-radius: 0.4vw;
  491. position: absolute;
  492. left: 0;
  493. top: 50%;
  494. -webkit-transform: translateY(-50%);
  495. transform: translateY(-50%);
  496. }
  497. }
  498. }
  499. .tit {
  500. padding-left: 2.667vw;
  501. position: relative;
  502. }
  503. }
  504. .page-4 {
  505. .custom-item-tit {
  506. height: 13.333vw;
  507. font-size: 4.267vw;
  508. color: #333;
  509. padding: 2.667vw 0;
  510. position: relative;
  511. display: -webkit-box;
  512. display: -ms-flexbox;
  513. display: flex;
  514. -webkit-box-pack: justify;
  515. -ms-flex-pack: justify;
  516. justify-content: space-between;
  517. -webkit-box-align: center;
  518. -ms-flex-align: center;
  519. align-items: center;
  520. -webkit-box-sizing: border-box;
  521. box-sizing: border-box;
  522. .tit {
  523. &::after {
  524. content: "";
  525. width: 0.8vw;
  526. height: 90%;
  527. background-color: #976dec;
  528. border-radius: 0.4vw;
  529. position: absolute;
  530. left: 0;
  531. top: 50%;
  532. -webkit-transform: translateY(-50%);
  533. transform: translateY(-50%);
  534. }
  535. }
  536. }
  537. .tit {
  538. padding-left: 2.667vw;
  539. position: relative;
  540. }
  541. s .evaluate-box {
  542. padding: 20px 30px;
  543. background: $page-color-base;
  544. border: 1px solid #ebedf0;
  545. border-radius: 100px;
  546. display: flex;
  547. align-items: center;
  548. justify-content: space-between;
  549. box-sizing: border-box;
  550. }
  551. }
  552. .annex-list-box {
  553. display: flex;
  554. // flex-wrap: wrap;
  555. // justify-content: space-between;
  556. &::after {
  557. display: block;
  558. content: "";
  559. width: 30%;
  560. height: 0px;
  561. }
  562. .annex-item {
  563. width: 240rpx;
  564. height: 240rpx;
  565. border: 1px solid $text4;
  566. margin-bottom: 20px;
  567. position: relative;
  568. overflow: hidden;
  569. > img {
  570. width: 240rpx;
  571. height: 240rpx;
  572. position: absolute;
  573. top: 0;
  574. left: 0;
  575. right: 0;
  576. bottom: 0;
  577. margin: auto;
  578. display: block;
  579. }
  580. video {
  581. width: 100%;
  582. height: 100%;
  583. }
  584. }
  585. }
  586. .tel-box {
  587. display: flex;
  588. align-items: center;
  589. /deep/ .custom-tel-component {
  590. margin-left: 20px;
  591. }
  592. }
  593. }
  594. </style>
  595. <style lang="scss">
  596. .image-repairDispatch-box {
  597. .van-image-preview__close-icon {
  598. color: #fff;
  599. font-size: 64px;
  600. }
  601. }
  602. </style>s