success.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  1. <template>
  2. <view class="container cashier">
  3. <cu-custom :navbar-data='nvabarData'></cu-custom>
  4. <view class="container-cash clearfix" :style="{marginTop:CustomBar+'px'}">
  5. <view class="container-wrapper">
  6. <view class="cash-icon">
  7. <text class="iconfont" :class="payStatus ? 'icon-wancheng' : 'icon-shibai'"></text>
  8. </view>
  9. <view class="cash-text">
  10. <text>{{ successText }}</text>
  11. </view>
  12. </view>
  13. <view class="container-amount">
  14. <view class="amount-label">支付金额</view>
  15. <view class="amount-money">¥{{ amuntMoney | NumFormat }}</view>
  16. </view>
  17. <view class="container-button">
  18. <view class="btn btn-home" v-if="payBtnStatus" @click="toAgainPay">继续下一笔支付</view>
  19. <view class="btn btn-home" v-else @click="this.$api.switchTabTo('/pages/tabBar/home/index')">回到首页</view>
  20. <view class="btn btn-open" @click="details">查看订单</view>
  21. </view>
  22. </view>
  23. </view>
  24. </template>
  25. <script>
  26. export default{
  27. data(){
  28. return{
  29. orderId:0,
  30. nvabarData: { //顶部自定义导航
  31. haveBack:false,
  32. haveHome:true,
  33. showCapsule:1, // 是否显示左上角图标 1表示显示 0表示不显示,
  34. showSearch: 0,
  35. title: '支付结果', // 导航栏 中间的标题
  36. textLeft:this.$store.state.isIphone
  37. },
  38. payType:'',
  39. payStatus:true,
  40. payBtnStatus:false,
  41. amuntMoney:0,
  42. successText:'订单支付失败',
  43. isIphoneX:this.$store.state.isIphoneX,
  44. CustomBar:this.CustomBar,// 顶部导航栏高度
  45. mapStateArr:[11,12,13,21,22,23,111]
  46. }
  47. },
  48. filters:{
  49. NumFormat(value) {
  50. //处理金额
  51. if (value) {
  52. return Number(value).toFixed(2)
  53. } else {
  54. return '0.00'
  55. }
  56. }
  57. },
  58. onLoad(option) {
  59. this.initData(option)
  60. },
  61. methods:{
  62. initOrderInfo() {
  63. this.orderInfo = uni.getStorageSync('orderInfo')
  64. uni.removeStorageSync('orderInfo')
  65. },
  66. initData(option){
  67. const data = JSON.parse(option.data)
  68. this.orderId = data.data.orderId
  69. this.payType = data.data.type
  70. this.amuntMoney = data.data.payAmount
  71. if(this.payType == 'success'){
  72. this.payStatus = true
  73. this.successText = '订单支付成功'
  74. }else{
  75. this.payStatus = false
  76. this.successText = '订单支付失败'
  77. }
  78. this.PayOrderCheckoutCounter(this.orderId)
  79. },
  80. PayOrderCheckoutCounter(orderId){//初始化支付信息
  81. this.PayService.PayOrderCheckoutCounter({ orderId : orderId }).then(response =>{
  82. this.isRepuest = true
  83. const status = response.data.order.status //主订单状态
  84. this.mapStateArr.forEach(value => {
  85. if(status === value){
  86. this.payBtnStatus = true
  87. }
  88. })
  89. }).catch(error =>{
  90. this.$util.msg(error.msg,2000)
  91. })
  92. },
  93. toAgainPay(){
  94. this.$api.reLaunch(`/pages/user/order/order-pay-list?orderId=${this.orderId}`)
  95. },
  96. details(){
  97. this.$api.reLaunch('/pages/user/order/order-details?type=share&orderId='+this.orderId)
  98. }
  99. },
  100. onShow() {
  101. }
  102. }
  103. </script>
  104. <style lang="scss">
  105. page{
  106. height: auto !important;
  107. }
  108. .container-cash{
  109. width: 100%;
  110. .container-wrapper{
  111. width:100%;
  112. height: auto;
  113. padding: 120rpx 24rpx 0 24rpx;
  114. box-sizing: border-box;
  115. .cash-icon{
  116. width: 100%;
  117. height: 90rpx;
  118. text-align: center;
  119. .iconfont{
  120. font-size: 80rpx;
  121. &.icon-wancheng{
  122. color:#00BE6F ;
  123. }
  124. &.icon-shibai{
  125. color:#F94B4B ;
  126. }
  127. }
  128. }
  129. .cash-text{
  130. width: 100%;
  131. height: 90rpx;
  132. text-align: center;
  133. font-size: $font-size-28;
  134. color: $text-color;
  135. line-height: 90rpx;
  136. padding-bottom: 40rpx;
  137. }
  138. }
  139. .container-amount{
  140. width: 100%;
  141. height: 130rpx;
  142. box-sizing: border-box;
  143. padding: 0 24rpx;
  144. margin-bottom: 24rpx;
  145. font-size: $font-size-28;
  146. color: #333333;
  147. line-height: 90rpx;
  148. border-top: 20rpx solid #F7F7F7;
  149. border-bottom: 20rpx solid #F7F7F7;
  150. .amount-label{
  151. float: left;
  152. font-weight: bold;
  153. }
  154. .amount-money{
  155. float: right;
  156. text-align: right;
  157. }
  158. }
  159. .container-button{
  160. width: 100%;
  161. box-sizing: border-box;
  162. padding: 80rpx 75rpx;
  163. .btn{
  164. width: 100%;
  165. height: 90rpx;
  166. border-radius: 50rpx;
  167. line-height: 90rpx;
  168. box-sizing: border-box;
  169. text-align: center;
  170. font-size: $font-size-26;
  171. color: #FFFFFF;
  172. margin: 24rpx 0;
  173. &.btn-open{
  174. background:#FFFFFF;
  175. border: 1px solid $color-system;
  176. color: $color-system;
  177. }
  178. &.btn-home{
  179. background:$btn-confirm;
  180. }
  181. }
  182. }
  183. }
  184. </style>