storeOrderRefundSubmit.vue 11 KB

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