vip修改

This commit is contained in:
tx 2024-09-04 18:09:51 +08:00
parent 5fea21303e
commit 5e37093e15
4 changed files with 324 additions and 56 deletions

View File

@ -16,27 +16,27 @@
<view class="card3" style="margin-top: 85rpx;" > <view class="card3" style="margin-top: 85rpx;" >
<view class="top"> <view class="top">
<view class="tit1"> <view class="tit1">
电单车15天5次卡 {{item.name}}
</view> </view>
<view class="tit2"> <view class="tit2">
5.25 <span style="font-size: 28rpx;"></span> {{item.retailPrice}}<span style="font-size: 28rpx;"></span>
</view> </view>
</view> </view>
<view class="middle"> <view class="middle">
<view class="tit3"> <view class="tit3" >
电单车15天5次卡 {{item.descr}}
</view> </view>
<view class="tit4"> <view class="tit4">
5.25 {{item.originalPrice}}
</view> </view>
</view> </view>
<view class="bot"> <view class="bot">
<view class="bot_left"> <view class="bot_left">
<view class="txt3"> <view class="txt3">
低至1.05/ 低至{{ (item.retailPrice / item.limitNum).toFixed(2) }}/
</view> </view>
<view class="txt4"> <view class="txt4">
已优惠 <span style="color: red;">9.75</span> 已优惠 <span style="color: red;">{{(item.originalPrice - item.retailPrice).toFixed(2)}}</span>
</view> </view>
</view> </view>
<view class="btn" @click="buycard(item)"> <view class="btn" @click="buycard(item)">
@ -46,36 +46,36 @@
</view> </view>
</view> </view>
<view class="card3" v-for="(item,index) in CouponList" :key="index" v-show="item.isHot==false"> <view class="card3" v-for="(item,index) in CouponList" :key="index" v-show="item.isHot==false">
<view class="top"> <view class="top">
<view class="tit1"> <view class="tit1">
电单车15天5次卡 {{item.name}}
</view>
<view class="tit2">
{{item.retailPrice}}<span style="font-size: 28rpx;"></span>
</view>
</view>
<view class="middle">
<view class="tit3" >
{{item.descr}}
</view>
<view class="tit4">
{{item.originalPrice}}
</view>
</view>
<view class="bot">
<view class="bot_left">
<view class="txt3">
低至{{ (item.retailPrice / item.limitNum).toFixed(2) }}/
</view> </view>
<view class="tit2"> <view class="txt4">
5.25<span style="font-size: 28rpx;"></span> 已优惠 <span style="color: red;">{{(item.originalPrice - item.retailPrice).toFixed(2)}}</span>
</view> </view>
</view> </view>
<view class="middle"> <view class="btn" @click="buycard(item)">
<view class="tit3"> 购买
电单车15天5次卡
</view>
<view class="tit4">
5.25
</view>
</view>
<view class="bot">
<view class="bot_left">
<view class="txt3">
低至1.05/
</view>
<view class="txt4">
已优惠 <span style="color: red;">9.75</span>
</view>
</view>
<view class="btn" @click="buycard(item)">
购买
</view>
</view> </view>
</view> </view>
</view>
</view> </view>
<u-mask :show="show" :z-index='100' /> <u-mask :show="show" :z-index='100' />
@ -83,26 +83,26 @@
<view class="taocan"> <view class="taocan">
<view class="top"> <view class="top">
<view class="tit1"> <view class="tit1">
电单车15天5次卡 {{buyinfo.name}}
</view> </view>
<view class="tit2"> <view class="tit2">
5.25<span style="font-size: 28rpx;"></span> {{buyinfo.retailPrice}}<span style="font-size: 28rpx;"></span>
</view> </view>
</view> </view>
<view class="bot"> <view class="bot">
<view class="bot_left"> <view class="bot_left">
<view class="txt4"> <view class="txt4">
每单最高抵3元 {{buyinfo.descr}}
</view> </view>
<view class="txt3"> <view class="txt3">
低至1.05/ 低至{{ (buyinfo.retailPrice / buyinfo.limitNum).toFixed(2) }}/
</view> </view>
</view> </view>
</view> </view>
</view> </view>
<view class="tit_txt"> <view class="tit_txt">
每次骑行最高可抵扣 <span>3</span> {{buyinfo.descr}}
</view> </view>
<view class="text"> <view class="text">
只能用于抵扣骑行费用不能抵扣调度费预约费等费 只能用于抵扣骑行费用不能抵扣调度费预约费等费
@ -119,7 +119,7 @@
<view class="btn1" @click="show=false"> <view class="btn1" @click="show=false">
取消 取消
</view> </view>
<view class="btn2"> <view class="btn2" @click="buy()">
立即支付 立即支付
</view> </view>
</view> </view>
@ -138,13 +138,72 @@
istrue: false, istrue: false,
show:false, show:false,
CouponList:[], CouponList:[],
buyinfo:[] buyinfo:{},
userinfo:{}
} }
}, },
onShow() { onShow() {
this.getCouponList() this.getCouponList()
this.getinfo()
}, },
methods: { 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){ buycard(item){
this.buyinfo=item this.buyinfo=item
this.show=true this.show=true

View File

@ -48,12 +48,48 @@
backgroundColor: '#fff' backgroundColor: '#fff'
}, },
sn: '', sn: '',
istrue: false istrue: false,
CouponLists:[]
} }
}, },
onShow() {
this.getinfo()
},
methods: { 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
// });
}
});
}
} }
} }
</script> </script>

View File

