refundDetail.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504
  1. <template>
  2. <view class="refundDetail">
  3. <view class="content progress">
  4. <view class="progress-title">
  5. {{info.goodsList[0].goodsState == 'REFUNDED'?'退款成功':'退款中'}}
  6. </view>
  7. <view class="progress-desc">
  8. {{info.goodsList[0].refundLog.refundAmount?'如您未查询到退款,请拨打10086咨询客服':' 请耐心等待,正在为您处理退款'}}
  9. </view>
  10. <u-steps dot current="0" activeColor="#FF4D3A" direction="column">
  11. <u-steps-item v-for="(item,index) in stepList" :key="index" :title="item.desc" :desc="$u.timeFormat(info.goodsList[0].refundLog[item.time], 'yyyy-mm-dd hh:MM:ss')">
  12. </u-steps-item>
  13. </u-steps>
  14. </view>
  15. <!-- <view class="content shop-box">
  16. <view class="shop-name">
  17. {{info.shopInfo.shopName}}
  18. </view>
  19. <view class="address">
  20. {{info.shopInfo.address}}
  21. </view>
  22. </view> -->
  23. <view class="content info">
  24. <view class="order-info">
  25. <image class="icon" :src="info.goodsList[0].goodsInfo.activityCover" mode=""></image>
  26. <view class="shop-info">
  27. <view class="title">
  28. {{info.goodsList[0].goodsInfo.activityName}}
  29. </view>
  30. <view class="goods-desc">
  31. 活动时间:{{info.goodsList[0].goodsInfo.activityStartTime}} 至 {{info.goodsList[0].goodsInfo.activityEndTime}}
  32. </view>
  33. <view class="num-box">
  34. <view class="label">
  35. 报名人数
  36. </view>
  37. <view class="label">
  38. {{info.goodsList.length}}
  39. </view>
  40. </view>
  41. </view>
  42. </view>
  43. </view>
  44. <view class="content">
  45. <view class="title">
  46. 商品总价
  47. </view>
  48. <view class="item">
  49. <view class="label">
  50. 商品金额
  51. </view>
  52. <view class="value black">
  53. ¥{{info.goodsList[0].goodsInfo.price}}
  54. </view>
  55. </view>
  56. <view class="item" >
  57. <view class="label">
  58. 优惠券
  59. </view>
  60. <view class="value red">
  61. -¥{{info.discountAmount}}
  62. </view>
  63. </view>
  64. <view class="item">
  65. <view class="label">
  66. 合计
  67. </view>
  68. <view class="value">
  69. <text class="red fs28">¥{{info.payAmount}}</text>
  70. </view>
  71. </view>
  72. <view class="item">
  73. <view class="label">
  74. 退款金额
  75. </view>
  76. <view class="value">
  77. <text class="red fs28">¥{{info.goodsList[0].refundLog.refundAmount||info.payAmount}}</text>
  78. </view>
  79. </view>
  80. </view>
  81. <view class="content refund-box">
  82. <view class="title">
  83. 退款原因
  84. </view>
  85. <view class="refund-msg">
  86. {{info.goodsList[0].refundLog.remark}}
  87. </view>
  88. </view>
  89. <button type="default" :loading="btnLoading" v-if="!info.payment.transferAll" class="pay-btn" @click="cancelReply" >取消退款</button>
  90. <button type="default" :loading="btnLoading" class="pay-btn" v-if="info.orderType == 'WAIT_PAYMENT'" @click="pay" >立即支付</button>
  91. <view class="content apply-box" v-else-if="info.orderType == 'WAIT_USE'||info.orderType == 'USED'||info.orderType == 'CLOSE'" @click="apply">
  92. <view class="label">
  93. 退款申请
  94. </view>
  95. <view class="value">
  96. 如引发商品争议,可申请平台介入处理
  97. </view>
  98. <image class="jiantou" src="../../static/jiantou-icon.png" mode=""></image>
  99. </view>
  100. </view>
  101. </template>
  102. <script>
  103. import {qrCode} from '@/api/order.js'
  104. import {payDetails,queryPayOrder,unRefund} from '@/api/payment.js'
  105. export default {
  106. data() {
  107. return {
  108. codeData:'123',
  109. loading:false,
  110. btnLoading:false,
  111. oldBright:0,
  112. info:{
  113. goodsList:[]
  114. },
  115. stepList:[
  116. {
  117. desc:'平台受理中',
  118. time:'createTime'
  119. },
  120. {
  121. desc:'提交申请',
  122. time:'createTime'
  123. },
  124. ]
  125. }
  126. },
  127. filters: {
  128. filterType: function(val) {
  129. if(val == 'APPLY_REFUND'){
  130. return '退款审核中'
  131. }else if(val == 'CLOSE'){
  132. return '关闭订单'
  133. }else if(val == 'REFUNDED'){
  134. return '已退款'
  135. }else if(val == 'REFUSAL_REFUND'){
  136. return '拒绝退款'
  137. }else if(val == 'USED'){
  138. return '订单已完成'
  139. }else if(val == 'WAIT_PAYMENT'){
  140. return '待付款'
  141. }else if(val == 'WAIT_USE'){
  142. return '待使用'
  143. }
  144. },
  145. filterPay(val){
  146. if(val == 'wx.unifiedOrder'){
  147. return '微信支付'
  148. }else if(val == 'trade.create'){
  149. return '支付宝支付'
  150. }else if(val == 'uac.miniOrder'){
  151. return '云闪付支付'
  152. }else{
  153. return '-'
  154. }
  155. }
  156. },
  157. methods: {
  158. apply(){
  159. let that = this
  160. uni.navigateTo({
  161. url:'./refund',
  162. success: function(res) {
  163. // 通过eventChannel向被打开页面传送数据
  164. res.eventChannel.emit('orderInfo', that.info)
  165. }
  166. })
  167. },
  168. // 获取订单详情
  169. payDetails(orderNo){
  170. payDetails(orderNo).then(res=>{
  171. this.info = res.content
  172. console.log(this.info);
  173. if(this.info.goodsList[0].goodsState == 'REFUNDED'&&this.info.goodsList[0].refundLog.conclusionTime){
  174. this.stepList.unshift({
  175. desc:'退款完成,已原路返回',
  176. time:'conclusionTime'
  177. })
  178. }
  179. })
  180. },
  181. // 支付
  182. pay(){
  183. if (this.btnLoading) return
  184. this.btnLoading = true
  185. uni.showLoading({
  186. title: '支付中'
  187. })
  188. let that = this
  189. let miniPayRequest = JSON.parse(this.info.miniPayRequest)
  190. uni.requestPayment({
  191. "provider": "wxpay",
  192. "orderInfo": miniPayRequest,
  193. "appid": miniPayRequest.appId, // 微信开放平台 - 应用 - AppId,注意和微信小程序、公众号 AppId 可能不一致
  194. "paySign": miniPayRequest.paySign,
  195. "nonceStr": miniPayRequest.nonceStr, // 随机字符串
  196. "package": miniPayRequest.package, // 固定值
  197. // "prepayid": miniPayRequest.package, // 统一下单订单号
  198. "timeStamp": miniPayRequest.timeStamp, // 时间戳(单位:秒)
  199. "signType": miniPayRequest.signType, //签名算法
  200. success(msg) {
  201. console.log('msg', msg);
  202. queryPayOrder(that.info.orderNo).then(res1 => {
  203. if (res1.state == 'Success') {
  204. uni.hideLoading()
  205. uni.showToast({
  206. title: '支付成功',
  207. icon: 'success'
  208. })
  209. that.btnLoading = false
  210. that.payDetails(that.info.orderNo)
  211. }
  212. })
  213. },
  214. fail(e) {
  215. that.btnLoading = false
  216. uni.hideLoading()
  217. uni.showToast({
  218. title: '取消支付',
  219. icon: 'fail'
  220. })
  221. // 取消支付后,获取支付信息以备再次支付
  222. that.payDetails(that.info.orderNo)
  223. console.log('err', e,this);
  224. }
  225. })
  226. },
  227. // 取消退款申请
  228. cancelReply(){
  229. if (this.btnLoading) return
  230. this.btnLoading = true
  231. uni.showLoading({
  232. title: '取消中'
  233. })
  234. unRefund({id:this.info.goodsList[0].id}).then(res=>{
  235. this.btnLoading = false
  236. uni.hideLoading()
  237. if (res.state == 'Success') {
  238. this.payDetails(this.info.orderNo)
  239. uni.showToast({
  240. title:'取消成功',
  241. icon:'success'
  242. })
  243. }
  244. })
  245. }
  246. },
  247. onReady() {
  248. },
  249. onLoad(options) {
  250. this.info.orderNo = options.id
  251. },
  252. onShow() {
  253. this.payDetails(this.info.orderNo)
  254. },
  255. created() {
  256. // this.info = JSON.parse(uni.getStorageSync('order'))
  257. }
  258. }
  259. </script>
  260. <style lang="scss">
  261. .refundDetail{
  262. background: #F9F9F9;
  263. min-height: 100vh;
  264. padding-bottom: 100rpx;
  265. .progress{
  266. .progress-title{
  267. font-weight: 600;
  268. font-size: 32rpx;
  269. color: #181818;
  270. }
  271. .progress-desc{
  272. font-weight: 300;
  273. font-size: 24rpx;
  274. color: #AAAAAA;
  275. margin-top: 15rpx;
  276. }
  277. }
  278. .shop-box{
  279. width: 690rpx;
  280. // margin: 0 30rpx;
  281. // padding: 24rpx 24rpx 30rpx;
  282. background: #fff;
  283. border-radius: 16rpx;
  284. margin-top: -30rpx;
  285. box-sizing: border-box;
  286. .shop-name{
  287. font-weight: 600;
  288. font-size: 32rpx;
  289. color: #181818;
  290. width: 100%;
  291. white-space: nowrap;
  292. overflow: hidden;
  293. text-overflow: ellipsis;
  294. }
  295. .address{
  296. font-weight: 300;
  297. font-size: 24rpx;
  298. color: #AAAAAA;
  299. margin-top: 20rpx;
  300. width: 100%;
  301. white-space: nowrap;
  302. overflow: hidden;
  303. text-overflow: ellipsis;
  304. }
  305. }
  306. .black{
  307. color: #222222!important;
  308. }
  309. .red{
  310. color: red!important;
  311. }
  312. .fs28{
  313. font-size: 28rpx!important;
  314. font-weight: bold;
  315. }
  316. .input-box{
  317. margin: 20rpx 30rpx;
  318. padding: 28rpx 24rpx;
  319. background: #FFFFFF;
  320. border-radius: 16rpx 16rpx 16rpx 16rpx;
  321. display: flex;
  322. align-items: center;
  323. justify-content: space-between;
  324. .label {
  325. color: #222;
  326. font-size: 28rpx;
  327. }
  328. .value {
  329. font-size: 28rpx;
  330. color: #AAAAAA;
  331. }
  332. }
  333. .content{
  334. margin: 20rpx 30rpx;
  335. padding: 28rpx 24rpx;
  336. border-radius: 16rpx;
  337. background: #fff;
  338. .title{
  339. font-weight: 600;
  340. font-size: 28rpx;
  341. color: #222222;
  342. }
  343. .item{
  344. display: flex;
  345. align-items: center;
  346. justify-content: space-between;
  347. margin-top: 28rpx;
  348. .label{
  349. color: #222222;
  350. font-size: 28rpx;
  351. }
  352. .value{
  353. color: #999999;
  354. font-size: 28rpx;
  355. }
  356. }
  357. }
  358. .pay-btn{
  359. background: $uni-color-primary;
  360. width: 688rpx;
  361. height: 80rpx;
  362. line-height: 80rpx;
  363. border-radius: 46rpx;
  364. color: #fff;
  365. margin-top: 50rpx;
  366. }
  367. .refund-box{
  368. .refund-msg{
  369. font-weight: 300;
  370. font-size: 24rpx;
  371. color: #222222;
  372. margin-top: 15rpx;
  373. line-height: 40rpx;
  374. }
  375. }
  376. .apply-box{
  377. position: relative;
  378. .label{
  379. font-weight: 600;
  380. font-size: 28rpx;
  381. color: #222222;
  382. }
  383. .value{
  384. color: #999999;
  385. font-size: 24rpx;
  386. margin-top: 15rpx;
  387. }
  388. .jiantou{
  389. position: absolute;
  390. top: 50%;
  391. right: 24rpx;
  392. transform: translateY(-50%);
  393. width: 24rpx;
  394. height: 24rpx;
  395. }
  396. }
  397. .info{
  398. .order-info{
  399. display: flex;
  400. .icon{
  401. width: 164rpx;
  402. height: 164rpx;
  403. border-radius: 16rpx;
  404. flex-shrink: 0;
  405. }
  406. .shop-info{
  407. display: flex;
  408. flex-direction: column;
  409. justify-content: space-between;
  410. padding-left: 24rpx;
  411. flex: 1;
  412. box-sizing: border-box;
  413. .title{
  414. color: #181818;
  415. font-size: 28rpx;
  416. width: 450rpx;
  417. white-space: nowrap;
  418. overflow: hidden;
  419. text-overflow: ellipsis;
  420. }
  421. .price-box{
  422. display: flex;
  423. align-items: center;
  424. justify-content: space-between;
  425. .price{
  426. color: #181818;
  427. font-size: 32rpx;
  428. font-weight: bold;
  429. }
  430. }
  431. .goods-desc{
  432. font-size: 24rpx;
  433. color: #AAAAAA;
  434. width: 450rpx;
  435. white-space: nowrap;
  436. overflow: hidden;
  437. text-overflow: ellipsis;
  438. margin-top: 10rpx;
  439. }
  440. .num-box{
  441. display: flex;
  442. align-items: center;
  443. justify-content: space-between;
  444. .label{
  445. font-weight: 300;
  446. font-size: 24rpx;
  447. color: #181818;
  448. }
  449. .num{
  450. font-weight: 400;
  451. font-size: 24rpx;
  452. color: #222222;
  453. }
  454. }
  455. }
  456. }
  457. }
  458. .wrap{
  459. display: flex;
  460. justify-content: center;
  461. align-items: center;
  462. height: 100vh;
  463. overflow: hidden;
  464. }
  465. }
  466. </style>