refundOrder.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506
  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" :key="index"> -->
  9. <view class="drug-info" v-for="(item,index) in items" :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{{item.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="退款金额" 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://zkzh-2025.oss-cn-beijing.aliyuncs.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="return-method">
  63. <view class="title-box">
  64. <text class="text">退货方式</text>
  65. <text class="text">用户发货</text>
  66. </view>
  67. <view class="return-tips">
  68. <text class="text">请您在审核通过后7天内,将商品发货到指定点</text>
  69. </view>
  70. <view class="info-item">
  71. <text class="label">联系人</text>
  72. <text class="text">张三 1572325612</text>
  73. </view>
  74. <view class="info-item">
  75. <text class="label">发货地址</text>
  76. <text class="text">重庆市江北区建玛特商场5楼</text>
  77. </view>
  78. </view> -->
  79. <!-- 底部按钮 -->
  80. <view class="btn-box">
  81. <view class="sub-btn" @click="submit()">申请售后</view>
  82. </view>
  83. </view>
  84. </view>
  85. </template>
  86. <script>
  87. import {applyAfterSales,getMyStoreOrderItemByOrderId} from '@/api/storeAfterSales'
  88. export default {
  89. data() {
  90. return {
  91. orderId:null,
  92. order:null,
  93. orderCode:null,
  94. items:[],
  95. type:null,
  96. reasonsList:[],
  97. reasons:"请选择",
  98. explains:"",
  99. // refundAmount:0.00,
  100. }
  101. },
  102. onLoad(option) {
  103. console.log(option);
  104. this.type=option.type;
  105. this.orderCode=option.orderCode;
  106. this.items=uni.getStorageSync('refundItems')
  107. console.log(uni.getStorageSync('refundItems'))
  108. console.log(JSON.parse(this.items[0].jsonInfo));
  109. this.reasonsList=this.utils.getDict("storeAfterSalesReasons");
  110. this.orderId=option.orderId;
  111. // this.getMyStoreOrderItemByOrderId()
  112. },
  113. computed:{
  114. refundAmount(){
  115. const counts = this.items.map(item=> {
  116. return{
  117. ...item,
  118. price:JSON.parse(item.jsonInfo).price*item.num
  119. }
  120. }
  121. );
  122. const count = counts.reduce((accumulator, item) => accumulator + item.price, 0);
  123. console.log(count)
  124. return count
  125. }
  126. },
  127. methods: {
  128. getMyStoreOrderItemByOrderId(){
  129. var data={orderId:this.orderId};
  130. getMyStoreOrderItemByOrderId(data).then(res => {
  131. if(res.code==200){
  132. this.order=res.order;
  133. this.items=res.items;
  134. if(this.order.isPayRemain==0){
  135. this.refundAmount=this.order.payMoney.toFixed(2)
  136. }
  137. else{
  138. this.refundAmount=this.order.payPrice.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 nums=this.items.map(item=>item.num);
  169. var products=[];
  170. for(var i=0;i<productIds.length;i++){
  171. var item={productId:productIds[i],num:nums[i]};
  172. products.push(item);
  173. }
  174. var data={refundAmount:this.refundAmount,orderCode:this.orderCode,serviceType:this.type,reasons:this.reasons,explains:this.explains,productList:products};
  175. applyAfterSales(data).then(res => {
  176. if(res.code==200){
  177. uni.showToast({
  178. icon:'success',
  179. title:'提交成功'
  180. });
  181. setTimeout(function() {
  182. uni.$emit('refreshOrder');
  183. uni.navigateBack({
  184. delta: 1
  185. })
  186. }, 500);
  187. }else{
  188. uni.showToast({
  189. icon:'none',
  190. title: res.msg
  191. });
  192. }
  193. });
  194. },
  195. }
  196. }
  197. </script>
  198. <style lang="scss">
  199. .content{
  200. margin-bottom: 170upx;
  201. .inner{
  202. padding: 20upx;
  203. .drug-list{
  204. .item{
  205. background: #FFFFFF;
  206. border-radius: 16upx;
  207. margin-bottom: 20upx;
  208. padding: 0 30upx;
  209. .drug-info{
  210. display: flex;
  211. align-items: center;
  212. padding: 30upx 0;
  213. .img-box{
  214. width: 160upx;
  215. height: 160upx;
  216. margin-right: 30upx;
  217. image{
  218. width: 100%;
  219. height: 100%;
  220. }
  221. }
  222. .info{
  223. width: calc(100% - 160upx);
  224. height: 160upx;
  225. display: flex;
  226. flex-direction: column;
  227. justify-content: space-between;
  228. .top{
  229. .title{
  230. font-size: 28upx;
  231. font-family: PingFang SC;
  232. font-weight: 500;
  233. color: #111111;
  234. line-height: 1.4;
  235. .tag{
  236. display: inline-block;
  237. padding: 0 6upx;
  238. height: 30upx;
  239. background: linear-gradient(90deg, #66b2ef 0%, #2BC7B9 100%);
  240. border-radius: 4upx;
  241. margin-right: 10upx;
  242. font-size: 22upx;
  243. font-family: PingFang SC;
  244. font-weight: bold;
  245. color: #FFFFFF;
  246. line-height: 30upx;
  247. float: left;
  248. margin-top: 7upx;
  249. }
  250. }
  251. .spec{
  252. font-size: 24upx;
  253. font-family: PingFang SC;
  254. font-weight: 500;
  255. color: #999999;
  256. line-height: 1;
  257. margin-top: 14upx;
  258. }
  259. }
  260. .price-num{
  261. display: flex;
  262. align-items: center;
  263. justify-content: space-between;
  264. .price-box{
  265. display: flex;
  266. align-items: flex-end;
  267. .unit{
  268. font-size: 24upx;
  269. font-family: PingFang SC;
  270. font-weight: 500;
  271. color: #111111;
  272. line-height: 1.2;
  273. margin-right: 5upx;
  274. }
  275. .price{
  276. font-size: 32upx;
  277. font-family: PingFang SC;
  278. font-weight: 500;
  279. color: #111111;
  280. line-height: 1;
  281. }
  282. }
  283. .num{
  284. font-size: 24upx;
  285. font-family: PingFang SC;
  286. font-weight: bold;
  287. color: #666666;
  288. }
  289. }
  290. }
  291. }
  292. }
  293. }
  294. .reason-apply{
  295. margin-top: 20upx;
  296. background: #FFFFFF;
  297. border-radius: 16upx;
  298. padding: 0 30upx;
  299. .title-box{
  300. height: 86upx;
  301. display: flex;
  302. align-items: center;
  303. justify-content: space-between;
  304. border-bottom: 1px solid #F0F0F0;
  305. .label{
  306. font-size: 30upx;
  307. font-family: PingFang SC;
  308. font-weight: bold;
  309. color: #333333;
  310. }
  311. .money{
  312. font-size: 24upx;
  313. font-family: PingFang SC;
  314. font-weight: 500;
  315. color: #999999;
  316. }
  317. .chose-box{
  318. display: flex;
  319. align-items: center;
  320. .text{
  321. font-size: 24upx;
  322. font-family: PingFang SC;
  323. font-weight: 500;
  324. color: #999999;
  325. }
  326. image{
  327. width: 14upx;
  328. height: 24upx;
  329. margin-left: 10upx;
  330. }
  331. }
  332. }
  333. .textarea-box{
  334. padding: 30upx 0;
  335. textarea{
  336. width: 100%;
  337. box-sizing: border-box;
  338. background: #F5F5F5;
  339. border-radius: 16upx;
  340. padding: 30upx 20upx;
  341. font-size: 24upx;
  342. font-family: PingFang SC;
  343. font-weight: 500;
  344. color: #111111;
  345. }
  346. .textarea-place{
  347. font-size: 24upx;
  348. font-family: PingFang SC;
  349. font-weight: 500;
  350. color: #999999;
  351. }
  352. }
  353. }
  354. .return-method{
  355. background: #FFFFFF;
  356. border-radius: 16upx;
  357. margin-top: 20upx;
  358. padding: 0 30upx 40upx;
  359. .title-box{
  360. height: 86upx;
  361. display: flex;
  362. align-items: center;
  363. justify-content: space-between;
  364. border-bottom: 1px solid #F0F0F0;
  365. .text{
  366. font-size: 30upx;
  367. font-family: PingFang SC;
  368. font-weight: bold;
  369. color: #333333;
  370. }
  371. }
  372. .return-tips{
  373. margin-top: 30upx;
  374. margin-bottom: 30upx;
  375. height: 80upx;
  376. background: #FFF4E6;
  377. border-radius: 16upx;
  378. padding: 0 20upx;
  379. display: flex;
  380. align-items: center;
  381. .text{
  382. font-size: 24upx;
  383. font-family: PingFang SC;
  384. font-weight: 500;
  385. color: #EF8A07;
  386. }
  387. }
  388. .info-item{
  389. display: flex;
  390. align-items: center;
  391. justify-content: space-between;
  392. margin-bottom: 40upx;
  393. &:last-child{
  394. margin-bottom: 0;
  395. }
  396. .label{
  397. font-size: 26upx;
  398. font-family: PingFang SC;
  399. font-weight: 500;
  400. color: #666666;
  401. line-height: 1;
  402. }
  403. .text{
  404. font-size: 26upx;
  405. font-family: PingFang SC;
  406. font-weight: 500;
  407. color: #111111;
  408. line-height: 1;
  409. }
  410. .detail-box{
  411. display: flex;
  412. align-items: center;
  413. .price-box{
  414. display: flex;
  415. align-items: flex-end;
  416. margin-right: 18upx;
  417. .unit{
  418. font-size: 24upx;
  419. font-family: PingFang SC;
  420. font-weight: 500;
  421. color: #111111;
  422. line-height: 1.2;
  423. }
  424. .num{
  425. font-size: 32upx;
  426. font-family: PingFang SC;
  427. font-weight: bold;
  428. color: #111111;
  429. line-height: 1;
  430. }
  431. }
  432. .det-text{
  433. font-size: 26upx;
  434. font-family: PingFang SC;
  435. font-weight: 500;
  436. color: #111111;
  437. }
  438. image{
  439. width: 14upx;
  440. height: 24upx;
  441. margin-left: 10upx;
  442. }
  443. }
  444. }
  445. }
  446. }
  447. .reson-box{
  448. padding: 0 10upx 60upx;
  449. .reson-item{
  450. width: 100%;
  451. height: 110upx;
  452. display: flex;
  453. align-items: center;
  454. justify-content: space-between;
  455. .title{
  456. font-size: 30upx;
  457. font-family: PingFang SC;
  458. font-weight: 500;
  459. color: #111111;
  460. }
  461. }
  462. }
  463. }
  464. .btn-box{
  465. height: 120upx;
  466. padding: 0 30upx;
  467. display: flex;
  468. align-items: center;
  469. justify-content: center;
  470. .sub-btn{
  471. width: 100%;
  472. height: 88upx;
  473. line-height: 88upx;
  474. text-align: center;
  475. font-size: 30upx;
  476. font-family: PingFang SC;
  477. font-weight: bold;
  478. color: #FFFFFF;
  479. background: #2BC7B9;
  480. border-radius: 44upx;
  481. }
  482. }
  483. input{
  484. text-align: right;
  485. }
  486. .form-input{
  487. font-size: 30upx;
  488. font-family: PingFang SC;
  489. font-weight: 500;
  490. color: #999999;
  491. text-align: right;
  492. }
  493. </style>