refundDetail.vue 10 KB

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