details.vue 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269
  1. <!-- 进度查询-详情 -->
  2. <script>
  3. import useColumns from "./columns";
  4. import { ProblemItem } from "@/api/business/as/after-sales";
  5. export default {
  6. name: "asDetails",
  7. props: {
  8. value: {
  9. type: [String, Number],
  10. require: true,
  11. },
  12. },
  13. components: {
  14. ElFormatValue: () => import("../components/format-value/index.vue"),
  15. ElImagePreview: () => import("../components/image-preview/index.vue"),
  16. },
  17. data() {
  18. const { formColumns } = useColumns();
  19. const params = this.$init.params(formColumns);
  20. return {
  21. title: "进度详情",
  22. width: "100%",
  23. loading: false,
  24. visible: false,
  25. size: "medium",
  26. formColumns,
  27. params: {
  28. ...params,
  29. problemPicture: [],
  30. },
  31. imgUrl: require("../images/order.png"),
  32. phone: "",
  33. show: false,
  34. actions: [
  35. { name: "拨号", key: "call" },
  36. { name: "复制", key: "copy" },
  37. ],
  38. };
  39. },
  40. computed: {
  41. problemId: {
  42. get() {
  43. return this.$props.value;
  44. },
  45. set() {},
  46. },
  47. },
  48. methods: {
  49. setVisible(prop) {
  50. this.visible = prop;
  51. },
  52. hide() {
  53. this.params = {
  54. ...this.$init.params(this.formColumns),
  55. problemPicture: [],
  56. };
  57. this.visible = false;
  58. this.$emit("refresh");
  59. },
  60. beforeOpen() {
  61. this.fetchItem(this.problemId);
  62. },
  63. async fetchItem(id) {
  64. try {
  65. this.loading = true;
  66. let { code, data } = await ProblemItem({ id });
  67. if (code === 200) {
  68. this.params = data;
  69. }
  70. } catch (error) {
  71. } finally {
  72. this.loading = false;
  73. }
  74. },
  75. useCall(prop) {
  76. // this.phone = prop.phone;
  77. this.phone = prop.processorWay;
  78. this.show = true;
  79. },
  80. async onSelect({ key, name }) {
  81. this.show = false;
  82. if (key === "call") {
  83. window.location.href = `tel:${this.phone}`;
  84. return;
  85. }
  86. if (key === "copy") {
  87. let clipboard = navigator.clipboard || {
  88. writeText: (text) => {
  89. let copyInput = document.createElement("input");
  90. copyInput.value = text;
  91. document.body.appendChild(copyInput);
  92. copyInput.select();
  93. document.execCommand("copy");
  94. document.body.removeChild(copyInput);
  95. },
  96. };
  97. if (clipboard) {
  98. await clipboard.writeText(this.phone);
  99. return this.$toast("已复制到剪贴板");
  100. }
  101. // await navigator.clipboard.writeText(this.phone);
  102. //
  103. }
  104. },
  105. onCancel() {},
  106. },
  107. created() {},
  108. };
  109. </script>
  110. <template>
  111. <el-drawer
  112. :size="width"
  113. v-bind="$attrs"
  114. v-on="$listeners"
  115. v-loading="loading"
  116. :visible.sync="visible"
  117. :show-close="false"
  118. destroy-on-close
  119. @close="hide"
  120. @open="beforeOpen"
  121. >
  122. <div
  123. slot="title"
  124. style="display: flex; justify-content: space-between; align-items: center"
  125. >
  126. <van-nav-bar
  127. :title="title"
  128. left-text="返回"
  129. left-arrow
  130. @click-left="hide"
  131. style="width: 100%"
  132. />
  133. </div>
  134. <el-form :model="params">
  135. <el-descriptions :column="1" :size="size" :reverse="true">
  136. <template slot="title">
  137. <div class="mes_title">
  138. <div style="display: flex; align-items: center">
  139. <el-image
  140. style="width: 16px; height: 16px; margin-right: 10px"
  141. :src="imgUrl"
  142. fit="contain"
  143. ></el-image>
  144. <span>单号:{{ params.problemCode }}</span>
  145. </div>
  146. <span>{{
  147. params.createTime &&
  148. new Date(params.createTime.replace(/-/g, "/")).Format(
  149. "yyyy-MM-dd HH:mm"
  150. )
  151. }}</span>
  152. </div>
  153. </template>
  154. <el-descriptions-item
  155. v-for="({ item, attr }, index) in formColumns"
  156. :label="item.title"
  157. >
  158. <el-format-value
  159. v-if="attr.is === 'el-select'"
  160. v-model="params[item.key]"
  161. :dicts="attr.options"
  162. ></el-format-value>
  163. <el-image-preview
  164. v-else-if="attr.is === 'el-image-preview'"
  165. v-model="params[item.key]"
  166. ></el-image-preview>
  167. <span v-else>{{ params[item.key] }}</span>
  168. </el-descriptions-item>
  169. </el-descriptions>
  170. <el-card shadow="never">
  171. <p class="dispose">
  172. <span>工单处理状态</span>
  173. <span style="color: #ff8500; font-size: 12px"
  174. >持续时长:{{ params.processingTime }}</span
  175. >
  176. </p>
  177. <el-timeline style="padding: 16px 12px">
  178. <el-timeline-item
  179. v-for="(flow, index) in params.processFlow"
  180. :key="index"
  181. :timestamp="flow.timestamp"
  182. color="#0095ff"
  183. size="large"
  184. >
  185. <div>
  186. <span>{{ flow.content }}</span>
  187. <div>
  188. <span>处理人:{{ flow.processorName }}</span>
  189. <el-button
  190. type="text"
  191. @click="useCall(flow)"
  192. style="padding: 6px 12px 0px"
  193. >{{ flow.processorWay }}</el-button
  194. >
  195. </div>
  196. </div>
  197. </el-timeline-item>
  198. <el-timeline-item color="#ff8500" size="large"></el-timeline-item>
  199. </el-timeline>
  200. </el-card>
  201. <van-action-sheet
  202. v-model="show"
  203. :actions="actions"
  204. cancel-text="取消"
  205. close-on-click-action
  206. @cancel="onCancel"
  207. @select="onSelect"
  208. />
  209. </el-form>
  210. </el-drawer>
  211. </template>
  212. <style scoped lang="scss">
  213. ::v-deep .el-drawer__header {
  214. padding: 0 !important;
  215. margin: 0 !important;
  216. }
  217. .el-form {
  218. height: 100%;
  219. padding: 16px;
  220. background-color: #f7f7f7;
  221. }
  222. .el-descriptions {
  223. padding: 12px;
  224. background-color: #fff;
  225. border-radius: 4px;
  226. }
  227. ::v-deep .el-descriptions__header {
  228. margin: 0 0 12px;
  229. color: #303133;
  230. }
  231. ::v-deep .el-descriptions__title {
  232. width: 100%;
  233. }
  234. .mes_title {
  235. width: 100%;
  236. font-size: 14px;
  237. display: flex;
  238. align-items: center;
  239. justify-content: space-between;
  240. }
  241. ::v-deep .van-uploader__upload {
  242. display: none;
  243. }
  244. .el-card {
  245. margin: 10px 0;
  246. font-size: 14px;
  247. }
  248. ::v-deep .el-card__body {
  249. padding: 0;
  250. }
  251. .dispose {
  252. border-bottom: 1px solid #e2dede;
  253. margin: 0;
  254. line-height: 28px;
  255. padding: 6px 12px;
  256. font-weight: 600;
  257. display: flex;
  258. justify-content: space-between;
  259. align-items: center;
  260. }
  261. </style>