detail.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617
  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 == null ? "" : 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. @click="lookLookpng(explainAnnexList, index)"
  42. class="annex-item"
  43. v-for="(item, index) in explainAnnexList"
  44. :key="index"
  45. >
  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. <TelNum :num="detail.phone" v-if="detail.phone" :showTel="false" />
  56. </p>
  57. </div>
  58. <div class="cell-item">
  59. <p class="label">报事时间</p>
  60. <p class="tit">{{ detail.createdAt }}</p>
  61. </div>
  62. </div>
  63. <div
  64. class="white-box page-3 form-part"
  65. style="margin-bottom: 100rpx; padding-bottom: 100rpx"
  66. >
  67. <div class="custom-item-tit">
  68. <p class="tit">处理情况</p>
  69. </div>
  70. <div class="block-cell-item">
  71. <p class="label">处理进展</p>
  72. <div class="tit">
  73. <van-steps
  74. :active="stepActive"
  75. :active-color="'#6600FF'"
  76. :steps="processSteps"
  77. >
  78. </van-steps>
  79. </div>
  80. </div>
  81. <div style="width: 100%; height: 88rpx" @click="openPicker()">
  82. <van-field
  83. readonly
  84. :disabled="false"
  85. clickable
  86. class="input-item picker-item"
  87. :value="value"
  88. input-align="right"
  89. label="处理人"
  90. placeholder="请选择"
  91. >
  92. <template #button>
  93. <i class="iconfont icon-zuo"></i>
  94. </template>
  95. </van-field>
  96. </div>
  97. <van-popup
  98. :show="showPicker"
  99. position="bottom"
  100. round
  101. :closeable="false"
  102. :close-on-click-overlay="false"
  103. >
  104. <van-picker
  105. class="picker-box"
  106. show-toolbar
  107. :columns="columns"
  108. @confirm="(value) => onSelect(value)"
  109. @cancel="showPicker = false"
  110. />
  111. <div style="height: 100rpx; width: 100%"></div>
  112. </van-popup>
  113. <div class="custom-item-tit">
  114. <p class="tit">备注</p>
  115. </div>
  116. <div class="custom-textarea-box">
  117. <uni-easyinput
  118. type="textarea"
  119. class="bgcF9F9F9 height218rpx"
  120. v-model="params.remark"
  121. autoHeight
  122. placeholder="请填写"
  123. show-word-limit
  124. :disabled="detail.status !== 'unAcceptance'"
  125. >
  126. </uni-easyinput>
  127. </div>
  128. </div>
  129. <!-- -->
  130. <div
  131. class="white-box page-4"
  132. v-if="detailStatus === 'processed' && detail.isUser === 'true'"
  133. style="padding-bottom: 120rpx"
  134. >
  135. <div class="custom-item-tit">
  136. <p class="tit">服务评价</p>
  137. </div>
  138. <div class="custom-white-box-content">
  139. <div class="evaluate-box">
  140. <p class="evaluate-left">企业对本次服务的评价</p>
  141. <div class="evaluate-right">
  142. <van-rate
  143. :vlaue="evaluateVal"
  144. color="#ffd21e"
  145. @change="getRate"
  146. />
  147. </div>
  148. </div>
  149. </div>
  150. </div>
  151. </div>
  152. <!-- v-if="detailStatus === 'processed' && detail.isUser === 'true'" -->
  153. <div
  154. class="repair-bottom bottom-button"
  155. v-if="detailStatus === 'processed' && detail.isUser === 'true'"
  156. >
  157. <button class="btn" @click="onPinConfirm">评价提交</button>
  158. </div>
  159. <div
  160. class="repair-bottom bottom-button"
  161. v-if="detail.status === 'unAcceptance'"
  162. >
  163. <button class="btn" @click="onConfirm()">派单</button>
  164. </div>
  165. </div>
  166. </template>
  167. <script>
  168. import vanPopup from "../../../wxcomponents/weapp/dist/popup/index";
  169. import vanRate from "../../../wxcomponents/weapp/dist/rate/index";
  170. import TelNum from "../../subPackages/components/tel-number";
  171. // import { getRepairDispatchById, getDispatchToPerson } from "../../service/api_repair";
  172. import {
  173. getByCodes,
  174. getRepairDispatchById,
  175. getUserLocalStorageInfo,
  176. getDispatchToPerson,
  177. editRepair,
  178. } from "@/js_sdk/http";
  179. // import Base from "@/pages/base/base";
  180. // import { editRepair } from "@/service/api_repair";
  181. // import { getCompanyById } from "@/service/api_road_show";
  182. // import { Toast, ImagePreview } from "vant";
  183. export default {
  184. components: {
  185. TelNum,
  186. vanPopup,
  187. vanRate,
  188. },
  189. data() {
  190. return {
  191. dic_key: ["QUICK_SELECTION", "REPAIR_STATUS"],
  192. dic_SelectList: {},
  193. detailId: "", // 详情id
  194. value: "",
  195. showPicker: false,
  196. columns: [],
  197. detailStatus: "unAcceptance", // 1 待派单 2已派单
  198. explainAnnexList: [
  199. {
  200. type: "image",
  201. url: "",
  202. },
  203. ], // 说明附件 type image、图片 video、视频
  204. processedAnnexList: [
  205. {
  206. type: "image",
  207. url: "",
  208. },
  209. ], // 附件 type image、图片 video、视频
  210. stepActive: 0, // 当前处理到哪一步
  211. processSteps: [
  212. {
  213. id: 1,
  214. status: 1,
  215. text: "上报",
  216. },
  217. {
  218. id: 2,
  219. status: 1,
  220. text: "已受理",
  221. },
  222. {
  223. id: 3,
  224. status: 1,
  225. text: "已处理",
  226. },
  227. {
  228. id: 4,
  229. status: 0,
  230. text: "评价",
  231. },
  232. ], // 处理流程
  233. evaluateVal: 0, // 评分
  234. id: "",
  235. detail: {},
  236. fileUrlList: [],
  237. pingParams: {
  238. id: "",
  239. evaluateNum: "",
  240. score: "",
  241. },
  242. userId2: "",
  243. params: {
  244. id: "",
  245. status: "acceptance",
  246. dispatchUserId:
  247. getUserLocalStorageInfo().user.id +
  248. "-" +
  249. getUserLocalStorageInfo().user.truename +
  250. "-" +
  251. getUserLocalStorageInfo().user.phone, // getUserLocalStorageInfo().user.current
  252. dispatchTime: this.$common.transServDate(new Date()),
  253. handleUserId: "",
  254. remark: "",
  255. },
  256. };
  257. },
  258. onLoad(option) {
  259. console.log(option);
  260. this.id = option.id;
  261. this.getByCodes();
  262. getDispatchToPerson({ groupId: "" }).then((res) => {
  263. this.columns = res.data;
  264. });
  265. },
  266. methods: {
  267. lookLookpng(imgList, i) {
  268. console.log(imgList);
  269. uni.previewImage({
  270. urls: imgList,
  271. longPressActions: {
  272. itemList: ["发送给朋友", "保存图片", "收藏"],
  273. success: function (data) {
  274. console.log(data);
  275. },
  276. fail: function (err) {
  277. console.log(err);
  278. },
  279. },
  280. });
  281. },
  282. openPicker() {
  283. this.showPicker = true;
  284. },
  285. closePicker() {
  286. this.showPicker = false;
  287. },
  288. async getByCodes() {
  289. let data = await getByCodes(JSON.stringify(this.dic_key));
  290. this.dic_SelectList = this.$common.handleDicList(data);
  291. this.getDetailById();
  292. },
  293. onSelect(event) {
  294. let val = event.detail.value;
  295. this.value = val.text;
  296. this.params.handleUserId = val.value + "-" + val.text;
  297. this.showPicker = false;
  298. },
  299. onPinConfirm(value) {
  300. this.pingParams.evaluateNum = this.pingParams.evaluateNum + 1;
  301. this.pingParams.score = this.pingParams.score + this.evaluateVal;
  302. this.pingParams.status = "evaluated";
  303. editRepair(this.pingParams).then((res) => {
  304. this.$showToast("评价成功");
  305. uni.navigateBack({});
  306. });
  307. },
  308. onConfirm() {
  309. let that = this;
  310. if (that.params.handleUserId == null || that.params.handleUserId === "") {
  311. this.$showToast("请选择处理人");
  312. return;
  313. }
  314. this.params.id = that.id;
  315. that.params.updatedBy = getUserLocalStorageInfo().user.id;
  316. editRepair(that.params).then((res) => {
  317. this.$showToast("派单成功");
  318. uni.navigateBack({});
  319. });
  320. },
  321. open(item, index) {
  322. //
  323. let that = this;
  324. let fileUrlViewList = that.detail.fileUrlViewList.map((e) => {
  325. return e.url;
  326. });
  327. uni.previewImage({
  328. urls: fileUrlViewList,
  329. });
  330. },
  331. getDetailById() {
  332. const _this = this;
  333. getRepairDispatchById(_this.id).then((res) => {
  334. if (res.data) {
  335. const det = _this.getItemJson(res.data);
  336. this.detail = det;
  337. this.explainAnnexList = det.fileUrlViewList;
  338. this.processedAnnexList = det.handleUrlList;
  339. this.detailStatus = det.status;
  340. this.params.handleUserId = det.handleUserId;
  341. this.value = det.dispatchUserId;
  342. if (det.handleUserId != null && det.handleUserId !== "") {
  343. const test = det.handleUserId.split("-");
  344. this.value = test[1] + "-" + test[2];
  345. }
  346. if (det.userId != null && det.userId !== "") {
  347. const test = det.userId.split("-");
  348. this.userId2 = test[1] + "-" + test[2];
  349. }
  350. this.params.remark = det.remark;
  351. this.pingParams = {
  352. id: det.id,
  353. evaluateNum: det.evaluateNum,
  354. score: det.score,
  355. };
  356. // this.evaluateVal = ((det.score == null ? 0 : det.score) / (det.evaluateNum == null ? 1 : det.evaluateNum))
  357. }
  358. // const item = _this.getItemJson(res)
  359. });
  360. },
  361. getRate(event) {
  362. this.evaluateVal = event;
  363. },
  364. getItemJson: function (item) {
  365. // item.releaseTime = this.$common.transBaseDateTime(item.releaseTime);
  366. // item.createdAt = this.$common.transBaseDateTime(item.createdAt);
  367. item.serviceType =
  368. this.dic_SelectList.QUICK_SELECTION[item.serviceType - 1].label;
  369. // if (item.handleUserId) {
  370. // item.handlePhone = item.handleUserId.split("-")[1];
  371. // }
  372. // item.handleTime = this.$common.transDate(item.handleTime);
  373. switch (item.status) {
  374. case "unAcceptance":
  375. this.stepActive = 0;
  376. break;
  377. case "acceptance":
  378. this.stepActive = 1;
  379. break;
  380. case "evaluated":
  381. this.stepActive = 3;
  382. break;
  383. case "processed":
  384. this.stepActive = 2;
  385. break;
  386. }
  387. const fileUrls = item.fileUrl ? item.fileUrl.split(",") : [];
  388. console.log("files你到底是干嘛的", fileUrls);
  389. const fileUrlViews = [];
  390. if (fileUrls !== null && fileUrls.length > 0) {
  391. fileUrls.forEach((item) => {
  392. item =
  393. this.$constant.BASE_URI + "/wx/fileController/download/" + item;
  394. fileUrlViews.push(item);
  395. });
  396. }
  397. item.fileUrlViewList = fileUrlViews;
  398. const handleUrls = item.handleUrl ? item.handleUrl.split(",") : [];
  399. console.log(handleUrls);
  400. const handleUrl = [];
  401. if (handleUrls !== null && handleUrls.length > 0) {
  402. handleUrls.forEach((item) => {
  403. if (item.url) {
  404. const ul = {
  405. type: "image",
  406. url: item.url,
  407. };
  408. handleUrl.push(ul);
  409. }
  410. });
  411. }
  412. item.handleUrlList = handleUrl;
  413. console.log(item);
  414. return item;
  415. },
  416. /**
  417. *
  418. */
  419. quickSelect(item) {
  420. if (this.quickSleced.val && this.quickSleced.val === item.val) {
  421. this.quickSleced = {};
  422. } else {
  423. this.quickSleced = item;
  424. }
  425. },
  426. /**
  427. * 上传文件
  428. */
  429. afterRead(file) {
  430. console.log(file);
  431. },
  432. },
  433. };
  434. </script>
  435. <style lang="scss" >
  436. .bottom-button {
  437. position: fixed;
  438. z-index: 100;
  439. bottom: 0;
  440. left: 0;
  441. width: 100%;
  442. height: 160rpx;
  443. padding: 35rpx 30rpx;
  444. background-color: #fff;
  445. display: flex;
  446. align-items: center;
  447. justify-content: center;
  448. box-sizing: border-box;
  449. .btn {
  450. height: 100%;
  451. line-height: 80rpx;
  452. width: 100%;
  453. color: #fff;
  454. background-color: #6600ff;
  455. font-size: 34rpx;
  456. border-radius: 10rpx;
  457. }
  458. }
  459. .repair-detail-box {
  460. // width: 100%;
  461. // height: 100%;
  462. .page-1 {
  463. .textarea {
  464. padding: 20rpx;
  465. border-radius: 10rpx;
  466. background: $page-color-base;
  467. box-sizing: border-box;
  468. }
  469. }
  470. .page-3 {
  471. padding-bottom: 100rpx;
  472. .input-item {
  473. padding: 0;
  474. }
  475. .custom-item-tit {
  476. height: 13.333vw;
  477. font-size: 4.267vw;
  478. color: #333;
  479. padding: 2.667vw 0;
  480. position: relative;
  481. display: -webkit-box;
  482. display: -ms-flexbox;
  483. display: flex;
  484. -webkit-box-pack: justify;
  485. -ms-flex-pack: justify;
  486. justify-content: space-between;
  487. -webkit-box-align: center;
  488. -ms-flex-align: center;
  489. align-items: center;
  490. -webkit-box-sizing: border-box;
  491. box-sizing: border-box;
  492. .tit {
  493. &::after {
  494. content: "";
  495. width: 0.8vw;
  496. height: 90%;
  497. background-color: #976dec;
  498. border-radius: 0.4vw;
  499. position: absolute;
  500. left: 0;
  501. top: 50%;
  502. -webkit-transform: translateY(-50%);
  503. transform: translateY(-50%);
  504. }
  505. }
  506. }
  507. .tit {
  508. padding-left: 2.667vw;
  509. position: relative;
  510. }
  511. }
  512. .page-4 {
  513. .custom-item-tit {
  514. height: 13.333vw;
  515. font-size: 4.267vw;
  516. color: #333;
  517. padding: 2.667vw 0;
  518. position: relative;
  519. display: -webkit-box;
  520. display: -ms-flexbox;
  521. display: flex;
  522. -webkit-box-pack: justify;
  523. -ms-flex-pack: justify;
  524. justify-content: space-between;
  525. -webkit-box-align: center;
  526. -ms-flex-align: center;
  527. align-items: center;
  528. -webkit-box-sizing: border-box;
  529. box-sizing: border-box;
  530. .tit {
  531. &::after {
  532. content: "";
  533. width: 0.8vw;
  534. height: 90%;
  535. background-color: #976dec;
  536. border-radius: 0.4vw;
  537. position: absolute;
  538. left: 0;
  539. top: 50%;
  540. -webkit-transform: translateY(-50%);
  541. transform: translateY(-50%);
  542. }
  543. }
  544. }
  545. .tit {
  546. padding-left: 2.667vw;
  547. position: relative;
  548. }
  549. s .evaluate-box {
  550. padding: 20rpx 30rpx;
  551. background: $page-color-base;
  552. border: 2rpx solid #ebedf0;
  553. border-radius: 100rpx;
  554. display: flex;
  555. align-items: center;
  556. justify-content: space-between;
  557. box-sizing: border-box;
  558. }
  559. }
  560. .annex-list-box {
  561. display: flex;
  562. flex-wrap: wrap;
  563. &::after {
  564. display: block;
  565. content: "";
  566. width: 30%;
  567. height: 0rpx;
  568. }
  569. .annex-item {
  570. width: 240rpx;
  571. height: 240rpx;
  572. border: 2rpx solid $text4;
  573. margin-bottom: 20rpx;
  574. position: relative;
  575. overflow: hidden;
  576. > img {
  577. width: 240rpx;
  578. height: 240rpx;
  579. position: absolute;
  580. top: 0;
  581. left: 0;
  582. right: 0;
  583. bottom: 0;
  584. margin: auto;
  585. display: block;
  586. }
  587. video {
  588. width: 100%;
  589. height: 100%;
  590. }
  591. }
  592. }
  593. .tel-box {
  594. display: flex;
  595. align-items: center;
  596. /deep/ .custom-tel-component {
  597. margin-left: 20rpx;
  598. }
  599. }
  600. }
  601. </style>
  602. <style lang="scss">
  603. .image-repairDispatch-box {
  604. .van-image-preview__close-icon {
  605. color: #fff;
  606. font-size: 64rpx;
  607. }
  608. }
  609. </style>