signUpDetail.vue 17 KB

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