jhzh
2024-09-28 1cdd7b754a7b112d36c4e84bb45309dc81f4505e
src/page/list/trading-list.vue
@@ -1,478 +1,107 @@
<template>
  <div class="tr_list_page">
    <div class="content">
      <div class="tabs">
        <div class="top_title">
          <div class="tabs_title">
            <div
              class="tb"
              v-for="(item, index) in tabsArr"
              :key="index"
              @click="handleTabsClick(item, index)"
            >
              <span :class="index === tabsIndex ? 'active' : ''">{{ item }}</span>
            </div>
  <div>
    <!-- 搜索框 -->
    <div class="search">
      <div class="search_content">
        <div class="left_search">
          <div class="search_img">
            <img src="../../assets/img/searchs.png" alt />
          </div>
          <div class="right_money"></div>
        </div>
        <div class="bottom_content" v-if="tabsIndex === 1">
          <!-- 搜索框 -->
          <div class="search">
            <div class="search_content">
              <div class="left_search">
                <div class="search_img">
                  <img src="../../assets/img/search2.png" alt />
                </div>
                <div class="search_input">
                  <input type="text" class="searchs" placeholder="输入品种名称/代码搜索" />
                </div>
              </div>
              <div class="right_search_class">
                <img src="../../assets/img/fenlei2.png" alt />
              </div>
            </div>
          </div>
          <div class="tab_class">
            <div class="scroll_tab">
              <div
                class="tab_items"
                v-for="(item, index) in tabsClassArr"
                :key="index"
                @click="handleTabsItem(item, index)"
              >
                <span :class="tabsItemIndex === index ? 'active' : ''">{{ item.name }}</span>
              </div>
            </div>
          </div>
          <div class="kai_mess">
            <div class="left_identity_img">
              <img src="../../assets/img/shenfen.png" alt />
            </div>
            <div class="text">
              <span>{{ '开户即可入金交易' }}</span>
            </div>
            <div class="right_go">
              <img src="../../assets/img/yuoujiantou.png" alt />
            </div>
          </div>
          <div class="list_title">
            <div class="item_title varieties">
              <span>{{ '品种' }}</span>
            </div>
            <div class="item_title latest_price">
              <span>{{ '最新价' }}</span>
            </div>
            <div class="item_title applies">
              <span>{{ '涨跌幅' }}</span>
            </div>
          </div>
          <div class="list">
            <div class="list_items">
              <div class="item" v-for="(item, index) in listArr" :key="index">
                <div class="left_title">
                  <div class="tp">
                    <span class="title_color">{{ item.name }}</span>
                  </div>
                  <div class="bt">
                    <span>{{ item.referred }}</span>
                  </div>
                </div>
                <div class="center_price">
                  <div class="tp">
                    <span class="price_color">{{ item.price }}</span>
                  </div>
                  <div class="bt">
                    <span>{{ item.time }}</span>
                  </div>
                </div>
                <div class="right_bs">
                  <div class="tp">
                    <span class="price_color">{{ item.applies + '%' }}</span>
                  </div>
                  <div class="bt"></div>
                </div>
              </div>
            </div>
          <div class="search_input">
            <input
              type="text"
              class="searchs"
              :placeholder="$t('hj37')"
              ref="search"
              id="sousuo"
              v-model="gpcode"
              @input="gpinput"
            />
          </div>
        </div>
        <div class="right_search" @click="sousuo">{{ $t("Search") }}</div>
      </div>
    </div>
    <tabsList ref="tabsList" />
  </div>
