From 1bd03f5c2e7b9fa9cc80c4e673e18132da411333 Mon Sep 17 00:00:00 2001
From: jhzh <1628036192@qq.com>
Date: Wed, 12 Nov 2025 16:21:06 +0800
Subject: [PATCH] 1
---
src/page/trading/buy.vue | 228 +++++++++++++++++++++++++++++++++++++++++++++++++-------
1 files changed, 199 insertions(+), 29 deletions(-)
diff --git a/src/page/trading/buy.vue b/src/page/trading/buy.vue
index ad08455..9b9bc65 100644
--- a/src/page/trading/buy.vue
+++ b/src/page/trading/buy.vue
@@ -4,10 +4,10 @@
<div class="top_cny">
<div class="top_back">
<div class="left_back" @click="handleBack()">
- <img src="../../assets/img/zuojiantou.png" alt />
+ <img src="../../assets/img/backs.png" alt />
</div>
<div class="right_title">
- <div class="t_t" style="white-space: nowrap">
+ <div class="t_t" style="white-space: pre-wrap">
<span>{{ name }}({{ gid }})</span>
</div>
<div class="b_t">
@@ -118,8 +118,8 @@
</div>
<div class="tr_rs">
<div class="top_bzz" style="padding-bottom: 0.2rem">
- <span style="text-align: left"> {{ $t("交易总额") }}() </span>
- <span style="text-align: right"> {{ $t("hj103") }}() </span>
+ <span style="text-align: left"> {{ $t("交易总额") }} </span>
+ <span style="text-align: right"> {{ $t("hj103") }} </span>
</div>
<div class="bottom_bzz">
@@ -144,17 +144,18 @@
</div>
<div class="tr_rs">
<div class="top_bzz" style="padding-bottom: 0.2rem">
- <span style="text-align: left"> {{ $t("hj44") }}() </span>
+ <span style="text-align: left"> {{ $t("hj44") }} </span>
<span style="text-align: right"> </span>
</div>
<div class="bottom_bzz">
<span>
- {{
+ <!-- {{
(nowPrice * selectCycle.replace("X", "") * num * sxf).toFixed(
2
)
- }}
+ }} -->
+ {{Math.floor(nowPrice * selectCycle.replace("X", "") * num * sxf * 100) / 100}}
<span v-if="bayType != 'US'">
≈ $
{{
@@ -221,13 +222,54 @@
</div>
</div>
</div> -->
+ <div class="btn_buy" @click="clickishow()">
+ <div
+ :class="tabsCurrentIndex == 0 ? 'maichu' : ''"
+ :style="preMarket==0?'background-color:#555555 !important':'background-color:#287dff'"
+ >
+ <span>{{ tabsCurrentIndex == 0 ? $t("场外卖出") : $t("场外买入") }}</span>
+ </div>
+ </div>
<div class="btn_buy" @click="gdOrSetBuy()">
- <!-- <div :class="tabsCurrentIndex == 0 ? 'maichu' : ''">#c4d600 -->
- <div class="maichu" style="background-color:#c4d600">
+ <div
+ :class="tabsCurrentIndex == 0 ? 'maichu' : ''"
+ style="background-color:#287dff"
+ >
<span>{{ tabsCurrentIndex == 0 ? $t("hj84") : $t("gm") }}</span>
</div>
</div>
</div>
+ <van-popup v-model="isshow" position="center" round>
+ <div class="edit-popup">
+ <div class="edit-title">
+ {{ tabsCurrentIndex == 0 ? $t("场外卖出") : $t("场外买入") }}
+ </div>
+ <div class="division"></div>
+
+ <div class="edit-form">
+ <div class="form-item">
+ <div class="form-label">
+ <span class="required">*</span>{{ $t("hj271") }}
+ </div>
+ <input
+ pattern="^(0\.\d+|[1-9]\d*(\.\d+)?)$"
+ type="number"
+ v-model="preMarketPrice"
+ :placeholder="$t('hj271')"
+ class="form-input"
+ />
+ </div>
+ </div>
+
+ <div class="division"></div>
+ <div class="edit-buttons">
+ <div class="cancel-btn" @click="isshow = false">
+ {{ $t("qx") }}
+ </div>
+ <div class="save-btn" @click="saveEdit">{{ $t("qr") }}</div>
+ </div>
+ </div>
+ </van-popup>
<van-action-sheet
v-model="showGg"
:actions="siteLeverList"
@@ -276,6 +318,9 @@
if (this.$route.query.if_us) {
this.if_us = this.$route.query.if_us;
}
+ if(this.$route.query.preMarket){
+ this.preMarket = this.$route.query.preMarket;
+ }
},
data() {
return {
@@ -288,6 +333,9 @@
nums: 1,
profit: false,
nowPrice: 0,
+ isshow: false,
+ preMarketPrice:"",
+ preMarket:0,
type: 0,
code: "",
name: "",
@@ -376,6 +424,30 @@
}
},
methods: {
+ async clickishow(){
+ if(this.preMarket==0){
+ return
+ }
+ if(this.tabsCurrentIndex == 0 ){
+ this.$store.commit("elAlertShow", {
+ elAlertShow: true,
+ elAlertText: this.$t("失败")
+ });
+ }else{
+ this.isshow = true
+ }
+ },
+ async saveEdit(){
+ if(this.preMarketPrice<=0){
+ this.$store.commit("elAlertShow", {
+ elAlertShow: true,
+ elAlertText: this.$t("hj277")+0
+ });
+ }else{
+ this.setBuy()
+ }
+
+ },
async queryStockConfig() {
let data = await api.queryStockConfig();
if (data.status === 0) {
@@ -526,6 +598,14 @@
this.selectLever = val.label;
},
gdOrSetBuy() {
+ if(this.preMarket == 1){
+ this.$store.commit("elAlertShow", {
+ elAlertShow: true,
+ elAlertText: this.$t('hj113'),
+ elAlertType: "success"
+ });
+ return
+ }
if (this.priceTabsCurrentIndex == 0) {
this.setBuy();
} else {
@@ -572,7 +652,7 @@
});
this.getUserInfo();
// this.$router.push("/warehouse?index=1&buyType=" + this.bayType);
- this.$router.push("/tradeNew?index=1&buyType=" + this.bayType);
+ this.$router.push("/markets-list");
} else {
this.$store.commit("elAlertShow", {
elAlertShow: true,
@@ -602,7 +682,7 @@
// buyType: this.selectType,
lever: this.selectCycle ? this.selectCycle : 0,
// subaccountNumber:this.subaccountNumber
-
+ preMarketPrice:this.preMarketPrice,
// 买入是买涨buyType:0, 卖出是买跌buyType:1,卖出的状态是0,买入的状态是1
buyNum: this.num, // 单位为手
// buyNum: (this.num.match(/\d+/g))[0] * 100, // 单位为手
@@ -652,7 +732,7 @@
buyType = 0;
}
// this.$router.push("/warehouse?index=1&buyType=" + this.bayType);
- this.$router.push("/tradeNew?index=1&buyType=" + this.bayType);
+ this.$router.push("/markets-list");
} else {
if (data.msg.indexOf("不在交易时段内") > -1) {
this.$store.commit("elAlertShow", {
@@ -680,7 +760,7 @@
});
this.getUserInfo();
// this.$router.push("/warehouse?index=1&buyType=" + this.bayType);
- this.$router.push("/tradeNew?index=1&buyType=" + this.bayType);
+ this.$router.push("/markets-list");
} else {
this.$store.commit("elAlertShow", {
elAlertShow: true,
@@ -757,17 +837,107 @@
</script>
<style scoped lang="less">
+ @green: #287dff;
.buy_page {
width: 100%;
min-height: 100vh;
- background-color: #fff;
+ // background-color: #fff;
> .content {
width: 100%;
height: calc(100% - 1.6rem);
position: relative;
- background-color: rgb(241, 242, 246);
+ background-color: #222;
}
+}
+.edit-popup {
+ width: 100%;
+ padding: 0.25rem 0;
+ box-sizing: border-box;
+
+ .division {
+ width: 100%;
+ height: 0.25rem;
+ background-color: #f5f5f5;
+ }
+}
+/deep/ .van-popup {
+ width: 80%;
+ border-radius: 8px;
+}
+.edit-popup {
+ width: 100%;
+ padding: 0.25rem 0;
+ box-sizing: border-box;
+
+ .division {
+ width: 100%;
+ height: 0.25rem;
+ background-color: #f5f5f5;
+ }
+}
+.form-item {
+ // margin-bottom: 15px;
+ border-bottom: 1px solid #f5f5f5;
+ padding: 0.35rem 0 0.25rem;
+}
+
+.form-label {
+ font-size: 0.4rem;
+ margin-bottom: 0.2rem;
+ color: #333;
+}
+
+.required {
+ color: red;
+ margin-right: 4px;
+}
+
+.form-input {
+ width: 100%;
+ height: 1.1rem;
+ border: 1px solid #ccc;
+ border-radius: 4px;
+ padding: 0 10px;
+ font-size: 0.3rem;
+ box-sizing: border-box;
+ color: #333;
+}
+
+.edit-buttons {
+ display: flex;
+ justify-content: space-between;
+ border-top: 1px solid #f5f5f5;
+ padding-top: 15px;
+}
+.cancel-btn,
+.save-btn {
+ flex: 1;
+ height: 40px;
+ line-height: 40px;
+ text-align: center;
+ font-size: 16px;
+ cursor: pointer;
+}
+
+.cancel-btn {
+ color: #333;
+}
+
+.save-btn {
+ color: @green;
+ font-weight: 500;
+}
+.edit-title {
+ text-align: center;
+ font-size: 0.45rem;
+ font-weight: 700;
+ padding: 0.25rem;
+ color: #333;
+}
+
+.edit-form {
+ padding: 0.25rem;
}
.top_cny {
@@ -795,12 +965,12 @@
}
.right_title {
- width: 3rem;
+ width: 80vw;
height: 80%;
.t_t {
width: 100%;
- height: 70%;
+ // height: 70%;
display: flex;
align-items: center;
font-size: 0.4615rem;
@@ -872,7 +1042,7 @@
> div {
width: 45%;
height: 70%;
- background: rgb(236, 236, 236);
+ background: #444;
display: flex;
justify-content: center;
align-items: center;
@@ -881,7 +1051,7 @@
}
.active {
- background: #fff;
+ background: #333;
color: rgb(110, 169, 118);
span {
@@ -890,7 +1060,7 @@
}
.actives {
- background: #fff;
+ background: #333;
color: rgb(212, 71, 78);
span {
@@ -907,14 +1077,14 @@
width: 100%;
height: auto;
padding: 0.2rem 0.8rem;
- background: #fff;
+ // background: #fff;
margin-top: 0.1rem;
border-radius: 0.3rem;
.tabs {
width: 100%;
height: 0.8205rem;
- background: rgb(247, 247, 247);
+ background: #555;
display: flex;
align-items: center;
justify-content: center;
@@ -930,7 +1100,7 @@
}
.active {
- background: #fff;
+ background: #333;
span {
font-weight: 600;
@@ -985,7 +1155,7 @@
}
.bottom_bzz {
- color: #000;
+ // color: #000;
font-size: 0.3846rem;
span {
@@ -1007,7 +1177,7 @@
border-bottom: 0.05rem solid rgb(236, 236, 236);
> div {
- color: #000;
+ // color: #000;
}
}
}
@@ -1049,7 +1219,7 @@
width: 100%;
height: auto;
bottom: 0;
- background: #fff;
+ // background: #fff;
padding: 0.8rem 0.8rem;
display: flex;
align-items: flex-end;
@@ -1119,7 +1289,7 @@
}
.maichu {
- // background-color: rgb(225, 59, 69) !important;
+ background-color: rgb(225, 59, 69) !important;
}
.mr {
@@ -1135,7 +1305,7 @@
left: -0.1rem;
z-index: 10000;
background: rgba(255, 255, 255, 0);
- border-left: 0.12rem solid rgb(241, 242, 246);
+ border-left: 0.12rem solid #555;
transform-origin: bottom right;
-ms-transform: skew(-10deg, 0deg);
-webkit-transform: skew(-10deg, 0deg);
@@ -1156,7 +1326,7 @@
left: 0;
z-index: 10000;
background: rgba(255, 255, 255, 0);
- border-right: 0.1rem solid rgb(241, 242, 246);
+ border-right: 0.1rem solid #555;
transform-origin: bottom left;
-ms-transform: skew(-10deg, 0deg);
-webkit-transform: skew(-10deg, 0deg);
--
Gitblit v1.9.3