refundOrder.vue 11 KB

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