powerbank/pages/income/index.vue
2024-06-06 18:02:54 +08:00

441 lines
10 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="page">
<u-navbar :title="bttit" :border-bottom="false" :background="bgc" title-color='#000' title-size='36'
height='58'></u-navbar>
<view class="box">
<view class="top">
<u-search placeholder="搜索" input-align="center" v-model="keyword" @custom="seach"></u-search>
</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
@click="btnaddid(1)">{{qishiprice == '' ? qishiprice + '起始金额' : qishiprice + '元'}} </text>
--
<text @click="btnaddid(2)">{{jieshuprice == '' ? jieshuprice + '结束金额' : jieshuprice + '元'}} </text>
<view class="cx" @click="btnchaxun">查询</view>
</view>
<!-- 店铺排行 -->
<view class="shoppm">
<view class="shopname">
<view class="one">店铺名称</view>
<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>
</view>
<view class="listshop" @scrolltolower="onReachBottom" v-for="(item,index) in listarr" :key="index">
<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)}">
{{index + 1}}</text>
{{item.storeName}}
</view>
<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>
</view>
</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,
selector: '',
selectors: '',
num: '',
vipflag: false,
textje: '请输入起始金额',
qishiprice: '',
jieshuprice: '',
jesum: '',
jeflag: '',
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:''
}
},
onLoad(option) {
this.bttit = option.tit
this.sytit = option.tits
let today = new Date()
this.selector = this.formatDate(today)
this.selectors = this.formatDate(today)
this.getlist()
},
methods: {
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;
}
}
})
},
onReachBottom() {
let sum = this.total / this.pagesize
if (this.pagenum - 1 < sum) {
this.getlist(); // 上拉加载更多
} else {
uni.showToast({
title: '没有更多店铺收益了',
icon: 'none',
duration: 1000
})
}
},
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}`;
},
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
this.jesum = ''
} else {
this.jieshuprice = this.jesum
this.jesum = ''
}
},
getColorByIndex(index) {
const colors = ['red', 'orange', 'green', 'black']; // 颜色数组
return index < colors.length ? colors[index] : colors[3]; // 如果index小于颜色数组长度返回对应颜色否则返回黑色
}
}
}
</script>
<style lang="scss">
/deep/ .u-title,
/deep/ .uicon-nav-back {
padding-bottom: 40rpx;
}
page {
// background: linear-gradient(180deg, #25CE88 0%, rgba(255, 255, 255, 0) 100%);
}
.page {
width: 750rpx;
// position: fixed;
// top: 0;
// left: 0;
.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>