refundDetail.vue 11 KB

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