oil-station/gasStation-uni/pagesHome/MyCard/MyCard.vue
2024-10-09 17:48:51 +08:00

392 lines
7.5 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<view class="content">
<view class="card_" @click="goDetails('balance')">
<view class="top_card">
<view class="">储值卡</view>
<view class="" @click="goCode()">
<image src="../../static/new/rwm.png" style="width: 25px; height: 25px; "></image>
</view>
</view>
<view class="card-b">
储值卡余额
</view>
<view class="card-num">
¥{{cardBalance.cardBalance || 0}}
</view>
<!-- <view class="r-box">
NO.xxxxxxxxxxxxxxxxxx
</view> -->
</view>
<view class="card_1" @click="goDetails('oilCard')" v-for="(item,index) in cardsList" :key="index">
<view class="top_card">
<view class="">囤油卡</view>
<view style="display: flex;" @click="goCode()">
<view style="margin-right: 5px;">{{item.oilName}} 7.28/L</view>
<image src="../../static/new/rwm.png" style="width: 25px; height: 25px; "></image>
</view>
</view>
<view class="card-b">
剩余油量
</view>
<view class="card-num">
{{item.fuelAmount}}L
</view>
<!-- <view class="r-box">
NO.xxxxxxxxxxxxxxxxxx
</view> -->
</view>
<view class="card_2">
<view class="top_card">
<view class="">礼品卡</view>
<view class="" @click="goGiftDetails()">
兑换记录
</view>
</view>
<view class="card-b">
已兑换{{cardBalance.giftCardCount || 0}}
</view>
<view class="card-b">
累计兑换金额{{cardBalance.giftCardAmount || 0}}
</view>
<!-- <view class="r-box">
NO.xxxxxxxxxxxxxxxxxx
</view> -->
</view>
<view v-if="fleetList.length>0">
<view class="card_" v-for="(item,index) in fleetList" :key="index" @click="goDetails('fleet',item.id)">
<view class="top_card">
<view class="">{{item.fleetName}}</view>
<view class="" @click="goCode()">
<image src="../../static/new/rwm.png" style="width: 25px; height: 25px; "></image>
</view>
</view>
<view class="card-b">
当前余额
</view>
<view class="card-num">
¥{{item.totalBalance || 0}}
</view>
</view>
</view>
</view>
</template>
<script>
import request from "../../utils/request";
export default {
data() {
return {
query: {
chainStoreId: '',
couponType: '',
useStatus: 0,
pageNo: 1,
pageSize: 10
},
cardBalance: 0.00,
cardsList: [],
cardsIndex: 0,
title: '',
giftInfo: {},
fleetList: []
}
},
components: {
},
onShow() {
this.query.chainStoreId = uni.getStorageSync('chainStoreId');
this.getUserBalance()
this.getFleetInfo()
},
methods: {
getFleetInfo() {
request({
url: '/fleetInfo/getFleetInfoByStoreId',
method: 'get',
params: {
storeId: uni.getStorageSync('storeId')
}
}).then(res => {
if (res.code == 200) {
this.fleetList = res.data
console.log(this.fleetList, '111');
}
})
},
goGiftDetails() {
uni.navigateTo({
url: '/pagesHome/RechargeRecords/RechargeRecords'
})
},
goCode() {
uni.navigateTo({
url: '/pagesHome/QRcode/QRcode'
})
},
goDetails(val, fleetId) {
if (fleetId) {
uni.navigateTo({
url: '/pagesHome/cardDetails/index?type=' + val + '&fleetId=' + fleetId
})
return
}
uni.navigateTo({
url: '/pagesHome/cardDetails/index?type=' + val
})
},
getCardFuleRecords() {
request({
url: 'business/marketingActivity/cardFuelRecord/queryByPageApplet',
method: 'get',
}).then(res => {
if (res.code == 200) {
this.cardsList = res.data.records
}
})
},
getUserBalance() {
request({
url: '/business/userManager/user/getUserBalanceApplet',
method: 'get',
params: this.query
}).then(res => {
if (res.code == 200) {
this.cardBalance = res.data
console.log(res, 163);
this.cardsList = res.data.userFuel
}
})
},
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'
})
}
},
goback() {
uni.navigateBack()
}
}
}
</script>
<style scoped lang="scss">
.content {
background: #f4f5f6;
height: 100vh;
box-sizing: border-box;
padding-top: 1px;
}
.d_dis {
display: flex;
align-items: center;
}
.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;
}
.z_yw {
width: 100%;
margin: 5px auto;
display: flex;
align-items: center;
justify-content: flex-end;
}
.card_ {
width: 95%;
margin: 15px auto;
height: 135px;
background: url('../../static/new/czk.png') no-repeat;
background-size: 100% 100%;
box-sizing: border-box;
padding: 10px;
color: #fff;
}
.top_card {
width: 100%;
display: flex;
align-items: center;
justify-content: space-between;
font-size: 16px;
margin-bottom: 15px;
}
.card-b {
font-size: 14px;
color: #FFFFFF;
margin-bottom: 5px;
}
.card_1 {
width: 95%;
margin: 15px auto;
height: 135px;
background: url('../../static/new/tyk.png') no-repeat;
background-size: 100% 100%;
box-sizing: border-box;
padding: 10px;
color: #fff;
}
.card_2 {
width: 95%;
margin: 15px auto;
height: 135px;
background: url('../../static/new/lpk.png') no-repeat;
background-size: 100% 100%;
box-sizing: border-box;
padding: 10px;
color: #fff;
}
.card_1 {
width: 95%;
margin: 15px auto;
height: 135px;
background: url('http://47.94.122.58:83/oilBg.png') no-repeat;
background-size: 100% 100%;
box-sizing: border-box;
padding: 10px;
color: #fff;
}
.card-num {
font-size: 20px;
color: #FFFFFF;
}
.r-box {
width: 100%;
text-align: right;
}
</style>