wenjie 6 månader sedan
förälder
incheckning
57f6b0fc76

+ 38 - 0
App.vue

@@ -3,6 +3,8 @@
 		getGoodsTypeObj,
 		getUserDetail
 	} from '@/api/common.js';
+	import {getVipLog,mealList,getTmpVip} from '@/api/combo.js'
+	import {Test} from '@/utils/tool.js';
 	export default {
 
 		onLaunch: function() {
@@ -12,6 +14,42 @@
 		},
 		onShow: function() {
 			console.log('App Show')
+			// if(uni.getStorageSync('token')){
+				
+			// 	getVipLog().then(res=>{
+			// 		console.log(res);
+			// 		if(res.content&&!res.content.length){
+			// 			uni.showModal({
+			// 				title:'提示',
+			// 				content:'免费领取7天会员,畅享专属权益,点击“领取”体验!',
+			// 				cancelText:'取消',
+			// 				confirmText:'领取',
+			// 				success: function (r) {
+			// 						if (r.confirm) {
+			// 							console.log('用户点击确定');
+			// 							mealList({source:2}).then(result=>{
+			// 								if(result.content.records.length){
+			// 									getTmpVip(result.content.records[0].setMealCode).then(res1=>{
+			// 										if(res1.state == 'Success'){
+			// 											uni.showToast({
+			// 												title:'领取成功',
+			// 												icon:'none'
+			// 											})
+			// 										}
+			// 									})
+			// 								}else{
+			// 									uni.showToast({
+			// 										title:'未配置临时会员',
+			// 										icon:'none'
+			// 									})
+			// 								}
+			// 							})
+			// 						}
+			// 					}
+			// 			})
+			// 		}
+			// 	})
+			// }
 			// 获取商品类型字段
 			// getGoodsTypeObj().then(res => {
 			// 	if (res.state == 'Success') {

+ 17 - 0
api/combo.js

@@ -50,3 +50,20 @@ export function getVideoEquity(data) {
       data
   })
 }
+
+// 查询开通的会员记录列表
+export function getVipLog(data) {
+  return request({
+      url: '/vipserver/queryVip/list',
+      data
+  })
+}
+
+
+//领取临时会员
+export function getTmpVip(data) {
+  return request({
+      url: '/vipserver/tmpVip/'+data,
+      data
+  })
+}

+ 58 - 0
components/zs-getVip/index.vue

@@ -0,0 +1,58 @@
+<template>
+	<view class="zs-getVip">
+		<view class="content">
+			<image class="bg" src="https://zswl-dev.oss-cn-chengdu.aliyuncs.com/63b7c68b71a69169d1b33f92/store/bdb/user/avatar/uHMgZAP95DoL7c10575028ada2bc02c172627840290d.png/1.png" mode=""></image>
+			<image @click="submit" class="btn" src="https://zswl-dev.oss-cn-chengdu.aliyuncs.com/63b7c68b71a69169d1b33f92/store/bdb/user/avatar/39IILRhLzeb35d1bc2dc0c13256eaa79865032fb19ca.png/1.png" mode=""></image>
+			<image @click="close" class="close-btn" src="@/static/close.png" mode=""></image>
+		</view>
+	</view>
+</template>
+
+<script>
+	export default {
+		methods: {
+			close() {
+				this.$emit('close')
+			},
+			submit() {
+				this.$emit('submit')
+			}
+		},
+	}
+</script>
+
+<style lang="scss" scoped>
+.zs-getVip{
+	position: fixed;
+	top: 0%;
+	left: 0%;
+	width: 100vw;
+	height: 100vh;
+	background: rgba(0,0,0,0.3);
+	z-index: 9999;
+	display: flex;
+	align-items: center;
+	justify-content: center;
+	.content{
+		position: relative;
+		.bg{
+			width: 628rpx;
+			height: 628rpx;
+		}
+		.btn{
+			width: 290rpx;
+			height: 86rpx;
+			position: absolute;
+			bottom: 32rpx;
+			left: calc(50% - 145rpx);
+		}
+		.close-btn{
+			width: 60rpx;
+			height: 60rpx;
+			position: absolute;
+			bottom: -80rpx;
+			left: calc(50% - 30rpx);
+		}
+	}
+}
+</style>

+ 71 - 0
main.js

@@ -1,6 +1,75 @@
 import App from './App'
 
 import {myRequest} from './utils/request.js'
