refundDetail.vue 11 KB

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