refundOrder.vue 11 KB

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