applyRefund.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509
  1. <template>
  2. <view class="container">
  3. <view class="order-info">
  4. <image :src="orderInfo.hospitalVo.logoUrl" mode="aspectFill"></image>
  5. <view class="info-content">
  6. <span class="name">{{orderInfo.hospitalVo.name || '-'}}</span>
  7. <span class="address">
  8. <u-icon name="map" color="#999999" size="14"></u-icon>
  9. <span class="txt">{{orderInfo.hospitalVo.address || '-'}}</span>
  10. </span>
  11. <!-- <span class="area">所属区:{{orderInfo.hospitalVo.areaName || '-'}}</span> -->
  12. </view>
  13. </view>
  14. <view class="info-box">
  15. <view class="info-item">
  16. <span class="title">所在科室</span>
  17. <span class="txt">{{orderInfo.hospitalDepartmentName || '-'}}</span>
  18. </view>
  19. <u-line></u-line>
  20. <view class="info-item">
  21. <span class="title">房床号</span>
  22. <span class="txt">{{orderInfo.roomNumber || '-'}}</span>
  23. </view>
  24. <u-line></u-line>
  25. <view class="info-item info-item-spa">
  26. <span class="title">备注</span>
  27. <span class="txt">{{orderInfo.remarks || '-'}}</span>
  28. </view>
  29. </view>
  30. <view class="info-box">
  31. <view class="info-item">
  32. <span class="title">就诊人</span>
  33. <span class="txt">{{orderInfo.patientVo.name || '-'}}({{orderInfo.patientVo.mobile || '-'}})</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.serviceName || '-'}}</span>
  40. </view>
  41. <u-line></u-line>
  42. <view class="info-item">
  43. <span class="title">期望时间</span>
  44. <span class="txt">{{orderInfo.expectedTime || '-'}}</span>
  45. </view>
  46. </view>
  47. <!-- 基本信息 -->
  48. <view class="info-box">
  49. <span class="title-m">基本信息</span>
  50. <view class="info-item">
  51. <span class="title">订单号</span>
  52. <span class="txt">{{orderInfo.orderNo || '-'}}</span>
  53. </view>
  54. <u-line></u-line>
  55. <view class="info-item">
  56. <span class="title">下单时间</span>
  57. <span class="txt">{{orderInfo.createTime || '-'}}</span>
  58. </view>
  59. <u-line></u-line>
  60. <view class="info-item">
  61. <span class="title">下单数量</span>
  62. <span class="txt">{{orderInfo.orderNum || '-'}}({{ getUnitTxt(orderInfo.serviceUnit) }})</span>
  63. </view>
  64. <u-line></u-line>
  65. <view class="info-item">
  66. <span class="title">销售价格</span>
  67. <span class="txt">¥{{orderInfo.sellingPrice || "0.00"}}</span>
  68. </view>
  69. <u-line></u-line>
  70. <view class="info-item">
  71. <span class="title">应付金额</span>
  72. <span class="txt">¥{{orderInfo.totalPrice || "0.00"}}</span>
  73. </view>
  74. </view>
  75. <view class="info-box">
  76. <span class="title-m">退款信息</span>
  77. <view class="form-box">
  78. <u--form labelWidth="140rpx" :model="formData" :rules="rules" ref="uForm">
  79. <u-form-item label="退款原因" prop="refundReason" borderBottom @click="showReason = true" required>
  80. <u-input :border="none" disabled v-model="formData.refundReason" disabledColor="#ffffff"
  81. placeholder="请选择" inputAlign="right" />
  82. <u-icon slot="right" name="arrow-right" color="#999999"></u-icon>
  83. </u-form-item>
  84. <u-form-item label="退款数量" prop="refundQuantity" borderBottom required>
  85. <view class="switch-box">
  86. <u-number-box v-model="formData.refundQuantity" :max="orderInfo.orderNum"
  87. min="1"></u-number-box>
  88. </view>
  89. </u-form-item>
  90. <u-form-item label="退款金额" prop="refundAmount" borderBottom required>
  91. <u--input type="number" maxlength="9" v-model="formData.refundAmount"
  92. placeholder-class="input-placeholder" border="none" clearable placeholder="请输入"
  93. inputAlign="right"></u--input>
  94. </u-form-item>
  95. <u-form-item label="退款方式" prop="refundWayName" borderBottom>
  96. <u--input v-model="formData.refundWayName" placeholder-class="input-placeholder" border="none"
  97. clearable placeholder="请输入" disabled inputAlign="right"></u--input>
  98. </u-form-item>
  99. <u-form-item label="退款说明" prop="refundDesc" borderBottom labelPosition="top">
  100. <u--textarea v-model="formData.refundDesc" placeholder="请输入退款说明,非必填"
  101. height="200rpx"></u--textarea>
  102. </u-form-item>
  103. </u--form>
  104. </view>
  105. </view>
  106. <view class="footer-btn">
  107. <span class="btn" @click="submitForm">确认提交</span>
  108. </view>
  109. <u-action-sheet :show="showReason" :actions="reasonList" title="请选择性别" @close="showReason = false"
  110. @select="reasonSelect" safeAreaInsetBottom>
  111. </u-action-sheet>
  112. </view>
  113. </template>
  114. <script>
  115. import {
  116. dictData
  117. } from "@/api/home.js"
  118. import {
  119. getOrderDetail,
  120. getServiceUnit,
  121. } from '@/api/order.js'
  122. import {
  123. addAfterSaleOrder
  124. } from '@/api/hospital.js'
  125. export default {
  126. data() {
  127. return {
  128. unitList: [],
  129. orderInfo: {},
  130. orderId: '',
  131. showReason: false,
  132. formData: {
  133. refundReason: '',
  134. refundQuantity: 1,
  135. refundAmount: '',
  136. refundWay: '原路返回'
  137. },
  138. reasonList: [],
  139. rules: {
  140. refundReason: [{
  141. required: true,
  142. message: '请选择退款原因',
  143. trigger: ['blur', 'change'],
  144. }],
  145. // refundQuantity: [{
  146. // required: true,
  147. // message: '请输入退款数量',
  148. // trigger: ['blur', 'change'],
  149. // }],
  150. // refundAmount: [{
  151. // required: true,
  152. // message: '请输入退款金额',
  153. // trigger: ['blur', 'change'],
  154. // }],
  155. }
  156. }
  157. },
  158. //计算refundAmount
  159. computed: {
  160. refundAmount() {
  161. this.formData.refundAmount = this.formData.refundQuantity * this.orderInfo.sellingPrice;
  162. return this.formData.refundQuantity * this.orderInfo.sellingPrice;
  163. }
  164. },
  165. onReady() {
  166. this.$refs.uForm.setRules(this.rules);
  167. },
  168. onLoad(options) {
  169. if (options.id) {
  170. this.orderId = options.id;
  171. }
  172. this.getServiceUnit();
  173. this.getReasonList()
  174. this.getRefundMethod()
  175. },
  176. onShow() {
  177. this.getInfoById(this.orderId);
  178. },
  179. methods: {
  180. //获取退款原因
  181. getReasonList() {
  182. let that = this;
  183. dictData('reason_refund').then(res => {
  184. let data = res.data;
  185. data.forEach(item => {
  186. item.name = item.dictLabel
  187. })
  188. that.reasonList = data;
  189. }, err => {
  190. console.log(err);
  191. }).finally(() => {
  192. });
  193. },
  194. //获取退款方式
  195. getRefundMethod() {
  196. let that = this;
  197. dictData('refund_way').then(res => {
  198. let data = res.data;
  199. data.forEach(item => {
  200. item.name = item.dictLabel
  201. })
  202. that.formData.refundWay = data[0].dictValue;
  203. that.formData.refundWayName = data[0].name
  204. }, err => {
  205. console.log(err);
  206. }).finally(() => {
  207. });
  208. },
  209. reasonSelect(e) {
  210. this.formData.refundReason = e.dictValue;
  211. },
  212. getUnitTxt(value) {
  213. let obj = this.unitList.find(item => item.code == value);;
  214. return obj ? obj.value : ''
  215. },
  216. getInfoById(id) {
  217. let that = this;
  218. uni.showLoading({
  219. title: '加载中',
  220. mask: true,
  221. });
  222. getOrderDetail(id).then(res => {
  223. if (res.code == 200) {
  224. let data = res.data;
  225. that.orderInfo = data;
  226. }
  227. })
  228. .catch((err) => {
  229. console.log(err);
  230. })
  231. .finally(() => {
  232. uni.hideLoading();
  233. });
  234. },
  235. //查询单位
  236. getServiceUnit() {
  237. let that = this;
  238. getServiceUnit().then(res => {
  239. if (res.code == 200) {
  240. that.unitList = res.data.serviceUnit;
  241. }
  242. })
  243. .catch((err) => {
  244. console.log(err);
  245. })
  246. },
  247. submitForm() {
  248. console.log("formData", this.formData);
  249. this.$refs.uForm.validate().then((res) => {
  250. if (res) {
  251. this.formData.orderId = this.orderId;
  252. addAfterSaleOrder(this.formData).then(res => {
  253. uni.$u.toast('添加成功');
  254. setTimeout(() => {
  255. uni.navigateBack({
  256. delta: 1,
  257. });
  258. }, 1000)
  259. }, err => {
  260. console.log(err);
  261. }).finally(() => {
  262. });
  263. }
  264. })
  265. .catch((errors) => {
  266. console.log(",errors", errors);
  267. uni.$u.toast('校验失败');
  268. });
  269. },
  270. }
  271. }
  272. </script>
  273. <style scoped lang="scss">
  274. .container {
  275. padding: 20rpx 20rpx 200rpx;
  276. .order-info {
  277. display: flex;
  278. align-items: center;
  279. padding: 20rpx;
  280. background: #fff;
  281. border-radius: 10rpx;
  282. margin-bottom: 20rpx;
  283. image {
  284. width: 180rpx;
  285. height: 180rpx;
  286. border-radius: 10rpx;
  287. margin-right: 20rpx;
  288. }
  289. .info-content {
  290. display: flex;
  291. flex-direction: column;
  292. flex: 1;
  293. .name {
  294. word-break: break-all;
  295. font-size: 32rpx;
  296. color: #333;
  297. font-weight: bold;
  298. }
  299. .address {
  300. font-size: 28rpx;
  301. color: #666;
  302. margin-top: 20rpx;
  303. width: 100%;
  304. font-weight: 500;
  305. line-height: 35rpx;
  306. display: flex;
  307. justify-content: flex-start;
  308. align-items: flex-start;
  309. overflow: hidden; //超出的文本隐藏
  310. text-overflow: ellipsis; //溢出用省略号显示
  311. white-space: normal; //处理元素中的 空白
  312. display: -webkit-box;
  313. -webkit-line-clamp: 2;
  314. -webkit-box-orient: vertical;
  315. display: -moz-box;
  316. -moz-line-clamp: 2;
  317. -moz-box-orient: vertical;
  318. overflow-wrap: break-word;
  319. word-break: break-all;
  320. ::v-deep .u-icon {
  321. display: inline-block;
  322. }
  323. .txt {
  324. margin-left: 15rpx;
  325. }
  326. }
  327. .area {
  328. font-size: 28rpx;
  329. color: #666;
  330. margin-top: 10rpx;
  331. }
  332. }
  333. }
  334. .info-box {
  335. padding: 20rpx;
  336. background: #fff;
  337. border-radius: 10rpx;
  338. margin-bottom: 20rpx;
  339. .info-item {
  340. display: flex;
  341. justify-content: space-between;
  342. align-items: center;
  343. padding: 30rpx 0;
  344. .title {
  345. width: 250rpx;
  346. font-size: 28rpx;
  347. color: #333;
  348. }
  349. .txt {
  350. /* flex: 1; */
  351. max-width: 540rpx;
  352. text-align: left;
  353. font-size: 28rpx;
  354. color: #757575;
  355. }
  356. }
  357. .info-item-spa {
  358. align-items: flex-start;
  359. flex-direction: column;
  360. .txt {
  361. margin-left: 0;
  362. margin-top: 20rpx;
  363. text-align: left;
  364. }
  365. }
  366. .tip-txt {
  367. padding: 30rpx 0;
  368. font-size: 28rpx;
  369. color: #333;
  370. }
  371. }
  372. .title-m {
  373. /* 竖线和文字对齐 */
  374. display: flex;
  375. align-items: center;
  376. padding: 20rpx 0;
  377. font-size: 28rpx;
  378. color: #333;
  379. font-weight: bold;
  380. line-height: 28rpx;
  381. /* 左边加一个竖线 */
  382. &::before {
  383. content: '';
  384. display: inline-block;
  385. width: 6rpx;
  386. height: 30rpx;
  387. background: #4B91D1;
  388. margin-right: 10rpx;
  389. }
  390. }
  391. .form-box {
  392. padding: 20rpx;
  393. background-color: #fff;
  394. ::v-deep .u-input {
  395. padding: 15rpx !important;
  396. }
  397. ::v-deep .u-upload {
  398. margin-top: 15rpx;
  399. }
  400. .upload-box {
  401. margin-top: 20rpx;
  402. .name-box {
  403. display: flex;
  404. align-items: center;
  405. margin-top: 20rpx;
  406. .btn {
  407. padding: 10rpx 20rpx;
  408. background-color: #4B91D1;
  409. color: #fff;
  410. border-radius: 10rpx;
  411. margin-left: 20rpx;
  412. border: 1rpx solid #4B91D1;
  413. }
  414. .btn2 {
  415. background-color: #fff;
  416. color: #FF0000;
  417. border: 1rpx solid #FF0000;
  418. }
  419. }
  420. }
  421. .switch-box {
  422. display: flex;
  423. align-items: center;
  424. justify-content: flex-end;
  425. padding: 20rpx 0;
  426. .name {
  427. margin-right: 20rpx;
  428. font-size: 30rpx;
  429. }
  430. }
  431. }
  432. .footer-btn {
  433. position: fixed;
  434. bottom: 0;
  435. left: 0;
  436. width: 100%;
  437. padding: 50rpx 30rpx;
  438. box-sizing: border-box;
  439. font-size: 28rpx;
  440. background-color: #fff;
  441. box-shadow: 0 -2rpx 30rpx #c5c5c53a;
  442. .btn {
  443. display: block;
  444. width: 100%;
  445. padding: 20rpx 0;
  446. border: 1rpx solid #4B91D1;
  447. background-color: #4B91D1;
  448. border-radius: 40rpx;
  449. color: #fff;
  450. text-align: center;
  451. }
  452. }
  453. }
  454. </style>