diff --git a/src/components/u-charts/config-ucharts.js b/src/components/u-charts/config-ucharts.js index c2e4ca8..3ddd6f6 100644 --- a/src/components/u-charts/config-ucharts.js +++ b/src/components/u-charts/config-ucharts.js @@ -135,7 +135,7 @@ const cfu = { }, // 食堂喜好分析饼图提示格式化 canteenPieTooltip: function (item, category, index, opts) { - return `分类:${item.classifyName}/br/购买总人数:${item.payUserCount}/br/购买总金额:${ + return `分类:${item.classifyName || ""}/br/购买总人数:${item.payUserCount}/br/购买总金额:${ Number(item.totalPrice) / 100.0 }元/br/购买总次数:${item.timeCount}` }, diff --git a/src/pages/tabbar/canteenAnalyse.vue b/src/pages/tabbar/canteenAnalyse.vue index d5caf57..11b330f 100644 --- a/src/pages/tabbar/canteenAnalyse.vue +++ b/src/pages/tabbar/canteenAnalyse.vue @@ -17,8 +17,8 @@ 个人菜品喜好排行 - - + + 排名 菜品名称 分类 @@ -38,7 +38,7 @@ - + {{ item.payCount }}次 @@ -96,7 +96,7 @@ const pieChartOpts = { margin: 2, fontSize: 14, lineHeight: 14, - itemGap: 10, + itemGap: 4, }, extra: { pie: { @@ -170,10 +170,10 @@ const getPieChartData = async () => { if (code != 0) return uni.showToast({ title: msg || "数据获取失败", icon: "none" }) const seriesData = data.map((item: any, index: number) => { return { - index: index, - name: item.classifyName, - value: Number(item.payUserCount), - labelText: `${item.classifyName} ${item.payUserCount}次`, + index, + name: item.classifyName || "", + value: Number(item.payCount), + labelText: `${item.classifyName || ""} ${item.payUserCount}次`, ...item, } })