PositionIndex.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  1. <template>
  2. <!-- 持仓 -->
  3. <div class="position flex-col">
  4. <div class="box1 flex-col">
  5. <s-header :name="$t('position.machineSalesRanking')" :noback="true" :isFixed="false"></s-header>
  6. <div class="positionBox1 flex-col">
  7. <div class="searchRow flex-row justify-between">
  8. <div class="flex-col">
  9. <div class="flex-row justify-between bd3">
  10. <div class="flex-col outer4"></div>
  11. <span class="flex-col txt2">持仓情况</span>
  12. </div>
  13. </div>
  14. </div>
  15. </div>
  16. <img class="pic1" src="../../assets/device/line.png" />
  17. </div>
  18. <div>
  19. <div class="o-plr-15 o-ptb-20">
  20. <div class="bd1 flex-col">
  21. <div class="box2 l-f l-flex-c l-flex-j-a">
  22. <div class="TextGroup flex-col">
  23. <div class="main6 flex-col justify-between align-center">
  24. <span class="word5">11.5</span>
  25. <span class="word6">现价</span>
  26. </div>
  27. </div>
  28. <div class="TextGroup flex-col">
  29. <div class="main6 flex-col justify-between align-center">
  30. <span class="word5">100.8</span>
  31. <span class="word6">当日盈亏</span>
  32. </div>
  33. </div>
  34. <div class="TextGroup flex-col">
  35. <div class="main6 flex-col justify-between align-center">
  36. <span class="word5">2000.50</span>
  37. <span class="word6">总盈亏</span>
  38. </div>
  39. </div>
  40. </div>
  41. </div>
  42. </div>
  43. </div>
  44. <div class="positionBox">
  45. </div>
  46. <img class="img1" referrerpolicy="no-referrer" src="../../assets/line.png" />
  47. <div class="groove"></div>
  48. <div class="tradingHistory">
  49. <!-- 交易历史 -->
  50. <div class="searchRow flex-row justify-between">
  51. <div class="flex-col">
  52. <div class="flex-row justify-between bd3">
  53. <div class="flex-col outer4"></div>
  54. <span class="flex-col txt2">
  55. 交易历史</span>
  56. </div>
  57. </div>
  58. <!-- 搜索 -->
  59. <div class="flex-col">
  60. <div class="main5 flex-row justify-between" @click="searchClick">
  61. <img class="label2" src="../../assets/position/searchIcon.png" />
  62. </div>
  63. </div>
  64. </div>
  65. </div>
  66. <!-- 历史记录明细 -->
  67. <van-list v-model:loading="loading" :finished="finished" finished-text="没有更多了" @load="onLoad">
  68. <van-cell v-for="item in orderHisList" :key="item" :title="item" />
  69. </van-list>
  70. <van-empty image="search" description="暂无交易历史" />
  71. <div class="historyList">
  72. </div>
  73. <!-- 使用搜索弹窗组件 -->
  74. <SearchPop :showSearchPop="showSearchPop" @update:showSearchPop="handleUpdateShowSearchPop" />
  75. <div style="height: 50px;"></div>
  76. <TestComp param="哈哈哈" />
  77. </div>
  78. </template>
  79. <script setup>
  80. // 导入无数据组件
  81. import sHeader from "@/components/SimpleHeader"
  82. import { onMounted, ref } from "vue"
  83. import SearchPop from './SearchPop.vue';
  84. import TestComp from './TestComp.vue'
  85. import { listMyOrderHis } from "@/service/position";
  86. const showSearchPop = ref(false);
  87. const orderHisList = ref([]);
  88. const loading = ref(false)
  89. const finished = ref(false)
  90. // const getOrderHisListFunc = async () => {
  91. // const params = {
  92. // current: 1,
  93. // size: 10
  94. // }
  95. // setTimeout(() => {
  96. // const { data } = listMyOrderHis(params).then((res) => {
  97. // orderHisList.value = res.data.data;
  98. // })
  99. // if (data.code === '00000') {
  100. // console.log("获取交易历史成功!");
  101. // console.log(data.data);
  102. // // 加载状态结束
  103. // loading.value = false;
  104. // // 数据全部加载完成
  105. // if (orderHisList.value.length >= 40) {
  106. // finished.value = true;
  107. // }
  108. // }
  109. // }, 1000);
  110. // }
  111. // TODO: 2024-04-12
  112. const onLoad = () => {
  113. // 异步更新数据
  114. setTimeout(() => {
  115. const params = {
  116. current: 1,
  117. size: 10
  118. }
  119. const { data } = listMyOrderHis(params).then((res) => {
  120. orderHisList.value = res.data.data;
  121. })
  122. if (data.code === '00000') {
  123. console.log("获取交易历史成功!");
  124. console.log(data.data);
  125. // 加载状态结束
  126. loading.value = false;
  127. // 数据全部加载完成
  128. if (orderHisList.value.length >= 40) {
  129. finished.value = true;
  130. }
  131. }
  132. // 加载状态结束
  133. loading.value = false;
  134. // 数据全部加载完成
  135. if (orderHisList.value.length >= 4) {
  136. finished.value = true;
  137. }
  138. }, 1000);
  139. };
  140. onMounted(async () => {
  141. // getOrderHisListFunc()
  142. onLoad
  143. });
  144. const searchClick = () => {
  145. console.log("点击搜索");
  146. showSearchPop.value = true;
  147. }
  148. // 处理子组件传递回来的更新事件
  149. const handleUpdateShowSearchPop = (val) => {
  150. showSearchPop.value = val;
  151. }
  152. </script>
  153. <style lang="less" scoped>
  154. @import "../../styles/position/index.less";
  155. </style>