refundDetail.vue 11 KB

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