refundDetail.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509
  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 @click="toMap()" class="content shop-box">
  16. <view class="shop-name">
  17. 印象贵大文创店
  18. </view>
  19. <view class="address">
  20. 贵州大学西校区西一区体育场楼下
  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.goodsDescribe}}
  32. </view> -->
  33. <view class="price-box">
  34. <view class="price">
  35. ¥{{info.goodsList[0].goodsInfo.price}}
  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.price}}
  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 == 'APPLY_REFUND'){
  132. return '退款审核中'
  133. }else if(val == 'CLOSE'){
  134. return '关闭订单'
  135. }else if(val == 'REFUNDED'){
  136. return '已退款'
  137. }else if(val == 'REFUSAL_REFUND'){
  138. return '拒绝退款'
  139. }else if(val == 'USED'){
  140. return '订单已完成'
  141. }else if(val == 'WAIT_PAYMENT'){
  142. return '待付款'
  143. }else if(val == 'WAIT_USE'){
  144. return '待使用'
  145. }
  146. },
  147. filterPay(val){
  148. if(val == 'wx.unifiedOrder'){
  149. return '微信支付'
  150. }else if(val == 'trade.create'){
  151. return '支付宝支付'
  152. }else if(val == 'uac.miniOrder'){
  153. return '云闪付支付'
  154. }else{
  155. return '-'
  156. }
  157. }
  158. },
  159. methods: {
  160. toMap() {
  161. uni.openLocation({
  162. latitude: 26.4401,
  163. longitude: 106.664,
  164. name: "印象贵大文创店",
  165. address: "贵州大学西校区西一区体育场楼下",
  166. });
  167. },
  168. apply(){
  169. let that = this
  170. uni.navigateTo({
  171. url:'./refund',
  172. success: function(res) {
  173. // 通过eventChannel向被打开页面传送数据
  174. res.eventChannel.emit('orderInfo', that.info)
  175. }
  176. })
  177. },
  178. // 获取订单详情
  179. payDetails(orderNo){
  180. payDetails(orderNo).then(res=>{
  181. this.info = res.content
  182. console.log(this.info);
  183. if(this.info.goodsList[0].goodsState == 'REFUNDED'&&this.info.goodsList[0].refundLog.conclusionTime){
  184. console.log(222222222222222);
  185. this.stepList.unshift({
  186. desc:'退款完成,已原路返回',
  187. time:'conclusionTime'
  188. })
  189. }
  190. try{
  191. let extend = JSON.parse(this.info.extend)
  192. if(extend.account){
  193. this.isVisual = true
  194. }
  195. }catch(e){
  196. //TODO handle the exception
  197. }
  198. })
  199. },
  200. // 支付
  201. pay(){
  202. if (this.btnLoading) return
  203. this.btnLoading = true
  204. uni.showLoading({
  205. title: '支付中'
  206. })
  207. let that = this
  208. let miniPayRequest = JSON.parse(this.info.miniPayRequest)
  209. uni.requestPayment({
  210. "provider": "wxpay",
  211. "orderInfo": miniPayRequest,
  212. "appid": miniPayRequest.appId, // 微信开放平台 - 应用 - AppId,注意和微信小程序、公众号 AppId 可能不一致
  213. "paySign": miniPayRequest.paySign,
  214. "nonceStr": miniPayRequest.nonceStr, // 随机字符串
  215. "package": miniPayRequest.package, // 固定值
  216. // "prepayid": miniPayRequest.package, // 统一下单订单号
  217. "timeStamp": miniPayRequest.timeStamp, // 时间戳(单位:秒)
  218. "signType": miniPayRequest.signType, //签名算法
  219. success(msg) {
  220. console.log('msg', msg);
  221. queryPayOrder(that.info.orderNo).then(res1 => {
  222. if (res1.state == 'Success') {
  223. uni.hideLoading()
  224. uni.showToast({
  225. title: '支付成功',
  226. icon: 'success'
  227. })
  228. that.btnLoading = false
  229. that.payDetails(that.info.orderNo)
  230. }
  231. })
  232. },
  233. fail(e) {
  234. that.btnLoading = false
  235. uni.hideLoading()
  236. uni.showToast({
  237. title: '取消支付',
  238. icon: 'fail'
  239. })
  240. // 取消支付后,获取支付信息以备再次支付
  241. that.payDetails(that.info.orderNo)
  242. console.log('err', e,this);
  243. }
  244. })
  245. },
  246. // 取消退款申请
  247. cancelReply(){
  248. if (this.btnLoading) return
  249. this.btnLoading = true
  250. uni.showLoading({
  251. title: '取消中'
  252. })
  253. unRefund({id:this.info.goodsList[0].id}).then(res=>{
  254. this.btnLoading = false
  255. uni.hideLoading()
  256. if (res.state == 'Success') {
  257. this.payDetails(this.info.orderNo)
  258. uni.showToast({
  259. title:'取消成功',
  260. icon:'success'
  261. })
  262. }
  263. })
  264. }
  265. },
  266. onReady() {
  267. },
  268. onLoad(options) {
  269. this.info.orderNo = options.id
  270. },
  271. onShow() {
  272. this.payDetails(this.info.orderNo)
  273. },
  274. created() {
  275. // this.info = JSON.parse(uni.getStorageSync('order'))
  276. }
  277. }
  278. </script>
  279. <style lang="scss">
  280. .refundDetail{
  281. background: #F9F9F9;
  282. min-height: 100vh;
  283. padding-bottom: 100rpx;
  284. .progress{
  285. .progress-title{
  286. font-weight: 600;
  287. font-size: 32rpx;
  288. color: #181818;
  289. }
  290. .progress-desc{
  291. font-weight: 300;
  292. font-size: 24rpx;
  293. color: #AAAAAA;
  294. margin-top: 15rpx;
  295. }
  296. }
  297. .shop-box{
  298. width: 690rpx;
  299. // margin: 0 30rpx;
  300. // padding: 24rpx 24rpx 30rpx;
  301. background: #fff;
  302. border-radius: 16rpx;
  303. margin-top: -30rpx;
  304. box-sizing: border-box;
  305. .shop-name{
  306. font-weight: 600;
  307. font-size: 32rpx;
  308. color: #181818;
  309. width: 100%;
  310. white-space: nowrap;
  311. overflow: hidden;
  312. text-overflow: ellipsis;
  313. }
  314. .address{
  315. font-weight: 300;
  316. font-size: 24rpx;
  317. color: #AAAAAA;
  318. margin-top: 20rpx;
  319. width: 100%;
  320. white-space: nowrap;
  321. overflow: hidden;
  322. text-overflow: ellipsis;
  323. }
  324. }
  325. .black{
  326. color: #222222!important;
  327. }
  328. .red{
  329. color: red!important;
  330. }
  331. .fs28{
  332. font-size: 28rpx!important;
  333. font-weight: bold;
  334. }
  335. .input-box{
  336. margin: 20rpx 30rpx;
  337. padding: 28rpx 24rpx;
  338. background: #FFFFFF;
  339. border-radius: 16rpx 16rpx 16rpx 16rpx;
  340. display: flex;
  341. align-items: center;
  342. justify-content: space-between;
  343. .label {
  344. color: #222;
  345. font-size: 28rpx;
  346. }
  347. .value {
  348. font-size: 28rpx;
  349. color: #AAAAAA;
  350. }
  351. }
  352. .content{
  353. margin: 20rpx 30rpx;
  354. padding: 28rpx 24rpx;
  355. border-radius: 16rpx;
  356. background: #fff;
  357. .title{
  358. font-weight: 600;
  359. font-size: 28rpx;
  360. color: #222222;
  361. }
  362. .item{
  363. display: flex;
  364. align-items: center;
  365. justify-content: space-between;
  366. margin-top: 28rpx;
  367. .label{
  368. color: #222222;
  369. font-size: 28rpx;
  370. }
  371. .value{
  372. color: #999999;
  373. font-size: 28rpx;
  374. }
  375. }
  376. }
  377. .pay-btn{
  378. background: $uni-color-primary;
  379. width: 688rpx;
  380. height: 80rpx;
  381. line-height: 80rpx;
  382. border-radius: 46rpx;
  383. color: #fff;
  384. margin-top: 50rpx;
  385. }
  386. .refund-box{
  387. .refund-msg{
  388. font-weight: 300;
  389. font-size: 24rpx;
  390. color: #222222;
  391. margin-top: 15rpx;
  392. line-height: 40rpx;
  393. }
  394. }
  395. .apply-box{
  396. position: relative;
  397. .label{
  398. font-weight: 600;
  399. font-size: 28rpx;
  400. color: #222222;
  401. }
  402. .value{
  403. color: #999999;
  404. font-size: 24rpx;
  405. margin-top: 15rpx;
  406. }
  407. .jiantou{
  408. position: absolute;
  409. top: 50%;
  410. right: 24rpx;
  411. transform: translateY(-50%);
  412. width: 24rpx;
  413. height: 24rpx;
  414. }
  415. }
  416. .info{
  417. .order-info{
  418. display: flex;
  419. .icon{
  420. width: 164rpx;
  421. height: 164rpx;
  422. border-radius: 16rpx;
  423. flex-shrink: 0;
  424. }
  425. .shop-info{
  426. display: flex;
  427. flex-direction: column;
  428. justify-content: space-between;
  429. padding-left: 24rpx;
  430. flex: 1;
  431. box-sizing: border-box;
  432. .title{
  433. color: #181818;
  434. font-size: 28rpx;
  435. width: 450rpx;
  436. white-space: nowrap;
  437. overflow: hidden;
  438. text-overflow: ellipsis;
  439. }
  440. .price-box{
  441. display: flex;
  442. align-items: center;
  443. justify-content: space-between;
  444. .price{
  445. color: #181818;
  446. font-size: 32rpx;
  447. font-weight: bold;
  448. }
  449. }
  450. .start-time,.goods-desc{
  451. font-size: 24rpx;
  452. color: #AAAAAA;
  453. width: 450rpx;
  454. white-space: nowrap;
  455. overflow: hidden;
  456. text-overflow: ellipsis;
  457. margin-top: 10rpx;
  458. }
  459. }
  460. }
  461. }
  462. .wrap{
  463. display: flex;
  464. justify-content: center;
  465. align-items: center;
  466. height: 100vh;
  467. overflow: hidden;
  468. }
  469. }
  470. </style>