Browse Source

新增激活码会员入口

相识就已经很好了 7 months ago
parent
commit
fd71bd0aa2
8 changed files with 282 additions and 2 deletions
  1. 18 0
      api/vipActivation.js
  2. 251 0
      my/vipActivation/index.vue
  3. 3 1
      package-lock.json
  4. 1 1
      package.json
  5. 6 0
      pages.json
  6. 3 0
      pages/my/index.vue
  7. BIN
      static/vip-icon.png
  8. BIN
      static/vipTypology-icon.png

+ 18 - 0
api/vipActivation.js

@@ -0,0 +1,18 @@
+import {request} from '@/utils/request.js'
+
+// 激活码兑换
+export function selectActivationCode(data) {
+	return request({
+		url: `/vipserver/group/user/activation?phone=${data.phoneNum}&serialNumber=${data.activationCode}`,
+		method: 'post',
+	})
+}
+
+//获取激活列表
+export function getActivationList(data) {
+	return request({
+		url: '/vipserver/group/user/activationList',
+		method: 'post',
+		data
+	})
+}

+ 251 - 0
my/vipActivation/index.vue

@@ -0,0 +1,251 @@
+<template>
+	<view class="vip">
+		<view style="height: 20rpx;"></view>
+		<view class="topCard">
+			<view class="vipInfo">
+				<view class="left">
+					<view class="ownVip">当前会员:<text>{{setMealName||'普通用户'}}</text></view>
+					<view class="endTime">会员到期时间: 2023-10-19 22:25:10</view>
+				</view>
+				<view class="right">
+					<image slot="icon" src="../../static/vipTypology-icon.png" mode="widthFix"></image>
+				</view>
+			</view>
+			<view class="inputBox">
+				<input type="text" v-model="vipQuery.activationCode" placeholder="请输入激活码" placeholder-class="activationIpt" />
+				<u-button type="error " :loading="redeemload" loadingSize="20" shape="circle" text="立即兑换"
+					@click="confirmActivation"></u-button>
+			</view>
+		</view>
+		<view class="listCard">
+			<view class="listTitle">激活记录</view>
+			<view class="listBox" v-if="activationList.length>0">
+				<view class="list" v-for="item of 4">
+					<view class="vipTitle">
+						<view class="">尊享会员</view>
+						<view class="">已激活</view>
+					</view>
+					<view class="listInfo">
+						<view class="">激活码:<text>JTsjTIENS03J35ID</text></view>
+						<view class="">激活时间: 2023-10-19 22:25:10</view>
+					</view>
+				</view>
+			</view>
+			<block v-else>
+				<u-empty mode="data" textSize="20" iconSize="120" text="暂无激活记录"></u-empty>
+			</block>
+		</view>
+	</view>
+</template>
+
+<script>
+	import {mealList} from '@/api/combo.js'
+	import { selectActivationCode,getActivationList } from '@/api/vipActivation.js'
+	import { levelImgName } from '@/utils/config.js'
+	export default {
+		data() {
+			return {
+				redeemload: false,
+				activationList: [],
+				list:[],
+				userInfo:'',
+				setMealName:'',
+				vipQuery:{
+					phoneNum:'',
+					activationCode:'',
+				}
+			}
+		},
+		onShow() {
+		},
+		onLoad() {
+			this.userInfo=JSON.parse(uni.getStorageSync('userInfo'))
+			this.vipQuery.phoneNum=this.userInfo.phoneNum
+			this.mealList()
+			this.get_activationList()
+		},
+
+		methods: {
+			// 激活列表
+			get_activationList(){
+				getActivationList().then(res=>{
+					if(res.state=='Success'){
+						this.activationList=res.content
+					}
+				})
+			},
+			
+			// 二次确认
+			confirmActivation() {
+				let that = this
+				uni.showModal({
+					title: '提示',
+					content: '确认兑换当前激活码吗?',
+					success(res) {
+						if (res.confirm) {
+							that.redeemload = true
+							that.select_activationCode()
+						}
+					}
+				})
+			},
+			
+			// 兑换激活码
+			select_activationCode(){
+				selectActivationCode(this.vipQuery).then(res=>{
+					this.redeemload=false
+					if(res.state=='Success'){
+						uni.showToast({
+							title: '激活成功',
+						});
+						this.get_activationList()
+					}else{
+						uni.showToast({
+							title: res.content,
+						});
+					}
+				})
+			},
+
+			// 获取套餐列表
+			mealList(){
+				mealList({currentPage:1,pageSize:99,status:1}).then(res=>{
+					if (res.state == 'Success') {
+						this.list = res.content.records
+						// 判断当前会员类型
+						this.list.map(item=>{
+							if(item.setMealCode == this.userInfo.setMealCode){
+								this.setMealName = item.setMealName
+							}
+						})
+					}
+				})
+			},
+		}
+	}
+</script>
+
+<style lang="scss">
+	.vip {
+		height: 100vh;
+		padding: 0 24rpx;
+		background: #F9F9F9;
+
+		.topCard {
+			background: #fff;
+			border-radius: 8rpx;
+			padding: 20rpx;
+
+			.vipInfo {
+				display: flex;
+				align-items: center;
+				justify-content: space-between;
+
+				.left {
+					.ownVip {
+						font-size: 28rpx;
+						color: #181818;
+						font-weight: bold;
+
+						&>text {
+							margin-left: 10rpx;
+							font-weight: bold;
+							font-size: 36rpx;
+						}
+					}
+
+					.endTime {
+						margin-top: 20rpx;
+						font-weight: normal;
+						font-size: 24rpx;
+						color: #AAAAAA;
+					}
+				}
+
+				.right {
+					&>image {
+						width: 100rpx;
+					}
+				}
+			}
+
+			.inputBox {
+				display: flex;
+				align-items: center;
+				border: #F9F9F9 4rpx solid;
+				border-radius: 50rpx;
+				padding: 6rpx;
+				margin-top: 20rpx;
+
+				&>input {
+					margin-left: 8rpx;
+					width: 1800rpx;
+				}
+
+				.activationIpt {
+					font-size: 28rpx;
+					color: #AAAAAA;
+				}
+			}
+		}
+
+		.listCard {
+			background: #fff;
+			border-radius: 8rpx;
+			padding: 20rpx;
+			margin-top: 20rpx;
+
+			.listTitle {
+				font-weight: bold;
+				font-size: 28rpx;
+				color: #222222;
+			}
+
+			.listBox {
+				.list {
+					border-bottom: 1rpx solid #F0F0F0;
+
+					.vipTitle {
+						display: flex;
+						align-items: center;
+						justify-content: space-between;
+						font-weight: bold;
+						font-size: 32rpx;
+						margin-top: 20rpx;
+
+						&>view:first-child {
+							color: #222222;
+						}
+
+						&>view:last-child {
+							color: #FF4A39;
+						}
+					}
+
+					.listInfo {
+						margin-top: 20rpx;
+
+						&>view:first-child {
+							font-weight: normal;
+							color: #222222;
+							font-size: 24rpx;
+
+							&>text {
+								margin-left: 10rpx;
+								color: #AAAAAA;
+							}
+						}
+
+						&>view:last-child {
+							height: 64rpx;
+							line-height: 64rpx;
+							font-size: 24rpx;
+							font-weight: normal;
+							color: #222222;
+						}
+					}
+				}
+			}
+		}
+	}
+</style>

