提交 244765a6 authored 作者: yuanyufei's avatar yuanyufei

Merge branch 'yuantest' into test

# Conflicts:
#	.env.development
# 开发环境配置
ENV = 'development'
<<<<<<< HEAD
# 正式环境
#VUE_APP_BASE_API = 'http://sj.jxhh.com/api/v1'
# 测试环境
VUE_APP_BASE_API = 'http://192.168.26.179:6605/api/v1'
#VUE_APP_BASE_API = 'http://192.168.111.240:6605/api/v1'
=======
# dev环境
#VUE_APP_BASE_API = 'http://192.168.111.240:6605/api/v1'
# 测试环境
VUE_APP_BASE_API = 'http://192.168.26.179:6605/api/v1'
>>>>>>> yuantest
# 文档模块 直接调用 sys开放接口
VUE_APP_BASE_SYS_API = 'http://sysapi.jxhh.com'
......
......@@ -26,34 +26,26 @@ export default {
type: Boolean,
default: true
},
numberData: {
chartData: {
type: Object,
required: true
}
},
data() {
return {
dateArr: [],
yAsix:10000,
chart: null
}
},
watch: {
numberData: {
chartData: {
deep: true,
handler(val) {
this.dateArr= val.date
this.numberMax(this.numberData.ordercount,this.numberData.customerprice)
this.setOptions(val)
// debugger
}
}
},
created() {
this.$nextTick(() => {
this.initChart()
})
},
mounted() {
this.$nextTick(() => {
this.initChart()
})
......@@ -66,30 +58,52 @@ export default {
this.chart = null
},
methods: {
moneyMax(num){
let maxNumVal=Math.max.apply(null,num)
let prec = 2
let ceil = true
const len = String(maxNumVal).length;
console.log(len,'22')
console.log(maxNumVal,'9999')
if (len <= prec) { return maxNumVal };
const mult = Math.pow(10, prec);
return ceil ?
Math.ceil(maxNumVal / mult) * mult :
Math.floor(maxNumVal / mult) * mult;
},
numberMax(num1,num2){
if(num1,num2){
let result = num1.every(function(item,index,array){
return item == 0
})
let result2 = num2.every(function(item,index,array){
return item == 0
})
if(result||result2){
this.yAsix=100
}else{
var c = num1.concat(num2)
this.yAsix = Math.ceil(Math.max(...c))
}
let maxNum1=Math.max.apply(null,num1)
let maxNum2=Math.max.apply(null,num2)
let num = ''
if(maxNum1>=maxNum2){
num = maxNum1
}else{
num = maxNum2
}
let prec = 2
let ceil = true
const len = String(num).length;
if (len <= prec) { return num };
const mult = Math.pow(10, prec);
return ceil ?
Math.ceil(num / mult) * mult :
Math.floor(num / mult) * mult;
},
initChart() {
this.chart = echarts.init(this.$el, 'macarons')
this.setOptions(this.numberData)
// debugger
// if(this.chartData.months){
this.setOptions(this.chartData)
// }
},
setOptions({ordercount,customerprice,ordertotal,customerArr,dateArr,retentionArr} = {}) {
setOptions({ customerprice, ordercount, ordertotal,date} = {}) {
this.chart.setOption({
xAxis: {
data: this.dateArr,
type: 'category',
data: date,
boundaryGap: true,
axisTick: {
show: true
......@@ -114,36 +128,53 @@ export default {
type: 'value',
name: '交易量',
min: 0,
max: this.yAsix,
interval: Math.ceil(this.yAsix/5),
max: this.numberMax(this.chartData.customerprice,this.chartData.ordercount)<10?10:this.numberMax(this.chartData.customerprice,this.chartData.ordercount),
interval: this.numberMax(this.chartData.customerprice,this.chartData.ordercount)<10?2:(this.numberMax(this.chartData.customerprice,this.chartData.ordercount))/5,
axisLabel: {
formatter: '{value}'
}
},
{
type: 'value',
name: '总订单金额',
min: 0,
max: this.moneyMax(this.chartData.ordertotal)<10?10:this.moneyMax(this.chartData.ordertotal),
interval: this.moneyMax(this.chartData.ordertotal)<10?2:(this.moneyMax(this.chartData.ordertotal))/5,
axisLabel: {
formatter: '{value} 元'
}
}
],
legend: {
data: ['总订单数','总订单金额','客单价']
legend: {
data: ['总订单数', '总订单金额','客单价']
},
series: [{
name: '总订单数', itemStyle: {
series: [
{
name: '总订单数',
smooth: false,
type: 'bar',
itemStyle: {
normal: {
color: '#4784FF',
color: '#3A64E4',
lineStyle: {
color: '#4784FF',
width: 2
color: '#3A64E4',
width: 1
},
areaStyle: {
color: '#f3f8ff'
}
}
},
smooth: true,
type: 'bar',
data: ordercount,
animationDuration: 2800,
animationEasing: 'quadraticOut'
},
{
name: '总订单金额',
smooth: true,
smooth: false,
type: 'line',
yAxisIndex: 1,
itemStyle: {
normal: {
color: '#EE7945',
......@@ -151,20 +182,18 @@ export default {
color: '#EE7945',
width: 2
},
areaStyle: {
color: '#f3f8ff'
}
}
},
data: ordertotal,
animationDuration: 2800,
animationEasing: 'cubicInOut'
animationEasing: 'quadraticOut'
},
{
name: '客单价',
smooth: true,
smooth: false,
type: 'bar',
// yAxisIndex: 1,
yAxisIndex: 0,
itemStyle: {
normal: {
color: '#49D3CE',
......@@ -172,9 +201,7 @@ export default {
color: '#49D3CE',
width: 2
},
areaStyle: {
color: '#f3f8ff'
}
}
},
data: customerprice,
......
......@@ -149,7 +149,7 @@
</div>
</div>
<div style="margin-top:38px;padding:16px 16px 0;" v-show="isShowData">
<line-chart :number-data="numberChartData"/>
<line-chart :chart-data="numberChartData"/>
</div>
<div style="margin-top:38px;padding:16px 16px 0;" v-show="!isShowData">
<el-table
......@@ -699,6 +699,11 @@ export default {
margin-top: 15px;
}
}
@media screen and (max-width: 1637px) {
.footer-top-two{
margin-top: 15px;
}
}
@media screen and (max-width: 1200px) {
.main-left-top .tp-le{
width: 100%;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论