This commit is contained in:
cclu 2024-04-25 19:10:40 +08:00
parent 2ba9a56866
commit ccabdb6424
2 changed files with 129 additions and 15 deletions

View File

@ -18,9 +18,21 @@
</view> </view>
<!-- <view class="pageTitle" :style="{top: menu.bottom + 5 + 12 +'px'}">营收统计</view>--> <!-- <view class="pageTitle" :style="{top: menu.bottom + 5 + 12 +'px'}">营收统计</view>-->
<view :style="{paddingTop: menu.bottom + 5 + 8 +'px'}"> <view :style="{paddingTop: menu.bottom + 5 + 8 +'px'}">
<view class="tabBox" > <view class="tabBox">
<image :class="selectTab===1?'selectTabItem':'tabItem'" @click="handleChangeTab(1)" :src="selectTab===1?'https://eshangtech.com/ShopICO/ahyd-BID/newIndex3/activeFirstTab.png':'https://eshangtech.com/ShopICO/ahyd-BID/newIndex3/firstTab.png'"/> <div class="tab">
<image :class="selectTab===2?'selectTabItem':'tabItem'" @click="handleChangeTab(2)" :src="selectTab===2?'https://eshangtech.com/ShopICO/ahyd-BID/newIndex3/activeSecondTab.png':'https://eshangtech.com/ShopICO/ahyd-BID/newIndex3/secondTab.png'"/> <image :class="selectTab===1?'selectTabItem':'tabItem'" @click="handleChangeTab(1)" :src="selectTab===1?'https://eshangtech.com/ShopICO/ahyd-BID/newIndex3/activeFirstTab.png':'https://eshangtech.com/ShopICO/ahyd-BID/newIndex3/firstTab.png'"/>
<image :class="selectTab===2?'selectTabItem':'tabItem'" @click="handleChangeTab(2)" :src="selectTab===2?'https://eshangtech.com/ShopICO/ahyd-BID/newIndex3/activeSecondTab.png':'https://eshangtech.com/ShopICO/ahyd-BID/newIndex3/secondTab.png'"/>
</div>
<div class="timeSelect">
<!-- <uni-datetime-picker />-->
<picker mode="date" fields="month" :start="defaultStart" class="screen-unit" @change="handleChangeSelectStart($event)">
<text class="time">{{ selectStart || '开始时间' }}</text>
</picker>
<span style="margin: 0 4px">-</span>
<picker mode="date" fields="month" class="screen-unit" :start="selectStart" :end="endTime" @change="handleChangeSelectEnd($event)">
<text class="time">{{ selectEnd || '结束时间' }}</text>
</picker>
</div>
</view> </view>
<scroll-view class="scrollView" :current="currentScroll" scroll-x="true" :scroll-into-view="'item'+selectIndex" scroll-with-animation> <scroll-view class="scrollView" :current="currentScroll" scroll-x="true" :scroll-into-view="'item'+selectIndex" scroll-with-animation>
<view class="bigView" :style="{width: `${60*selectList.length +20}px`}"> <view class="bigView" :style="{width: `${60*selectList.length +20}px`}">
@ -655,7 +667,11 @@ export default {
pageAccountList:[],// pageAccountList:[],//
curYear:2024,// curYear:2024,//
query:{}, query:{},
currentMonth:'' currentMonth:'',
defaultStart:'',//
selectStart:'',//
selectEnd:'',//
endTime:'',//
} }
}, },
async onLoad(option){ async onLoad(option){
@ -686,8 +702,12 @@ export default {
let currentMonth = selectDate.getMonth() + 1 let currentMonth = selectDate.getMonth() + 1
this.currentMonth = currentMonth this.currentMonth = currentMonth
this.curYear = selectYear this.curYear = selectYear
this.defaultStart = `${selectYear}-01`
this.selectStart = `${selectYear}-01`
const nowDate = new Date() const nowDate = new Date()
let endMonth = nowDate.getMonth() + 1
this.endTime = `${selectYear}-${endMonth<10?'0'+endMonth:endMonth}`
let nowYear = nowDate.getFullYear() let nowYear = nowDate.getFullYear()
let monthNumber = 0 let monthNumber = 0
if (nowYear>selectYear){ if (nowYear>selectYear){
@ -712,6 +732,83 @@ export default {
uni.hideLoading() uni.hideLoading()
}, },
methods:{ methods:{
//
async handleChangeSelectStart(e){
console.log('e',e)
this.selectStart = e.detail.value
const date = new Date(this.selectEnd)
let m = date.getMonth() + 1
if (this.selectStart && this.selectEnd){
uni.showLoading({
title:'正在加载'
})
this.handleGetPageData(m)
uni.hideLoading()
}
},
//
async handleChangeSelectEnd(e){
this.selectEnd = e.detail.value
console.log('this.selectEnd',this.selectEnd)
const date = new Date(this.selectEnd)
let m = date.getMonth() + 1
console.log(' m', m)
if (this.selectStart && this.selectEnd){
uni.showLoading({
title:'正在加载'
})
await this.handleGetPageData(m)
uni.hideLoading()
}
},
//
async handleGetPageData(month){
if (this.selectStart && this.selectEnd){
const req = {
calcType: 2,
pushProvinceCode: this.useInfo.userData.ProvinceCode || '340000',
curYear: this.curYear,//
compareYear: this.curYear-1,//
StatisticsMonth: month,//
StatisticsDate: this.lastDay
}
console.log('req',req)
const data = await request.$webGet('CommercialApi/Revenue/GetMonthlyBusinessAnalysis',req)
let res = data.Result_Data.List
if (res && res.length>0){
let everyTop = {}//
let revenueList = [{},{},{},{},{}]//
let accountList = [{},{},{},{},{}]//
res.forEach(item=>{
if (item.ServerpartName==='累计'){
everyTop = item
}else if(item.SPRegionTypeId===1){
// SPRegionTypeId===1
revenueList[0] = {...item.RevenueINC, type:1}
accountList[0] = {...item.AccountINC, type:1}
}else if(item.SPRegionTypeId===2){
// SPRegionTypeId===2
revenueList[3] = {...item.RevenueINC, type:1}
accountList[3] = {...item.AccountINC, type:1}
}else if(item.ServerpartId===1){
revenueList[1] = {...item.RevenueINC, type:2}
accountList[1] = {...item.AccountINC, type:2}
}else if(item.ServerpartId===2){
revenueList[2] = {...item.RevenueINC,type:2}
accountList[2] = {...item.AccountINC,type:2}
}else if(item.ServerpartId===3){
revenueList[4] = {...item.RevenueINC,type:2}
accountList[4] = {...item.AccountINC,type:2}
}
})
this.topDetail = everyTop
this.pageRevenueList = revenueList
console.log('accountList',accountList)
this.pageAccountList = accountList
}
}
},
// //
handleGoSort(type){ handleGoSort(type){
this.$util.toNextRoute('navigateTo', `/pages/revenueStatistics/servicePartList?type=${type}&yearMonth=${this.searchText}&thisMonth=${this.thisMonth && this.thisMonth!=='0'?this.thisMonth:this.currentMonth}`) this.$util.toNextRoute('navigateTo', `/pages/revenueStatistics/servicePartList?type=${type}&yearMonth=${this.searchText}&thisMonth=${this.thisMonth && this.thisMonth!=='0'?this.thisMonth:this.currentMonth}`)
@ -942,18 +1039,35 @@ export default {
width: 100%; width: 100%;
box-sizing: border-box; box-sizing: border-box;
padding-left: 32rpx; padding-left: 32rpx;
padding-right: 32rpx;
display: flex; display: flex;
align-items: center; align-items: center;
.tabItem{ justify-content: space-between;
width: 204rpx; position: relative;
height: 68rpx; .tab{
margin-right: 48rpx; .tabItem{
width: 204rpx;
height: 68rpx;
margin-right: 48rpx;
}
.selectTabItem{
width: 204rpx;
height: 68rpx;
margin-right: 48rpx;
}
} }
.selectTabItem{ .timeSelect{
width: 204rpx; position: absolute;
height: 68rpx; right: 32rpx;
margin-right: 48rpx; top: 0;
display: flex;
align-items: center;
.time{
font-size: 14px;
color: #fff;
}
} }
} }
.scrollView{ .scrollView{
width: calc(100vw - 64rpx); width: calc(100vw - 64rpx);