index.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417
  1. // 评价页面
  2. <template>
  3. <div class="page">
  4. <div class="stepList item_content" :key="stepShow+'123'">
  5. <div class="item_content_top">
  6. <div class="stepList_title">维修单号 {{id}}</div>
  7. <van-button v-if="detailData.repairerVo?.status == 30" size="small" @click="goRoute(`/repair/${id}`)" color="#00B3EC" type="primary" >待确认</van-button>
  8. <van-button v-if="detailData.repairerVo?.status == 80 || detailData.repairerVo?.status == 40" size="small" @click="goRoute(`/payment/${id}`)" color="#00B3EC" type="primary" >支付</van-button>
  9. <van-button v-if="detailData.repairerVo?.status > 80 && detailData.repairerVo?.commentStatus == 0" size="small" @click="goRoute(`/evaluate/${id}`)" color="#00B3EC" type="primary" >评价</van-button>
  10. <van-button v-if="detailData.repairerVo?.status > 80 && detailData.applyInvoice == 0 && detailData.repairerVo.warrantyType != 0" size="small" @click="goRoute(`/invoice/${id}`)" color="#00B3EC" type="primary" >申请开票</van-button>
  11. </div>
  12. <transition-group name="van-fade">
  13. <!-- <div v-show="stepShow">Slide Right</div> -->
  14. <div class="border stepItem" v-for="(item, index) in processList" :key="index" v-show="stepShow ? true : index < 1">
  15. <div class="step">
  16. <div class="step_title">{{item.title || item.remark}}</div>
  17. <!-- <div v-if="item.customerAddress">{{item.customerAddress.sendType == 0?' 前台送修':`快递寄送 ${item.customerAddress?.sendTrackingNum}`}}</div> -->
  18. <div class="htmlText" v-if="item.customerAddress">{{item.customerAddress.getType == 0?' 前台取回':`快递寄回 ${item.customerAddress?.getTrackingNum}`}}</div>
  19. <div class="htmlText" v-if="item.repairRegisterVo?.checkResult">检测结果: {{item.repairRegisterVo?.checkResult}}</div>
  20. <div class="htmlText" v-if="item.repairRegisterVo?.partNamesStr">所需备件: {{item.repairRegisterVo?.partNamesStr}}</div>
  21. <div class="htmlText" v-if="item.orderReceiving?.orderFaultMsg">机器外观: {{item.orderReceiving?.orderFaultMsg}}</div>
  22. <div class="htmlText" v-if="item.repairTest?.resultInfo">测试描述: {{item.repairTest?.resultInfo}}</div>
  23. <div class="imgList" v-if="item.imagesInfo?.length">
  24. <img :src="imgItem" v-for="(imgItem,imgID) in item.imagesInfo" @click="imgPreview(item.imagesInfo, imgID)" :key="imgItem + index" alt="" />
  25. </div>
  26. <div v-if="item.repairLogId">{{ namePrivate(item.sysUserName) }}完成{{ item.remark }}</div>
  27. <div class="status htmlText" v-else>
  28. {{ replacName(item.sysUserName,item.subTitle) }}
  29. </div>
  30. <div class="step_time" v-if="item.createTime">{{dayjs(item.createTime).format('MM-DD HH:mm')}}</div>
  31. <div class="doct" :class="index == 0 ? 'oneSpot' : 'Spot'"></div>
  32. </div>
  33. </div>
  34. </transition-group>
  35. <van-divider v-if="processList?.length >1">
  36. <div @click="handleShow">
  37. <van-icon :name="!stepShow ? 'arrow-down' : 'arrow-up'" />
  38. {{ !stepShow ? '展开' : '收起' }}
  39. </div>
  40. </van-divider>
  41. </div>
  42. <div class="page_top item_content" v-if="detailData.customer">
  43. <div class="title">客户信息</div>
  44. <div class="content">
  45. <div class="cost_list" style="border-bottom: none">
  46. <div class="item">
  47. <span>公司名称</span>
  48. <span>{{detailData.customer?.companyName}}</span>
  49. </div>
  50. <div class="item">
  51. <span>联系人</span>
  52. <span>{{detailData.customer?.customerName}}</span>
  53. </div>
  54. <div class="item">
  55. <span>联系电话</span>
  56. <span>{{detailData.customer?.phone}}</span>
  57. </div>
  58. </div>
  59. </div>
  60. </div>
  61. <div class="page_top item_content" v-if="detailData.repairerVo">
  62. <div class="title">故障信息</div>
  63. <div class="content">
  64. <div class="text">{{cameraType[detailData.repairerVo?.cameraType]}} {{detailData.repairerVo?.cameraSnCode}}</div>
  65. <div class="text" v-html="detailData.repairerVo?.faultMsg"></div>
  66. <div class="imgList" v-if="detailData.repairerVo">
  67. <img :src="imgItem" v-for="(imgItem, imgID) in detailData.repairerVo.faultImg" @click="imgPreview(detailData.repairerVo.faultImg, imgID)" :key="imgItem" alt="" />
  68. </div>
  69. </div>
  70. </div>
  71. <div class="page_custinfo item_content" v-if="detailData.priceList.length && detailData.repairerVo?.status > 30">
  72. <div class="title">费用明细</div>
  73. <div class="content">
  74. <div class="cost_list">
  75. <!-- v-show="!(item.type == 0 && item.status == 0) && item.laborId != 2" -->
  76. <div class="item" v-for="item in detailData.priceList" :key="item.name">
  77. <span>{{ item.name }}</span>
  78. <span>¥{{ item.discount ==0 ?item.price:item.priceDiscount }} x{{ item.count }}</span>
  79. </div>
  80. <div class="item" v-if="detailData.repairerVo.warrantyType == 0">
  81. <span>保内维修</span>
  82. <span>¥ -{{ priceCount(detailData?.priceList || []) }}</span>
  83. </div>
  84. </div>
  85. <div class="cell" style="border: none">
  86. <span>维修费用</span>
  87. <span>¥{{ detailData.repairerVo.warrantyType == 0?'0.00':priceCount(detailData?.priceList || []) }}</span>
  88. </div>
  89. </div>
  90. </div>
  91. <div class="page_top item_content" v-if="detailData.customerAddress">
  92. <div class="title">运输信息</div>
  93. <div class="content">
  94. <div class="cost_list">
  95. <div class="item">
  96. <span>送修方式</span>
  97. <span>{{detailData.customerAddress.sendType == 0 ?'前台送修':'快递寄送'}}</span>
  98. </div>
  99. <div class="item" v-if="detailData.customerAddress.sendType != 0">
  100. <span>快递单号</span>
  101. <span>{{detailData.customerAddress.sendTrackingNum}}</span>
  102. </div>
  103. <div class="item">
  104. <span>取回方式</span>
  105. <span>{{detailData.customerAddress.getType == 0 ?'前台取回':'快递寄回'}}</span>
  106. </div>
  107. <div class="item" v-if="detailData.customerAddress.getType != 0">
  108. <span>快递单号</span>
  109. <span>{{detailData.customerAddress.getTrackingNum}}</span>
  110. </div>
  111. <div class="item" v-if="detailData.customerAddress.getType != 0 && detailData.customerAddress.getAddrName" >
  112. <span>收件人</span>
  113. <span>{{detailData.customerAddress.getAddrName}}</span>
  114. </div>
  115. <div class="item" v-if="detailData.customerAddress.getType != 0 && detailData.customerAddress.getAddrPhone">
  116. <span>收件人电话</span>
  117. <span>{{detailData.customerAddress.getAddrPhone}}</span>
  118. </div>
  119. <div class="item" v-if="detailData.customerAddress.getType != 0 && detailData.customerAddress.getAddress">
  120. <span>收件地址</span>
  121. <span>{{detailData.customerAddress.getAddress}}</span>
  122. </div>
  123. </div>
  124. </div>
  125. </div>
  126. <div class="page_top item_content" v-if="detailData.repairComment">
  127. <div class="title">评价信息</div>
  128. <div class="content">
  129. <div class="cost_list" style="border-bottom: none">
  130. <div class="item">
  131. <span>内容</span>
  132. <span>{{detailData.repairComment?.comment}}</span>
  133. </div>
  134. <div class="item">
  135. <span>评分</span>
  136. <span>{{detailData.repairComment?.starRank}}分</span>
  137. </div>
  138. </div>
  139. </div>
  140. </div>
  141. </div>
  142. </template>
  143. <script lang="ts" setup name="detailPage">
  144. import { useRouter } from 'vue-router';
  145. import { ref, onMounted, unref, onActivated } from 'vue';
  146. import { showImagePreview } from 'vant';
  147. import { repairProcess, repairDetails } from '/@/api';
  148. import dayjs from 'dayjs'
  149. const { currentRoute } = useRouter();
  150. const router = useRouter();
  151. const { id } = unref(currentRoute)?.params
  152. const stepShow = ref<boolean>(false);
  153. const cameraType = {
  154. 0:'四维看看',
  155. 1:'四维看见',
  156. 2:'四维深时',
  157. }
  158. let detailData = ref({
  159. customer:<any>{},
  160. customerAddress:<any>{},
  161. repairerVo:<any>{},
  162. RepairTestVo:<any>{},
  163. repairRegisterVo:<any>{},
  164. orderReceivingVo:<any>{},
  165. repairPay:<any>{},
  166. repairComment:<any>{},
  167. priceList:<any>[],
  168. applyInvoice:0,
  169. });
  170. let processList = ref<any>([])
  171. onMounted(() => {
  172. console.log('onMounted',id)
  173. getDetaile();
  174. });
  175. onActivated(()=>{
  176. console.log('onActivated')
  177. getDetaile();
  178. })
  179. function priceCount(list){
  180. let priceCount = 0
  181. list.map(ele => {
  182. // if(!(ele.type == 0 && ele.status == 0) && ele.laborId != 2){
  183. let price = ele.discount == 0 ? ele.price : ele.priceDiscount
  184. priceCount = (price * ele.count) + priceCount
  185. // }
  186. })
  187. return priceCount.toFixed(2)
  188. }
  189. const getDetaile = async () => {
  190. const { data } = await repairDetails(id);
  191. detailData.value = data
  192. const resProcess = await repairProcess(id);
  193. console.log('resProcess',resProcess)
  194. let process = unref(resProcess?.response)?.data;
  195. processList.value = process
  196. };
  197. const handleShow = () => {
  198. stepShow.value = !stepShow.value;
  199. };
  200. const goRoute = (path) => {
  201. console.log('goRoute',path)
  202. if (!path) return;
  203. router.push(path);
  204. };
  205. function replacName(name,subTitle){
  206. return subTitle.replace(name, namePrivate(name));
  207. }
  208. // 姓名脱敏
  209. function namePrivate(name) {
  210. if(null != name && name != undefined) {
  211. if(name.length == 2) {
  212. return name.substring(0,1) + '*' // 截取name的第一个字符,第二个字符变成*
  213. } else if(name.length == 3) {
  214. return name.substring(0,1) + '*' + name.substring(2,3) // 截取name的第一个和第三个字符,第二个字符变成*
  215. } else if(name.length > 3) {
  216. return name.substring(0,1) + '*' + '*' + name.substring(3,name.length) //截取第一个和大于第4个字符
  217. }
  218. } else {
  219. return ''
  220. }
  221. }
  222. function imgPreview(list,startPosition=1){
  223. let images = list.map(ele =>{
  224. if(typeof ele == 'string' ){
  225. return ele
  226. }else{
  227. return
  228. }
  229. })
  230. showImagePreview({
  231. images: images||[],
  232. startPosition,
  233. });
  234. }
  235. </script>
  236. <style lang="scss" >
  237. .page {
  238. min-height: 100vh;
  239. background-color: #f5f5f5;
  240. overflow: hidden;
  241. .item_content {
  242. background-color: #fff;
  243. border-radius: 4px 4px 4px 4px;
  244. margin: 12px;
  245. .title {
  246. font-size: 14px;
  247. font-family: PingFang SC-Medium, PingFang SC;
  248. font-weight: 600;
  249. color: #000000;
  250. padding: 15px 0;
  251. margin: 0 15px;
  252. border-bottom: 1px solid #e7e7e7;
  253. }
  254. .content {
  255. padding: 24px 15px;
  256. }
  257. .item {
  258. display: flex;
  259. justify-content: space-between;
  260. align-items: center;
  261. line-height: 30px;
  262. font-size: 14px;
  263. span{
  264. max-width: 70%;
  265. overflow:hidden; //超出的文本隐藏
  266. text-overflow:ellipsis; //用省略号显示
  267. white-space:nowrap;
  268. }
  269. // margin-bottom: 8px;
  270. }
  271. .imgList {
  272. margin-top: 8px;
  273. img {
  274. height: 64px;
  275. width: 64px;
  276. padding: 0 8px 0 0;
  277. object-fit: cover;
  278. }
  279. }
  280. }
  281. .stepList {
  282. padding: 24px 16px;
  283. .item_content_top{
  284. padding-bottom: 15px;
  285. margin-bottom: 16px;
  286. border-bottom: 1px solid #f5f5f5;
  287. display: flex;
  288. justify-content: space-between;
  289. align-items: center;
  290. }
  291. &_title {
  292. font-size: 14px;
  293. font-family: PingFang SC-Medium, PingFang SC;
  294. font-weight: 500;
  295. color: #000000;
  296. }
  297. .stepItem {
  298. transition: all 3s 2s linear;
  299. }
  300. .step {
  301. &:last-child {
  302. // border: none;
  303. }
  304. padding: 8px 15px 16px 15px;
  305. border-left: 1px solid #f5f5f5;
  306. div{
  307. margin-top: 8px;
  308. }
  309. &_title {
  310. font-size: 14px;
  311. line-height: 22px;
  312. margin-top: 0px !important;
  313. }
  314. &_time {
  315. font-size: 10px;
  316. font-family: PingFang SC-Regular, PingFang SC;
  317. font-weight: 400;
  318. color: #999999;
  319. line-height: 14px;
  320. // padding-bottom: 24px;
  321. }
  322. font-size: 12px;
  323. font-family: PingFang SC-Regular, PingFang SC;
  324. font-weight: 400;
  325. color: #333333;
  326. line-height: 18px;
  327. position: relative;
  328. .doct {
  329. display: inline-block;
  330. position: absolute;
  331. left: 0;
  332. top: 0;
  333. width: 8px;
  334. height: 8px;
  335. border-radius: 50%;
  336. transform: translat(-50%, -50%);
  337. }
  338. .oneSpot {
  339. border: 4px solid #00b3ec;
  340. left: -8px;
  341. top: 4px;
  342. background: #fff;
  343. }
  344. .Spot {
  345. background: #cccccc;
  346. left: -4px;
  347. top: 8px;
  348. }
  349. }
  350. }
  351. .colortext {
  352. color: #e34d59;
  353. }
  354. .cell {
  355. border-top: 1px solid #e7e7e7;
  356. &:first-child {
  357. border-top: none;
  358. }
  359. // height: 48px;
  360. margin-top: 12px;
  361. display: flex;
  362. justify-content: space-between;
  363. align-items: center;
  364. font-size: 14px;
  365. font-family: PingFang SC-Regular, PingFang SC;
  366. font-weight: 400;
  367. color: #333333;
  368. line-height: 22px;
  369. }
  370. .page_custinfo {
  371. .cost_list {
  372. padding-bottom: 8px;
  373. // margin: 0 15px;
  374. // padding-top: 24px;
  375. border: {
  376. // top: 1px solid #e7e7e7;
  377. bottom: 1px solid #e7e7e7;
  378. }
  379. }
  380. }
  381. .page_top {
  382. .cost_list {
  383. border: {
  384. // bottom: 1px solid #e7e7e7;
  385. }
  386. }
  387. .text {
  388. line-height: 30px;
  389. }
  390. }
  391. .repairInfo {
  392. background-color: #fff;
  393. margin-bottom: 12px;
  394. border-radius: 4px 4px 4px 4px;
  395. }
  396. .but {
  397. padding: 25px 15px;
  398. .tips {
  399. font-size: 12px;
  400. font-family: PingFang SC-Regular, PingFang SC;
  401. font-weight: 400;
  402. color: #999999;
  403. margin-bottom: 10px;
  404. }
  405. button {
  406. margin-top: 16px;
  407. }
  408. }
  409. }
  410. </style>