From 7d9176b8facd97c3f5ee696a496a7cc7737425bb Mon Sep 17 00:00:00 2001
From: tx <2622874537@qq.com>
Date: Fri, 6 Sep 2024 17:58:07 +0800
Subject: [PATCH] =?UTF-8?q?vip=E4=BF=AE=E6=94=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 common/css/iconfont.css |  14 ++++--
 page_vip/card_his.vue   |  13 ++---
 page_vip/checkCard.vue  | 106 ++++++++++++++++++++++++++++++++++------
 page_vip/vip_his.vue    |  16 +++---
 pages/index/index.vue   | 100 +++++++++++++++++++++++++++++++++++--
 pages/my.vue            |  12 ++---
 6 files changed, 219 insertions(+), 42 deletions(-)

diff --git a/common/css/iconfont.css b/common/css/iconfont.css
index 9d72533..62910cf 100644
--- a/common/css/iconfont.css
+++ b/common/css/iconfont.css
@@ -1,8 +1,8 @@
 @font-face {
   font-family: "iconfont"; /* Project id 4503426 */
-  src: url('//at.alicdn.com/t/c/font_4503426_h95wjcstqhw.woff2?t=1720592381205') format('woff2'),
-       url('//at.alicdn.com/t/c/font_4503426_h95wjcstqhw.woff?t=1720592381205') format('woff'),
-       url('//at.alicdn.com/t/c/font_4503426_h95wjcstqhw.ttf?t=1720592381205') format('truetype');
+  src: url('//at.alicdn.com/t/c/font_4503426_no8o2248czg.woff2?t=1725609027382') format('woff2'),
+       url('//at.alicdn.com/t/c/font_4503426_no8o2248czg.woff?t=1725609027382') format('woff'),
+       url('//at.alicdn.com/t/c/font_4503426_no8o2248czg.ttf?t=1725609027382') format('truetype');
 }
 
 .iconfont {
@@ -13,6 +13,14 @@
   -moz-osx-font-smoothing: grayscale;
 }
 
+.icon-xiangshang:before {
+  content: "\e6b1";
+}
+
+.icon-xiangxia:before {
+  content: "\e6b2";
+}
+
 .icon-xiangzuo:before {
   content: "\eb15";
 }
diff --git a/page_vip/card_his.vue b/page_vip/card_his.vue
index 0341694..9871a4f 100644
--- a/page_vip/card_his.vue
+++ b/page_vip/card_his.vue
@@ -4,17 +4,17 @@
 			height='45'></u-navbar>
 
 		<view class="cont">
-			<view class="vip_card">
+			<view class="vip_card" v-for="(item,index) in CouponLists" :key="index">
 				<view class="top">
 					<view class="txt">
-						电单车15天5次卡
+						{{item.couponName}}
 					</view>
 					<view class="txt">
-						3.9 <span style="font-size: 32rpx;">元</span>
+					{{item.retailPrice}} <span style="font-size: 32rpx;">元</span>
 					</view>
 				</view>
 				<view class="bot">
-					2024-07-28 17:39:50
+				{{formatDate(item.createTime)}} 
 				</view>
 			</view>
 		</view>
