refundDetail.vue 12 KB

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