湘妃到家前端代码仓库
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

738 lines
15 KiB

1 month ago
  1. <template>
  2. <view class="order">
  3. <mNavbar title="订单详情" :leftClick="toLeft" style="background: linear-gradient(#4899a6, rgb(78 160 167));" />
  4. <view class="box">
  5. <view class="title">
  6. <view class="icon">
  7. <uni-icons type="wallet-filled" color="#4899a6" size="15"></uni-icons>
  8. </view>
  9. <view class="text">
  10. {{ getStatus(msgOrder.state) }}
  11. </view>
  12. </view>
  13. <view class="tips">
  14. <!-- 请确认订单 -->
  15. </view>
  16. <van-steps style="background: transparent;padding-bottom: 30px;" active-color="#fff" inactive-color="#ddd"
  17. :active="stepsActive">
  18. <van-step v-for="(item, index) in steps">
  19. <template #active-icon>
  20. <view class="active-icon"></view>
  21. </template>
  22. <view :class="{color : index <
  23. stepsActive,stepText : true,
  24. tip : index == 2 || index == 4}">
  25. {{ item }}
  26. <view :class="{act : index == stepsActive}"></view>
  27. </view>
  28. <template #inactive-icon>
  29. <view :class="{'inactive-icon' : true,
  30. tip : index == 2 || index == 4}"></view>
  31. </template>
  32. </van-step>
  33. </van-steps>
  34. <view class="btns">
  35. <view class="btn btc" @click="calcelOrder(msgOrder.id,cancelSuccess)" v-if="msgOrder.state == 0">
  36. 取消订单
  37. </view>
  38. <view class="btn" @click="toPayOrder(msgOrder)" v-if="msgOrder.state == 0">
  39. 立即付款
  40. </view>
  41. <view class="btn btc" @click="moreOrder(msgOrder.projectId,toPlaceorder)" v-if="msgOrder.state == 3">
  42. 再来一单
  43. </view>
  44. <view class="btn" @click="toEvaluate(msgOrder.id,msgOrder.projectId)" v-if="msgOrder.state == 3">
  45. 立即评价
  46. </view>
  47. <view class="btn" @click="moreOrder(msgOrder.projectId,toPlaceorder)" v-if="msgOrder.state == 4">
  48. 再来一单
  49. </view>
  50. </view>
  51. </view>
  52. <view class="info">
  53. <view class="flex">
  54. <view style="width: 8rpx;height: 30rpx;
  55. background: #6fc6ad;border-radius: 6rpx;" />
  56. <view class="head-title">服务项目</view>
  57. </view>
  58. <view class="flex">
  59. <view class="server-item">
  60. <view class="img-box">
  61. <image :src="msgShop.image" mode="aspectFill"></image>
  62. </view>
  63. <view class="server-info">
  64. <view class="server-title">
  65. {{msgOrder.projectName}}
  66. <!-- <view class="coupon">领券立减</view> -->
  67. </view>
  68. <view class="current-price">
  69. <text class="unit"></text>{{msgOrder.money}}
  70. </view>
  71. <view class="time-coupon">
  72. <view class="flex">
  73. <image src="@/static/home/time-icon.png"></image>
  74. <view class="time">{{msgOrder.useTime}}分钟</view>
  75. </view>
  76. <view class="sales-volume">
  77. <image src="@/static/icons/icon1.png"></image>
  78. <view class="desc">已售出{{msgShop.payNum}}+</view>
  79. </view>
  80. </view>
  81. <view class="sales-volume" style="margin-top: 5px;">
  82. <view class="desc">服务时间{{msgOrder.serviceDate}} {{msgOrder.serviceTime}}</view>
  83. </view>
  84. </view>
  85. </view>
  86. </view>
  87. <view class="line min_tips">
  88. <view class="head-div flex">
  89. <view style="width: 118rpx;height: 118rpx;border-radius: 50%;overflow: hidden;">
  90. <image style="width: 118rpx;" :src="msgTechnician.image" mode="widthFix"></image>
  91. </view>
  92. <view style="padding: 10rpx 34rpx;display: flex;flex-direction: column;justify-content: space-around;">
  93. <view class="nickname">
  94. {{msgTechnician.title}}
  95. <view v-if="msgTechnician.isVip" class="tag">
  96. <image src="@/static/order/s.png" mode="aspectFit"></image>
  97. <view class="auth">官方认证</view>
  98. </view>
  99. </view>
  100. <view class="days">
  101. <van-rate v-model="msgTechnician.score" :size="10" readonly color="#ffb54c" void-icon="star"
  102. void-color="#eee" />
  103. <view class="">
  104. 好评{{msgTechnician.pinNum}}
  105. </view>
  106. </view>
  107. </view>
  108. </view>
  109. <view @click="gototechnicianDetail(msgTechnician)" class="btn-x">
  110. 服务技师
  111. </view>
  112. </view>
  113. <view class="line address">
  114. <view class="address-top">
  115. <view class="">
  116. 服务地址
  117. </view>
  118. <view class="copy">
  119. <image @click="copy(msgOrder.name + ' ' +
  120. msgOrder.phone + ' ' + msgOrder.address
  121. + ' ' + (msgOrder.addressDetails || ''))" src="/static/order/copy.png"></image>
  122. </view>
  123. </view>
  124. <view class="addressDetail">
  125. <view class="">{{msgOrder.name}} {{msgOrder.phone}}</view>
  126. <view class="">{{msgOrder.address}}{{msgOrder.addressDetails || ''}}</view>
  127. </view>
  128. </view>
  129. <view class="line">
  130. <view class="t min_tips">
  131. <view class="">
  132. 实付款含路费
  133. </view>
  134. <view class="current-price">
  135. {{ msgOrder.money }}
  136. </view>
  137. </view>
  138. <view class="min_tips">
  139. <view class="">
  140. 订单金额
  141. </view>
  142. <view class="">
  143. {{ msgShop.price }}
  144. </view>
  145. </view>
  146. <view class="min_tips">
  147. <view class="">
  148. 路费
  149. </view>
  150. <view class="">
  151. {{ msgOrder.temp}}
  152. </view>
  153. </view>
  154. <view class="min_tips">
  155. <view class="">
  156. 优惠券
  157. </view>
  158. <view class="">
  159. -{{ coupon ? coupon.money : 0 }}
  160. </view>
  161. </view>
  162. </view>
  163. <!-- 订单信息 -->
  164. <view class="line">
  165. <view class="t min_tips">
  166. <view class="">
  167. 订单信息
  168. </view>
  169. </view>
  170. <view class="min_tips">
  171. <view class="">
  172. 订单编号
  173. </view>
  174. <view class="">
  175. {{msgOrder.id}}
  176. </view>
  177. </view>
  178. <view class="min_tips">
  179. <view class="">
  180. 下单时间
  181. </view>
  182. <view class="">
  183. {{msgOrder.createTime}}
  184. </view>
  185. </view>
  186. </view>
  187. <!-- 下单须知 -->
  188. <view class="line">
  189. <view class="t min_tips">
  190. <view class="">
  191. 下单须知
  192. </view>
  193. </view>
  194. <view class="min_tips" style="line-height: 40rpx;">
  195. {{msgShop.projectExplain}}
  196. </view>
  197. <view class="btns">
  198. <view @click="clickService" class="btn">
  199. 联系客服
  200. </view>
  201. </view>
  202. </view>
  203. </view>
  204. </view>
  205. </template>
  206. <script>
  207. import mNavbar from '@/components/base/m-navbar.vue'
  208. import order from '@/mixins/order.js'
  209. export default {
  210. components: {
  211. mNavbar,
  212. },
  213. mixins: [order],
  214. data() {
  215. return {
  216. rate: 5,
  217. stepsActive: -1,
  218. steps: ['下单', '接单', '技师出发', '技师到达', '开始服务', '服务完成'],
  219. msgOrder: [],
  220. msgShop: [],
  221. msgTechnician: [],
  222. phone: '',
  223. coupon : {}
  224. }
  225. },
  226. onShow() {
  227. this.getOrderDetail()
  228. this.getConfig()
  229. },
  230. methods: {
  231. //获取订单详情
  232. getOrderDetail() {
  233. this.$api('getOrderDetail', {
  234. id: this.$route.query.id
  235. }, res => {
  236. if (res.code == 200) {
  237. this.msgOrder = res.result.msgOrder;
  238. this.msgShop = res.result.msgShop;
  239. this.msgTechnician = res.result.msgTechnician;
  240. this.coupon = res.result.coupon
  241. this.changeSetup()
  242. }
  243. })
  244. },
  245. //返回订单列表
  246. toLeft() {
  247. uni.switchTab({
  248. url: '/pages/index/order'
  249. })
  250. },
  251. //复制内容
  252. copy(content) {
  253. uni.setClipboardData({
  254. data: content,
  255. success: () => {
  256. uni.showToast({
  257. title: '复制成功',
  258. icon: 'none'
  259. })
  260. }
  261. })
  262. },
  263. //跳转确认订单页面
  264. //立即支付
  265. toPayOrder(item) {
  266. this.$api('immediatelyPay', {
  267. addressId: item.addressId,
  268. couponId: item.couponId,
  269. orderId: item.id,
  270. payType: item.payType,
  271. remark: item.remark,
  272. serviceTime: item.serviceTime
  273. }, res => {
  274. if (res.code == 200) {
  275. this.$wxPay(res,this.getOrderDetail,this.getOrderDetail)
  276. }
  277. })
  278. },
  279. //点击联系客服按钮(联系客服)
  280. clickService() {
  281. uni.makePhoneCall({
  282. phoneNumber: this.phone,
  283. success: () => {},
  284. fail: () => {}
  285. });
  286. },
  287. //获取配置信息
  288. getConfig() {
  289. this.$api('getConfig', {}, res => {
  290. if (res.code == 200) {
  291. res.result.forEach(item => {
  292. if (item.keyValue == 'phone') {
  293. this.phone = this.deleteTag(item.content);
  294. }
  295. })
  296. }
  297. })
  298. },
  299. //删除html标签
  300. deleteTag(html) { //删除html标签
  301. return html.replace(/<[^>]*>/g, '');
  302. },
  303. //跳转技师详情
  304. gototechnicianDetail(item) {
  305. uni.navigateTo({
  306. url: '/pages/technician/technicianDetail?id=' + item.id
  307. })
  308. },
  309. //修改进度条状态
  310. changeSetup() {
  311. let state = this.msgOrder.state;
  312. let tenState = this.msgOrder.tenState
  313. if (state == 1) {
  314. this.stepsActive = 0
  315. }
  316. if (tenState == 2 && state == 2) {
  317. this.stepsActive = 2
  318. }
  319. if (state == 2) {
  320. this.stepsActive = 1
  321. }
  322. if (tenState == 3) {
  323. this.stepsActive = 3
  324. }
  325. if (tenState == 4) {
  326. this.stepsActive = 4
  327. }
  328. if (tenState == 5 && state == 3) {
  329. this.stepsActive = 5
  330. }
  331. },
  332. //获取订单状态
  333. getStatus(state){
  334. let stateArr = ['待付款','已付款','已确认','已完成','已取消']
  335. return stateArr[state]
  336. },
  337. //取消成功
  338. cancelSuccess() {
  339. uni.showToast({
  340. title: '取消成功',
  341. icon: 'none'
  342. })
  343. this.getOrderDetail()
  344. },
  345. //跳转再来一单
  346. toPlaceorder(res, projectId) {
  347. uni.navigateTo({
  348. url: `/pages/technician/selectTechnician?serviceId=${projectId}`
  349. })
  350. sessionStorage.setItem('technicianList', JSON.stringify(res.result.tenPageList))
  351. },
  352. }
  353. }
  354. </script>
  355. <style scoped lang="scss">
  356. .order {
  357. background: linear-gradient(#4899a6, #6fc6ad, #6fc6ad);
  358. padding-bottom: 10px;
  359. }
  360. .box {
  361. padding: 20px;
  362. .active-icon {
  363. width: 12px;
  364. height: 12px;
  365. background-color: #fff;
  366. border-radius: 6px;
  367. transform: translate(-25%, 0);
  368. }
  369. .inactive-icon {
  370. width: 8px;
  371. height: 8px;
  372. background-color: #fff;
  373. border-radius: 4px;
  374. }
  375. .stepText {
  376. font-size: 20rpx !important;
  377. }
  378. .stepText.color {
  379. color: #eee;
  380. }
  381. .inactive-icon.tip {
  382. width: 6px;
  383. height: 6px;
  384. background-color: #fff;
  385. border-radius: 3px;
  386. }
  387. .stepText.tip {
  388. background-color: #b5d7d3;
  389. padding: 3px 5px;
  390. position: relative;
  391. top: 50px;
  392. border-radius: 5px;
  393. color: #4899a6;
  394. display: flex;
  395. font-size: 10px;
  396. }
  397. .stepText.tip>view {
  398. position: absolute;
  399. top: -13px;
  400. left: 50%;
  401. transform: translate(-50%, 0);
  402. border-top: 7px solid transparent;
  403. border-bottom: 7px solid #b5d7d3;
  404. border-left: 7px solid transparent;
  405. border-right: 7px solid transparent;
  406. }
  407. .stepText.tip>view.act {
  408. left: 50%;
  409. }
  410. .title {
  411. display: flex;
  412. justify-content: center;
  413. align-items: center;
  414. .icon {
  415. width: 25px;
  416. height: 25px;
  417. background-color: #fff;
  418. border-radius: 15px;
  419. display: flex;
  420. justify-content: center;
  421. align-items: center;
  422. }
  423. .text {
  424. color: #fff;
  425. padding-left: 5px;
  426. }
  427. }
  428. .tips {
  429. display: flex;
  430. justify-content: center;
  431. align-items: center;
  432. color: #eee;
  433. padding: 10px;
  434. font-size: 22rpx;
  435. padding-bottom: 20px;
  436. }
  437. .btns {
  438. display: flex;
  439. justify-content: center;
  440. align-items: center;
  441. margin-top: 10px;
  442. .btn {
  443. color: #fff;
  444. padding: 10rpx 50rpx;
  445. background-color: #ffb300;
  446. border-radius: 30rpx;
  447. font-size: 25rpx;
  448. margin-right: 10rpx;
  449. }
  450. .btc{
  451. background: #ccc;
  452. }
  453. }
  454. }
  455. .info {
  456. margin: 10px;
  457. padding: 20rpx;
  458. background-color: #fff;
  459. width: calc(100% - 40px);
  460. border-radius: 10px;
  461. .head-title {
  462. font-family: PingFang SC, PingFang SC-Bold;
  463. color: #2f2e2e;
  464. line-height: 30rpx;
  465. margin-left: 10rpx;
  466. }
  467. .server-item {
  468. display: flex;
  469. flex-wrap: wrap;
  470. align-items: center;
  471. justify-content: space-between;
  472. background: white;
  473. border-radius: 15rpx;
  474. box-sizing: border-box;
  475. margin: 20rpx 0rpx;
  476. width: 100%;
  477. .img-box {
  478. width: 150rpx;
  479. height: 150rpx;
  480. border-radius: 10rpx;
  481. overflow: hidden;
  482. image {
  483. width: 100%;
  484. height: 100%;
  485. }
  486. }
  487. .server-info {
  488. display: flex;
  489. flex-direction: column;
  490. justify-content: space-around;
  491. width: calc(100% - 180rpx);
  492. box-sizing: border-box;
  493. padding: 10rpx 15rpx;
  494. .server-title {
  495. display: flex;
  496. }
  497. .coupon {
  498. display: flex;
  499. justify-content: center;
  500. align-items: center;
  501. background: #F29E45;
  502. color: white;
  503. width: 120rpx;
  504. height: 40rpx;
  505. border-radius: 10rpx;
  506. margin-left: 10rpx;
  507. font-size: 22rpx;
  508. }
  509. .time-coupon,
  510. .price {
  511. display: flex;
  512. flex-wrap: wrap;
  513. align-items: center;
  514. }
  515. .time-coupon {
  516. margin: 10rpx 0rpx;
  517. font-size: 26rpx;
  518. justify-content: space-between;
  519. width: 100%;
  520. .flex {
  521. justify-content: center;
  522. align-items: center;
  523. }
  524. image {
  525. width: 25rpx;
  526. height: 25rpx;
  527. }
  528. .time {
  529. color: #B8B8B8;
  530. margin-left: 6rpx;
  531. }
  532. }
  533. .sales-volume {
  534. display: flex;
  535. align-items: center;
  536. color: #B8B8B8;
  537. font-size: 24rpx;
  538. image {
  539. width: 25rpx;
  540. height: 25rpx;
  541. }
  542. }
  543. }
  544. }
  545. .address {
  546. .address-top{
  547. display: flex;
  548. justify-content: space-between;
  549. align-items: center;
  550. image{
  551. width: 30rpx;
  552. height: 30rpx;
  553. }
  554. }
  555. .addressDetail {
  556. color: #777;
  557. font-size: 22rpx;
  558. padding: 5px 0;
  559. }
  560. text {
  561. background-color: #F29E45;
  562. padding: 8rpx 10rpx;
  563. color: #fff;
  564. font-size: 20rpx;
  565. margin-left: 10px;
  566. border-radius: 5px;
  567. }
  568. }
  569. .min_tips {
  570. font-size: 22rpx;
  571. color: #777;
  572. display: flex;
  573. justify-content: space-between;
  574. padding: 5px 0;
  575. align-items: center;
  576. }
  577. .current-price {
  578. font-size: 30rpx;
  579. color: #F29E45;
  580. }
  581. .line {
  582. border-top: 2px dotted #00000011;
  583. padding: 20rpx 0;
  584. .t {
  585. padding: 5px 0;
  586. color: #000;
  587. font-size: 26rpx;
  588. }
  589. }
  590. .head-div {
  591. .nickname {
  592. font-size: 30rpx;
  593. font-weight: 600;
  594. text-align: left;
  595. line-height: 42rpx;
  596. display: flex;
  597. align-items: center;
  598. .tag {
  599. position: relative;
  600. display: flex;
  601. align-items: center;
  602. image {
  603. height: 45rpx;
  604. width: 90rpx;
  605. vertical-align: middle;
  606. }
  607. .auth {
  608. position: absolute;
  609. white-space: nowrap;
  610. color: #FF6200;
  611. left: 23rpx;
  612. font-size: 17rpx;
  613. }
  614. }
  615. }
  616. .days {
  617. font-size: 20rpx;
  618. font-weight: 400;
  619. text-align: left;
  620. line-height: 56rpx;
  621. display: flex;
  622. align-items: center;
  623. view {
  624. padding-left: 5px;
  625. }
  626. }
  627. }
  628. .btn-x {
  629. color: #6fc6ad;
  630. border: 1px solid #6fc6ad;
  631. padding: 10rpx 20rpx;
  632. border-radius: 30rpx;
  633. }
  634. .btns {
  635. display: flex;
  636. justify-content: center;
  637. .btn {
  638. color: #6fc6ad;
  639. border: 1px solid #6fc6ad;
  640. padding: 10rpx 20rpx;
  641. border-radius: 30rpx;
  642. }
  643. }
  644. }
  645. </style>