<template>
|
<div data-v-7f4e78c6 class="buy page-deal">
|
<van-nav-bar data-v-7f4e78c6 left-arrow @click-left="$router.go(-1)" fixed>
|
<template #title>
|
<van-tabs
|
data-v-7f4e78c6
|
v-model="activeTab"
|
class="tabs_auto"
|
shrink
|
line-width="30"
|
line-height="3"
|
animated
|
>
|
<van-tab :title="$t('hj85')" />
|
<van-tab :title="$t('hj84')" />
|
</van-tabs>
|
</template>
|
</van-nav-bar>
|
|
<div data-v-7f4e78c6="" class="stock_info">
|
<div data-v-7f4e78c6="" class="title_box">
|
<div data-v-7f4e78c6="" class="code">
|
<span
|
data-v-7f4e78c6=""
|
class="van-tag van-tag--mark van-tag--success"
|
>{{ stockMarket }}</span
|
>
|
{{ stockCode }}
|
</div>
|
<div data-v-7f4e78c6="" class="title">{{ stockName }}</div>
|
<div data-v-7f4e78c6="" class="desc">
|
<div data-v-7f4e78c6="" class="price">{{ nowPrice }}</div>
|
<div
|
class="change"
|
:class="changeValue >= 0 ? 'change_up' : 'change_down'"
|
>
|
{{ changeValue }}
|
<span class="percent">({{ upPercent }}%)</span>
|
</div>
|
</div>
|
</div>
|
<div data-v-7f4e78c6="" class="desc_box">
|
<div data-v-7f4e78c6="" class="desc_item">
|
<span data-v-7f4e78c6="" class="label">{{ $t("hj73") }}</span
|
><span data-v-7f4e78c6="" class="value">{{ max }}</span>
|
</div>
|
<div data-v-7f4e78c6="" class="desc_item">
|
<span data-v-7f4e78c6="" class="label">{{ $t("hj75") }}</span
|
><span data-v-7f4e78c6="" class="value">{{ min }}</span>
|
</div>
|
</div>
|
</div>
|
|
<!-- 表单区域 -->
|
<van-form>
|
<!-- 平仓 -->
|
<template v-if="activeTab">
|
<div v-if="positions.length === 0" class="empty-position">
|
<!-- <img src="@/assets/img/empty.png" alt="empty" class="empty-img" /> -->
|
<div class="empty-text">{{ $t("zwsj") }}</div>
|
</div>
|
<div v-else>
|
<div data-v-7f4e78c6="" class="van-cell van-cell--center">
|
<div class="van-cell__title">
|
<span>{{ $t("hj2") }}</span>
|
</div>
|
<div class="van-cell__value">
|
<!-- <span data-v-7f4e78c6="" class="positions">23</span> -->
|
</div>
|
</div>
|
<!-- 选择一个持仓卖出 -->
|
<van-field :label="$t('hj2')" label-align="top" data-v-7f4e78c6>
|
<template #input>
|
<van-radio-group v-model="selectedPositionId" data-v-7f4e78c6>
|
<van-cell-group data-v-7f4e78c6>
|
<van-cell
|
data-v-7f4e78c6
|
v-for="item in positions"
|
:key="item.id"
|
clickable
|
@click="selectedPositionId = item.id"
|
>
|
<template #title>
|
<span data-v-7f4e78c6 class="color-text"
|
>{{ $t("si") }}:{{ item.orderNum }}</span
|
>
|
<van-tag
|
data-v-7f4e78c6s
|
:type="
|
item.orderDirection === '买涨' ? 'danger' : 'success'
|
"
|
size="small"
|
>
|
{{
|
item.orderDirection == "买涨"
|
? $t("买涨")
|
: $t("买跌")
|
}}
|
</van-tag>
|
</template>
|
<template #right-icon>
|
<van-radio data-v-7f4e78c6 :name="item.id" />
|
</template>
|
</van-cell>
|
</van-cell-group>
|
</van-radio-group>
|
</template>
|
</van-field>
|
</div>
|
|
<div data-v-7f4e78c6="" class="placeholder_10_bg"></div>
|
</template>
|
<!-- -->
|
<van-cell-group inset>
|
<van-field
|
v-model="price"
|
:label="$t('hj81')"
|
placeholder="请输入"
|
type="number"
|
left-icon="$"
|
/>
|
<van-field :label="$t('si')">
|
<template #input>
|
<van-stepper v-model="num" min="1" />
|
</template>
|
</van-field>
|
<van-field :label="$t('je')">
|
<template #input>
|
<span class="color-danger">
|
$ {{ total }}
|
<span> ≈ MX$ {{ mxTotal }}</span>
|
</span>
|
</template>
|
</van-field>
|
</van-cell-group>
|
|
<!-- 快捷按钮 -->
|
<div class="fast_btns" data-v-7f4e78c6>
|
<van-button type="default" size="small" block round @click="setHalf">{{
|
$t("半仓")
|
}}</van-button>
|
<van-button type="default" size="small" block round @click="setAll">{{
|
$t("全仓")
|
}}</van-button>
|
</div>
|
|
<div class="placeholder_10_bg"></div>
|
|
<!-- 底部操作按钮 -->
|
<div class="submit_box">
|
<div data-v-7f4e78c6="" class="record_btn">
|
<i
|
data-v-7f4e78c6=""
|
class="van-badge__wrapper van-icon van-icon-column"
|
style="font-size: 0.6rem;"
|
></i>
|
{{ $t("jl") }}
|
</div>
|
<template v-if="activeTab">
|
<van-button type="warning" block @click="sell"
|
>{{ $t("确认") }} {{ $t("hj84") }}</van-button
|
>
|
</template>
|
<template v-else>
|
<van-button type="primary" block @click="gdOrSetBuy(0)">{{
|
$t("买涨")
|
}}</van-button>
|
<van-button type="warning" block @click="gdOrSetBuy(1)">{{
|
$t("买跌")
|
}}</van-button>
|
</template>
|
</div>
|
</van-form>
|
</div>
|
</template>
|
|
<script>
|
import * as api from "@/axios/api";
|
import { mapActions } from "vuex";
|
export default {
|
name: "trBuy",
|
data() {
|
return {
|
activeTab: 0,
|
price: "",
|
num: 1,
|
positions: [
|
{ id: 1, orderNum: 23, orderDirection: "买涨" },
|
{ id: 2, orderNum: 10, orderDirection: "买跌" }
|
],
|
selectedPositionId: 1,
|
// moneyData: null,
|
// 股票参数
|
stockMarket: "US",
|
stockCode: "",
|
stockName: "",
|
// nowPrice: "",
|
changeValue: "",
|
upPercent: "",
|
max: "",
|
min: "",
|
stockId: null,
|
|
// tabsCurrentIndex: 0,
|
|
tradingArr: [this.$t("hj84"), this.$t("hj85")],
|
tabsCurrentIndex: 0,
|
// priceTabs: [this.$t("hj108"), this.$t("hj109")],
|
priceTabs: [this.$t("hj108")],
|
priceTabsCurrentIndex: 0,
|
num: 1,
|
nums: 1,
|
profit: false,
|
nowPrice: 0,
|
type: 0,
|
code: "",
|
name: "",
|
spell: "",
|
settingInfo: [],
|
selectCycle: "1X",
|
selectLever: 1,
|
siteLeverList: [],
|
checkedZy: false,
|
checkedZs: false,
|
buying: false,
|
zhisun: 0,
|
showGg: false,
|
profitTarget: 0,
|
if_us: 0,
|
bayType: "",
|
sxf: "",
|
id: "",
|
actions: [
|
{
|
name: "100X",
|
subname: this.$t("hj102")
|
},
|
{
|
name: "200X",
|
subname: this.$t("hj102")
|
},
|
{
|
name: "300X",
|
subname: this.$t("hj102")
|
}
|
],
|
profitArr: [
|
{
|
name: this.$t("hj104"),
|
checked: false
|
},
|
{
|
name: this.$t("hj105"),
|
checked: false
|
},
|
{
|
name: this.$t("hj110"),
|
checked: false
|
}
|
],
|
moneyData: {},
|
gid: ""
|
};
|
},
|
computed: {
|
total() {
|
// 示例:总金额 = 价格 * 数量
|
return (Number(this.price) * this.num || 0).toFixed(2);
|
},
|
mxTotal() {
|
// 示例:假设汇率20
|
return (this.total * 21).toFixed(2);
|
},
|
totalPositions() {
|
return this.positions.reduce((sum, item) => sum + item.num, 0);
|
}
|
},
|
created() {
|
// 从路由参数获取动态数据
|
const query = this.$route.query;
|
this.stockMarket = query.market || "US";
|
this.stockCode = query.code || "AAPL";
|
this.stockName = query.cname || "Apple Inc.";
|
this.price = this.nowPrice = query.m || "0.00";
|
this.max = query.max || "--";
|
this.min = query.min || "--";
|
this.changeValue = query.up || "0.00";
|
this.upPercent = query.upPercent || "0.00";
|
|
if (this.$route.query.id) {
|
this.stockId = this.$route.query.id;
|
}
|
// 余额
|
this.getMoneyData();
|
|
if (this.$route.query.t) {
|
this.tabsCurrentIndex = Number(this.$route.query.t);
|
console.log(this.tabsCurrentIndex);
|
}
|
if (this.$route.query.m) {
|
this.nowPrice = Number(this.$route.query.m);
|
this.profitTarget = Number(this.$route.query.m);
|
this.zhisun = Number(this.$route.query.m);
|
this.nums = Number(this.$route.query.m);
|
}
|
if (this.$route.query.id) {
|
this.id = this.$route.query.id;
|
}
|
if (this.$route.query.code) {
|
this.code = this.$route.query.code;
|
}
|
if (this.$route.query.name) {
|
this.name = this.$route.query.name;
|
}
|
if (this.$route.query.spell) {
|
this.spell = this.$route.query.spell;
|
}
|
if (this.$route.query.type) {
|
this.type = this.$route.query.type;
|
}
|
if (this.$route.query.if_us) {
|
this.if_us = this.$route.query.if_us;
|
}
|
},
|
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") {
|
this.priceTabs = [this.$t("hj108")];
|
}
|
this.setUseInfo();
|
this.getMoneyData();
|
this.getSettingInfo();
|
this.queryStockConfig();
|
},
|
watch: {
|
checkedZy(val) {
|
if (navigator.vibrate) {
|
// 支持
|
navigator.vibrate([55]);
|
}
|
},
|
checkedZs(val) {
|
if (navigator.vibrate) {
|
// 支持
|
navigator.vibrate([55]);
|
}
|
},
|
activeTab(val) {
|
if (val === 1) {
|
this.getOrderList();
|
}
|
}
|
},
|
methods: {
|
async sell(val) {
|
// if(!this.canBuyStatus()){
|
// Toast('不在开盘时间内,暂不能交易!')
|
// return
|
// }
|
// if (!this.$store.state.userInfo.idCard) {
|
// Toast('您还未实名认证,请先实名认证了再下单')
|
// this.$router.push('/authentication')
|
// return
|
// }
|
// MessageBox.confirm('您确定要平仓吗?').then(async action => {
|
const pos = this.positions.find(
|
item => item.id === this.selectedPositionId
|
);
|
if (pos) {
|
let opt = {
|
positionSn: pos.positionSn
|
};
|
let data = await api.sell(opt);
|
if (data.status === 0) {
|
Toast(data.msg);
|
this.getOrderList();
|
} else {
|
Toast(data.msg);
|
}
|
}
|
// })
|
},
|
async getMoneyData() {
|
let data = await api.getMoney();
|
// let type = this.stockMarket === "SZHB" ? "US" : this.stockMarket;
|
if (data.status === 0) {
|
// const newArr = data.data.filter(item => item.accectType === type);
|
|
this.moneyData = data.data[0] || {};
|
console.log("余额", this.moneyData.availableBalance, this.moneyData);
|
}
|
},
|
setHalf() {
|
if (this.activeTab) {
|
const pos = this.positions.find(
|
item => item.id === this.selectedPositionId
|
);
|
if (pos) {
|
this.num = Math.max(1, Math.floor(pos.orderNum / 2));
|
}
|
} else {
|
// 半仓 = 余额的一半 / 当前价格,向下取整
|
if (
|
this.moneyData &&
|
this.moneyData.availableBalance &&
|
this.price > 0
|
) {
|
const half = Math.floor(
|
this.moneyData.availableBalance / 2 / this.price
|
);
|
this.num = half > 0 ? half : 1;
|
}
|
}
|
},
|
setAll() {
|
if (this.activeTab) {
|
const pos = this.positions.find(
|
item => item.id === this.selectedPositionId
|
);
|
if (pos) {
|
this.num = pos.orderNum > 0 ? pos.orderNum : 1;
|
}
|
} else {
|
// 全仓 = 余额 / 当前价格,向下取整
|
if (
|
this.moneyData &&
|
this.moneyData.availableBalance &&
|
this.price > 0
|
) {
|
const all = Math.floor(this.moneyData.availableBalance / this.price);
|
this.num = all > 0 ? all : 1;
|
}
|
}
|
},
|
async buyUp() {
|
// 买涨逻辑
|
let data = await api.buy({
|
lever: 1,
|
buyNum: this.num, // 单位为手
|
buyType: 1,
|
stockId: this.stockId
|
});
|
// this.buying = false;
|
if (data.status === 0) {
|
this.$store.commit("elAlertShow", {
|
elAlertShow: true,
|
elAlertText: data.msg,
|
elAlertType: "success"
|
});
|
this.getUserInfo();
|
var buyType = "";
|
if (this.tabsCurrentIndex == 0) {
|
buyType = 1;
|
} else {
|
buyType = 0;
|
}
|
this.$router.push("/warehouse?index=1&buyType=" + this.bayType);
|
} else {
|
if (data.msg.indexOf("不在交易时段内") > -1) {
|
this.$store.commit("elAlertShow", {
|
elAlertShow: true,
|
elAlertText: this.$t("hj113")
|
});
|
} else {
|
this.$store.commit("elAlertShow", {
|
elAlertShow: true,
|
elAlertText: data.msg
|
});
|
}
|
}
|
},
|
buyDown() {
|
// 买跌逻辑
|
},
|
goRecord() {
|
// 跳转记录页
|
},
|
async getOrderList() {
|
// 查询持仓
|
let opt = {
|
state: 1,
|
stockCode: this.stockCode,
|
pageNum: 1,
|
pageSize: 99
|
};
|
// this.loading = true
|
// this.hasSearch = true
|
let data = await api.getOrderList(opt);
|
if (data.status === 0) {
|
this.positions = data.data.list;
|
// this.total = data.data.total
|
} else {
|
Toast(data.msg);
|
}
|
// this.loading = false
|
document.activeElement.blur();
|
},
|
async queryStockConfig() {
|
let data = await api.queryStockConfig();
|
if (data.status === 0) {
|
this.sxf = data.data.cValue;
|
}
|
},
|
zSjian() {
|
var newzishu = (Number(this.zhisun) - 1).toFixed(2);
|
if (Number(newzishu) < 1) {
|
} else {
|
this.zhisun = newzishu;
|
}
|
},
|
...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);
|
},
|
handleDoubleClick(event) {
|
console.log(1);
|
// console.log('Input field was double-clicked', event);
|
},
|
async getMoneyData() {
|
let data = await api.getMoney();
|
let type = this.bayType === "SZHB" ? "US" : this.bayType;
|
if (data.status === 0) {
|
const newArr = data.data.filter(item => item.accectType === type);
|
|
this.moneyData = newArr[0] || {};
|
// console.log(this.bayType, newArr);
|
// 判断是否登录
|
// this.moneyList = data.data;
|
}
|
},
|
handleBack() {
|
this.$router.go(-1);
|
},
|
handleTradingClick(index) {
|
this.tabsCurrentIndex = index;
|
},
|
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") {
|
this.num = 1;
|
} else {
|
if (this.num > 1) {
|
if (typeof this.num === "string") {
|
this.num = Number(this.num - 1);
|
} else {
|
this.num = Number(this.num - 1);
|
}
|
} else {
|
this.num = 1;
|
}
|
}
|
},
|
gdJian() {
|
if (this.nums > 1) {
|
if (typeof this.nums === "string") {
|
this.nums = Number(Number(this.nums) - 1).toFixed(2);
|
} else {
|
this.nums = Number(Number(this.nums) - 1).toFixed(2);
|
}
|
} else {
|
this.nums = this.nowPrice;
|
}
|
},
|
zYjian() {
|
var newzishu = (Number(this.profitTarget) - 1).toFixed(2);
|
if (Number(newzishu) < 1) {
|
} else {
|
this.profitTarget = newzishu;
|
}
|
// this.profitTarget = (Number(this.profitTarget) - 1).toFixed(2);
|
// if(this.tabsCurrentIndex==0){
|
// console.log( this.nowPrice);
|
// if ((Number(this.profitTarget) - 1).toFixed(2) < this.nowPrice) {
|
// this.profitTarget = (Number(this.profitTarget) - 1).toFixed(2);
|
// } else {
|
// this.profitTarget = this.nowPrice;
|
// }
|
// }else{
|
// console.log(123);
|
// if ((Number(this.profitTarget) - 1).toFixed(2) < this.nowPrice) {
|
// this.profitTarget = this.nowPrice;
|
// } else {
|
// this.profitTarget = (Number(this.profitTarget) - 1).toFixed(2);
|
// }
|
// }
|
},
|
zSjia() {
|
this.zhisun++;
|
// if ((Number(this.zhisun) + 1).toFixed(2) > this.nowPrice) {
|
// this.zhisun = this.nowPrice;
|
// } else {
|
// this.zhisun++;
|
// }
|
},
|
zsInt(e) {
|
if (typeof e.target.value === "string") {
|
this.zhisun = this.nowPrice;
|
} else {
|
if (Number(e.target.value) > this.nowPrice) {
|
this.zhisun = this.nowPrice;
|
}
|
}
|
},
|
zyInt(e) {
|
if (typeof e.target.value === "string") {
|
this.profitTarget = this.nowPrice;
|
} else {
|
if (Number(e.target.value) < Number(this.nowPrice)) {
|
this.profitTarget = Number(this.nowPrice);
|
}
|
}
|
},
|
onSelect(val) {
|
this.selectCycle = val.name;
|
this.selectLever = val.label;
|
},
|
gdOrSetBuy(val) {
|
this.priceTabsCurrentIndex = val;
|
if (this.priceTabsCurrentIndex == 0) {
|
this.setBuy();
|
} else {
|
this.gdBuy();
|
}
|
if (navigator.vibrate) {
|
// 支持
|
navigator.vibrate([55]);
|
}
|
},
|
// 挂单
|
async gdBuy() {
|
if (this.buying) {
|
return;
|
}
|
this.buying = true;
|
let opts = {
|
stockId: this.code,
|
buyNum: this.num,
|
lever: this.selectLever,
|
targetPrice: this.nums
|
};
|
console.log(this.selectLever, "this.selectLever ");
|
|
if (this.tabsCurrentIndex == 0) {
|
opts.buyType = 1;
|
} else {
|
opts.buyType = 0;
|
}
|
if (this.checkedZy) {
|
// opts.profitTarget = this.profitTarget.substring(0,this.profitTarget.indexOf(".")+3)
|
opts.profitTarget = this.profitTarget;
|
}
|
if (this.checkedZs) {
|
opts.stopTarget = this.zhisun;
|
}
|
let data = await api.guadan(opts);
|
this.buying = false;
|
if (data.status === 0) {
|
this.$store.commit("elAlertShow", {
|
elAlertShow: true,
|
elAlertText: data.msg,
|
elAlertType: "success"
|
});
|
this.getUserInfo();
|
this.$router.push("/warehouse?index=1&buyType=" + this.bayType);
|
} else {
|
this.$store.commit("elAlertShow", {
|
elAlertShow: true,
|
elAlertText: data.msg
|
});
|
}
|
},
|
// 买卖
|
setBuy() {
|
if (this.$store.state.userInfo.isActive !== 2) {
|
this.$store.commit("elAlertShow", {
|
elAlertShow: true,
|
elAlertText: this.$t("hj111")
|
});
|
this.$router.push("/authentications");
|
return;
|
}
|
|
if (this.buying) {
|
return;
|
}
|
this.buying = true;
|
let opts = {};
|
opts = {
|
// stockId: this.detail.id,
|
// buyNum: this.selectNumber ? this.selectNumber * 100 : 0, // 单位为手
|
// buyType: this.selectType,
|
lever: this.selectCycle ? this.selectCycle : 0,
|
// subaccountNumber:this.subaccountNumber
|
|
// 买入是买涨buyType:0, 卖出是买跌buyType:1,卖出的状态是0,买入的状态是1
|
buyNum: this.num, // 单位为手
|
// buyNum: (this.num.match(/\d+/g))[0] * 100, // 单位为手
|
lever: this.selectLever
|
};
|
console.log(this.selectLever, "this.selectLever ");
|
if (this.tabsCurrentIndex == 0) {
|
opts.buyType = 1;
|
} else {
|
opts.buyType = 0;
|
}
|
if (this.checkedZy) {
|
// opts.profitTarget = this.profitTarget.substring(0,this.profitTarget.indexOf(".")+3)
|
opts.profitTarget = this.profitTarget;
|
}
|
if (this.checkedZs) {
|
opts.stopLoss = this.zhisun;
|
}
|
if (this.type == 0) {
|
// 股票
|
this.gpBuy(opts);
|
// opts.stockId= this.code,
|
// data = await api.buy(opts)
|
} else {
|
// 指数
|
this.zsBuy(opts);
|
// opts.indexId= this.code,
|
// data = await api.indexBuy(opts)
|
}
|
},
|
// 股票买入
|
async gpBuy(opts) {
|
opts.stockId = this.id;
|
let data = await api.buy(opts);
|
this.buying = false;
|
if (data.status === 0) {
|
this.$store.commit("elAlertShow", {
|
elAlertShow: true,
|
elAlertText: data.msg,
|
elAlertType: "success"
|
});
|
this.getUserInfo();
|
var buyType = "";
|
if (this.tabsCurrentIndex == 0) {
|
buyType = 1;
|
} else {
|
buyType = 0;
|
}
|
this.$router.push("/warehouse?index=1&buyType=" + this.bayType);
|
} else {
|
if (data.msg.indexOf("不在交易时段内") > -1) {
|
this.$store.commit("elAlertShow", {
|
elAlertShow: true,
|
elAlertText: this.$t("hj113")
|
});
|
} else {
|
this.$store.commit("elAlertShow", {
|
elAlertShow: true,
|
elAlertText: data.msg
|
});
|
}
|
}
|
},
|
// 指数买入
|
async zsBuy(opts) {
|
opts.indexId = this.id;
|
let data = await api.indexBuy(opts);
|
this.buying = false;
|
if (data.status === 0) {
|
this.$store.commit("elAlertShow", {
|
elAlertShow: true,
|
elAlertText: data.msg,
|
elAlertType: "success"
|
});
|
this.getUserInfo();
|
this.$router.push("/warehouse?index=1&buyType=" + this.bayType);
|
} else {
|
this.$store.commit("elAlertShow", {
|
elAlertShow: true,
|
elAlertText: data.msg
|
});
|
}
|
},
|
async getUserInfo() {
|
// 获取用户信息
|
// let showcookie = this.getCookie('USER_TOKEN');
|
let data = await api.getUserInfo();
|
if (data.status === 0) {
|
// this.getProductSetting()
|
this.$store.state.userInfo = data.data;
|
} else {
|
this.$store.commit("elAlertShow", {
|
elAlertShow: true,
|
elAlertText: data.msg
|
});
|
}
|
this.$store.state.user = this.user;
|
},
|
async getSettingInfo() {
|
// 网站设置信息
|
let data = await api.getSetting();
|
if (data.status === 0) {
|
// 成功
|
this.settingInfo = data.data;
|
// 杠杆倍数
|
// data.data.siteLever根据/分割成数组
|
// this.siteLeverList = data.data.siteLever.split('/')
|
|
if (
|
this.$store.state.userInfo !== undefined &&
|
this.$store.state.userInfo !== null &&
|
this.$store.state.userInfo.siteLever != null
|
) {
|
this.selectCycle =
|
this.$store.state.userInfo.siteLever.split("/")[0] + "X";
|
|
this.siteLeverList = [];
|
for (
|
let i = 0;
|
i < this.$store.state.userInfo.siteLever.split("/").length;
|
i++
|
) {
|
let val = this.$store.state.userInfo.siteLever.split("/")[i];
|
let item = {
|
label: val,
|
name: val + "X"
|
};
|
this.siteLeverList.push(item);
|
}
|
console.log(this.siteLeverList, " this.selectCycle");
|
}
|
} else {
|
this.$store.commit("elAlertShow", {
|
elAlertShow: true,
|
elAlertText: data.msg
|
});
|
}
|
}
|
},
|
filters: {
|
getName(name) {
|
if (name.length > 15) {
|
return name;
|
} else {
|
return name;
|
}
|
}
|
}
|
};
|
</script>
|
<style>
|
@import "../../assets/css/index-bde0222a.css";
|
@import "../../assets/css/stockDeal-fd084338.css";
|
@import "../../assets/css/vant-4a12a0cd.css";
|
</style>
|
<style scoped lang="less">
|
.stock_info {
|
margin-top: 1rem;
|
}
|
.buy.page-deal {
|
background: #fff;
|
min-height: 100vh;
|
}
|
.stock_info {
|
padding: 16px;
|
}
|
.title_box {
|
margin-bottom: 8px;
|
}
|
.code {
|
display: flex;
|
align-items: center;
|
gap: 8px;
|
font-size: 18px;
|
}
|
.title {
|
font-weight: bold;
|
margin: 4px 0;
|
}
|
.desc {
|
display: flex;
|
align-items: center;
|
gap: 12px;
|
}
|
.price {
|
color: #333;
|
font-size: 20px;
|
}
|
.change_down {
|
color: #f44;
|
}
|
.desc_box {
|
display: flex;
|
gap: 16px;
|
margin-top: 8px;
|
}
|
.desc_item .label {
|
color: #888;
|
margin-right: 4px;
|
}
|
.fast_btns {
|
display: flex;
|
gap: 12px;
|
margin: 16px 0;
|
}
|
.submit_box {
|
display: flex;
|
align-items: center;
|
gap: 12px;
|
margin-top: 16px;
|
}
|
.record_btn {
|
display: flex;
|
align-items: center;
|
gap: 4px;
|
color: #1989fa;
|
cursor: pointer;
|
}
|
.placeholder_10_bg {
|
height: 10px;
|
background: #f7f8fa;
|
margin: 16px 0;
|
}
|
</style>
|