refundOrder.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548
  1. <template>
  2. <view class="content">
  3. <view class="inner">
  4. <!-- 药品列表 -->
  5. <view class="drug-list">
  6. <view class="item">
  7. <!-- 药品信息 -->
  8. <view v-if="order!=null&&order.isPackage!=1" class="drug-info" v-for="(item,index) in items"
  9. :key="index">
  10. <view class="img-box">
  11. <image :src="JSON.parse(item.jsonInfo).image" mode="aspectFit"></image>
  12. </view>
  13. <view class="info">
  14. <view class="top">
  15. <view class="title ellipsis2">{{ JSON.parse(item.jsonInfo).productName}}</view>
  16. </view>
  17. <view class="price-num">
  18. <view class="price-box">
  19. <text class="unit">¥</text>
  20. <text class="price">{{JSON.parse(item.jsonInfo).price.toFixed(2)}}</text>
  21. </view>
  22. <view class="num">x{{JSON.parse(item.jsonInfo).num}}</view>
  23. </view>
  24. </view>
  25. </view>
  26. <view v-if="order!=null&&order.isPackage==1&&order.packageJson!=null" class="drug-info">
  27. <view class="img-box">
  28. <image :src="JSON.parse(order.packageJson).imgUrl" mode="aspectFit"></image>
  29. </view>
  30. <view class="info">
  31. <view class="top">
  32. <view class="title ellipsis2">
  33. <view class="tag">套餐</view>{{JSON.parse(order.packageJson).title}}
  34. </view>
  35. <view class="spec">{{JSON.parse(order.packageJson).descs}}</view>
  36. </view>
  37. </view>
  38. </view>
  39. </view>
  40. </view>
  41. <!-- 申请原因 -->
  42. <view class="reason-apply">
  43. <view class="title-box">
  44. <text class="label">退款金额</text>
  45. <input class="money" type="text" disabled v-model="refundAmount" placeholder="退款金额"
  46. placeholder-class="form-input" />
  47. </view>
  48. <view class="title-box">
  49. <text class="label">申请原因</text>
  50. <picker @change="reasonsChange" :value="reasons" range-key="dictLabel" :range="reasonsList">
  51. <view class="chose-box">
  52. <text class="text">{{reasons}}</text>
  53. <image src="/static/images/arrow_gray.png" mode=""></image>
  54. </view>
  55. </picker>
  56. </view>
  57. <view class="textarea-box">
  58. <textarea v-model="explains" placeholder="请描述申请售后服务的具体原因" placeholder-class="textarea-place" />
  59. </view>
  60. </view>
  61. <!-- 底部按钮 -->
  62. <view class="btn-box">
  63. <view class="sub-btn" @click="submit()">申请售后</view>
  64. </view>
  65. </view>
  66. </view>
  67. </template>
  68. <script>
  69. import {
  70. // Dicts,
  71. getStoreOrderItems, //获取订单项列表
  72. applyAfterSales, // 申请售后
  73. revoke //撤销售后
  74. } from '@/api/order.js'
  75. export default {
  76. data() {
  77. return {
  78. orderId: null,
  79. order: null,
  80. orderCode: null,
  81. items: [],
  82. type: null,
  83. reasonsList: [],
  84. reasons: "请选择",
  85. explains: "",
  86. refundAmount: 0.00,
  87. }
  88. },
  89. onLoad(option) {
  90. this.type = option.type;
  91. this.orderCode = option.orderCode;
  92. this.orderId = option.orderId;
  93. console.log(this.orderId);
  94. this.getStoreOrder()
  95. this.reasonsList=this.utils.getDict("storeAfterSalesReasons");
  96. // this.getDicts()
  97. },
  98. methods: {
  99. // getDicts() {
  100. // var data = {
  101. // key: "store_after_sales_reasons"
  102. // };
  103. // Dicts(data).then(res => {
  104. // if (res.code == 200) {
  105. // this.reasonsList=res.data
  106. // } else {
  107. // uni.showToast({
  108. // icon: 'none',
  109. // title: "请求失败",
  110. // });
  111. // }
  112. // });
  113. // },
  114. getStoreOrder() {
  115. var data = {
  116. orderId: this.orderId
  117. };
  118. getStoreOrderItems(data).then(res => {
  119. if (res.code == 200) {
  120. this.order = res.order;
  121. this.items = res.items;
  122. if (this.order.isPayRemain == 0) {
  123. this.refundAmount = this.order.totalPrice.toFixed(2)
  124. } else {
  125. this.refundAmount = this.order.totalPrice.toFixed(2)
  126. }
  127. } else {
  128. uni.showToast({
  129. icon: 'none',
  130. title: "请求失败",
  131. });
  132. }
  133. });
  134. },
  135. reasonsChange(e) {
  136. console.log(e.detail.value)
  137. this.reasons = this.reasonsList[e.detail.value].dictLabel
  138. },
  139. submit() {
  140. if (this.reasons == "请选择") {
  141. uni.showToast({
  142. icon: 'none',
  143. title: '请选择原因'
  144. });
  145. return;
  146. }
  147. if (this.refundAmount < 0) {
  148. uni.showToast({
  149. icon: 'none',
  150. title: '请输入退款金额'
  151. });
  152. return;
  153. }
  154. var productIds = this.items.map(item => item.productId);
  155. var products = [];
  156. for (var i = 0; i < productIds.length; i++) {
  157. var item = {
  158. productId: productIds[i]
  159. };
  160. products.push(item);
  161. }
  162. var data = {
  163. orderId:this.orderId,
  164. refundType:this.type,//0仅退款1退货退款
  165. refundAmount: this.refundAmount,
  166. orderCode: this.orderCode,
  167. reasons: this.reasons,
  168. explains: this.explains,
  169. productList: products
  170. };
  171. applyAfterSales(data).then(res => {
  172. if (res.code == 200) {
  173. uni.showToast({
  174. icon: 'success',
  175. title: '提交成功'
  176. });
  177. setTimeout(function() {
  178. uni.redirectTo({
  179. url: './order'
  180. })
  181. }, 500);
  182. } else {
  183. uni.showToast({
  184. icon: 'none',
  185. title: res.msg
  186. });
  187. }
  188. });
  189. },
  190. }
  191. }
  192. </script>
  193. <style lang="scss">
  194. .content {
  195. margin-bottom: 170upx;
  196. .inner {
  197. padding: 20upx;
  198. .drug-list {
  199. .item {
  200. background: #FFFFFF;
  201. border-radius: 16upx;
  202. margin-bottom: 20upx;
  203. padding: 0 30upx;
  204. .drug-info {
  205. display: flex;
  206. align-items: center;
  207. padding: 30upx 0;
  208. .img-box {
  209. width: 160upx;
  210. height: 160upx;
  211. margin-right: 30upx;
  212. image {
  213. width: 100%;
  214. height: 100%;
  215. }
  216. }
  217. .info {
  218. width: calc(100% - 160upx);
  219. height: 160upx;
  220. display: flex;
  221. flex-direction: column;
  222. justify-content: space-between;
  223. .top {
  224. .title {
  225. font-size: 28upx;
  226. font-family: PingFang SC;
  227. font-weight: 500;
  228. color: #111111;
  229. line-height: 1.4;
  230. .tag {
  231. display: inline-block;
  232. padding: 0 6upx;
  233. height: 30upx;
  234. background: linear-gradient(90deg, #66b2ef 0%, #0bb3f2 100%);
  235. border-radius: 4upx;
  236. margin-right: 10upx;
  237. font-size: 22upx;
  238. font-family: PingFang SC;
  239. font-weight: bold;
  240. color: #FFFFFF;
  241. line-height: 30upx;
  242. float: left;
  243. margin-top: 7upx;
  244. }
  245. }
  246. .spec {
  247. font-size: 24upx;
  248. font-family: PingFang SC;
  249. font-weight: 500;
  250. color: #999999;
  251. line-height: 1;
  252. margin-top: 14upx;
  253. }
  254. }
  255. .price-num {
  256. display: flex;
  257. align-items: center;
  258. justify-content: space-between;
  259. .price-box {
  260. display: flex;
  261. align-items: flex-end;
  262. .unit {
  263. font-size: 24upx;
  264. font-family: PingFang SC;
  265. font-weight: 500;
  266. color: #111111;
  267. line-height: 1.2;
  268. margin-right: 5upx;
  269. }
  270. .price {
  271. font-size: 32upx;
  272. font-family: PingFang SC;
  273. font-weight: 500;
  274. color: #111111;
  275. line-height: 1;
  276. }
  277. }
  278. .num {
  279. font-size: 24upx;
  280. font-family: PingFang SC;
  281. font-weight: bold;
  282. color: #666666;
  283. }
  284. }
  285. }
  286. }
  287. }
  288. }
  289. .reason-apply {
  290. margin-top: 20upx;
  291. background: #FFFFFF;
  292. border-radius: 16upx;
  293. padding: 0 30upx;
  294. .title-box {
  295. height: 86upx;
  296. display: flex;
  297. align-items: center;
  298. justify-content: space-between;
  299. border-bottom: 1px solid #F0F0F0;
  300. .label {
  301. font-size: 30upx;
  302. font-family: PingFang SC;
  303. font-weight: bold;
  304. color: #333333;
  305. }
  306. .money {
  307. font-size: 24upx;
  308. font-family: PingFang SC;
  309. font-weight: 500;
  310. color: #999999;
  311. }
  312. .chose-box {
  313. display: flex;
  314. align-items: center;
  315. .text {
  316. font-size: 24upx;
  317. font-family: PingFang SC;
  318. font-weight: 500;
  319. color: #999999;
  320. }
  321. image {
  322. width: 14upx;
  323. height: 24upx;
  324. margin-left: 10upx;
  325. }
  326. }
  327. }
  328. .textarea-box {
  329. padding: 30upx 0;
  330. textarea {
  331. width: 100%;
  332. box-sizing: border-box;
  333. background: #F5F5F5;
  334. border-radius: 16upx;
  335. padding: 30upx 20upx;
  336. font-size: 24upx;
  337. font-family: PingFang SC;
  338. font-weight: 500;
  339. color: #111111;
  340. }
  341. .textarea-place {
  342. font-size: 24upx;
  343. font-family: PingFang SC;
  344. font-weight: 500;
  345. color: #999999;
  346. }
  347. }
  348. }
  349. .return-method {
  350. background: #FFFFFF;
  351. border-radius: 16upx;
  352. margin-top: 20upx;
  353. padding: 0 30upx 40upx;
  354. .title-box {
  355. height: 86upx;
  356. display: flex;
  357. align-items: center;
  358. justify-content: space-between;
  359. border-bottom: 1px solid #F0F0F0;
  360. .text {
  361. font-size: 30upx;
  362. font-family: PingFang SC;
  363. font-weight: bold;
  364. color: #333333;
  365. }
  366. }
  367. .return-tips {
  368. margin-top: 30upx;
  369. margin-bottom: 30upx;
  370. height: 80upx;
  371. background: #FFF4E6;
  372. border-radius: 16upx;
  373. padding: 0 20upx;
  374. display: flex;
  375. align-items: center;
  376. .text {
  377. font-size: 24upx;
  378. font-family: PingFang SC;
  379. font-weight: 500;
  380. color: #EF8A07;
  381. }
  382. }
  383. .info-item {
  384. display: flex;
  385. align-items: center;
  386. justify-content: space-between;
  387. margin-bottom: 40upx;
  388. &:last-child {
  389. margin-bottom: 0;
  390. }
  391. .label {
  392. font-size: 26upx;
  393. font-family: PingFang SC;
  394. font-weight: 500;
  395. color: #666666;
  396. line-height: 1;
  397. }
  398. .text {
  399. font-size: 26upx;
  400. font-family: PingFang SC;
  401. font-weight: 500;
  402. color: #111111;
  403. line-height: 1;
  404. }
  405. .detail-box {
  406. display: flex;
  407. align-items: center;
  408. .price-box {
  409. display: flex;
  410. align-items: flex-end;
  411. margin-right: 18upx;
  412. .unit {
  413. font-size: 24upx;
  414. font-family: PingFang SC;
  415. font-weight: 500;
  416. color: #111111;
  417. line-height: 1.2;
  418. }
  419. .num {
  420. font-size: 32upx;
  421. font-family: PingFang SC;
  422. font-weight: bold;
  423. color: #111111;
  424. line-height: 1;
  425. }
  426. }
  427. .det-text {
  428. font-size: 26upx;
  429. font-family: PingFang SC;
  430. font-weight: 500;
  431. color: #111111;
  432. }
  433. image {
  434. width: 14upx;
  435. height: 24upx;
  436. margin-left: 10upx;
  437. }
  438. }
  439. }
  440. }
  441. }
  442. .reson-box {
  443. padding: 0 10upx 60upx;
  444. .reson-item {
  445. width: 100%;
  446. height: 110upx;
  447. display: flex;
  448. align-items: center;
  449. justify-content: space-between;
  450. .title {
  451. font-size: 30upx;
  452. font-family: PingFang SC;
  453. font-weight: 500;
  454. color: #111111;
  455. }
  456. }
  457. }
  458. }
  459. .btn-box {
  460. height: 120upx;
  461. padding: 0 30upx;
  462. display: flex;
  463. align-items: center;
  464. justify-content: center;
  465. .sub-btn {
  466. width: 100%;
  467. height: 88upx;
  468. line-height: 88upx;
  469. text-align: center;
  470. font-size: 30upx;
  471. font-family: PingFang SC;
  472. font-weight: bold;
  473. color: #FFFFFF;
  474. background: #0bb3f2;
  475. border-radius: 44upx;
  476. }
  477. }
  478. input {
  479. text-align: right;
  480. }
  481. .form-input {
  482. font-size: 30upx;
  483. font-family: PingFang SC;
  484. font-weight: 500;
  485. color: #999999;
  486. text-align: right;
  487. }
  488. </style>