<template>
	<view>
		<view class="" v-if="thly.report==1 && selty">
			<qiun-data-charts type="line" :opts="opts" :chartData="chartDatathly" :ontouch="true" />
		</view>
		<view class="" v-if="thly.report==4 && selty">
			<qiun-data-charts type="column" :opts="opts" :chartData="types" :ontouch="true" />
		</view>
		<view class="" v-if="thly.report==8 && selty">
			<qiun-data-charts type="column" :opts="opts" :chartData="types" :ontouch="true" />
		</view>
		<view class="" v-if="thly.report==0 && selty">
			<qiun-data-charts type="line" :opts="opts" :chartData="chartData" :ontouch="true" />
		</view>
		<view class="" v-if="thly.report==6 && selty">
			<qiun-data-charts type="line" :opts="opts" :chartData="chartData" :ontouch="true" />
		</view>
	</view>
</template>

<script>
	import qiunDataCharts from "./qiun-data-charts/components/qiun-data-charts/qiun-data-charts.vue"
	export default {
		components: {
			qiunDataCharts
		},
		props: {
			Monthly: Object
		},
		data() {
			return {
				a: [],
				selty: false,
				thly: this.Monthly,
				chartDatathly: {
					categories: [],
					series: [{
							name: "订单笔数",
							index: '1',
							// yAxisIndex: 1,
							data: []
						},
						{
							name: "订单金额",
							index: '0',
							// yAxisIndex: 1,
							data: []
						},
						{
							name: "退货单数",
							index: '1',
							// yAxisIndex: 0,
							data: []
						},
						{
							name: "退货金额",
							index: '0',
							// yAxisIndex: 0,
							data: []
						}
					]
				},
				chartData: {
					categories: [],
					series: [{
							name: "订单笔数",
							index: '1',
							data: []
						},
						{
							name: "订单金额",
							index: '0',
							data: []
						},
						{
							name: "退货单数",
							index: '1',
							data: []
						},
						{
							name: "退货金额",
							index: '0',
							data: []
						}
					]
				},
				types: {
					categories: [],
					series: [{
							name: "订单笔数",
							index: '1',
							data: []
						},
						{
							name: "订单金额",
							index: '0',
							data: []
						},
						{
							name: "退货单数",
							index: '1',
							data: []
						},
						{
							name: "退货金额",
							index: '0',
							data: []
						}
					]
				},
				area: {
					categories: ['山西', '辽宁', '吉林', '黑龙江', '江苏', '浙江', '安徽', '福建', '江西'],
					series: [{
							name: "订单笔数",
							index: '0',
							data: []
						},
						{
							name: "订单金额",
							index: '1',
							data: []
						},
						{
							name: "退货单数",
							index: '0',
							data: []
						},
						{
							name: "退货金额",
							index: '1',
							data: []
						}
					]
				},
				opts: {
					color: ["#1890FF", "#91CB74", "#FAC858", "#EE6666", "#73C0DE", "#3CA272", "#FC8452", "#9A60B4",
						"#ea7ccc"
					],
					padding: [20, 0, 0, 0],
					dataLabel: false,
					dataPointShape: false,
					enableScroll: false,
					scrollShow: true,
					enableScroll: true,

					legend: {},
					xAxis: {
						disableGrid: true,
						itemCount: 4,
						scrollShow: true,
					},
					yAxis: {
						gridType: "dash",
						dashLength: 2,
						data: [{ //这里y轴分组   left是下标为0的第一组y数据在最左侧
								position: "left",
								axisLine: false, //坐标轴轴线是否显示
								// axisLineColor: '#fff', //坐标轴轴线颜色
								fontColor: "#474e5b",
								fontSize: 14,
								disabled: false, //是否绘画y轴  true不 默认为false
								min: '', //y轴最小值
								max: '', //y轴最大值   最大值来除以y轴显示的数量=每份的数量
								// unit:'焦',//y轴刻度后面的单位
								tofix: 2,
								title: '',
								titleOffsetY: -6,
								titleOffsetX: -6,
							},
							{ //这里y轴分组   right是下标为1的第二组y数据在最右侧
								position: "right",
								axisLine: false, //坐标轴轴线是否显示
								axisLineColor: '#fff', //坐标轴轴线颜色
								fontColor: "#474e5b",
								fontSize: 14,
								disabled: false, //是否绘画y轴  true不 默认为false
								min: '', //y轴最小值
								max: '', //y轴最大值   最大值来除以y轴显示的数量=每份的数量
								// unit:'焦',//y轴刻度后面的单位
								tofix: 2,
								title: '',
								// 

								titleOffsetY: -6,
								titleOffsetX: 10,
							},

						]
					},
					extra: {
						line: {
							type: "curve",
							width: 2,
							activeType: "hollow",
							linearType: "custom"
						},
						column: {
							type: "group",
							width: 10,
							activeBgColor: "#000000",
							activeBgOpacity: 0.08
						}
					}
				}
			};
		},
		destroyed() {


		},
		methods: {
			formatRoundNum(num) {
				return Math.ceil(num / 1000) * 1000
			},
			formatRoundNumten(num) {
				return Math.ceil(num / 10) * 10
			},
			format(num) {
				return num != 0 ? Math.floor(num / 10) * 10 : 0
			},
			
			//日报
			dailyones(month_time){
				let myDate = new Date();
				this.$api.sendRequest({
					url: '/api/salasmanstat/todayStatHome',
					data: {
						month_time
					},
					success: res => {
						console.log(res.data.list, '经营日报图表');
						// for(let i=0;i<res.data.list.length;i++){
						// 	this.chartData.categories.push(res.data.list.date)
						// }
						let a = []
						let b = []
						let c = []
						let d = []
						let e = []
						for (let i = 0; i < res.data.list.length; i++) {
				
							if (Number(res.data.list[i].date.substring(0, res.data.list[i].date.length - 1)) <=
								Number(myDate.getDate())) {
								a.push(res.data.list[i].date)
								b.push(Number(res.data.list[i].order_money))
								c.push(Number(res.data.list[i].order_num))
								d.push(Number(res.data.list[i].order_refund_num))
								e.push(Number(res.data.list[i].order_refund_money))
							}
				
						}
						setTimeout(() => {
							console.log(a, '日期');
							console.log(b, '订单金额');
							//报表最小值
							// if(this.format(Math.min(...b))
							//b  订单金额  e 退款金额
							if (this.format(Math.min(...b)) <= this.format(Math.min(...e))) {
								this.opts.yAxis.data[0].min = this.format(Math.min(...b))
							} else {
								this.opts.yAxis.data[0].min = this.format(Math.min(...e))
							}
							if (this.formatRoundNum(Math.max(...b)) <= this.formatRoundNum(Math.max(...
									e))) {
								this.opts.yAxis.data[0].max = this.formatRoundNum(Math.max(...e))
							} else {
								this.opts.yAxis.data[0].max = this.formatRoundNum(Math.max(...b))
							}
							//c   订单笔数   d退款笔数
							if (this.format(Math.min(...c)) <= this.format(Math.min(...d))) {
								this.opts.yAxis.data[1].min = this.format(Math.min(...c))
							} else {
								this.opts.yAxis.data[1].min = this.format(Math.min(...d))
							}
							if (this.formatRoundNum(Math.max(...c)) <= this.formatRoundNum(Math.max(...
									d))) {
								this.opts.yAxis.data[1].max = this.formatRoundNumten(Math.max(...c))
							} else {
								this.opts.yAxis.data[1].max = this.formatRoundNumten(Math.max(...d))
							}
							// this.opts.yAxis.data[0].min =this.format(Math.min(...b))
				
							// this.opts.yAxis.data[0].max = this.formatRoundNum(Math.max(...b))
							// this.opts.yAxis.data[1].min = this.format(Math.min(...c))
							// this.opts.yAxis.data[1].max = this.formatRoundNumten(Math.max(...c))
							console.log(c, '订单笔数');
							console.log(d, '退款笔数');
							console.log(e, '退款金额');
							this.chartData.categories = a
							this.chartData.series[1].data = b
							this.chartData.series[0].data = c
							this.chartData.series[2].data = d
							this.chartData.series[3].data = e
							this.selty = true
						}, 200)
				
					}
				})
			},
			Monthlyreport(year_time){
				// console.log('月报');
				let myDate = new Date();
				this.$api.sendRequest({
					url: '/api/salasmanstat/monthStat',
					data: {
						year_time
					},
					success: res => {
						console.log(res.data.list, '经营月报图表');
						let a = []
						let b = []
						let c = []
						let d = []
						let e = []
						
						for (let i = 0; i < res.data.list.length; i++) {
							if (Number(res.data.list[i].date.substring(0, res.data.list[i].date.length - 1)) <= Number(myDate.getMonth() + 1 < 10 ? '0' + (myDate.getMonth() + 1) : myDate.getMonth() + 1)) {
							a.push(res.data.list[i].date)
							b.push(Number(res.data.list[i].order_money))
							c.push(Number(res.data.list[i].order_num))
							d.push(Number(res.data.list[i].order_refund_num))
							e.push(Number(res.data.list[i].order_refund_money))
							}
							
						}
						setTimeout(() => {
							console.log(a, '日期');
							if (this.format(Math.min(...b)) <= this.format(Math.min(...e))) {
								this.opts.yAxis.data[0].min = this.format(Math.min(...b))
							} else {
								this.opts.yAxis.data[0].min = this.format(Math.min(...e))
							}
							if (this.formatRoundNum(Math.max(...b)) <= this.formatRoundNum(Math.max(...
									e))) {
								this.opts.yAxis.data[0].max = this.formatRoundNum(Math.max(...e))
							} else {
								this.opts.yAxis.data[0].max = this.formatRoundNum(Math.max(...b))
							}
							//c   订单笔数   d退款笔数
							if (this.format(Math.min(...c)) <= this.format(Math.min(...d))) {
								this.opts.yAxis.data[1].min = this.format(Math.min(...c))
							} else {
								this.opts.yAxis.data[1].min = this.format(Math.min(...d))
							}
							if (this.formatRoundNum(Math.max(...c)) <= this.formatRoundNum(Math.max(...
									d))) {
								this.opts.yAxis.data[1].max = this.formatRoundNumten(Math.max(...c))
							} else {
								this.opts.yAxis.data[1].max = this.formatRoundNumten(Math.max(...d))
							}
							console.log(b, '订单金额');
							console.log(c, '订单笔数');
							console.log(d, '退款笔数');
							console.log(e, '退款金额');
							this.chartDatathly.categories = a
							this.chartDatathly.series[1].data = b
							this.chartDatathly.series[0].data = c
							this.chartDatathly.series[2].data = d
							this.chartDatathly.series[3].data = e
							this.selty = true
						}, 100)
				
					}
				})
			},
			areaones(start_time,end_time){
				this.$api.sendRequest({
						url: '/api/salasmanstat/areaStatList',
						data: {
									start_time,
									end_time
							},
						success:res=>{
							console.log(res.data.list,'地区统计图表');
							let a = []
							let b = []
							let c = []
							let d = []
							let e = []
							for (let i = 0; i < res.data.list.length; i++) {
											
								a.push(res.data.list[i].province_name)
								b.push(Number(res.data.list[i].order_money))
								c.push(Number(res.data.list[i].order_num))
								d.push(Number(res.data.list[i].order_refund_num))
								e.push(Number(res.data.list[i].order_refund_money))
							}
										setTimeout(() => {
							// 				console.log(a, '日期');
											if (this.format(Math.min(...b)) <= this.format(Math.min(...e))) {
												this.opts.yAxis.data[0].min = this.format(Math.min(...b))
											} else {
												this.opts.yAxis.data[0].min = this.format(Math.min(...e))
											}
											if (this.formatRoundNum(Math.max(...b)) <= this.formatRoundNum(Math.max(...
													e))) {
												this.opts.yAxis.data[0].max = this.formatRoundNum(Math.max(...e))
											} else {
												this.opts.yAxis.data[0].max = this.formatRoundNum(Math.max(...b))
											}
											//c   订单笔数   d退款笔数
											if (this.format(Math.min(...c)) <= this.format(Math.min(...d))) {
												this.opts.yAxis.data[1].min = this.format(Math.min(...c))
											} else {
												this.opts.yAxis.data[1].min = this.format(Math.min(...d))
											}
											if (this.formatRoundNum(Math.max(...c)) <= this.formatRoundNum(Math.max(...
													d))) {
												this.opts.yAxis.data[1].max = this.formatRoundNumten(Math.max(...c))
											} else {
												this.opts.yAxis.data[1].max = this.formatRoundNumten(Math.max(...d))
											}
											console.log(b, '订单金额');
											console.log(c, '订单笔数');
											console.log(d, '退款笔数');
											console.log(e, '退款金额');
											this.types.categories = a
											this.types.series[1].data = b
											this.types.series[0].data = c
											this.types.series[2].data = d
											this.types.series[3].data = e
											this.selty = true
										}, 100)
							
							// 		}
							// 	})
							
						}
				})
			},
			Customerset(start_time,end_time){
				this.$api.sendRequest({
					url: '/api/salasmanstat/memberTypeStatList',
					data: {
						start_time,
						end_time
					},
					success: res => {
				
						console.log(res.data.list, '客户分类统计');
						// for(let i=0;i<res.data.list.length;i++){
						// 	this.chartData.categories.push(res.data.list.date)
						// }
						let a = []
						let b = []
						let c = []
						let d = []
						let e = []
						for (let i = 0; i < res.data.list.length; i++) {
							a.push(res.data.list[i].type_name)
							b.push(Number(res.data.list[i].order_money))
							c.push(Number(res.data.list[i].order_num))
							d.push(Number(res.data.list[i].order_refund_num))
							e.push(Number(res.data.list[i].order_refund_num))
						}
						setTimeout(() => {
							console.log(a, '分类');
							console.log(b, '订单金额');
							console.log(c, '订单笔数');
							console.log(d, '退款笔数');
							console.log(e, '退款金额');
							this.chartData.categories = a
							if (this.format(Math.min(...b)) <= this.format(Math.min(...e))) {
								this.opts.yAxis.data[0].min = this.format(Math.min(...b))
							} else {
								this.opts.yAxis.data[0].min = this.format(Math.min(...e))
							}
							if (this.formatRoundNum(Math.max(...b)) <= this.formatRoundNum(Math.max(...
									e))) {
								this.opts.yAxis.data[0].max = this.formatRoundNum(Math.max(...e))
							} else {
								this.opts.yAxis.data[0].max = this.formatRoundNum(Math.max(...b))
							}
							//c   订单笔数   d退款笔数
							if (this.format(Math.min(...c)) <= this.format(Math.min(...d))) {
								this.opts.yAxis.data[1].min = this.format(Math.min(...c))
							} else {
								this.opts.yAxis.data[1].min = this.format(Math.min(...d))
							}
							if (this.formatRoundNum(Math.max(...c)) <= this.formatRoundNum(Math.max(...
									d))) {
								this.opts.yAxis.data[1].max = this.formatRoundNumten(Math.max(...c))
							} else {
								this.opts.yAxis.data[1].max = this.formatRoundNumten(Math.max(...d))
							}
							this.chartData.series[1].data = b
							this.chartData.series[0].data = c
							this.chartData.series[2].data = d
							this.chartData.series[3].data = e
							this.selty = true
						}, 100)
				
					}
				})
			},
			roductdivision(start_time,end_time){
				this.$api.sendRequest({
					url: '/api/salasmanstat/goodsCateStatList',
					data: {
						start_time,
						end_time
					},
					success: res => {
						console.log(res.data.list, '商品分类统计图像');
						// for(let i=0;i<res.data.list.length;i++){
						// 	this.chartData.categories.push(res.data.list.date)
						// }
						let a = []
						let b = []
						let c = []
						let d = []
						let e = []
						for (let i = 0; i < res.data.list.length; i++) {
							a.push(res.data.list[i].cate_name)
							b.push(Number(res.data.list[i].order_goods_money))
							c.push(Number(res.data.list[i].order_goods_num))
							d.push(Number(res.data.list[i].order_refund_goods_num))
							e.push(Number(res.data.list[i].order_refund_goods_money))
						}
						setTimeout(() => {
							console.log(a, '日期');
							console.log(b, '订单金额');
							console.log(c, '订单笔数');
							console.log(d, '退款笔数');
							console.log(e, '退款金额');
							this.types.categories = a
							if (this.format(Math.min(...b)) <= this.format(Math.min(...e))) {
								this.opts.yAxis.data[0].min = this.format(Math.min(...b))
							} else {
								this.opts.yAxis.data[0].min = this.format(Math.min(...e))
							}
							if (this.formatRoundNum(Math.max(...b)) <= this.formatRoundNum(Math.max(...
									e))) {
								this.opts.yAxis.data[0].max = this.formatRoundNum(Math.max(...e))
							} else {
								this.opts.yAxis.data[0].max = this.formatRoundNum(Math.max(...b))
							}
							//c   订单笔数   d退款笔数
							if (this.format(Math.min(...c)) <= this.format(Math.min(...d))) {
								this.opts.yAxis.data[1].min = this.format(Math.min(...c))
							} else {
								this.opts.yAxis.data[1].min = this.format(Math.min(...d))
							}
							if (this.formatRoundNum(Math.max(...c)) <= this.formatRoundNum(Math.max(...
									d))) {
								this.opts.yAxis.data[1].max = this.formatRoundNumten(Math.max(...c))
							} else {
								this.opts.yAxis.data[1].max = this.formatRoundNumten(Math.max(...d))
							}
							this.types.series[1].data = b
							this.types.series[0].data = c
							this.types.series[2].data = d
							this.types.series[3].data = e
							this.selty = true
						}, 100)
				
					}
				})
			},
			
		},
		created() {
			let myDate = new Date();
			if (this.thly.report == 0) {
				this.$api.sendRequest({
					url: '/api/salasmanstat/todayStatHome',
					data: {
						month_time: this.thly.day_time
					},
					success: res => {
						console.log(res.data.list, '经营日报图表');
						// for(let i=0;i<res.data.list.length;i++){
						// 	this.chartData.categories.push(res.data.list.date)
						// }
						let a = []
						let b = []
						let c = []
						let d = []
						let e = []
						for (let i = 0; i < res.data.list.length; i++) {

							if (Number(res.data.list[i].date.substring(0, res.data.list[i].date.length - 1)) <=
								Number(myDate.getDate())) {
								a.push(res.data.list[i].date)
								b.push(Number(res.data.list[i].order_money))
								c.push(Number(res.data.list[i].order_num))
								d.push(Number(res.data.list[i].order_refund_num))
								e.push(Number(res.data.list[i].order_refund_money))
							}

						}
						setTimeout(() => {
							console.log(a, '日期');
							console.log(b, '订单金额');
							//报表最小值
							// if(this.format(Math.min(...b))
							//b  订单金额  e 退款金额
							if (this.format(Math.min(...b)) <= this.format(Math.min(...e))) {
								this.opts.yAxis.data[0].min = this.format(Math.min(...b))
							} else {
								this.opts.yAxis.data[0].min = this.format(Math.min(...e))
							}
							if (this.formatRoundNum(Math.max(...b)) <= this.formatRoundNum(Math.max(...
									e))) {
								this.opts.yAxis.data[0].max = this.formatRoundNum(Math.max(...e))
							} else {
								this.opts.yAxis.data[0].max = this.formatRoundNum(Math.max(...b))
							}
							//c   订单笔数   d退款笔数
							if (this.format(Math.min(...c)) <= this.format(Math.min(...d))) {
								this.opts.yAxis.data[1].min = this.format(Math.min(...c))
							} else {
								this.opts.yAxis.data[1].min = this.format(Math.min(...d))
							}
							if (this.formatRoundNum(Math.max(...c)) <= this.formatRoundNum(Math.max(...
									d))) {
								this.opts.yAxis.data[1].max = this.formatRoundNumten(Math.max(...c))
							} else {
								this.opts.yAxis.data[1].max = this.formatRoundNumten(Math.max(...d))
							}
							// this.opts.yAxis.data[0].min =this.format(Math.min(...b))

							// this.opts.yAxis.data[0].max = this.formatRoundNum(Math.max(...b))
							// this.opts.yAxis.data[1].min = this.format(Math.min(...c))
							// this.opts.yAxis.data[1].max = this.formatRoundNumten(Math.max(...c))
							console.log(c, '订单笔数');
							console.log(d, '退款笔数');
							console.log(e, '退款金额');
							this.chartData.categories = a
							this.chartData.series[1].data = b
							this.chartData.series[0].data = c
							this.chartData.series[2].data = d
							this.chartData.series[3].data = e
							this.selty = true
						}, 200)

					}
				})
			}
			if (this.thly.report == 1) {


				this.$api.sendRequest({
					url: '/api/salasmanstat/monthStat',
					data: {
						year_time: this.thly.day_time
					},
					success: res => {
						console.log(res.data.list, '经营月报图表');
						let a = []
						let b = []
						let c = []
						let d = []
						let e = []
						
						for (let i = 0; i < res.data.list.length; i++) {
							if (Number(res.data.list[i].date.substring(0, res.data.list[i].date.length - 1)) <= Number(myDate.getMonth() + 1 < 10 ? '0' + (myDate.getMonth() + 1) : myDate.getMonth() + 1)) {
							a.push(res.data.list[i].date)
							b.push(Number(res.data.list[i].order_money))
							c.push(Number(res.data.list[i].order_num))
							d.push(Number(res.data.list[i].order_refund_num))
							e.push(Number(res.data.list[i].order_refund_money))
							}
							
						}
						setTimeout(() => {
							console.log(a, '日期');
							if (this.format(Math.min(...b)) <= this.format(Math.min(...e))) {
								this.opts.yAxis.data[0].min = this.format(Math.min(...b))
							} else {
								this.opts.yAxis.data[0].min = this.format(Math.min(...e))
							}
							if (this.formatRoundNum(Math.max(...b)) <= this.formatRoundNum(Math.max(...
									e))) {
								this.opts.yAxis.data[0].max = this.formatRoundNum(Math.max(...e))
							} else {
								this.opts.yAxis.data[0].max = this.formatRoundNum(Math.max(...b))
							}
							//c   订单笔数   d退款笔数
							if (this.format(Math.min(...c)) <= this.format(Math.min(...d))) {
								this.opts.yAxis.data[1].min = this.format(Math.min(...c))
							} else {
								this.opts.yAxis.data[1].min = this.format(Math.min(...d))
							}
							if (this.formatRoundNum(Math.max(...c)) <= this.formatRoundNum(Math.max(...
									d))) {
								this.opts.yAxis.data[1].max = this.formatRoundNumten(Math.max(...c))
							} else {
								this.opts.yAxis.data[1].max = this.formatRoundNumten(Math.max(...d))
							}
							console.log(b, '订单金额');
							console.log(c, '订单笔数');
							console.log(d, '退款笔数');
							console.log(e, '退款金额');
							this.chartDatathly.categories = a
							this.chartDatathly.series[1].data = b
							this.chartDatathly.series[0].data = c
							this.chartDatathly.series[2].data = d
							this.chartDatathly.series[3].data = e
							this.selty = true
						}, 100)

					}
				})
			}
			if (this.thly.report == 4) {
				console.log(this.thly,'thly');
				this.$api.sendRequest({
					url: '/api/salasmanstat/goodsCateStatList',
					data: {
						start_time: this.thly.day_time,
						end_time:this.thly.end_time
					},
					success: res => {
						console.log(res.data.list, '商品分类统计图像');
						// for(let i=0;i<res.data.list.length;i++){
						// 	this.chartData.categories.push(res.data.list.date)
						// }
						let a = []
						let b = []
						let c = []
						let d = []
						let e = []
						for (let i = 0; i < res.data.list.length; i++) {
							a.push(res.data.list[i].cate_name)
							b.push(Number(res.data.list[i].order_goods_money))
							c.push(Number(res.data.list[i].order_goods_num))
							d.push(Number(res.data.list[i].order_refund_goods_num))
							e.push(Number(res.data.list[i].order_refund_goods_money))
						}
						setTimeout(() => {
							console.log(a, '日期');
							console.log(b, '订单金额');
							console.log(c, '订单笔数');
							console.log(d, '退款笔数');
							console.log(e, '退款金额');
							this.types.categories = a
							if (this.format(Math.min(...b)) <= this.format(Math.min(...e))) {
								this.opts.yAxis.data[0].min = this.format(Math.min(...b))
							} else {
								this.opts.yAxis.data[0].min = this.format(Math.min(...e))
							}
							if (this.formatRoundNum(Math.max(...b)) <= this.formatRoundNum(Math.max(...
									e))) {
								this.opts.yAxis.data[0].max = this.formatRoundNum(Math.max(...e))
							} else {
								this.opts.yAxis.data[0].max = this.formatRoundNum(Math.max(...b))
							}
							//c   订单笔数   d退款笔数
							if (this.format(Math.min(...c)) <= this.format(Math.min(...d))) {
								this.opts.yAxis.data[1].min = this.format(Math.min(...c))
							} else {
								this.opts.yAxis.data[1].min = this.format(Math.min(...d))
							}
							if (this.formatRoundNum(Math.max(...c)) <= this.formatRoundNum(Math.max(...
									d))) {
								this.opts.yAxis.data[1].max = this.formatRoundNumten(Math.max(...c))
							} else {
								this.opts.yAxis.data[1].max = this.formatRoundNumten(Math.max(...d))
							}
							this.types.series[1].data = b
							this.types.series[0].data = c
							this.types.series[2].data = d
							this.types.series[3].data = e
							this.selty = true
						}, 100)

					}
				})
			}
			if (this.thly.report == 6) {
				this.$api.sendRequest({
					url: '/api/salasmanstat/memberTypeStatList',
					data: {
						day_time: this.thly.day_time
					},
					success: res => {

						console.log(res.data.list, '客户分类统计');
						// for(let i=0;i<res.data.list.length;i++){
						// 	this.chartData.categories.push(res.data.list.date)
						// }
						let a = []
						let b = []
						let c = []
						let d = []
						let e = []
						for (let i = 0; i < res.data.list.length; i++) {
							a.push(res.data.list[i].type_name)
							b.push(Number(res.data.list[i].order_money))
							c.push(Number(res.data.list[i].order_num))
							d.push(Number(res.data.list[i].order_refund_num))
							e.push(Number(res.data.list[i].order_refund_num))
						}
						setTimeout(() => {
							console.log(a, '分类');
							console.log(b, '订单金额');
							console.log(c, '订单笔数');
							console.log(d, '退款笔数');
							console.log(e, '退款金额');
							this.chartData.categories = a
							if (this.format(Math.min(...b)) <= this.format(Math.min(...e))) {
								this.opts.yAxis.data[0].min = this.format(Math.min(...b))
							} else {
								this.opts.yAxis.data[0].min = this.format(Math.min(...e))
							}
							if (this.formatRoundNum(Math.max(...b)) <= this.formatRoundNum(Math.max(...
									e))) {
								this.opts.yAxis.data[0].max = this.formatRoundNum(Math.max(...e))
							} else {
								this.opts.yAxis.data[0].max = this.formatRoundNum(Math.max(...b))
							}
							//c   订单笔数   d退款笔数
							if (this.format(Math.min(...c)) <= this.format(Math.min(...d))) {
								this.opts.yAxis.data[1].min = this.format(Math.min(...c))
							} else {
								this.opts.yAxis.data[1].min = this.format(Math.min(...d))
							}
							if (this.formatRoundNum(Math.max(...c)) <= this.formatRoundNum(Math.max(...
									d))) {
								this.opts.yAxis.data[1].max = this.formatRoundNumten(Math.max(...c))
							} else {
								this.opts.yAxis.data[1].max = this.formatRoundNumten(Math.max(...d))
							}
							this.chartData.series[1].data = b
							this.chartData.series[0].data = c
							this.chartData.series[2].data = d
							this.chartData.series[3].data = e
							this.selty = true
						}, 100)

					}
				})
			}
			if (this.thly.report == 8) {
				console.log(this.thly,'thly');
				this.$api.sendRequest({
						url: '/api/salasmanstat/areaStatList',
						data: {
									start_time: this.thly.day_time,
									end_time:this.thly.end_time,
							},
						success:res=>{
							console.log(res.data.list,'地区统计图表');
							let a = []
							let b = []
							let c = []
							let d = []
							let e = []
							for (let i = 0; i < res.data.list.length; i++) {
											
								a.push(res.data.list[i].province_name)
								b.push(Number(res.data.list[i].order_money))
								c.push(Number(res.data.list[i].order_num))
								d.push(Number(res.data.list[i].order_refund_num))
								e.push(Number(res.data.list[i].order_refund_money))
							}
										setTimeout(() => {
							// 				console.log(a, '日期');
											if (this.format(Math.min(...b)) <= this.format(Math.min(...e))) {
												this.opts.yAxis.data[0].min = this.format(Math.min(...b))
											} else {
												this.opts.yAxis.data[0].min = this.format(Math.min(...e))
											}
											if (this.formatRoundNum(Math.max(...b)) <= this.formatRoundNum(Math.max(...
													e))) {
												this.opts.yAxis.data[0].max = this.formatRoundNum(Math.max(...e))
											} else {
												this.opts.yAxis.data[0].max = this.formatRoundNum(Math.max(...b))
											}
											//c   订单笔数   d退款笔数
											if (this.format(Math.min(...c)) <= this.format(Math.min(...d))) {
												this.opts.yAxis.data[1].min = this.format(Math.min(...c))
											} else {
												this.opts.yAxis.data[1].min = this.format(Math.min(...d))
											}
											if (this.formatRoundNum(Math.max(...c)) <= this.formatRoundNum(Math.max(...
													d))) {
												this.opts.yAxis.data[1].max = this.formatRoundNumten(Math.max(...c))
											} else {
												this.opts.yAxis.data[1].max = this.formatRoundNumten(Math.max(...d))
											}
											console.log(b, '订单金额');
											console.log(c, '订单笔数');
											console.log(d, '退款笔数');
											console.log(e, '退款金额');
											this.types.categories = a
											this.types.series[1].data = b
											this.types.series[0].data = c
											this.types.series[2].data = d
											this.types.series[3].data = e
											this.selty = true
										}, 100)
							
							// 		}
							// 	})
							
						}
				})
			
			
			}
		},
		
	}
</script>

<style lang="scss">

</style>
