zhengkaixin 3 år sedan
förälder
incheckning
f08b38c7eb
5 ändrade filer med 102 tillägg och 33 borttagningar
  1. 10 1
      apis/index.js
  2. 60 1
      pages/index/index.vue
  3. 18 7
      pages/login/login.vue
  4. 14 24
      pages/user/InviteFriends.vue
  5. BIN
      static/img/guide_point.png

+ 10 - 1
apis/index.js

@@ -170,4 +170,13 @@ export function passengerMessageNoReadNum(data) {
   		data: data,
   		url: '/mobile/charging/chargingDeviceData'
   	})
-  }
+  }
+  
+  export function findActivity(data) {
+  	return requestWhite({
+  		method: 'post',
+  		data: data,
+  		url: '/mobile/chargingCouponApi/findActivity'
+  	})
+  } 
+  

+ 60 - 1
pages/index/index.vue

@@ -235,7 +235,10 @@
 	import * as siteApi from '@/apis/site.js';
 	import MapLoader from '@/utils/AMap'
 	import Tabbar from '@/components/Tabbar.vue'
-
+	import {
+		secondsDistance,
+		hourDistanceArr
+	} from '@/utils'
 	export default {
 		components: {
 			Tabbar
@@ -282,6 +285,8 @@
 					})
 				}
 			}
+			
+			
 			this.getBannerInfo("homepage")
 			
 		},
@@ -320,6 +325,19 @@
 				} else {
 					this.show = true;
 				}
+			}else{
+				var obj=this.carhelp.get("friends_invitation")
+				// this.carhelp.set("friends_invitation",{
+				// 	op:op,
+				// 	date:new Date().getTime()
+				// })
+				if(obj){
+					if(obj.date+1000*60*60*24 > new Date().getTime() ){
+					
+						this.friendsInvitation(obj)
+					}
+					
+				}
 			}
 
 			WxJsApi.getWxConfig(['getLocation', 'addEventListener', 'scanQRCode']).then((res) => {
@@ -334,6 +352,47 @@
 			this.getActivityInfoList();
 		},
 		methods: {
+			friendsInvitation(obj){
+				 API.findActivity({
+					 id:obj.op.id,
+					 code:obj.op.code
+				 }).then((res) => {
+					obj.activityInfo=res.data.activityInfo;
+					 var name=res.data.activityInfo.name;
+					 var title="参与活动"
+					var  okbtn="前往注册"
+					var endTime=res.data.activityInfo.endTime;
+					
+					if(endTime&&secondsDistance(endTime)>0){
+						name="活动已结束"
+						okbtn="继续注册"
+						title="提示"
+						obj=null
+					}
+					this.carhelp.set("friends_invitation",obj)
+					 uni.showModal({
+						 title:title,
+					 	content:name,
+						confirmText:okbtn,
+						success: res1 => {
+							if (res1.confirm) {
+								uni.navigateTo({
+									url: '/pages/login/login'
+								})		
+							} else if (res1.cancel) {
+								console.log('用户点击取消');
+							}
+						}
+					 })
+					 
+					 
+				}).catch(error => {
+				 		uni.showToast({
+				 		
+				 			title: error,icon: "none"
+				 		})
+				 })
+			},
 			clickBanner(index){
 				 
 				

+ 18 - 7
pages/login/login.vue

@@ -4,6 +4,7 @@
 			<view class="login-title">
 				<h3>手机号登录/注册</h3>
 				<p>欢迎来到{{projectName}}</p>
+				<p v-if="activityInfo"><span style="color: red;">*</span>正在参加活动<span style="color: #3fbd70;" ><{{activityInfo.name}}></span></p>
 			</view>
 			
 			<view class="login-form">
@@ -52,6 +53,7 @@
 					telephone: '',
 					verifyCode: '',
 				},
+				activityInfo:null,
 				isSendMsgIng: false,
 				sendMsgSecond: 60,
 				codeTips: '',
@@ -90,6 +92,18 @@
 				} 
 				
 			}
