detail.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403
  1. <template>
  2. <div class="detailPage">
  3. <div class="topButton">
  4. <a-button type="primary" @click="goBack">
  5. {{ t('common.back') }}
  6. </a-button>
  7. </div>
  8. <div class="content">
  9. <div class="content_left">
  10. <div class="content_left_info">
  11. <Descriptions title="客户信息" :column="3" v-if="detailData.customer">
  12. <DescriptionsItem label="客户名称">
  13. {{ detailData.customer.companyName }}</DescriptionsItem
  14. >
  15. <DescriptionsItem label="联系人">
  16. {{ detailData.customer.customerName }}
  17. </DescriptionsItem>
  18. <DescriptionsItem label="联系电话"> {{ detailData.customer.phone }} </DescriptionsItem>
  19. </Descriptions>
  20. <Descriptions title="产品及故障信息" :column="3" v-if="detailData.orderReceivingVo">
  21. <DescriptionsItem label="产品名称" v-if="detailData.repairerVo">
  22. {{ t(`routes.device.type.${detailData.repairerVo.cameraType || 1}`) }}
  23. </DescriptionsItem>
  24. <DescriptionsItem label="产品SN码" v-if="detailData.repairerVo">
  25. {{ detailData.repairerVo.cameraSnCode }}
  26. </DescriptionsItem>
  27. <DescriptionsItem label="保修届满日期">
  28. {{ detailData.repairerVo.warrantyDate }}
  29. </DescriptionsItem>
  30. <DescriptionsItem label="报修日期">
  31. {{ detailData.repairerVo?.createTime }}
  32. </DescriptionsItem>
  33. <DescriptionsItem label="送修方式" v-if="detailData.customerAddress">
  34. {{ detailData.customerAddress.sendType ? '前台送修' : '快递寄送' }}
  35. </DescriptionsItem>
  36. <DescriptionsItem label="保修类型">
  37. {{ t(`routes.spares.warrantyType.${detailData.orderReceivingVo.warrantyType}`)}}
  38. </DescriptionsItem>
  39. <DescriptionsItem label="维修单号">
  40. {{ detailData.orderReceivingVo.repairId }}
  41. </DescriptionsItem>
  42. <DescriptionsItem label="上次维修单号" :span="2">
  43. {{ detailData.orderReceivingVo.repairerId }}
  44. </DescriptionsItem>
  45. <DescriptionsItem label="故障描述" :span="3">
  46. <div>
  47. <p>{{ detailData.repairerVo.faultMsg }}</p>
  48. <PreviewGroup>
  49. <Image
  50. :width="80"
  51. v-for="item in detailData.repairerVo.faultImg"
  52. :key="item"
  53. :src="item"
  54. ></Image>
  55. </PreviewGroup>
  56. </div>
  57. </DescriptionsItem>
  58. <DescriptionsItem label="机器外观">
  59. <div>
  60. <p>{{ detailData.repairRegisterVo?.orderFaultMsg }}</p>
  61. <PreviewGroup>
  62. <Image
  63. :width="80"
  64. v-for="item in detailData.orderReceivingVo?.orderFaultImg"
  65. :key="item"
  66. :src="item"
  67. ></Image>
  68. </PreviewGroup>
  69. </div>
  70. </DescriptionsItem>
  71. <DescriptionsItem label="售后工程师">
  72. {{ detailData.orderReceivingVo?.sysUserName }}
  73. </DescriptionsItem>
  74. <DescriptionsItem label="接单日期">
  75. {{ detailData.orderReceivingVo?.createTime }}
  76. </DescriptionsItem>
  77. <DescriptionsItem label="检测结果" v-if="detailData.repairRegisterVo">
  78. <div>
  79. <p>{{ detailData.repairRegisterVo.checkResult }}</p>
  80. <PreviewGroup>
  81. <Image
  82. :width="80"
  83. v-for="item in detailData.repairRegisterVo.checkImg"
  84. :key="item"
  85. :src="item"
  86. ></Image>
  87. </PreviewGroup>
  88. </div>
  89. </DescriptionsItem>
  90. <DescriptionsItem label="检测日期">
  91. {{ detailData.repairRegisterVo?.createTime }}
  92. </DescriptionsItem>
  93. <DescriptionsItem label="所需备件">
  94. {{ detailData.orderReceivingVo?.shipMobile }}
  95. </DescriptionsItem>
  96. </Descriptions>
  97. <Descriptions title="维修清单" :column="3" layout="vertical">
  98. <DescriptionsItem label="备件信息" :span="3">
  99. <BasicTable @register="registerTable"></BasicTable>
  100. </DescriptionsItem>
  101. </Descriptions>
  102. <Descriptions :column="3">
  103. <DescriptionsItem label="维修工程师">
  104. {{ detailData.repairRegisterVo?.sysUserName }}</DescriptionsItem
  105. >
  106. <DescriptionsItem label="维修完成日期">
  107. {{ detailData.repairRegisterVo?.overTime }}
  108. </DescriptionsItem>
  109. <DescriptionsItem label="维修记录">
  110. {{ detailData.repairRegisterVo?.remark }}
  111. </DescriptionsItem>
  112. <DescriptionsItem label="测试工程师">
  113. {{ detailData.RepairTestVo?.sysUserName }}
  114. </DescriptionsItem>
  115. <DescriptionsItem label="测试通过时间" :span="2">
  116. {{ detailData.repairRegisterVo?.passTime }}
  117. </DescriptionsItem>
  118. <DescriptionsItem label="支付方式" :span="3">
  119. <div v-if="detailData.repairPay">
  120. <p>{{
  121. detailData.repairPay.payType == 1
  122. ? '微信'
  123. : detailData.repairPay.payType == 2
  124. ? '支付宝'
  125. : '银行'
  126. }}</p>
  127. <PreviewGroup>
  128. <Image
  129. :width="80"
  130. v-for="item in [detailData.repairPay.payImg]"
  131. :key="item"
  132. :src="item"
  133. ></Image>
  134. </PreviewGroup>
  135. </div>
  136. </DescriptionsItem>
  137. <DescriptionsItem label="取回方式" v-if="detailData.customerAddress">
  138. {{
  139. detailData.customerAddress.getType == 0
  140. ? '前台取回'
  141. : `快递寄回 ${detailData.customerAddress.getTrackingNum}`
  142. }}</DescriptionsItem
  143. >
  144. <DescriptionsItem label="收件信息" :span="2" v-if="detailData.customerAddress">
  145. {{ detailData.customerAddress.getAddrName }}
  146. {{ detailData.customerAddress.getAddrPhone }}{{ detailData.customerAddress.getAddress }}
  147. </DescriptionsItem>
  148. </Descriptions>
  149. <!-- <Descriptions title="单据下载" :column="3">
  150. <DescriptionsItem label="维修记录" :span="3">
  151. <div class="link">
  152. <a v-for="(item,index) in ['www.baidusss.com','www.baidudd.com']" :key="index" :href="item" target="_blank">
  153. <span v-if="index !== 0">、</span>
  154. {{ item }}
  155. </a>
  156. </div>
  157. </DescriptionsItem>
  158. <DescriptionsItem label="维修工单" :span="3">
  159. <div class="link">
  160. <a :href="'www.baidudd.com'" target="_blank">2022101200001维修工单.pdf </a>
  161. </div>
  162. </DescriptionsItem>
  163. </Descriptions> -->
  164. <Descriptions title="客户评价" :column="3" v-if="detailData.RepairComment">
  165. <DescriptionsItem label="评价内容">
  166. {{ detailData.RepairComment.comment }}
  167. </DescriptionsItem>
  168. <DescriptionsItem label="评分">
  169. {{ detailData.RepairComment.starRank }}
  170. </DescriptionsItem>
  171. </Descriptions>
  172. <Descriptions title="备注" :column="3">
  173. <DescriptionsItem label="备注内容">
  174. {{ detailData.repairerVo?.remark }}
  175. </DescriptionsItem>
  176. </Descriptions>
  177. </div>
  178. </div>
  179. <div class="content_right">
  180. <Timeline>
  181. <TimelineItem
  182. v-for="(item, indexs) in stepList"
  183. :color="indexs == 0 ? 'red' : 'green'"
  184. :key="indexs"
  185. >
  186. <div class="timeItem">
  187. <div class="name">
  188. <span>{{ item.remark }}</span>
  189. <a-button
  190. style="margin-left: 50px"
  191. @click="handleSubmit"
  192. v-for="butItem in butList"
  193. :key="butItem"
  194. v-if="indexs == 0"
  195. >
  196. {{ butItem }}
  197. </a-button>
  198. </div>
  199. <div class="status"
  200. >{{ item.sysUserName }}完成{{ item.remark }} <span>{{ item.createTime }}</span></div
  201. >
  202. <div class="itemText" v-if="item.customerAddress">{{
  203. item.customerAddress.getType == 0
  204. ? '前台取回'
  205. : `快递寄回 ${item.customerAddress.getTrackingNum}`
  206. }}</div>
  207. <div class="itemText" v-if="item.customerAddress">{{
  208. item.customerAddress.sendType == 0
  209. ? '前台送修'
  210. : `快递寄送 ${item.customerAddress.sendTrackingNum}`
  211. }}</div>
  212. <div class="itemText" v-if="item.repairRegisterVo"
  213. >检测结论: {{ item.repairRegisterVo.checkResult }}</div
  214. >
  215. <div class="itemText">所需备件: 镜头x2、电池x1</div>
  216. <div class="itemText" v-if="item.orderReceivingVo"
  217. >机器外观: {{ item.orderReceivingVo.orderFaultMsg }}</div
  218. >
  219. <div class="iamgeList">
  220. <PreviewGroup>
  221. <Image :width="80" v-for="item in [logo]" :key="item" :src="item"></Image>
  222. </PreviewGroup>
  223. </div>
  224. </div>
  225. </TimelineItem>
  226. </Timeline>
  227. </div>
  228. </div>
  229. <div class="bottom_but">
  230. <a-button type="primary" v-for="item in butList" :key="item" @click="goBack">
  231. {{ item }}
  232. </a-button>
  233. <a-button type="primary" @click="goBack">
  234. {{ t('common.back') }}
  235. </a-button>
  236. </div>
  237. </div>
  238. </template>
  239. <script lang="ts">
  240. import { defineComponent, ref, onMounted, reactive } from 'vue';
  241. import { useI18n } from '/@/hooks/web/useI18n';
  242. import { useRouter } from 'vue-router';
  243. import { useMessage } from '/@/hooks/web/useMessage';
  244. import { detail, process } from '/@/api/spares';
  245. import { detailResult } from '/@/api/spares/model';
  246. import logo from '/@/assets/images/grey-logo.png';
  247. import { BasicTable, useTable, BasicColumn, TableImg } from '/@/components/Table';
  248. import {
  249. Timeline,
  250. // TimelineItem,
  251. Descriptions,
  252. // DescriptionsItem,
  253. Image,
  254. // ImagePreviewGroup,
  255. } from 'ant-design-vue';
  256. import { cloneDeep } from 'lodash-es';
  257. export default defineComponent({
  258. components: {
  259. Image,
  260. Descriptions: Descriptions,
  261. DescriptionsItem: Descriptions.Item,
  262. [Timeline.name]: Timeline,
  263. [Timeline.Item.name]: Timeline.Item,
  264. PreviewGroup: Image.PreviewGroup,
  265. },
  266. setup(props) {
  267. const router = useRouter();
  268. const { createMessage } = useMessage();
  269. const { t } = useI18n();
  270. const repairId = ref<string | string[]>(router.currentRoute.value.params.id || '0');
  271. const detailData = ref<detailResult>({
  272. customer: {},
  273. customerAddress: {},
  274. repairerVo: {},
  275. RepairTestVo: {},
  276. repairRegisterVo: {},
  277. orderReceivingVo: {},
  278. repairPay: {},
  279. RepairComment: {},
  280. priceList: [],
  281. });
  282. const stepList = ref<any>([]);
  283. const butList = ref([]);
  284. onMounted(() => {
  285. getData();
  286. });
  287. let dataSource = reactive<any>([]);
  288. const columns: BasicColumn[] = [
  289. {
  290. title: '备件名称',
  291. dataIndex: 'name',
  292. width: 150,
  293. },
  294. {
  295. title: '单价(元)',
  296. dataIndex: 'price',
  297. width: 100,
  298. },
  299. {
  300. title: '数量',
  301. dataIndex: 'count',
  302. width: 110,
  303. },
  304. {
  305. title: '小计(元)',
  306. dataIndex: 'total',
  307. width: 140,
  308. },
  309. ];
  310. async function getData() {
  311. let res = await detail({ repairId: repairId.value });
  312. detailData.value = res;
  313. let countItem = {
  314. id: 3,
  315. price: null,
  316. name: '',
  317. count: '合计(元)',
  318. total: 0,
  319. };
  320. dataSource = res.priceList.map((ele) => {
  321. countItem.total = countItem.total + ele.price * ele.count;
  322. return {
  323. ...ele,
  324. total: ele.price * ele.count,
  325. };
  326. });
  327. setTableData(cloneDeep([...dataSource, countItem]));
  328. const stepRes = await process({ repairId: repairId.value });
  329. let butTypeList = {
  330. 0: ['接单'],
  331. 1: ['检测登记'],
  332. 2: ['报价'],
  333. 3: ['修改报价'],
  334. 4: ['付款登记'],
  335. 5: ['备件出库'],
  336. 6: ['添加备件', '完成维修'],
  337. 7: ['备件回收'],
  338. 8: ['测试登记'],
  339. 9: ['付款登记'],
  340. 10: ['发货登记'],
  341. };
  342. butList.value = stepRes[0] ? butTypeList[stepRes[0].repairStatus || 0] : ['接单'];
  343. stepList.value = stepRes;
  344. console.log('repairId', dataSource, stepRes, butList.value);
  345. }
  346. function goBack() {
  347. router.go(-1);
  348. }
  349. function handleSubmit() {
  350. createMessage.success(t('common.optSuccess'));
  351. }
  352. const [registerTable, { setTableData }] = useTable({
  353. dataSource: dataSource,
  354. columns,
  355. showSummary: true,
  356. showIndexColumn: false,
  357. rowKey: 'id',
  358. pagination: false,
  359. bordered: true,
  360. canResize: false,
  361. });
  362. return {
  363. registerTable,
  364. handleSubmit,
  365. goBack,
  366. butList,
  367. dataSource,
  368. stepList,
  369. t,
  370. };
  371. },
  372. });
  373. </script>
  374. <style lang="less" scoped>
  375. .detailPage {
  376. margin: 20px;
  377. padding: 20px;
  378. background-color: #fff;
  379. .topButton {
  380. text-align: right;
  381. }
  382. .content {
  383. width: 100%;
  384. display: flex;
  385. justify-content: space-between;
  386. &_right {
  387. width: 400px;
  388. padding: 40px 20px;
  389. }
  390. &_left {
  391. width: calc(100% - 400px);
  392. }
  393. }
  394. .bottom_but {
  395. text-align: center;
  396. button {
  397. margin: 20px;
  398. }
  399. }
  400. }
  401. </style>