diff --git a/pages/DigitalIntelligenceDashboard/components/BrandDetail.vue b/pages/DigitalIntelligenceDashboard/components/BrandDetail.vue index 5ecde7d..9839369 100644 --- a/pages/DigitalIntelligenceDashboard/components/BrandDetail.vue +++ b/pages/DigitalIntelligenceDashboard/components/BrandDetail.vue @@ -38,7 +38,7 @@ - diff --git a/pages/DigitalIntelligenceDashboard/components/BusinessCase.vue b/pages/DigitalIntelligenceDashboard/components/BusinessCase.vue index bbf97a7..994f2b8 100644 --- a/pages/DigitalIntelligenceDashboard/components/BusinessCase.vue +++ b/pages/DigitalIntelligenceDashboard/components/BusinessCase.vue @@ -7,8 +7,7 @@ - - + @@ -53,7 +51,7 @@ export default { { label: "客单量", value: 2 }, { label: "客单均价", value: 3 } ], - selectTab: 1, // 当前选中的Tab + selectTab: 3, // 当前选中的Tab // 当前请求来的实际数据 realData: {}, diff --git a/pages/DigitalIntelligenceDashboard/components/CustomerConsumptionPreferences.vue b/pages/DigitalIntelligenceDashboard/components/CustomerConsumptionPreferences.vue index 71f9f0d..279eaba 100644 --- a/pages/DigitalIntelligenceDashboard/components/CustomerConsumptionPreferences.vue +++ b/pages/DigitalIntelligenceDashboard/components/CustomerConsumptionPreferences.vue @@ -2,7 +2,8 @@ - 客群消费偏好 + + 近10日单品营收Top5 @@ -62,7 +63,8 @@ export default { name: '客单占比', data: this.rawData.seriesData } - ] + ], + } }, @@ -106,7 +108,8 @@ export default { activeBgOpacity: 0.08, barBorderRadius: [4, 4, 0, 0] } - } + }, + realData: this.rawData.realData } } }, @@ -129,14 +132,23 @@ export default { methods: { // 获取客群消费偏好数据 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 = { - 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可以在这里添加 + startDate: moment().subtract(10, 'd').format('YYYY-MM-DD'), + endDate: moment().format('YYYY-MM-DD'), + 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 const data = await this.getBusinessTradeRevenue(req); + + + this.isLoading = false // 处理数据 @@ -146,7 +158,7 @@ export default { // 发起API请求获取业态客单偏好数据 async getBusinessTradeRevenue(params) { const data = await request.$webGet( - "CommercialApi/Revenue/GetBusinessTradeRevenue", + "EShangApiMain/Sales/GetCommodityTypeSummary", params ); return data || {} @@ -158,13 +170,23 @@ export default { let seriesData = [] let realData = [] + console.log('datadatadadasda321312312', data); + + // 处理数据:获取业态客单偏好数据 - if (data.BusinessTradeRank && data.BusinessTradeRank.length > 0) { - let list = data.BusinessTradeRank.slice(0, 5) // 只取前10条 + // if (data.BusinessTradeRank && data.BusinessTradeRank.length > 0) { + 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) => { - category.push(item.name) - seriesData.push(Number(item.value)) - realData.push(item.value) + // category.push(item.name) + // seriesData.push(Number(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 } }, + /** + * 对象数组排序方法 + * @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 + }); + } } } diff --git a/pages/DigitalIntelligenceDashboard/components/MemberMall.vue b/pages/DigitalIntelligenceDashboard/components/MemberMall.vue index 6a47836..afa440d 100644 --- a/pages/DigitalIntelligenceDashboard/components/MemberMall.vue +++ b/pages/DigitalIntelligenceDashboard/components/MemberMall.vue @@ -64,7 +64,7 @@ 会员总销售额/元 - {{ formatMoney(memberData.totalSalesAmount || 0) }} + {{ memberData.totalSalesAmount }} @@ -104,19 +104,19 @@ - {{ formatMoney(memberData.avgAmount || 0) }} + {{ memberData.avgAmount || 0 }} + 人均消费 + + + + {{ (memberData.repurchaseRate || 0) }} 客单价 - {{ (memberData.repurchaseRate || 0) + '%' }} + {{ (memberData.totalAmount || 0) + '%' }} 会员复购率 - - - {{ formatMoney(memberData.totalAmount || 0) }} - 总销售额 - @@ -186,22 +186,22 @@ export default { async getMemberMallData(params) { // 写死数据返回 const mockData = { - totalMembers: 12733, - monthNewMembers: 56, - newMembersCount: 94, - openCount: 2716, - newPeopleCount: 624, - visitCount: 884, - consumptionCount: 133, - totalSalesAmount: 27734.10, - unionMembers: 512, - memberRatio: 4.02, - conversionRate: 15.06, - growthRate: 0.74, - buyPeopleCount: 23, - avgAmount: 208.53, - repurchaseRate: 29.17, - totalAmount: 1205.83 + totalMembers: 15071, + monthNewMembers: 146, + newMembersCount: 270, + openCount: 3203, + newPeopleCount: 757, + visitCount: 1914, + consumptionCount: 104, + totalSalesAmount: '47, 550.60', + unionMembers: 1782, + memberRatio: 11.82, + conversionRate: 32.17, + growthRate: 0.97, + buyPeopleCount: 99, + avgAmount: 480.31, + repurchaseRate: 461.66, + totalAmount: 2.02 } return mockData || {} diff --git a/pages/DigitalIntelligenceDashboard/components/OverviewOfServiceArea.vue b/pages/DigitalIntelligenceDashboard/components/OverviewOfServiceArea.vue index 08e85d7..f93bf5a 100644 --- a/pages/DigitalIntelligenceDashboard/components/OverviewOfServiceArea.vue +++ b/pages/DigitalIntelligenceDashboard/components/OverviewOfServiceArea.vue @@ -25,6 +25,10 @@ {{ serviceData.WaterStationCount || 0 }} 加水站/座 + + 24 + 加油站/座 + @@ -41,6 +45,8 @@ {{ serviceData.ClosedCount || 0 }} 关停/座 + + diff --git a/pages/DigitalIntelligenceDashboard/components/PreferenceType.vue b/pages/DigitalIntelligenceDashboard/components/PreferenceType.vue index 12af70a..7c631ad 100644 --- a/pages/DigitalIntelligenceDashboard/components/PreferenceType.vue +++ b/pages/DigitalIntelligenceDashboard/components/PreferenceType.vue @@ -58,12 +58,12 @@ export default { return { categories: this.rawData.category.map(item => item.name), series: [ + // { + // name: '男性', + // data: this.rawData.seriesDataMan + // }, { - name: '男性', - data: this.rawData.seriesDataMan - }, - { - name: '女性', + name: '偏好类型', data: this.rawData.seriesData } ] @@ -128,15 +128,22 @@ export default { methods: { // 获取偏好类型数据 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 = { - 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 + ProvinceCode: '530000', + StatisticsDate: moment().subtract(1, 'd').format('YYYY-MM-DD'), } + + this.isLoading = true const data = await this.getCustomerSaleRatio(req); this.isLoading = false @@ -148,7 +155,8 @@ export default { // 发起API请求获取客群消费偏好数据 async getCustomerSaleRatio(params) { const data = await request.$webGet( - "CommercialApi/Customer/GetCustomerSaleRatio", + // "CommercialApi/Customer/GetCustomerSaleRatio", + "CommercialApi/Revenue/GetBusinessTradeRevenue", params ); return data || {} @@ -161,21 +169,36 @@ export default { let seriesDataMan = [] let max = 0 + console.log('datadatadatadata', data); + + // 处理数据:获取客群消费偏好数据 - let list = data.CustomerSaleList || [] + // let list = data.CustomerSaleList || [] + let list = data.BusinessTradeRank || [] if (list && list.length > 0) { list.forEach((item) => { - // 计算最大值 - if (item.FemaleRatio > max) { - max = item.FemaleRatio - } - if (item.MaleRatio > max) { - max = item.MaleRatio + + + if (Number(item.value) > max) { + max = Number(item.value) } - category.push({ name: item.BusinessTradeName, max: 100 }) - seriesData.push(Number(item.FemaleRatio)) - seriesDataMan.push(Number(item.MaleRatio)) + + // category.push({ name: item.BusinessTradeName, max: 100 }) + 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)) }) } diff --git a/pages/DigitalIntelligenceDashboard/components/RegionalRevenue.vue b/pages/DigitalIntelligenceDashboard/components/RegionalRevenue.vue index 818bd14..2964116 100644 --- a/pages/DigitalIntelligenceDashboard/components/RegionalRevenue.vue +++ b/pages/DigitalIntelligenceDashboard/components/RegionalRevenue.vue @@ -163,6 +163,7 @@ export default { let seriesData = [] let legendData = [] + console.log('dadasdjifhdlsk', data); // 处理数据:获取区域营收占比数据 if (data && data.length > 0) { @@ -180,12 +181,12 @@ export default { let percentage = Number(((subItem.TotalRevenue.Revenue_Amount / sum) * 100).toFixed(2)) seriesData.push({ - name: subItem.Serverpart_Name, + name: subItem.Serverpart_Name.split('管理单元')[0], value: revenueAmount }) legendData.push({ - name: subItem.Serverpart_Name, + name: subItem.Serverpart_Name.split('管理单元')[0], value: percentage + '%' }) }) diff --git a/pages/DigitalIntelligenceDashboard/components/SupplierListBox.vue b/pages/DigitalIntelligenceDashboard/components/SupplierListBox.vue index 8beacc7..700b9f2 100644 --- a/pages/DigitalIntelligenceDashboard/components/SupplierListBox.vue +++ b/pages/DigitalIntelligenceDashboard/components/SupplierListBox.vue @@ -10,28 +10,32 @@ - 经销商/家 - {{ supplierObj.dealer || - 0 }} + 电商及工会福利/家 + + 14 - 品牌方/家 - {{ supplierObj.brandSide - || 0 }} + 绿色云品品牌厂家/家 + + 14 - 自有品牌水/家 - {{ - supplierObj.privateLabelWater || 0 }} + 自有水品牌厂家/家 + + 2 - 零售批发类/家 - {{ - supplierObj.retailAndWholesale || 0 }} + 快消品零售批发/家 + + 28 @@ -122,7 +126,7 @@ export default { const req = { ProvinceCode: "530000", type: 'encryption', - StatisticsMonth: this.selectTime ? moment(this.selectTime).format('YYYYMM') : "202505", + StatisticsMonth: "202505", } // 这里使用模拟数据,实际应该调用真实的API diff --git a/pages/DigitalIntelligenceDashboard/components/ThisMonthBenefits.vue b/pages/DigitalIntelligenceDashboard/components/ThisMonthBenefits.vue index eeda92b..4f91988 100644 --- a/pages/DigitalIntelligenceDashboard/components/ThisMonthBenefits.vue +++ b/pages/DigitalIntelligenceDashboard/components/ThisMonthBenefits.vue @@ -11,7 +11,7 @@ - + diff --git a/pages/DigitalIntelligenceDashboard/components/TradingAlert.vue b/pages/DigitalIntelligenceDashboard/components/TradingAlert.vue index 3e12a7f..b6350d9 100644 --- a/pages/DigitalIntelligenceDashboard/components/TradingAlert.vue +++ b/pages/DigitalIntelligenceDashboard/components/TradingAlert.vue @@ -222,6 +222,9 @@ export default { width: 30%; font-size: 24rpx; color: #666; + text-overflow: ellipsis; + overflow: hidden; + white-space: nowrap; } .item-type { diff --git a/pages/DigitalIntelligenceDashboard/components/TrendOfTrafficFlow.vue b/pages/DigitalIntelligenceDashboard/components/TrendOfTrafficFlow.vue index 81ad9ee..6dc9546 100644 --- a/pages/DigitalIntelligenceDashboard/components/TrendOfTrafficFlow.vue +++ b/pages/DigitalIntelligenceDashboard/components/TrendOfTrafficFlow.vue @@ -232,26 +232,49 @@ export default { } // 生成12个月的对比数据 - 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 }; + if (currentData && currentData.length > 0) { + currentData.forEach(item => { + const month = `${item.Statistics_Month}月`; + 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++; - } + 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 + monthlyData.push({ + month: month, + currentYearValue: currentMonthData.value, + previousYearValue: previousMonthData.value, + 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'; diff --git a/pages/DigitalIntelligenceDashboard/components/VehiclesEntering.vue b/pages/DigitalIntelligenceDashboard/components/VehiclesEntering.vue index dddc5e8..21a7ce3 100644 --- a/pages/DigitalIntelligenceDashboard/components/VehiclesEntering.vue +++ b/pages/DigitalIntelligenceDashboard/components/VehiclesEntering.vue @@ -218,17 +218,22 @@ export default { // 当前年份数据请求 const currentReq = { 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 } // 去年数据请求 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'), - 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 } + console.log('currentReqcurrentReqcurrentReq1111', currentReq); + console.log('lastYearReqlastYearReqlastYearReq222', lastYearReq); + + + // 并行调用两个API const [currentData, lastYearData] = await Promise.all([ this.getMonthAnalysis(currentReq), diff --git a/pages/DigitalIntelligenceDashboard/components/qiun-data-charts/js_sdk/u-charts/config-ucharts.js b/pages/DigitalIntelligenceDashboard/components/qiun-data-charts/js_sdk/u-charts/config-ucharts.js index c25643d..1e06bc8 100644 --- a/pages/DigitalIntelligenceDashboard/components/qiun-data-charts/js_sdk/u-charts/config-ucharts.js +++ b/pages/DigitalIntelligenceDashboard/components/qiun-data-charts/js_sdk/u-charts/config-ucharts.js @@ -138,7 +138,7 @@ const cfu = { return `${category}\n${item.name}:${item.data}${item.name === '客单量' ? '单' : '辆'}` }, "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) { return `${item.name}\n${category}占比:${item.data}%`