oil-station/gasStation-uni/pagesHome/cardDetails/detailed.vue

340 lines
8.2 KiB
Vue
Raw Normal View History

2024-09-18 10:29:23 +08:00
<template>
<view class="centenr">
2024-09-18 14:13:55 +08:00
<view class="Candywrapper">
2024-09-21 17:35:37 +08:00
<view class="card_box" v-if="type=='balance'">
2024-09-18 14:13:55 +08:00
<view class="r-size">储值卡</view>
<view style="margin-bottom: 10px;">当前余额</view>
2024-09-20 09:07:19 +08:00
<view class="r-num">{{cardBalance.cardBalance || 0}}</view>
2024-09-18 14:13:55 +08:00
</view>
2024-09-21 17:35:37 +08:00
<view class="card_box" v-if="type=='oilCard'">
<view class="r-size">囤油卡</view>
<view style="margin-bottom: 10px;">剩余升数L</view>
<view class="r-num">{{cardBalance.cardBalance || 0}}</view>
</view>
2024-09-18 14:13:55 +08:00
<view class="tab-bs">
<view class="w_box" @click="show1 = true">类型筛选 <u-icon name="arrow-down-fill"></u-icon> </view>
<view class="w_box" @click="show = true">全部时间 <u-icon name="arrow-down-fill"></u-icon> </view>
</view>
2024-09-21 17:35:37 +08:00
<!-- 储值卡 -->
<view v-if="type=='balance'">
<view class="bai_box" v-for="(item,index) in orderList" :key="index">
<view class="left-img">
<image src="../../static/icon/hyxf.png" mode="" v-if="item.changeType==0"></image>
<image src="../../static/icon/hycz.png" mode="" v-if="item.changeType==1"></image>
2024-09-18 14:13:55 +08:00
</view>
2024-09-21 17:35:37 +08:00
<view style="width: 85%;">
<view class="right-box">
<view class="l-text" v-if="item.changeType==0">会员消费</view>
<view class="l-text" v-if="item.changeType==1">会员充值</view>
<view class="r-text">{{item.giveBalance ? (item.balance + item.giveBalance) : item.balance}}
</view>
</view>
<view class="right-box">
<view class="">储值卡</view>
<view class="">余额{{item.afterTheChange || 0}}</view>
</view>
<view class="right-box">
<view class="">{{item.storeName}}</view>
<view class="">{{item.createTime}}</view>
</view>
2024-09-18 14:13:55 +08:00
</view>
</view>
2024-09-21 17:35:37 +08:00
<view v-if="!orderList || orderList.length==0">
<u-empty mode="list" icon="http://cdn.uviewui.com/uview/empty/list.png">
</u-empty>
2024-09-18 14:13:55 +08:00
</view>
2024-09-21 17:35:37 +08:00
</view>
<!-- 囤油卡 -->
<view v-if="type=='oilCard'">
<view class="bai_box" v-for="(item,index) in oilCardList" :key="index">
<view class="left-img">
<image src="../../static/icon/hyxf.png" mode="" v-if="item.changeType==0"></image>
<image src="../../static/icon/hycz.png" mode="" v-if="item.changeType==1"></image>
2024-09-18 14:13:55 +08:00
</view>
2024-09-21 17:35:37 +08:00
<view style="width: 85%;">
<view class="right-box">
<view class="l-text" v-if="item.changeType==0">会员消费</view>
<view class="l-text" v-if="item.changeType==1">会员充值</view>
<view class="r-text">{{item.balance || 0}}
</view>
</view>
<view class="right-box">
<view class="">囤油卡</view>
<view class="">余额{{item.afterTheChange || 0}}</view>
</view>
<view class="right-box">
<view class="">{{item.storeName}}</view>
<view class="">{{item.createTime}}</view>
</view>
2024-09-18 14:13:55 +08:00
</view>
</view>
2024-09-21 17:35:37 +08:00
<view v-if="!oilCardList || oilCardList.length==0">
<u-empty mode="list" icon="http://cdn.uviewui.com/uview/empty/list.png">
</u-empty>
</view>
</view>
2024-09-21 15:55:14 +08:00
<u-datetime-picker :show="show" v-model="value1" mode="year-month" @cancel="cancel1"
2024-09-20 09:07:19 +08:00
@confirm="confirm1"></u-datetime-picker>
<u-picker :show="show1" :columns="columns" @cancel="cancel" @confirm="confirm"></u-picker>
2024-09-18 14:13:55 +08:00
</view>
2024-09-18 10:29:23 +08:00
</view>
</template>
<script>
2024-09-20 09:07:19 +08:00
import request from "../../utils/request";
2024-09-18 14:13:55 +08:00
export default {
data() {
return {
2024-09-21 17:35:37 +08:00
type: "balance",
2024-09-20 09:07:19 +08:00
query: {
chainStoreId: '',
couponType: '',
useStatus: 0,
pageNo: 1,
pageSize: 10
},
cardBalance: {},
2024-09-18 14:13:55 +08:00
show: false,
show1: false,
value1: Number(new Date()),
columns: [
2024-09-20 09:07:19 +08:00
['全部类型', '消费有礼', '会员充值']
2024-09-18 14:13:55 +08:00
],
2024-09-20 09:07:19 +08:00
queryParams: {
2024-09-21 15:55:14 +08:00
pageNo: 1,
2024-09-20 09:07:19 +08:00
pageSize: 30,
storeId: uni.getStorageSync('storeId'),
changeType: '',
2024-09-21 17:35:37 +08:00
startTime: '',
createTime: ''
2024-09-20 09:07:19 +08:00
},
orderList: [],
2024-09-21 17:35:37 +08:00
total: 0,
oilCardList: []
}
},
onLoad(e) {
this.type = e.type
if (this.type == 'oilCard') {
this.getOilCardList()
} else {
this.getOrderList()
2024-09-20 09:07:19 +08:00
}
},
onShow() {
this.query.chainStoreId = uni.getStorageSync('chainStoreId');
this.getUserBalance()
},
onPullDownRefresh() {
console.log("刷新");
this.orderList = []
2024-09-21 17:35:37 +08:00
this.oilCardList = []
2024-09-20 09:07:19 +08:00
this.queryParams = {
2024-09-21 15:55:14 +08:00
pageNo: 1,
2024-09-20 09:07:19 +08:00
pageSize: 30,
storeId: uni.getStorageSync('storeId'),
changeType: '',
2024-09-21 17:35:37 +08:00
startTime: '',
createTime: ''
}
if (this.type == 'oilCard') {
this.getOilCardList()
} else {
this.getOrderList()
2024-09-20 09:07:19 +08:00
}
},
onReachBottom() {
// 触底加载
2024-09-21 17:35:37 +08:00
if (this.type == 'oilCard') {
if (this.oilCardList.length < this.total) {
this.queryParams.pageNo++
this.getOilCardList()
}
} else {
if (this.orderList.length < this.total) {
this.queryParams.pageNo++
this.getOrderList()
}
2024-09-18 14:13:55 +08:00
}
},
methods: {
2024-09-21 17:35:37 +08:00
getOilCardList() {
request({
url: '/business/marketingActivity/cardFuelChange/queryByPageUni',
method: 'get',
params: this.queryParams
}).then(res => {
if (res.code == 200) {
this.oilCardList = res.data.records
this.total = res.data.total
console.log(res, 130);
}
})
},
2024-09-20 09:07:19 +08:00
// 获取订单信息
getOrderList() {
request({
url: '/clientApi/balance/detail',
method: 'get',
params: this.queryParams
}).then(res => {
if (res.code == 200) {
2024-09-21 15:55:14 +08:00
this.orderList = res.data.records
this.total = res.data.total
2024-09-20 09:07:19 +08:00
}
})
},
// 获取余额信息
getUserBalance() {
request({
url: '/business/userManager/user/getUserBalanceApplet',
method: 'get',
params: this.query
}).then(res => {
if (res.code == 200) {
this.cardBalance = res.data
}
})
},
confirm(e) {
2024-09-21 15:55:14 +08:00
this.queryParams.pageNo = 1
2024-09-20 09:07:19 +08:00
if (e.indexs[0] == 1) {
this.queryParams.changeType = 0
} else if (e.indexs[0] == 2) {
this.queryParams.changeType = 1
} else {
this.queryParams.changeType = ""
}
2024-09-21 17:35:37 +08:00
if (this.type == 'oilCard') {
this.getOilCardList()
} else {
this.getOrderList()
}
2024-09-20 09:07:19 +08:00
this.show1 = false
},
2024-09-18 14:13:55 +08:00
cancel() {
this.show1 = false
},
2024-09-20 09:07:19 +08:00
timestampToString(timestamp) {
// 将时间戳转换为Date对象
const date = new Date(timestamp);
// 使用toLocaleDateString和toLocaleTimeString可以根据本地格式转换日期和时间
const dateString = date.toLocaleDateString()
const timeString = date.toLocaleTimeString();
// 返回日期和时间的组合
2024-09-21 17:35:37 +08:00
return date.getFullYear() + '-' + (date.getMonth() + 1);
2024-09-20 09:07:19 +08:00
},
confirm1(e) {
this.queryParams.startTime = this.timestampToString(e.value)
2024-09-21 15:55:14 +08:00
this.queryParams.pageNo = 1
2024-09-21 17:35:37 +08:00
if (this.type == 'oilCard') {
this.getOilCardList()
} else {
this.getOrderList()
}
2024-09-20 09:07:19 +08:00
this.show = false
},
2024-09-18 14:13:55 +08:00
cancel1() {
this.show = false
}
}
}
2024-09-18 10:29:23 +08:00
</script>
<style scoped lang="scss">
2024-09-18 14:13:55 +08:00
.centenr {
width: 100%;
height: 100vh;
background: #F9F9F9;
}
.Candywrapper {
background: #F9F9F9;
box-sizing: border-box;
padding: 10px;
}
.card_box {
width: 100%;
height: 90px;
background: url('../../static/imgs/topback.png') no-repeat;
background-size: 100% 100%;
box-sizing: border-box;
padding: 10px;
color: #fff;
font-size: 14px;
}
.r-size {
width: 100%;
display: flex;
align-items: center;
justify-content: flex-end;
}
.r-num {
font-weight: 600;
font-size: 20px;
color: #FFFFFF;
}
.tab-bs {
width: 100%;
display: flex;
align-items: center;
justify-content: space-between;
background: #fff;
margin: 15px auto;
}
.w_box {
width: 50%;
display: flex;
align-items: center;
justify-content: center;
box-sizing: border-box;
padding: 15px;
}
.bai_box {
width: 100%;
box-sizing: border-box;
padding: 15px 10px;
background: #fff;
display: flex;
align-items: center;
justify-content: space-between;
}
.left-img {
margin-right: 10px;
image {
width: 40px;
height: 40px;
}
}
.right-box {
width: 100%;
display: flex;
align-items: center;
justify-content: space-between;
font-size: 12px;
color: #666666;
}
.l-text {
font-size: 16px;
color: #333333;
margin-bottom: 5px;
font-weight: bold;
}
.r-text {
font-size: 16px;
color: #333333;
margin-bottom: 5px;
font-weight: bold;
}
2024-09-18 10:29:23 +08:00
</style>