powerbank/pages/income/index.vue

440 lines
10 KiB
Vue
Raw Normal View History

2024-05-11 10:57:53 +08:00
<template>
<view class="page">
2024-06-07 18:02:00 +08:00
<u-navbar :title="bttit" :border-bottom="false" :background="bgc" title-color='#000' back-icon-color="#000" title-size='36' height='50'></u-navbar>
2024-05-11 10:57:53 +08:00
<view class="box">
<view class="top">
2024-06-06 18:02:54 +08:00
<u-search placeholder="搜索" input-align="center" v-model="keyword" @custom="seach"></u-search>
2024-05-11 10:57:53 +08:00
</view>
<u-picker mode="time" v-model="show" :params="params" @confirm="confirm"></u-picker>
<view class="date">
<text @click="btnks(1)">{{selector}}</text> -- <text @click="btnks(2)">{{selectors}}</text>
</view>
<view class="jesx">
<view class="sx">金额筛选</view><text
2024-06-06 18:02:54 +08:00
@click="btnaddid(1)">{{qishiprice == '' ? qishiprice + '起始金额' : qishiprice + '元'}} </text>
2024-05-11 10:57:53 +08:00
--
2024-06-06 18:02:54 +08:00
<text @click="btnaddid(2)">{{jieshuprice == '' ? jieshuprice + '结束金额' : jieshuprice + ''}} </text>
<view class="cx" @click="btnchaxun">查询</view>
2024-05-11 10:57:53 +08:00
</view>
<!-- 店铺排行 -->
<view class="shoppm">
<view class="shopname">
<view class="one">店铺名称</view>
2024-06-06 18:02:54 +08:00
<view class="two">{{sytit}}
<image @click="btnpx" src="https://api.ccttiot.com/smartmeter/img/static/usFoZqC3MrePH4pqCJe7" mode=""
style="display: inline-block;width: 46rpx;height: 46rpx;vertical-align: middle;"></image>
</view>
2024-05-11 10:57:53 +08:00
</view>
2024-06-06 18:02:54 +08:00
<view class="listshop" @scrolltolower="onReachBottom" v-for="(item,index) in listarr" :key="index">
2024-05-11 10:57:53 +08:00
<view class="nikename">
<text :style="{
width: '38rpx',
height: '38rpx',
background: '#ccc',
display: 'inline-block',
borderRadius: '50%',
textAlign: 'center',
marginRight: '14rpx',
fontSize: '24rpx',
lineHeight: '38rpx',
color: getColorByIndex(index)}">
2024-06-06 18:02:54 +08:00
{{index + 1}}</text>
{{item.storeName}}
2024-05-11 10:57:53 +08:00
</view>
2024-06-06 18:02:54 +08:00
<view class="price" v-if="sytit == '收益金额'">{{item.income}}</view>
<view class="price" v-else>{{item.flow}}</view>
</view>
<view class="" style="width: 448rpx;height: 448rpx;margin: auto;margin-top: 100rpx;text-align: center;"
v-if="showflag">
<image style="width: 448rpx;height: 448rpx;"
src="https://api.ccttiot.com/smartmeter/img/static/ufLi6IZd5kh1MIEZFYTo" mode=""></image>
<view class="" style="font-size: 30rpx;color: #ccc;margin-top: 30rpx;">暂无更多店铺收益...</view>
2024-05-11 10:57:53 +08:00
</view>
2024-06-06 18:02:54 +08:00
2024-05-11 10:57:53 +08:00
</view>
</view>
<!-- 弹窗 -->
<view class="tanc" v-if="vipflag">
<view class="tit">{{textje}}</view>
<input type="text" v-model="jesum" />
<view class="xian"></view>
<view class="anniu">
<text @click="btnqx">取消</text> <text style="border-left: 1px solid #D8D8D8;color: #25CE88;"
@click="trueje">确定</text>
</view>
</view>
<view class="mask" v-if="vipflag"></view>
</view>
</template>
<script>
export default {
data() {
return {
params: {
year: true,
month: true,
day: true,
hour: false,
minute: false,
second: false
},
show: false,
2024-06-05 18:08:46 +08:00
selector: '',
selectors: '',
2024-05-11 10:57:53 +08:00
num: '',
vipflag: false,
textje: '请输入起始金额',
2024-06-06 18:02:54 +08:00
qishiprice: '',
jieshuprice: '',
2024-06-05 18:08:46 +08:00
jesum: '',
jeflag: '',
2024-06-06 18:02:54 +08:00
listarr: [],
pagesum: 1,
pagesize: 10,
pagenum: 1,
pagesize: 10, // 一页多少数据
isLoading: false, // 是否正在加载数据
noMoreData: false, // 是否没有更多数据
total: 0,
keyword: '',
bgc: {
background: '#25CE88'
},
showflag: false,
isAsc:'desc',
bttit:'',
sytit:''
2024-05-11 10:57:53 +08:00
}
},
2024-06-06 18:02:54 +08:00
onLoad(option) {
this.bttit = option.tit
this.sytit = option.tits
2024-06-05 18:08:46 +08:00
let today = new Date()
this.selector = this.formatDate(today)
this.selectors = this.formatDate(today)
this.getlist()
},
2024-05-11 10:57:53 +08:00
methods: {
2024-06-06 18:02:54 +08:00
btnchaxun() {
this.pagenum = 1
this.listarr = []
this.getlist()
},
seach(){
this.pagenum = 1
this.listarr = []
this.getlist()
},
btnpx(){
if(this.isAsc == 'asc'){
this.isAsc = 'desc'
this.pagenum = 1
this.listarr = []
this.getlist()
}else{
this.isAsc = 'asc'
this.pagenum = 1
this.listarr = []
this.getlist()
}
},
getlist() {
this.$u.get('/agent/report/agent/storeRank?orderByColumn=' + 'income' + '&isAsc=' + this.isAsc +
'&startDate=' + this.selector + '&endDate=' + this.selectors + '&pageNum=' + this.pagenum +
'&pageSize=' + this.pagesize + '&startAmount=' + this.qishiprice + '&endAmount=' + this.jieshuprice + '&keyword=' + this.keyword + '&isAsc=' + this.isAsc).then(res => {
if (res.code == 200) {
this.total = res.total
if (this.total > 0) {
this.showflag = false
} else {
this.showflag = true
}
if (res.rows.length > 0) {
// 有数据,追加到列表
this.listarr = this.listarr.concat(res.rows)
this.pagenum++
} else {
// 没有更多数据
this.noMoreData = true;
}
2024-06-05 18:08:46 +08:00
}
})
},
2024-06-06 18:02:54 +08:00
onReachBottom() {
let sum = this.total / this.pagesize
if (this.pagenum - 1 < sum) {
this.getlist(); // 上拉加载更多
} else {
uni.showToast({
title: '没有更多店铺收益了',
icon: 'none',
duration: 1000
})
}
},
2024-06-05 18:08:46 +08:00
formatDate(date) {
let year = date.getFullYear();
let month = String(date.getMonth() + 1).padStart(2, '0');
let day = String(date.getDate()).padStart(2, '0');
return `${year}-${month}-${day}`;
},
2024-05-11 10:57:53 +08:00
btnks(num) {
this.show = true
if (num == 1) {
this.num = 1
} else {
this.num = 2
}
},
confirm(e) {
if (this.num == 1) {
this.selector = e.year + '-' + e.month + '-' + e.day
} else {
this.selectors = e.year + '-' + e.month + '-' + e.day
}
},
btnaddid(num) {
this.vipflag = true
if (num == 1) {
this.textje = '请输入起始金额'
this.jeflag = true
} else {
this.textje = '请输入结束金额'
this.jeflag = false
}
},
btnqx() {
this.vipflag = false
},
trueje() {
this.vipflag = false
// 为true是起始金额 为false是结束金额
if (this.jeflag == true) {
this.qishiprice = this.jesum
2024-06-06 18:02:54 +08:00
this.jesum = ''
2024-05-11 10:57:53 +08:00
} else {
this.jieshuprice = this.jesum
2024-06-06 18:02:54 +08:00
this.jesum = ''
2024-05-11 10:57:53 +08:00
}
},
getColorByIndex(index) {
const colors = ['red', 'orange', 'green', 'black']; // 颜色数组
return index < colors.length ? colors[index] : colors[3]; // 如果index小于颜色数组长度返回对应颜色否则返回黑色
}
}
}
</script>
<style lang="scss">
2024-05-25 18:06:00 +08:00
/deep/ .u-title,
/deep/ .uicon-nav-back {
2024-06-07 18:02:00 +08:00
padding-bottom: 22rpx;
2024-05-25 18:06:00 +08:00
}
2024-06-06 18:02:54 +08:00
2024-05-11 10:57:53 +08:00
page {
2024-06-06 18:02:54 +08:00
// background: linear-gradient(180deg, #25CE88 0%, rgba(255, 255, 255, 0) 100%);
2024-05-11 10:57:53 +08:00
}
.page {
width: 750rpx;
2024-06-06 18:02:54 +08:00
// position: fixed;
// top: 0;
// left: 0;
2024-05-11 10:57:53 +08:00
.mask {
width: 750rpx;
height: 100vh;
background: #000000;
border-radius: 0rpx 0rpx 0rpx 0rpx;
opacity: 0.2;
z-index: 1;
position: fixed;
top: 0;
left: 0;
}
.box {
width: 750rpx;
height: 1440rpx;
background: #F4F5F7;
border-radius: 0rpx 0rpx 0rpx 0rpx;
.shoppm {
.listshop {
padding: 24rpx 48rpx;
box-sizing: border-box;
display: flex;
justify-content: space-between;
border-bottom: 1rpx solid #F0F0F0;
font-size: 28rpx;
color: #3D3D3D;
.nikename {}
}
.shopname {
display: flex;
justify-content: space-between;
padding: 0rpx 48rpx;
box-sizing: border-box;
margin-top: 60rpx;
border-bottom: 1rpx solid #F0F0F0;
padding-bottom: 24rpx;
.one {
font-size: 28rpx;
color: #808080;
}
.two {
font-weight: 600;
font-size: 28rpx;
color: #3D3D3D;
}
}
}
.jesx {
display: flex;
justify-content: space-between;
margin-top: 32rpx;
padding: 0 22rpx;
box-sizing: border-box;
text {
padding: 6rpx 18rpx;
box-sizing: border-box;
background: #eee;
border-radius: 10rpx 10rpx 10rpx 10rpx;
font-size: 24rpx;
color: #808080;
}
.sx {
font-size: 24rpx;
color: #3D3D3D;
width: 120rpx;
margin-top: 6rpx;
}
.cx {
width: 100rpx;
margin-right: 20rpx;
text-align: center;
font-size: 24rpx;
color: #FFFFFF;
height: 46rpx;
line-height: 46rpx;
background: #25CE88;
border-radius: 10rpx 10rpx 10rpx 10rpx;
}
}
.date {
padding-left: 80rpx;
padding-right: 80rpx;
box-sizing: border-box;
display: flex;
justify-content: space-between;
margin-top: 26rpx;
text {
padding: 6rpx 18rpx;
box-sizing: border-box;
background: #eee;
border-radius: 10rpx 10rpx 10rpx 10rpx;
font-size: 24rpx;
color: #808080;
}
}
.top {
padding: 28rpx 32rpx;
box-sizing: border-box;
/deep/ .u-content {
border: 1px solid #ccc;
border-radius: 50rpx 0 0 50rpx !important;
}
/deep/ .u-action {
border-radius: 0 50rpx 50rpx 0 !important;
width: 112rpx;
height: 65rpx;
line-height: 65rpx;
border: 2rpx solid #ccc;
margin-left: 0;
color: #3D3D3D;
background-color: #f2f2f2;
}
}
}
.tanc {
width: 610rpx;
height: 282rpx;
background: #FFFFFF;
border-radius: 30rpx 30rpx 30rpx 30rpx;
position: fixed;
top: 628rpx;
left: 50%;
transform: translateX(-50%);
z-index: 2;
.tit {
width: 100%;
text-align: center;
margin-top: 28rpx;
font-weight: 500;
font-size: 32rpx;
color: #3D3D3D;
}
input {
width: 504rpx;
height: 62rpx;
background: #EEEEEE;
border-radius: 6rpx 6rpx 6rpx 6rpx;
margin: auto;
margin-top: 22rpx;
padding-left: 20rpx;
}
.xian {
width: 610rpx;
height: 2rpx;
background: #D8D8D8;
border-radius: 0rpx 0rpx 0rpx 0rpx;
margin-top: 26rpx;
}
.anniu {
display: flex;
justify-content: space-between;
height: 98rpx;
text {
padding: 24rpx;
text-align: center;
box-sizing: border-box;
font-weight: 500;
font-size: 36rpx;
color: #3D3D3D;
display: inline-block;
width: 100%;
height: 100rpx;
}
}
}
}
</style>