refundDetail.vue 11 KB

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