refundOrder.vue 12 KB

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