oil-station/gasStation-uni/pagesHome/MyCard/MyCard.vue

349 lines
7.2 KiB
Vue
Raw Normal View History

2023-11-27 09:24:16 +08:00
<template>
<view class="content">
<view class="container">
<view class="my-header">
<view class="my-icons" @click="goback"> <uni-icons type="left" size="16"></uni-icons> </view>
<view class="my-text">卡包</view>
<view class="my-icons"></view>
</view>
<!-- 顶部区域 -->
<!-- 储值卡 -->
2023-12-15 13:48:17 +08:00
<view class="xyihang">
<view class="title-hei">储值卡</view>
</view>
2023-11-27 09:24:16 +08:00
<view class="card-cz">
<view class="card-top">
<view class="cardimg">
<image src="../../static/imgs/jyz.png" mode=""></image>
</view>
2023-12-15 13:48:17 +08:00
<!-- <text>油站名称</text> -->
2023-11-27 09:24:16 +08:00
</view>
<view class="dis-but">
<view class="bai-box">
<view class="">通用余额</view>
2023-12-15 13:48:17 +08:00
<view class=""> <text style="font-weight: bold;font-size: 26px;">{{cardBalance}}</text>
</view>
2023-11-27 09:24:16 +08:00
</view>
2023-12-15 14:00:09 +08:00
<view class="anniu-cz" @click="gocard(0)">
2023-11-27 09:24:16 +08:00
<text>立即充值</text>
</view>
</view>
</view>
<!-- 囤油卡 -->
<view class="xyihang">
<view class="title-hei">囤油卡</view>
2023-12-15 13:48:17 +08:00
<view class="d_dis">
<view class="" @click="s_()">
<text>上一张</text>
<uni-icons type="reload" color="#2979ff" size="20"></uni-icons>
</view>
<view class="" @click="x_()">
<text>下一张</text>
<uni-icons type="refreshempty" color="#2979ff" size="20"></uni-icons>
</view>
2023-11-27 09:24:16 +08:00
</view>
</view>
<view class="card-ty">
<view class="card-top">
<view class="cardimg">
<image src="../../static/imgs/jyzb.png" mode=""></image>
</view>
2023-12-15 13:48:17 +08:00
<!-- <text style="color: #ffffff;">油站名称</text> -->
2023-11-27 09:24:16 +08:00
</view>
<view style="width: 100%;display: flex;align-items: center;justify-content: space-between; ">
<view class="bai-box">
<view class="title-card">囤油卡</view>
2023-12-15 13:48:17 +08:00
<view class="">{{cardsList[cardsIndex].type}}:{{cardsList[cardsIndex].oilType}} </view>
<!-- <view style="lins"> **** **** **** 970 </view> -->
2023-11-27 09:24:16 +08:00
</view>
<view class="">
<uni-icons type="eye-slash-filled" color="#ffffff" size="30"
style="margin-right: 15px;"></uni-icons>
</view>
</view>
2023-12-15 14:00:09 +08:00
<view class="z_yw">
<view class="anniu-cz" @click="gocard(1)">
<text>立即充值</text>
</view>
2023-12-15 13:48:17 +08:00
</view>
2023-12-15 14:00:09 +08:00
2023-11-27 09:24:16 +08:00
</view>
<!-- 礼品卡 -->
<view class="xyihang">
<view class="title-hei">礼品卡</view>
<view class="">
<text>下一张</text>
<uni-icons type="refreshempty" color="#2979ff" size="20"></uni-icons>
</view>
</view>
<view class="card-lp">
<view class="card-top">
<view class="cardimg">
<image src="../../static/imgs/jyzb.png" mode=""></image>
</view>
2023-12-15 13:48:17 +08:00
<!-- <text style="color: #ffffff;">油站名称</text> -->
2023-11-27 09:24:16 +08:00
</view>
<view style="width: 100%;display: flex;align-items: center;justify-content: space-between; ">
<view class="bai-box">
<view class="title-card">礼品卡</view>
2023-12-15 13:48:17 +08:00
<view class="">卡号:454545578545</view>
<view style="lins"> 卡密: **** **** **** 970 </view>
2023-11-27 09:24:16 +08:00
</view>
<view class="">
<uni-icons type="eye-slash-filled" color="#ffffff" size="30"
style="margin-right: 15px;"></uni-icons>
</view>
</view>
2023-12-15 14:00:09 +08:00
<view class="z_yw">
<view class="anniu-cz" @click="gocard(2)">
<text>立即兑换</text>
</view>
2023-12-15 13:48:17 +08:00
</view>
2023-11-27 09:24:16 +08:00
</view>
</view>
</view>
</template>
<script>
2023-12-15 13:48:17 +08:00
import request from "../../utils/request";
2023-11-27 09:24:16 +08:00
export default {
data() {
return {
2023-12-15 13:48:17 +08:00
cardBalance: 0.00,
cardsList: [],
cardsIndex: 0,
2023-11-27 09:24:16 +08:00
title: '',
}
},
components: {
2023-12-15 13:48:17 +08:00
},
onShow() {
this.getCardFuleRecords();
this.getUserBalance()
2023-11-27 09:24:16 +08:00
},
methods: {
2023-12-15 14:00:09 +08:00
gocard(id) {
2023-11-27 09:24:16 +08:00
uni.navigateTo({
2023-12-15 14:00:09 +08:00
url: '/pagesHome/oilRecharge/oilRecharge?id=' + id
2023-11-27 09:24:16 +08:00
})
},
2023-12-15 13:48:17 +08:00
s_() {
if (this.cardsIndex == 0) {
uni.showToast({
title: '没有上一张了',
icon: 'error'
})
return
}
this.cardsIndex--
},
x_() {
if (this.cardsIndex < this.toil) {
this.cardsIndex++
} else {
uni.showToast({
title: '没有下一张了哦',
icon: 'error'
})
}
},
getCardFuleRecords() {
request({
url: 'business/marketingActivity/cardFuelRecord/queryByPageApplet',
method: 'get',
}).then(res => {
console.log(res)
if (res.code == 200) {
this.cardsList = res.data.records
if (this.cardsList.length != 0) {
this.toil = this.cardsList.length - 1
} else {
this.toil = this.cardsList.length
}
console.log(this.toil);
}
})
},
getUserBalance() {
request({
url: '/business/userManager/user/getUserBalance',
method: 'get',
}).then(res => {
console.log(res)
if (res.code == 200) {
this.cardBalance = res.data.cardBalance
}
})
},
2023-11-27 09:24:16 +08:00
goback() {
uni.navigateBack()
}
}
}
</script>
<style scoped lang="scss">
.content {
background: #f4f5f6;
}
.container {
width: 100%;
height: 100vh;
box-sizing: border-box;
padding-top: 88px;
}
.my-header {
width: 100%;
height: 88px;
background: #ffffff;
display: flex;
align-items: center;
justify-content: space-between;
color: #000;
box-sizing: border-box;
padding: 0px 15px;
padding-top: 40px;
.my-icons {
width: 20px;
}
position: fixed;
top: 0px;
}
2023-12-15 13:48:17 +08:00
.d_dis {
display: flex;
align-items: center;
}
2023-11-27 09:24:16 +08:00
.card-cz {
width: 90%;
border-radius: 8px;
background-color: #9ea1ad;
height: 180px;
margin: 10px auto;
background: url('http://47.95.206.185:83/card.png')center no-repeat;
background-size: 100% 100%;
box-sizing: border-box;
padding: 15px;
}
.card-ty {
width: 90%;
border-radius: 8px;
background-color: #9ea1ad;
height: 180px;
margin: 10px auto;
background: url('http://47.95.206.185:83/dhq.png')center no-repeat;
background-size: 100% 100%;
box-sizing: border-box;
padding: 15px;
}
.card-lp {
width: 90%;
border-radius: 8px;
background-color: #9ea1ad;
height: 180px;
margin: 10px auto;
background: url('http://47.95.206.185:83/lpk.png')center no-repeat;
background-size: 100% 100%;
box-sizing: border-box;
padding: 15px;
}
.dis-but {
width: 100%;
display: flex;
align-items: center;
justify-content: space-between;
margin-top: 40px;
}
.anniu-cz {
width: 100px;
height: 30px;
border-radius: 50px;
background-color: white;
display: flex;
align-items: center;
justify-content: center;
}
.bai-box {
color: white;
}
.card-top {
margin-bottom: 20px;
display: flex;
align-items: center;
}
.cardimg {
width: 18px;
height: 18px;
// background: linear-gradient(90deg, #FFD57C 0%, #F8A82F 100%);
background: #3d4141;
border-radius: 6px 1px 6px 1px;
margin-right: 5px;
display: flex;
align-items: center;
justify-content: center;
image {
width: 50%;
height: 50%;
}
}
.title-card {
font-size: 20px;
font-weight: bold;
color: #FFFFFF;
margin-bottom: 15px;
}
.xyihang {
width: 90%;
margin: 0 auto;
display: flex;
align-items: center;
justify-content: space-between;
font-size: 16px;
color: #2979ff;
}
.title-hei {
font-size: 16px;
font-weight: bold;
color: #000;
}
2023-12-15 14:00:09 +08:00
.z_yw {
width: 100%;
margin: 5px auto;
display: flex;
align-items: center;
justify-content: flex-end;
}
2023-11-27 09:24:16 +08:00
</style>