index.vue 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251
  1. <template>
  2. <view class="vip">
  3. <view style="height: 20rpx;"></view>
  4. <view class="topCard">
  5. <view class="vipInfo">
  6. <view class="left">
  7. <view class="ownVip">当前会员:<text>{{setMealName||'普通用户'}}</text></view>
  8. <view class="endTime">会员到期时间: 2023-10-19 22:25:10</view>
  9. </view>
  10. <view class="right">
  11. <image slot="icon" src="../../static/vipTypology-icon.png" mode="widthFix"></image>
  12. </view>
  13. </view>
  14. <view class="inputBox">
  15. <input type="text" v-model="vipQuery.activationCode" placeholder="请输入激活码" placeholder-class="activationIpt" />
  16. <u-button type="error " :loading="redeemload" loadingSize="20" shape="circle" text="立即兑换"
  17. @click="confirmActivation"></u-button>
  18. </view>
  19. </view>
  20. <view class="listCard">
  21. <view class="listTitle">激活记录</view>
  22. <view class="listBox" v-if="activationList.length>0">
  23. <view class="list" v-for="item of 4">
  24. <view class="vipTitle">
  25. <view class="">尊享会员</view>
  26. <view class="">已激活</view>
  27. </view>
  28. <view class="listInfo">
  29. <view class="">激活码:<text>JTsjTIENS03J35ID</text></view>
  30. <view class="">激活时间: 2023-10-19 22:25:10</view>
  31. </view>
  32. </view>
  33. </view>
  34. <block v-else>
  35. <u-empty mode="data" textSize="20" iconSize="120" text="暂无激活记录"></u-empty>
  36. </block>
  37. </view>
  38. </view>
  39. </template>
  40. <script>
  41. import {mealList} from '@/api/combo.js'
  42. import { selectActivationCode,getActivationList } from '@/api/vipActivation.js'
  43. import { levelImgName } from '@/utils/config.js'
  44. export default {
  45. data() {
  46. return {
  47. redeemload: false,
  48. activationList: [],
  49. list:[],
  50. userInfo:'',
  51. setMealName:'',
  52. vipQuery:{
  53. phoneNum:'',
  54. activationCode:'',
  55. }
  56. }
  57. },
  58. onShow() {
  59. },
  60. onLoad() {
  61. this.userInfo=JSON.parse(uni.getStorageSync('userInfo'))
  62. this.vipQuery.phoneNum=this.userInfo.phoneNum
  63. this.mealList()
  64. this.get_activationList()
  65. },
  66. methods: {
  67. // 激活列表
  68. get_activationList(){
  69. getActivationList().then(res=>{
  70. if(res.state=='Success'){
  71. this.activationList=res.content
  72. }
  73. })
  74. },
  75. // 二次确认
  76. confirmActivation() {
  77. let that = this
  78. uni.showModal({
  79. title: '提示',
  80. content: '确认兑换当前激活码吗?',
  81. success(res) {
  82. if (res.confirm) {
  83. that.redeemload = true
  84. that.select_activationCode()
  85. }
  86. }
  87. })
  88. },
  89. // 兑换激活码
  90. select_activationCode(){
  91. selectActivationCode(this.vipQuery).then(res=>{
  92. this.redeemload=false
  93. if(res.state=='Success'){
  94. uni.showToast({
  95. title: '激活成功',
  96. });
  97. this.get_activationList()
  98. }else{
  99. uni.showToast({
  100. title: res.content,
  101. });
  102. }
  103. })
  104. },
  105. // 获取套餐列表
  106. mealList(){
  107. mealList({currentPage:1,pageSize:99,status:1}).then(res=>{
  108. if (res.state == 'Success') {
  109. this.list = res.content.records
  110. // 判断当前会员类型
  111. this.list.map(item=>{
  112. if(item.setMealCode == this.userInfo.setMealCode){
  113. this.setMealName = item.setMealName
  114. }
  115. })
  116. }
  117. })
  118. },
  119. }
  120. }
  121. </script>
  122. <style lang="scss">
  123. .vip {
  124. height: 100vh;
  125. padding: 0 24rpx;
  126. background: #F9F9F9;
  127. .topCard {
  128. background: #fff;
  129. border-radius: 8rpx;
  130. padding: 20rpx;
  131. .vipInfo {
  132. display: flex;
  133. align-items: center;
  134. justify-content: space-between;
  135. .left {
  136. .ownVip {
  137. font-size: 28rpx;
  138. color: #181818;
  139. font-weight: bold;
  140. &>text {
  141. margin-left: 10rpx;
  142. font-weight: bold;
  143. font-size: 36rpx;
  144. }
  145. }
  146. .endTime {
  147. margin-top: 20rpx;
  148. font-weight: normal;
  149. font-size: 24rpx;
  150. color: #AAAAAA;
  151. }
  152. }
  153. .right {
  154. &>image {
  155. width: 100rpx;
  156. }
  157. }
  158. }
  159. .inputBox {
  160. display: flex;
  161. align-items: center;
  162. border: #F9F9F9 4rpx solid;
  163. border-radius: 50rpx;
  164. padding: 6rpx;
  165. margin-top: 20rpx;
  166. &>input {
  167. margin-left: 8rpx;
  168. width: 1800rpx;
  169. }
  170. .activationIpt {
  171. font-size: 28rpx;
  172. color: #AAAAAA;
  173. }
  174. }
  175. }
  176. .listCard {
  177. background: #fff;
  178. border-radius: 8rpx;
  179. padding: 20rpx;
  180. margin-top: 20rpx;
  181. .listTitle {
  182. font-weight: bold;
  183. font-size: 28rpx;
  184. color: #222222;
  185. }
  186. .listBox {
  187. .list {
  188. border-bottom: 1rpx solid #F0F0F0;
  189. .vipTitle {
  190. display: flex;
  191. align-items: center;
  192. justify-content: space-between;
  193. font-weight: bold;
  194. font-size: 32rpx;
  195. margin-top: 20rpx;
  196. &>view:first-child {
  197. color: #222222;
  198. }
  199. &>view:last-child {
  200. color: #FF4A39;
  201. }
  202. }
  203. .listInfo {
  204. margin-top: 20rpx;
  205. &>view:first-child {
  206. font-weight: normal;
  207. color: #222222;
  208. font-size: 24rpx;
  209. &>text {
  210. margin-left: 10rpx;
  211. color: #AAAAAA;
  212. }
  213. }
  214. &>view:last-child {
  215. height: 64rpx;
  216. line-height: 64rpx;
  217. font-size: 24rpx;
  218. font-weight: normal;
  219. color: #222222;
  220. }
  221. }
  222. }
  223. }
  224. }
  225. }
  226. </style>