wang-hao-jie
2022-01-05 3a9879dfcf271846605c7f896d0397472cf5e839
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
<template>
  <div class="card-chart-line">
    <Card>
      <p slot="title" class="card-title">销售量统计</p>
      <div slot="extra">
        <DatePicker type="year" placeholder="选择查看的年份" style="width: 220px"></DatePicker>
      </div>
      <div class="wrap">
        <div class="chart">
          <apexchart type="line" height="280" :options="chartOptions" :series="series" />
        </div>
        <Row class="row">
          <Col span="8" class="text">
            <h6 class>总销售额</h6>
            <h3>¥10,345</h3>
          </Col>
          <Col span="8" class="text">
            <h6 class>本月</h6>
            <h3>¥7,589</h3>
          </Col>
          <Col span="8" class="text">
            <h6 class>本周</h6>
            <h3>¥1,476</h3>
          </Col>
        </Row>
      </div>
    </Card>
  </div>
</template>
 
<script>
var zh = require("../../../../libs/zh.json");
export default {
  name: "line-chart",
  components: {},
  props: {},
  data() {
    return {
      series: [
        {
          name: "",
          data: []
        }
      ],
      chartOptions: {
        colors: ["#599df9"],
        chart: {
          zoom: {
            enabled: false
          },
          locales: [zh],
          defaultLocale: "zh"
        },
        stroke: {
          width: 3,
          curve: "straight"
        },
        dataLabels: {
          enabled: false
        },
        markers: {
          size: 4
        },
        xaxis: {
          labels: {
            formatter: function(value) {
              return value + "月";
            }
          },
          categories: [
            "1",
            "2",
            "3",
            "4",
            "5",
            "6",
            "7",
            "8",
            "9",
            "10",
            "11",
            "12"
          ]
        }
      }
    };
  },
  methods: {
    init() {
      this.series = [
        {
          name: "销售金额",
          data: [10, 41, 35, 51, 49, 62, 69, 91, 148, 110, 140, 135]
        }
      ];
    }
  },
  mounted() {
    this.init();
  }
};
</script>
<style lang="less">
.card-chart-line {
  .ivu-card-head {
    border-bottom: none !important;
  }
  .card-title {
    color: #67757c;
  }
  .wrap {
    height: 370px;
    .text {
      padding: 1rem;
      text-align: center;
      color: #67757c;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
      h6 {
        font-size: 0.875rem;
        margin-bottom: 0.5rem;
        line-height: 1.2;
      }
      h3 {
        font-size: 1.3125rem;
        margin-bottom: 0.5rem;
        font-weight: 400;
        line-height: 1.2;
      }
    }
  }
}
</style>