orderDetails.vue 16 KB

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