order-success.vue 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  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,
  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]
  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.shopOrderId = data.data.shopOrderId
  70. this.payType = data.data.type
  71. this.amuntMoney = data.data.payAmount
  72. if(this.payType == 'success'){
  73. this.payStatus = true
  74. this.successText = '订单支付成功'
  75. }else{
  76. this.payStatus = false
  77. this.successText = '订单支付失败'
  78. }
  79. this.PayOrderCheckoutCounter(this.shopOrderId)
  80. },
  81. async PayOrderCheckoutCounter(shopOrderId){//初始化支付信息
  82. try{
  83. const res = await this.PayService.PayOrderCheckoutCounter({ shopOrderId : shopOrderId })
  84. const data = res.data.shopOrder
  85. const status = data.status //子订单状态
  86. this.mapStateArr.forEach(value => {
  87. if(status === value){
  88. this.payBtnStatus = true
  89. }
  90. })
  91. this.isRepuest = true
  92. }catch(error){
  93. this.$util.msg(error.msg,2000)
  94. }
  95. },
  96. toAgainPay(){
  97. this.$api.reLaunch(`/pages/user/order/order-pay-list?orderId=${this.orderId}`)
  98. },
  99. details(){
  100. this.$api.reLaunch('/pages/user/order/order-details?type=share&orderId='+this.orderId)
  101. }
  102. },
  103. onShow() {
  104. }
  105. }
  106. </script>
  107. <style lang="scss">
  108. page{
  109. height: auto !important;
  110. }
  111. .container-cash{
  112. width: 100%;
  113. .container-wrapper{
  114. width:100%;
  115. height: auto;
  116. padding: 120rpx 24rpx 0 24rpx;
  117. box-sizing: border-box;
  118. .cash-icon{
  119. width: 100%;
  120. height: 90rpx;
  121. text-align: center;
  122. .iconfont{
  123. font-size: 80rpx;
  124. &.icon-wancheng{
  125. color:#00BE6F ;
  126. }
  127. &.icon-shibai{
  128. color:#F94B4B ;
  129. }
  130. }
  131. }
  132. .cash-text{
  133. width: 100%;
  134. height: 90rpx;
  135. text-align: center;
  136. font-size: $font-size-28;
  137. color: $text-color;
  138. line-height: 90rpx;
  139. padding-bottom: 40rpx;
  140. }
  141. }
  142. .container-amount{
  143. width: 100%;
  144. height: 130rpx;
  145. box-sizing: border-box;
  146. padding: 0 24rpx;
  147. margin-bottom: 24rpx;
  148. font-size: $font-size-28;
  149. color: #333333;
  150. line-height: 90rpx;
  151. border-top: 20rpx solid #F7F7F7;
  152. border-bottom: 20rpx solid #F7F7F7;
  153. .amount-label{
  154. float: left;
  155. font-weight: bold;
  156. }
  157. .amount-money{
  158. float: right;
  159. text-align: right;
  160. }
  161. }
  162. .container-button{
  163. width: 100%;
  164. box-sizing: border-box;
  165. padding: 80rpx 75rpx;
  166. .btn{
  167. width: 100%;
  168. height: 90rpx;
  169. border-radius: 50rpx;
  170. line-height: 90rpx;
  171. box-sizing: border-box;
  172. text-align: center;
  173. font-size: $font-size-26;
  174. color: #FFFFFF;
  175. margin: 24rpx 0;
  176. &.btn-open{
  177. background:#FFFFFF;
  178. border: 1px solid $color-system;
  179. color: $color-system;
  180. }
  181. &.btn-home{
  182. background:$btn-confirm;
  183. }
  184. }
  185. }
  186. }
  187. </style>