@ -12,14 +12,20 @@
<view class="name"> <view class="name">
17795402553 17795402553
</view> </view>
<view class="type"> <view class="type" v-if="userinfo.vipType==0">
未开通 未开通
</view> </view>
<view class="type" v-if="userinfo.vipType==1">
已开通
</view>
</view> </view>
<view class="card_bot"> <view class="card_bot">
<view class="txts"> <view class="txts" v-if="userinfo.vipType==0">
开通立享超值会员特权 开通立享超值会员特权
</view> </view>
<view class="txts" v-if="userinfo.vipType==1&&userinfo">
月卡会员{{ daysUntilExpiration }}天后到期
</view>
<view class="topage"> <view class="topage">
购买记录 > 购买记录 >
</view> </view>
@ -28,7 +34,7 @@
<image class="mc" src="https://lxnapi.ccttiot.com/bike/img/static/uCIpavkHbM18al7gpxH8" mode=""></image> <image class="mc" src="https://lxnapi.ccttiot.com/bike/img/static/uCIpavkHbM18al7gpxH8" mode=""></image>
<view class="cont_box"> <view class="cont_box">
<view class="cont_li" v-for="(item,index) in CouponList" :key="index"> <view class="cont_li" v-for="(item,index) in CouponList" :key="index" @click="choose(item,index)" :class="chooseidx==index?'act1':''">
<view class="tit"> <view class="tit">
{{item.name}} {{item.name}}
</view> </view>
@ -36,22 +42,41 @@
{{item.retailPrice}} {{item.retailPrice}}
</view> </view>
<view class="tips" style="text-decoration: line-through; "> <view class="tips" style="text-decoration: line-through; ">
59.9 {{item.originalPrice}}
</view> </view>
<view class="tips"> <view class="tips">
立省20 立省{{ (item.originalPrice - item.retailPrice).toFixed(2) }}
</view> </view>
</view> </view>
</view> </view>
<view class="txt"> <view class="txt">
该卡只能用于抵扣骑行费用不能抵扣调度费预约费等费用 如您产生调度费预约费等费用需另支付差额 该卡只能用于抵扣骑行费用不能抵扣调度费预约费等费用 如您产生调度费预约费等费用需另支付差额
</view> </view>
<view class="pay_btn"> <view class="pay_btn" @click="buy()">
39.9立即开通 {{chooseInfo.retailPrice}}立即开通
</view> </view>
<view class="tipss"> <view class="tipss">
更多优惠 更多优惠
</view> </view>
<view class="fee_box">
<view class="auto_box">
<view class="auto_li" v-for="(item,index) in CouponLists" :key="index" @click="tobuy">
<view class="txt1">
{{item.name}}
</view>
<view class="txt1">
{{item.retailPrice}}
</view>
<view class="txt2" v-if="item.desc">
{{item.desc}}
<!-- 每单最高抵3元 -->
</view>
<view class="buy_btn">
购买
</view>
</view>
</view>
</view>
</view> </view>
</template> </template>
@ -66,14 +91,99 @@
sn: '', sn: '',
istrue: false, istrue: false,
CouponList:[], CouponList:[],
userinfo:{} CouponLists:[],
userinfo:{},
chooseInfo:{},
chooseidx:0,
daysUntilExpiration: 0 //
} }
}, },
onShow() { onShow() {
this.getCouponList() this.getCouponList()
this.getinfo() this.getinfo()
this.getCouponLists()
}, },
methods: { 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() { getinfo() {
// uni.showLoading({ // uni.showLoading({
// title:'' // title:''
@ -84,7 +194,7 @@
this.$store.commit('SET_USERID', res.user.userId); this.$store.commit('SET_USERID', res.user.userId);
this.userinfo = res.user this.userinfo = res.user
this.calculateDaysUntilExpiration()
} else { } else {
} }
@ -98,7 +208,7 @@
if (res.code == 200) { if (res.code == 200) {
this.CouponList = res.data this.CouponList = res.data
this.chooseInfo=this.CouponList[0]
} else { } else {
// uni.showToast({ // uni.showToast({
// title: res.msg, // title: res.msg,
@ -119,7 +229,68 @@
.page { .page {
width: 750rpx; 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 { .fixed {
z-index: 999; z-index: 999;
position: fixed; position: fixed;
@ -231,7 +402,9 @@
scrollbar-width: none; // Firefox scrollbar-width: none; // Firefox
-ms-overflow-style: none; // Internet Explorer Edge -ms-overflow-style: none; // Internet Explorer Edge
.act1{
background: #FFFBF1;
}
.cont_li { .cont_li {
width: 218rpx; width: 218rpx;
height: 256rpx; height: 256rpx;

View File

@ -222,7 +222,7 @@
</view> </view>
<view class="vip_box"> <view class="vip_box">
<view class="txt1">月卡会员</view> <view class="txt1">月卡会员</view>
<view class="txt2" v-if="CarkTypeList[0].desc">{{CarkTypeList[0].desc}}</view> <view class="txt2" v-if="CarkTypeList[0].retailPrice"> 仅需{{CarkTypeList[0].retailPrice }}可享30天免费骑行权益</view>
</view> </view>
<view class="fee_box"> <view class="fee_box">
<view class="auto_box"> <view class="auto_box">
@ -385,7 +385,7 @@
}, },
getCarkType(){ getCarkType(){
let data={ let data={
type:'3,4' type:'1'
} }
this.$u.get("/app/couponList",data ).then((res) => { this.$u.get("/app/couponList",data ).then((res) => {