index.vue 4.1 KB

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