pay-result.vue 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  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 '../../comps/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:"/pagesC/static/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. if (this.$isNotEmpty(this.payResult.goodsBillsId)) {
  63. uni.redirectTo({
  64. url:"/pagesD/pages/take-order/take-order?id="+this.payResult.goodsBillsId
  65. })
  66. }else{
  67. uni.reLaunch({
  68. url:'/pages/mine/mine'
  69. })
  70. }
  71. },
  72. //处理支付回调结果
  73. handelPayResult(){
  74. if (this.payResult.isSuccess==true) {
  75. this.changePayData(1)
  76. }
  77. if (this.payResult.isSuccess==false) {
  78. this.changePayData(2)
  79. }
  80. },
  81. changePayData(type){
  82. if (type==1) {
  83. this.payData={
  84. payStatus:1,
  85. title:'支付成功',
  86. icon:"/pagesC/static/pay-success.png"
  87. }
  88. }else if (type==2) {
  89. this.payData={
  90. payStatus:2,
  91. title:'支付失败',
  92. desc:this.payResult.msg,
  93. icon:"/pagesC/static/pay-fail.png"
  94. }
  95. }
  96. },
  97. }
  98. }
  99. </script>
  100. <style>
  101. page{
  102. background-color: #FFFFFF;
  103. }
  104. </style>
  105. <style lang="scss" scoped>
  106. .content{
  107. margin-top: 180rpx;
  108. display: flex;
  109. justify-content: center;
  110. align-items: center;
  111. flex-direction: column;
  112. image{
  113. width: 150rpx;
  114. height: 150rpx;
  115. }
  116. .tips{
  117. margin-top: 50rpx;
  118. display: flex;
  119. flex-direction: column;
  120. text-align: center;
  121. .title{
  122. font-size: 38rpx;
  123. }
  124. .desc{
  125. margin-top: 20rpx;
  126. font-size: 28rpx;
  127. color: #969696;
  128. }
  129. }
  130. .btn{
  131. margin-top: 180rpx;
  132. width: 60%;
  133. padding: 42rpx;
  134. }
  135. }
  136. </style>