zhengkaixin 2 rokov pred
rodič
commit
23ae8c9946

+ 22 - 0
apis/card.js

@@ -0,0 +1,22 @@
+import request from '../utils/request.js';
+ import requestWhite from '../utils/requestWhite.js';
+
+import Qs from 'qs';
+
+export function cardDetail(data) {
+	 
+	return request({
+		method: 'get',
+		data:data ,
+		url: '/mobile/regUserCard/cardDetail'
+	})
+}
+
+export function openCard(data) {
+	 
+	return request({
+		method: 'get',
+		data:data ,
+		url: '/mobile/regUserCard/openCard'
+	})
+}

+ 278 - 123
pages/monthlyCardActivity/monthlyCardBuy.vue

@@ -1,125 +1,280 @@
-<template>
-	<view >
-		<ujp-navbar title="包月卡购买" ></ujp-navbar>
-		<!-- 卡片 -->
-		<view class="monthly-card">
-		<view class="main">
-			<view class="title-1">
-			充电服务费包月卡	
-			</view>
-			<view class="title-2">
-			有效期内,合约充电站使用度数无上限	
-			</view>
-		</view>
-			<img class="cover" src="../../assets/img/cover@3.png" alt="">
-		</view>
-		<view class="slogan-1">
-			充电服务费包月卡
-		</view>
-		<view class="slogan-2">
-			单次购买、整月受益!
-		</view>
-		<view class="slogan-3">
-			仅限车主购买,适用于平台对外开放充电站
-		</view>
-		
-		<!-- 立即开通 -->
-		<view class="bottom">
-			<button class="dredge">立即开通 ¥59.90/月</button>
-			<p>开通表示阅读并同意
-			<text class="agreement">《服务费折扣协议》</text>
-			</p>
-		</view>
-	</view>
-</template>
-
-<script>
-</script>
-
-<style lang="scss" scoped>
-	page{
-		background-color: #2a2c31;
-	}
-	
-	// 卡片
-	.monthly-card{
-		margin: 20px;
-		border-radius: 16px;
-		height: 150px;
-		background:linear-gradient(#F2E6CA,#C9A87B);
-		position: relative;
-		.main{
-			padding: 24px 0 24px 24px ;
-			height: 100%;
-			background: url(@/assets/img/card@3.png) ;
-			background-repeat:  no-repeat;
-			background-position: 30% 10%;      
-            background-size: cover;
-			color: rgba(255, 255, 255, 100);
-			.title-1{
-				line-height: 28px;
+<template>
+	<view>
+		<ujp-navbar title="包月卡购买"></ujp-navbar>
+		<!-- 卡片 -->
+		<view class="monthly-card">
+			<view class="main">
+				<view class="title-1">
+					充电服务费包月卡
+				</view>
+				<view class="title-2">
+					有效期内,合约充电站使用度数无上限
+				</view>
+			</view>
+			<img class="cover" src="../../assets/img/cover@3.png" alt="">
+		</view>
+		<view class="slogan-1">
+			充电服务费包月卡
+		</view>
+		<view class="slogan-2">
+			单次购买、整月受益!
+		</view>
+		<view class="slogan-3">
+			仅限车主购买,适用于平台对外开放充电站
+		</view>
+		<u-action-sheet :list="list" @click="click" v-model="show"></u-action-sheet>
+		<u-modal v-model="showModel" :show-cancel-button="true" @confirm="confirm" confirm-text="支付成功?" title="扫码支付">
+			<view style="
+								text-align: center;
+							">
+				<img id="qrcode2" :src="qrCodeImg">
+			</view>
+			<view style="
+								text-align: center;
+							">请使用支付宝扫码</view>
+
+		</u-modal>
+		<img id="qrcode" style="display: none;">
+		<!-- 立即开通 -->
+		<view class="bottom">
+			<button class="dredge" @click="show = true">立即开通 ¥{{detail.price}}/月</button>
+			<p>开通表示阅读并同意
+				<text class="agreement" @click="gotoUrl('pages/article/details?code=FWFZKXY')">《服务费折扣协议》</text>
+			</p>
+		</view>
+	</view>
+</template>
+
+<script>
+	import * as Pay from '@/apis/weixin.js'
+	import * as API from '@/apis/card.js'
+
+	import QRCode from 'qrcodejs2'
+	import {
+		convertCanvasToImage,
+	} from '@/utils'
+	import {
+		wxPayJs
+	} from '@/utils/wxpay'
+	export default {
+		data() {
+			return {
+				qrCodeImg: "",
+				showModel: false,
+				list: [{
+					text: '微信',
+
+				}, {
+					text: '支付宝'
+				}],
+				show: false,
+				submitForm:{},
+				detail:{}
+			}
+		},
+		onReady() {
+			this.getInfo();
+		},
+		methods: {
+			getInfo(){
+				uni.showLoading({
+					title: "加载中",
+					mask: true,
+				})
+				API.cardDetail({
+					cardId:'3e1b0f8f-61b0-405f-a285-929b5346479f'
+				}).then((response) => {
+					this.detail=response.data.monthlyRentCard
+					uni.hideLoading()
+				}).catch(error => {
+					uni.showToast({
+						title: error
+					})
+				})
+			},
+			submit(type){
 				
-				font-size: 28px;
-				margin-bottom: 8px;
-			}
-			.title-2{
-				line-height: 24px;
+				uni.showLoading({
+					title: "加载中",
+					mask: true,
+				})
+				API.openCard({
+					cardId:'3e1b0f8f-61b0-405f-a285-929b5346479f'
+				}).then((response) => {
+					this.submitForm.id=response.data.orderInfoId
+					
+					if(type==0){			
+						this.wxpy()
+					}
+					if(type==1){
+						this.alpy()
+					}
+				}).catch(error => {
+					uni.showToast({
+						title: error
+					})
+				})
 				
-				font-size: 17px;
-			}
-		}
-		
-		.cover{
-			width: 102%;
-			position: absolute;
-			bottom: -10px;
-			left: -2px;
-			right: 0;
-		}
-	}
-	
-	.slogan-1{
-		height: 36px;
-		color: rgba(234, 217, 180, 100);
-		font-size: 24px;
-		text-align: center;
-		margin-bottom: 4px;
-	}
-	.slogan-2{
-		height: 36px;
-		color: rgba(234, 217, 180, 100);
-		font-size: 28px;
-		text-align: center;
-		margin-bottom: 12px;
-	}
-	.slogan-3{
-		height: 20px;
-		color: rgba(255, 255, 255, 100);
-		font-size: 14px;
-		text-align: center;
-	}
-	// 立即开通
-	.bottom{
-		
-		position: fixed;
-		bottom: 40px;
-		left: 0;
-		right: 0;
-		.dredge{
-			width: 72.2%;
-			border-radius: 50px;
-			font-size: 18px;
-			background:linear-gradient(to right,#C9A87B,#F2E6CA);
-			margin-bottom: 12px;
-		}
-		p{
-			height: 20px;
-			color: rgba(226, 222, 217, 100);
-			font-size: 14px;
-			text-align: center;
-		}
-		.agreement{
-			color: #897a69;
-		}
-	}
-</style>
+			},
+			alpy() {
+				uni.showLoading({
+					title: "加载中",
+					mask: true,
+				})
+				Pay.alpay(this.submitForm).then((response) => {
+
+					let qrcode = new QRCode('qrcode', {
+						width: 200,
+						height: 200,
+						text: response.data.qr_code,
+						correctLevel: QRCode.CorrectLevel.M,
+
+					})
+					this.outOrderNo = response.data.outOrderNo;
+					var canvas = document.getElementsByTagName('canvas')[0];
+					this.qrCodeImg = convertCanvasToImage(canvas);
+					uni.hideLoading()
+					this.showModel = true
+
+				}).catch(error => {
+					uni.showToast({
+
+						title: error
+					})
+				})
+			},
+			wxpy() {
+
+				Pay.wxpay(this.submitForm).then((response) => {
+
+					if (!response.result) {
+						uni.showToast({
+							title: response.message
+						})
+						return
+					}
+					var data = response.data
+					uni.hideLoading()
+					//("Pay+"+new Date().getTime())		
+					wxPayJs(data);
+
+				}).catch(error => {
+					uni.showToast({
+
+						title: error
+					})
+
+				})
+			},
+			confirm() {
+				uni.redirectTo({
+					url: "/pages/user/finance/rechargeRes?id=" + this.outOrderNo
+				})
+			},
+			click(index) {
+				console.log(`点击了第${index + 1}项,内容为:${this.list[index].text}`)
+				this.submit(index);
+			}
+		}
+
+	}
+</script>
+
+<style lang="scss" scoped>
+	page {
+		background-color: #2a2c31;
+	}
+
+	// 卡片
+	.monthly-card {
+		margin: 20px;
+		border-radius: 16px;
+		height: 150px;
+		background: linear-gradient(#F2E6CA, #C9A87B);
+		position: relative;
+
+		.main {
+			padding: 24px 0 24px 24px;
+			height: 100%;
+			background: url(@/assets/img/card@3.png);
+			background-repeat: no-repeat;
+			background-position: 30% 10%;
+			background-size: cover;
+			color: rgba(255, 255, 255, 100);
+			border-radius: 6px;
+			.title-1 {
+				line-height: 28px;
+
+				font-size: 56rpx;
+				margin-bottom: 8px;
+			}
+
+			.title-2 {
+				line-height: 24px;
+
+				font-size: 34rpx;
+			}
+		}
+
+		.cover {
+			width: 102%;
+			position: absolute;
+			bottom: -10px;
+			left: -2px;
+			right: 0;
+		}
+	}
+
+	.slogan-1 {
+		height: 36px;
+		color: rgba(234, 217, 180, 100);
+		font-size: 48rpx;
+		text-align: center;
+		margin-bottom: 4px;
+	}
+
+	.slogan-2 {
+		height: 36px;
+		color: rgba(234, 217, 180, 100);
+		font-size: 56rpx;
+		text-align: center;
+		margin-bottom: 12px;
+	}
+
+	.slogan-3 {
+		height: 20px;
+		color: rgba(255, 255, 255, 100);
+		font-size: 28rpx;
+		text-align: center;
+	}
+
+	// 立即开通
+	.bottom {
+
+		position: fixed;
+		background-color: #2a2c31;
+		bottom: 0px;
+		padding-bottom: 40px;
+		left: 0;
+		right: 0;
+
+		.dredge {
+			width: 72.2%;
+			border-radius: 50px;
+			font-size: 18px;
+			background: linear-gradient(to right, #C9A87B, #F2E6CA);
+			margin-bottom: 12px;
+		}
+
+		p {
+			height: 20px;
+			color: rgba(226, 222, 217, 100);
+			font-size: 14px;
+			text-align: center;
+		}
+
+		.agreement {
+			color: #897a69;
+		}
+	}
+</style>

+ 24 - 4
pages/searchPile/chargeProcess/charge.vue

@@ -83,7 +83,7 @@
 			 
 			 
 			 <!-- 会员活动 -->
-			 <view class="member">
+			 <view class="member" v-if="userCardBool" >
 			 	<view class="actively">
 			 		会员活动
 			 	</view>
@@ -157,15 +157,33 @@
 						name: '100'
 					},
 
-				],
+				],
+				userCard:null,
 				selectObj:{},
 				value:"",
 				// 优惠券
 				listlength:0,
 
 			}
