detail.vue 14 KB

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