diff --git a/page_vip/buyCard.vue b/page_vip/buyCard.vue index 4dc2d21..6893c2e 100644 --- a/page_vip/buyCard.vue +++ b/page_vip/buyCard.vue @@ -16,27 +16,27 @@ - 电单车15天5次卡 + {{item.name}} - 5.25 + {{item.retailPrice}} - - 电单车15天5次卡 + + {{item.descr}} - 5.25元 + {{item.originalPrice}}元 - 低至1.05元/次 + 低至{{ (item.retailPrice / item.limitNum).toFixed(2) }}元/次 - 已优惠 9.75元 + 已优惠 {{(item.originalPrice - item.retailPrice).toFixed(2)}} @@ -46,36 +46,36 @@ - - - 电单车15天5次卡 + + + {{item.name}} + + + {{item.retailPrice}} + + + + + {{item.descr}} + + + {{item.originalPrice}}元 + + + + + + 低至{{ (item.retailPrice / item.limitNum).toFixed(2) }}元/次 - - 5.25 + + 已优惠 {{(item.originalPrice - item.retailPrice).toFixed(2)}} - - - 电单车15天5次卡 - - - 5.25元 - - - - - - 低至1.05元/次 - - - 已优惠 9.75元 - - - - 购买 - + + 购买 + @@ -83,26 +83,26 @@ - 电单车15天5次卡 + {{buyinfo.name}} - 5.25 + {{buyinfo.retailPrice}} - 每单最高抵3元 + {{buyinfo.descr}} - 低至1.05元/次 + 低至{{ (buyinfo.retailPrice / buyinfo.limitNum).toFixed(2) }}元/次 - 每次骑行最高可抵扣 3元 + {{buyinfo.descr}} 只能用于抵扣骑行费用,不能抵扣调度费、预约费等费 @@ -119,7 +119,7 @@ 取消 - + 立即支付 @@ -138,13 +138,72 @@ istrue: false, show:false, CouponList:[], - buyinfo:[] + buyinfo:{}, + userinfo:{} } }, onShow() { this.getCouponList() + this.getinfo() }, methods: { + 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 + + } else { + + } + }); + }, + buy(){ + + let data={ + userId:this.userinfo.userId, + couponId:this.buyinfo.couponId + } + let that=this + that.$u.get("/appVerify/coupon/buy?",data ).then((res) => { + + if (res.code == 200) { + uni.requestPayment({ + provider: 'wxpay', + timeStamp: res.data.timeStamp, + nonceStr: res.data.nonceStr, + package: res.data.packageVal, + signType: res.data.signType, + paySign: res.data.paySign, + success(res) { + // 支付成功逻辑 + that.show=false + that.getinfo() + }, + fail(err) { + // 支付失败逻辑 + uni.showToast({ + title: '支付失败', + icon: 'none', + duration: 2000 + }); + } + }); + + } else { + // uni.showToast({ + // title: res.msg, + // icon: 'none', + // duration: 2000 + // }); + } + }); + }, buycard(item){ this.buyinfo=item this.show=true diff --git a/page_vip/myVip_index.vue b/page_vip/myVip_index.vue index c8c3b87..6eb0bb7 100644 --- a/page_vip/myVip_index.vue +++ b/page_vip/myVip_index.vue @@ -48,12 +48,48 @@ backgroundColor: '#fff' }, sn: '', - istrue: false + istrue: false, + CouponLists:[] } }, - + onShow() { + this.getinfo() + }, methods: { - + 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 { + + } + }); + }, + 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 + // }); + } + }); + } } } diff --git a/page_vip/vip_index.vue b/page_vip/vip_index.vue index 53e09ae..cca9e8d 100644 --- a/page_vip/vip_index.vue +++ b/page_vip/vip_index.vue @@ -12,14 +12,20 @@ 17795402553 - + 未开通 + + 已开通 + - + 开通立享超值会员特权 + + 月卡会员{{ daysUntilExpiration }}天后到期 + 购买记录 > @@ -28,7 +34,7 @@ - + {{item.name}} @@ -36,22 +42,41 @@ ¥ {{item.retailPrice}} - ¥59.9 + ¥{{item.originalPrice}} - 立省¥20 + 立省¥{{ (item.originalPrice - item.retailPrice).toFixed(2) }} 该卡只能用于抵扣骑行费用,不能抵扣调度费、预约费等费用。 如您产生调度费、预约费等费用,需另支付差额。 - - ¥39.9立即开通 + + ¥{{chooseInfo.retailPrice}}立即开通 更多优惠 + + + + + {{item.name}} + + + {{item.retailPrice}}元 + + + {{item.desc}} + + + + 购买 + + + + @@ -66,14 +91,99 @@ sn: '', istrue: false, CouponList:[], - userinfo:{} + CouponLists:[], + userinfo:{}, + chooseInfo:{}, + chooseidx:0, + daysUntilExpiration: 0 // 剩余天数 } }, onShow() { this.getCouponList() this.getinfo() + this.getCouponLists() }, methods: { + calculateDaysUntilExpiration() { + const currentDate = new Date(); + const expirationDate = new Date(this.userinfo.expirationTime); + + // 计算时间差(毫秒) + const timeDifference = expirationDate - currentDate; + + // 将毫秒转换为天 + this.daysUntilExpiration = Math.ceil(timeDifference / (1000 * 60 * 60 * 24)); + }, + tobuy(){ + uni.navigateTo({ + url:'/page_vip/buyCard' + }) + }, + choose(itm,idx){ + this.chooseInfo=itm + this.chooseidx=idx + }, + buy(){ + + let data={ + userId:this.userinfo.userId, + couponId:this.chooseInfo.couponId + } + let that=this + that.$u.get("/appVerify/coupon/buy?",data ).then((res) => { + + if (res.code == 200) { + uni.requestPayment({ + provider: 'wxpay', + timeStamp: res.data.timeStamp, + nonceStr: res.data.nonceStr, + package: res.data.packageVal, + signType: res.data.signType, + paySign: res.data.paySign, + success(res) { + // 支付成功逻辑 + setTimeout(()=>{ + that.getinfo() + },500) + + }, + fail(err) { + // 支付失败逻辑 + uni.showToast({ + title: '支付失败', + icon: 'none', + duration: 2000 + }); + } + }); + + } else { + // uni.showToast({ + // title: res.msg, + // icon: 'none', + // duration: 2000 + // }); + } + }); + }, + getCouponLists(){ + let data={ + type:'3,4' + } + this.$u.get("/app/couponList",data ).then((res) => { + + if (res.code == 200) { + this.CouponLists = res.data + + } else { + // uni.showToast({ + // title: res.msg, + // icon: 'none', + // duration: 2000 + // }); + } + }); + }, getinfo() { // uni.showLoading({ // title:'加载中' @@ -84,7 +194,7 @@ this.$store.commit('SET_USERID', res.user.userId); this.userinfo = res.user - + this.calculateDaysUntilExpiration() } else { } @@ -98,7 +208,7 @@ if (res.code == 200) { this.CouponList = res.data - + this.chooseInfo=this.CouponList[0] } else { // uni.showToast({ // title: res.msg, @@ -119,7 +229,68 @@ .page { width: 750rpx; - + .fee_box { + margin-top: 18rpx; + position: relative; + margin-left: 38rpx; + width: 680rpx; + height: 288rpx; + background-image: url('https://lxnapi.ccttiot.com/bike/img/static/ugciMYClSGgJxP8HYoRU'); + background-size: cover; + background-position: center; + background-repeat: no-repeat; + .auto_box::-webkit-scrollbar { + display: none; + } + .auto_box { + padding-left: 24rpx; + display: flex; + overflow-x: auto; /* 允许横向滚动 */ + flex-wrap: nowrap; /* 禁止换行,保持所有元素在一行 */ + position: absolute; + top: 90rpx; + width: 100%; /* 根据需要调整宽度 */ + height: auto; /* 根据内容自动调整高度 */ + + .auto_li { + position: relative; + padding: 24rpx 28rpx; + margin-right: 22rpx; + width: 408rpx; + height: 176rpx; + flex-shrink: 0; /* 防止子元素被压缩 */ + background-image: url('https://lxnapi.ccttiot.com/bike/img/static/ui88NWy9R1j2zFGojdHU'); + background-size: cover; + background-position: center; + .txt1{ + width: 100%; + font-weight: 600; + font-size: 32rpx; + color: #495E74; + } + .txt2{ + font-weight: 400; + font-size: 24rpx; + color: #495E74; + } + .buy_btn{ + position: absolute; + right: 26rpx; + bottom: 38rpx; + display: flex; + align-items: center; + justify-content: center; + width: 132rpx; + height: 50rpx; + background: #495E74; + border-radius: 25rpx 25rpx 25rpx 25rpx; + font-weight: 500; + font-size: 28rpx; + color: #FFF3DB; + } + } + } + } .fixed { z-index: 999; position: fixed; @@ -231,7 +402,9 @@ scrollbar-width: none; // 针对 Firefox -ms-overflow-style: none; // 针对 Internet Explorer 和 Edge - + .act1{ + background: #FFFBF1; + } .cont_li { width: 218rpx; height: 256rpx; diff --git a/pages/my.vue b/pages/my.vue index cfbec8b..76062f9 100644 --- a/pages/my.vue +++ b/pages/my.vue @@ -222,7 +222,7 @@ 月卡会员 - {{CarkTypeList[0].desc}} + 仅需¥{{CarkTypeList[0].retailPrice }},可享30天免费骑行权益 @@ -385,7 +385,7 @@ }, getCarkType(){ let data={ - type:'3,4' + type:'1' } this.$u.get("/app/couponList",data ).then((res) => {