index.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  1. <template>
  2. <view class="history-box" :rise-fall="stocksColor">
  3. <headContent borderBottom>
  4. <template #left>
  5. <reverse-back />
  6. </template>
  7. <template #content>
  8. <view class="haed-title">
  9. 合约历史
  10. </view>
  11. </template>
  12. </headContent>
  13. <view class="swiper-lable">
  14. <template v-for="(item , index) in historyLable">
  15. <view @click.stop="historyIdex = index"
  16. :class="['swiper-lable-item' , historyIdex === index ? 'active-swiper-lable' : '']">
  17. {{ item.name }}
  18. </view>
  19. </template>
  20. </view>
  21. <view class="">
  22. <!-- <u-swiper :list="list1" @change="change" ></u-swiper> -->
  23. <swiper class="swiper-content" :current="historyIdex"
  24. :style="{'height': swiperHeight ? `${swiperHeight}px` : '' }">
  25. <swiper-item class="swiper-item-box">
  26. <at-present :listHeight="swiperHeight" :status="historyLable[historyIdex].status" :legal_id="legal_id" :currency_id="currency_id"/>
  27. <!-- <view class="swiper-item" :style="{'height': listHeight[0] ? `${listHeight[0]}px` : '' }">{{ listHeight[0] }}</view> -->
  28. </swiper-item>
  29. <swiper-item>
  30. <history :listHeight="swiperHeight" :status="historyLable[historyIdex].status" />
  31. <!-- <view class="swiper-item uni-bg-green">B</view> -->
  32. </swiper-item>
  33. <swiper-item>
  34. <turnover :listHeight="swiperHeight" :status="historyLable[historyIdex].status" />
  35. </swiper-item>
  36. </swiper>
  37. </view>
  38. </view>
  39. </template>
  40. <script>
  41. import {
  42. mapGetters
  43. } from 'vuex'
  44. import entrust from "../sustainability/entrust.vue"
  45. import atPresent from "./at-present.vue"
  46. import history from "./history.vue"
  47. import turnover from "./turnover.vue"
  48. import {
  49. Api_getRegister
  50. } from "@/api/index.js"
  51. export default {
  52. name: 'contract-history',
  53. components: {
  54. entrust,
  55. history,
  56. turnover,
  57. atPresent
  58. },
  59. data() {
  60. return {
  61. legal_id:'',
  62. currency_id:'',
  63. swiperHeight: 0,
  64. historyIdex: 2,
  65. historyLable: [
  66. // 类型:
  67. // -1:历史仓位;
  68. // 3:成交记录;
  69. // 0:当前委托;
  70. // 1:当前持仓
  71. // (无历史委托,成交的委托会转 1 当前持仓,成交后转 成交记录)
  72. {
  73. name: '当前委托',
  74. status: 0,
  75. },
  76. // {
  77. // name:'当前委托',
  78. // status: 0,
  79. // },
  80. {
  81. name: '历史仓位',
  82. status: -1,
  83. },
  84. {
  85. name: '成交记录',
  86. status: 3,
  87. }
  88. ],
  89. historyData:[
  90. [],
  91. [],
  92. []
  93. ]
  94. };
  95. },
  96. computed: {
  97. ...mapGetters([
  98. "stocksColor",
  99. 'PageContentHeight'
  100. ])
  101. },
  102. watch: {
  103. PageContentHeight: {
  104. handler(newH) {
  105. if (newH) {
  106. this.swiperHeight = newH - uni.upx2px(96) - 10;
  107. }
  108. },
  109. immediate: true
  110. },
  111. },
  112. onLoad(opt) {
  113. this.legal_id = opt?.legal_id;
  114. this.currency_id = opt?.currency_id;
  115. // ?legal_id=3&currency_id=1
  116. },
  117. mounted() {
  118. },
  119. methods: {
  120. }
  121. }
  122. </script>
  123. <style lang="scss" scoped>
  124. @import "~../sustainability/index.scss";
  125. .history-box {
  126. width: 100%;
  127. height: 100vh;
  128. // <view class="swiper-lable">
  129. // <template v-for="(item , index) in historyLable">
  130. // <view class="swiper-lable-item">{{ item.name }}</view>
  131. // </template>
  132. // </view>
  133. .swiper-lable {
  134. padding: 0 $pages-padding;
  135. width: 100%;
  136. height: 96rpx;
  137. border-bottom: 1rpx solid $border-color;
  138. background-color: #fff;
  139. display: flex;
  140. align-items: stretch;
  141. .swiper-lable-item {
  142. display: flex;
  143. align-items: center;
  144. font-size: 28rpx;
  145. color: rgba(107, 105, 105, 0.9);
  146. &:nth-child(n + 2) {
  147. margin-left: 30rpx;
  148. }
  149. }
  150. .active-swiper-lable {
  151. position: relative;
  152. color: $Theme-Color;
  153. &::before {
  154. content: '';
  155. position: absolute;
  156. left: 50%;
  157. bottom: 0;
  158. width: 40rpx;
  159. height: 7rpx;
  160. background-color: $Theme-Color;
  161. transform: translateX(-50%);
  162. border-radius: 8rpx;
  163. }
  164. }
  165. }
  166. .swiper-content {
  167. width: 100%;
  168. .swiper-item-box {
  169. width: 100%;
  170. height: 100%;
  171. }
  172. .swiper-list {}
  173. }
  174. }
  175. </style>