From f989b0f6b7c1190a719d22a2aeec0e8914c2db07 Mon Sep 17 00:00:00 2001
From: zzzz <690498789@qq.com>
Date: Fri, 26 Apr 2024 11:49:39 +0800
Subject: [PATCH] first
---
src/page/trading/buy.vue | 67 +++++++++++++++++++++------------
1 files changed, 43 insertions(+), 24 deletions(-)
diff --git a/src/page/trading/buy.vue b/src/page/trading/buy.vue
index 22faf37..4f8914c 100644
--- a/src/page/trading/buy.vue
+++ b/src/page/trading/buy.vue
@@ -8,7 +8,7 @@
</div>
<div class="right_title">
<div class="t_t" style="white-space: nowrap">
- <span>{{ name }}</span>
+ <span>{{ name }}({{ gid }})</span>
</div>
<div class="b_t">
<span>{{ spell }}</span>
@@ -19,7 +19,7 @@
<div class="cot">
<div class="lefts">
<div class="top_new">
- <span>{{ nowPrice | _toString }}</span>
+ <span>{{ nowPrice | _toLocaleString }}</span>
</div>
<div class="bottom_es">
<span>{{ $t("hj98") }}</span>
@@ -94,6 +94,7 @@
type="number"
onkeyup="value=value.replace(/[^\d]/g,'')"
v-model="num"
+ @input="numInput"
/>
</div>
<div class="right_sw flexJy" style="width: auto">
@@ -101,14 +102,7 @@
<img src="@/assets/img/ic_number_jian.png" />
</div>
<div class="addorj"></div>
- <div
- class="addorj"
- @click="
- typeof num == 'string'
- ? (num = Number(Number(num) + 1))
- : (num = Number(Number(num) + 1))
- "
- >
+ <div class="addorj" @click="jjjisua">
<img src="@/assets/img/ic_number_add.png" />
</div>
</div>
@@ -130,11 +124,14 @@
</div>
<div class="bottom_bzz">
- <span>{{ ((nowPrice / selectCycle) * num) | _toString }}</span>
+ <span>
+ {{
+ ((nowPrice / selectCycle.replace("X", "")) * num)
+ | _toLocaleString
+ }}
+ </span>
<span style="white-space: nowarp">
- <!-- moneyData.symbol + " " + -->
-
- {{ moneyData.availableBalance | _toString }}
+ {{ moneyData.availableBalance | _toLocaleString }}
</span>
</div>
</div>
@@ -196,14 +193,6 @@
</div>
</div>
</div>
- <!-- <div class="zy">
- <div class="left_zy">
- <span>追踪止损</span>
- </div>
- <div class="right_sw">
- <van-switch v-model="profitArr[2].checked" />
- </div>
- </div> -->
</div>
<div class="btn_buy" @click="gdOrSetBuy()">
<div :class="tabsCurrentIndex == 0 ? 'maichu' : ''">
@@ -306,10 +295,12 @@
},
],
moneyData: {},
+ gid: "",
};
},
mounted() {
this.bayType = this.$route.query.bayType;
+ this.gid = this.$route.query.gid;
if (this.bayType == "in") {
this.priceTabs = [this.$t("hj108"), this.$t("hj109")];
} else if (this.bayType == "qh") {
@@ -335,7 +326,20 @@
},
methods: {
...mapActions(["setUseInfo"]),
-
+ numInput(e) {
+ // this.nowPrice / this.selectCycle.replace("X", "")
+ // this.moneyData.availableBalance
+ let numbs = Math.floor(
+ this.moneyData.availableBalance /
+ this.nowPrice /
+ this.selectCycle.replace("X", "")
+ );
+ if (e.target.value >= numbs) {
+ this.num = numbs;
+ }
+ // if()
+ console.log(e.target.value);
+ },
async getMoneyData() {
let data = await api.getMoney();
let type = this.bayType === "SZHB" ? "US" : this.bayType;
@@ -356,6 +360,21 @@
},
handleTabsClick(item, index) {
this.priceTabsCurrentIndex = index;
+ },
+ jjjisua() {
+ let numbs = Math.floor(
+ this.moneyData.availableBalance /
+ this.nowPrice /
+ this.selectCycle.replace("X", "")
+ );
+ typeof this.num == "string"
+ ? (this.num = Number(Number(this.num) + 1))
+ : (this.num = Number(Number(this.num) + 1));
+
+ console.log(this.num, numbs);
+ if (this.num >= numbs) {
+ this.num = numbs;
+ }
},
jyslJian() {
if (typeof this.num === "string") {
@@ -475,7 +494,7 @@
},
// 买卖
setBuy() {
- if (!this.$store.state.userInfo.idCard) {
+ if (this.$store.state.userInfo.isActive !== 2) {
this.$store.commit("elAlertShow", {
elAlertShow: true,
elAlertText: this.$t("hj111"),
--
Gitblit v1.9.3