From 3bf7e0a813b96d29f1d11b9419da0603131dd0f6 Mon Sep 17 00:00:00 2001 From: ylj20011123 Date: Fri, 24 Oct 2025 10:08:30 +0800 Subject: [PATCH] update --- .../components/ProductReport.vue | 87 ++++++++++--------- .../components/TransactionReport.vue | 77 ++++++++++++---- .../js_sdk/u-charts/config-ucharts.js | 10 +-- 3 files changed, 110 insertions(+), 64 deletions(-) diff --git a/pages/DigitalIntelligenceDashboard/components/ProductReport.vue b/pages/DigitalIntelligenceDashboard/components/ProductReport.vue index 436dfb2..f5ef602 100644 --- a/pages/DigitalIntelligenceDashboard/components/ProductReport.vue +++ b/pages/DigitalIntelligenceDashboard/components/ProductReport.vue @@ -47,13 +47,6 @@ - - - - {{ item.name }} - {{ item.percentage }}% - - @@ -107,27 +100,27 @@ - {{ item.type }} + {{ index + 1 }} - {{ item.code }} + {{ item.COMMODITY_BARCODE }} - {{ item.name }} + {{ item.COMMODITY_NAME }} 销量 - {{ formatNumber(item.sales) }} + {{ item.SELLCOUNT ? item.SELLCOUNT.toLocaleString() : "" }} 销售额 - ¥{{ formatMoney(item.revenue) }} + ¥{{ item.FACTAMOUNT ? item.FACTAMOUNT.toLocaleString() : "" }} @@ -154,17 +147,9 @@ export default { productTypes: 12, // 商品类型分布数据 - productTypeData: [ - { name: '保健品', value: 35, percentage: 35, color: '#576EFF' }, - { name: '茶叶', value: 28, percentage: 28, color: '#52C41A' }, - { name: '食品', value: 20, percentage: 20, color: '#FAAD14' }, - { name: '饮品', value: 12, percentage: 12, color: '#FF7875' }, - { name: '其他', value: 5, percentage: 5, color: '#B37FEB' } - ], - + productTypeData: [], // 销量排行榜数据 salesRankingData: [], - // 销售趋势数据 trendData: { categories: ['1日', '5日', '10日', '15日', '20日', '25日', '30日'], @@ -172,14 +157,7 @@ export default { revenueData: [100, 200, 300, 400, 500, 600, 700] }, - productList: [ - { type: '保健品', code: 'YN001', name: '云南白药牙膏', sales: 3456, revenue: 456789 }, - { type: '茶叶', code: 'PU002', name: '普洱茶饼', sales: 2890, revenue: 567890 }, - { type: '食品', code: 'FH003', name: '鲜花饼', sales: 2345, revenue: 345678 }, - { type: '饮品', code: 'KF004', name: '云南咖啡', sales: 1876, revenue: 234567 }, - { type: '保健品', code: 'SQ005', name: '三七粉', sales: 1567, revenue: 456789 }, - { type: '工艺品', code: 'YS006', name: '玉石手镯', sales: 1234, revenue: 345678 } - ] + productList: [] } }, props: { @@ -188,7 +166,6 @@ export default { default: 0 } }, - computed: { // 饼图数据 pieChartData() { @@ -205,11 +182,10 @@ export default { // 饼图配置 pieChartOpts() { return { - color: this.productTypeData.map(item => item.color), padding: [5, 5, 5, 5], dataLabel: true, legend: { - show: false + show: true }, extra: { pie: { @@ -229,7 +205,7 @@ export default { barChartData() { return { categories: this.salesRankingData.map(item => - item.name + this.formatXAxisLabel(item.name) ), series: [{ name: '销量', @@ -282,6 +258,9 @@ export default { data: yAxisData }] }, + categoriesReal: this.salesRankingData.map(item => + item.name + ), extra: { column: { type: 'group', @@ -349,15 +328,40 @@ export default { this.handleGetAllData() }, methods: { - SalesRankingOfProducts() { - console.log('1111'); - return item.name + ':' + item.data + '件' + // 格式化X轴标签文字 + formatXAxisLabel(name) { + if (!name) return ''; + // 如果名称超过4个字符,截取并添加省略号 + return name.length > 4 ? name.substring(0, 4) + '...' : name; }, // 获取整个组件的数据 handleGetAllData() { + // 拿到商品类型分布 + this.handleGetShopTypeDistribution() // 拿到商品销售排行榜 this.handleGetTopSalesRank() }, + // 拿到商品类型分布 + async handleGetShopTypeDistribution() { + const req = { + ProvinceCode: '530000', + StatisticsMonth: '202509', + type: 'encryption' + } + const data = await request.$webPost( + "CommercialApi/SupplyChain/GetWelFareSummary", + req + ); + console.log('商品类型分布', data); + let list = data.Result_Data.WelFareGoodsTypeList + let res = [] + if (list && list.length > 0) { + list.forEach((item) => { + res.push({ name: item.GoodsTypeName, value: item.GoodsCount }) + }) + } + this.productTypeData = res + }, // 拿到商品销售排行榜 async handleGetTopSalesRank() { const req = { @@ -378,6 +382,7 @@ export default { }) } this.salesRankingData = res + this.productList = list }, diff --git a/pages/DigitalIntelligenceDashboard/components/TransactionReport.vue b/pages/DigitalIntelligenceDashboard/components/TransactionReport.vue index e09cade..ac494ef 100644 --- a/pages/DigitalIntelligenceDashboard/components/TransactionReport.vue +++ b/pages/DigitalIntelligenceDashboard/components/TransactionReport.vue @@ -78,16 +78,6 @@ - - - - 订单量 - - - - 交易额(÷1000) - - @@ -175,6 +165,7 @@