orderDetails.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793
  1. <template>
  2. <view class="container" :class="{disableScroll:disableScroll}">
  3. <view class="info-box order-status">
  4. <view class="status-text">
  5. <span class="status">订单状态:{{getStatusTxt(orderInfo.status)}}</span>
  6. <span v-if="orderInfo.hasRefund">(有退款)</span>
  7. </view>
  8. <view class="refund-btn" v-if="orderInfo.hasRefund" @click="viewRefund">查看退款信息</view>
  9. </view>
  10. <view class="order-info">
  11. <image :src="orderInfo.hospitalVo.logoUrl" mode="aspectFill"></image>
  12. <view class="info-content">
  13. <span class="name">{{orderInfo.hospitalVo.name || '-'}}</span>
  14. <span class="address">
  15. <u-icon name="map" color="#999999" size="14"></u-icon>
  16. <span class="txt">{{orderInfo.hospitalVo.address || '-'}}</span>
  17. </span>
  18. <!-- <span class="area">所属区:{{orderInfo.hospitalVo.areaName || '-'}}</span> -->
  19. </view>
  20. </view>
  21. <view class="info-box">
  22. <view class="info-item">
  23. <span class="title">所在科室</span>
  24. <span class="txt">{{orderInfo.hospitalDepartmentName || '-'}}</span>
  25. </view>
  26. <u-line></u-line>
  27. <view class="info-item">
  28. <span class="title">房床号</span>
  29. <span class="txt">{{orderInfo.roomNumber || '-'}}</span>
  30. </view>
  31. <u-line></u-line>
  32. <view class="info-item info-item-spa">
  33. <span class="title">备注</span>
  34. <span class="txt">{{orderInfo.remarks || '-'}}</span>
  35. </view>
  36. </view>
  37. <view class="info-box">
  38. <view class="info-item">
  39. <span class="title">就诊人</span>
  40. <span class="txt">{{orderInfo.patientVo.name || '-'}}({{orderInfo.patientVo.mobile || '-'}})</span>
  41. </view>
  42. </view>
  43. <view class="info-box">
  44. <view class="info-item">
  45. <span class="title">服务产品</span>
  46. <span class="txt">{{orderInfo.serviceName || '-'}}</span>
  47. </view>
  48. <u-line></u-line>
  49. <view class="info-item">
  50. <span class="title">期望时间</span>
  51. <span class="txt">{{orderInfo.expectedTime || '-'}}</span>
  52. </view>
  53. </view>
  54. <!-- 基本信息 -->
  55. <view class="info-box">
  56. <span class="title-m">基本信息</span>
  57. <view class="info-item">
  58. <span class="title">订单号</span>
  59. <span class="txt">{{orderInfo.orderNo || '-'}}</span>
  60. </view>
  61. <u-line></u-line>
  62. <view class="info-item">
  63. <span class="title">下单时间</span>
  64. <span class="txt">{{orderInfo.createTime || '-'}}</span>
  65. </view>
  66. <u-line></u-line>
  67. <view class="info-item">
  68. <span class="title">下单数量</span>
  69. <span class="txt">{{orderInfo.orderNum || '-'}}({{ getUnitTxt(orderInfo.serviceUnit) }})</span>
  70. </view>
  71. <u-line></u-line>
  72. <view class="info-item">
  73. <span class="title">销售价格</span>
  74. <span class="txt">¥{{orderInfo.sellingPrice || "0.00"}}</span>
  75. </view>
  76. <u-line></u-line>
  77. <view class="info-item">
  78. <span class="title">应付金额</span>
  79. <span class="txt">¥{{orderInfo.totalPrice || "0.00"}}</span>
  80. </view>
  81. </view>
  82. <!-- 护工信息 -->
  83. <view class="info-box">
  84. <span class="title-m">护工信息</span>
  85. <view class="info-item">
  86. <span class="title">姓名</span>
  87. <span class="txt">{{orderInfo.orderWorkerChangeRecord.workerName || '-'}}</span>
  88. </view>
  89. <!-- <u-line></u-line>
  90. <view class="info-item">
  91. <span class="title">电话</span>
  92. <span class="txt">{{orderInfo.createTime || '-'}}</span>
  93. </view> -->
  94. <u-line></u-line>
  95. <view class="info-item">
  96. <span class="title">性别</span>
  97. <span class="txt">{{orderInfo.orderWorkerChangeRecord.sex == 1 ? '男' : '女' || '-'}}</span>
  98. </view>
  99. </view>
  100. <!-- 服务信息 -->
  101. <view class="info-box" v-if="orderInfo.status != '1' || orderInfo.status != '2'">
  102. <span class="title-m">服务信息</span>
  103. <view class="info-item">
  104. <span class="title">开始时间</span>
  105. <span class="txt">{{orderInfo.orderWorkerChangeRecord.workerStartTime || '-'}}</span>
  106. </view>
  107. <u-line></u-line>
  108. <view class="info-item">
  109. <span class="title">完成时间</span>
  110. <span class="txt">{{orderInfo.orderWorkerChangeRecord.workerEndTime || '-'}}</span>
  111. </view>
  112. </view>
  113. <!-- 评价信息 -->
  114. <view class="info-box" v-if="orderInfo.status == '5'">
  115. <span class="title-m">评价信息</span>
  116. <view class="info-item">
  117. <span class="title">服务态度</span>
  118. <u-rate :count="count" v-model="orderInfo.orderReviews.serviceAttitude"></u-rate>
  119. </view>
  120. <u-line></u-line>
  121. <view class="info-item">
  122. <span class="title">着装仪态</span>
  123. <u-rate :count="count" v-model="orderInfo.orderReviews.dressAppearance"></u-rate>
  124. </view>
  125. <u-line></u-line>
  126. <view class="info-item">
  127. <span class="title">沟通能力</span>
  128. <u-rate :count="count" v-model="orderInfo.orderReviews.communicationAbility"></u-rate>
  129. </view>
  130. <u-line></u-line>
  131. <view class="tip-txt">
  132. 文字评价:{{orderInfo.orderReviews.content}}
  133. </view>
  134. </view>
  135. <!-- 底部按钮 -->
  136. <view class="footer-box" v-if="orderInfo.status !=5 || orderInfo.status !=6">
  137. <view class="btn-box">
  138. <!-- 待确认 -->
  139. <span class="btn " v-if="orderInfo.status == 1" @click.stop="cancleOrder(orderInfo.id)">取消订单</span>
  140. <!-- 待服务 -->
  141. <template v-if="orderInfo.status == 2 || orderInfo.status == 3">
  142. <span class="btn" @click.stop="apllyRefund(orderInfo.id)">申请退款</span>
  143. <span class="btn btn1" @click.stop="contactPerson(orderInfo.id)">联系护工</span>
  144. </template>
  145. <!-- 待评价 -->
  146. <span class="btn btn1" v-if="orderInfo.status == 4" @click.stop="evaluateShow = true">去评价</span>
  147. </view>
  148. </view>
  149. <!-- 评价 -->
  150. <u-popup :overlayStyle="{'touch-action':'none'}" closeable mode="bottom" :show="evaluateShow"
  151. @close="evaluateClose" @open="evaluateOpen" :round="20">
  152. <view class="pop-box">
  153. <view class="pop-title">订单评价</view>
  154. <view class="pop-content">
  155. <view class="info-item">
  156. <span class="title">服务态度</span>
  157. <u-rate :count="count" size="20" v-model="evaluateInfo.serviceAttitude"></u-rate>
  158. </view>
  159. <u-line></u-line>
  160. <view class="info-item">
  161. <span class="title">着装仪态</span>
  162. <u-rate :count="count" size="20" v-model="evaluateInfo.dressAppearance"></u-rate>
  163. </view>
  164. <u-line></u-line>
  165. <view class="info-item">
  166. <span class="title">沟通能力</span>
  167. <u-rate :count="count" size="20" v-model="evaluateInfo.communicationAbility"></u-rate>
  168. </view>
  169. <u-line></u-line>
  170. <view class="tip-txt">
  171. <span class="name">文字评价</span>
  172. <u--textarea v-model="evaluateInfo.content" placeholder="请输入内容"></u--textarea>
  173. </view>
  174. </view>
  175. <view class="footer-btn">
  176. <span class="btn" @click="confirmEvaluate">确认提交</span>
  177. </view>
  178. </view>
  179. </u-popup>
  180. <!-- 联系护工 -->
  181. <u-popup :overlayStyle="{'touch-action':'none'}" closeable mode="bottom" :show="popShow" @close="popClose"
  182. @open="open" :round="20">
  183. <view class="pop-box">
  184. <view class="pop-title">联系护工</view>
  185. <view class="pop-content">
  186. <view class="pop-item" v-for="item,index in workerList" :key="index"
  187. @click="confirmAndCall(item.phoneNumber)">
  188. <u-icon name="phone" color="#fff"></u-icon>
  189. <span class="txt">{{item.phoneNumber || '-'}}</span>
  190. </view>
  191. </view>
  192. <view class="pop-footer-btn">
  193. <span class="btn" @click="popClose()">取消</span>
  194. </view>
  195. </view>
  196. </u-popup>
  197. </view>
  198. </template>
  199. <script>
  200. import {
  201. getOrderDetail,
  202. getServiceUnit,
  203. getOrderStatus,
  204. cancelOrder,
  205. getServicePhoneList,
  206. evaluateOrder
  207. } from '@/api/order.js'
  208. export default {
  209. components: {},
  210. data() {
  211. return {
  212. evaluateShow: '',
  213. count: 5,
  214. value: 3,
  215. orderInfo: {
  216. serviceUnit: ''
  217. },
  218. typeList: [],
  219. couponList: [],
  220. disableScroll: false,
  221. timer: null,
  222. unitList: [],
  223. orderId: '',
  224. evaluateInfo: {
  225. content: '',
  226. serviceAttitude: 0,
  227. dressAppearance: 0,
  228. communicationAbility: 0,
  229. },
  230. workerList: [],
  231. popShow: false,
  232. }
  233. },
  234. onLoad(options) {
  235. if (options.id) {
  236. this.orderId = options.id;
  237. }
  238. this.getOrderStatus();
  239. this.getServiceUnit();
  240. },
  241. onShow() {
  242. // this.getOrderStatus();
  243. this.getInfoById(this.orderId);
  244. },
  245. onUnload() {
  246. // 当页面关闭或卸载时清除定时器
  247. },
  248. methods: {
  249. evaluateOpen() {
  250. this.evaluateShow = true;
  251. },
  252. evaluateClose() {
  253. this.evaluateShow = false;
  254. },
  255. getStatusTxt(value) {
  256. let obj = this.typeList.find(item => item.code == value);;
  257. return obj ? obj.value : '待确认'
  258. },
  259. getUnitTxt(value) {
  260. let obj = this.unitList.find(item => item.code == value);;
  261. return obj ? obj.value : ''
  262. },
  263. //查询订单状态
  264. getOrderStatus() {
  265. let that = this;
  266. getOrderStatus().then(res => {
  267. if (res.code == 200) {
  268. let data = res.data.orderStatus;
  269. data.unshift({
  270. value: '全部',
  271. code: '',
  272. })
  273. this.typeList = data;
  274. }
  275. })
  276. .catch((err) => {
  277. console.log(err);
  278. })
  279. },
  280. //查询单位
  281. getServiceUnit() {
  282. let that = this;
  283. getServiceUnit().then(res => {
  284. if (res.code == 200) {
  285. this.unitList = res.data.serviceUnit;
  286. }
  287. })
  288. .catch((err) => {
  289. console.log(err);
  290. })
  291. },
  292. //查看退款信息
  293. viewRefund() {
  294. let id = this.orderInfo.refundList[0].id;
  295. uni.navigateTo({
  296. url: '/pages/order/refundDetails?id=' + id
  297. })
  298. },
  299. getInfoById(id) {
  300. let that = this;
  301. uni.showLoading({
  302. title: '加载中',
  303. mask: true,
  304. });
  305. getOrderDetail(id).then(res => {
  306. if (res.code == 200) {
  307. let data = res.data;
  308. this.orderInfo = data;
  309. }
  310. })
  311. .catch((err) => {
  312. console.log(err);
  313. })
  314. .finally(() => {
  315. uni.hideLoading();
  316. });
  317. },
  318. //取消订单
  319. cancleOrder(id) {
  320. //确认是否删除
  321. uni.showModal({
  322. title: '提示',
  323. content: '确定取消订单吗?',
  324. success: (res) => {
  325. if (res.confirm) {
  326. console.log('用户点击确定');
  327. cancelOrder(id).then(res => {
  328. if (res.code == 200) {
  329. uni.showToast({
  330. title: '取消成功',
  331. icon: 'success'
  332. })
  333. this.getInfoById(this.orderId);
  334. }
  335. })
  336. } else if (res.cancel) {
  337. console.log('用户点击取消');
  338. }
  339. },
  340. })
  341. },
  342. //申请退款
  343. apllyRefund(id) {
  344. uni.navigateTo({
  345. url: '/pages/order/applyRefund?id=' + id
  346. })
  347. },
  348. confirmAndCall(phoneNumber) {
  349. // 先验证电话号码
  350. if (!this.isValidPhoneNumber(phoneNumber)) {
  351. uni.showToast({
  352. title: '电话号码格式不正确',
  353. icon: 'none'
  354. });
  355. return;
  356. }
  357. // 显示确认对话框
  358. uni.showModal({
  359. title: '确认拨打电话',
  360. content: `确定要拨打 ${phoneNumber} 吗?`,
  361. success: (res) => {
  362. if (res.confirm) {
  363. // 用户点击确定,执行拨打电话
  364. this.makePhoneCall(phoneNumber);
  365. }
  366. }
  367. });
  368. },
  369. isValidPhoneNumber(phoneNumber) {
  370. // 简单的电话号码验证
  371. return /^1[3-9]\d{9}$/.test(phoneNumber);
  372. },
  373. makePhoneCall(phoneNumber) {
  374. uni.makePhoneCall({
  375. phoneNumber: phoneNumber,
  376. success: () => {
  377. console.log('拨打电话成功');
  378. },
  379. fail: (err) => {
  380. console.error('拨打电话失败', err);
  381. uni.showToast({
  382. title: '拨打电话失败',
  383. icon: 'none'
  384. });
  385. }
  386. });
  387. },
  388. //联系护工
  389. contactPerson(item) {
  390. this.open()
  391. },
  392. open() {
  393. let that = this;
  394. getServicePhoneList().then(res => {
  395. if (res.code == 200) {
  396. let data = res.data;
  397. this.workerList = data;
  398. this.popShow = true;
  399. }
  400. })
  401. .catch((err) => {
  402. console.log(err);
  403. })
  404. },
  405. popClose() {
  406. this.popShow = false;
  407. },
  408. // 评价订单
  409. confirmEvaluate() {
  410. if (!this.evaluateInfo.content) {
  411. uni.showToast({
  412. title: '请填写内容',
  413. icon: 'none'
  414. });
  415. return
  416. }
  417. let that = this;
  418. uni.showLoading({
  419. title: '评价中',
  420. mask: true,
  421. });
  422. that.evaluateInfo.orderId = that.orderId
  423. evaluateOrder(that.evaluateInfo).then(res => {
  424. if (res.code == 200) {
  425. let data = res.data;
  426. that.evaluateInfo = {
  427. content: '',
  428. serviceAttitude: 0,
  429. dressAppearance: 0,
  430. communicationAbility: 0,
  431. }
  432. that.evaluateClose()
  433. that.getInfoById(that.orderId)
  434. }
  435. })
  436. .catch((err) => {
  437. console.log(err);
  438. })
  439. .finally(() => {
  440. uni.hideLoading();
  441. });
  442. },
  443. //下拉刷新回调函数
  444. onPullDownRefresh() {
  445. this.getInfoById(this.orderId);
  446. setTimeout(function() {
  447. uni.stopPullDownRefresh();
  448. }, 1000);
  449. },
  450. },
  451. }
  452. </script>
  453. <style lang='scss' scoped>
  454. .container {
  455. padding: 20rpx 20rpx 200rpx;
  456. .order-status {
  457. display: flex;
  458. justify-content: space-between;
  459. align-items: center;
  460. padding: 40rpx 20rpx !important;
  461. .status-text {
  462. /* text-align: center; */
  463. font-weight: bold;
  464. font-size: 30rpx;
  465. color: #333;
  466. }
  467. .refund-btn {
  468. font-size: 28rpx;
  469. color: #4B91D1;
  470. }
  471. }
  472. .order-info {
  473. display: flex;
  474. align-items: center;
  475. padding: 20rpx;
  476. background: #fff;
  477. border-radius: 10rpx;
  478. margin-bottom: 20rpx;
  479. image {
  480. width: 180rpx;
  481. height: 180rpx;
  482. border-radius: 10rpx;
  483. margin-right: 20rpx;
  484. }
  485. .info-content {
  486. display: flex;
  487. flex-direction: column;
  488. flex: 1;
  489. .name {
  490. word-break: break-all;
  491. font-size: 32rpx;
  492. color: #333;
  493. font-weight: bold;
  494. }
  495. .address {
  496. font-size: 28rpx;
  497. color: #666;
  498. margin-top: 20rpx;
  499. width: 100%;
  500. font-weight: 500;
  501. line-height: 35rpx;
  502. display: flex;
  503. justify-content: flex-start;
  504. align-items: flex-start;
  505. overflow: hidden; //超出的文本隐藏
  506. text-overflow: ellipsis; //溢出用省略号显示
  507. white-space: normal; //处理元素中的 空白
  508. display: -webkit-box;
  509. -webkit-line-clamp: 2;
  510. -webkit-box-orient: vertical;
  511. display: -moz-box;
  512. -moz-line-clamp: 2;
  513. -moz-box-orient: vertical;
  514. overflow-wrap: break-word;
  515. word-break: break-all;
  516. ::v-deep .u-icon {
  517. display: inline-block;
  518. }
  519. .txt {
  520. margin-left: 15rpx;
  521. }
  522. }
  523. .area {
  524. font-size: 28rpx;
  525. color: #666;
  526. margin-top: 10rpx;
  527. }
  528. }
  529. }
  530. .info-box {
  531. padding: 20rpx;
  532. background: #fff;
  533. border-radius: 10rpx;
  534. margin-bottom: 20rpx;
  535. .info-item {
  536. display: flex;
  537. justify-content: space-between;
  538. align-items: center;
  539. padding: 30rpx 0;
  540. .title {
  541. width: 250rpx;
  542. font-size: 28rpx;
  543. color: #333;
  544. }
  545. .txt {
  546. /* flex: 1; */
  547. max-width: 540rpx;
  548. text-align: left;
  549. font-size: 28rpx;
  550. color: #757575;
  551. }
  552. }
  553. .info-item-spa {
  554. align-items: flex-start;
  555. flex-direction: column;
  556. .txt {
  557. margin-left: 0;
  558. margin-top: 20rpx;
  559. text-align: left;
  560. }
  561. }
  562. .tip-txt {
  563. padding: 30rpx 0;
  564. font-size: 28rpx;
  565. color: #333;
  566. }
  567. }
  568. .title-m {
  569. /* 竖线和文字对齐 */
  570. display: flex;
  571. align-items: center;
  572. padding: 20rpx 0;
  573. font-size: 28rpx;
  574. color: #333;
  575. font-weight: bold;
  576. line-height: 28rpx;
  577. /* 左边加一个竖线 */
  578. &::before {
  579. content: '';
  580. display: inline-block;
  581. width: 6rpx;
  582. height: 30rpx;
  583. background: #4B91D1;
  584. margin-right: 10rpx;
  585. }
  586. }
  587. .footer-box {
  588. position: fixed;
  589. bottom: 0;
  590. left: 0;
  591. width: 100%;
  592. padding: 50rpx 30rpx;
  593. box-sizing: border-box;
  594. font-size: 28rpx;
  595. background-color: #fff;
  596. box-shadow: 0 -2rpx 30rpx #c5c5c53a;
  597. .btn-box {
  598. display: flex;
  599. align-items: center;
  600. justify-content: flex-end;
  601. .btn {
  602. width: 170rpx;
  603. height: 60rpx;
  604. margin-left: 20rpx;
  605. line-height: 60rpx;
  606. text-align: center;
  607. background-color: #fff;
  608. border: 1rpx solid #4B91D1;
  609. color: #4B91D1;
  610. border-radius: 30rpx;
  611. font-size: 24rpx;
  612. margin-left: 30rpx;
  613. }
  614. .btn1 {
  615. background-color: #00aa00;
  616. border: 1rpx solid #00aa00;
  617. color: #fff;
  618. }
  619. .btn2 {
  620. background-color: #4B91D1;
  621. border: 1rpx solid #4B91D1;
  622. color: #fff;
  623. }
  624. }
  625. }
  626. }
  627. .pop-box {
  628. .pop-title {
  629. font-size: 32rpx;
  630. font-weight: bold;
  631. text-align: center;
  632. padding: 20rpx 0;
  633. }
  634. .pop-content {
  635. display: flex;
  636. flex-direction: column;
  637. align-items: center;
  638. margin-top: 30rpx;
  639. font-size: 28rpx;
  640. color: #6F6F6F;
  641. padding: 0 20rpx;
  642. .info-item {
  643. display: flex;
  644. justify-content: space-between;
  645. padding: 20rpx 0;
  646. width: 100%;
  647. }
  648. .tip-txt {
  649. display: flex;
  650. flex-direction: column;
  651. padding: 20rpx 0;
  652. width: 100%;
  653. .name {
  654. margin-bottom: 20rpx;
  655. }
  656. }
  657. &>view {
  658. margin-bottom: 20rpx;
  659. &:last-child {
  660. margin-bottom: 0;
  661. }
  662. }
  663. .pop-item {
  664. display: flex;
  665. align-items: center;
  666. justify-content: center;
  667. width: 500rpx;
  668. padding: 20rpx 0;
  669. background-color: #4B91D1;
  670. border-radius: 40rpx;
  671. color: #fff;
  672. .txt {
  673. font-size: 28rpx;
  674. }
  675. }
  676. }
  677. .footer-btn {
  678. display: flex;
  679. flex-direction: column;
  680. align-items: center;
  681. margin-top: 30rpx;
  682. padding: 20rpx;
  683. .btn {
  684. width: 100%;
  685. padding: 20rpx 0;
  686. border: 1rpx solid #4B91D1;
  687. background-color: #4B91D1;
  688. border-radius: 40rpx;
  689. color: #fff;
  690. text-align: center;
  691. }
  692. }
  693. .pop-footer-btn {
  694. display: flex;
  695. flex-direction: column;
  696. align-items: center;
  697. margin-top: 60rpx;
  698. .btn {
  699. width: 500rpx;
  700. padding: 20rpx 0;
  701. border: 1rpx solid #4B91D1;
  702. border-radius: 40rpx;
  703. color: #333;
  704. text-align: center;
  705. }
  706. }
  707. }
  708. </style>