投屏pc端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

139 lines
3.6 KiB

6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
  1. <template>
  2. <div class="datalist-box">
  3. <div class="datalist-title hc-bgColor3">
  4. <span class="tit-span">{{$t('盘口')}}</span>
  5. </div>
  6. <div class="datalist-list1">
  7. <div class="table-box">
  8. <div class="deal-list deal-list-title">
  9. <ul>
  10. <li>{{$t('价格')}}({{currentPair.convertType}})</li>
  11. <li>{{$t('数量')}}({{currentPair.dealCoin}})</li>
  12. <li>{{$t('累计')}}({{currentPair.dealCoin}})</li>
  13. </ul>
  14. </div>
  15. <div class="deal-folder" :class="{'deal-folder-open': depthListType == 3}" v-if="depthListType != 2">
  16. <!-- 买单 -->
  17. <div class="deal-list">
  18. <ul v-for="(item, index) of buyDepth" :key="index">
  19. <li><span class="red-text">{{item.price}}</span></li>
  20. <li><span>{{item.remain}}</span></li>
  21. <li><span>{{item.amount}}</span></li>
  22. </ul>
  23. </div>
  24. </div>
  25. <div class="deal-list-update">
  26. <h3>
  27. <span class="red-text" :class="{'green-text': currentPair.changes > 0}">{{currentPair.price}}</span>
  28. <i> {{currentPair.price * 7 | Decimal(2)}} CNY</i>
  29. </h3>
  30. <span class="more-aa hc-color4">
  31. {{$t('更多')}}
  32. </span>
  33. </div>
  34. <div class="deal-folder" :class="{'deal-folder-open': depthListType == 2}" v-if="depthListType != 3">
  35. <!-- 卖单 -->
  36. <div class="deal-list">
  37. <ul v-for="(item, index) of sellDepth" :key="index">
  38. <li><span class="green-text">{{item.price}}</span></li>
  39. <li><span>{{item.remain}}</span></li>
  40. <li><span>{{item.amount}}</span></li>
  41. </ul>
  42. </div>
  43. </div>
  44. </div>
  45. </div>
  46. <div class="deallist-operation hc-bgColor3">
  47. <div class="deal-list-range">
  48. <!-- 普通 -->
  49. <div class="list-range-1" :class="{'active': depthListType == 1}" @click="changeList(1)"></div>
  50. <!-- 只显示买单 -->
  51. <div class="list-range-2" :class="{'active': depthListType == 2}" @click="changeList(2)"></div>
  52. <!-- 只显示卖单 -->
  53. <div class="list-range-3" :class="{'active': depthListType == 3}" @click="changeList(3)"></div>
  54. </div>
  55. <div class="deal-list-type">
  56. <el-select v-model="depth" @change="chooseDepth">
  57. <el-option v-for="item in depthOptions" :key="item.value" :label="item.label" :value="item.value">
  58. </el-option>
  59. </el-select>
  60. </div>
  61. <div class="clearfix"></div>
  62. </div>
  63. </div>
  64. </template>
  65. <script>
  66. import { mapState } from 'vuex'
  67. export default {
  68. name: 'tradeDepth',
  69. props: {
  70. depthValue: Number,
  71. },
  72. data() {
  73. return {
  74. timers:'',
  75. depthListType: 1, //1全部 2买单 3卖单
  76. depth: 0, //深度
  77. depthOptions: [ //深度
  78. {value: 0, label: '深度1'},
  79. {value: 1, label: '深度2'},
  80. {value: 2, label: '深度3'},
  81. {value: 3, label: '深度4'},
  82. ],
  83. }
  84. },
  85. computed: {
  86. ...mapState('trend', ['currentPair', 'buyList', 'sellList']),
  87. buyDepth() {
  88. let list = [];
  89. let buyLength = this.depthListType == 2 ? 30: 15;
  90. this.buyList.forEach((item, index) => {
  91. if(index < buyLength) {
  92. list.push(item)
  93. }
  94. });
  95. return list;
  96. },
  97. sellDepth() {
  98. let list = [];
  99. let sellLength = this.depthListType == 3 ? 30: 15;
  100. this.sellList.forEach((item, index) => {
  101. if(index < sellLength) {
  102. list.push(item)
  103. }
  104. });
  105. console.log(JSON.stringify(list)+'卖卖卖')
  106. return list;
  107. },
  108. },
  109. methods: {
  110. chooseDepth(val) { //切换深度
  111. this.$emit('chooseDepth', val);
  112. },
  113. changeList(val) { //切换列表类型
  114. this.depthListType = val;
  115. }
  116. },
  117. }
  118. </script>
  119. <style scoped>
  120. .deal-folder {
  121. height: 300px;
  122. }
  123. .deal-folder-open {
  124. height: 600px;
  125. }
  126. </style>