refundOrder.vue 12 KB

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