wenjie 7 месяцев назад
Родитель
Сommit
78c3f231e3
4 измененных файлов с 99 добавлено и 119 удалено
  1. 62 44
      my/vipActivation/index.vue
  2. 33 74
      special/kaihui.vue
  3. 3 0
      uni_modules/uview-ui/components/u-toast/u-toast.vue
  4. 1 1
      utils/request.js

+ 62 - 44
my/vipActivation/index.vue

@@ -8,11 +8,14 @@
 					<view class="endTime">会员到期时间: {{expireTime||'--'}}</view>
 				</view>
 				<view class="right">
-					<image slot="icon" src="http://zswl-dev.oss-cn-chengdu.aliyuncs.com/63b7c68b71a69169d1b33f92/store/bdb/user/avatar/Jm8VtOGY6Bqg6cf0dd7cba21cff1cf57cd5a36effe8f.png/1.png" mode="widthFix"></image>
+					<image slot="icon"
+						src="http://zswl-dev.oss-cn-chengdu.aliyuncs.com/63b7c68b71a69169d1b33f92/store/bdb/user/avatar/Jm8VtOGY6Bqg6cf0dd7cba21cff1cf57cd5a36effe8f.png/1.png"
+						mode="widthFix"></image>
 				</view>
 			</view>
 			<view class="inputBox">
-				<input type="text" v-model="vipQuery.activationCode" placeholder="请输入激活码" placeholder-class="activationIpt" />
+				<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>
@@ -35,35 +38,46 @@
 				<u-empty mode="data" textSize="20" iconSize="120" text="暂无激活记录"></u-empty>
 			</block>
 		</view>
+		<u-toast ref="uToast"></u-toast>
 	</view>
 </template>
 
 <script>
