refundDetails.vue 16 KB

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