signUpDetail.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679
  1. <template>
  2. <view class="signUpDetail">
  3. <view class="status-box">
  4. <view class="text-box">
  5. <view class="status" v-if="info.goodsList[0].goodsState == 'WAIT_PAYMENT'&&!isNotTime">
  6. 等待支付,剩余<u-count-down :time="closeTime" format="HH:mm:ss" @finish="finish"></u-count-down>
  7. </view>
  8. <view class="status" v-else>
  9. {{info.goodsList[0].goodsState | filterType}}
  10. </view>
  11. </view>
  12. </view>
  13. <view class="content progress" v-if="info.goodsList[0].goodsState == 'APPLY_REFUND' || info.goodsList[0].goodsState == 'REFUNDED'" @click="refundDetail">
  14. <view class="progress-title">
  15. 退款进度
  16. </view>
  17. <view class="progress-desc">
  18. 查看退款详情
  19. </view>
  20. </view>
  21. <view class="content info">
  22. <view class="order-info">
  23. <image class="icon" :src="info.goodsList[0].goodsInfo.activityCover" mode=""></image>
  24. <view class="shop-info">
  25. <view class="title">
  26. {{info.goodsList[0].goodsInfo.activityName}}
  27. </view>
  28. <view class="goods-desc">
  29. 活动时间:{{info.goodsList[0].goodsInfo.activityStartTime}} 至 {{info.goodsList[0].goodsInfo.activityEndTime}}
  30. </view>
  31. <view class="num-box">
  32. <view class="label">
  33. 报名人数
  34. </view>
  35. <view class="label">
  36. {{info.goodsList.length}}
  37. </view>
  38. </view>
  39. </view>
  40. </view>
  41. </view>
  42. <!-- <view class="content code-box" v-if="info.goodsList[0].goodsState == 'WAIT_USE'&&info.goodsList[0].goodsName!='二维码支付'">
  43. <view class="left">
  44. <view class="title">
  45. 券码信息
  46. </view>
  47. <view class="codeNum">
  48. </view>
  49. </view>
  50. <view class="code-btn" @click="checkCode">
  51. 查看券码 <image class="jiantou" src="@/static/jiantou-icon.png" mode=""></image>
  52. </view>
  53. </view> -->
  54. <view class="content">
  55. <view class="title">
  56. 报名信息 (开发中)
  57. </view>
  58. <view class="box">
  59. <view class="item">
  60. <view class="label">
  61. 姓名
  62. </view>
  63. <view class="value">
  64. {{info.orderNo}}
  65. </view>
  66. </view>
  67. </view>
  68. </view>
  69. <view class="content">
  70. <view class="title">
  71. 订单信息
  72. </view>
  73. <view class="item">
  74. <view class="label">
  75. 订单编号
  76. </view>
  77. <view class="value">
  78. {{info.orderNo}}
  79. </view>
  80. </view>
  81. <view class="item" v-if="info.payment">
  82. <view class="label">
  83. 付款方式
  84. </view>
  85. <view class="value">
  86. <!-- {{info.payment? (info.payment.paymentWay| filterPay) : '-' }} -->
  87. {{info.payment.paymentWay| filterPay }}
  88. </view>
  89. </view>
  90. <view class="item">
  91. <view class="label">
  92. 下单时间
  93. </view>
  94. <view class="value">
  95. {{$u.timeFormat(info.createTime,'yyyy-mm-dd hh:MM:ss')}}
  96. </view>
  97. </view>
  98. <view class="item" v-if="info.goodsList[0].goodsState != 'WAIT_PAYMENT' && info.goodsList[0].goodsState != 'CLOSE'">
  99. <view class="label">
  100. 支付时间
  101. </view>
  102. <view class="value">
  103. {{$u.timeFormat(info.payment.paymentTime,'yyyy-mm-dd hh:MM:ss')}}
  104. </view>
  105. </view>
  106. </view>
  107. <view class="content">
  108. <view class="title">
  109. 交易信息
  110. </view>
  111. <view class="item">
  112. <view class="label">
  113. 商品金额
  114. </view>
  115. <view class="value black">
  116. ¥{{info.goodsList[0].goodsInfo.price}}
  117. </view>
  118. </view>
  119. <view class="item" >
  120. <view class="label">
  121. 优惠券
  122. </view>
  123. <view class="value red">
  124. -¥{{info.discountAmount}}
  125. </view>
  126. </view>
  127. <view class="item">
  128. <view class="label">
  129. 合计
  130. </view>
  131. <view class="value">
  132. <text class="red fs28">¥{{info.payAmount}}</text>
  133. </view>
  134. </view>
  135. </view>
  136. <template v-if="info.goodsList[0].goodsState == 'APPLY_REFUND'">
  137. <view class="content refund-box">
  138. <view class="title">
  139. 退款原因
  140. </view>
  141. <view class="refund-msg">
  142. {{info.goodsList[0].refundLog.remark}}
  143. </view>
  144. </view>
  145. <button type="default" :loading="btnLoading" v-if="!info.payment.transferAll" class="pay-btn" @click="cancelReply" >取消退款</button>
  146. </template>
  147. <button type="default" :loading="btnLoading" class="pay-btn" v-if="info.goodsList[0].goodsState == 'WAIT_PAYMENT'" @click="pay" >立即支付</button>
  148. <view class="content apply-box" v-else-if="(info.goodsList[0].goodsState == 'WAIT_USE'||info.goodsList[0].goodsState == 'USED')&&isRefund()" @click="apply">
  149. <view class="label">
  150. 退款申请
  151. </view>
  152. <view class="value">
  153. 如引发商品争议,可申请平台介入处理
  154. </view>
  155. <image class="jiantou" src="@/static/jiantou-icon.png" mode=""></image>
  156. </view>
  157. <!-- 二维码 -->
  158. <u-overlay :show="show" v-if="show" :opacity="0.6">
  159. <view class="wrap" @click.stop="close">
  160. <uqrcode ref="uqrcode" type="2d" auto canvas-id="qrcode" :value="codeData" :loading="loading" :options="{ margin: 20 }">
  161. <template v-slot:loading>
  162. <text style="color: black;">拼命加载中...</text>
  163. </template>
  164. </uqrcode>
  165. </view>
  166. </u-overlay>
  167. </view>
  168. </template>
  169. <script>
  170. import {qrCode} from '@/api/order.js'
  171. import {payDetails,queryPayOrder,unRefund} from '@/api/payment.js'
  172. import {getOrderDetail} from '@/api/activity.js'
  173. export default {
  174. data() {
  175. return {
  176. codeData:'123',
  177. show:false,
  178. loading:false,
  179. btnLoading:false,
  180. oldBright:0,
  181. info:{
  182. goodsList:[{goodsState:''}]
  183. },
  184. isNotTime:false
  185. }
  186. },
  187. watch: {
  188. // isNotTime(val) {
  189. // if(this.isNotTime){
  190. // this.payDetails(this.info.orderNo)
  191. // }
  192. // }
  193. },
  194. filters: {
  195. filterType: function(val) {
  196. if(val == 'APPLY_REFUND'){
  197. return '退款审核中'
  198. }else if(val == 'CLOSE'){
  199. return '关闭订单'
  200. }else if(val == 'REFUNDED'){
  201. return '已退款'
  202. }else if(val == 'REFUSAL_REFUND'){
  203. return '拒绝退款'
  204. }else if(val == 'USED'){
  205. return '订单已完成'
  206. }else if(val == 'WAIT_PAYMENT'){
  207. return '待付款'
  208. }else if(val == 'WAIT_USE'){
  209. return '待使用'
  210. }
  211. },
  212. filterPay(val){
  213. if(val == 'wx.unifiedOrder'){
  214. return '微信支付'
  215. }else if(val == 'trade.create'){
  216. return '支付宝支付'
  217. }else if(val == 'uac.miniOrder'){
  218. return '云闪付支付'
  219. }else{
  220. return '-'
  221. }
  222. }
  223. },
  224. computed: {
  225. closeTime() {
  226. return (this.info.createTime + 1000*60*30) - new Date().getTime()
  227. },
  228. },
  229. methods: {
  230. isRefund(){
  231. if(!this.info.goodsList[0].verifyModel){//没核销
  232. return true
  233. }else if(this.info.goodsList[0].verifyModel && (new Date().getTime() < (this.info.goodsList[0].verifyModel.checkTime + 1000*60*60*48))){// 已核销 并且没超过48小时
  234. return true
  235. }else{
  236. return false
  237. }
  238. },
  239. finish(){
  240. this.isNotTime = true
  241. console.log(222222,this.isNotTime);
  242. this.payDetails(this.info.orderNo)
  243. },
  244. refundDetail(){
  245. uni.navigateTo({
  246. url:`./refundDetail?id=${this.info.orderNo}`
  247. })
  248. },
  249. checkCode() {
  250. this.codeData = ''
  251. this.$nextTick(()=>{
  252. this.show = true
  253. this.loading = true
  254. let that = this
  255. // uni.getScreenBrightness({
  256. // success(res) {
  257. // // 获取用户手机亮度 保存起来
  258. // that.oldBright = res.value
  259. // setTimeout(()=>{
  260. // uni.setScreenBrightness({
  261. // value:1
  262. // })
  263. // },200)
  264. // }
  265. // })
  266. qrCode(this.info.goodsList[0].id).then(res=>{
  267. this.loading = false
  268. if(res.state == 'Success'){
  269. this.codeData = res.content
  270. }
  271. })
  272. })
  273. },
  274. close(){
  275. this.show = false
  276. // uni.setScreenBrightness({
  277. // value:this.oldBright
  278. // })
  279. },
  280. apply(){
  281. console.log(1111111);
  282. let that = this
  283. uni.navigateTo({
  284. url:'./refund',
  285. success: function(res) {
  286. console.log(222222);
  287. // 通过eventChannel向被打开页面传送数据
  288. res.eventChannel.emit('orderInfo', that.info)
  289. }
  290. })
  291. },
  292. getOrderDetail(orderNo,activityId){
  293. getOrderDetail({activityId,orderNo}).then(res=>{
  294. if (res.state == 'Success') {
  295. }
  296. })
  297. },
  298. // 获取订单详情
  299. payDetails(orderNo){
  300. payDetails(orderNo).then(res=>{
  301. if (res.state == 'Success') {
  302. this.info = res.content
  303. this.getOrderDetail(this.info.orderNo,this.info.goodsList[0].goodsInfo.id)
  304. }
  305. })
  306. },
  307. // 支付
  308. pay(){
  309. if (this.btnLoading) return
  310. this.btnLoading = true
  311. uni.showLoading({
  312. title: '支付中'
  313. })
  314. let that = this
  315. let miniPayRequest = JSON.parse(this.info.payment.miniPayRequest)
  316. uni.requestPayment({
  317. "provider": "wxpay",
  318. "orderInfo": miniPayRequest,
  319. "appid": miniPayRequest.appId, // 微信开放平台 - 应用 - AppId,注意和微信小程序、公众号 AppId 可能不一致
  320. "paySign": miniPayRequest.paySign,
  321. "nonceStr": miniPayRequest.nonceStr, // 随机字符串
  322. "package": miniPayRequest.package, // 固定值
  323. // "prepayid": miniPayRequest.package, // 统一下单订单号
  324. "timeStamp": miniPayRequest.timeStamp, // 时间戳(单位:秒)
  325. "signType": miniPayRequest.signType, //签名算法
  326. success(msg) {
  327. console.log('msg', msg);
  328. queryPayOrder(that.info.orderNo).then(res1 => {
  329. if (res1.state == 'Success') {
  330. uni.hideLoading()
  331. uni.showToast({
  332. title: '支付成功',
  333. icon: 'success'
  334. })
  335. that.btnLoading = false
  336. that.payDetails(that.info.orderNo)
  337. }
  338. })
  339. },
  340. fail(e) {
  341. that.btnLoading = false
  342. uni.hideLoading()
  343. uni.showToast({
  344. title: '取消支付',
  345. icon: 'fail'
  346. })
  347. // 取消支付后,获取支付信息以备再次支付
  348. that.payDetails(that.info.orderNo)
  349. console.log('err', e,this);
  350. }
  351. })
  352. },
  353. // 取消退款申请
  354. cancelReply(){
  355. if (this.btnLoading) return
  356. this.btnLoading = true
  357. uni.showLoading({
  358. title: '取消中'
  359. })
  360. unRefund({id:this.info.goodsList[0].id}).then(res=>{
  361. this.btnLoading = false
  362. uni.hideLoading()
  363. if (res.state == 'Success') {
  364. this.payDetails(this.info.orderNo)
  365. uni.showToast({
  366. title:'取消成功',
  367. icon:'success'
  368. })
  369. }
  370. })
  371. }
  372. },
  373. onReady() {
  374. },
  375. onLoad(options) {
  376. this.info.orderNo = options.id
  377. },
  378. onShow() {
  379. this.payDetails(this.info.orderNo)
  380. },
  381. created() {
  382. // this.info = JSON.parse(uni.getStorageSync('order'))
  383. }
  384. }
  385. </script>
  386. <style lang="scss">
  387. .signUpDetail{
  388. background: #F9F9F9;
  389. min-height: 100vh;
  390. padding-bottom: 100rpx;
  391. .status-box{
  392. padding: 24rpx 24rpx 4rpx;
  393. display: flex;
  394. justify-content: space-between;
  395. .text-box{
  396. color: #181818;
  397. .status{
  398. font-weight: bold;
  399. font-size: 32rpx;
  400. display: flex;
  401. .u-count-down__text{
  402. color: $uni-color-primary!important;
  403. }
  404. }
  405. .notice{
  406. font-size: 24rpx;
  407. margin-top: 20rpx;
  408. }
  409. }
  410. }
  411. .progress{
  412. .progress-title{
  413. font-weight: 600;
  414. font-size: 32rpx;
  415. color: #181818;
  416. }
  417. .progress-desc{
  418. font-weight: 300;
  419. font-size: 24rpx;
  420. color: #AAAAAA;
  421. margin-top: 15rpx;
  422. }
  423. }
  424. .shop-box{
  425. width: 690rpx;
  426. // margin: 0 30rpx;
  427. // padding: 24rpx 24rpx 30rpx;
  428. background: #fff;
  429. border-radius: 16rpx;
  430. margin-top: -30rpx;
  431. box-sizing: border-box;
  432. .shop-name{
  433. font-weight: 600;
  434. font-size: 32rpx;
  435. color: #181818;
  436. width: 100%;
  437. white-space: nowrap;
  438. overflow: hidden;
  439. text-overflow: ellipsis;
  440. }
  441. .address{
  442. font-weight: 300;
  443. font-size: 24rpx;
  444. color: #AAAAAA;
  445. margin-top: 20rpx;
  446. width: 100%;
  447. white-space: nowrap;
  448. overflow: hidden;
  449. text-overflow: ellipsis;
  450. }
  451. }
  452. .black{
  453. color: #222222!important;
  454. }
  455. .red{
  456. color: red!important;
  457. }
  458. .fs28{
  459. font-size: 28rpx!important;
  460. font-weight: bold;
  461. }
  462. .code-box{
  463. display: flex;
  464. align-items: center;
  465. justify-content: space-between;
  466. .left{
  467. .title{
  468. font-weight: 500;
  469. font-size: 28rpx;
  470. color: #222222;
  471. }
  472. .codeNum{
  473. font-weight: 300;
  474. font-size: 24rpx;
  475. color: #AAAAAA;
  476. margin-top: 15rpx;
  477. }
  478. }
  479. .code-btn{
  480. display: flex;
  481. align-items: center;
  482. font-weight: 300;
  483. font-size: 24rpx;
  484. color: #AAAAAA;
  485. .jiantou{
  486. width: 24rpx;
  487. height: 24rpx;
  488. }
  489. }
  490. }
  491. .input-box{
  492. margin: 20rpx 30rpx;
  493. padding: 28rpx 24rpx;
  494. background: #FFFFFF;
  495. border-radius: 16rpx 16rpx 16rpx 16rpx;
  496. display: flex;
  497. align-items: center;
  498. justify-content: space-between;
  499. .label {
  500. color: #222;
  501. font-size: 28rpx;
  502. }
  503. .value {
  504. font-size: 28rpx;
  505. color: #AAAAAA;
  506. }
  507. }
  508. .box{
  509. border-top: 1rpx solid #F0F0F0;
  510. margin-top: 28rpx;
  511. }
  512. .content{
  513. margin: 20rpx 30rpx;
  514. padding: 28rpx 24rpx;
  515. border-radius: 16rpx;
  516. background: #fff;
  517. .title{
  518. font-weight: 600;
  519. font-size: 28rpx;
  520. color: #222222;
  521. }
  522. .item{
  523. display: flex;
  524. align-items: center;
  525. justify-content: space-between;
  526. margin-top: 28rpx;
  527. .label{
  528. color: #222222;
  529. font-size: 28rpx;
  530. }
  531. .value{
  532. color: #999999;
  533. font-size: 28rpx;
  534. }
  535. }
  536. }
  537. .pay-btn{
  538. background: $uni-color-primary;
  539. width: 688rpx;
  540. height: 80rpx;
  541. line-height: 80rpx;
  542. border-radius: 46rpx;
  543. color: #fff;
  544. margin-top: 50rpx;
  545. }
  546. .refund-box{
  547. .refund-msg{
  548. font-weight: 300;
  549. font-size: 24rpx;
  550. color: #222222;
  551. margin-top: 15rpx;
  552. line-height: 40rpx;
  553. }
  554. }
  555. .apply-box{
  556. position: relative;
  557. .label{
  558. font-weight: 600;
  559. font-size: 28rpx;
  560. color: #222222;
  561. }
  562. .value{
  563. color: #999999;
  564. font-size: 24rpx;
  565. margin-top: 15rpx;
  566. }
  567. .jiantou{
  568. position: absolute;
  569. top: 50%;
  570. right: 24rpx;
  571. transform: translateY(-50%);
  572. width: 24rpx;
  573. height: 24rpx;
  574. }
  575. }
  576. .info{
  577. .order-info{
  578. display: flex;
  579. .icon{
  580. width: 164rpx;
  581. height: 164rpx;
  582. border-radius: 16rpx;
  583. flex-shrink: 0;
  584. }
  585. .shop-info{
  586. display: flex;
  587. flex-direction: column;
  588. justify-content: space-between;
  589. padding-left: 24rpx;
  590. flex: 1;
  591. box-sizing: border-box;
  592. .title{
  593. color: #181818;
  594. font-size: 28rpx;
  595. width: 450rpx;
  596. white-space: nowrap;
  597. overflow: hidden;
  598. text-overflow: ellipsis;
  599. }
  600. .num-box{
  601. display: flex;
  602. align-items: center;
  603. justify-content: space-between;
  604. .label{
  605. font-weight: 300;
  606. font-size: 24rpx;
  607. color: #181818;
  608. }
  609. .num{
  610. font-weight: 400;
  611. font-size: 24rpx;
  612. color: #222222;
  613. }
  614. }
  615. .start-time,.goods-desc{
  616. font-size: 24rpx;
  617. color: #AAAAAA;
  618. width: 450rpx;
  619. white-space: nowrap;
  620. overflow: hidden;
  621. text-overflow: ellipsis;
  622. }
  623. }
  624. }
  625. }
  626. .wrap{
  627. display: flex;
  628. justify-content: center;
  629. align-items: center;
  630. height: 100vh;
  631. overflow: hidden;
  632. }
  633. }
  634. </style>