</template>
<script>
import tabsList from "./tradingList/tabs";
export default {
  name: "trading",
  name: "TradingList",
  components: { tabsList },
  data() {
    return {
      tabsIndex: 0,
      tabsArr: ["自选", "市场"],
      tabClassActive: 1,
      tabsClassArr: [
        {
          name: "热门",
          type: 1
        },
        {
          name: "外汇",
          type: 2
        },
        {
          name: "商品",
          type: 3
        },
        {
          name: "股票",
          type: 4
        },
        {
          name: "指数",
          type: 5
        },
        {
          name: "加密",
          type: 6
        }
      ],
      tabsItemIndex: 0,
      listArr: [
        {
          name: "香港50指数",
          referred: "HK50",
          price: 16445.5,
          time: "02:59:58",
          applies: 5.93,
        },
        {
          name: "香港50指数",
          referred: "HK50",
          price: 16445.5,
          time: "02:59:58",
          applies: 5.93
        },
        {
          name: "香港50指数",
          referred: "HK50",
          price: 16445.5,
          time: "02:59:58",
          applies: 5.93
        },
        {
          name: "香港50指数",
          referred: "HK50",
          price: 16445.5,
          time: "02:59:58",
          applies: 5.93
        },
        {
          name: "香港50指数",
          referred: "HK50",
          price: 16445.5,
          time: "02:59:58",
          applies: 5.93
        },
        {
          name: "香港50指数",
          referred: "HK50",
          price: 16445.5,
          time: "02:59:58",
          applies: 5.93
        },
        {
          name: "香港50指数",
          referred: "HK50",
          price: 16445.5,
          time: "02:59:58",
          applies: 5.93
        },
        {
          name: "香港50指数",
          referred: "HK50",
          price: 16445.5,
          time: "02:59:58",
          applies: 5.93
        },
        {
          name: "香港50指数",
          referred: "HK50",
          price: 16445.5,
          time: "02:59:58",
          applies: 5.93
        },
        {
          name: "香港50指数",
          referred: "HK50",
          price: 16445.5,
          time: "02:59:58",
          applies: 5.93
        },
        {
          name: "香港50指数",
          referred: "HK50",
          price: 16445.5,
          time: "02:59:58",
          applies: 5.93
        },
        {
          name: "香港50指数",
          referred: "HK50",
          price: 16445.5,
          time: "02:59:58",
          applies: 5.93
        },
        {
          name: "香港50指数",
          referred: "HK50",
          price: 16445.5,
          time: "02:59:58",
          applies: 5.93
        }
      ]
      gpcode: "",
    };
  },
  methods: {
    handleTabsClick(item, index) {
      this.tabsIndex = index;
    sousuo() {
      this.$refs.tabsList.sousuo = this.gpcode;
    },
    handleTabsItem(item, index) {
      this.tabsItemIndex = index;
    }
  }
    gpinput(e) {
      this.gpcode = e.target.value;
      this.$refs.tabsList.sousuo = e.target.value;
    },
  },
};
</script>
<style scoped lang="less">
.tr_list_page {
  width: 100%;
  height: calc(100% - 1.3rem);
  background: #fff;
  > .content {
.search {
  height: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 15px 22px;
  position: relative;
  z-index: 99;
  .search_content {
    width: 100%;
    height: 90%;
    display: flex;
    justify-content: space-between;
    align-items: center;
  }
  .left_search {
    width: 100%;
    height: 100%;
    padding: 0 0.3rem;
  }
}
.tabs {
  width: 100%;
  height: 100%;
  margin-top: 1.1282rem;
  .top_title {
    width: 100%;
    height: 1.2821rem;
    background: #fff;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    > div {
      width: 40%;
      height: 100%;
      display: flex;
    }
    .tb {
      width: 50%;
    .search_img {
      width: 1rem;
      height: 100%;
      display: flex;
      justify-content: center;
      align-items: center;
      font-size: 0.4103rem;
    }
    .active {
      font-size: 0.5003rem;
      font-weight: 800;
    }
  }
  .search {
    width: 100%;
    height: 1.3333rem;
    display: flex;
    align-items: center;
    .search_content {
      width: 100%;
      height: 90%;
      display: flex;
      align-items: center;
    }
    .left_search {
      width: 87%;
      height: 100%;
      background: rgb(246, 246, 246);
      border-radius: 0.2rem;
      display: flex;
      .search_img {
        width: 1rem;
        height: 100%;
        display: flex;
        justify-content: center;
        align-items: center;
        img {
          width: 0.6rem;
          height: 0.6rem;
        }
      }
      .search_input {
        width: calc(100% - 1rem);
        height: 100%;
        display: flex;
      }
    }
    .right_search_class {
      width: 13%;
      height: 100%;
      display: flex;
      justify-content: flex-end;
      align-items: center;
      img {
        width: 0.6rem;
        height: 0.6rem;
        width: 0.5rem;
        height: 0.5rem;
      }
    }
  }
}
.bottom_content {
  width: 100%;
  height: calc(100% - 1.2821rem);
}
.scroll_tab {
  width: 100%;
  height: 1.1538rem;
  overflow-x: scroll;
  -webkit-overflow-scrolling: touch;
  display: -webkit-box;
  white-space: nowrap;
  > div {
    display: inline-block;
    width: 25%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    span {
      display: inline-block;
      min-width: 40%;
      height: 100%;
      text-align: center;
      line-height: 1.1538rem;
    }
  }
  span.active {
    color: rgb(43, 132, 247);
    border-bottom: 1px solid rgb(43, 132, 247);
    font-weight: 800;
    transition: all 0.5s;
  }
}
.scroll_tab::-webkit-scrollbar {
  display: none;
}
.kai_mess {
  width: 100%;
  height: 1.2821rem;
  background: rgb(245, 249, 254);
  display: flex;
  justify-content: space-between;
  .left_identity_img {
    width: 0.9744rem;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    img {
      width: 0.6rem;
      height: 0.6rem;
    }
  }
  .text {
    width: 80%;
    height: 100%;
    display: flex;
    align-items: center;
    color: #2883f7;
    font-weight: 800;
    font-size: 0.35rem;
    padding-left: 0.4128rem;
  }
  .right_go {
    width: 10%;
    display: flex;
    align-items: center;
    justify-content: center;
    img {
      width: 0.6rem;
      height: 0.6rem;
    }
  }
}
.list::-webkit-scrollbar {
  display: none;
}
.list {
  width: 100%;
  height: calc(100% - 1.2821rem -  1rem - 1.1538rem - 1.3333rem);
  overflow-x: auto;
  padding-bottom: 1.2821rem;
  .list_items {
    width: 100%;
    > div {
    .search_input {
      width: 100%;
      height: 1.0256rem;
      overflow: hidden;
      height: 100%;
      display: flex;
      margin: 0.5rem 0;
      > div {
        > div {
          display: flex;
          align-items: center;
        }
        .tp {
          width: 100%;
          height: 70%;
        }
        .bt {
          width: 100%;
          height: 30%;
        }
      }
    }
    .left_title {
      width: 45%;
      height: 100%;
    }
    .center_price {
      width: 35%;
      height: 100%;
    }
    .right_bs {
      width: 20%;
      height: 100%;
    }
  }
}
.list_title {
    width: 100%;
    height: 1rem;
    color: #ccc;
    display: flex;
    >div {
        display: flex;
        align-items: center;
    }
    .varieties{
        width: 45%;
    }
    .latest_price {
        width: 35%;
    }
    .applies {
        width: 20%;
    }
}
.price_color {
  color: rgb(39, 171, 99);
  font-size: 0.4rem;
  font-weight: 600;
}
.title_color {
  color: rgb(2, 2, 2);
  font-size: 0.4rem;
  font-weight: 600;
  .right_search {
    width: 140px;
    line-height: 0.9rem;
    text-align: center;
    height: 100%;
    border-radius: 0.5rem;
    background-color: #0066ed;
    color: #ffffff;
    font-weight: bold;
    margin-left: 20px;
  }
}
</style>