zkx 2 лет назад
Родитель
Сommit
378a2d69bf

+ 55 - 19
pages/index/index.vue

@@ -96,7 +96,7 @@
 					 </view>
 					
 					<u-image width="600"  style="margin: auto;min-height: 250px;"
-					mode="widthFix" @click="showNtStepClick"
+					mode="widthFix"
 						v-show="showNtStep==1"
 					src="@/assets/img/nt/news-activity-1.png">
 					
@@ -114,7 +114,17 @@
 					 <span style="font-size: 28rpx;">元</span>
 					 </view>
 					 
-					 
+					 <view
+					  style="color: #ecc07d;
+					 		font-size: 72rpx;
+					 		position: relative;
+					 		top: -290rpx;
+					 		right: -144rpx; width: 310rpx;"
+					 		@click="showNtStepClick"
+					 
+					  v-show="showNtStep==1" >
+					  <span >.</span>
+					  </view>
 					
 					 
 			</view>
@@ -623,17 +633,22 @@
 		},
 		methods: {
 			getNewYear(){
-				var obj=this.carhelp.get("newyear_activity2023")
+				var obj=this.carhelp.get("newyear_activity2023")
+				//
+				var sz=["1615623336912621569","1615623336912621568"];
+				var code=0
 				if(obj&&obj.status==0){
-					this.exchangeDetail(obj.nt);
+					//this.exchangeDetail(obj.nt);
+					 code=obj.code
 				}else{
-					var sz=["1615623336912621569","1615623336912621568"];
-					var code=parseInt(Math.random()*2) 
-					this.carhelp.set("newyear_activity2023",{
-						nt:sz[code],
-						code:code,
-						status:0
-					})
+					 code=parseInt(Math.random()*2) 
+					 this.carhelp.set("newyear_activity2023",{
+					 	nt:sz[code],
+					 	code:code,
+					 	status:0
+					 })
+				 }
+					
 					//先查询另一个领取过没
 					userApi.exchangeDetail({
 						key: sz[code==0?1:0]
@@ -646,10 +661,10 @@
 						 	}else{
 						 		//已经结束
 						 	}
-						 	
+						 	this.getBannerInfoTop("home-top");	
 						 
 						 }else if(res.data.status==1){
-						 	
+						 	this.getBannerInfoTop("home-top");	
 							//已经兑换,或者不能兑换
 						 } else if(res.data.status==2){
 							// this.showNtValue=res.data.totalDiscount
@@ -657,7 +672,7 @@
 						 }else{
 						 	//res.data.status==0
 						 	//this.showNtValue=res.data.totalDiscount
-							this.exchangeDetail(sz[code]);
+							this.exchangeDetail(sz[code],sz[code==0?1:0]);
 						 }
 						 
 						  
@@ -668,11 +683,11 @@
 							icon: "none"
 						})
 					})
-				}
+				
 				
 				
 			},
