update
This commit is contained in:
parent
870d96fb3c
commit
309cdacdc9
@ -38,7 +38,7 @@
|
|||||||
<ChartLoading v-if="isLoading" text="数据加载中..." />
|
<ChartLoading v-if="isLoading" text="数据加载中..." />
|
||||||
<!-- 品牌列表内容 -->
|
<!-- 品牌列表内容 -->
|
||||||
<view v-else>
|
<view v-else>
|
||||||
<view class="brand-item" v-for="(item, index) in brandListData" :key="index"
|
<view class="brand-item" v-for="(item, index) in brandListData.slice(0, 3)" :key="index"
|
||||||
:style="{ marginBottom: index + 1 === brandListData.length ? '0' : '20rpx' }">
|
:style="{ marginBottom: index + 1 === brandListData.length ? '0' : '20rpx' }">
|
||||||
<view class=" brand-left">
|
<view class=" brand-left">
|
||||||
<image class="brand-icon" :src="item.BRAND_INTRO || defaultImg" mode="aspectFill" />
|
<image class="brand-icon" :src="item.BRAND_INTRO || defaultImg" mode="aspectFill" />
|
||||||
|
|||||||
@ -7,8 +7,7 @@
|
|||||||
|
|
||||||
<!-- 营收特征分析图表 -->
|
<!-- 营收特征分析图表 -->
|
||||||
<view class="chart-container">
|
<view class="chart-container">
|
||||||
<view style="width:100%;height: 80rpx;">
|
<!-- <view style="width:100%;height: 80rpx;">
|
||||||
<!-- 选择器 -->
|
|
||||||
<picker mode="selector" :range="tabList" range-key="label" :value="getCurrentPickerIndex()"
|
<picker mode="selector" :range="tabList" range-key="label" :value="getCurrentPickerIndex()"
|
||||||
@change="handlePickerChange" class="picker-container">
|
@change="handlePickerChange" class="picker-container">
|
||||||
<view class="picker-display">
|
<view class="picker-display">
|
||||||
@ -16,8 +15,7 @@
|
|||||||
<text class="picker-arrow">▼</text>
|
<text class="picker-arrow">▼</text>
|
||||||
</view>
|
</view>
|
||||||
</picker>
|
</picker>
|
||||||
</view>
|
</view> -->
|
||||||
|
|
||||||
|
|
||||||
<view style="width:100%;height: 400rpx;">
|
<view style="width:100%;height: 400rpx;">
|
||||||
<!-- 图表加载效果 -->
|
<!-- 图表加载效果 -->
|
||||||
@ -53,7 +51,7 @@ export default {
|
|||||||
{ label: "客单量", value: 2 },
|
{ label: "客单量", value: 2 },
|
||||||
{ label: "客单均价", value: 3 }
|
{ label: "客单均价", value: 3 }
|
||||||
],
|
],
|
||||||
selectTab: 1, // 当前选中的Tab
|
selectTab: 3, // 当前选中的Tab
|
||||||
|
|
||||||
// 当前请求来的实际数据
|
// 当前请求来的实际数据
|
||||||
realData: {},
|
realData: {},
|
||||||
|
|||||||
@ -2,7 +2,8 @@
|
|||||||
<view class="customer-consumption-preferences">
|
<view class="customer-consumption-preferences">
|
||||||
<!-- 客群消费偏好标题 -->
|
<!-- 客群消费偏好标题 -->
|
||||||
<view class="section-header">
|
<view class="section-header">
|
||||||
<text class="section-title">客群消费偏好</text>
|
<!-- <text class="section-title">客群消费偏好</text> -->
|
||||||
|
<text class="section-title">近10日单品营收Top5</text>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- 客群消费偏好图表 -->
|
<!-- 客群消费偏好图表 -->
|
||||||
@ -62,7 +63,8 @@ export default {
|
|||||||
name: '客单占比',
|
name: '客单占比',
|
||||||
data: this.rawData.seriesData
|
data: this.rawData.seriesData
|
||||||
}
|
}
|
||||||
]
|
],
|
||||||
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -106,7 +108,8 @@ export default {
|
|||||||
activeBgOpacity: 0.08,
|
activeBgOpacity: 0.08,
|
||||||
barBorderRadius: [4, 4, 0, 0]
|
barBorderRadius: [4, 4, 0, 0]
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
realData: this.rawData.realData
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -129,14 +132,23 @@ export default {
|
|||||||
methods: {
|
methods: {
|
||||||
// 获取客群消费偏好数据
|
// 获取客群消费偏好数据
|
||||||
async handleGetCustomerConsumptionPreferencesData() {
|
async handleGetCustomerConsumptionPreferencesData() {
|
||||||
|
// const req = {
|
||||||
|
// ProvinceCode: '530000',
|
||||||
|
// StatisticsDate: this.selectTime ? moment(this.selectTime).subtract(1, 'd').format('YYYY-MM-DD') : moment().subtract(1, 'd').format('YYYY-MM-DD'),
|
||||||
|
// ServerpartId: "" // 暂时为空,如果需要传入服务区ID可以在这里添加
|
||||||
|
// }
|
||||||
const req = {
|
const req = {
|
||||||
ProvinceCode: '530000',
|
startDate: moment().subtract(10, 'd').format('YYYY-MM-DD'),
|
||||||
StatisticsDate: this.selectTime ? moment(this.selectTime).subtract(1, 'd').format('YYYY-MM-DD') : moment().subtract(1, 'd').format('YYYY-MM-DD'),
|
endDate: moment().format('YYYY-MM-DD'),
|
||||||
ServerpartId: "" // 暂时为空,如果需要传入服务区ID可以在这里添加
|
ServerpartShopIds: "5670,5527,5548,5519,5520,5547,5531,5546,7078,7248,5522,6974,5549,5529,5528,7069,5521,6033,5530,5502,6972,7092,7091,6971,5759,5760,6968,6969,7089,7088,6970,7090,5747,6044,6045,6046,6047,7156,5746,7160,6950,6952,6031,6026,5715,5716,6056,6052,6050,6053,6057,6051,6058,6054,6939,6940,7064,7065,6936,6937,6948,6949,5736,6954,7129,7134,7132,7133,5733,5735,7208,7212,5732,5740,5741,5742,7357,7356,5738,5739"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
this.isLoading = true
|
this.isLoading = true
|
||||||
const data = await this.getBusinessTradeRevenue(req);
|
const data = await this.getBusinessTradeRevenue(req);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
this.isLoading = false
|
this.isLoading = false
|
||||||
|
|
||||||
// 处理数据
|
// 处理数据
|
||||||
@ -146,7 +158,7 @@ export default {
|
|||||||
// 发起API请求获取业态客单偏好数据
|
// 发起API请求获取业态客单偏好数据
|
||||||
async getBusinessTradeRevenue(params) {
|
async getBusinessTradeRevenue(params) {
|
||||||
const data = await request.$webGet(
|
const data = await request.$webGet(
|
||||||
"CommercialApi/Revenue/GetBusinessTradeRevenue",
|
"EShangApiMain/Sales/GetCommodityTypeSummary",
|
||||||
params
|
params
|
||||||
);
|
);
|
||||||
return data || {}
|
return data || {}
|
||||||
@ -158,13 +170,23 @@ export default {
|
|||||||
let seriesData = []
|
let seriesData = []
|
||||||
let realData = []
|
let realData = []
|
||||||
|
|
||||||
|
console.log('datadatadadasda321312312', data);
|
||||||
|
|
||||||
|
|
||||||
// 处理数据:获取业态客单偏好数据
|
// 处理数据:获取业态客单偏好数据
|
||||||
if (data.BusinessTradeRank && data.BusinessTradeRank.length > 0) {
|
// if (data.BusinessTradeRank && data.BusinessTradeRank.length > 0) {
|
||||||
let list = data.BusinessTradeRank.slice(0, 5) // 只取前10条
|
if (data.List && data.List.length > 0) {
|
||||||
|
let list = data.List.slice(0, 5) // 只取前10条
|
||||||
|
list = this.sortByKey(list, 'Total_SellAmountRate', 'desc')
|
||||||
|
console.log('djaksdjaksdjal', list);
|
||||||
|
|
||||||
list.forEach((item) => {
|
list.forEach((item) => {
|
||||||
category.push(item.name)
|
// category.push(item.name)
|
||||||
seriesData.push(Number(item.value))
|
// seriesData.push(Number(item.value))
|
||||||
realData.push(item.value)
|
// realData.push(item.value)
|
||||||
|
category.push(item.CommodityType_Name.split(']')[1])
|
||||||
|
seriesData.push(Number(item.Total_SellAmountRate))
|
||||||
|
realData.push(item.Total_SellAmount)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -175,7 +197,24 @@ export default {
|
|||||||
realData: realData
|
realData: realData
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
/**
|
||||||
|
* 对象数组排序方法
|
||||||
|
* @param {Array} arr - 要排序的对象数组
|
||||||
|
* @param {String} key - 按哪个字段排序
|
||||||
|
* @param {String} order - 排序方式:'asc' 正序,'desc' 倒序
|
||||||
|
*/
|
||||||
|
sortByKey(arr, key, order = 'asc') {
|
||||||
|
return arr.sort((a, b) => {
|
||||||
|
const valA = a[key];
|
||||||
|
const valB = b[key];
|
||||||
|
|
||||||
|
if (valA === valB) return 0;
|
||||||
|
if (order === 'asc') {
|
||||||
|
return valA > valB ? 1 : -1;
|
||||||
|
}
|
||||||
|
return valA < valB ? 1 : -1; // desc
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@ -64,7 +64,7 @@
|
|||||||
<view class="member-consumption-item">
|
<view class="member-consumption-item">
|
||||||
<view class="member-consumption-label">会员总销售额/元</view>
|
<view class="member-consumption-label">会员总销售额/元</view>
|
||||||
<view class="member-consumption-progress2"></view>
|
<view class="member-consumption-progress2"></view>
|
||||||
<view class="member-consumption-value">{{ formatMoney(memberData.totalSalesAmount || 0) }}</view>
|
<view class="member-consumption-value">{{ memberData.totalSalesAmount }}</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
@ -104,19 +104,19 @@
|
|||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="member-overview-item">
|
<view class="member-overview-item">
|
||||||
<view class="member-overview-item-top">{{ formatMoney(memberData.avgAmount || 0) }}</view>
|
<view class="member-overview-item-top">{{ memberData.avgAmount || 0 }}</view>
|
||||||
|
<view class="member-overview-item-bottom">人均消费</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view class="member-overview-item">
|
||||||
|
<view class="member-overview-item-top">{{ (memberData.repurchaseRate || 0) }}</view>
|
||||||
<view class="member-overview-item-bottom">客单价</view>
|
<view class="member-overview-item-bottom">客单价</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="member-overview-item">
|
<view class="member-overview-item">
|
||||||
<view class="member-overview-item-top">{{ (memberData.repurchaseRate || 0) + '%' }}</view>
|
<view class="member-overview-item-top">{{ (memberData.totalAmount || 0) + '%' }}</view>
|
||||||
<view class="member-overview-item-bottom">会员复购率</view>
|
<view class="member-overview-item-bottom">会员复购率</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="member-overview-item">
|
|
||||||
<view class="member-overview-item-top">{{ formatMoney(memberData.totalAmount || 0) }}</view>
|
|
||||||
<view class="member-overview-item-bottom">总销售额</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
@ -186,22 +186,22 @@ export default {
|
|||||||
async getMemberMallData(params) {
|
async getMemberMallData(params) {
|
||||||
// 写死数据返回
|
// 写死数据返回
|
||||||
const mockData = {
|
const mockData = {
|
||||||
totalMembers: 12733,
|
totalMembers: 15071,
|
||||||
monthNewMembers: 56,
|
monthNewMembers: 146,
|
||||||
newMembersCount: 94,
|
newMembersCount: 270,
|
||||||
openCount: 2716,
|
openCount: 3203,
|
||||||
newPeopleCount: 624,
|
newPeopleCount: 757,
|
||||||
visitCount: 884,
|
visitCount: 1914,
|
||||||
consumptionCount: 133,
|
consumptionCount: 104,
|
||||||
totalSalesAmount: 27734.10,
|
totalSalesAmount: '47, 550.60',
|
||||||
unionMembers: 512,
|
unionMembers: 1782,
|
||||||
memberRatio: 4.02,
|
memberRatio: 11.82,
|
||||||
conversionRate: 15.06,
|
conversionRate: 32.17,
|
||||||
growthRate: 0.74,
|
growthRate: 0.97,
|
||||||
buyPeopleCount: 23,
|
buyPeopleCount: 99,
|
||||||
avgAmount: 208.53,
|
avgAmount: 480.31,
|
||||||
repurchaseRate: 29.17,
|
repurchaseRate: 461.66,
|
||||||
totalAmount: 1205.83
|
totalAmount: 2.02
|
||||||
}
|
}
|
||||||
|
|
||||||
return mockData || {}
|
return mockData || {}
|
||||||
|
|||||||
@ -25,6 +25,10 @@
|
|||||||
<text class="metric-value" style="color: #1aba80;">{{ serviceData.WaterStationCount || 0 }}</text>
|
<text class="metric-value" style="color: #1aba80;">{{ serviceData.WaterStationCount || 0 }}</text>
|
||||||
<text class="metric-label">加水站/座</text>
|
<text class="metric-label">加水站/座</text>
|
||||||
</view>
|
</view>
|
||||||
|
<view class="metric-card">
|
||||||
|
<text class="metric-value" style="color: #1aba80;">24</text>
|
||||||
|
<text class="metric-label">加油站/座</text>
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- 服务区类型统计 - 第三行 -->
|
<!-- 服务区类型统计 - 第三行 -->
|
||||||
@ -41,6 +45,8 @@
|
|||||||
<text class="metric-value" style="color: #757575;">{{ serviceData.ClosedCount || 0 }}</text>
|
<text class="metric-value" style="color: #757575;">{{ serviceData.ClosedCount || 0 }}</text>
|
||||||
<text class="metric-label">关停/座</text>
|
<text class="metric-label">关停/座</text>
|
||||||
</view>
|
</view>
|
||||||
|
<view class="metric-card" style="background-color: transparent;box-shadow: none;">
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- 设备设施分布图 -->
|
<!-- 设备设施分布图 -->
|
||||||
|
|||||||
@ -58,12 +58,12 @@ export default {
|
|||||||
return {
|
return {
|
||||||
categories: this.rawData.category.map(item => item.name),
|
categories: this.rawData.category.map(item => item.name),
|
||||||
series: [
|
series: [
|
||||||
|
// {
|
||||||
|
// name: '男性',
|
||||||
|
// data: this.rawData.seriesDataMan
|
||||||
|
// },
|
||||||
{
|
{
|
||||||
name: '男性',
|
name: '偏好类型',
|
||||||
data: this.rawData.seriesDataMan
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: '女性',
|
|
||||||
data: this.rawData.seriesData
|
data: this.rawData.seriesData
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
@ -128,15 +128,22 @@ export default {
|
|||||||
methods: {
|
methods: {
|
||||||
// 获取偏好类型数据
|
// 获取偏好类型数据
|
||||||
async handleGetPreferenceTypeData() {
|
async handleGetPreferenceTypeData() {
|
||||||
|
// const req = {
|
||||||
|
// statisticsType: 1,
|
||||||
|
// startMonth: this.selectTime ? moment(this.selectTime).startOf('y').format('YYYYMM') : moment().startOf('y').format('YYYYMM'),
|
||||||
|
// endMonth: this.selectTime ? moment(this.selectTime).format('YYYYMM') : moment().format('YYYYMM'),
|
||||||
|
// provinceCode: '530000',
|
||||||
|
// showTradeLevel: 1,
|
||||||
|
// fromRedis: true
|
||||||
|
// }
|
||||||
|
|
||||||
const req = {
|
const req = {
|
||||||
statisticsType: 1,
|
ProvinceCode: '530000',
|
||||||
startMonth: this.selectTime ? moment(this.selectTime).startOf('y').format('YYYYMM') : moment().startOf('y').format('YYYYMM'),
|
StatisticsDate: moment().subtract(1, 'd').format('YYYY-MM-DD'),
|
||||||
endMonth: this.selectTime ? moment(this.selectTime).format('YYYYMM') : moment().format('YYYYMM'),
|
|
||||||
provinceCode: '530000',
|
|
||||||
showTradeLevel: 1,
|
|
||||||
fromRedis: true
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
this.isLoading = true
|
this.isLoading = true
|
||||||
const data = await this.getCustomerSaleRatio(req);
|
const data = await this.getCustomerSaleRatio(req);
|
||||||
this.isLoading = false
|
this.isLoading = false
|
||||||
@ -148,7 +155,8 @@ export default {
|
|||||||
// 发起API请求获取客群消费偏好数据
|
// 发起API请求获取客群消费偏好数据
|
||||||
async getCustomerSaleRatio(params) {
|
async getCustomerSaleRatio(params) {
|
||||||
const data = await request.$webGet(
|
const data = await request.$webGet(
|
||||||
"CommercialApi/Customer/GetCustomerSaleRatio",
|
// "CommercialApi/Customer/GetCustomerSaleRatio",
|
||||||
|
"CommercialApi/Revenue/GetBusinessTradeRevenue",
|
||||||
params
|
params
|
||||||
);
|
);
|
||||||
return data || {}
|
return data || {}
|
||||||
@ -161,21 +169,36 @@ export default {
|
|||||||
let seriesDataMan = []
|
let seriesDataMan = []
|
||||||
let max = 0
|
let max = 0
|
||||||
|
|
||||||
|
console.log('datadatadatadata', data);
|
||||||
|
|
||||||
|
|
||||||
// 处理数据:获取客群消费偏好数据
|
// 处理数据:获取客群消费偏好数据
|
||||||
let list = data.CustomerSaleList || []
|
// let list = data.CustomerSaleList || []
|
||||||
|
let list = data.BusinessTradeRank || []
|
||||||
if (list && list.length > 0) {
|
if (list && list.length > 0) {
|
||||||
list.forEach((item) => {
|
list.forEach((item) => {
|
||||||
// 计算最大值
|
|
||||||
if (item.FemaleRatio > max) {
|
|
||||||
max = item.FemaleRatio
|
if (Number(item.value) > max) {
|
||||||
}
|
max = Number(item.value)
|
||||||
if (item.MaleRatio > max) {
|
|
||||||
max = item.MaleRatio
|
|
||||||
}
|
}
|
||||||
|
|
||||||
category.push({ name: item.BusinessTradeName, max: 100 })
|
|
||||||
seriesData.push(Number(item.FemaleRatio))
|
// category.push({ name: item.BusinessTradeName, max: 100 })
|
||||||
seriesDataMan.push(Number(item.MaleRatio))
|
category.push({ name: item.name, max: 100 })
|
||||||
|
seriesData.push(Number(item.value))
|
||||||
|
|
||||||
|
// // 计算最大值
|
||||||
|
// if (item.FemaleRatio > max) {
|
||||||
|
// max = item.FemaleRatio
|
||||||
|
// }
|
||||||
|
// if (item.MaleRatio > max) {
|
||||||
|
// max = item.MaleRatio
|
||||||
|
// }
|
||||||
|
|
||||||
|
// category.push({ name: item.BusinessTradeName, max: 100 })
|
||||||
|
// seriesData.push(Number(item.FemaleRatio))
|
||||||
|
// seriesDataMan.push(Number(item.MaleRatio))
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -163,6 +163,7 @@ export default {
|
|||||||
let seriesData = []
|
let seriesData = []
|
||||||
let legendData = []
|
let legendData = []
|
||||||
|
|
||||||
|
console.log('dadasdjifhdlsk', data);
|
||||||
|
|
||||||
// 处理数据:获取区域营收占比数据
|
// 处理数据:获取区域营收占比数据
|
||||||
if (data && data.length > 0) {
|
if (data && data.length > 0) {
|
||||||
@ -180,12 +181,12 @@ export default {
|
|||||||
let percentage = Number(((subItem.TotalRevenue.Revenue_Amount / sum) * 100).toFixed(2))
|
let percentage = Number(((subItem.TotalRevenue.Revenue_Amount / sum) * 100).toFixed(2))
|
||||||
|
|
||||||
seriesData.push({
|
seriesData.push({
|
||||||
name: subItem.Serverpart_Name,
|
name: subItem.Serverpart_Name.split('管理单元')[0],
|
||||||
value: revenueAmount
|
value: revenueAmount
|
||||||
})
|
})
|
||||||
|
|
||||||
legendData.push({
|
legendData.push({
|
||||||
name: subItem.Serverpart_Name,
|
name: subItem.Serverpart_Name.split('管理单元')[0],
|
||||||
value: percentage + '%'
|
value: percentage + '%'
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
@ -10,28 +10,32 @@
|
|||||||
<!-- 第一行:经销商、品牌方 -->
|
<!-- 第一行:经销商、品牌方 -->
|
||||||
<view class="supplier-message-box-top">
|
<view class="supplier-message-box-top">
|
||||||
<view class="supplier-message-box-top-item">
|
<view class="supplier-message-box-top-item">
|
||||||
<view class="supplier-message-box-top-item-label">经销商/家</view>
|
<view class="supplier-message-box-top-item-label">电商及工会福利/家</view>
|
||||||
<view class="supplier-message-box-top-item-value" style="color: #56BCE6;">{{ supplierObj.dealer ||
|
<!-- <view class="supplier-message-box-top-item-value" style="color: #56BCE6;">{{ supplierObj.dealer ||
|
||||||
0 }}</view>
|
0 }}</view> -->
|
||||||
|
<view class="supplier-message-box-top-item-value" style="color: #56BCE6;">14</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="supplier-message-box-top-item">
|
<view class="supplier-message-box-top-item">
|
||||||
<view class="supplier-message-box-top-item-label">品牌方/家</view>
|
<view class="supplier-message-box-top-item-label">绿色云品品牌厂家/家</view>
|
||||||
<view class="supplier-message-box-top-item-value" style="color: #ef5a0d;">{{ supplierObj.brandSide
|
<!-- <view class="supplier-message-box-top-item-value" style="color: #ef5a0d;">{{ supplierObj.brandSide
|
||||||
|| 0 }}</view>
|
|| 0 }}</view> -->
|
||||||
|
<view class="supplier-message-box-top-item-value" style="color: #ef5a0d;">14</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- 第二行:自有品牌水、零售批发类 -->
|
<!-- 第二行:自有品牌水、零售批发类 -->
|
||||||
<view class="supplier-message-box-top" style="margin-top: 20rpx;">
|
<view class="supplier-message-box-top" style="margin-top: 20rpx;">
|
||||||
<view class="supplier-message-box-top-item">
|
<view class="supplier-message-box-top-item">
|
||||||
<view class="supplier-message-box-top-item-label">自有品牌水/家</view>
|
<view class="supplier-message-box-top-item-label">自有水品牌厂家/家</view>
|
||||||
<view class="supplier-message-box-top-item-value" style="color: #56BCE6;">{{
|
<!-- <view class="supplier-message-box-top-item-value" style="color: #56BCE6;">{{
|
||||||
supplierObj.privateLabelWater || 0 }}</view>
|
supplierObj.privateLabelWater || 0 }}</view> -->
|
||||||
|
<view class="supplier-message-box-top-item-value" style="color: #56BCE6;">2</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="supplier-message-box-top-item">
|
<view class="supplier-message-box-top-item">
|
||||||
<view class="supplier-message-box-top-item-label">零售批发类/家</view>
|
<view class="supplier-message-box-top-item-label">快消品零售批发/家</view>
|
||||||
<view class="supplier-message-box-top-item-value" style="color: #ef5a0d;">{{
|
<!-- <view class="supplier-message-box-top-item-value" style="color: #ef5a0d;">{{
|
||||||
supplierObj.retailAndWholesale || 0 }}</view>
|
supplierObj.retailAndWholesale || 0 }}</view> -->
|
||||||
|
<view class="supplier-message-box-top-item-value" style="color: #ef5a0d;">28</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@ -122,7 +126,7 @@ export default {
|
|||||||
const req = {
|
const req = {
|
||||||
ProvinceCode: "530000",
|
ProvinceCode: "530000",
|
||||||
type: 'encryption',
|
type: 'encryption',
|
||||||
StatisticsMonth: this.selectTime ? moment(this.selectTime).format('YYYYMM') : "202505",
|
StatisticsMonth: "202505",
|
||||||
}
|
}
|
||||||
|
|
||||||
// 这里使用模拟数据,实际应该调用真实的API
|
// 这里使用模拟数据,实际应该调用真实的API
|
||||||
|
|||||||
@ -11,7 +11,7 @@
|
|||||||
<view class="core-category-box">
|
<view class="core-category-box">
|
||||||
|
|
||||||
<!-- 本月福利金发放额度 -->
|
<!-- 本月福利金发放额度 -->
|
||||||
<view class="benefits-header">
|
<!-- <view class="benefits-header">
|
||||||
<view class="benefits-left">
|
<view class="benefits-left">
|
||||||
<text class="benefits-title">本月福利金发放额度</text>
|
<text class="benefits-title">本月福利金发放额度</text>
|
||||||
</view>
|
</view>
|
||||||
@ -21,7 +21,7 @@
|
|||||||
}}</text>
|
}}</text>
|
||||||
<text class="benefits-unit">元</text>
|
<text class="benefits-unit">元</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view> -->
|
||||||
|
|
||||||
<view class="chart-container">
|
<view class="chart-container">
|
||||||
<!-- 图表加载效果 -->
|
<!-- 图表加载效果 -->
|
||||||
|
|||||||
@ -222,6 +222,9 @@ export default {
|
|||||||
width: 30%;
|
width: 30%;
|
||||||
font-size: 24rpx;
|
font-size: 24rpx;
|
||||||
color: #666;
|
color: #666;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
overflow: hidden;
|
||||||
|
white-space: nowrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
.item-type {
|
.item-type {
|
||||||
|
|||||||
@ -232,26 +232,49 @@ export default {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 生成12个月的对比数据
|
// 生成12个月的对比数据
|
||||||
for (let i = 1; i <= 12; i++) {
|
if (currentData && currentData.length > 0) {
|
||||||
const month = `${i}月`;
|
currentData.forEach(item => {
|
||||||
const currentMonthData = currentDataMap[month] || { value: 0, realValue: 0 };
|
const month = `${item.Statistics_Month}月`;
|
||||||
const previousMonthData = previousDataMap[month] || { value: 0, realValue: 0 };
|
const currentMonthData = currentDataMap[month] || { value: 0, realValue: 0 };
|
||||||
|
const previousMonthData = previousDataMap[month] || { value: 0, realValue: 0 };
|
||||||
|
|
||||||
let growthRate = '0.00';
|
let growthRate = '0.00';
|
||||||
if (previousMonthData.realValue > 0 && currentMonthData.realValue > 0) {
|
if (previousMonthData.realValue > 0 && currentMonthData.realValue > 0) {
|
||||||
growthRate = (((currentMonthData.realValue - previousMonthData.realValue) / previousMonthData.realValue) * 100).toFixed(2);
|
growthRate = (((currentMonthData.realValue - previousMonthData.realValue) / previousMonthData.realValue) * 100).toFixed(2);
|
||||||
totalGrowthRate += parseFloat(growthRate);
|
totalGrowthRate += parseFloat(growthRate);
|
||||||
validMonthCount++;
|
validMonthCount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
monthlyData.push({
|
monthlyData.push({
|
||||||
month: month,
|
month: month,
|
||||||
currentYearValue: currentMonthData.value,
|
currentYearValue: currentMonthData.value,
|
||||||
previousYearValue: previousMonthData.value,
|
previousYearValue: previousMonthData.value,
|
||||||
growthRate: growthRate
|
growthRate: growthRate
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// for (let i = 1; i <= 12; i++) {
|
||||||
|
// const month = `${i}月`;
|
||||||
|
// const currentMonthData = currentDataMap[month] || { value: 0, realValue: 0 };
|
||||||
|
// const previousMonthData = previousDataMap[month] || { value: 0, realValue: 0 };
|
||||||
|
|
||||||
|
// let growthRate = '0.00';
|
||||||
|
// if (previousMonthData.realValue > 0 && currentMonthData.realValue > 0) {
|
||||||
|
// growthRate = (((currentMonthData.realValue - previousMonthData.realValue) / previousMonthData.realValue) * 100).toFixed(2);
|
||||||
|
// totalGrowthRate += parseFloat(growthRate);
|
||||||
|
// validMonthCount++;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// monthlyData.push({
|
||||||
|
// month: month,
|
||||||
|
// currentYearValue: currentMonthData.value,
|
||||||
|
// previousYearValue: previousMonthData.value,
|
||||||
|
// growthRate: growthRate
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
|
||||||
// 计算平均增长率
|
// 计算平均增长率
|
||||||
const averageGrowth = validMonthCount > 0 ? (totalGrowthRate / validMonthCount).toFixed(2) : '0.00';
|
const averageGrowth = validMonthCount > 0 ? (totalGrowthRate / validMonthCount).toFixed(2) : '0.00';
|
||||||
|
|
||||||
|
|||||||
@ -218,17 +218,22 @@ export default {
|
|||||||
// 当前年份数据请求
|
// 当前年份数据请求
|
||||||
const currentReq = {
|
const currentReq = {
|
||||||
StartDate: this.selectTime ? moment(this.selectTime).startOf('y').format('YYYY-MM-DD') : moment().startOf('y').format('YYYY-MM-DD'),
|
StartDate: this.selectTime ? moment(this.selectTime).startOf('y').format('YYYY-MM-DD') : moment().startOf('y').format('YYYY-MM-DD'),
|
||||||
EndDate: this.selectTime ? moment(this.selectTime).endOf('m').format('YYYY-MM-DD') : moment().endOf('m').format('YYYY-MM-DD'),
|
EndDate: this.selectTime ? moment(this.selectTime).endOf('M').format('YYYY-MM-DD') : moment().endOf('M').format('YYYY-MM-DD'),
|
||||||
ProvinceCode: 530000
|
ProvinceCode: 530000
|
||||||
}
|
}
|
||||||
|
|
||||||
// 去年数据请求
|
// 去年数据请求
|
||||||
const lastYearReq = {
|
const lastYearReq = {
|
||||||
StartDate: this.selectTime ? moment(this.selectTime).subtract(1, 'y').startOf('y').format('YYYY-MM-DD') : moment().subtract(1, 'y').startOf('y').format('YYYY-MM-DD'),
|
StartDate: this.selectTime ? moment(this.selectTime).subtract(1, 'y').startOf('y').format('YYYY-MM-DD') : moment().subtract(1, 'y').startOf('y').format('YYYY-MM-DD'),
|
||||||
EndDate: this.selectTime ? moment(this.selectTime).subtract(1, 'y').endOf('y').format('YYYY-MM-DD') : moment().subtract(1, 'y').endOf('y').format('YYYY-MM-DD'),
|
EndDate: this.selectTime ? moment(this.selectTime).subtract(1, 'y').endOf('M').format('YYYY-MM-DD') : moment().subtract(1, 'y').endOf('M').format('YYYY-MM-DD'),
|
||||||
ProvinceCode: 530000
|
ProvinceCode: 530000
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log('currentReqcurrentReqcurrentReq1111', currentReq);
|
||||||
|
console.log('lastYearReqlastYearReqlastYearReq222', lastYearReq);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 并行调用两个API
|
// 并行调用两个API
|
||||||
const [currentData, lastYearData] = await Promise.all([
|
const [currentData, lastYearData] = await Promise.all([
|
||||||
this.getMonthAnalysis(currentReq),
|
this.getMonthAnalysis(currentReq),
|
||||||
|
|||||||
@ -138,7 +138,7 @@ const cfu = {
|
|||||||
return `${category}\n${item.name}:${item.data}${item.name === '客单量' ? '单' : '辆'}`
|
return `${category}\n${item.name}:${item.data}${item.name === '客单量' ? '单' : '辆'}`
|
||||||
},
|
},
|
||||||
"customerConsumptionPreferencesChart": function (item, category, index, opts) {
|
"customerConsumptionPreferencesChart": function (item, category, index, opts) {
|
||||||
return `${category}\n${item.name}:${item.data}%`
|
return `${category}\n${item.name}:${item.data}%,${opts.realData[index].toLocaleString()}元`
|
||||||
},
|
},
|
||||||
"PreferenceType": function (item, category, index, opts) {
|
"PreferenceType": function (item, category, index, opts) {
|
||||||
return `${item.name}\n${category}占比:${item.data}%`
|
return `${item.name}\n${category}占比:${item.data}%`
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user