浏览代码

前往关注

zhengkaixin 3 年之前
父节点
当前提交
f8684e5d80
共有 5 个文件被更改,包括 99 次插入22 次删除
  1. 6 0
      apis/index.js
  2. 11 2
      pages/login/login.vue
  3. 40 5
      pages/searchPile/chargeProcess/dcCharging.vue
  4. 28 15
      pages/user/car/carDet.vue
  5. 14 0
      utils/mixin.js

+ 6 - 0
apis/index.js

@@ -11,6 +11,12 @@ export function codeOperation(url) {
 	if(url&&url.indexOf("#/?jpcode=")>-1){
 		res=url.split("#/?jpcode=")[1]
 	}
+	if(url&&url.indexOf("#/?gunId=")>-1){
+		var gunId=url.split("#/?gunId=")[1]
+		res="jp_team51_charge_id:A_"+gunId
+	}
+	
+	
 	if(res&&res.length>22){
 		
 	}else if(res == 'toLogin') {

+ 11 - 2
pages/login/login.vue

@@ -191,8 +191,17 @@
 					var token = response ? response.data.token : '';
 					this.carhelp.setToken(token);
 					this.carhelp.setPersonInfo(response.data.regUser);
-					
-					if(this.code == 'A') {
+					if(!response.data.regUser.carId){
+						var url="/pages/user/car/carDet?login=1"
+						
+						if(this.code == 'A') {
+							url+="&jpcode=jp_team51_charge_id:A_" + this.codeId
+						} 	
+						uni.redirectTo({
+							url:url
+						})
+						
+					}else if(this.code == 'A') {
 						
 						var k=API.codeOperation("jp_team51_charge_id:A_"+this.codeId);
 						if(k){

+ 40 - 5
pages/searchPile/chargeProcess/dcCharging.vue

@@ -73,6 +73,8 @@
 			<view class="iconfont tittle-font" @click="show = true">
 				&#xe616;
 			</view>
+			
+
 
 			<view class="progress-bar">
 				<u-circle-progress width="440" active-color="green" :percent="percent?percent:percentValue" border-width="50">
@@ -181,10 +183,24 @@
 				 shape="circle" >结束充电</u-button>
 			</view>
 
-			<u-modal v-model="show" @confirm="confirmPhone" :confirm-text="confirmText" confirm-color="#606266"
+			<u-modal v-model="show" @confirm="confirmPhone" 
+			:confirm-text="confirmText"  confirm-color="#606266"
 				:show-cancel-button="true" ref="uModal" :asyncClose="true" :title="title" :content="consumerPhone">
+			</u-modal>
+			
+			<u-modal v-model="show2" @confirm="gotoGz" 
+			cancel-text="暂不关注"  @cancel="cancelGz"
+			confirm-text="前往关注"
+			
+			 confirm-color="#53b56b"
+				:show-cancel-button="true" 
+				ref="uModal2" :asyncClose="true" 
+				 >
+				<view style="padding: 15px;"
+				
+				>请关注<span style=" color:  #53b56b;">{{projectName}}</span>公众号,以便第一时间收到充电结束消息提醒</view>
 			</u-modal>
-
+ 			
 		</view>
 	</view>
 </template>
@@ -211,11 +227,15 @@
 				chargingGun: {},
 				chargingRecord: {},
 				show: false,
+				show2: false,
 				isReady:true,
-				waitNum:'',
+				waitNum:'',
+				projectName:"",
 			}
 		},
-		onLoad(op) {
+		onLoad(op) {
+			this.projectName=process.car.ProjectName;
+			
 			if (op.id) {
 				this.id = op.id;
 				this.init()
@@ -225,7 +245,8 @@
 			// img="https://yktwechat.xiaoxinda.com/config/xxd2021.jpg"		
 			if (consumerPhone) {
 				this.consumerPhone = consumerPhone
-			}
+			}
+			
 
 		},
 		onUnload() {
@@ -235,6 +256,15 @@
 			this.addpercent()
 		},
 		methods: {
+			cancelGz(){
+				this.carhelp.setGzDate()
+			},
+			gotoGz(){
+				this.carhelp.setGzDate()
+				var url="https://mp.weixin.qq.com/mp/profile_ext?action=home&__biz=Mzg4Njc5ODEyMw==#wechat_redirect";
+				window.location.href=url
+				
+			},
 			gotoMain(i){
 				if(i==0){
 					uni.reLaunch({
@@ -338,6 +368,11 @@
 					}else if(this.chargingGun.gunType==2){
 						//交流
 					}
+					if (this.chargingRecord.status == 1) {
+						if(this.carhelp.getGzDate()){
+							this.show2=true;
+						}
+					}
 					if(this.isReady&&this.chargingRecord.status!=2){
 						var time=500;
 						if(this.chargingRecord.status==0){

+ 28 - 15
pages/user/car/carDet.vue

@@ -1,6 +1,8 @@
 <template>
 	<view class="wrap">
-		<u-navbar title="添加车牌"></u-navbar>
+		<u-navbar title="添加车牌">
+			<view slot="right" v-if="isLogin" @click="gotoLink" style=" margin-right: 10px;"> 跳过</view>
+		</u-navbar>
 		<view class="key-input">
 			<u-message-input :focus="true" :value="form.carNum" :maxlength="maxlength" :disabled-keyboard="true"></u-message-input>
 		</view>
@@ -24,6 +26,7 @@
 		},
 		data() {
 			return {
+				isLogin:false,
 				maxlength:8,
 				keyShow: true,
 				form: {
@@ -33,10 +36,10 @@
 			}
 		},
 		onLoad(op) {
-			if (op.id) {
-				var str1 = op.id.slice(0, 19);
-				var str2 = op.id.slice(20, 21);
-				var str3 = op.id.slice(22);
+			if (op.jpcode) {
+				var str1 = op.jpcode.slice(0, 19);
+				var str2 = op.jpcode.slice(20, 21);
+				var str3 = op.jpcode.slice(22);
 
 				if (str1 == 'jp_team51_charge_id') {
 					if (str2 == 'A') {
@@ -45,11 +48,29 @@
 					}
 				}
 			}
+			if(op.login){
+				this.isLogin=true;
+			}
 		},
 		onReady() {
 			this.$refs.uKeyboard.changeCarInputMode();
 		},
 		methods: {
+			gotoLink(){
+				if (this.code == 'A') {
+					uni.redirectTo({
+						url: '/pages/searchPile/stationAndPile/chargingPileDetails?id=' + this.codeId
+					})
+				} else if (this.isLogin){
+					uni.redirectTo({
+						url: '/pages/index/index'
+					})
+				}else {
+					uni.navigateBack({
+						url: '/pages/user/car/index'
+					})
+				}
+			},
 			checkboxChange() {
 				this.form.defaultFlag = !this.form.defaultFlag;
 			},
@@ -82,16 +103,8 @@
 				})
 				userApi.addRegUserCar(this.form).then((res) => {
 					uni.hideLoading();
-
-					if (this.code == 'A') {
-						uni.navigateBack({
-							url: '/pages/searchPile/stationAndPile/chargingPileDetails?id=' + this.codeId
-						})
-					} else {
-						uni.navigateBack({
-							url: '/pages/user/car/index'
-						})
-					}
+					
+					this.gotoLink()
 				}).catch(error => {
 					uni.showToast({
 						title: error,

+ 14 - 0
utils/mixin.js

@@ -1,6 +1,20 @@
 var prefix = 'jp_charging_' + process.car.NODE_ENV + '_';
 
 var app = {
+	getGzDate : (key) => {
+		var tdate=new Date( ).toJSON().substr(0,10).replace("T"," ")
+		var date= uni.getStorageSync( prefix + "is_gz_date")
+		
+		if(tdate==date){
+			return false
+		}else{
+			return  true;
+		}
+		
+	},
+	
+	setGzDate : () => uni.setStorageSync(prefix + "is_gz_date", new Date( ).toJSON().substr(0,10).replace("T"," ") ),
+	
 	getGunIdCharge :()=>{
 
 		var date= uni.getStorageSync( prefix + "GunId_Date_charge")