Bladeren bron

临时会员上线、大牌点餐优化、套餐code统一

wenjie 6 maanden geleden
bovenliggende
commit
6e1767a25b
10 gewijzigde bestanden met toevoegingen van 207 en 8 verwijderingen
  1. 38 0
      App.vue
  2. 17 0
      api/combo.js
  3. 58 0
      components/zs-getVip/index.vue
  4. 71 0
      main.js
  5. 1 1
      manifest.json
  6. 3 3
      my/memberCenter/index.vue
  7. 6 1
      orderFood/shopDetail.vue
  8. 8 0
      pages/index/index.vue
  9. 4 2
      utils/config.js
  10. 1 1
      utils/request.js

+ 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'

+ 1 - 1
manifest.json

@@ -1,6 +1,6 @@
 {
     "name" : "慧研学惠生活",
-    "appid" : "__UNI__96CACF3",
+    "appid" : "__UNI__4E38610",
     "description" : "",
     "versionName" : "1.0.0",
     "versionCode" : "100",

+ 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)=>{

+ 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'){

+ 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(){
@@ -629,6 +636,7 @@
 				}
 		},
 		onShow() {
+			this.$GetVip()
 			if (uni.getStorageSync('token')&&!uni.getStorageSync('userInfo')) {
 				this.getUserDetail()
 				

+ 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({