+import {getUserDetail} from '@/api/common.js'
+import {getVipLog,mealList,getTmpVip} from '@/api/combo.js'
+function GetVip(){
+	console.log('cesjhio');
+	if(uni.getStorageSync('token')){
+		getVipLog().then(res=>{
+			let createTime = new Date(JSON.parse(uni.getStorageSync('userInfo')).createTime)  
+			if(res.content&&!res.content.length&&createTime>new Date('2024-12-01 00:00:00')){
+				this.showGetVip = true
+				// uni.showModal({
+				// 	title:'提示',
+				// 	content:'免费领取7天会员,畅享专属权益,点击“领取”体验!',
+				// 	cancelText:'取消',
+				// 	confirmText:'领取',
+				// 	success: function (r) {
+				// 			if (r.confirm) {
+				// 				console.log('用户点击确定');
+				// 				mealList({source:2}).then(result=>{
+				// 					if(result.content.records.length){
+				// 						getTmpVip(result.content.records[0].setMealCode).then(res1=>{
+				// 							if(res1.state == 'Success'){
+				// 								getUserDetail().then(data => {
+				// 									uni.setStorageSync('userInfo', JSON.stringify(data.content))
+				// 								})
+				// 								uni.showToast({
+				// 									title:'领取成功',
+				// 									icon:'none'
+				// 								})
+				// 							}
+				// 						})
+										
+				// 					}else{
+				// 						uni.showToast({
+				// 							title:'未配置临时会员',
+				// 							icon:'none'
+				// 						})
+				// 					}
+				// 				})
+				// 			}
+				// 		}
+				// })
+			}
+		})
+	}
+}
+function submit(){
+	mealList({source:2}).then(result=>{
+		if(result.content.records.length){
+			getTmpVip(result.content.records[0].setMealCode).then(res1=>{
+				if(res1.state == 'Success'){
+					getUserDetail().then(data => {
+						uni.setStorageSync('userInfo', JSON.stringify(data.content))
+					})
+					this.showGetVip = false
+					uni.showToast({
+						title:'领取成功',
+						icon:'none'
+					})
+				}
+			})
+			
+		}else{
+			uni.showToast({
+				title:'未配置临时会员',
+				icon:'none'
+			})
+		}
+	})
+}
 // #ifndef VUE3
 import Vue from 'vue'
 import './uni.promisify.adaptor'
@@ -8,6 +77,8 @@ Vue.config.productionTip = false
 App.mpType = 'app'
 //挂载,让全局可以使用
 Vue.prototype.$req = myRequest
+Vue.prototype.$GetVip = GetVip
+Vue.prototype.$Submit = submit
 import uView from '@/uni_modules/uview-ui'
 Vue.use(uView)
 uni.$u.config.unit = 'rpx'

+ 3 - 3
my/memberCenter/index.vue

@@ -100,11 +100,11 @@
 						</view>
 					</view>
 				</view>
-				<button class="btn" v-if="cmVipEnable&&userInfo.setMealCode != currentMeal" :loading="btnLoading" @click="goOrder">
+				<button class="btn" v-if="cmVipEnable&&userInfo.setMealCode != currentMeal&&list[current].source==1" :loading="btnLoading" @click="goOrder">
 					立即开通
 				</button>
 			</view>
-			<view class="agreement-box" v-if="cmVipEnable&&userInfo.setMealCode != currentMeal">
+			<view class="agreement-box" v-if="cmVipEnable&&userInfo.setMealCode != currentMeal&&list[current].source==1">
 				<u-checkbox-group size="28rpx" v-model="checked" @change="choose">
 					<u-checkbox  activeColor="#EE4320" shape="circle" name="1" ></u-checkbox>
 				</u-checkbox-group>
