pay-result.vue 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. <template>
  2. <view @click="tooltipShow=false">
  3. <u-navbar :is-back="false" title="支付结果"></u-navbar>
  4. <view class="content">
  5. <image :src="payData.icon" mode=""></image>
  6. <view class="tips">
  7. <text class="title">{{payData.title}}</text>
  8. <text class="desc" v-if="payData.payStatus!=1">{{payData.desc}}</text>
  9. <view v-else class="desc" id="tips1" @click.stop="showTips('tips1')">
  10. <text >已支付 {{payResult.totalPrice || 0}} 元</text>
  11. <text class="cuIcon-question" style="margin-left: 5rpx;"></text>
  12. </view>
  13. </view>
  14. <view class="cu-btn btn radius line-gray" @click.stop="confirm">
  15. 确认
  16. </view>
  17. </view>
  18. <tooltips
  19. gravity="bottom"
  20. :tooltipShow="tooltipShow"
  21. :btns="tooltipBtns"
  22. :eleId="eleId"></tooltips>
  23. </view>
  24. </template>
  25. <script>
  26. import tooltips from '@/components/tooltips/tooltips.vue'
  27. export default {
  28. components:{
  29. tooltips
  30. },
  31. data() {
  32. return {
  33. tooltipShow:false,
  34. tooltipBtns:[''],
  35. eleId:"",
  36. payResult:{},
  37. payData:{
  38. payStatus:0,
  39. title:'支付处理中',
  40. desc:'正在处理中,请等待',
  41. icon:"/static/icon/pay-handel.png"
  42. }
  43. }
  44. },
  45. onLoad(options) {
  46. if (this.$isEmpty(options.payResult)) {
  47. this.$dialog.showModalAndBack('支付结果不能为空')
  48. return
  49. }
  50. this.payResult=JSON.parse(options.payResult)
  51. this.handelPayResult()
  52. },
  53. methods: {
  54. showTips(id){
  55. let tipsTxt1='现金支付 '+this.payResult.amountNum+" 元"
  56. let tipsTxt2='积分支付 '+this.payResult.pointsNum+" 元"
  57. this.tooltipBtns=[tipsTxt1,tipsTxt2]
  58. this.tooltipShow = true;
  59. this.eleId =id;
  60. },
  61. confirm(){
  62. uni.reLaunch({
  63. url:'/pages/mine/mine'
  64. })
  65. },
  66. //处理支付回调结果
  67. handelPayResult(){
  68. if (this.payResult.isSuccess==true) {
  69. this.changePayData(1)
  70. }
  71. if (this.payResult.isSuccess==false) {
  72. this.changePayData(2)
  73. }
  74. },
  75. changePayData(type){
  76. if (type==1) {
  77. this.payData={
  78. payStatus:1,
  79. title:'支付成功',
  80. icon:"/static/icon/pay-success.png"
  81. }
  82. }else if (type==2) {
  83. this.payData={
  84. payStatus:2,
  85. title:'支付失败',
  86. desc:this.payResult.msg,
  87. icon:"/static/icon/pay-fail.png"
  88. }
  89. }
  90. },
  91. }
  92. }
  93. </script>
  94. <style>
  95. page{
  96. background-color: #FFFFFF;
  97. }
  98. </style>
  99. <style lang="scss" scoped>
  100. .content{
  101. margin-top: 180rpx;
  102. display: flex;
  103. justify-content: center;
  104. align-items: center;
  105. flex-direction: column;
  106. image{
  107. width: 150rpx;
  108. height: 150rpx;
  109. }
  110. .tips{
  111. margin-top: 50rpx;
  112. display: flex;
  113. flex-direction: column;
  114. text-align: center;
  115. .title{
  116. font-size: 38rpx;
  117. }
  118. .desc{
  119. margin-top: 20rpx;
  120. font-size: 28rpx;
  121. color: #969696;
  122. }
  123. }
  124. .btn{
  125. margin-top: 180rpx;
  126. width: 60%;
  127. padding: 42rpx;
  128. }
  129. }
  130. </style>