success.vue 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  1. <template>
  2. <view class="container cashier">
  3. <header-pay
  4. :systeminfo="systeminfo"
  5. :navbar-data="nvabarData"
  6. :headerBtnPosi="headerBtnPosi"
  7. :isBackType="true"
  8. :path="'/pages/user/cart/cart'"
  9. >
  10. </header-pay>
  11. <view class="container-cash clearfix" :style="{ marginTop: CustomBar + 'px' }">
  12. <view class="container-wrapper">
  13. <view class="cash-icon"> <image :src="StaticUrl + 'icon-pay-success.png'" mode=""></image> </view>
  14. <view class="cash-text">
  15. <text>{{ successText }}</text>
  16. </view>
  17. </view>
  18. <view class="container-money">
  19. <view class="label">支付金额</view>
  20. <view class="money">¥{{ orderInfo.payableAmount | NumFormat }}</view>
  21. </view>
  22. <view class="container-button">
  23. <view class="btn btn-pay" @click="goHome">继续购买</view>
  24. <view class="btn btn-open" @click="searchOrder">查看订单</view>
  25. </view>
  26. </view>
  27. <cm-loading :visible="isSubLoading" :text="loadingText"></cm-loading>
  28. </view>
  29. </template>
  30. <script>
  31. import HeaderPay from '@/components/cm-module/headerNavbar/header-pay'
  32. import authorize from '@/common/authorize.js'
  33. import CmLoading from '@/components/cm-module/cm-loading/cm-loading.vue'
  34. import wechatPay from '@/mixins/wechatPay.js'
  35. import { mapGetters } from 'vuex'
  36. export default {
  37. components: {
  38. HeaderPay,
  39. CmLoading
  40. },
  41. // 混入支付
  42. mixins: [wechatPay],
  43. data() {
  44. return {
  45. StaticUrl: this.$Static,
  46. CustomBar: this.CustomBar, // 顶部导航栏高度
  47. orderId: '',
  48. nvabarData: {
  49. //顶部自定义导航
  50. haveBack: false,
  51. showCapsule: 1, // 是否显示左上角图标 1表示显示 0表示不显示,
  52. showSearch: 0,
  53. title: '支付结果', // 导航栏 中间的标题
  54. textLeft: this.$store.getters.isIphone
  55. },
  56. headerBtnPosi: this.setHeaderBtnPosi(), //获取设备顶部胶囊高度
  57. systeminfo: this.setSysteminfo(), //获取设备信息
  58. successText: '订单支付成功',
  59. orderInfo: {}
  60. }
  61. },
  62. onLoad() {
  63. this.initOrderInfo()
  64. },
  65. filters: {
  66. NumFormat(value) {
  67. //处理金额
  68. return Number(value).toFixed(2)
  69. }
  70. },
  71. computed: {
  72. ...mapGetters(['isIphoneX']),
  73. hanldOrder() {
  74. return {
  75. order: this.orderInfo
  76. }
  77. }
  78. },
  79. methods: {
  80. initOrderInfo() {
  81. this.orderInfo = uni.getStorageSync('orderInfo')
  82. uni.removeStorageSync('orderInfo')
  83. },
  84. setHeaderBtnPosi() {
  85. // 获得胶囊按钮位置信息
  86. let headerBtnPosi = uni.getMenuButtonBoundingClientRect()
  87. return headerBtnPosi
  88. },
  89. setSysteminfo() {
  90. let systeminfo
  91. uni.getSystemInfo({
  92. // 获取设备信息
  93. success: res => {
  94. systeminfo = res
  95. }
  96. })
  97. return systeminfo
  98. },
  99. // 回到首页
  100. goHome() {
  101. uni.reLaunch({ url: '/pages/tabBar/index/index' })
  102. },
  103. // 查看订单
  104. searchOrder() {
  105. this.$api.redirectTo('/pages/user/order/order-details?type=confim&orderId=' + this.orderInfo.orderId)
  106. }
  107. }
  108. }
  109. </script>
  110. <style lang="scss" scoped>
  111. page {
  112. background-color: #f7f7f7;
  113. height: auto !important;
  114. }
  115. .container-cash {
  116. width: 100%;
  117. .container-wrapper {
  118. width: 100%;
  119. margin: 0 auto;
  120. margin-top: 120rpx;
  121. display: flex;
  122. flex-direction: column;
  123. align-items: center;
  124. background-color: #ffffff;
  125. .cash-icon {
  126. width: 210rpx;
  127. height: 210rpx;
  128. margin-top: 112rpx;
  129. image {
  130. width: 210rpx;
  131. height: 210rpx;
  132. }
  133. }
  134. .cash-text {
  135. font-size: $font-size-28;
  136. color: #666666;
  137. line-height: 104rpx;
  138. font-weight: bold;
  139. }
  140. }
  141. .container-money {
  142. width: 100%;
  143. height: 90rpx;
  144. float: left;
  145. line-height: 90rpx;
  146. font-size: $font-size-28;
  147. box-sizing: border-box;
  148. padding: 0 24rpx;
  149. margin-top: 20rpx;
  150. background-color: #ffffff;
  151. .label {
  152. float: left;
  153. color: #333333;
  154. }
  155. .money {
  156. float: right;
  157. color: #666666;
  158. }
  159. }
  160. .container-button {
  161. width: 100%;
  162. height: auto;
  163. float: left;
  164. display: flex;
  165. flex-direction: column;
  166. align-items: center;
  167. margin-top: 160rpx;
  168. .btn {
  169. width: 600rpx;
  170. height: 90rpx;
  171. border-radius: 45rpx;
  172. line-height: 90rpx;
  173. text-align: center;
  174. font-size: $font-size-26;
  175. color: #ffffff;
  176. box-sizing: border-box;
  177. border: 1px solid $color-system;
  178. margin-bottom: 24rpx;
  179. &.btn-open {
  180. color: $color-system;
  181. }
  182. &.btn-pay {
  183. border-color: $color-system;
  184. background: $btn-confirm;
  185. }
  186. }
  187. }
  188. }
  189. </style>