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

361 lines
7.6 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>
2024-01-02 12:45:39 +08:00
<view class=""> <text style="font-weight: bold;font-size: 26px;">{{cardBalance || '0'}}</text>
2023-12-15 13:48:17 +08:00
</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>
2024-01-04 15:01:20 +08:00
<view class="">{{cardsList[cardsIndex].type || '暂无囤油'}}:{{cardsList[cardsIndex].oilName || '0'}}
2023-12-25 14:41:17 +08:00
</view>
2024-01-05 15:12:40 +08:00
<view>剩余油量{{cardsList[cardsIndex].incomeLitres || '0'}}L</view>
2023-12-15 13:48:17 +08:00
<!-- <view style="lins"> **** **** **** 970 </view> -->
2023-11-27 09:24:16 +08:00
</view>
2024-01-02 12:45:39 +08:00
<!-- <view class="">
2023-11-27 09:24:16 +08:00
<uni-icons type="eye-slash-filled" color="#ffffff" size="30"
style="margin-right: 15px;"></uni-icons>
2024-01-02 12:45:39 +08:00
</view> -->
2023-11-27 09:24:16 +08:00
</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>
2024-01-03 10:54:36 +08:00
<!-- <view class="">
2023-11-27 09:24:16 +08:00
<text>下一张</text>
<uni-icons type="refreshempty" color="#2979ff" size="20"></uni-icons>
2024-01-03 10:54:36 +08:00
</view> -->
2023-11-27 09:24:16 +08:00
</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>
2024-01-03 10:54:36 +08:00
<view class="">卡号: **** **** **** ****</view>
2024-01-02 12:45:39 +08:00
<view style="lins"> 卡密: **** **** **** **** </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 {
2024-01-03 13:39:21 +08:00
query: {
2024-01-04 15:01:20 +08:00
chainStoreId: '',
2024-01-03 13:39:21 +08:00
couponType: '',
useStatus: 0,
pageNo: 1,
pageSize: 10
},
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() {
2024-01-04 15:01:20 +08:00
this.query.chainStoreId = uni.getStorageSync('chainStoreId');
// this.getCardFuleRecords();
2023-12-15 13:48:17 +08:00
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
console.log(this.toil);
}
})
},
getUserBalance() {
2024-01-15 11:39:48 +08:00
this.cardsList = []
2023-12-15 13:48:17 +08:00
request({
2024-01-03 13:39:21 +08:00
url: '/business/userManager/user/getUserBalanceApplet',
2023-12-15 13:48:17 +08:00
method: 'get',
2024-01-03 13:39:21 +08:00
params: this.query
2023-12-15 13:48:17 +08:00
}).then(res => {
console.log(res)
if (res.code == 200) {
this.cardBalance = res.data.cardBalance
2024-01-04 15:01:20 +08:00
this.cardsList = JSON.parse(res.data.refuelMoney)
if (this.cardsList.length != 0) {
this.toil = this.cardsList.length - 1
} else {
this.toil = this.cardsList.length
}
2023-12-15 13:48:17 +08:00
}
})
},
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>