storeOrderRefundSubmit.vue 10.0 KB

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