refundOrder.vue 12 KB

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