repairDetail.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696
  1. <template>
  2. <view class="content">
  3. <view class="top">
  4. <u-navbar :title="title" @leftClick="leftClick" bgColor="rgba(0,0,0,0)" :placeholder="true"></u-navbar>
  5. <view class="state" v-if="pageData.status == 1">暂未收到报价,请耐心等待</view>
  6. <view class="state" v-if="pageData.status == 2">收到报价,请尽快确认</view>
  7. <view class="state" v-if="pageData.status == 3">已匹配成功</view>
  8. <view class="top_box" v-if="pageData.status == 3">
  9. <view class="hflex jbetween">
  10. <view class="hflex acenter">
  11. <image :src="pageData.success.headimg" class="headimg"></image>
  12. <view class="img_right">
  13. <view class="hflex acenter ">
  14. <view class="name text_hide">{{pageData.success.nickname}}</view>
  15. <view class="blue_bg">维修工</view>
  16. </view>
  17. <view class="hflex acenter ">
  18. <view class="text_style1">已认证</view>
  19. <!-- <view class="text_style1">| {{worker.wxc}}</view> -->
  20. </view>
  21. </view>
  22. </view>
  23. <view class="text_red">报价:<span style="font-size: 36rpx;">¥{{pageData.success_price}}</span></view>
  24. </view>
  25. <view class="hflex acenter jbetween" style="padding-top: 32rpx;">
  26. <view class="hflex acenter">
  27. <view class="text_style1">联系电话:</view>
  28. <view class="text_style1">{{pageData.success.phone}}</view>
  29. <view class="phone hflex acenter jcenter" @click.stop="makeCell(pageData.success.phone)">
  30. <u-icon name="phone-fill" color="#506DFF" size="9"></u-icon>
  31. </view>
  32. </view>
  33. <view class="btn hflex acenter jcenter" @click.stop="toChat(pageData.id,-1)">查看详情</view>
  34. </view>
  35. </view>
  36. </view>
  37. <view class="box">
  38. <view class="hflex acenter" style="padding-top: 28rpx;">
  39. <image :src="pageData.user.headimg" class="headimg"></image>
  40. <view class="img_right">
  41. <view class="hflex acenter ">
  42. <view class="name text_hide">{{pageData.user.nickname}}</view>
  43. </view>
  44. <view class="hflex acenter ">
  45. <view class="text_style1">{{pageData.province}}{{pageData.city}}</view>
  46. <view class="text_style1">| {{pageData.create_at}}发布</view>
  47. </view>
  48. </view>
  49. </view>
  50. <view class="box_contetn">{{pageData.describe}}</view>
  51. <view class="imgs hflex acenter fwrap">
  52. <block v-for="(item,index) in pageData.imgs" :key="index">
  53. <image :src="item" class="img" mode="aspectFill"></image>
  54. </block>
  55. </view>
  56. <view class="hflex acenter jbetween cell">
  57. <view class="left_text">联系方式</view>
  58. <view class="right_text">{{pageData.user.phone}}</view>
  59. </view>
  60. <view class="hflex acenter jbetween cell">
  61. <view class="left_text">维修时间</view>
  62. <view class="right_text">{{pageData.start_time}}至{{pageData.end_time}}</view>
  63. </view>
  64. <view class="hflex acenter jbetween cell" style="padding-bottom: 28rpx;">
  65. <view class="left_text">维修地点</view>
  66. <view class="right_text">{{pageData.address}}</view>
  67. </view>
  68. <view class="hflex acenter jbetween type">
  69. <view class="right_text">订单类型</view>
  70. <view class="text_blue">{{pageData.quick==2?'快修':'普修'}}</view>
  71. </view>
  72. <view class="offer hflex acenter jbetween" v-if="pageData.type == 2">
  73. <view class="hflex acenter">
  74. <view class="offer_label">订单报价:</view>
  75. <view class="offer_text">¥{{boss.offest}}</view>
  76. </view>
  77. <view class="btn hflex acenter jcenter">查看详情</view>
  78. </view>
  79. </view>
  80. <view class="box" style="margin-bottom: 186rpx;" v-if="pageData.status == 3">
  81. <view class="hflex acenter jbetween cell">
  82. <view class="left_text">订单编号</view>
  83. <view class="right_text">{{pageData.order_no}}</view>
  84. </view>
  85. <view class="hflex acenter jbetween cell">
  86. <view class="left_text">创建时间</view>
  87. <view class="right_text">{{pageData.success_at}}</view>
  88. </view>
  89. </view>
  90. <view class="box" style="margin-bottom: 186rpx;" v-if="pageData.status == 2">
  91. <block v-for="(item,index) in pageData.offer" :key="index">
  92. <view class="item_bg" :class="active == index ? 'active' : ''" @click="selectItem(index,item.id)">
  93. <view class="hflex jbetween">
  94. <view class="hflex acenter">
  95. <image :src="item.user.headimg" class="headimg"></image>
  96. <view class="img_right">
  97. <view class="hflex acenter ">
  98. <view class="name text_hide" style="max-width: 200rpx;">{{item.user.nickname}}</view>
  99. <view class="blue_bg">维修工</view>
  100. </view>
  101. <view class="hflex acenter text_hide" style="width: 270rpx;">
  102. <view class="text_style1">已认证</view>
  103. </view>
  104. </view>
  105. </view>
  106. <view class="text_red">报价:<span style="font-size: 36rpx;">¥{{item.price != 0?item.price: '暂无'}}</span></view>
  107. </view>
  108. <view class="hflex acenter jbetween">
  109. <view class="hflex acenter">
  110. <view class="text_style1">联系电话:</view>
  111. <view class="text_style1">{{item.user.phone}}</view>
  112. <view class="phone hflex acenter jcenter" @click.stop="makeCell(item.user.phone)">
  113. <u-icon name="phone-fill" color="#506DFF" size="9"></u-icon>
  114. </view>
  115. </view>
  116. <view class="btn hflex acenter jcenter" @click.stop="toChat(item.repair_id,index)">查看详情</view>
  117. </view>
  118. </view>
  119. </block>
  120. </view>
  121. <view class="bottom" v-if="pageData.status !== 1">
  122. <view class="btn hflex acenter jcenter" v-if="type == 1 && pageData.status == 3" @click="openDown">
  123. <image src="https://ship-expert.zhousi.hdlkeji.com/common/down-fff.png" style="width: 33rpx; height: 33rpx;"></image>
  124. <view>下载文件</view>
  125. </view>
  126. <view class="btn hflex acenter jcenter" :class="active == -1 ? 'btn1' : ''" v-if="type == 1 && pageData.status == 2" @click="match">匹配维修工</view>
  127. <view class="hflex acenter jcenter" v-if="type == 2">
  128. <view class="left_btn hflex acenter jcenter" @click="openDown">
  129. <image src="https://ship-expert.zhousi.hdlkeji.com/common/down-blue.png" style="width: 33rpx; height: 33rpx;"></image>
  130. <view>下载文件</view>
  131. </view>
  132. <view class="right_btn hflex acenter jcenter" @click="toChat(item.repair_id,index)">查看回复</view>
  133. </view>
  134. </view>
  135. <u-modal :show="show">
  136. <view class="modeal_content" slot="default">
  137. <view>{{content}}</view>
  138. </view>
  139. <view slot="confirmButton" class="button_group hflex acenter jcenter">
  140. <view class="left hflex acenter jcenter" @click="close">我再想想</view>
  141. <view class="right hflex acenter jcenter" @click="sure">确认匹配</view>
  142. </view>
  143. </u-modal>
  144. <u-popup :show="down_show" @close="close" :round="10" mode="center" :closeable="true">
  145. <view class="popu">
  146. <view class="popu_top hflex acenter jbetween">
  147. <view></view>
  148. <view class="popu_title">下载文件</view>
  149. <view></view>
  150. </view>
  151. <view class="file_bg hflex acenter">
  152. <!-- <image :src="pageData.items[index1].enclosure[index2].icon" class="file_icon"></image> -->
  153. <view class="file_name text_hide">{{pageData.down_word}}</view>
  154. </view>
  155. <view class="btn_group hflex acenter jbetween">
  156. <view class="left_btn hflex acenter jcenter" @click="copy(pageData.down_word)">复制链接</view>
  157. <view class="right_btn hflex acenter jcenter" @click="see(pageData.down_word)">预览文件</view>
  158. </view>
  159. <!-- <view class="hflex acenter jcenter text_blue" @click="see(pageData.items[index1].enclosure[index2].fileurl)">预览文件></view> -->
  160. </view>
  161. </u-popup>
  162. </view>
  163. </template>
  164. <script>
  165. import $api from '@/static/js/api.js'
  166. var that = ''
  167. export default {
  168. data() {
  169. return {
  170. title: '',
  171. active: -1,
  172. type: '',
  173. show: false,
  174. content: '确定要匹配当前维修工吗?',
  175. id: '',
  176. pageData: {},
  177. offer_id: '',
  178. down_show: false,
  179. }
  180. },
  181. onLoad(options) {
  182. that = this
  183. that.id = options.id
  184. that.type = options.type
  185. that.getData()
  186. },
  187. onReady() {
  188. if(true) {
  189. uni.setNavigationBarTitle({
  190. title: '订单详情'
  191. })
  192. }
  193. },
  194. methods: {
  195. leftClick() {
  196. $api.jump(-1)
  197. },
  198. getData() {
  199. $api.req({
  200. url: '/data/api.auth.Center/repairdetail',
  201. method: 'POST',
  202. data: {
  203. type: that.type,
  204. id: that.id
  205. }
  206. }, function(res) {
  207. if(res.code == 1) {
  208. that.pageData = res.data
  209. }
  210. })
  211. },
  212. selectItem(index,id) {
  213. that.active = index
  214. that.offer_id = id
  215. },
  216. match() {
  217. if(that.active == -1) {
  218. $api.info('请选择维修工')
  219. return
  220. } else {
  221. that.show = true
  222. }
  223. },
  224. close() {
  225. that.show = false
  226. that.down_show = false
  227. },
  228. sure() {
  229. $api.req({
  230. url: '/data/api.auth.Center/repairoffer',
  231. method: 'POST',
  232. data: {
  233. id: that.pageData.id,
  234. offer_id: that.offer_id
  235. }
  236. }, function(res) {
  237. if(res.code == 1) {
  238. $api.info(res.info)
  239. }
  240. })
  241. that.close()
  242. that.getData()
  243. },
  244. makeCell(mobile) {
  245. $api.makeCall(mobile)
  246. },
  247. toChat(id,index) {
  248. if(index == -1) {
  249. for(var i=0;i<that.pageData.offer.length;i++) {
  250. if(that.pageData.offer[i].user.id == that.pageData.success_uuid) {
  251. index = i
  252. }
  253. }
  254. }
  255. $api.jump('/page_shop/pages/order/chat?id=' + id + '&offer_id=' + that.pageData.offer[index].id + '&offer_id2=' + that.pageData.offer[index].offer_id)
  256. },
  257. openDown() {
  258. // var url = that.pageData.repair.down_word
  259. // wx.downloadFile({
  260. // url: url, //仅为示例,并非真实的资源
  261. // success (res) {
  262. // // 只要服务器有响应数据,就会把响应内容写入文件并进入 success 回调,业务需要自行判断是否下载到了想要的内容
  263. // if (res.statusCode === 200) {
  264. // const filePath = res.tempFilePath
  265. // uni.saveFile({
  266. // tempFilePath: filePath,
  267. // success: function(res) {
  268. // console.log(res);
  269. // that.close()
  270. // that.see(res.savedFilePath)
  271. // }
  272. // })
  273. // }
  274. // }
  275. // })
  276. that.down_show = true
  277. },
  278. down(url) {
  279. wx.downloadFile({
  280. url: url, //仅为示例,并非真实的资源
  281. success (res) {
  282. // 只要服务器有响应数据,就会把响应内容写入文件并进入 success 回调,业务需要自行判断是否下载到了想要的内容
  283. if (res.statusCode === 200) {
  284. const filePath = res.tempFilePath
  285. uni.saveFile({
  286. tempFilePath: filePath,
  287. success: function(res) {
  288. console.log(res);
  289. that.close()
  290. that.see(res.savedFilePath)
  291. }
  292. })
  293. }
  294. }
  295. })
  296. },
  297. copy(url) {
  298. uni.setClipboardData({
  299. data: url,
  300. success: function () {
  301. $api.info('复制成功')
  302. that.close()
  303. }
  304. });
  305. },
  306. see(url) {
  307. wx.downloadFile({
  308. // 示例 url,并非真实存在
  309. url: url,
  310. showMenu: true,
  311. success: function (res) {
  312. const filePath = res.tempFilePath
  313. wx.openDocument({
  314. filePath: filePath,
  315. success: function (res) {
  316. console.log('打开文档成功')
  317. }
  318. })
  319. }
  320. })
  321. }
  322. },
  323. }
  324. </script>
  325. <style lang="scss" scoped>
  326. .content {
  327. background: #F4F4F4;
  328. .top {
  329. box-sizing: border-box;
  330. width: 100%;
  331. padding: 0 30rpx;
  332. background: linear-gradient(180deg, #506DFF 0%, #F3F3F3 100%);
  333. .state {
  334. font-size: 44rpx;
  335. font-weight: 500;
  336. color: #FFFFFF;
  337. line-height: 60rpx;
  338. padding: 28rpx 0;
  339. }
  340. .top_box {
  341. width: 100%;
  342. box-sizing: border-box;
  343. padding: 28rpx 20rpx 20rpx;
  344. background: #FFFFFF;
  345. border-radius: 10px;
  346. .headimg {
  347. width: 72rpx;
  348. height: 72rpx;
  349. border-radius: 50%;
  350. }
  351. .img_right {
  352. margin-left: 12rpx;
  353. .name {
  354. max-width: 500rpx;
  355. font-size: 30rpx;
  356. font-weight: 400;
  357. color: #222222;
  358. line-height: 42rpx;
  359. }
  360. .blue_bg {
  361. margin-left: 8rpx;
  362. width: 72rpx;
  363. height: 28rpx;
  364. background: #506DFF;
  365. border-radius: 4rpx;
  366. font-size: 20rpx;
  367. font-weight: 400;
  368. color: #FFFFFF;
  369. line-height: 28rpx;
  370. text-align: center;
  371. }
  372. }
  373. .text_red {
  374. font-size: 24rpx;
  375. font-weight: 400;
  376. color: #FF4646;
  377. line-height: 34rpx;
  378. }
  379. .text_style1 {
  380. font-size: 24rpx;
  381. font-weight: 400;
  382. color: #666666;
  383. line-height: 34rpx;
  384. padding-right: 12rpx;
  385. }
  386. .phone {
  387. width: 32rpx;
  388. height: 32rpx;
  389. background: #E1E6FF;
  390. border-radius: 8rpx;
  391. }
  392. .btn {
  393. width: 132rpx;
  394. height: 48rpx;
  395. border-radius: 24rpx;
  396. border: 2rpx solid #506DFF;
  397. font-size: 24rpx;
  398. font-weight: 400;
  399. color: #506DFF;
  400. line-height: 48rpx;
  401. }
  402. }
  403. }
  404. .box {
  405. width: 690rpx;
  406. margin: 20rpx auto 0;
  407. box-sizing: border-box;
  408. padding: 0 20rpx 20rpx;
  409. background: #FFFFFF;
  410. border-radius: 10px;
  411. .box_contetn {
  412. font-size: 28rpx;
  413. font-weight: 400;
  414. color: #444444;
  415. line-height: 44rpx;
  416. padding: 24rpx 0 0;
  417. }
  418. .imgs{
  419. width: 100%;
  420. .img {
  421. width: 200rpx;
  422. height: 200rpx;
  423. border-radius: 6px;
  424. margin: 20rpx 14rpx 0 0;
  425. }
  426. .img:nth-child(3n+3) {
  427. margin: 20rpx 0 0;
  428. }
  429. }
  430. .cell {
  431. padding: 24rpx 0 0;
  432. .left_text {
  433. font-size: 26rpx;
  434. font-weight: 400;
  435. color: #777777;
  436. line-height: 36rpx;
  437. }
  438. .right_text {
  439. font-size: 26rpx;
  440. font-weight: 500;
  441. color: #222222;
  442. line-height: 32rpx;
  443. }
  444. }
  445. .type {
  446. padding: 24rpx 0;
  447. border-top: 1rpx solid #F4F4F4;
  448. .text_blue {
  449. font-size: 28rpx;
  450. font-weight: 500;
  451. color: #506DFF;
  452. line-height: 40rpx;
  453. }
  454. }
  455. .offer {
  456. width: 100%;
  457. height: 76rpx;
  458. background: #EAF4FF;
  459. border-radius: 12rpx;
  460. box-sizing: border-box;
  461. padding: 16rpx 20rpx;
  462. .offer_label {
  463. font-size: 24rpx;
  464. font-weight: 400;
  465. color: #506DFF;
  466. line-height: 34rpx;
  467. }
  468. .offer_text {
  469. font-size: 32rpx;
  470. font-weight: 400;
  471. color: #222222;
  472. line-height: 40rpx;
  473. }
  474. .btn {
  475. width: 132rpx;
  476. height: 48rpx;
  477. border-radius: 24rpx;
  478. border: 2rpx solid #506DFF;
  479. font-size: 24rpx;
  480. font-weight: 400;
  481. color: #506DFF;
  482. line-height: 48rpx;
  483. }
  484. }
  485. .headimg {
  486. width: 72rpx;
  487. height: 72rpx;
  488. border-radius: 50%;
  489. }
  490. .img_right {
  491. margin-left: 12rpx;
  492. .name {
  493. max-width: 500rpx;
  494. font-size: 30rpx;
  495. font-weight: 400;
  496. color: #222222;
  497. line-height: 42rpx;
  498. }
  499. .blue_bg {
  500. margin-left: 8rpx;
  501. width: 72rpx;
  502. height: 28rpx;
  503. background: #506DFF;
  504. border-radius: 4rpx;
  505. font-size: 20rpx;
  506. font-weight: 400;
  507. color: #FFFFFF;
  508. line-height: 28rpx;
  509. text-align: center;
  510. }
  511. }
  512. .text_style1 {
  513. font-size: 24rpx;
  514. font-weight: 400;
  515. color: #666666;
  516. line-height: 34rpx;
  517. padding-right: 12rpx;
  518. }
  519. .phone {
  520. width: 32rpx;
  521. height: 32rpx;
  522. background: #E1E6FF;
  523. border-radius: 8rpx;
  524. }
  525. .active {
  526. background: #F0F3FF !important;
  527. border-radius: 8px;
  528. border: 1px solid #506DFF;
  529. }
  530. .item_bg {
  531. background: #F4F4F4;
  532. border-radius: 8px;
  533. margin-top: 20rpx;
  534. box-sizing: border-box;
  535. padding: 20rpx;
  536. .text_red {
  537. font-size: 24rpx;
  538. font-weight: 400;
  539. color: #FF4646;
  540. line-height: 34rpx;
  541. }
  542. .btn {
  543. width: 132rpx;
  544. height: 48rpx;
  545. border-radius: 24rpx;
  546. border: 2rpx solid #506DFF;
  547. font-size: 24rpx;
  548. font-weight: 400;
  549. color: #506DFF;
  550. line-height: 48rpx;
  551. }
  552. }
  553. }
  554. .bottom {
  555. width: 100%;
  556. height: 166rpx;
  557. background: #FFFFFF;
  558. position: fixed;
  559. bottom: 0;
  560. z-index: 99;
  561. box-sizing: border-box;
  562. padding: 10rpx 30rpx 0;
  563. .btn {
  564. width: 100%;
  565. height: 88rpx;
  566. background: #506DFF;
  567. border-radius: 44rpx;
  568. font-size: 36rpx;
  569. font-weight: 500;
  570. color: #FFFFFF;
  571. line-height: 50rpx;
  572. }
  573. .btn1 {
  574. background: rgba(80,109,255,0.3) !important;
  575. }
  576. .left_btn {
  577. width: 300rpx;
  578. height: 88rpx;
  579. background: #ECEFFE;
  580. border-radius: 44rpx;
  581. font-size: 36rpx;
  582. font-weight: 500;
  583. color: #506DFF;
  584. margin-right: 20rpx;
  585. }
  586. .right_btn {
  587. width: 370rpx;
  588. height: 88rpx;
  589. background: #506DFF;
  590. border-radius: 44rpx;
  591. font-size: 36rpx;
  592. font-weight: 500;
  593. color: #fff;
  594. }
  595. }
  596. .modeal_content {
  597. font-size: 36rpx;
  598. font-weight: 500;
  599. color: #222222;
  600. line-height: 50rpx;
  601. }
  602. .left {
  603. width: 230rpx;
  604. height: 84rpx;
  605. background: #ECEFFF;
  606. border-radius: 42rpx;
  607. font-size: 32rpx;
  608. font-weight: 400;
  609. color: #506DFF;
  610. margin-right: 50rpx;
  611. }
  612. .right {
  613. width: 230rpx;
  614. height: 84rpx;
  615. background: #506DFF;
  616. border-radius: 42rpx;
  617. font-size: 32rpx;
  618. font-weight: 400;
  619. color: #FFFFFF;
  620. }
  621. .popu {
  622. width: 630rpx;
  623. background: #FFFFFF;
  624. border-radius: 24rpx;
  625. margin: 0 auto;
  626. box-sizing: border-box;
  627. padding: 0 40rpx;
  628. .popu_top {
  629. padding: 32rpx 0 40rpx;
  630. .popu_title {
  631. font-size: 36rpx;
  632. font-weight: 500;
  633. color: #333333;
  634. line-height: 50rpx;
  635. }
  636. }
  637. .file_bg {
  638. width: 550rpx;
  639. height: 100rpx;
  640. background: #F4F4F4;
  641. border-radius: 16rpx;
  642. margin: 0 0 42rpx;
  643. }
  644. .file_icon {
  645. width: 48rpx;
  646. height: 60rpx;
  647. }
  648. .file_name {
  649. max-width: 530rpx;
  650. padding-left: 14rpx;
  651. font-size: 28rpx;
  652. font-weight: 400;
  653. color: #333333;
  654. line-height: 40rpx;
  655. }
  656. .btn_group {
  657. width: 100%;
  658. padding: 30rpx 0;
  659. .left_btn {
  660. width: 260rpx;
  661. height: 76rpx;
  662. background: #ECEFFE;
  663. border-radius: 40rpx;
  664. font-size: 30rpx;
  665. font-weight: 500;
  666. color: #506DFF;
  667. line-height: 42rpx;
  668. }
  669. .right_btn {
  670. width: 260rpx;
  671. height: 76rpx;
  672. background: #506DFF;
  673. border-radius: 40rpx;
  674. font-size: 30rpx;
  675. font-weight: 500;
  676. color: #FFFFFF;
  677. line-height: 42rpx;
  678. }
  679. }
  680. .text_blue {
  681. font-size: 30rpx;
  682. font-weight: 400;
  683. color: #506DFF;
  684. line-height: 42rpx;
  685. padding: 28rpx 0 46rpx;
  686. }
  687. }
  688. }
  689. </style>