refundOrder.vue 12 KB

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