first commit
This commit is contained in:
parent
f0ab72c78b
commit
c8f020d72e
@ -15,6 +15,8 @@
|
|||||||
<view class="uni-input">{{ serviceInfo.SERVERPART_NAME ? serviceInfo.SERVERPART_NAME :
|
<view class="uni-input">{{ serviceInfo.SERVERPART_NAME ? serviceInfo.SERVERPART_NAME :
|
||||||
'请选择服务区' }}
|
'请选择服务区' }}
|
||||||
</view>
|
</view>
|
||||||
|
<p class="area">{{ serviceInfo.SPREGIONTYPE_NAME ? serviceInfo.SPREGIONTYPE_NAME : '' }}
|
||||||
|
</p>
|
||||||
<image class="rightArrow"
|
<image class="rightArrow"
|
||||||
src="https://eshangtech.com/ShopICO/ahyd-BID/commercial/rightArrow.svg"></image>
|
src="https://eshangtech.com/ShopICO/ahyd-BID/commercial/rightArrow.svg"></image>
|
||||||
</view>
|
</view>
|
||||||
@ -489,6 +491,15 @@ export default {
|
|||||||
color: #160002;
|
color: #160002;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.area {
|
||||||
|
font-size: 12px;
|
||||||
|
font-family: PingFangSC-Regular, PingFang SC;
|
||||||
|
font-weight: 400;
|
||||||
|
color: #786B6C;
|
||||||
|
line-height: 40px;
|
||||||
|
margin-left: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
.rightArrow {
|
.rightArrow {
|
||||||
width: 12px;
|
width: 12px;
|
||||||
height: 12px;
|
height: 12px;
|
||||||
|
|||||||
@ -14,6 +14,8 @@
|
|||||||
<view class="uni-input">{{ serviceInfo.SERVERPART_NAME ? serviceInfo.SERVERPART_NAME :
|
<view class="uni-input">{{ serviceInfo.SERVERPART_NAME ? serviceInfo.SERVERPART_NAME :
|
||||||
'' }}
|
'' }}
|
||||||
</view>
|
</view>
|
||||||
|
<p class="area">{{ serviceInfo.SPREGIONTYPE_NAME ? serviceInfo.SPREGIONTYPE_NAME : '' }}
|
||||||
|
</p>
|
||||||
<image class="rightArrow"
|
<image class="rightArrow"
|
||||||
src="https://eshangtech.com/ShopICO/ahyd-BID/commercial/rightArrow.svg"></image>
|
src="https://eshangtech.com/ShopICO/ahyd-BID/commercial/rightArrow.svg"></image>
|
||||||
</view>
|
</view>
|
||||||
|
|||||||
@ -13,6 +13,8 @@
|
|||||||
<view class="uni-input">{{ serviceInfo.SERVERPART_NAME ? serviceInfo.SERVERPART_NAME :
|
<view class="uni-input">{{ serviceInfo.SERVERPART_NAME ? serviceInfo.SERVERPART_NAME :
|
||||||
'' }}
|
'' }}
|
||||||
</view>
|
</view>
|
||||||
|
<p class="area">{{ serviceInfo.SPREGIONTYPE_NAME ? serviceInfo.SPREGIONTYPE_NAME : '' }}
|
||||||
|
</p>
|
||||||
<image class="rightArrow"
|
<image class="rightArrow"
|
||||||
src="https://eshangtech.com/ShopICO/ahyd-BID/commercial/rightArrow.svg"></image>
|
src="https://eshangtech.com/ShopICO/ahyd-BID/commercial/rightArrow.svg"></image>
|
||||||
</view>
|
</view>
|
||||||
@ -107,7 +109,7 @@
|
|||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="calendarGrid">
|
<view class="calendarGrid">
|
||||||
<view v-for="i in firstDayOfWeek" :key="`empty-${i}`" class="calendarCell empty"></view>
|
<view v-for="(n, index) in firstDayOfWeek" :key="index" class="calendarCell empty"></view>
|
||||||
|
|
||||||
<view v-for="day in monthDays" :key="day.date" class="calendarCell" :class="{
|
<view v-for="day in monthDays" :key="day.date" class="calendarCell" :class="{
|
||||||
'weekend': day.isWeekend,
|
'weekend': day.isWeekend,
|
||||||
@ -522,6 +524,15 @@ export default {
|
|||||||
color: #160002;
|
color: #160002;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.area {
|
||||||
|
font-size: 12px;
|
||||||
|
font-family: PingFangSC-Regular, PingFang SC;
|
||||||
|
font-weight: 400;
|
||||||
|
color: #786B6C;
|
||||||
|
line-height: 40px;
|
||||||
|
margin-left: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
.rightArrow {
|
.rightArrow {
|
||||||
width: 12px;
|
width: 12px;
|
||||||
height: 12px;
|
height: 12px;
|
||||||
|
|||||||
@ -17,7 +17,8 @@
|
|||||||
<!-- 月份的轮播框 -->
|
<!-- 月份的轮播框 -->
|
||||||
<view class="monthListBox" :style="{ paddingTop: menu.bottom + 8 + 'px' }">
|
<view class="monthListBox" :style="{ paddingTop: menu.bottom + 8 + 'px' }">
|
||||||
<swiper class="swiperBox" previous-margin="40rpx" next-margin="40rpx" :current="selectIndex"
|
<swiper class="swiperBox" previous-margin="40rpx" next-margin="40rpx" :current="selectIndex"
|
||||||
@animationfinish="handleChangeSwiper">
|
@animationfinish="handleChangeSwiper" :disable-programmatic-animation="false" :duration="300"
|
||||||
|
:easing-function="ease - out">
|
||||||
<swiper-item class="swiperItem" v-for="(item, index) in monthList" :key="index">
|
<swiper-item class="swiperItem" v-for="(item, index) in monthList" :key="index">
|
||||||
<view class="swiperItemContent"
|
<view class="swiperItemContent"
|
||||||
:class="{ 'is-first': index === 0, 'is-last': index === monthList.length - 1 }">
|
:class="{ 'is-first': index === 0, 'is-last': index === monthList.length - 1 }">
|
||||||
@ -25,31 +26,26 @@
|
|||||||
|
|
||||||
<!-- 轮播框里面的实际内容 写在这个里面 -->
|
<!-- 轮播框里面的实际内容 写在这个里面 -->
|
||||||
<view class="swiperItemContentMonth">
|
<view class="swiperItemContentMonth">
|
||||||
{{ selectIndex === index ? item.month || "-" : "-" }}月对客营收
|
{{ selectIndex === index ? currentMonthData.monthText : '-月对客营收' }}
|
||||||
<span class="swiperItemContentUnit">/万元</span>
|
<span class="swiperItemContentUnit">/万元</span>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- 月度营收的值 -->
|
<!-- 月度营收的值 -->
|
||||||
<view class="swiperItemContentMonthRevenueBox">
|
<view class="swiperItemContentMonthRevenueBox">
|
||||||
<view class="leftRevenueValue">{{ selectIndex === index
|
<view class="leftRevenueValue">{{ selectIndex === index ?
|
||||||
? topShowData.MonthRevenueModel.CashPayChange || "-" : "-" }}
|
currentRevenueData.cashPayChange : '-' }}
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="rightRevenueValue">
|
<view class="rightRevenueValue">
|
||||||
<text v-if="selectIndex === index" class="addValue" :style="{
|
<text v-if="selectIndex === index && hasCurrentMonthData" class="addValue"
|
||||||
color:
|
:style="revenueChangeStyle">
|
||||||
topShowData.MonthRevenueModel.addNumber > 0
|
{{ revenueChangeText }}
|
||||||
? '#E83944'
|
</text>
|
||||||
: topShowData.MonthRevenueModel.addNumber < 0
|
|
||||||
? '#0E9976'
|
|
||||||
: '',
|
|
||||||
}">{{ topShowData.MonthRevenueModel.addNumber ?
|
|
||||||
topShowData.MonthRevenueModel.addNumber : "-" }}%</text>
|
|
||||||
<text class="rightNav">同比</text>
|
<text class="rightNav">同比</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="monthRevenueBox" v-if="selectIndex === index">
|
<view class="monthRevenueBox" v-if="selectIndex === index && hasCurrentMonthData">
|
||||||
<view class="leftBox" @click="handleShowYDModal">
|
<view class="leftBox" @click="handleShowYDModal">
|
||||||
<view class="rateChartsBox" v-if="moneyRateList && moneyRateList.length > 0">
|
<view class="rateChartsBox" v-if="moneyRateList && moneyRateList.length > 0">
|
||||||
<rateCharts :success="moneyRateList"
|
<rateCharts :success="moneyRateList"
|
||||||
@ -120,7 +116,7 @@
|
|||||||
<!-- <view class="itemType">累计</view>-->
|
<!-- <view class="itemType">累计</view>-->
|
||||||
</view>
|
</view>
|
||||||
<view class="itemBottom">
|
<view class="itemBottom">
|
||||||
<span class="revenueNum" v-if="selectIndex === index">{{
|
<span class="revenueNum" v-if="selectIndex === index && hasCurrentMonthData">{{
|
||||||
topShowData && topShowData.MonthRevenueModel &&
|
topShowData && topShowData.MonthRevenueModel &&
|
||||||
topShowData.MonthRevenueModel.YearRevenueAmount
|
topShowData.MonthRevenueModel.YearRevenueAmount
|
||||||
? $util.getMoney(
|
? $util.getMoney(
|
||||||
@ -129,7 +125,7 @@
|
|||||||
)
|
)
|
||||||
: ""
|
: ""
|
||||||
}}</span>
|
}}</span>
|
||||||
<span class="revenueAdd" v-if="selectIndex === index" :style="{
|
<span class="revenueAdd" v-if="selectIndex === index && hasCurrentMonthData" :style="{
|
||||||
color:
|
color:
|
||||||
topShowData && topShowData.MonthRevenueModel && topShowData.MonthRevenueModel.YearRevenueAddNumber > 0
|
topShowData && topShowData.MonthRevenueModel && topShowData.MonthRevenueModel.YearRevenueAddNumber > 0
|
||||||
? '#E83944'
|
? '#E83944'
|
||||||
@ -155,7 +151,8 @@
|
|||||||
}}
|
}}
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
<span class="revenueAdd" v-if="selectIndex === index" :style="{
|
<span class="revenueAdd" v-if="selectIndex === index && hasCurrentMonthData"
|
||||||
|
:style="{
|
||||||
color:
|
color:
|
||||||
topShowData && topShowData.MonthRevenueModel && topShowData.MonthRevenueModel.YearRevenueAdd > 0
|
topShowData && topShowData.MonthRevenueModel && topShowData.MonthRevenueModel.YearRevenueAdd > 0
|
||||||
? '#E83944'
|
? '#E83944'
|
||||||
@ -350,6 +347,10 @@ export default {
|
|||||||
modalRateList: [],// 点击圆环图出现的白色悬浮框的数据
|
modalRateList: [],// 点击圆环图出现的白色悬浮框的数据
|
||||||
useInfo: {},
|
useInfo: {},
|
||||||
isReturn: true,
|
isReturn: true,
|
||||||
|
// 新增缓存相关数据
|
||||||
|
monthDataCache: {}, // 月份数据缓存
|
||||||
|
loadingMap: {}, // 加载状态映射
|
||||||
|
swiperTransition: false, // swiper过渡状态
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
components: {
|
components: {
|
||||||
@ -359,6 +360,58 @@ export default {
|
|||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapGetters({ user: "getUser" }),
|
...mapGetters({ user: "getUser" }),
|
||||||
|
|
||||||
|
// 为uniapp小程序兼容性,使用简单的computed属性
|
||||||
|
currentMonthData() {
|
||||||
|
if (this.selectIndex >= 0 && this.monthList[this.selectIndex]) {
|
||||||
|
return {
|
||||||
|
month: this.monthList[this.selectIndex].month || "-",
|
||||||
|
monthText: (this.monthList[this.selectIndex].month || "-") + "月对客营收"
|
||||||
|
};
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
month: "-",
|
||||||
|
monthText: "-月对客营收"
|
||||||
|
};
|
||||||
|
},
|
||||||
|
|
||||||
|
currentRevenueData() {
|
||||||
|
if (this.topShowData && this.topShowData.MonthRevenueModel) {
|
||||||
|
return {
|
||||||
|
cashPayChange: this.topShowData.MonthRevenueModel.CashPayChange || "-",
|
||||||
|
addNumber: this.topShowData.MonthRevenueModel.addNumber || 0,
|
||||||
|
hasData: true
|
||||||
|
};
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
cashPayChange: "-",
|
||||||
|
addNumber: 0,
|
||||||
|
hasData: false
|
||||||
|
};
|
||||||
|
},
|
||||||
|
|
||||||
|
// 收益变化颜色样式
|
||||||
|
revenueChangeStyle() {
|
||||||
|
const addNumber = this.currentRevenueData.addNumber;
|
||||||
|
let color = '';
|
||||||
|
if (addNumber > 0) {
|
||||||
|
color = '#E83944';
|
||||||
|
} else if (addNumber < 0) {
|
||||||
|
color = '#0E9976';
|
||||||
|
}
|
||||||
|
return { color: color };
|
||||||
|
},
|
||||||
|
|
||||||
|
// 收益变化文字
|
||||||
|
revenueChangeText() {
|
||||||
|
const addNumber = this.currentRevenueData.addNumber;
|
||||||
|
return addNumber ? `${addNumber}%` : "-";
|
||||||
|
},
|
||||||
|
|
||||||
|
// 判断是否有当前月份数据
|
||||||
|
hasCurrentMonthData() {
|
||||||
|
return this.topShowData && this.topShowData.MonthRevenueModel;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
user: {
|
user: {
|
||||||
@ -443,7 +496,7 @@ export default {
|
|||||||
uni.hideTabBar();
|
uni.hideTabBar();
|
||||||
},
|
},
|
||||||
onPullDownRefresh: function () {
|
onPullDownRefresh: function () {
|
||||||
let _this = this
|
let _this = this;
|
||||||
let userInfo = JSON.parse(JSON.stringify(this.user));
|
let userInfo = JSON.parse(JSON.stringify(this.user));
|
||||||
if (userInfo && userInfo.WeChat_UserId && userInfo.AuthorityInfo["89a1f248-2113-4d57-84b1-c2e6edb9e8ee"] === 1) {
|
if (userInfo && userInfo.WeChat_UserId && userInfo.AuthorityInfo["89a1f248-2113-4d57-84b1-c2e6edb9e8ee"] === 1) {
|
||||||
_this.isReturn = false;
|
_this.isReturn = false;
|
||||||
@ -453,7 +506,10 @@ export default {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (!_this.isReturn) {
|
if (!_this.isReturn) {
|
||||||
_this.handleGetOnLoad()
|
// 下拉刷新时清空缓存,确保数据最新
|
||||||
|
_this.monthDataCache = {};
|
||||||
|
_this.loadingMap = {};
|
||||||
|
_this.handleGetOnLoad();
|
||||||
}
|
}
|
||||||
uni.stopPullDownRefresh();
|
uni.stopPullDownRefresh();
|
||||||
},
|
},
|
||||||
@ -461,15 +517,44 @@ export default {
|
|||||||
// 在onLoad里面调用的 请求整个页面的数据
|
// 在onLoad里面调用的 请求整个页面的数据
|
||||||
async handleGetOnLoad() {
|
async handleGetOnLoad() {
|
||||||
// 拿到首页的一些基本信息
|
// 拿到首页的一些基本信息
|
||||||
this.handleGetIndexInfo()
|
this.handleGetIndexInfo();
|
||||||
|
|
||||||
// 拿到顶部轮播框的数据
|
// 并行请求数据,提升加载速度
|
||||||
await this.handleGetTopData()
|
const promises = [
|
||||||
|
this.handleGetTopData(),
|
||||||
// 实时营收
|
this.handleRealRevenue(),
|
||||||
this.handleRealRevenue()
|
|
||||||
// 云南的实时内容 油品、加水、尿素、充电
|
|
||||||
this.handleGetYNRealData()
|
this.handleGetYNRealData()
|
||||||
|
];
|
||||||
|
|
||||||
|
// 预加载相邻月份数据,提升切换体验
|
||||||
|
const currentIndex = this.selectIndex;
|
||||||
|
if (currentIndex > 0) {
|
||||||
|
promises.push(this.preloadMonthData(currentIndex - 1));
|
||||||
|
}
|
||||||
|
if (currentIndex < this.monthList.length - 1) {
|
||||||
|
promises.push(this.preloadMonthData(currentIndex + 1));
|
||||||
|
}
|
||||||
|
|
||||||
|
await Promise.allSettled(promises);
|
||||||
|
},
|
||||||
|
|
||||||
|
// 预加载月份数据
|
||||||
|
async preloadMonthData(index) {
|
||||||
|
if (index < 0 || index >= this.monthList.length) return;
|
||||||
|
|
||||||
|
const monthKey = this.monthList[index]?.realFull;
|
||||||
|
if (!monthKey || this.monthDataCache[monthKey] || this.loadingMap[monthKey]) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 后台预加载,不影响当前显示
|
||||||
|
setTimeout(async () => {
|
||||||
|
try {
|
||||||
|
await this.handleGetTopData(index);
|
||||||
|
} catch (error) {
|
||||||
|
console.log('预加载数据失败:', error);
|
||||||
|
}
|
||||||
|
}, 500);
|
||||||
},
|
},
|
||||||
handleShowYDModal() {
|
handleShowYDModal() {
|
||||||
this.ydModal = !this.ydModal;
|
this.ydModal = !this.ydModal;
|
||||||
@ -557,91 +642,153 @@ export default {
|
|||||||
},
|
},
|
||||||
// 拿到云南 油水电等数据
|
// 拿到云南 油水电等数据
|
||||||
async handleGetYNRealData() {
|
async handleGetYNRealData() {
|
||||||
|
try {
|
||||||
let req = {
|
let req = {
|
||||||
serverPartId: ""
|
serverPartId: ""
|
||||||
}
|
};
|
||||||
const res = await request.$webJava("partner/today/data/statistics", req)
|
const res = await request.$webJava("partner/today/data/statistics", req);
|
||||||
console.log('handleGetYNRealDatahandleGetYNRealDatahandleGetYNRealData', res);
|
console.log('handleGetYNRealDatahandleGetYNRealDatahandleGetYNRealData', res);
|
||||||
let list = res.Result_Data
|
let list = res.Result_Data;
|
||||||
let result = []
|
let result = [];
|
||||||
|
|
||||||
|
// 数据类型映射配置
|
||||||
|
const dataTypeMap = {
|
||||||
|
2000: {
|
||||||
|
label: '油品',
|
||||||
|
icon: 'https://eshangtech.com/cyy_DIB/oilIcon.png',
|
||||||
|
valueKey: 'totalCount',
|
||||||
|
unitKey: 'totalCountUnit'
|
||||||
|
},
|
||||||
|
3000: {
|
||||||
|
label: '加水',
|
||||||
|
icon: 'https://eshangtech.com/cyy_DIB/addWaterIcon.png',
|
||||||
|
valueKey: 'totalCount',
|
||||||
|
unitKey: 'totalCountUnit'
|
||||||
|
},
|
||||||
|
4000: {
|
||||||
|
label: '尿素',
|
||||||
|
icon: 'https://eshangtech.com/cyy_DIB/ureaIcon.png',
|
||||||
|
valueKey: 'totalCount',
|
||||||
|
unitKey: 'totalCountUnit'
|
||||||
|
},
|
||||||
|
5000: {
|
||||||
|
label: '充电',
|
||||||
|
icon: 'https://eshangtech.com/cyy_DIB/chargeIcon.png',
|
||||||
|
valueKey: 'totalTicket',
|
||||||
|
unitKey: 'totalTicketUnit'
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
if (list && list.length > 0) {
|
if (list && list.length > 0) {
|
||||||
list.forEach((item) => {
|
list.forEach((item) => {
|
||||||
if (item.dataType === 2000) {
|
const config = dataTypeMap[item.dataType];
|
||||||
|
if (config) {
|
||||||
result.push({
|
result.push({
|
||||||
label: `油品`,
|
label: config.label,
|
||||||
value: this.$util.fmoney(item.totalCount),
|
value: this.$util.fmoney(item[config.valueKey]),
|
||||||
unit: item.totalCountUnit,
|
unit: item[config.unitKey],
|
||||||
icon: "https://eshangtech.com/cyy_DIB/oilIcon.png"
|
icon: config.icon
|
||||||
})
|
});
|
||||||
} else if (item.dataType === 3000) {
|
|
||||||
result.push({
|
|
||||||
label: `加水`,
|
|
||||||
value: this.$util.fmoney(item.totalCount),
|
|
||||||
unit: item.totalCountUnit,
|
|
||||||
icon: "https://eshangtech.com/cyy_DIB/addWaterIcon.png"
|
|
||||||
})
|
|
||||||
} else if (item.dataType === 4000) {
|
|
||||||
result.push({
|
|
||||||
label: `尿素`,
|
|
||||||
value: this.$util.fmoney(item.totalCount),
|
|
||||||
unit: item.totalCountUnit,
|
|
||||||
icon: "https://eshangtech.com/cyy_DIB/ureaIcon.png"
|
|
||||||
})
|
|
||||||
} else if (item.dataType === 5000) {
|
|
||||||
result.push({
|
|
||||||
label: `充电`,
|
|
||||||
value: this.$util.fmoney(item.totalTicket),
|
|
||||||
unit: item.totalTicketUnit,
|
|
||||||
icon: "https://eshangtech.com/cyy_DIB/chargeIcon.png"
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
|
}
|
||||||
|
this.otherRealData = result;
|
||||||
|
} catch (error) {
|
||||||
|
console.error('获取实时数据失败:', error);
|
||||||
|
this.otherRealData = [];
|
||||||
}
|
}
|
||||||
this.otherRealData = result
|
|
||||||
},
|
},
|
||||||
// 切换轮播框的方法
|
// 切换轮播框的方法
|
||||||
async handleChangeSwiper(e) {
|
async handleChangeSwiper(e) {
|
||||||
console.log('e', e);
|
console.log('e', e);
|
||||||
this.selectIndex = e.target.current
|
const currentIndex = e.target.current;
|
||||||
this.topShowData = null
|
|
||||||
this.moneyRateList = []
|
// 防抖处理,避免快速切换时重复加载
|
||||||
this.profitSharingList = []
|
if (this.swiperTransition) return;
|
||||||
this.modalRateList = []
|
this.swiperTransition = true;
|
||||||
await this.handleGetTopData(e.target.current)
|
|
||||||
|
this.selectIndex = currentIndex;
|
||||||
|
|
||||||
|
// 检查是否有缓存数据
|
||||||
|
const monthKey = this.monthList[currentIndex]?.realFull;
|
||||||
|
if (this.monthDataCache[monthKey]) {
|
||||||
|
// 使用缓存数据
|
||||||
|
const cachedData = this.monthDataCache[monthKey];
|
||||||
|
this.topShowData = cachedData.topShowData;
|
||||||
|
this.moneyRateList = cachedData.moneyRateList;
|
||||||
|
this.profitSharingList = cachedData.profitSharingList;
|
||||||
|
this.modalRateList = cachedData.modalRateList;
|
||||||
|
} else {
|
||||||
|
// 清空数据并加载新数据
|
||||||
|
this.topShowData = null;
|
||||||
|
this.moneyRateList = [];
|
||||||
|
this.profitSharingList = [];
|
||||||
|
this.modalRateList = [];
|
||||||
|
await this.handleGetTopData(currentIndex);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 重置过渡状态
|
||||||
|
setTimeout(() => {
|
||||||
|
this.swiperTransition = false;
|
||||||
|
}, 100);
|
||||||
},
|
},
|
||||||
// 实时营收
|
// 实时营收
|
||||||
async handleRealRevenue() {
|
async handleRealRevenue() {
|
||||||
|
try {
|
||||||
let req = {
|
let req = {
|
||||||
pushProvinceCode: "530000",
|
pushProvinceCode: "530000",
|
||||||
StatisticsDate: this.nowDay,
|
StatisticsDate: this.nowDay,
|
||||||
};
|
};
|
||||||
const res = await request.$webGet("CommercialApi/Revenue/GetCurRevenue", req)
|
const res = await request.$webGet("CommercialApi/Revenue/GetCurRevenue", req);
|
||||||
// this.currentMoney = res.Result_Data.CurRevenueAmount.toFixed(2);
|
// this.currentMoney = res.Result_Data.CurRevenueAmount.toFixed(2);
|
||||||
this.currentMoney = res.Result_Data.CurRevenueAmount.toLocaleString('zh-CN')
|
this.currentMoney = res.Result_Data.CurRevenueAmount.toLocaleString('zh-CN');
|
||||||
|
} catch (error) {
|
||||||
|
console.error('获取实时营收数据失败:', error);
|
||||||
|
this.currentMoney = '暂无数据';
|
||||||
|
}
|
||||||
},
|
},
|
||||||
// 拿到顶部轮播框的数据
|
// 拿到顶部轮播框的数据
|
||||||
async handleGetTopData(index) {
|
async handleGetTopData(index) {
|
||||||
let nowMonth = index ? this.monthList[index] : this.monthList[this.selectIndex]
|
let nowMonth = index !== undefined ? this.monthList[index] : this.monthList[this.selectIndex];
|
||||||
|
const monthKey = nowMonth.realFull;
|
||||||
|
|
||||||
|
// 检查是否正在加载,避免重复请求
|
||||||
|
if (this.loadingMap[monthKey]) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 检查缓存
|
||||||
|
if (this.monthDataCache[monthKey]) {
|
||||||
|
const cachedData = this.monthDataCache[monthKey];
|
||||||
|
this.topShowData = cachedData.topShowData;
|
||||||
|
this.moneyRateList = cachedData.moneyRateList;
|
||||||
|
this.profitSharingList = cachedData.profitSharingList;
|
||||||
|
this.modalRateList = cachedData.modalRateList;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 设置加载状态
|
||||||
|
this.loadingMap[monthKey] = true;
|
||||||
|
|
||||||
|
try {
|
||||||
const req = {
|
const req = {
|
||||||
pushProvinceCode: "530000",
|
pushProvinceCode: "530000",
|
||||||
StatisticsMonth: nowMonth.realFull,
|
StatisticsMonth: nowMonth.realFull,
|
||||||
StatisticsDate: this.lastDay
|
StatisticsDate: this.lastDay
|
||||||
}
|
};
|
||||||
const data = await request.$webGet("CommercialApi/Revenue/GetSummaryRevenueMonth", req)
|
const data = await request.$webGet("CommercialApi/Revenue/GetSummaryRevenueMonth", req);
|
||||||
|
|
||||||
// 保留接口返回 完全不处理的
|
// 保留接口返回 完全不处理的
|
||||||
let dataObj = data.Result_Data
|
let dataObj = data.Result_Data;
|
||||||
// 深拷贝一份 用于处理数据
|
// 深拷贝一份 用于处理数据
|
||||||
let resObj = JSON.parse(JSON.stringify(data.Result_Data))
|
let resObj = JSON.parse(JSON.stringify(data.Result_Data));
|
||||||
console.log('dataObjdataObjdataObj', dataObj);
|
console.log('dataObjdataObjdataObj', dataObj);
|
||||||
// 拿到月度对客营收
|
// 拿到月度对客营收
|
||||||
resObj.MonthRevenueModel.CashPayChange = this.$util.fmoney(this.$util.getMoney(resObj.MonthRevenueModel.CashPay / 10000), 2);
|
resObj.MonthRevenueModel.CashPayChange = this.$util.fmoney(this.$util.getMoney(resObj.MonthRevenueModel.CashPay / 10000), 2);
|
||||||
// 拿到月度对客营收的同比增长
|
// 拿到月度对客营收的同比增长
|
||||||
let addNumber = resObj.MonthRevenueModel.RevenueYOY ? Number((((resObj.MonthRevenueModel.CashPay - resObj.MonthRevenueModel.RevenueYOY) / resObj.MonthRevenueModel.RevenueYOY) * 100).toFixed(2)) : 0;
|
let addNumber = resObj.MonthRevenueModel.RevenueYOY ? Number((((resObj.MonthRevenueModel.CashPay - resObj.MonthRevenueModel.RevenueYOY) / resObj.MonthRevenueModel.RevenueYOY) * 100).toFixed(2)) : 0;
|
||||||
resObj.MonthRevenueModel.add = addNumber === 0 ? '' : addNumber > 0 ? "+" + addNumber : addNumber
|
resObj.MonthRevenueModel.add = addNumber === 0 ? '' : addNumber > 0 ? "+" + addNumber : addNumber;
|
||||||
resObj.MonthRevenueModel.addNumber = addNumber
|
resObj.MonthRevenueModel.addNumber = addNumber;
|
||||||
// 拿到年度的对客营收
|
// 拿到年度的对客营收
|
||||||
resObj.MonthRevenueModel.YearRevenueAddNumber = resObj.MonthRevenueModel.YearRevenueAmount - resObj.MonthRevenueModel.YearRevenueYOY;
|
resObj.MonthRevenueModel.YearRevenueAddNumber = resObj.MonthRevenueModel.YearRevenueAmount - resObj.MonthRevenueModel.YearRevenueYOY;
|
||||||
resObj.MonthRevenueModel.YearRevenueAdd = resObj.MonthRevenueModel.YearRevenueYOY ? (((resObj.MonthRevenueModel.YearRevenueAmount - resObj.MonthRevenueModel.YearRevenueYOY) / resObj.MonthRevenueModel.YearRevenueYOY) * 100).toFixed(2) : 0;
|
resObj.MonthRevenueModel.YearRevenueAdd = resObj.MonthRevenueModel.YearRevenueYOY ? (((resObj.MonthRevenueModel.YearRevenueAmount - resObj.MonthRevenueModel.YearRevenueYOY) / resObj.MonthRevenueModel.YearRevenueYOY) * 100).toFixed(2) : 0;
|
||||||
@ -649,7 +796,7 @@ export default {
|
|||||||
// 顶部的 自营、外包 的数据
|
// 顶部的 自营、外包 的数据
|
||||||
let shareList = [{}, {}];
|
let shareList = [{}, {}];
|
||||||
// 自营、外包 的数据合计
|
// 自营、外包 的数据合计
|
||||||
let sum = 0
|
let sum = 0;
|
||||||
resObj.BusinessTypeList.forEach((item) => {
|
resObj.BusinessTypeList.forEach((item) => {
|
||||||
// 同比
|
// 同比
|
||||||
if (item.data) {
|
if (item.data) {
|
||||||
@ -676,35 +823,50 @@ export default {
|
|||||||
// 分润占比
|
// 分润占比
|
||||||
if (item.name === "自营") {
|
if (item.name === "自营") {
|
||||||
shareList[0] = item;
|
shareList[0] = item;
|
||||||
sum += Number(item.value)
|
sum += Number(item.value);
|
||||||
} else if (item.name === "外包") {
|
} else if (item.name === "外包") {
|
||||||
shareList[1] = item;
|
shareList[1] = item;
|
||||||
sum += Number(item.value)
|
sum += Number(item.value);
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
|
|
||||||
console.log('sum', sum);
|
console.log('sum', sum);
|
||||||
console.log('shareListshareListshareList', shareList);
|
console.log('shareListshareListshareList', shareList);
|
||||||
|
|
||||||
|
let modalListRate = [];
|
||||||
let modalListRate = []
|
|
||||||
if (shareList && shareList.length > 0) {
|
if (shareList && shareList.length > 0) {
|
||||||
shareList.forEach((item) => {
|
shareList.forEach((item) => {
|
||||||
modalListRate.push((Number(item.value) / sum * 100).toFixed(2))
|
modalListRate.push((Number(item.value) / sum * 100).toFixed(2));
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
this.modalRateList = modalListRate
|
|
||||||
|
|
||||||
|
const moneyRateList = [
|
||||||
this.moneyRateList = [
|
|
||||||
Number(shareList[0].value),
|
Number(shareList[0].value),
|
||||||
Number(shareList[1].value)
|
Number(shareList[1].value)
|
||||||
];
|
];
|
||||||
this.profitSharingList = shareList
|
|
||||||
|
// 缓存数据
|
||||||
|
this.monthDataCache[monthKey] = {
|
||||||
|
topShowData: resObj,
|
||||||
|
moneyRateList: moneyRateList,
|
||||||
|
profitSharingList: shareList,
|
||||||
|
modalRateList: modalListRate
|
||||||
|
};
|
||||||
|
|
||||||
|
// 设置当前数据
|
||||||
|
this.modalRateList = modalListRate;
|
||||||
|
this.moneyRateList = moneyRateList;
|
||||||
|
this.profitSharingList = shareList;
|
||||||
console.log('profitSharingListprofitSharingListprofitSharingList', this.profitSharingList);
|
console.log('profitSharingListprofitSharingListprofitSharingList', this.profitSharingList);
|
||||||
console.log('moneyRateListmoneyRateListmoneyRateList', this.moneyRateList);
|
console.log('moneyRateListmoneyRateListmoneyRateList', this.moneyRateList);
|
||||||
console.log('resObjresObjresObjresObjresObj', resObj);
|
console.log('resObjresObjresObjresObjresObj', resObj);
|
||||||
this.topShowData = resObj
|
this.topShowData = resObj;
|
||||||
|
} catch (error) {
|
||||||
|
console.error('获取数据失败:', error);
|
||||||
|
} finally {
|
||||||
|
// 清除加载状态
|
||||||
|
delete this.loadingMap[monthKey];
|
||||||
|
}
|
||||||
},
|
},
|
||||||
// 拿到首页的一些基本信息
|
// 拿到首页的一些基本信息
|
||||||
handleGetIndexInfo() {
|
handleGetIndexInfo() {
|
||||||
@ -743,7 +905,15 @@ export default {
|
|||||||
const data = await request.$webGet('CommercialApi/BaseInfo/GetServerpartList', req)
|
const data = await request.$webGet('CommercialApi/BaseInfo/GetServerpartList', req)
|
||||||
console.log('sdjkajdas', data);
|
console.log('sdjkajdas', data);
|
||||||
let list = data.Result_Data.List
|
let list = data.Result_Data.List
|
||||||
uni.setStorageSync('currentService', list[0])
|
uni.setStorageSync('currentService', list[0]);
|
||||||
|
},
|
||||||
|
|
||||||
|
// uniapp小程序兼容性方法,保留作为备用
|
||||||
|
getCurrentMonthText(index) {
|
||||||
|
if (this.selectIndex === index && this.monthList[index]) {
|
||||||
|
return (this.monthList[index].month || "-") + "月对客营收";
|
||||||
|
}
|
||||||
|
return "-月对客营收";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -77,20 +77,6 @@ export default {
|
|||||||
methods: {
|
methods: {
|
||||||
// 第一行的跳转
|
// 第一行的跳转
|
||||||
handleGoFirst(item) {
|
handleGoFirst(item) {
|
||||||
if (this.isReturn) {
|
|
||||||
let _this = this
|
|
||||||
uni.showModal({
|
|
||||||
title: '温馨提示',
|
|
||||||
content: '请您授权登录后再操作。',
|
|
||||||
success(res) {
|
|
||||||
if (res.confirm) {
|
|
||||||
_this.$util.toNextRoute('redirectTo', '/pages/register/register')
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if (item.isNotice) {
|
if (item.isNotice) {
|
||||||
this.$util.toNextRoute('navigateTo', item.homeUrl)
|
this.$util.toNextRoute('navigateTo', item.homeUrl)
|
||||||
} else {
|
} else {
|
||||||
@ -122,17 +108,16 @@ export default {
|
|||||||
},
|
},
|
||||||
// 第四行的跳转
|
// 第四行的跳转
|
||||||
handleGoFourth(item) {
|
handleGoFourth(item) {
|
||||||
if (this.isReturn) {
|
//通过权限来判断是否可以点击跳转
|
||||||
let _this = this
|
let userInfo = uni.getStorageSync("vuex");
|
||||||
uni.showModal({
|
userInfo = userInfo ? JSON.parse(userInfo) : ""
|
||||||
title: '温馨提示',
|
console.log('userInfouserInfouserInfo', userInfo);
|
||||||
content: '请您授权登录后再操作。',
|
if (!userInfo.userData || !userInfo.userData.WeChat_UserId) {
|
||||||
success(res) {
|
this.$util.toNextRoute('redirectTo', '/pages/register/register')
|
||||||
if (res.confirm) {
|
} else if (userInfo.userData && userInfo.userData.WeChat_UserId && userInfo.userData.AuthorityInfo["89a1f248-2113-4d57-84b1-c2e6edb9e8ee"] !== 1) {
|
||||||
_this.$util.toNextRoute('redirectTo', '/pages/register/register')
|
uni.redirectTo({
|
||||||
}
|
url: `/pages/commercialBI/noData?type=homeIndex`,
|
||||||
}
|
});
|
||||||
})
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -264,14 +264,12 @@ export default {
|
|||||||
//通过权限来判断是否可以点击跳转
|
//通过权限来判断是否可以点击跳转
|
||||||
let userInfo = uni.getStorageSync("vuex");
|
let userInfo = uni.getStorageSync("vuex");
|
||||||
|
|
||||||
if (
|
if (userInfo && userInfo.WeChat_UserId && userInfo.AuthorityInfo["89a1f248-2113-4d57-84b1-c2e6edb9e8ee"] === 1) {
|
||||||
userInfo.userData &&
|
|
||||||
userInfo.userData.WeChat_UserId &&
|
|
||||||
userInfo.userData.AuthorityInfo[
|
|
||||||
"89a1f248-2113-4d57-84b1-c2e6edb9e8ee"
|
|
||||||
] === 1
|
|
||||||
) {
|
|
||||||
this.isReturn = false;
|
this.isReturn = false;
|
||||||
|
} else if (userInfo && userInfo.WeChat_UserId && userInfo.AuthorityInfo["89a1f248-2113-4d57-84b1-c2e6edb9e8ee"] !== 1) {
|
||||||
|
uni.redirectTo({
|
||||||
|
url: `/pages/commercialBI/noData?type=homeIndex`,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user