-			exchangeDetail(exchangeCode) {
+			exchangeDetail(exchangeCode,code2) {
 				uni.showLoading({
 					title: "加载中",
 					mask: true,
@@ -690,9 +705,30 @@
 						}else{
 							//已经结束
 						}
-						
-					}else if(res.data.status==1||res.data.status==2){
-						//已经兑换,或者不能兑换
+						this.getBannerInfoTop("home-top");	
+					}else if(res.data.status==1){
+						this.getBannerInfoTop("home-top");	
+						//已经兑换,
+					}else if(res.data.status==2){
+						
+						if(code2){
+							//试试另一张卷
+							
+							var c=this.carhelp.get("newyear_activity2023")
+							if(c){
+								this.carhelp.set("newyear_activity2023",{
+									nt:code2,
+									code:c.code==0?1:0,
+									status:0
+								})
+							}
+						
+							this.exchangeDetail(code2)
+						}else{
+								this.getBannerInfoTop("home-top");	
+						}
+					
+						//不能兑换
 					}else{
 						
 						this.showNt=true

+ 280 - 9
pages/searchPile/stationAndPile/chargingPileDetails.vue

@@ -235,13 +235,83 @@
 				:show-cancel-button="true" ref="uModal" :asyncClose="true" :title="title" :content="consumerPhone"
 				:content-style="{fontSize: '24px',color: '#101010'}"></u-modal>
 		</view>
-	</view>
+	</view>
+	
+	
+	<u-modal v-model="showNt"  class="showOss"
+			:show-title="false" :show-confirm-button="false" >
+				<view class="slot-content">
+					
+						<u-image width="600"  style="margin: auto;min-height: 250px;"
+						mode="widthFix" 
+						v-show="showNtStep==0"
+						src="@/assets/img/nt/news-activity-2.png">
+						
+							<view slot="loading" style="height: 200px;" >
+								<u-loading mode="flower" size="186" >
+								
+								</u-loading>
+									
+							</view>
+							
+						</u-image>
+						<view
+						 style="color: #ecc07d;
+								font-size: 64rpx;
+								position: relative;
+								top: -220rpx;
+								right: -100rpx; width: 400rpx;"
+								@click="showNtStepClick"
+						
+						 v-show="showNtStep==0" >
+						 <span >.</span>
+						 </view>
+						
+						<u-image width="600"  style="margin: auto;min-height: 250px;"
+						mode="widthFix"
+							v-show="showNtStep==1"
+						src="@/assets/img/nt/news-activity-1.png">
+						
+						</u-image>
+						<view 
+						 style="color: #FFFFFF;
+								font-size: 64rpx;
+								position: relative;
+								top: -600rpx;
+								right: -80rpx;"
+						:style="{
+							right:showNtValue>99?'-80rpx':(showNtValue>9?'-95rpx':'-110rpx')
+						}"
+						 v-show="showNtStep==1" ><b>{{showNtValue}}</b>
+						 <span style="font-size: 28rpx;">元</span>
+						 </view>
+						 
+						 <view
+						  style="color: #ecc07d;
+						 		font-size: 72rpx;
+						 		position: relative;
+						 		top: -290rpx;
+						 		right: -144rpx; width: 310rpx;"
+						 		@click="showNtStepClick"
+						 
+						  v-show="showNtStep==1" >
+						  <span >.</span>
+						  </view>
+						
+						 
+				</view>
+			</u-modal>
+	
+	
+	
 	</view>
 </template>
 
 <script>
 	import * as API_index from '@/apis/index.js'
-	import * as API from "@/apis/chargeProcess.js"
+	import * as API from "@/apis/chargeProcess.js"
+	import * as userApi from '@/apis/user.js'
+	
 	import {
 		newDate,
 		hourDistanceArr,
@@ -251,7 +321,10 @@
 
 	export default {
 		data() {
-			return {
+			return {
+				showNt:false,
+				showNtStep:0,
+				showNtValue:30,
 				station:{},
 				step:0,
 				isInsert:false,
@@ -261,7 +334,8 @@
 				car: {},
 				isback: false,
 				gun: {},
-				prices: {},
+				prices: {},
+				personInfo:{},
 				price: {
 					costPrice:0,
 					electricityPrice:0,
@@ -597,7 +671,182 @@
 			},
 			isInsertBtn(){
 				this.isInsert=true;
-			}
+			},
+			getNewYear(){
+				var obj=this.carhelp.get("newyear_activity2023")
+				//
+				var sz=["1615623336912621569","1615623336912621568"];
+				var code=0
+				if(obj&&obj.status==0){
+					//this.exchangeDetail(obj.nt);
+					 code=obj.code
+				}else{
+					 code=parseInt(Math.random()*2) 
+					 this.carhelp.set("newyear_activity2023",{
+					 	nt:sz[code],
+					 	code:code,
+					 	status:0
+					 })
+				 }
+					
+					//先查询另一个领取过没
+					userApi.exchangeDetail({
+						key: sz[code==0?1:0]
+					}).then((res) => {
+						 
+						 if(!res.data.enabled){
+						
+							if(res.data.code==2){
+						 		//未开始
+						 	}else{
+						 		//已经结束
+						 	}
+						 	this.getBannerInfoTop("home-top");	
+						 
+						 }else if(res.data.status==1){
+						 	this.getBannerInfoTop("home-top");	
+							//已经兑换,或者不能兑换
+						 } else if(res.data.status==2){
+							// this.showNtValue=res.data.totalDiscount
+							 this.exchangeDetail(sz[code]);
+						 }else{
+						 	//res.data.status==0
+						 	//this.showNtValue=res.data.totalDiscount
+							this.exchangeDetail(sz[code],sz[code==0?1:0]);
+						 }
+						 
+						  
+					}).catch(error => {
+						this.showNt=false;
+						uni.showToast({
+							title: error,
+							icon: "none"
+						})
+					})
+				
+				
+				
+			},
+			exchangeDetail(exchangeCode,code2) {
+				uni.showLoading({
+					title: "加载中",
+					mask: true,
+				})		
+				userApi.exchangeDetail({
+					key: exchangeCode
+				}).then((res) => {
+					uni.hideLoading();
+					//
+					
+					if(!res.data.enabled){
+						
+						if(res.data.code==2){
+							//未开始
+						}else{
+							//已经结束
+						}
+						this.getBannerInfoTop("home-top");	
+					}else if(res.data.status==1){
+						this.getBannerInfoTop("home-top");	
+						//已经兑换,
+					}else if(res.data.status==2){
+						
+						if(code2){
+							//试试另一张卷
+							
+							var c=this.carhelp.get("newyear_activity2023")
+							if(c){
+								this.carhelp.set("newyear_activity2023",{
+									nt:code2,
+									code:c.code==0?1:0,
+									status:0
+								})
+							}
+						
+							this.exchangeDetail(code2)
+						}else{
+								this.getBannerInfoTop("home-top");	
+						}
+					
+						//不能兑换
+					}else{
+						
+						this.showNt=true
+						this.showNtStep=0;
+						this.showNtValue=res.data.totalDiscount
+					}
+					
+				}).catch(error => {
+					this.showNt=false;
+					uni.showToast({
+						title: error,
+						icon: "none"
+					})
+				})
+			},
+			redeemNow(exchangeCode) {
+				uni.showLoading({
+					title: "加载中",
+					mask: true,
+				})		
+				userApi.exchange({
+					key: exchangeCode
+				}).then((res) => {
+					uni.hideLoading();
+					this.showNtStep=1
+					this.carhelp.set("newyear_activity2023",{
+						nt:exchangeCode,
+						status:1
+					})
+				}).catch(error => {
+					this.showNt=false;
+					uni.showToast({
+						title: error,
+						icon: "none"
+					})
+				})
+			},
+			showNtStepClick(){
+				if(this.showNtStep==0){
+					var obj=this.carhelp.get("newyear_activity2023")
+				
+					
+					if(this.personInfo.userType!=1){
+						this.redeemNow(obj.nt)
+					}else{
+						this.showNt=false;
+						uni.showModal({
+												 title:"提示",
+							content:"游客无法兑换,请先注册为会员后再兑换",
+												confirmText:"前往注册",
+												success: res1 => {
+													if (res1.confirm) {
+														uni.navigateTo({
+															url: '/pages/login/login'
+														})		
+													} else if (res1.cancel) {
+														//('用户点击取消');
+													}
+												}
+						})
+						
+					}
+					
+				}else if(this.showNtStep==1||this.showNtStep==2||this.showNtStep==3||this.showNtStep==4){
+					this.showNt=false;
+					uni.navigateTo({
+						url:"/pages/user/coupon/myCoupon"
+					})
+					
+				}
+			},
+			getBannerInfoTop(){
+				var personInfo=this.carhelp.getPersonInfo()
+				
+				if(personInfo&&personInfo.userType=="1"){
+					this.showVin=true
+				}
+			},
 		},
 
 		onReady() {
@@ -621,10 +870,27 @@
 			if (op.id) {
 				this.id = op.id
 				
-				var personInfo=this.carhelp.getPersonInfo()
-				if(personInfo&&personInfo.userType=="1"){
-					this.showVin=true
+				var personInfo=this.carhelp.getPersonInfo()
+				this.personInfo=personInfo
+				
+				
+				var obj=this.carhelp.get("newyear_activity2023")
+				if(obj==null||obj==""||(obj&&obj.status==0)){
+					var userInfo= this.carhelp.getPersonInfo();
+					
+					if(userInfo&&userInfo.id){
+						
+							this.getNewYear()
+					}else{
+						this.getBannerInfoTop("home-top");	
+					}
+					
+					//this.showNtStep=2
+				}else{
+					this.getBannerInfoTop("home-top");
 				}
+				
+				
 				
 				
 				//this.carhelp.setGunId(op.id)
@@ -889,5 +1155,10 @@
 
 			vertical-align: middle;
 		}
-	}
+	}
+	.showOss{
+			/deep/.u-model,/deep/.u-mode-center-box{
+				background-color: transparent;
+			}
+		}
 </style>

+ 8 - 5
pages/searchPile/stationAndPile/stationDetails.vue

@@ -458,10 +458,6 @@
 
 		</view>
 
-
-
-
-
 	</view>
 </template>
 
@@ -477,7 +473,10 @@
 	export default {
 
 		data() {
-			return {
+			return {
+				showNt:false,
+				showNtStep:0,
+				showNtValue:30,
 				pricesInfoCurrent:null,
 				noticeShow:false,
 				parkingTips:false,
@@ -488,6 +487,7 @@
 				userId: '',
 				show: false,
 				showtips:true,
+				
 				list: [{
 						"name": "充电桩"
 					},
@@ -511,6 +511,7 @@
 
 				},
 				openlist:null,
+				personInfo:{},
 				info: {
 					station: {
 
@@ -604,6 +605,7 @@
 			if (this.carhelp.getPersonInfo()) {
 				this.userId = this.carhelp.getPersonInfo().id;
 				this.personInfo= this.carhelp.getPersonInfo()
+			
 
 			}
 			WxJsApi.getWxConfig(['getLocation','openLocation', 'addEventListener', 'scanQRCode']).then((res) => {
@@ -648,6 +650,7 @@
 			}
 		},
 		methods: {
+			
 			confirmPhone() {
 				
 				 if( this.stationDetail.station&&this.stationDetail.station.contactPhone){