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
|
| <template>
| <div class="Price" v-if="priceNew">
| ¥<span class="newPrice">{{ priceN1 }}</span
| >{{ priceN2 }}/年
| <span class="iconSave" v-if="showIcon">省</span>
| <span class="oldPrice">¥{{ priceO1 }}{{ priceO2 }}/年</span>
| </div>
| </template>
|
| <script>
| export default {
| props: {
| priceNew: {},
| showIcon: {
| default: false,
| },
| },
| data() {
| return {
| priceN1: "",
| priceN2: "",
| priceO1: "",
| priceO2: "",
| };
| },
| created() {
| const priceO = (this.priceNew * 1.2 + "").split(".");
| const priceN = (this.priceNew + "").split(".");
| if (priceN.length > 1) {
| this.priceN1 = priceN[0];
| this.priceN2 = "." + priceN[1];
| } else {
| this.priceN1 = priceN[0];
| this.priceN2 = ".00";
| }
| if (priceO.length > 1) {
| this.priceO1 = priceO[0];
| this.priceO2 = "." + priceO[1];
| } else {
| this.priceO1 = priceO[0];
| this.priceO2 = ".00";
| }
| },
| };
| </script>
|
| <style lang="scss" scoped>
| .Price {
| margin: 0 20px 0 20px;
| font-size: 14px;
| text-align: left;
|
| display: -webkit-box;
| -webkit-box-orient: vertical;
| -webkit-line-clamp: 1;
| overflow: hidden;
| text-overflow: ellipsis;
|
| .newPrice {
| font-size: 30px;
| color: rgb(255, 96, 0);
| font-weight: 700;
| }
|
| .oldPrice {
| margin-left: 10px;
| font-size: 14px;
| color: #999999;
| text-decoration: line-through;
| }
|
| .iconSave {
| display: inline-block;
| width: 18px;
| height: 18px;
| font-size: 12px;
| color: #fff;
| line-height: 18px;
| text-align: center;
| background: #ff6000;
| border-radius: 2px;
| }
| }
| </style>
|
|