123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324 |
- <template>
- <moduleEnclosure title="近30日电子支付订单趋势">
- <div id="orderEcharts1" style="width: 100%; height: 100%"></div>
- </moduleEnclosure>
- </template>
- <script>
- import moduleEnclosure from '@/components/moduleEnclosure.vue'
- import * as echarts from 'echarts'
- import { getOrderTrend } from '@/api/bigView.js'
- import { csize } from '@/utils/const.js'
- let myChart4
- export default {
- components: {
- moduleEnclosure
- },
- data() {
- return {
- myChart2: null
- }
- },
- mounted() {
- getOrderTrend().then(res => {
- this.initEcharts(res.data)
- })
- },
- beforeUnmount() {},
- methods: {
- getDate() {
- const today = new Date()
- const dates = []
- for (let i = 0; i < 30; i++) {
- const d = new Date()
- d.setDate(today.getDate() - i)
- dates.unshift(d.toISOString().split('T')[0].slice(5, 11))
- }
- return dates
- },
- initEcharts(data) {
- var times = this.getDate()
- var data1 = data.map(item => {
- return item.sxdds || 0
- })
- var data2 = data.map(item => {
- return item.fcdds || 0
- })
- var data3 = data.map(item => {
- return item.pjdds || 0
- })
- var data4 = data.map(item => {
- return item.zzdds || 0
- })
- if (myChart4) {
- myChart4.dispose()
- }
- myChart4 = new echarts.init(document.getElementById('orderEcharts1'))
- myChart4.setOption({
- tooltip: {
- confine: true,
- trigger: 'axis',
- transitionDuration: 0,
- backgroundColor: '#092a66',
- borderColor: '#0462b5',
- borderRadius: 8,
- borderWidth: 2,
- padding: [5, 10],
- axisPointer: {
- type: 'line',
- lineStyle: {
- type: 'dashed',
- color: '#8AB1DC'
- }
- },
- textStyle: {
- color: '#ffffff'
- }
- },
- legend: {
- icon: 'circle',
- itemWidth: 8,
- itemHeight: 8,
- itemGap: 10,
- top: '16',
- right: '10',
- data: ['新增辅材单', '新增配件单'],
- textStyle: {
- color: '#A9BBCC'
- }
- },
- grid: {
- x: csize(40),
- y: csize(50),
- x2: csize(20),
- y2: csize(20)
- },
- xAxis: [
- {
- type: 'category',
- boundaryGap: false,
- axisLabel: {
- interval: Math.floor(times.length / 10),
- showMinLabel: true, //是否显示最小 tick 的 label
- showMaxLabel: true, //是否显示最大 tick 的 label
- fontSize: csize(12)
- },
- axisLine: {
- show: false,
- lineStyle: {
- color: '#8AB1DC'
- }
- },
- axisTick: {
- show: false
- },
- data: times
- }
- ],
- yAxis: [
- {
- type: 'value',
- minInterval: 1,
- name: '(单/台)',
- nameTextStyle: {
- color: '#aaa',
- nameLocation: 'start'
- // align: 'right'
- },
- axisLine: {
- show: false,
- lineStyle: {
- color: '#8AB1DC'
- }
- },
- axisLabel: {
- margin: 10,
- textStyle: {
- fontSize: csize(12)
- }
- },
- splitLine: {
- lineStyle: {
- color: 'rgba(256, 256, 256, 0.1)'
- }
- },
- axisTick: {
- show: false
- }
- }
- ],
- series: [
- // {
- // name: '新增销售单',
- // type: 'line',
- // smooth: true,
- // showSymbol: false,
- // lineStyle: {
- // normal: {
- // width: 2
- // }
- // },
- // areaStyle: {
- // normal: {
- // color: new echarts.graphic.LinearGradient(
- // 0,
- // 0,
- // 0,
- // 1,
- // [
- // {
- // offset: 0,
- // color: 'rgba(253, 173, 96, 0.3)'
- // },
- // {
- // offset: 0.8,
- // color: 'rgba(253, 173, 96, 0)'
- // }
- // ],
- // false
- // ),
- // shadowColor: 'rgba(0, 0, 0, 0.1)',
- // shadowBlur: 10
- // }
- // },
- // itemStyle: {
- // normal: {
- // color: '#FDAD60'
- // }
- // },
- // data: data1
- // },
- {
- name: '新增辅材单',
- type: 'line',
- smooth: true,
- showSymbol: false,
- lineStyle: {
- normal: {
- width: 2
- }
- },
- areaStyle: {
- normal: {
- color: new echarts.graphic.LinearGradient(
- 0,
- 0,
- 0,
- 1,
- [
- {
- offset: 0,
- color: 'rgba(68, 226, 143, 0.3)'
- },
- {
- offset: 0.8,
- color: 'rgba(68, 226, 143, 0)'
- }
- ],
- false
- ),
- shadowColor: 'rgba(0, 0, 0, 0.1)',
- shadowBlur: 10
- }
- },
- itemStyle: {
- normal: {
- color: '#44E28F'
- }
- },
- data: data2
- },
- {
- name: '新增配件单',
- type: 'line',
- smooth: true,
- showSymbol: false,
- lineStyle: {
- normal: {
- width: 2
- }
- },
- areaStyle: {
- normal: {
- color: new echarts.graphic.LinearGradient(
- 0,
- 0,
- 0,
- 1,
- [
- {
- offset: 0,
- color: 'rgba(160, 61, 239, 0.3)'
- },
- {
- offset: 0.8,
- color: 'rgba(160, 61, 239, 0)'
- }
- ],
- false
- ),
- shadowColor: 'rgba(0, 0, 0, 0.1)',
- shadowBlur: 10
- }
- },
- itemStyle: {
- normal: {
- color: '#A03DEF'
- }
- },
- data: data3
- }
- // {
- // name: '新增增值单',
- // type: 'line',
- // smooth: true,
- // showSymbol: false,
- // lineStyle: {
- // normal: {
- // width: 2
- // }
- // },
- // areaStyle: {
- // normal: {
- // color: new echarts.graphic.LinearGradient(
- // 0,
- // 0,
- // 0,
- // 1,
- // [
- // {
- // offset: 0,
- // color: 'rgba(65, 197, 226, 0.3)'
- // },
- // {
- // offset: 0.8,
- // color: 'rgba(65, 197, 226, 0)'
- // }
- // ],
- // false
- // ),
- // shadowColor: 'rgba(0, 0, 0, 0.1)',
- // shadowBlur: 10
- // }
- // },
- // itemStyle: {
- // normal: {
- // color: '#41C5E2'
- // }
- // },
- // data: data4
- // }
- ]
- })
- }
- }
- }
- </script>
- <style></style>
|