1
jhzh
2025-06-16 1760942f9204e56032ca93ff1b720bbf966dd495
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
<template>
  <div>
    <!-- 深度图 -->
    <!-- <div class="depth-map">
      <depth-map :serveSellList="sellList" :serveBuyList="buyList" />
    </div> -->
    <div class="d-flex fn-sm buy-and-sell" style="margin: 12px;height: 200px;">
      <div :class="query.code!='GITP/USDT'?'w-6/12 buy':'w-12/12 buy'" style="background-color: #F7F8FC;margin-right: 12px;">
        <div class="d-flex justify-between p-xs" style="color: #969BA1;">
          <div>{{$t('exchange.c5')}}</div>
          <div>{{$t('exchange.f3')}}</div>
        </div>
        <div class="d-flex item justify-between p-xs" v-for="(item,idx) in buyList" :key="idx" >
          <div class="progress bg-buy-transparent transition-default" :style="{width:getValue(item.amount)+'%'}"></div>
          <div class="color-light">{{item.amount}}</div>
 
          <div class="color-buy">{{item.price}}</div>
        </div>
      </div>
      <div class="w-6/12 sell" style="background-color: #F7F8FC;">
        <div class="d-flex justify-between p-xs" style="color: #969BA1;">
          <div >{{$t('exchange.c5')}}</div>
          <div>{{$t('exchange.f4')}}</div>
        </div>
        <div class="d-flex item justify-between p-xs" v-for="(item,idx) in sellList" :key="idx">
          <div class="progress bg-sell-transparent transition-default" :style="{width:getValue(item.amount)+'%'}"></div>
          <div class="color-light">{{item.amount}}</div>
 
          <div class="color-sell">{{item.price}}</div>
        </div>
      </div>
    </div>
  </div>
</template>
<script>
import depthMap from "./depth-map";
import math from "@/utils/class/math";
export default {
  props: {
    sellList: {
      default() {
        return [];
      },
      type: Array,
    },
    buyList: {
      default() {
        return [];
      },
      type: Array,
    },
    query:{
        default:{}
    }
  },
  components: {
    depthMap,
  },
  methods: {
    // 计算深度 当前数量 / 买卖最大值
    getValue(amount) {
      const arr = this.buyList.concat(this.sellList).map((item) => item.amount);
      let max = Math.max(...arr);
      return math.division(amount, max, 2) * 100;
    },
  },
  mounted() {
  },
};
</script>
<style lang="scss" scoped>
.buy-and-sell {
  .item {
    position: relative;
    .progress {
      position: absolute;
      height: 100%;
      top: 0;
    }
  }
  .buy {
    .progress {
      left: 0;
    }
  }
  .sell {
    .progress {
      right: 0;
    }
  }
}
</style>