259 lines
8.3 KiB
JavaScript
259 lines
8.3 KiB
JavaScript
"use strict";
|
||
const common_vendor = require("../../../common/vendor.js");
|
||
const utils_util = require("../../../utils/util.js");
|
||
const echarts = require("../../../uni_modules/lime-echart/static/echarts.min.js");
|
||
const _sfc_main = {
|
||
name: "zysj-view",
|
||
data() {
|
||
return {
|
||
option1: {
|
||
legend: {
|
||
show: true,
|
||
data: ["营业收入", "净利润"]
|
||
},
|
||
grid: {
|
||
left: "2%",
|
||
right: "2%",
|
||
top: "5%",
|
||
bottom: "30%"
|
||
},
|
||
xAxis: {
|
||
type: "category",
|
||
data: [],
|
||
axisLabel: {
|
||
// interval:0
|
||
}
|
||
},
|
||
yAxis: [
|
||
{
|
||
type: "value",
|
||
name: "营收(亿)",
|
||
position: "left",
|
||
alignTicks: true,
|
||
axisLine: {
|
||
onZero: false
|
||
}
|
||
},
|
||
{
|
||
type: "value",
|
||
name: "利润(亿)",
|
||
position: "right",
|
||
alignTicks: true,
|
||
axisLine: {
|
||
onZero: false
|
||
}
|
||
}
|
||
],
|
||
dataZoom: [{
|
||
type: "slider"
|
||
}],
|
||
series: [
|
||
{
|
||
type: "bar",
|
||
name: "营业收入",
|
||
data: [],
|
||
yAxisIndex: 0
|
||
},
|
||
{
|
||
type: "line",
|
||
name: "净利润",
|
||
data: [],
|
||
yAxisIndex: 1
|
||
}
|
||
]
|
||
},
|
||
option2: {
|
||
title: {
|
||
text: "",
|
||
textStyle: {
|
||
fontSize: 12
|
||
}
|
||
},
|
||
legend: {
|
||
show: true
|
||
},
|
||
grid: {
|
||
left: 0,
|
||
right: 0,
|
||
top: "5%",
|
||
bottom: "5%"
|
||
},
|
||
series: [
|
||
{
|
||
data: [],
|
||
type: "pie",
|
||
center: ["50%", "50%"],
|
||
label: {
|
||
formatter: "{d}%"
|
||
}
|
||
}
|
||
]
|
||
},
|
||
getChgRateStr: utils_util.getChgRateStr,
|
||
getNumStr: utils_util.getNumStr
|
||
};
|
||
},
|
||
props: {
|
||
stockInfo: Object,
|
||
financialMetricsInfo: Object,
|
||
barCategoryList: Array,
|
||
barList: Array,
|
||
lineList: Array,
|
||
//折线图数据
|
||
productClassificationList: Array
|
||
},
|
||
watch: {
|
||
barCategoryList(newValue) {
|
||
this.option1.xAxis.data = newValue;
|
||
},
|
||
barList(newValue) {
|
||
this.option1.series[0].data = newValue;
|
||
this.barLineInit();
|
||
},
|
||
lineList(newValue) {
|
||
this.option1.series[1].data = newValue;
|
||
this.barLineInit();
|
||
},
|
||
productClassificationList(newValue) {
|
||
let data = newValue[0].products;
|
||
this.option2.title.text = "主营业务构成(" + newValue[0].report_type + ")";
|
||
let pieList = [];
|
||
for (let item of data) {
|
||
pieList.push({
|
||
name: item.content,
|
||
value: item.revenue_ratio.toFixed(2)
|
||
});
|
||
}
|
||
this.option2.series[0].data = pieList;
|
||
this.pieInit();
|
||
}
|
||
},
|
||
methods: {
|
||
/**
|
||
* 柱状图,折线图初始化
|
||
*/
|
||
async barLineInit() {
|
||
const chart = await this.$refs.chartRef1.init(echarts);
|
||
let that = this;
|
||
setTimeout(function() {
|
||
chart.setOption(that.option1);
|
||
}, 2e3);
|
||
},
|
||
/**
|
||
* 饼状图初始化
|
||
*/
|
||
async pieInit() {
|
||
const chart = await this.$refs.chartRef2.init(echarts);
|
||
let that = this;
|
||
setTimeout(function() {
|
||
chart.setOption(that.option2);
|
||
}, 2e3);
|
||
},
|
||
/**
|
||
* 获取资产负债状态
|
||
*/
|
||
getDebtStatusText(value) {
|
||
if (value < 40)
|
||
return { text: "安全", color: "green" };
|
||
if (value < 60)
|
||
return { text: "适中", color: "gold" };
|
||
if (value < 70)
|
||
return { text: "偏高", color: "orange" };
|
||
return { text: "风险", color: "red" };
|
||
},
|
||
/**
|
||
* 获取营收增长状态
|
||
*/
|
||
getGrowthStatus(value) {
|
||
if (value > 30)
|
||
return { text: "高速增长", color: "green" };
|
||
if (value > 10)
|
||
return { text: "稳健增长", color: "gold" };
|
||
if (value > 0)
|
||
return { text: "低速增长", color: "orange" };
|
||
if (value > -10)
|
||
return { text: "小幅下滑", color: "orange" };
|
||
return { text: "大幅下滑", color: "red" };
|
||
},
|
||
/**
|
||
* 获取ROE状态
|
||
*/
|
||
getROEStatus(value) {
|
||
if (value > 20)
|
||
return { text: "优秀", color: "green" };
|
||
if (value > 15)
|
||
return { text: "良好", color: "gold" };
|
||
if (value > 10)
|
||
return { text: "一般", color: "orange" };
|
||
return { text: "较低", color: "red" };
|
||
},
|
||
itemClick(index) {
|
||
common_vendor.index.navigateTo({
|
||
url: `/pagesStock/stockCenterDetails/cwDetails?index=${index}`
|
||
});
|
||
}
|
||
}
|
||
};
|
||
if (!Array) {
|
||
const _easycom_l_echart2 = common_vendor.resolveComponent("l-echart");
|
||
_easycom_l_echart2();
|
||
}
|
||
const _easycom_l_echart = () => "../../../uni_modules/lime-echart/components/l-echart/l-echart.js";
|
||
if (!Math) {
|
||
_easycom_l_echart();
|
||
}
|
||
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
||
return common_vendor.e({
|
||
a: $props.stockInfo
|
||
}, $props.stockInfo ? common_vendor.e({
|
||
b: common_vendor.t($props.stockInfo.growth_rates.profit_growth ? $data.getChgRateStr($props.stockInfo.growth_rates.profit_growth) + "%" : "-"),
|
||
c: common_vendor.t($data.getChgRateStr($props.stockInfo.growth_rates.revenue_growth)),
|
||
d: common_vendor.t($props.stockInfo.growth_rates.profit_growth ? $options.getGrowthStatus($props.stockInfo.growth_rates.profit_growth).text : "-"),
|
||
e: common_vendor.s("color:" + $options.getGrowthStatus($props.stockInfo.growth_rates.profit_growth).color),
|
||
f: common_vendor.t($data.getChgRateStr($props.stockInfo.key_metrics.roe)),
|
||
g: common_vendor.t($options.getROEStatus($props.stockInfo.key_metrics.roe).text),
|
||
h: common_vendor.s("color: " + $options.getROEStatus($props.stockInfo.key_metrics.roe).color),
|
||
i: common_vendor.t($props.stockInfo.key_metrics.net_margin.toFixed(2)),
|
||
j: common_vendor.t($props.stockInfo.key_metrics.gross_margin ? $data.getChgRateStr($props.stockInfo.key_metrics.gross_margin) + "%" : "-"),
|
||
k: $props.financialMetricsInfo
|
||
}, $props.financialMetricsInfo ? {
|
||
l: common_vendor.t($props.financialMetricsInfo.solvency.asset_liability_ratio ? $props.financialMetricsInfo.solvency.asset_liability_ratio.toFixed(2) : "-"),
|
||
m: common_vendor.t($options.getDebtStatusText($props.financialMetricsInfo.solvency.asset_liability_ratio).text),
|
||
n: common_vendor.s("color: " + $options.getDebtStatusText($props.financialMetricsInfo.solvency.asset_liability_ratio).color),
|
||
o: common_vendor.t($props.financialMetricsInfo.solvency.current_ratio ? $props.financialMetricsInfo.solvency.current_ratio.toFixed(2) : "-"),
|
||
p: common_vendor.t($props.financialMetricsInfo.expense_ratios.rd_expense_ratio)
|
||
} : {}) : {}, {
|
||
q: common_vendor.sr("chartRef1", "d36e6b92-0"),
|
||
r: common_vendor.sr("chartRef2", "d36e6b92-1"),
|
||
s: common_vendor.f(["业务", "毛利率", "利润", "营收", "营收"], (item, index, i0) => {
|
||
return common_vendor.e({
|
||
a: common_vendor.t(item),
|
||
b: ["", "(2025年中报)", "(2025年中报)", "(2025年中报)", "(2024年年报)"][index].length > 0
|
||
}, ["", "(2025年中报)", "(2025年中报)", "(2025年中报)", "(2024年年报)"][index].length > 0 ? {
|
||
c: common_vendor.t(["", "(2025年中报)", "(2025年中报)", "(2025年中报)", "(2024年年报)"][index]),
|
||
d: index == 0 ? "left" : "center"
|
||
} : {}, {
|
||
e: index,
|
||
f: index == 0 ? "left" : "center",
|
||
g: index == 0 ? "flex-start" : "center"
|
||
});
|
||
}),
|
||
t: $props.productClassificationList.length > 0
|
||
}, $props.productClassificationList.length > 0 ? {
|
||
v: common_vendor.f($props.productClassificationList[0].products, (item, index, i0) => {
|
||
return {
|
||
a: common_vendor.t(item.content),
|
||
b: common_vendor.t(item.profit_margin.toFixed(2)),
|
||
c: common_vendor.t($data.getNumStr(item.profit)),
|
||
d: common_vendor.t($data.getNumStr(item.revenue)),
|
||
e: common_vendor.t(item.content),
|
||
f: index,
|
||
g: index % 2 == 0 ? "#FFFFFF" : "#FAFAFC"
|
||
};
|
||
})
|
||
} : {});
|
||
}
|
||
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render]]);
|
||
wx.createPage(MiniProgramPage);
|
||
//# sourceMappingURL=../../../../.sourcemap/mp-weixin/pagesStock/components/zysj-view/zysj-view.js.map
|