From 45190f969dd8c7d3d2c6e366694f0dadc5ea07e8 Mon Sep 17 00:00:00 2001
From: lxf <1371462558@qq.com>
Date: Mon, 19 May 2025 16:43:12 +0800
Subject: [PATCH] 样式修改
---
src/components/perpetual-history-position/index.vue | 180 +++++++++++++++++++++++++++++++++++++++++++++++++++++++----
1 files changed, 167 insertions(+), 13 deletions(-)
diff --git a/src/components/perpetual-history-position/index.vue b/src/components/perpetual-history-position/index.vue
index 5b37f26..42cbd26 100644
--- a/src/components/perpetual-history-position/index.vue
+++ b/src/components/perpetual-history-position/index.vue
@@ -1,7 +1,49 @@
<template>
<!-- 历史持仓 -->
<div>
- <template v-if="listData.length > 0">
+ <div class="asset-list" v-for="item in listData" :key="item.order_no">
+ <div class="list">
+ <div class="list-h">
+ <div>
+ <span class="currency">{{ $t("买入") }}</span>
+ <span>{{ item.name }}</span>
+ </div>
+ <div class="state">{{ $t("成交") }}</div>
+ </div>
+ <div class="kline"></div>
+ <div class="list-item">
+ <div class="list-b">
+ <div>{{ $t("时间") }}</div>
+ <div class="list-value">{{ item.close_time | formatDate }}</div>
+ </div>
+ <div class="list-b">
+ <div>{{ $t("价格") }}(USDT)</div>
+ <div class="list-value">
+ {{ handleWord(item.direction, item.state, item.price_type) }}
+ </div>
+ </div>
+ <div class="list-b">
+ <div>{{ $t("数量") }}(USDT)</div>
+ <div class="list-value">{{ item.volume_open }}</div>
+ </div>
+ <div class="list-b">
+ <div>{{ $t("最新成交") }}({{ item.symbol.toUpperCase() }})</div>
+ <div class="list-value">{{ item.volume_open }}</div>
+ </div>
+ <div class="list-b">
+ <div>{{ $t("成交额") }}(USDT)</div>
+ <div class="list-value">{{ item.trade_avg_price }}</div>
+ </div>
+ <div class="list-b">
+ <div>{{ $t("类型") }}</div>
+ <div class="list-value">
+ {{ item.state ? handleText(item.state) : "--" }}
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ <!-- <template v-if="listData.length > 0">
<div class="border-b-color list-item" v-for="item in listData" :key="item.order_no">
<div class="flex justify-between pt-30 pb-28">
<div class="flex items-center">
@@ -43,7 +85,7 @@
$t('详情') }}</button>
</div>
</div>
- </template>
+ </template> -->
</div>
</template>
@@ -54,26 +96,74 @@
listData: {
type: Array,
default() {
- return []
- }
- }
+ return [];
+ },
+ },
},
data() {
return {
historyData: [
- { name: "BTC/USDT", direction: "buy", amount: "200", price: "23000", create_time: "2022-07-20 10:05:15" },
- ]
- }
+ {
+ name: "BTC/USDT",
+ direction: "buy",
+ amount: "200",
+ price: "23000",
+ create_time: "2022-07-20 10:05:15",
+ },
+ ],
+ };
+ },
+ filters: {
+ toFixed(val) {
+ return (val / 1).toFixed(5);
+ },
+ formatDate(val) {
+ if (!val) return "";
+ const date = new Date(val);
+ const month = String(date.getMonth() + 1).padStart(2, "0");
+ const day = String(date.getDate()).padStart(2, "0");
+ const hours = String(date.getHours()).padStart(2, "0");
+ const minutes = String(date.getMinutes()).padStart(2, "0");
+ return `${month}-${day} ${hours}:${minutes}`;
+ },
},
methods: {
+ handleText(state) {
+ let str = "";
+ if (state == "created") {
+ str = this.$t("已平仓");
+ } else {
+ str = this.$t("持仓");
+ }
+ return str;
+ },
+ handleWord(direction, state, price_type) {
+ let a = "";
+ // let b = "";
+ if (price_type === "limit") {
+ a = this.$t("限价");
+ } else {
+ a = this.$t("市价");
+ }
+ // if (direction === "buy" && state === "submitted") {
+ // b = this.$t("开多");
+ // } else if (direction === "sell" && state === "submitted") {
+ // b = this.$t("开空");
+ // } else if (direction === "buy" && state === "created") {
+ // b = this.$t("平多");
+ // } else {
+ // b = this.$t("平空");
+ // }
+ // return a + "/" + b;
+ return a;
+ },
goDetail(item) {
this.$router.push({
- path: "/orderDetail?order_no=" + item.order_no
+ path: "/orderDetail?order_no=" + item.order_no,
});
- }
- }
-
-}
+ },
+ },
+};
</script>
<style lang="scss" scoped>
.list-item {
@@ -97,4 +187,68 @@
border: themed("btn_background1");
}
}
+
+.asset-list {
+ width: 100%;
+ @include themify() {
+ color: themed("text_color1");
+ }
+ .list {
+ background: #212121;
+ box-sizing: border-box;
+ margin-bottom: 2.3rem;
+ padding: 2.3rem;
+ border-radius: 2.3rem;
+ position: relative;
+ }
+ .list-h {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ margin-bottom: 2rem;
+ color: #d1cdcd;
+ .currency {
+ font-size: 2.2rem;
+ font-weight: 600;
+ color: #1cd36d;
+ }
+ span {
+ font-size: 1.6rem;
+ font-weight: 600;
+ // color: #fff;
+ }
+ }
+ .list-item {
+ display: flex;
+ flex-wrap: wrap;
+ margin-top: 2.3rem;
+ .list-b {
+ display: flex;
+ flex-direction: column;
+ justify-content: space-between;
+ margin-bottom: 1.4rem;
+ font-size: 1.6rem;
+ width: 14rem;
+ // padding-right: 1.4rem;
+ // margin-right: 1.4rem;
+ box-sizing: border-box;
+ color: #d1cdcd;
+ .list-value {
+ width: 100%;
+ color: #fff;
+ font-size: 1.8rem;
+ font-weight: 600;
+ line-height: 1.5;
+ overflow: hidden;
+ white-space: nowrap;
+ text-overflow: ellipsis;
+ }
+ }
+ }
+}
+.kline {
+ width: 100%;
+ height: 1px;
+ background: rgba(60, 58, 58, 0.6);
+}
</style>
--
Gitblit v1.9.3