耀实惠小程序
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

122 lines
2.6 KiB

  1. <template>
  2. <view class="pages">
  3. <image :src="img_url+'member/success.png'" mode=""></image>
  4. <text>认证成功</text>
  5. <button @click="toUpgradesRenewals">开通会员</button>
  6. <!-- <button @click="toUpgradesRenewals" v-else>{{type == 0?'升级会员':'立即续费'}}</button> -->
  7. </view>
  8. </template>
  9. <script>
  10. import config_img from "@/utils/js/config.js"
  11. export default {
  12. data() {
  13. return {
  14. img_url: config_img.img_url,
  15. id: '',
  16. type: ''
  17. }
  18. },
  19. onLoad(options) {
  20. this.id = options.id
  21. this.type = options.type
  22. },
  23. methods: {
  24. // 获取用户信息
  25. getUserInfo () {
  26. uni.showLoading();
  27. this.$api('getUserInfo')
  28. .then(res => {
  29. let { code, result, message } = res
  30. uni.hideLoading();
  31. if (code === 200) {
  32. const userInfo = {...result.userInfo,...result.account}
  33. this.$storage.setStorage("__user_info",userInfo)
  34. console.log(userInfo)
  35. } else {
  36. this.$Toast(message)
  37. }
  38. })
  39. .catch(err => {
  40. this.$Toast(err.message)
  41. uni.hideLoading();
  42. })
  43. },
  44. toUpgradesRenewals() {
  45. const id = this.id
  46. console.log(this.type == 0,this.type )
  47. let url = this.type == 0 ? 'vipRolePay': 'vipPay'
  48. this.$api(url,{id}).then(res =>{
  49. const { code, result, message } = res
  50. console.log(res)
  51. if (code == 200) {
  52. uni.requestPayment({
  53. provider: 'wxpay',
  54. timeStamp: result.timeStamp,
  55. nonceStr: result.nonceStr,
  56. package: result.packageValue,
  57. signType: result.signType,
  58. paySign: result.paySign,
  59. success: res => {
  60. this.$Toast('支付成功');
  61. // 刷新用户数据
  62. this.getUserInfo();
  63. setTimeout(() => {
  64. this.$tools.navigateTo({
  65. url: './../upgrades_renewals/index'
  66. })
  67. },1500)
  68. },
  69. fail:error=>{
  70. this.$Toast('取消支付')
  71. }
  72. })
  73. } else{
  74. setTimeout(() => {
  75. this.$tools.navigateTo({
  76. url: './../upgrades_renewals/index'
  77. })
  78. },1500)
  79. this.$Toast(message)
  80. }
  81. })
  82. }
  83. }
  84. }
  85. </script>
  86. <style lang="scss" scoped>
  87. .pages{
  88. display: flex;
  89. flex-direction: column;
  90. align-items: center;
  91. image{
  92. width: 451rpx;
  93. height: 401rpx;
  94. margin-top: 161rpx;
  95. margin-bottom: 32rpx;
  96. }
  97. text{
  98. font-size: 45rpx;
  99. font-weight: bold;
  100. color: #01AEEA;
  101. }
  102. button{
  103. margin-top: 133rpx;
  104. width: 569rpx;
  105. height: 94rpx;
  106. border: 3rpx solid #01AEEA;
  107. box-sizing: border-box;
  108. border-radius: 46rpx;
  109. background-color: #fff;
  110. font-size: 30rpx;
  111. font-weight: bold;
  112. color: #01AEEA;
  113. text-align: center;
  114. line-height: 94rpx;
  115. }
  116. }
  117. </style>