svip.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. <!-- svip页面 -->
  2. <template>
  3. <view class="ezy-svip-page">
  4. <view class="icon-title-navBar-box">
  5. <!-- 返回按钮 ↓ -->
  6. <view class="nav-bar-icon" @click="goBack"></view>
  7. <view class="nav-bar-title">开通svip</view>
  8. </view>
  9. <!-- :class="'svip-login'+Id" 改到下方 -->
  10. <icon :class="'svip-login'+cardId"></icon>
  11. <view class="svip-list-box">
  12. <view v-for="(item, index) in svipArr" :key="index" class="list-item-box">
  13. <icon class="list-icon" :style="{backgroundImage: 'url(' + item.iconPath + ')'}"></icon>
  14. <view>
  15. <view class="list-title">{{item.title}}</view>
  16. <view class="list-content" v-html="item.content"></view>
  17. </view>
  18. </view>
  19. </view>
  20. <view class="open-svip-box">
  21. <view class="svip-price-box">
  22. <view>原价:<text class="original-price">¥598</text></view>
  23. <view class="discount-price">活动价:¥198</view>
  24. </view>
  25. <radio-group @change="radioChange" class="pay-type-box">
  26. <view class="type-radio-title">支付方式</view>
  27. <view class="type-radio-content">
  28. <view class="type-radio-box">
  29. <icon class="wx-radio"></icon>
  30. <text>微信</text>
  31. <radio value="weixin" :checked="payType==='weixin'" activeBackgroundColor="transparent"
  32. :class="{'radio-checked': payType==='weixin'}" />
  33. </view>
  34. <view class="type-radio-box">
  35. <icon class="zfb-radio"></icon>
  36. <text>支付宝</text>
  37. <radio value="zhifubao" :checked="payType==='zhifubao'" activeBackgroundColor="transparent"
  38. :class="{'radio-checked': payType==='zhifubao'}" style="margin-right: 0;" />
  39. </view>
  40. </view>
  41. </radio-group>
  42. <view class="open-svip-btn" @click="creatOrder">立即开通</view>
  43. </view>
  44. <CustomTabBar></CustomTabBar>
  45. <tip-middle-dialog ref="daoPokeRef" @confirm-btn="daoPokeConfirm" :content="daoPokeContent"></tip-middle-dialog>
  46. </view>
  47. </template>
  48. <script setup>
  49. import {
  50. ref
  51. } from "vue";
  52. import {
  53. orderAdd
  54. } from "@/api/order.js"
  55. import CustomTabBar from '@/components/custom-tabbar/custom-tabbar.vue';
  56. import cacheManager from "@/utils/cacheManager.js";
  57. import tipMiddleDialog from '@/components/dialog/tipMiddleDialog.vue';
  58. import {
  59. onLoad,
  60. onReady
  61. } from '@dcloudio/uni-app';
  62. import {
  63. toast,
  64. getUserIdentity
  65. } from "@/utils/common";
  66. let payType = ref('weixin')
  67. let cardId = ref('')
  68. const daoPokeContent = '蛋破壳了!';
  69. const daoPokeRef = ref(null);
  70. const svipArr = [{
  71. iconPath: 'static/images/pay/svip-list-icon1.png',
  72. title: '学习资源,随心畅学',
  73. content: `解锁L1~L6全等级数学思维优质学习资源,<br/>满足多样学习需求`
  74. },
  75. {
  76. iconPath: 'static/images/pay/svip-list-icon2.png',
  77. title: '名师打造,优质路径',
  78. content: '资深名师精心规划学习路径,引领高效提升方向'
  79. },
  80. {
  81. iconPath: 'static/images/pay/svip-list-icon3.png',
  82. title: '进度分析,个性贴心',
  83. content: '优先参与丰富真题测试,精准洞察学习状况'
  84. },
  85. {
  86. iconPath: 'static/images/pay/svip-list-icon4.png',
  87. title: '真题测试,优先体验',
  88. content: '成为会员,即刻畅享专属权益,开启无忧学习之旅'
  89. }
  90. ];
  91. onLoad((options) => {
  92. cardId.value = options.cardId
  93. })
  94. function daoPokeConfirm() {
  95. daoPokeRef.value.handleClose();
  96. }
  97. function radioChange(data) {
  98. payType.value = data.detail.value;
  99. }
  100. function creatOrder(data) {
  101. let req = {
  102. cardId: cardId.value
  103. }
  104. orderAdd(req).then(res => {
  105. console.log('res');
  106. cacheManager.updateVipStatus('auth', cardId.value)
  107. toast('开通成功!')
  108. daoPokeRef.value.handleShow();
  109. setTimeout(() => {
  110. daoPokeConfirm()
  111. },2000)
  112. return
  113. uni.redirectTo({
  114. url: '/pages/study/index'
  115. })
  116. })
  117. }
  118. function goBack(data) {
  119. uni.redirectTo({
  120. url: '/pages/study/index'
  121. })
  122. }
  123. </script>
  124. <style>
  125. </style>