@@ -419,7 +419,7 @@
 			},
 			mealList(){
 				return new Promise((resolve,reject)=>{
-					mealList({currentPage:1,pageSize:99,status:1}).then(res=>{
+					mealList({source:1,currentPage:1,pageSize:99,status:1}).then(res=>{
 						if (res.state == 'Success') {
 							this.list = res.content.records
 							this.list.map((item,index)=>{

+ 20 - 10
my/vipActivation/index.vue

@@ -5,7 +5,7 @@
 			<view class="vipInfo">
 				<view class="left">
 					<view class="ownVip">当前会员:<text>{{setMealName||'普通用户'}}</text></view>
-					<view class="endTime">会员到期时间: {{expireTime||'--'}}</view>
+					<view class="endTime" v-if="expireTime">会员到期时间: {{expireTime||'--'}}</view>
 				</view>
 				<view class="right">
 					<image slot="icon"
@@ -14,8 +14,8 @@
 				</view>
 			</view>
 			<view class="inputBox">
-				<input type="text" v-model="vipQuery.activationCode" placeholder="请输入激活码"
-					placeholder-class="activationIpt" />
+				<input type="text" v-model="vipQuery.activationCode" @input="handleInput" @paste="handlePaste"
+					placeholder="请输入激活码" placeholder-class="activationIpt" />
 				<u-button type="error " :loading="redeemload" loadingSize="20" shape="circle" text="立即兑换"
 					@click="confirmActivation"></u-button>
 			</view>
@@ -84,6 +84,16 @@
 		},
 
 		methods: {
+			// 修复android粘贴出现回车问题
+			handleInput() {
+				this.vipQuery.activationCode = this.vipQuery.activationCode.replace(/\s/g, '');
+			},
+			handlePaste(event) {
+				let pasteData = event.clipboardData.getData('text');
+				pasteData = pasteData.replace(/\r?\n|\r/g, '');
+				this.vipQuery.activationCode = this.vipQuery.activationCode + pasteData;
+			},
+
 			// 用户信息
 			get_userinfo() {
 				refreshVip().then(res => {
@@ -107,10 +117,10 @@
 
 			// 二次确认
 			confirmActivation() {
-				if(this.vipQuery.activationCode=='') {
+				if (this.vipQuery.activationCode == '') {
 					uni.showToast({
-						title:'请输入激活码',
-						icon:'none'
+						title: '请输入激活码',
+						icon: 'none'
 					})
 					return
 				}
@@ -137,9 +147,9 @@
 						});
 						this.vipQuery.activationCode = ''
 						this.get_activationList()
-					} else{
+					} else {
 						this.$refs.uToast.show({
-							message:res.content
+							message: res.content
 						})
 					}
 				})
@@ -220,8 +230,8 @@
 				margin-top: 20rpx;
 
 				&>input {
-					margin-left: 8rpx;
-					width: 1800rpx;
+					margin-left: 16rpx;
+					width: 1600rpx;
 				}
 
 				.activationIpt {

+ 6 - 1
orderFood/shopDetail.vue

@@ -877,11 +877,16 @@
 			   this[key] = false
 		   },
 			handleItem(i,item){
-				console.log(item);
+				console.log(item,111);
 				this.num = 1
 				this.item = i
 				if(!item.childClassList) return
 				this.show2 = true
+				this.goodsInfo = {
+					product_name:'-',
+					product_description:'-',
+					product_img:'',
+				}
 				this.chooseInfo = {}
 				foodGoodsDetail({productId:i.productId,shopId:this.shopId}).then(res=>{
 					if(res.state = 'Success'){

+ 1 - 1
pages.json

@@ -307,7 +307,7 @@
 				{
 					"path": "vipActivation/index",
 					"style": {
-						"navigationBarTitleText": "会员激活"
+						"navigationBarTitleText": "激活码兑换"
 					}
 				}
 			]

+ 8 - 0
pages/index/index.vue

@@ -157,6 +157,9 @@
 
 		<!-- 广告弹窗 -->
 	  <zs-adv-dialog :list="dialogAdvList"></zs-adv-dialog>
+	  
+	  
+	  <zs-getVip v-if="showGetVip" @submit="$Submit" @close="close"></zs-getVip>
 	</view>
 </template>
 
@@ -180,6 +183,7 @@
 	export default {
 		data() {
 			return {
+				showGetVip:false,
 				background:false,
 				loading: false,
 				userId: '',
@@ -231,6 +235,9 @@
 			}
 		},
 		methods: {
+			close(){
+				this.showGetVip = false
+			},
 			formatImg(item){
 				if(item.productType == 'Kfc'){
 					// if(){
@@ -630,6 +637,7 @@
 				}
 		},
 		onShow() {
+			this.$GetVip()
 			if (uni.getStorageSync('token')&&!uni.getStorageSync('userInfo')) {
 				this.getUserDetail()
 				

+ 1 - 1
pages/my/index.vue

@@ -86,7 +86,7 @@
 		<!-- 	<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">
+			<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">

+ 0 - 3
special/kaihui.vue

@@ -9,9 +9,6 @@
 </template>
 
 <script>
-	import {
-		qrcode
-	} from '@/api/common.js';
 	export default {
 		data() {
 			return {

+ 4 - 2
utils/config.js

@@ -1,10 +1,12 @@
-const env = 'develop' // develop production
+const env = 'production' // develop production
 
 // export const BASE_URL = env == 'production'?'https://api.zonelife.cn':'http://8.137.120.225:9006';
 export const BASE_URL = env == 'production'?'https://api.zonelife.cn':'https://api.dev.zonelife.cn';
 
 export const SHOP_ID =  env == 'production'?'6618e31330fed626f8b57f18':'6618d9be32e63427d1a17009';
 
-export const levelImgName =  env == 'production'?{212086906345:1,212086906346:2,212086906347:3}:{2023110101:1,2023110102:2,2023110103:3};
+// export const levelImgName =  env == 'production'?{212086906345:1,212086906346:2,212086906347:3}:{2023110101:1,2023110102:2,2023110103:3};
+
+export const levelImgName =  env == 'production'?{212086906345:1,212086906346:2,212086906347:3}:{212086906345:1,212086906346:2,212086906347:3};
 
 

+ 1 - 1
utils/request.js

@@ -11,7 +11,7 @@ export let request = (options) => {
 		//请求路径拼接,,其中options.url就是通过下面方法myRequest获取到接口部分的url
 		//method--请求方法,不是method的post就是get
 		//请求的参数,当没有参数的时候就是空对象
-		if(options.data){
+		if(options.data&&options.method == 'POST'){
 			options.data.platformType = 1
 		}
 		request.requestTask = uni.request({