ZZJ
2022-03-09 cc7401e771e13b40bb7dea11ec26da3acfc8e5c7
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
 
<template>
  <div class="price">
    ¥<span class="newPrice">{{ priceNew1 }}</span
    >.{{ priceNew2 }}/年
    <span class="oldPrice">¥{{ priceOld }}/年</span>
  </div>
</template>
 
<script>
export default {
  props: {
    priceNew: {},
    priceOld: {},
  },
  computed: {
    priceNew1() {
      let prcie = "";
      if (typeof this.priceNew == Number) {
        prcie = `${this.priceNew}`.split(".")[0];
      } else {
        prcie = this.priceNew.split(".")[0];
      }
      return prcie;
    },
    priceNew2() {
      let prcie = "";
      if (typeof this.priceNew == Number) {
        prcie = `${this.priceNew}`.split(".")[1];
      } else {
        prcie = this.priceNew.split(".")[1];
      }
      return prcie;
    },
  },
};
</script>
 
<style lang="scss" scoped>
.price {
  margin: 0 20px 0 20px;
  font-size: 14px;
  text-align: left;
 
  .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;
  }
}
</style>