refund.vue 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372
  1. <template>
  2. <view class="content">
  3. <template v-if="loading">
  4. <view class="skeleton">
  5. <view class="skeleton-line max animate" style="height: 200upx;"></view>
  6. <view class="skeleton-line animate"></view>
  7. <view class="skeleton-line min animate"></view>
  8. <view class="skeleton-line min animate"></view>
  9. <view class="skeleton-line max animate" style="height: 200upx;"></view>
  10. <view class="skeleton-line max animate" style="height: 200upx;"></view>
  11. </view>
  12. </template>
  13. <template v-else>
  14. <scroll-view class="goods-body" scroll-y scroll-with-animation>
  15. <view class="order-body">
  16. <view class="item-goods">
  17. <view class="item-goods-body">
  18. <view class="image">
  19. <image :src="orderData.img"></image>
  20. </view>
  21. <view class="info">
  22. <view class="title">
  23. <view class="name" v-if="goodsData.is_new == 1">{{goodsData.price}}元代{{goodsData.line_price}}元商场权益券{{ goodsData.product_name }}</view>
  24. <view class="name" v-else>{{ goodsData.product_name }}</view>
  25. <view class="num">x{{ orderData.number }}</view>
  26. </view>
  27. <view class="tags">
  28. {{orderData.sku_name?orderData.sku_name:'默认'}}
  29. <view class="price">{{ $dialog.formatMoney(orderData.price,true) }}</view>
  30. </view>
  31. <view class="price-right">实付 <text>{{ $dialog.formatMoney(orderData.pay_money,true) }}</text></view>
  32. </view>
  33. </view>
  34. </view>
  35. <view class="order-info">
  36. <view class="info-item">
  37. <view class="name">订单编号</view>
  38. <view class="right">{{ orderData.out_order_no }}</view>
  39. </view>
  40. <view class="info-item" @click="refundMsg">
  41. <view class="name">退款原因<text class="red">*</text></view>
  42. <view class="right">
  43. {{refundMsgText?refundMsgText:'请至少选择1项'}}
  44. <view class="icon"><image src="/static/image/right.svg"></image></view>
  45. </view>
  46. </view>
  47. <view class="info-item">
  48. <view class="name">退款金额</view>
  49. <view class="right red">{{ $dialog.formatMoney(orderData.pay_money,true) }}</view>
  50. </view>
  51. <view class="info-item">
  52. <view class="name">退款路径<text>*</text></view>
  53. <view class="right">
  54. <radio-group @change="radioChange">
  55. <view class="flex-radio">
  56. <label class="uni-list-cell uni-list-cell-pd" v-for="(item, index) in items" :key="item.value">
  57. <view>
  58. <radio :value="item.value" style="transform: scale(0.7);" :checked="index === current" />
  59. </view>
  60. <view>{{item.name}}</view>
  61. </label>
  62. </view>
  63. </radio-group>
  64. </view>
  65. </view>
  66. <template v-if="itemsName == 'alipay'">
  67. <view class="info-item">
  68. <view class="name">姓名<text>*</text></view>
  69. <view class="right">
  70. <input v-model="aliData.truename" placeholder="请填写真实姓名" class="right-input" />
  71. </view>
  72. </view>
  73. <view class="info-item">
  74. <view class="name">支付宝帐号<text>*</text></view>
  75. <view class="right">
  76. <input v-model="aliData.account" placeholder="请输入" class="right-input" />
  77. </view>
  78. </view>
  79. </template>
  80. <template v-if="itemsName == 'bank'">
  81. <view class="info-item">
  82. <view class="name">姓名<text>*</text></view>
  83. <view class="right">
  84. <input v-model="bankData.truename" placeholder="请填写真实姓名" class="right-input" />
  85. </view>
  86. </view>
  87. <view class="info-item">
  88. <view class="name">银行卡号<text>*</text></view>
  89. <view class="right">
  90. <input v-model="bankData.card" placeholder="请输入银行卡号" class="right-input" />
  91. </view>
  92. </view>
  93. <view class="info-item">
  94. <view class="name">开户行<text>*</text></view>
  95. <view class="right">
  96. <input v-model="bankData.name" placeholder="请输入开户行全称" class="right-input" />
  97. </view>
  98. </view>
  99. </template>
  100. </view>
  101. </view>
  102. <view class="line-height"></view>
  103. </scroll-view>
  104. <view class="footer">
  105. <view class="tips">申请退款后需商家审核,审核时间预计1-3个工作日</view>
  106. <view class="footer-op">
  107. <button :loading="isSubmit" :disabled="isSubmit" class="btn full" @click="submitForm">提交申请</button>
  108. </view>
  109. <view class="footer-safe"></view>
  110. </view>
  111. </template>
  112. <refundMain ref="refundMain" @success="refundHandle"></refundMain>
  113. </view>
  114. </template>
  115. <script>
  116. var app;
  117. import refundMain from "@/components/kfService/refund";
  118. export default {
  119. components: {
  120. refundMain
  121. },
  122. data() {
  123. return {
  124. orderId:0,
  125. current: 0,
  126. goodsData:null,
  127. orderData:null,
  128. loading:true,
  129. refundMsgText:null,
  130. isSubmit:false,
  131. items:[
  132. {
  133. value: 'alipay',
  134. name: '支付宝',
  135. checked: 'true'
  136. },
  137. {
  138. value: 'bank',
  139. name: '银行卡'
  140. }
  141. ],
  142. bankData:{},
  143. aliData:{},
  144. itemsName:"alipay"
  145. }
  146. },
  147. onLoad({order}) {
  148. app = this;
  149. app.orderId = order;
  150. const eventChannel = this.getOpenerEventChannel();
  151. app.getOrder();
  152. },
  153. methods: {
  154. async submitForm(){
  155. var formData = {};
  156. if (!app.refundMsgText) return app.$dialog.showSuccess("请至少选择1项")
  157. formData.order = app.orderId;
  158. formData.msg = app.refundMsgText;
  159. formData.type = app.itemsName;
  160. if (app.itemsName == "alipay") {
  161. formData.content = JSON.stringify(app.aliData);
  162. } else {
  163. formData.content = JSON.stringify(app.bankData);
  164. }
  165. app.isSubmit = true;
  166. var resp = await app.$api.order.refund.post(formData);
  167. app.isSubmit = false;
  168. if (resp.code !== 1) return app.$dialog.showSuccess(resp.msg)
  169. app.$dialog.showSuccess(resp.msg)
  170. setTimeout(function(){
  171. const eventChannel = app.getOpenerEventChannel();
  172. eventChannel.emit('acceptKeepData', { msg: '会员信息已完善' });
  173. uni.navigateBack();
  174. },900)
  175. },
  176. refundMsg(){
  177. this.$refs.refundMain.open();
  178. },
  179. radioChange: function(evt) {
  180. app.itemsName = evt.detail.value;
  181. for (let i = 0; i < this.items.length; i++) {
  182. if (this.items[i].value === evt.detail.value) {
  183. this.current = i;
  184. break;
  185. }
  186. }
  187. },
  188. refundHandle(data){
  189. app.refundMsgText = data;
  190. },
  191. async getOrder(){
  192. app.loading = true;
  193. var res = await app.$api.order.detail.get({"order":app.orderId});
  194. app.loading = false;
  195. if (res.code && res.code == 0) {
  196. app.$dialog.showSuccess(res.msg);
  197. uni.navigateBack()
  198. return ;
  199. }
  200. app.goodsData = res.data.product;
  201. app.orderData = res.data;
  202. },
  203. }
  204. }
  205. </script>
  206. <style lang="scss" scoped>
  207. .content{
  208. position: fixed;
  209. z-index: 1;
  210. top: 0;
  211. left: 0;
  212. bottom: 0;
  213. right: 0;
  214. background-color: #f1f1f1;
  215. display: flex;
  216. flex-direction: column;
  217. .line-height{
  218. height: 40rpx;
  219. width: 100%;
  220. }
  221. }
  222. .right-input{
  223. border: 0;
  224. box-shadow: none;
  225. text-align: right;
  226. width: 100%;
  227. }
  228. .flex-radio{
  229. display: flex;
  230. align-items: center;
  231. gap: 20rpx;
  232. .uni-list-cell{
  233. display: flex;
  234. align-items: center;
  235. }
  236. }
  237. .goods-body{
  238. height: 0;
  239. flex: 1;
  240. }
  241. .footer{
  242. background-color: #fff;
  243. padding: 20upx 20upx 0 20upx;border-top: 2upx solid #f8f8f8;
  244. .footer-safe {
  245. height: env(safe-area-inset-bottom);width: 100%;
  246. }
  247. .tips{
  248. font-size: 24rpx;
  249. color: #999;
  250. margin-bottom: 20rpx;
  251. }
  252. .btn{
  253. font-size: 32rpx;
  254. height: 100upx;
  255. border-radius: 10upx;
  256. line-height: 100upx;
  257. text-align: center;
  258. min-width: 200rpx;
  259. color: #333;
  260. border: 2rpx solid #ccc;
  261. &.full{
  262. background-color: $main-color;
  263. color: #fff;
  264. border: 2rpx solid $main-color;
  265. }
  266. }
  267. }
  268. .order-body {
  269. width: 95%;
  270. margin: 20rpx auto;
  271. .order-info{
  272. border-radius: 20rpx;
  273. background-color: #fff;padding: 20upx;margin-top: 20upx;
  274. .title{font-size: 32upx;color: #333;font-weight: bold;margin-bottom: 20upx;}
  275. .info-item{
  276. font-size: 28upx;display: flex;align-items: center;
  277. padding: 30rpx 0;
  278. .name{
  279. text {
  280. color: $main-color;
  281. margin-left: 10rpx;
  282. }
  283. }
  284. .right{
  285. &.red{
  286. color: $main-color;
  287. font-size: 32rpx;
  288. }
  289. display: flex;
  290. align-items: center;
  291. color: #666;margin-left: auto;margin-right: 0;
  292. flex: 1;
  293. justify-content: right;
  294. image {
  295. width: 40rpx;
  296. height: 40rpx;
  297. }
  298. text{border: 2upx solid #ccc;color: #333;font-size: 24upx;padding: 0 15upx;margin-left: 20upx;border-radius: 5upx;}
  299. }
  300. }
  301. }
  302. .item-goods{
  303. background-color: #fff;
  304. margin-top: 20rpx;
  305. border-radius: 20rpx;
  306. padding: 20rpx;
  307. .item-goods-body{
  308. display: flex;
  309. align-items: center;
  310. gap: 20rpx;
  311. }
  312. .stock{
  313. text-align: right;
  314. }
  315. .image {
  316. height: 140rpx;
  317. overflow: hidden;display: flex;align-items: center;min-width: 140rpx;
  318. position: relative;
  319. image {
  320. width: 140rpx;
  321. border-radius: 10upx;
  322. height: 100%;
  323. }
  324. }
  325. .info{
  326. flex: 1 1 0%;
  327. overflow: hidden;
  328. .title{
  329. display: flex;
  330. align-items: center;
  331. justify-content: space-between;
  332. .name {
  333. overflow: hidden;
  334. text-overflow: ellipsis;
  335. font-size: 32rpx;
  336. display: -webkit-box;
  337. -webkit-line-clamp: 2;
  338. -webkit-box-orient: vertical;
  339. color: #333;
  340. font-weight: 900;
  341. }
  342. }
  343. .price-right{
  344. text-align: right;
  345. color: $main-color;
  346. margin-top: 20rpx;
  347. font-size: 28rpx;
  348. text {
  349. font-size: 30rpx;
  350. font-weight: 800;
  351. }
  352. }
  353. .tags {
  354. color: #94a3b8;
  355. font-size: 24rpx;
  356. margin: 10rpx 0;
  357. display: flex;
  358. align-items: center;
  359. justify-content: space-between;
  360. .price {
  361. font-size: 28rpx;
  362. color: $main-text-color;
  363. font-weight: 600;
  364. }
  365. }
  366. }
  367. }
  368. }
  369. </style>