+ 3 - 1
package-lock.json

@@ -1,6 +1,8 @@
 {
-  "requires": true,
+  "name": "双向滑动条",
+  "version": "v1.1.0",
   "lockfileVersion": 1,
+  "requires": true,
   "dependencies": {
     "address": {
       "version": "1.2.2",

+ 1 - 1
package.json

@@ -8,4 +8,4 @@
         "双向滑动条",
         "slider"
     ]
-}
+}

+ 6 - 0
pages.json

@@ -309,6 +309,12 @@
 					"style": {
 						"navigationBarTitleText": "客服"
 					}
+				},
+				{
+					"path": "vipActivation/index",
+					"style": {
+						"navigationBarTitleText": "会员激活"
+					}
 				}
 			]
 		},

+ 3 - 0
pages/my/index.vue

@@ -86,6 +86,9 @@
 		<!-- 	<u-cell title="研学MBTI测试"  @click="jump('../../study/test')" :border="false" :isLink="true" arrow-direction="right">
 				<image slot="icon" class="cell-icon" src="../../static/icon8.png" mode=""></image>
 			</u-cell> -->
+			<u-cell title="会员激活"  @click="jump('../../my/vipActivation/index')" :border="false" :isLink="true" arrow-direction="right">
+				<image slot="icon" class="cell-icon" src="../../static/vip-icon.png" mode=""></image>
+			</u-cell>
 			<u-cell title="设置"  @click="jump('../../my/edit/edit')" :border="false" :isLink="true" arrow-direction="right">
 				<image slot="icon" class="cell-icon" src="../../static/setting-icon.png" mode=""></image>
 			</u-cell>

BIN
static/vip-icon.png


BIN
static/vipTypology-icon.png