+			var obj=this.carhelp.get("friends_invitation")
+			
+			if(obj){
+				if(obj.date+1000*60*60*24 > new Date().getTime() ){
+					this.form.inviteId=obj.op.uid
+					this.form.code=obj.op.code
+					this.activityInfo=obj.activityInfo;
+				}
+				
+			}
+			
+			
 		},
 		methods: {
 			codeChange(text) {
@@ -180,13 +194,10 @@
 					title: "加载中",
 					mask: true,
 				})		
-				loginApi.validateCode({
-					verifyCode: this.form.verifyCode,
-					telephone: this.form.telephone,
-					nickName: this.carhelp.getUserInfo().nickname,
-					headImg:this.carhelp.getUserInfo().headimgurl,
-					openId: this.carhelp.getOpenId(),
-				}).then((response) => {
+				this.form.nickName= this.carhelp.getUserInfo().nickname;
+				this.form.headImg=this.carhelp.getUserInfo().headimgurl;
+				this.form.openId= this.carhelp.getOpenId();
+				loginApi.validateCode(this.form).then((response) => {
 					uni.hideLoading();
 					
 					var token = response ? response.data.token : '';

+ 14 - 24
pages/user/InviteFriends.vue

@@ -44,9 +44,9 @@
 				<view class="InviteFriends-title">我的奖励</view>
 				<view class="InviteFriends-reward">
 					<view class="reward-head">
-						<p>成功邀请1人,已获得</p>
+						<p>成功邀请{{list.length}}人,已获得</p>
 						<view class="reward-head-price">
-							<h2>5</h2><span>元</span>
+							<h2>{{amount}}</h2><span>元</span>
 						</view>
 					</view>
 					<view class="reward-main">
@@ -56,27 +56,15 @@
 								成功邀请记录
 							</view>
 							<view class="rewardList">
-								<view class="rewardList-item">
+								
+								<view class="rewardList-item" v-for="(item,i) in list" :key="i" >
 									<view class="u-flex">
-										<u-avatar src="/static/img/head1.png" size="72"></u-avatar>
-										<span>asdas</span>
+										<u-avatar :src="item.headImg" size="72"></u-avatar>
+										<span :v-text="item.nickName"></span>
 									</view>
-									<p>2022-05-30</p>
-								</view>
-								<view class="rewardList-item">
-									<view class="u-flex">
-										<u-avatar src="/static/img/head1.png" size="72"></u-avatar>
-										<span>asdas</span>
-									</view>
-									<p>2022-05-30</p>
-								</view>
-								<view class="rewardList-item">
-									<view class="u-flex">
-										<u-avatar src="/static/img/head1.png" size="72"></u-avatar>
-										<span>asdas</span>
-									</view>
-									<p>2022-05-30</p>
+									<p v-text="item.createTime"></p>
 								</view>
+								
 							</view>
 						</view>
 					</view>
@@ -103,6 +91,7 @@
 				id:"",
 				code:"",
 				show:false,
+				amount:0,
 			}
 		},
 		onLoad(op) {
@@ -112,7 +101,7 @@
 				
 		},
 		onShow() {
-				//this.inviteCouponList();
+				this.inviteCouponList();
 		},
 		methods: {
 			inviteCouponList(){
@@ -121,8 +110,8 @@
 							mask: true,
 						})
 						API.inviteCouponList().then((res) => {
-							this.list = res.data.helpList
-						
+							this.list = res.data.regUserList
+							this.amount=res.data.amount
 						
 							uni.hideLoading()
 							
@@ -133,7 +122,7 @@
 						})
 					},
 			inviteFriendsBtn(){
-				// this.show=true;
+				 this.show=true;
 			},
 			//获取微信jssdk配置信息
 			get_wx_config() {
@@ -173,6 +162,7 @@
 				//console.log(this.nowItem);
 				var ProjectName=process.car.ProjectName;
 				var title="["+ProjectName+"]"+'和好友一起领5元红包'
+				
 			 	var desc="来自"+info.nickName+"的邀请"
 				let joinUrl = window.location.href.split("#")[0]+"#/?friends=friends&id="+this.id+"&icode="+this.code+"&uid="+info.id;
 				var _this = this;

BIN
static/img/guide_point.png