refundDetail.vue 11 KB

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