Commit 93dd7011 by 张立顺

功能开发中

1 parent 98e6cfea
import * as echarts from '../ec-canvas/echarts';
Component({
/**
* 组件的属性列表
*/
properties: {
chartData: {
type: Array,
value: () => []
},
keys: {
type: Array,
value: ['year', 'sales']
},
tickCount: {
type: Number,
value: 4
},
color: {
type: String,
value: '#3975C6'
}
},
observers: {
'chartData': function (data) {
console.log(data, '----------------')
this.initData(data)
},
},
/**
* 组件的初始数据
*/
data: {
ec: {
// lazyLoad: false
lazyLoad: true
}
},
/**
* 组件的方法列表
*/
methods: {
onInitChart(xData, yData) {
this.ecComponent && this.ecComponent.init((canvas, width, height, dpr) => {
const chart = echarts.init(canvas, null, {
width: width,
height: height,
devicePixelRatio: dpr,
});
this.setOption(chart, xData, yData);
return chart;
})
},
setOption(chart, xData, yData) {
let {chartData:diagramList} = this.data
const abscissaDataList = [],
orderMoneyTotalList = [],
upgradeAveragePriceList = [],
upgradeRateList = []
diagramList.forEach(element => {
abscissaDataList.push(element.abscissaData)
orderMoneyTotalList.push(this.sceneId == 0 ? element.orderMoneyTotal : element.outputValue)
upgradeAveragePriceList.push(this.sceneId == 0 ? element.upgradeAveragePrice : element.avgPrice)
upgradeRateList.push(element.upgradeRate || 0)
});
const colors = ['#3582EE', '#35C376', '#FF9D0A']
var option = {
color: colors,
grid: {
left: '25%',
right: '15%'
},
// 滚动设置
dataZoom: [
{
type: 'slider', //隐藏或显示(true)组件
show: false,
showDetail: false, //是否显示detail,即拖拽时候显示详细数值信息
startValue: 0,
endValue: 5,
start: 50,
end: 100,
zoomLoxk: true // 是否锁定选择区域(或叫做数据窗口)的大小
},
{
//没有下面这块的话,只能拖动滚动条,鼠标滚轮在区域内不能控制外部滚动条
type: 'inside',
zoomOnMouseWheel: false, //滚轮是否触发缩放
moveOnMouseMove: true, //鼠标滚轮触发滚动
moveOnMouseWheel: true
}
],
legend: {
data: ['营业额', '客单价', '转化率'],
top: 'bottom'
},
xAxis: [
{
type: 'category',
axisTick: {
alignWithLabel: true
},
data:abscissaDataList|| ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
}
],
yAxis: [
{
type: 'value',
name: '营业额',
position: 'left',
alignTicks: true,
offset: -5,
axisLabel: {
formatter: '{value} 元'
}
},
{
type: 'value',
name: '客单价',
position: 'right',
offset: 1000,
axisLabel: {
formatter: '{value} 元'
}
},
{
type: 'value',
name: '转化率',
position: 'right',
alignTicks: true,
axisLabel: {
formatter: '{value} %'
}
}
],
series: [
{
name: '营业额',
type: 'bar',
yAxisIndex: 0,
data: orderMoneyTotalList
},
{
name: '客单价',
type: 'bar',
yAxisIndex: 0,
data: upgradeAveragePriceList
},
{
name: '转化率',
type: 'line',
yAxisIndex: 2,
data: upgradeRateList
}
]
};
chart.setOption(option)
},
//初始化数据
initData(data) {
const xData = [],
yData = [];
const [x, y] = this.data.keys
data.forEach(item => {
xData.push(item[x])
yData.push(item[y])
})
this.setData({
xData,
yData
})
this.onInitChart(xData, yData)
},
},
ready() {
// 获取组件
this.ecComponent = this.selectComponent('#mychart-dom-bar');
}
})
\ No newline at end of file
{
"component": true,
"usingComponents": {
"ec-canvas": "../ec-canvas/ec-canvas"
}
}
/* packageOutput/components/echart/echart.wxss */
// .f2-chart {
// width: 100%;
// height: 500rrpx;
// }
.ec-canvas {
width: 670rpx;
height: 520rpx;
margin-top: -20rpx;
}
.container {
height: 584rpx;
padding: 20rpx 16rpx 0rpx;
background-color: #fff;
margin-bottom: 20rpx;
font-size: 36rpx;
border-radius: 16rpx;
.title {
display: flex;
justify-content: space-between;
font-weight: 600;
font-size: 28rpx;
color: #323436;
.title-tip {
font-weight: 400;
font-size: 20rpx;
color: #999999;
}
.title-tip-red {
font-weight: 400;
font-size: 24rpx;
color: #db6d6d;
}
}
.content {
padding: 24rpx 20rpx 0rpx;
.row {
font-size: 24rpx;
padding: 16rpx 0;
border-bottom: 0.5rpx solid #e4e6ee;
.label {
margin-bottom: 19rpx;
}
.num {
font-weight: 600;
font-size: 36rpx;
color: #333333;
}
}
.row:last-child {
border: none;
}
.td:first-child {
width: 60%;
}
.td:nth-child(2),
.td:nth-child(3) {
width: 20%;
}
.icon-up-down {
width: 24rpx;
height: 24rpx;
}
.up {
font-weight: 600;
color: #f24724;
}
.down {
font-weight: 600;
color: #35c376;
}
}
.revenue {
box-sizing: border-box;
background-color: #fff;
padding: 20rpx 16rpx 20rpx;
margin-bottom: 20rpx;
border-radius: 16rpx;
}
.pro-rank {
.rank-item {
border-bottom: 0.5rpx solid #e4e6ee;
padding: 24rpx 0;
}
.rank-idx {
width: 36rpx;
height: 36rpx;
line-height: 40rpx;
text-align: center;
background: #999999;
border-radius: 8rpx;
font-weight: 600;
font-size: 20rpx;
color: #ffffff;
margin-right: 10rpx;
}
.rank-0 {
background-image: linear-gradient(180deg, #ffd767 0%, #f7c33f 100%);
color: #a86921;
}
.rank-1 {
background-image: linear-gradient(180deg, #dfe1e5 0%, #cbccce 100%);
color: #8b8585;
}
.rank-2 {
background-image: linear-gradient(180deg, #f6dac4 0%, #f0be98 100%);
color: #cf7334;
}
.pro-name {
width: 480rpx;
font-weight: 600;
font-size: 28rpx;
color: #333333;
}
.price {
font-weight: 600;
font-size: 36rpx;
color: #f24724;
text-align: right;
}
.tips {
font-weight: 400;
font-size: 24rpx;
color: #666666;
margin: 18rpx 0 0 46rpx;
}
.icons {
width: 100%;
text-align: center;
padding: 20rpx 0 0;
}
.rank-icon {
width: 40rpx;
height: 40rpx;
}
}
}
\ No newline at end of file
<view class="container">
<view class="title">
趋势分析
<view class="title-tip" v-show="firstOrderDate">业务开展时间:{{ firstOrderDate }}</view>
</view>
<!-- <view class="" id="bar"></view> -->
<view class="ec-canvas">
<ec-canvas class=" echart-box" id="mychart-dom-bar" canvas-id="mychart-bar" ec="{{ ec }}" force-use-old-canvas="true"></ec-canvas>
</view>
</view>
......@@ -54,88 +54,113 @@ Component({
})
},
setOption(chart, xData, yData) {
let {chartData:diagramList} = this.data
const abscissaDataList = [],
orderMoneyTotalList = [],
upgradeAveragePriceList = [],
upgradeRateList = []
diagramList.forEach(element => {
abscissaDataList.push(element.abscissaData)
orderMoneyTotalList.push(this.sceneId == 0 ? element.orderMoneyTotal : element.outputValue)
upgradeAveragePriceList.push(this.sceneId == 0 ? element.upgradeAveragePrice : element.avgPrice)
upgradeRateList.push(element.upgradeRate || 0)
});
const colors = ['#3582EE', '#35C376', '#FF9D0A']
var option = {
color: colors,
grid: {
left: 8,
right: 10,
top: 30,
bottom: 0,
containLabel: true
left: '25%',
right: '15%'
},
// tooltip: {
// trigger: 'axis',
// triggerOn: "mousemove",
// axisPointer: {
// type: "none",
// lineStyle: {
// type: 'solid'
// }
// },
// padding: [0, 12],
// borderWidth: 2,
// borderColor: this.data.color,
// borderRadius: 10,
// textStyle: {
// color: this.data.color,
// fontSize: 10
// },
// position: function(pt) {
// console.log(pt)
// return [pt[0], pt[1]];
// },
// formatter: function (item) {
// return `${item[0].value}`
// }
// },
xAxis: {
type: 'category',
axisLabel: {
fontSize: 11,
color: '#A6A6A6'
},
axisLine: {
show: false //坐标轴线线
},
axisTick: {
show: false //坐标轴刻度
},
data: xData
},
yAxis: {
x: 'center',
type: 'value',
axisLabel: {
fontSize: 11,
color: '#A6A6A6'
},
axisLine: {
show: false //坐标轴线线
},
axisTick: {
show: false //坐标轴刻度
},
splitLine: {
lineStyle: {
type: 'dashed'
}
}
},
series: [{
data: yData,
type: 'bar',
label: {
show: true,
position: 'top',
color: this.data.color,
},
color: this.data.color,
itemStyle: {
borderRadius: [50, 50, 0, 0],
padding: [50, 50, 0, 0]
},
barWidth: 24
}]
// 滚动设置
dataZoom: [
{
type: 'slider', //隐藏或显示(true)组件
show: false,
showDetail: false, //是否显示detail,即拖拽时候显示详细数值信息
startValue: 0,
endValue: 5,
start: 50,
end: 100,
zoomLoxk: true // 是否锁定选择区域(或叫做数据窗口)的大小
},
{
//没有下面这块的话,只能拖动滚动条,鼠标滚轮在区域内不能控制外部滚动条
type: 'inside',
zoomOnMouseWheel: false, //滚轮是否触发缩放
moveOnMouseMove: true, //鼠标滚轮触发滚动
moveOnMouseWheel: true
}
],
legend: {
data: ['营业额', '客单价', '转化率'],
top: 'bottom'
},
xAxis: [
{
type: 'category',
axisTick: {
alignWithLabel: true
},
data:abscissaDataList|| ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
}
],
yAxis: [
{
type: 'value',
name: '营业额',
position: 'left',
alignTicks: true,
offset: -5,
axisLabel: {
formatter: '{value} 元'
}
},
{
type: 'value',
name: '客单价',
position: 'right',
offset: 1000,
axisLabel: {
formatter: '{value} 元'
}
},
{
type: 'value',
name: '转化率',
position: 'right',
alignTicks: true,
axisLabel: {
formatter: '{value} %'
}
}
],
series: [
{
name: '营业额',
type: 'bar',
yAxisIndex: 0,
data: orderMoneyTotalList
},
{
name: '客单价',
type: 'bar',
yAxisIndex: 0,
data: upgradeAveragePriceList
},
{
name: '转化率',
type: 'line',
yAxisIndex: 2,
data: upgradeRateList
}
]
};
chart.setOption(option)
},
......
/* packageOutput/components/echart/echart.wxss */
// .f2-chart {
// width: 100%;
// height: 500rpx;
// height: 500rrpx;
// }
.ec-canvas {
width: 100%;
height: 100%;
width: 670rpx;
height: 520rpx;
margin-top: -20rpx;
}
.container {
height: 584rpx;
padding: 20rpx 16rpx 0rpx;
background-color: #fff;
margin-bottom: 20rpx;
font-size: 36rpx;
border-radius: 16rpx;
.title {
display: flex;
justify-content: space-between;
font-weight: 600;
font-size: 28rpx;
color: #323436;
.title-tip {
font-weight: 400;
font-size: 20rpx;
color: #999999;
}
.title-tip-red {
font-weight: 400;
font-size: 24rpx;
color: #db6d6d;
}
}
.content {
padding: 24rpx 20rpx 0rpx;
.row {
font-size: 24rpx;
padding: 16rpx 0;
border-bottom: 0.5rpx solid #e4e6ee;
.label {
margin-bottom: 19rpx;
}
.num {
font-weight: 600;
font-size: 36rpx;
color: #333333;
}
}
.row:last-child {
border: none;
}
.td:first-child {
width: 60%;
}
.td:nth-child(2),
.td:nth-child(3) {
width: 20%;
}
.icon-up-down {
width: 24rpx;
height: 24rpx;
}
.up {
font-weight: 600;
color: #f24724;
}
.down {
font-weight: 600;
color: #35c376;
}
}
.revenue {
box-sizing: border-box;
background-color: #fff;
padding: 20rpx 16rpx 20rpx;
margin-bottom: 20rpx;
border-radius: 16rpx;
}
.pro-rank {
.rank-item {
border-bottom: 0.5rpx solid #e4e6ee;
padding: 24rpx 0;
}
.rank-idx {
width: 36rpx;
height: 36rpx;
line-height: 40rpx;
text-align: center;
background: #999999;
border-radius: 8rpx;
font-weight: 600;
font-size: 20rpx;
color: #ffffff;
margin-right: 10rpx;
}
.rank-0 {
background-image: linear-gradient(180deg, #ffd767 0%, #f7c33f 100%);
color: #a86921;
}
.rank-1 {
background-image: linear-gradient(180deg, #dfe1e5 0%, #cbccce 100%);
color: #8b8585;
}
.rank-2 {
background-image: linear-gradient(180deg, #f6dac4 0%, #f0be98 100%);
color: #cf7334;
}
.pro-name {
width: 480rpx;
font-weight: 600;
font-size: 28rpx;
color: #333333;
}
.price {
font-weight: 600;
font-size: 36rpx;
color: #f24724;
text-align: right;
}
.tips {
font-weight: 400;
font-size: 24rpx;
color: #666666;
margin: 18rpx 0 0 46rpx;
}
.icons {
width: 100%;
text-align: center;
padding: 20rpx 0 0;
}
.rank-icon {
width: 40rpx;
height: 40rpx;
}
}
}
\ No newline at end of file
<ec-canvas class="ec-canvas" id="mychart-dom-bar" canvas-id="mychart-bar" ec="{{ ec }}" force-use-old-canvas="true"></ec-canvas>
<view class="container">
<view class="title">
趋势分析
<view class="title-tip" v-show="firstOrderDate">业务开展时间:{{ firstOrderDate }}</view>
</view>
<!-- <view class="" id="bar"></view> -->
<view class="ec-canvas">
<ec-canvas class=" echart-box" id="mychart-dom-bar" canvas-id="mychart-bar" ec="{{ ec }}" force-use-old-canvas="true"></ec-canvas>
</view>
</view>
......@@ -14,14 +14,19 @@ Component({
observer: function (){
this.initRevenueData()
}
}
},
chartData:{
type:Object,
value:[],
},
},
/**
* 组件的初始数据
*/
data: {
chartData: [],
// chartData: [],
opts: {
keys: ['abscissaValue', 'ordinateValue'],
tickCount: 8
......@@ -67,19 +72,19 @@ Component({
}
},
attached() {
setTimeout(() => {
this.setData({
chartData: [
{ abscissaValue: '2023-08-11', ordinateValue: 0 },
{ abscissaValue: '2023-08-12', ordinateValue: 0 },
{ abscissaValue: '2023-08-13', ordinateValue: 0 },
{ abscissaValue: '2023-08-14', ordinateValue: 0 },
{ abscissaValue: '2023-08-15', ordinateValue: 0 },
{ abscissaValue: '2023-08-16', ordinateValue: 9574 },
{ abscissaValue: '2023-08-17', ordinateValue: 0 }
]
})
}, 400)
// setTimeout(() => {
// this.setData({
// chartData: [
// { abscissaValue: '2023-08-11', ordinateValue: 0 },
// { abscissaValue: '2023-08-12', ordinateValue: 0 },
// { abscissaValue: '2023-08-13', ordinateValue: 0 },
// { abscissaValue: '2023-08-14', ordinateValue: 0 },
// { abscissaValue: '2023-08-15', ordinateValue: 0 },
// { abscissaValue: '2023-08-16', ordinateValue: 9574 },
// { abscissaValue: '2023-08-17', ordinateValue: 0 }
// ]
// })
// }, 400)
},
/**
* 组件的方法列表
......
{
"component": true,
"usingComponents": {
"echart": "../echart/echart"
"echart": "../echart/echart",
"echart-pie": "../echart-pie/echart"
}
}
\ No newline at end of file
......@@ -27,7 +27,7 @@
}
.content {
padding: 24rpx 20rpx;
padding: 24rpx 20rpx 0rpx;
.row {
font-size: 24rpx;
......@@ -77,8 +77,9 @@
.revenue {
box-sizing: border-box;
background-color: #fff;
padding: 20rpx 16rpx 40rpx;
padding: 20rpx 16rpx 20rpx;
margin-bottom: 20rpx;
border-radius: 16rpx;
}
.pro-rank {
......@@ -181,7 +182,7 @@
// height: 370rrpx;
height: 100%;
overflow: scroll;
background-color: #fff;
// background-color: #fff;
}
::-webkit-scrollbar {
......
......@@ -9,7 +9,7 @@
outputObj.targetOutputValue || 0 }}元
完成进度{{ outputObj.currentProgress || 0 }}%</view>
</view>
<view class="content revenue">
<view class="content">
<view wx:for="{{ tabIndex? revenueFormData.equityList: revenueFormData.membraneList }}" wx:key="index" class="flex row">
<view class="td">
<view class="label">{{ item.label }}</view>
......@@ -37,5 +37,7 @@
</view>
</view>
</view>
<!-- <echart chartData="{{ chartData }}" tickCount="{{ opts.tickCount }}" keys="{{ opts.keys }}"></echart> -->
<echart chartData="{{ chartData }}" tickCount="{{ opts.tickCount }}" keys="{{ opts.keys }}"></echart>
<echart-pie chartData="{{ chartData }}" tickCount="{{ opts.tickCount }}" keys="{{ opts.keys }}"></echart-pie>
</view>
\ No newline at end of file
......@@ -81,7 +81,6 @@
.container {
box-sizing: border-box;
height: calc(100% - 80rpx);
background-color: #F2F3F7;
}
......
......@@ -12,7 +12,7 @@
</view>
<view class="conCom" >
<output-echart class="container" revenueData="{{revenueData}}" tabIndex="{{tabIndx}}"></output-echart>
<output-echart class="container" revenueData="{{revenueData}}" chartData="{{diagramList}}" tabIndex="{{tabIndx}}"></output-echart>
</view>
<!-- <output-echart></output-echart>
<output-crowdfund></output-crowdfund> -->
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!