diff --git a/src/views/modules/reportList/FullYearCalendarCoin.vue b/src/views/modules/reportList/FullYearCalendarCoin.vue index 369a305..4a2f304 100644 --- a/src/views/modules/reportList/FullYearCalendarCoin.vue +++ b/src/views/modules/reportList/FullYearCalendarCoin.vue @@ -212,25 +212,36 @@ export default { }, methods: { getAmount(d, index, month) { - - // 定义所有可能的匹配规则 + if (!month || !month.total || !Array.isArray(month.total)) { + return "0"; + } + + if (d.val === "other") { + const list = month.total.filter(item => { + return ( + item.type === d.realTitle && + (item.payMethod === "" || item.payMethod === "其他") + ); + }); + + if (!list.length) { + return "0"; + } + + return list.reduce((sum, item) => { + const val = Number(item.amount || 0); + return sum + (isNaN(val) ? 0 : val); + }, 0); + } + const matchRules = [ - item => { - // 例如:当类型是特定值时,启用特殊匹配 - if (d.val == "other" && item.payMethod == "") { - return `${item.type}` === d.realTitle; - } - return false; - }, item => item.type === d.title, item => item.type === d.realTitle, item => `${item.payMethod}${item.type}` === d.realTitle, item => `${item.type}${item.payMethod}` === d.realTitle, item => `${item.type}${item.goodsType}` === d.realTitle - // 更复杂的条件组合 ]; - // 依次检查每个规则,返回第一个匹配项 for (const rule of matchRules) { const matchedItem = month.total.find(rule); if (matchedItem) { @@ -238,7 +249,6 @@ export default { } } - // 没有匹配项时返回空字符串 return "0"; }, async handleExportAll() { diff --git a/static/config/index.js b/static/config/index.js index 493669f..274f935 100644 --- a/static/config/index.js +++ b/static/config/index.js @@ -6,7 +6,7 @@ // api接口请求地址 // window.SITE_CONFIG['baseUrl'] = 'https://api.nuttyreading.com'; // 线上正式环境 - window.SITE_CONFIG['baseUrl'] = 'http://192.168.110.100:9200/pb'; //川 + window.SITE_CONFIG['baseUrl'] = 'http://192.168.110.100:9200/pb'; // 川 // cdn地址 = 域名 + 版本号 window.SITE_CONFIG['domain'] = './'; // 域名