Browse Source

优惠券

zhengkaixin 3 years ago
parent
commit
3eb55a8f5e

+ 4 - 3
pages/login/completeInfo.vue

@@ -19,7 +19,7 @@
 					<u-form-item label-position="top" label="昵称"><u-input v-model="form.nickName" placeholder="请填写昵称"/></u-form-item>
 				</u-form>
 			</view>
-			<p class="car-num">车牌号码</p>
+			<p class="car-num"  @tap="keyShow=!keyShow" >车牌号码<span style="color: #9e9e9e;float: right;padding-right: 10px;">(点击唤起键盘)</span></p>
 			
 			
 			<view class="key-input"
@@ -40,6 +40,7 @@
 			 
 			 <ucarkeyboard ref="uKeyboard"
 			  style="    z-index: 999;"
+			  :style="!keyShow?'display: none':''" 
 			  mode="car" :confirmBtn="false" :mask-close-able="false" :tooltip="false" v-show="keyShow" @change="valChange" @backspace="backspace">
 			 <view style="
 			 	text-align: center;
@@ -75,8 +76,8 @@
 				maxlength:8,
 				keyShow: false,
 				isLogin:false,
-							
-			
+				code:"",
+				codeId:"",			
 				form: {
 					nickName: '',
 					headImg: '',

+ 45 - 47
pages/searchPile/chargeProcess/charge.vue

@@ -27,7 +27,7 @@
 			</view>
 
 			<!-- 优惠券 -->
-			<view class="discounts" v-if="list.length" >
+			<view class="discounts" v-if="false" >
 				<view class="title">
 					<span class="title-1">
 						优惠券
@@ -61,11 +61,17 @@
 			 	<view class="left">
 			 		优惠券
 			 	</view>
-				<view class="right">
-					未选优惠券,最高优惠30元
+				<view class="right"  @click="chooseCoupons"  v-if="listlength">
+					未选择,剩余{{listlength}}张优惠券
 					<view class="iconfont">&#xe600;</view>
-				</view>
-			 </view>
+				</view>
+				<view class="right" v-else>
+					无优惠券
+					<view class="iconfont">&#xe600;</view>
+				</view>
+				
+			 </view>
+			
 		</view>
 		<view class="bottom">
 			<view class="botton"
@@ -86,6 +92,7 @@
 
 <script>
 	import * as API from '@/apis/chargeProcess.js'
+	import * as userApi from '@/apis/user.js'
 
 	export default {
 		data() {
@@ -101,7 +108,8 @@
 					chargeStrategy: 2,
 					amount: 0
 					//paytype:'YE',
-				},
+				},
+				uuid:0,
 				user: {},
 				otherNum: '',
 				moneyList: [
@@ -129,12 +137,12 @@
 				],
 				value:"",
 				// 优惠券
-				list: [
-				],
+				listlength:0,
 
 			}
 		},