-	import {mealList} from '@/api/combo.js'
-	import {refreshVip} from '@/api/common.js'
-	import { selectActivationCode,getActivationList } from '@/api/vipActivation.js'
-	import { levelImgName } from '@/utils/config.js'
-	import{timestampToDate} from '@/utils/tool.js'
+	import {
+		mealList
+	} from '@/api/combo.js'
+	import {
+		refreshVip
+	} from '@/api/common.js'
+	import {
+		selectActivationCode,
+		getActivationList
+	} from '@/api/vipActivation.js'
+	import {
+		levelImgName
+	} from '@/utils/config.js'
+	import {
+		timestampToDate
+	} from '@/utils/tool.js'
 	export default {
 		data() {
 			return {
-				expireTime:'',
+				expireTime: '',
 				redeemload: false,
 				activationList: [],
-				list:[],
-				userInfo:'',
-				setMealName:'',
-				vipQuery:{
-					phoneNum:'',
-					activationCode:'',
+				list: [],
+				userInfo: '',
+				setMealName: '',
+				vipQuery: {
+					phoneNum: '',
+					activationCode: '',
 				}
 			}
 		},
-		onShow() {
-		},
+		onShow() {},
 		onLoad() {
-			this.userInfo=JSON.parse(uni.getStorageSync('userInfo'))
-			this.vipQuery.phoneNum=this.userInfo.phoneNum
+			this.userInfo = JSON.parse(uni.getStorageSync('userInfo'))
+			this.vipQuery.phoneNum = this.userInfo.phoneNum
 			this.mealList()
 			this.get_activationList()
 			this.get_userinfo()
@@ -71,26 +85,26 @@
 
 		methods: {
 			// 用户信息
-			get_userinfo(){
-				refreshVip().then(res=>{
-					res.content.map((item)=>{
-						this.expireTime=timestampToDate(item.expirationTime)
+			get_userinfo() {
+				refreshVip().then(res => {
+					res.content.map((item) => {
+						this.expireTime = timestampToDate(item.expirationTime)
 					})
 				})
 			},
-			
+
 			// 激活列表
-			get_activationList(){
-				getActivationList().then(res=>{
-					if(res.state=='Success'){
-						res.content.content.map((item)=>{
-							item.useTime= timestampToDate(item.useTime)
+			get_activationList() {
+				getActivationList().then(res => {
+					if (res.state == 'Success') {
+						res.content.content.map((item) => {
+							item.useTime = timestampToDate(item.useTime)
 						})
-						this.activationList=res.content.content
+						this.activationList = res.content.content
 					}
 				})
 			},
-			
+
 			// 二次确认
 			confirmActivation() {
 				let that = this
@@ -105,33 +119,37 @@
 					}
 				})
 			},
-			
+
 			// 兑换激活码
-			select_activationCode(){
-				selectActivationCode(this.vipQuery).then(res=>{
-					this.redeemload=false
-					if(res.state=='Success'){
+			select_activationCode() {
+				selectActivationCode(this.vipQuery).then(res => {
+					this.redeemload = false
+					if (res.state == 'Success') {
 						uni.showToast({
 							title: '激活成功',
 						});
-						this.vipQuery.activationCode=''
+						this.vipQuery.activationCode = ''
 						this.get_activationList()
-					}else{
-						uni.showToast({
-							title: res.content,
-						});
+					} else if(res.content=='该手机号已订购【惠生活优享会员】,请在会员到期后再使用激活码'){
+						this.$refs.uToast.show({
+							message:res.content
+						})
 					}
 				})
 			},
 
 			// 获取套餐类型
-			mealList(){
-				mealList({currentPage:1,pageSize:99,status:1}).then(res=>{
+			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.list.map(item => {
+							if (item.setMealCode == this.userInfo.setMealCode) {
 								this.setMealName = item.setMealName
 							}
 						})

+ 33 - 74
special/kaihui.vue

@@ -1,16 +1,9 @@
 <template>
 	<view class="kaihuiLink">
-		<view class="imgBox">
-			<image src="http://zswl-dev.oss-cn-chengdu.aliyuncs.com/63b7c68b71a69169d1b33f92/store/bdb/user/avatar/g4F5r34OhLD99e4277ef0139b36812fdd75a8d3b4aad.png/1.png" mode="widthFix"></image>
-		</view>
-		<view class="btn">
-			<view class="kaihuiBtn" @click="handleBtn">立即下单</view>
-		</view>
-		<view class="kaihuiRule">
-			<view class="title">
-				<image src="../static/kaihuifuli.png" mode="widthFix"></image>
-			</view>
-			<view class="text">*仅限本平台会员中国移动用户专享</view>
+		<view class="imgBox" @click="handleBtn">
+			<image
+				src="http://zswl-dev.oss-cn-chengdu.aliyuncs.com/63b7c68b71a69169d1b33f92/store/bdb/user/avatar/ltefe2iGqNPa7eeb7ab61a1b713835d0587ee595b211.jpg/1.jpg"
+				mode="widthFix"></image>
 		</view>
 	</view>
 </template>
@@ -29,100 +22,66 @@
 		},
 		methods: {
 			handleBtn() {
-				if(uni.getStorageSync('token')){
-					if(JSON.parse(uni.getStorageSync('userInfo')).setMealCode != 0&&JSON.parse(uni.getStorageSync('userInfo')).setMealCode){
+				if (uni.getStorageSync('token')) {
+					if (JSON.parse(uni.getStorageSync('userInfo')).setMealCode != 0 && JSON.parse(uni.getStorageSync(
+							'userInfo')).setMealCode) {
 						uni.navigateToMiniProgram({
-							appId:'wx57a08b407511613d',
-							path:'//凯辉/首页/YWUe2IrfXEryMkw'
+							appId: 'wx57a08b407511613d',
+							path: '//凯辉/首页/YWUe2IrfXEryMkw'
 						})
-					}else{
+					} else {
 						uni.showModal({
-							title:'此权益需要开通会员才可使用',
-							cancelText:'下次再说',
-							confirmText:'立即开通',
+							title: '此权益需要开通会员才可使用',
+							cancelText: '下次再说',
+							confirmText: '立即开通',
 							success(res) {
-								if(res.confirm){
+								if (res.confirm) {
 									uni.navigateTo({
-										url:'/my/memberCenter/index'
+										url: '/my/memberCenter/index'
 									})
 								}
 							}
 						})
 					}
-					
-				}else{
+
+				} else {
 					return uni.showModal({
-						title:'请登录',
-						confirmText:'去登录',
-						success(res){
-							if(res.confirm){
+						title: '请登录',
+						confirmText: '去登录',
+						success(res) {
+							if (res.confirm) {
 								uni.navigateTo({
-									url:'/login/login/login?redirect=/special/water'
+									url: '/login/login/login?redirect=/special/water'
 								})
 							}
 						}
 					})
 				}
-				
+
 			},
-			loadedPage(){
+			loadedPage() {
 				uni.hideLoading()
 			},
-			onmessage(val){
+			onmessage(val) {
 				console.log(val);
 			}
 		},
-		 created() {},
+		created() {},
 	}
 </script>
 
 <style lang="scss" scoped>
 	.kaihuiLink {
-		.imgBox {
-			&>image {
-				width: 100%;
-			}
-		}
+		margin: 0;
+		padding: 0;
+		overflow-x: hidden;
 
-		.btn {
-			width: 100%;
-			display: flex;
-			align-items: center;
-			justify-content: center;
+		.imgBox {
+			height: 100vh;
 			position: relative;
 
-			.kaihuiBtn {
-				position: absolute;
-				width: 360rpx;
-				height: 80rpx;
-				border-radius: 40rpx;
-				background-color: #EE4320;
-				color: white;
-				display: flex;
-				align-items: center;
-				justify-content: center;
-				font-size: 32rpx;
-				font-weight: bold;
-			}
-		}
-
-		.kaihuiRule {
-			margin-top: 60rpx;
-			width: 100%;
-			position: relative;
-			.title{
-				position: absolute;
-				left:200rpx;
-				&>image{
-					width: 350rpx;
-				}
-			}
-			.text{
-				position: absolute;
-				top: 40rpx;
-				font-size: 26rpx;
-				margin-top: 20rpx;
-				margin-left: 20rpx;
+			&>image {
+				width: 100%;
 			}
 		}
 	}

+ 3 - 0
uni_modules/uview-ui/components/u-toast/u-toast.vue

@@ -255,6 +255,9 @@
 			}
 		}
 	}
+	.u-toast__content{
+		text-align: center;
+	}
 
 	.u-type-primary {
 		color: $u-toast-u-type-primary-color;

+ 1 - 1
utils/request.js

@@ -28,7 +28,7 @@ export let request = (options) => {
 								duration: 5000
 							})
 							// uni.hideLoading()
-						} else if (res.data.msg != '成功') { //接口返回报错
+						} else if (res.data.msg != '成功'&&res.data.content!='该手机号已订购【惠生活优享会员】,请在会员到期后再使用激活码') { //接口返回报错
 							setTimeout(()=>{
 								uni.showToast({
 									title: res.data.content || res.data.msg ||(res.data.exception && res.data.exception.message) || '请求失败',