+		},
+		computed:{
+			userCardBool(){
+				if(this.userCard){
+					var date=new Date().getTime()
+					var date2=new Date(this.userCard.endTime).getTime();
+					if(date<date2){
+						return true;
+					}
+				}
+				return false
+			}
 		},
-		onLoad(op) {
+		onLoad(op) {
+			
+			var plus=this.carhelp.getPersonInfoPlus()
+			if(plus){
+				this.userCard=plus.userCard;
+			}
 			this.uuid=new Date().getTime();
 			this.stationId= op.stationId;
 			if (op.deviceNo) {
@@ -276,7 +294,9 @@
 				if(this.selectObj.id){
 					this.submitForm.userCouponId=this.selectObj.id
 				}
-
+				if(this.userCardBool){
+					this.submitForm.userCardId=this.userCard.id
+				}
 				uni.showLoading({
 					title: "加载中",
 					mask: true,

+ 29 - 3
pages/searchPile/chargeProcess/dcCharging.vue

@@ -47,7 +47,16 @@
 					<view class="info-text" style="color:red">
 						{{couponObj&&couponObj.status=='1'?couponObj.text:'未使用'}}
 					</view>
-				</view>
+				</view>
+				<view class="info" v-if="userCardBool" >
+					<view class="info-name">
+						会员活动
+					</view>
+					<view class="info-text">
+						充电服务费包月卡
+					</view>
+				</view>
+				
 				<view class="info" v-if="chargingRecord.remark">
 					<view class="info-name">
 						结束原因
@@ -269,12 +278,17 @@
 				show2: false,
 				isReady:true,
 				waitNum:'',
-				projectName:"",
+				projectName:"",
+				userCard:null,
 			}
 		},
 		onLoad(op) {
 			this.projectName=process.car.ProjectName;
-			
+			
+			var plus=this.carhelp.getPersonInfoPlus()
+			if(plus){
+				this.userCard=plus.userCard;
+			}
 			if (op.id) {
 				this.id = op.id;
 				this.init()
@@ -313,6 +327,18 @@
 				this.theme('standard')
 				
 			this.addpercent()
+		},
+		computed:{
+			userCardBool(){
+				if(this.userCard){
+					var date=new Date().getTime()
+					var date2=new Date(this.userCard.endTime).getTime();
+					if(date<date2){
+						return true;
+					}
+				}
+				return false
+			}
 		},
 		methods: {
 			theme(type) {

+ 32 - 7
pages/user/finance/rechargeRes.vue

@@ -1,15 +1,19 @@
 <template>
 	<view>
-		<ujp-navbar title="充值结果"></ujp-navbar>
+		<ujp-navbar :title="title"></ujp-navbar>
 		<view class="paySuccess">
-			<u-icon name="chenggong" custom-prefix="custom-icon" size="180" color="#00B962"></u-icon>
-			<view class="title oldTextjp" oldstyle="font-size: 20px;">{{detail.payStatusStr}}</view>
+			<u-icon :name="detail.payStatus==20?'chenggong':'close-circle-fill'" custom-prefix="custom-icon" size="180" :color="detail.payStatus==20?'#00B962':'#ff9800'"></u-icon>
+			<view class="title oldTextjp" oldstyle="font-size: 20px;" v-if="detail.type=='1'">{{detail.payStatusStr}}</view>
+			<view class="title oldTextjp" oldstyle="font-size: 20px;" v-if="detail.type=='2'" >开通{{detail.payStatus==20?'成功':'失败'}}</view>
+			
 			<view class="payPrice">
 				<font>{{detail.totalFee}}</font><span>元</span>
 			</view>
-			<p class="oldTextjp2" oldstyle="font-size: 16px;">{{detail.payNameStr}}</p>
+			<p class="oldTextjp2" oldstyle="font-size: 16px;"  >{{detail.payNameStr}}</p>
+		
+			
 		</view>
-		<view class="paySuccess-btn">
+		<view class="paySuccess-btn" v-if="detail.type=='1'">
 			<u-button class="success-btn1 oldTextjp2" oldstyle="font-size: 18px;" shape="circle" type="" @click="rechargeContinue">
 				<span>继续充值</span>
 			</u-button>
@@ -24,6 +28,18 @@
 			 shape="circle" type="success" @click="balanceLook">
 				<span>查看余额</span>
 			</u-button>
+		</view>
+		<view class="paySuccess-btn" v-if="detail.type=='2'">
+			
+			<u-button class="success-btn1 oldTextjp2" v-if="detail.payStatus!=20" oldstyle="font-size: 18px;" shape="circle" type="" @click="getInfo">
+				<span>刷新</span>
+			</u-button>
+			
+			<u-button class="success-btn2 oldTextjp2" oldstyle="font-size: 18px;" shape="circle" type="" @click="userindex">
+				<span>返回</span>
+			</u-button>
+			
+			
 		</view>
 	</view>
 </template>
@@ -38,7 +54,7 @@
 				id: "",
 				charge:false,
 				chargeObj:{},
-				
+				title:'充值结果'
 
 			}
 		},
@@ -69,13 +85,22 @@
 				}).then((res) => {
 					uni.hideLoading()
 
-					this.detail = res.data.orderInfo;
+					this.detail = res.data.orderInfo;
+					if(this.detail.type=='2'){
+						this.title='开通会员'
+					}
+					
 				}).catch(error => {
 					uni.showToast({
 						title: error,
 						icon: "none"
 					})
 				})
+			},
+			userindex() {
+				uni.redirectTo({
+					url: '/pages/user/index'
+				})
 			},
 			rechargeContinue() {
 				uni.redirectTo({

+ 24 - 10
pages/user/index.vue

@@ -10,7 +10,7 @@
 			</view>
 		</view>
 		<!-- 引导模块 -->
-		<view class="userLead">
+		<view class="userLead" v-if="userId&&!userCardBool">
 			<view class="text">
 				<view class="text1">
 					<img class="svg-img" src="../../assets/img/antFill-crown@3x.png" alt="" >充电服务费包月卡
@@ -21,11 +21,11 @@
 				
 			</view>
 			<view class="btn">
-				<button class="open">立即开通</button>
+				<button class="open"  @click="gotoUrl('pages/monthlyCardActivity/monthlyCardBuy')" >立即开通</button>
 			</view>
 		</view>
 		<!-- 包月卡 -->
-		<view class="monthly-card">
+		<view class="monthly-card"  v-if="userId&&userCardBool"   @click="gotoUrl('pages/monthlyCardActivity/monthlyCardBuy')">
 			<view class="img-box"><img class="svg-img" src="../../assets/img/antFill-crown@3x.png" alt="" ></view>
 			<view class="flex">
 			<view class="text">
@@ -33,7 +33,7 @@
 				充电服务费包月卡
 			</view>
 			<view class="date">
-				2022.07.30到期<text class="iconfont">&#xe600;</text>
+				{{userCard.endTime?userCard.endTime.slice(0,10):''}}到期<text class="iconfont">&#xe600;</text>
 			</view>	
 			</view>
 		</view>
@@ -211,6 +211,7 @@
 		},
 		data() {
 			return {
+				userCard:null,
 				recordsTotal: 0,
 				myCouponList: [],
 				elderStatus: false,
@@ -246,6 +247,18 @@
 				this.elderStatus = false;
 			}
 		},
+		computed:{
+			userCardBool(){
+				if(this.userCard){
+					var date=new Date().getTime()
+					var date2=new Date(this.userCard.endTime).getTime();
+					if(date<date2){
+						return true;
+					}
+				}
+				return false
+			}
+		},
 		onReady() {
 			WxJsApi.getWxConfig(['getLocation', 'addEventListener', 'scanQRCode']).then((res) => {
 				// //(res)
@@ -395,7 +408,7 @@
 				}).then((res) => {
 					uni.hideLoading();
 					this.headImg = res.data.regUser.headImg;
-					
+					this.userCard=res.data.userCard;
 					var phone = res.data.regUser.phone;
 					var phone1 = phone.slice(0,3);
 					var phone2 = phone.slice(-4);
@@ -658,7 +671,7 @@
 	   border: 1px solid rgba(226, 210, 187, 100);
 	   .text1{
 		   color: rgba(16, 16, 16, 100);
-		   font-size: 16px;
+		   font-size: 32rpx;
 		   line-height: 20px;
 		   margin-bottom: 6px;
 		   .svg-img{
@@ -669,7 +682,7 @@
 	   }
 	   .text2{
 		   color: rgba(16, 16, 16, 100);
-		   font-size: 20px;
+		   font-size: 36rpx;
 		   line-height: 22px;
 		   .free{
 			   color: #ff7600;
@@ -677,11 +690,11 @@
 	   }
 	   .btn{
 		   line-height: 100%;
-		   margin: auto ;
-		   margin-left: 18px;
+		     margin: auto 13px;
+		     margin-right: 0px;
 		   .open{
 			   
-			   font-size: 14px;
+			   font-size: 32rpx;
 			   line-height: 32px;
 			   border-radius: 8px;
 			   background: linear-gradient(#ff3d00, #ff9600);
@@ -695,6 +708,7 @@
    .monthly-card{
 	   padding: 16px;
 	   margin: 16px;
+	     margin-top: 45px;
 	   border-radius: 8px;
 	   background: linear-gradient(to right,#d3bd9e,#f5eedf);
 	   display: flex;