From bc3a812e4134c46f2c7f118de0cf7cbee7ef58c2 Mon Sep 17 00:00:00 2001
From: PC-20250623MANY\Administrator <344137771@qq.com>
Date: Sat, 30 Aug 2025 16:50:28 +0800
Subject: [PATCH] 1

---
 src/views/account/components/Position.vue |  115 +++++++++++++++++++++++++++++++++++++++++++++++++++------
 1 files changed, 102 insertions(+), 13 deletions(-)

diff --git a/src/views/account/components/Position.vue b/src/views/account/components/Position.vue
index f0ef08a..ffbb920 100644
--- a/src/views/account/components/Position.vue
+++ b/src/views/account/components/Position.vue
@@ -7,29 +7,77 @@
     size="980px"
   >
     <div class="drawer-content">
+      <div class="card sb_b">
+        <div class="card_1 flex-center">
+          <div>{{ $t("浮動盈虧") }}</div>
+          <div
+            style="font-size: 24px"
+            :style="`color:${
+              thisMoneyData.profitAndLoss > 0
+                ? 'red'
+                : thisMoneyData.profitAndLoss < 0
+                ? 'green'
+                : ''
+            }`"
+          >
+            {{ thisMoneyData.symbol }} {{ thisMoneyData.profitAndLoss }}
+          </div>
+        </div>
+        <div class="card_2 flex-between">
+          <div class="card_2_item flex-center" style="align-items: start">
+            <div>{{ $t("總資產") }}</div>
+            <div>{{ thisMoneyData.symbol }}{{ thisMoneyData.totalMoney }}</div>
+          </div>
+          <div class="card_2_item flex-center">
+            <div>{{ $t("hj48") }}</div>
+            <div>
+              {{ thisMoneyData.symbol }}{{ thisMoneyData.availableBalance }}
+            </div>
+          </div>
+          <div class="card_2_item flex-center" style="align-items: end">
+            <div>{{ $t("账户盈亏") }}</div>
+            <div>
+              {{ thisMoneyData.symbol
+              }}{{ thisMoneyData.cumulativeProfitAndLoss }}
+            </div>
+          </div>
+        </div>
+        <div class="card_2 flex-between" style="border-top: #aaa solid 1px">
+          <el-button type="primary" size="medium" @click="$router.push('/home')">
+            {{ $t("buy") }}
+          </el-button>
+          <el-button type="primary" size="medium" @click="$router.push('/home')">
+            {{ $t("hj78") }}
+          </el-button>
+          <el-button type="primary" size="medium" @click="pc">
+            {{ $t("hj121") }}
+          </el-button>
+        </div>
+      </div>
+
       <el-table
         :data="tableData"
         style="width: 100%; flex: 1"
+        height="100%"
         empty-text="No Data"
       >
         <el-table-column prop="stockSpell" :label="$t('hj313')">
           <template slot-scope="scope">
-            <span class="market-tag sc_c" v-if="scope.row.stockGid == 'MEX'">
-              MEX
-            </span>
             <el-tag
-              type="success"
+              :type="scope.row.stockGid != $mc ? 'success' : ''"
               size="small"
               style="margin-right: 8px"
-              v-else-if="scope.row.stockGid == 'US'"
             >
-              US
+              {{ scope.row.stockGid }}
             </el-tag>
             <span>{{ scope.row.stockName }}</span>
           </template>
         </el-table-column>
 
-        <el-table-column prop="positionType" :label="`${$t('hj313')} ${$t('類型')}`">
+        <el-table-column
+          prop="positionType"
+          :label="`${$t('hj313')} ${$t('類型')}`"
+        >
           <template slot-scope="scope">
             <el-tag type="warning">
               {{ dictionary.gplx[scope.row.positionType] }}
@@ -71,8 +119,11 @@
               {{ scope.row.stockGid | currencySymbol }}
               {{ scope.row.buyOrderPrice }}
             </span>
-            <div v-if="scope.row.stockGid == 'US'">
-              ≈ MX$ {{ (scope.row.buyOrderPrice * utm).toFixed(2) }}
+            <div v-if="scope.row.stockGid != $mc">
+              ≈ $
+              {{
+                (scope.row.buyOrderPrice * rate(scope.row.stockGid)).toFixed(2)
+              }}
             </div>
           </template>
         </el-table-column>
@@ -83,8 +134,9 @@
               {{ scope.row.stockGid | currencySymbol }}
               {{ scope.row.now_price }}
             </span>
-            <div v-if="scope.row.stockGid == 'US'">
-              ≈ MX$ {{ (scope.row.now_price * utm).toFixed(2) }}
+            <div v-if="scope.row.stockGid != $mc">
+              ≈ $
+              {{ (scope.row.now_price * rate(scope.row.stockGid)).toFixed(2) }}
             </div>
           </template>
         </el-table-column>
@@ -111,7 +163,9 @@
 export default {
   data() {
     return {
-      opt: {}, // 列表参数,必须是opt和myMixins混入配合使用
+      opt: {
+        state: 0,
+      }, // 列表参数,必须是opt和myMixins混入配合使用
     };
   },
   mixins: [mixins],
@@ -124,10 +178,19 @@
       type: String,
       default: "",
     },
+    moneyData: {
+      type: Array,
+      default: () => [],
+    },
+  },
+  computed: {
+    thisMoneyData() {
+      return this.moneyData.find((item) => item.accectType == this.type) || {};
+    },
   },
   watch: {},
   async created() {
-    await this.getExchangeRate(); // 获取汇率
+    // await this.getExchangeRate(); // 获取汇率
     this.opt.stockType = this.type;
     this.apiInterface = api.getchicang; // 赋值接口
     this.init(); // 获取记录列表
@@ -137,6 +200,10 @@
     onClose() {
       this.$emit("update:dialogVisible", false);
       this.$emit("onClose"); // 关闭弹窗时,通知父组件
+    },
+    // 打开平仓弹窗
+    pc() {
+      this.$emit("pc");
     },
   },
 };
@@ -149,6 +216,28 @@
   display: flex;
   flex-direction: column;
 
+  .card {
+    border-radius: 16px;
+    overflow: hidden;
+    border: 1px solid #777;
+    .card_1 {
+      padding: 20px;
+      font-size: 18px;
+      flex-direction: column;
+    }
+    .card_2 {
+      width: 100%;
+      padding: 10px 30px 10px;
+      .card_2_item {
+        width: 33%;
+        flex-direction: column;
+        & > div {
+          padding: 3px 0;
+        }
+      }
+    }
+  }
+
   .pagination {
     margin-top: 20px;
     text-align: center;

--
Gitblit v1.9.3