@@ -63,9 +63,10 @@
 			  },
 			getcard(){
 				let data={
-					userId:this.userinfo.userId
+					userId:this.userinfo.userId,
+					typeList:'3,4'
 				}
-				this.$u.get("/appVerify/getCouponListByUserId?",data ).then((res) => {
+				this.$u.get("/appVerify/couponBuyRecord?",data ).then((res) => {
 							
 					if (res.code == 200) {
 						this.CouponLists = res.data
diff --git a/page_vip/checkCard.vue b/page_vip/checkCard.vue
index 1039846..b8ab490 100644
--- a/page_vip/checkCard.vue
+++ b/page_vip/checkCard.vue
@@ -8,37 +8,37 @@
 				<view class="card_txt">
 					不使用骑行卡
 				</view>
-				<image src="https://lxnapi.ccttiot.com/bike/img/static/u2RancJg66W4KNy3NVOW" mode=""></image>
-				<!-- <image src="https://lxnapi.ccttiot.com/bike/img/static/u534UfvcSJmYAoPtTP4V" mode=""></image> -->
+				<image src="https://lxnapi.ccttiot.com/bike/img/static/u2RancJg66W4KNy3NVOW" mode="" v-if="chooseIdx!=999"></image>
+				<image src="https://lxnapi.ccttiot.com/bike/img/static/u534UfvcSJmYAoPtTP4V" mode=""  v-if="chooseIdx==999"></image>
 			</view>
 			<view class="tips">
 				可用骑行卡
 			</view>
-			<view class="card2">
+			<view class="card2" v-for="(item,index) in CouponLists" :key="index" v-if="(item.couponType==3||item.couponType==4)&&item.status==1">
 				<view class="txt1">
-					电单车15天5次卡 | 剩余5次
+					{{item.couponName}} | 剩余{{item.limitNum}}次
 				</view>
 				<view class="txt2">
-					有效期至2024-08-04
+					有效期至{{formatDate(item.expirationTime) }}
 				</view>
-				<view class="btn1">
+				<!-- <view class="btn1">
 					满5.00元可使用
-				</view>
+				</view> -->
 				<view class="imgs">
 					<!-- <image src="https://lxnapi.ccttiot.com/bike/img/static/u2RancJg66W4KNy3NVOW" mode=""></image> -->
 					<image src="https://lxnapi.ccttiot.com/bike/img/static/u534UfvcSJmYAoPtTP4V" mode=""></image>
 				</view>
 			</view>
-			<view class="card3">
+			<view class="card3" v-for="(item,index) in CouponLists" :key="index" v-if="item.couponType==1&&item.status==1" @click="choose(item,index)">
 				<view class="txt4">
-					有效期至2024-08-28
+					有效期至{{formatDate(item.expirationTime)}}
 				</view>
 				<view class="imgs">
-					<!-- <image src="https://lxnapi.ccttiot.com/bike/img/static/ug8PuJqm4gM8NTod9QhV" mode=""></image> -->
-					<image src="https://lxnapi.ccttiot.com/bike/img/static/udiSbHYWZQYLoapdWOyc" mode=""></image>
+					<image src="https://lxnapi.ccttiot.com/bike/img/static/ug8PuJqm4gM8NTod9QhV" mode="" v-if="chooseIdx!=index"></image>
+					<image src="https://lxnapi.ccttiot.com/bike/img/static/udiSbHYWZQYLoapdWOyc" mode=""  v-if="chooseIdx==index"></image>
 				</view>
 			</view> 
-			<view class="sub_btn">
+			<view class="sub_btn" @click="sub()">
 				确定
 			</view>
 		</view>
@@ -53,12 +53,88 @@
 					backgroundColor: '#fff'
 				},
 				sn: '',
-				istrue: false
+				istrue: false,
+				orderId:'',
+				chooseIdx:-1,
+				CouponLists:[],
+				chooseInfo:{}
 			}
 		},
-
+		onShow() {
+			this.getinfo()
+		},
+		onLoad(e) {
+			this.orderId=e.orderId
+			console.log(e,);
+		},
 		methods: {
-
+			choose(item,index){
+				this.chooseIdx=index
+				this.chooseInfo=item
+			},
+			sub(){
+				if(this.chooseIdx==999){
+				uni.navigateBack({
+					delta: 1 // delta值为1时表示返回的页面层数
+				});
+				}else{
+					this.$u.post("/appVerify/useCoupon?orderNo="+this.orderId+'&logId='+this.chooseInfo.logId).then((res) => {
+								
+						if (res.code == 200) {
+							uni.navigateBack({
+								delta: 1 // delta值为1时表示返回的页面层数
+							});
+							
+						} else {
+						
+						}
+					});
+				}
+				
+			
+			},
+			getinfo() {
+				// uni.showLoading({
+				// 	title:'加载中'
+				// })
+				this.$u.get("/getAppInfo").then((res) => {
+			
+					if (res.code == 200) {
+					
+						this.$store.commit('SET_USERID', res.user.userId);
+						this.userinfo = res.user
+						this.getcard()
+					} else {
+					
+					}
+				});
+			},
+			 formatDate(dateString) {
+			    if (!dateString) return '';
+			    const date = new Date(dateString);
+			    const year = date.getFullYear();
+			    const month = (date.getMonth() + 1).toString().padStart(2, '0'); // 月份从0开始,需要加1
+			    const day = date.getDate().toString().padStart(2, '0');
+			    return `${year}-${month}-${day}`;
+			  },
+			getcard(){
+				let data={
+					userId:this.userinfo.userId
+				}
+				this.$u.get("/appVerify/getCouponListByUserId?",data ).then((res) => {
+							
+					if (res.code == 200) {
+						this.CouponLists = res.data
+						
+					} else { 
+						// uni.showToast({
+						// 	title: res.msg,
+						// 	icon: 'none',
+						// 	duration: 2000
+						// });
+					}
+				});
+			}
 		}
 	}
 </script>
diff --git a/page_vip/vip_his.vue b/page_vip/vip_his.vue
index ef1d639..4635643 100644
--- a/page_vip/vip_his.vue
+++ b/page_vip/vip_his.vue
@@ -4,10 +4,10 @@
 			height='45'></u-navbar>
 
 		<view class="cont">
-			<view class="vip_card">
+			<view class="vip_card"  v-for="(item,index) in CouponLists" :key="index">
 				<view class="top">
 					<image src="https://lxnapi.ccttiot.com/bike/img/static/uac2wTu5kmOGPkonvNcl" mode=""></image>
-					月卡会员
+					{{item.couponName}}
 				</view>
 				<view class="bot">
 					<view class="left">
@@ -15,13 +15,13 @@
 					</view>
 					<view class="right">
 						<view class="tit">
-							购买时长:1个月
+							购买时长:{{item.validityValue}}个月
 						</view>
 						<view class="data">
-							有效期:2024-07-29 至 2024-08-29
+							有效期: {{formatDate(item.createTime)}}至  {{formatDate(item.expirationTime)}}
 						</view>
 						<view class="data">
-							支付时间:2024-07-29 13:59
+							支付时间: {{formatDate(item.createTime)}}
 						</view>
 					</view>
 				</view>
@@ -72,9 +72,10 @@
 			  },
 			getcard(){
 				let data={
-					userId:this.userinfo.userId
+					userId:this.userinfo.userId,
+					typeList:'1'
 				}
-				this.$u.get("/appVerify/getCouponListByUserId?",data ).then((res) => {
+				this.$u.get("/appVerify/couponBuyRecord?",data ).then((res) => {
 							
 					if (res.code == 200) {
 						this.CouponLists = res.data
@@ -118,6 +119,7 @@
 				color: #FFFFFF;
 			}
 			.vip_card{
+				margin-top: 20rpx;
 				// margin: 0 auto;
 				width: 680rpx;
 				padding: 16rpx 24rpx;
diff --git a/pages/index/index.vue b/pages/index/index.vue
index ff896a0..4a55e68 100644
--- a/pages/index/index.vue
+++ b/pages/index/index.vue
@@ -112,6 +112,7 @@
 						</view>
 					</view>
 				</view>
+				
 				<view class="bot">
 
 					<view class=" left_btn" @click="Reserve()">
@@ -354,9 +355,42 @@
 					<view class="time">
 						使用时间:{{timeString}}
 					</view>
+					<view class="price_li">
+						<view class="price_left">
+							合计费用 <view class="iconfont icon-xiangxia"></view> <view class="iconfont icon-xiangshang"></view>
+						</view>
+						<view class="price_right">
+							4.00元
+						</view>
+					</view>
+					<view class="price_li1">
+						<view class="price_left1">
+							骑行费
+						</view>
+						<view class="price_right1">
+							4.00元
+						</view>
+					</view>
+					<view class="price_li1">
+						<view class="price_left1">
+							预约费
+						</view>
+						<view class="price_right1">
+							4.00元
+						</view>
+					</view>
+					<view class="price_li">
+						<view class="price_left">
+						骑行卡
+						</view>
+						<view class="price_right" @click="tocard()">
+							去使用>
+						</view>
+					</view>
 					<view class="price">
 						{{orderinfo.totalFee}}<span>元</span>
 					</view>
+					
 					<view class="toinfo" @click="tofeeDetail()">
 						查看骑行费明细 >
 					</view>
@@ -366,6 +400,8 @@
 					<view class="btn" @click="topay1()" v-if="orderinfo.status==3">
 						去支付
 					</view>
+					
+				
 				</view>
 			</view>
 		</view>
@@ -1377,6 +1413,11 @@
 			},
 		},
 		methods: {
+			tocard(){
+				uni.navigateTo({
+					url:'/page_vip/checkCard?orderId='+this.orderinfo.orderNo
+				})
+			},
 			getArea() {
 				// this.showmap = false
 				// 发送请求获取数据
@@ -6559,6 +6600,7 @@
 
 			.page4 {
 				.bot_btn {
+					padding-bottom: 30rpx;
 					padding-top: 20rpx;
 					// margin-top: 20rpx;
 					// padding: 26rpx 34rpx 48rpx 34rpx;
@@ -6567,12 +6609,62 @@
 					// flex-wrap: wrap;
 					// justify-content: center;
 					// bottom: 0;
-					// width: 750rpx;
-					height: 400rpx;
+					width: 750rpx;
+					// height: 400rpx;
 					background: #FFFFFF;
 					// box-shadow: 0rpx 10rpx 64rpx 0rpx rgba(0, 0, 0, 0.08);
 					border-radius: 30rpx;
-
+					.price_li{
+						margin-top: 24rpx;
+						width: 100%;
+						display: flex;
+						flex-wrap: nowrap;
+						justify-content: space-between;
+						align-items: center;
+						padding: 0 60rpx;
+						.price_left{
+							display: flex;
+							flex-wrap: nowrap;
+							align-items: center;
+							font-weight: 500;
+							font-size: 28rpx;
+							color: #3D3D3D;
+							.iconfont{
+								margin-left: 6rpx;
+								font-size: 20rpx;
+								font-weight: 600;
+								color: #3D3D3D;
+							}
+						}
+						.price_right{
+							font-weight: 500;
+							font-size: 28rpx;
+							color: #3D3D3D;
+						}
+					}
+					.price_li1{
+						margin-top: 22rpx;
+						width: 100%;
+						display: flex;
+						flex-wrap: nowrap;
+						justify-content: space-between;
+						align-items: center;
+						padding: 0 60rpx;
+						.price_left1{
+							display: flex;
+							flex-wrap: nowrap;
+							align-items: center;
+							font-weight: 500;
+							font-size: 28rpx;
+							color: #8D8A8A;
+							
+						}
+						.price_right1{
+							font-weight: 500;
+							font-size: 28rpx;
+							color: #8D8A8A;
+						}
+					}
 					.time {
 						// height: 88rpx;
 
@@ -6589,7 +6681,7 @@
 						margin-top: 22rpx;
 						width: 100%;
 						text-align: center;
-						font-weight: 500;
+						font-weight: 600;
 						font-size: 72rpx;
 						color: #3D3D3D;
 
diff --git a/pages/my.vue b/pages/my.vue
index 8b4f26e..98b4ecf 100644
--- a/pages/my.vue
+++ b/pages/my.vue
@@ -230,19 +230,19 @@
 				</view>
 			</view>
 		</view>
-		<view class="vip_box" v-if="info.vipType==0&&false">
+		<view class="vip_box" v-if="info.vipType==0">
 			<view class="txt1">月卡会员</view>
 			<view class="txt2" v-if="CarkTypeList[0].retailPrice"> 仅需¥{{CarkTypeList[0].retailPrice }},可享30天免费骑行权益
 			</view>
 		</view>
-		<view class="vip_box1" v-if="info.vipType==1&&false">
+		<view class="vip_box1" v-if="info.vipType==1">
 			<view class="txt1">月卡会员</view>
 			<view class="txt2"> 月卡会员{{ daysUntilExpiration }}天后到期</view>
 			<view class="btn">
 				立即续费
 			</view>
 		</view>
-		<view class="fee_box" v-if="false">
+		<view class="fee_box">
 			<view class="auto_box">
 				<view class="auto_li" v-for="(item,index) in CouponList" :key="index" @click="tobuy()">
 					<view class="txt1">
@@ -576,7 +576,7 @@
 						this.getCarkType()
 						this.$store.commit('SET_USERID', res.user.userId);
 						this.info = res.user
-						// this.calculateDaysUntilExpiration()
+						this.calculateDaysUntilExpiration()
 						if (info.role != 1) {
 							this.getareaList()
 						}
@@ -739,9 +739,7 @@
 
 			.txt1 {
 				top: 20rpx;
-				left: 17	
-				
-				1rpx;
+				left: 171rpx;
 				position: absolute;
 				font-weight: 500;
 				font-size: 39rpx;