-		onLoad(op) {
+		onLoad(op) {
+			this.uuid=new Date().getTime();
 			if (op.deviceNo) {
 				this.submitForm.deviceNo = op.deviceNo;
 				this.submitForm.channelNo = op.gun;
@@ -149,7 +157,13 @@
 		onShow() {
 			this.getHomePage()
 		},
-		methods: {
+		methods: {
+			chooseCoupons(){
+				this.submitInit()
+					
+				this.gotoUrl('pages/user/coupon/chooseCoupons?uuid='+this.uuid+"&amount="+this.submitForm.amount)
+				
+			},
 			ckInput(text) {
 				if (text.indexOf('.') > 0) {
 
@@ -173,13 +187,13 @@
 					})
 				
 				}
-				this.useCoupon()
+				
 
 			},
 			moneyClick(index) {
 				this.otherNum = ''
 				this.moneyActiveClass = index;
-				this.useCoupon()
+			
 
 			},
 			radioChange(e){},
@@ -234,7 +248,7 @@
 					this.user = res.data
 					this.isReady = true;
 					uni.hideLoading()
-					//this.useCoupon()
+				 
 				}).catch(error => {
 					uni.showToast({
 						title: error
@@ -242,41 +256,18 @@
 				})
 			},
 			useCoupon(){
-				uni.showLoading({
-					title: "加载中",
-					mask: true,
-				})
-				 	this.submitInit()
-				API.useCoupon({
-					amount:this.submitForm.amount?this.submitForm.amount:''
+				 
+				 
+				 
+				userApi.couponList({
+					status:0
 				}).then((res) => {
 					
-					this.list=res.data.userCouponList
-					for(var i in this.list){
-						var obj=this.list[i]
-						if(obj.id==this.value){
-							if(obj.chooseStatus==1){
-								
-							}else{
-								this.value=''
-							}
-						}
-					}
-					for(var i in this.list){
-						if(this.value==''){
-							var obj=this.list[i]
-							if(obj.chooseStatus==1){
-								this.value=obj.id
-								break
-							}
-							
-						}else{
-							break
-						}
-					}
+					this.listlength= res.data.recordsTotal;
+					 
 					
 					
-					uni.hideLoading()
+					//uni.hideLoading()
 					
 				}).catch(error => {
 					uni.showToast({
@@ -340,7 +331,12 @@
 	}
 </style>
 
-<style lang="scss" scoped>
+<style lang="scss" scoped>
+	.listlength{
+		    float: right;
+		    padding-right: 10px;
+	}
+	
 	/deep/.u-radio-group {
 		width: 100%;
 	}
@@ -533,12 +529,14 @@
 		width: 100%;
 		display: flex;
 		justify-content: space-between;
-		.left{
+		.left{
+				width: 70px;
 			// height: 20px;
 			color: rgba(16, 16, 16, 100);
 			font-size: 20px;
 		}
-		.right{
+		.right{
+		
 			height: 16px;
 			line-height: 28px;
 			color: rgba(255, 61, 0, 100);

+ 6 - 1
pages/searchPile/stationAndPile/chargingPileDetails.vue

@@ -1,6 +1,6 @@
 <template>
 	<view>
-		<u-navbar title="充电桩详情" :is-back="false" ></u-navbar>
+		<u-navbar title="充电桩详情" :custom-back="customback" ></u-navbar>
 
 		<!-- 充电桩信息 -->
 		<view class="main">
@@ -156,6 +156,11 @@
 
 		},
 		methods: {
+			customback(){
+				uni.reLaunch({
+					url:"/pages/login/welcome"
+				})
+			},
 			carDet(){
 				this.onShowRole = true
 				uni.navigateTo({

+ 2 - 0
pages/user/car/carDet.vue

@@ -29,6 +29,8 @@
 				isLogin:false,
 				maxlength:8,
 				keyShow: true,
+				code:"",
+				codeId:"",
 				form: {
 					carNum: '鄂',
 					defaultFlag: true,

+ 98 - 32
pages/user/coupon/chooseCoupons.vue

@@ -1,54 +1,44 @@
 <template>
 	<view >
 		<u-navbar title="我的优惠券"><view class="exchange" @click="toConversion">兑换</view></u-navbar>
-		<view class="list-item">
-			<view class="voucher">优惠券</view>
+		
+		<u-alert-tips size="12" :show-icon="true"  type="warning"
+		 description="同类型优惠券只显示一张"></u-alert-tips>
+		
+		
+		<view class="list-item"  v-for="(item,index) in myCouponList" :key="item.id">
+			
+			<view class="voucher" v-if="item.classify == '1'">优惠券</view>
+			<view class="voucher" v-if="item.classify == '2'">折扣卷</view>
 			<view class="checked">
 				<img src="../../../static/img/选中.png" alt="">
 			</view>
 			<view class="item-left">
 				<view class="title">
-					新客首充专享
+					{{item.couponName}}
 				</view>
 				<view class="useful-life">
-					有效期至2022.05.22
+					有效期至{{item.endDate&&item.endDate.slice(0,10)}}
 				</view>
 			</view>
 			<view class="item-right">
-				  <view class="price">
-				  	<text style="font-size: 14px;">¥</text>  15
-				  </view>
+				
+					<view class="price" v-if="item.classify == '1'">¥{{item.value}}</view>
+					<view class="price" v-if="item.classify == '2'">{{item.value*10}}折</view>
+				 
 				  <view class="contidion">
-				  	满100可用
+				  	{{item.threshold == 0 ? '无门槛' : '满'+item.threshold+'可用'}}
 				  </view>
 			</view>
 			
 		</view>
+		<u-divider  v-if="myCouponList.length > 0" style="padding-bottom: 80px;margin-top: 10px;">已经到底了</u-divider>
 		
-		<view class="list-item">
-			<view class="voucher">优惠券</view>
-			<view class="checked">
-				<img src="../../../static/img/选中.png" alt="">
-			</view>
-			<view class="item-left">
-				<view class="title">
-					逢周五充电服务费折扣券
-				</view>
-				<view class="useful-life">
-					每周五可使用
-				</view>
-			</view>
-			<view class="item-right">
-				  <view class="price">
-				  	  5<text style="font-size: 14px;">折</text>
-				  </view>
-				  <view class="contidion">
-				  	满66可用
-				  </view>
-			</view>
-			
+		<view class="carNone" v-if="myCouponList.length == 0">
+			<img src="static/img/暂无数据-缺省页.png" alt="">
+			<p>暂无优惠券</p>
 		</view>
-	
+		
 	<view class="bottom">
 		<view class="text">
 			已选1张,预计可减
@@ -67,9 +57,85 @@
 </template>
 
 <script>
+	//import * as userApi from '@/apis/user.js'
+	import * as userApi from '@/apis/chargeProcess.js'
+	
+	export default{
+		data(){
+			return{
+				amount:0,
+				uuid:0,
+				myCouponList: [],
+				pageIndex: 1,
+				recordsTotal: 0,
+			}
+		},
+		onReachBottom() {
+			if (this.myCouponList.length < this.recordsTotal) {			
+				this.myLoadmore();
+			}
+		},
+		onLoad(op) {
+			if(op.uuid){
+				this.amount=op.amount
+				this.uuid=op.uuid
+			}
+		
+		},
+		onShow() {
+				this.getCouponList();
+		},
+		methods:{
+			toConversion() {
+				uni.navigateTo({
+					url: '/pages/user/coupon/conversion'
+				})
+			},
+			getCouponList(bl) {
+				uni.showLoading({
+					title: "加载中",
+					mask: true,
+				})
+				if (bl) {
+					this.myCouponList = [];
+					this.pageIndex = 1;
+				}
+				userApi.useCoupon({
+					amount:this.amount
+				}).then((res) => {
+					uni.hideLoading();
+					
+					this.myCouponList =res.data.userCouponList
+					this.recordsTotal = res.data.recordsTotal;
+				}).catch(error => {
+					uni.showToast({
+						title: error,
+						icon: "none"
+					})
+				})
+			},
+			myLoadmore() {
+				this.pageIndex += 1;
+				this.getCouponList()
+			},
+		}
+	}
 </script>
 
 <style lang="scss">
+	.carNone{
+		display: flex;
+		flex-direction: column;
+		justify-content: center;
+		align-items: center;
+		img{
+			width: 100%;
+			height: 100%;
+		}
+		p{
+			margin-top: -60px;
+		}
+	}
 	.exchange{
 		margin-left: 85.3%;
 		color: rgba(119, 119, 119, 100);
@@ -118,7 +184,7 @@
 			.useful-life{
 				line-height: 22px;
 				color: rgba(51, 51, 51, 100);
-				font-size: 16px;
+				font-size: 14px;
 				margin-top: 1px;
 			}
 		}

+ 21 - 3
pages/user/coupon/myCoupon.vue

@@ -4,16 +4,19 @@
 		<view class="tab" >
 			<u-tabs :list="tabList" :current="current" @change="change" :show-bar="false" active-color="#333" inactive-color="#c4c0c0"></u-tabs>
 		</view>
-
+		<view class="carNone" v-if="myCouponList.length == 0">
+			<img src="static/img/暂无数据-缺省页.png" alt="">
+			<p>暂无优惠券</p>
+		</view>
 		<view class="workable" :style="current == 0 ? '' : 'opacity: 0.6'">
 			<view class="list-item" v-for="(item,index) in myCouponList" :key="item.id">
 				<view class="voucher" v-if="item.classify == '1'">优惠券</view>
 				<view class="voucher" v-if="item.classify == '2'">折扣卷</view>
 				<view class="content" @click="gotoUrl('pages/user/coupon/couponDetails?id=' + item.id)">
 					<view class="content-left">
-						<view class="text">{{item.accessChannel}}</view>
+						<view class="text">{{item.couponName}}</view>
 						<view class="useful-life">
-							有效期至{{item.endDate.slice(0,10)}}
+							有效期至{{item.endDate&&item.endDate.slice(0,10)}}
 						</view>	
 					</view>
 					<view class="content-right">
@@ -40,6 +43,8 @@
 				</view>
 			</view>
 		</view>
+		<u-divider  v-if="myCouponList.length ==recordsTotal" style="margin-top: 10px;">已经到底了</u-divider>
+		
 	</view>	
 </template>
 
@@ -134,6 +139,19 @@
 	}
 </style>
 <style lang="scss" scoped>
+	.carNone{
+		display: flex;
+		flex-direction: column;
+		justify-content: center;
+		align-items: center;
+		img{
+			width: 100%;
+			height: 100%;
+		}
+		p{
+			margin-top: -60px;
+		}
+	}
 	.exchange{
 		margin-left: 85.3%;
 		color: rgba(119, 119, 119, 100);