success.vue 4.6 KB

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