refundOrder.vue 12 KB

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