<template>
|
<div class="block_trading">
|
<page-head :title="`${$t('hj621')}`">
|
<template slot="right">
|
<div class="head_right" @click="$router.push('/blockTradingOrder')">
|
{{ $t("订单") }}
|
</div>
|
</template>
|
</page-head>
|
|
<div class="popup_head">
|
<div class="popup_input">
|
<van-field
|
v-model="searchValue"
|
:placeholder="$t('输入编码搜索')"
|
left-icon="search"
|
clearable
|
/>
|
</div>
|
<van-button type="primary" round @click="submit">{{
|
$t("Search")
|
}}</van-button>
|
</div>
|
|
<div class="trading_card" v-for="i in list" :key="i.id">
|
<div class="card_label2 flex-between" style="height:1.8em" @click="toDetails(i)">
|
<div>
|
<p class="flex-start">
|
<span class="label_icon">{{ i.stockType }}</span>
|
<span class="label_name line-one">{{ i.stockSpell }}</span>
|
</p>
|
<p class="flex-start gp">
|
<span>{{ i.stockName }}</span>
|
</p>
|
</div>
|
|
<div class="flex-end">
|
<van-icon name="arrow" color="#969799" size=".5em" />
|
</div>
|
</div>
|
|
<p class="card_label2 flex-between">
|
<span>{{ $t("市场价") }}</span>
|
<span>{{ i.stockType | currencySymbol }} {{ i.nowPrice }}</span>
|
</p>
|
|
<p class="card_label2 flex-between">
|
<span>{{ $t("最小购买数量") }}</span>
|
<span>{{ i.stockNum }}</span>
|
</p>
|
|
<p class="card_buy flex-center" @click="buyOpen(i)">
|
<van-icon name="add-square" size=".4em" />
|
<span>{{ $t("hj85") }}</span>
|
</p>
|
</div>
|
|
<!-- 无数据时显示 -->
|
<div class="no_data flex-center" v-show="!list || list.length == 0">
|
<img src="@/assets/img/zhaobudao2.png" alt="" />
|
</div>
|
|
<n-pagination
|
:pageNo.sync="pageNum"
|
:pageSize="pageSize"
|
:total="total"
|
></n-pagination>
|
|
<!-- 购买弹窗 -->
|
<van-popup v-model="buyShow" round>
|
<van-form class="buy_popup" @submit="popupSubmit">
|
<div class="popup_title flex-center">
|
<span>{{ popupData.stockName }}</span>
|
</div>
|
|
<div class="division"></div>
|
|
<div class="popup_item flex-between">
|
<span>{{ $t("市场价") }}</span>
|
<span>
|
{{ popupData.stockType | currencySymbol }} {{ popupData.nowPrice }}
|
</span>
|
</div>
|
|
<div class="popup_item flex-between">
|
<span>{{ $t("最小购买数量") }}</span>
|
<span>
|
{{ popupData.stockNum }}
|
</span>
|
</div>
|
|
<!-- <div class="popup_item flex-between-start">
|
<span style="color:red">*</span>
|
<van-field
|
v-model="popFrom.password"
|
:label="$t('购买密码')"
|
:placeholder="$t('请输入')"
|
:rules="[{ required: true, message: $t('请输入') }]"
|
/>
|
</div> -->
|
|
<div class="popup_item flex-between">
|
<p class="flex-start">
|
<span style="color:red">*</span>
|
<span>{{ $t("sl") }}</span>
|
</p>
|
<span>
|
<van-stepper
|
v-model="popFrom.num"
|
integer
|
:min="popupData.stockNum"
|
/>
|
</span>
|
</div>
|
|
<div class="popup_item flex-end">
|
<div class="zxgm flex-center" @click="minimum">
|
<span>{{ $t("最小购买") }}</span>
|
</div>
|
</div>
|
|
<div class="division"></div>
|
|
<div class="buts flex-between">
|
<p class="flex-center" @click="buyShow = false">
|
<span>{{ $t("qx") }}</span>
|
</p>
|
<p class="flex-center" native-type="submit">
|
<!-- <span>{{ $t("qr") }}</span> -->
|
<van-button native-type="submit">{{ $t("qr") }}</van-button>
|
</p>
|
</div>
|
</van-form>
|
</van-popup>
|
</div>
|
</template>
|
|
<script>
|
import PageHead from "@/components/pageHead.vue";
|
import nPagination from "@/components/nPagination.vue";
|
import * as api from "@/axios/api";
|
import { Toast } from "vant";
|
|
export default {
|
components: {
|
PageHead,
|
nPagination
|
},
|
data() {
|
return {
|
pageNum: 1,
|
pageSize: 10,
|
total: 1,
|
searchValue: "",
|
list: [],
|
buyShow: false, // 购买弹窗控制
|
popupData: {}, // 点击购买的数据
|
popFrom: {
|
password: "",
|
num: 0
|
}
|
};
|
},
|
watch: {
|
pageNum() {
|
this.list = [];
|
this.getDzListTwo();
|
}
|
},
|
created() {
|
this.getDzListTwo();
|
},
|
methods: {
|
// 提交搜索
|
submit() {
|
this.pageNum = 1;
|
this.getDzListTwo();
|
},
|
// 获取列表数据
|
async getDzListTwo() {
|
let opt = {
|
pageNum: this.pageNum,
|
pageSize: this.pageSize,
|
keyWords: this.searchValue
|
// orderBy: ""
|
};
|
let data = await api.getDzListTwo(opt);
|
if (data.status === 0) {
|
this.total = data.data.total;
|
this.list = data.data.list;
|
}
|
},
|
// 购买弹窗
|
buyOpen(i) {
|
this.popupData = i;
|
this.buyShow = true;
|
},
|
// 提交购买
|
async popupSubmit() {
|
let opt = {
|
...this.popFrom,
|
dzId: this.popupData.id
|
};
|
|
let data = await api.getBuyStockDz(opt);
|
|
if (data.status == 0) {
|
Toast.success();
|
setTimeout(() => {
|
this.buyShow = false;
|
}, 1000);
|
} else {
|
Toast.fail(data.msg);
|
}
|
},
|
// 最小购买
|
minimum() {
|
this.popFrom.num = this.popupData.stockNum;
|
},
|
// 点击进入详情
|
toDetails(item) {
|
const obj = {
|
pid: item.id || "",
|
type: item.stockType || ""
|
};
|
window.localStorage.setItem("kLine", JSON.stringify(obj));
|
|
this.$router.push({
|
path: "/kline",
|
query: {
|
code: item.id,
|
type: item.stockType
|
}
|
});
|
}
|
}
|
};
|
</script>
|
|
<style lang="less" scoped>
|
@green: #c4d600;
|
@grey-two: #969799;
|
@red: #ee0a24;
|
.block_trading {
|
font-size: 10vw;
|
width: 100%;
|
background-color: #f5f5f5;
|
min-height: 100vh;
|
padding-bottom: 0.3em;
|
padding-top: 1.4em;
|
|
.buy_popup {
|
width: 8.8em;
|
/deep/ .van-cell {
|
padding: 0;
|
font-size: 0.4em;
|
}
|
/deep/ .van-field__body {
|
// border: 0.01em solid #f5f5f5;
|
// height: 2.5em;
|
// padding: 0 0.5em;
|
// margin-top: 0.5em;
|
}
|
/deep/ .van-field__label {
|
color: #000;
|
}
|
/deep/ .van-stepper__minus {
|
width: 1rem;
|
height: 1rem;
|
}
|
/deep/ .van-stepper__plus {
|
width: 1rem;
|
height: 1rem;
|
}
|
/deep/ .van-stepper__input {
|
height: 1rem;
|
width: 2rem;
|
font-size: 0.4rem;
|
}
|
.division {
|
width: 100%;
|
height: 0.25em;
|
background-color: #f5f5f5;
|
}
|
.popup_title {
|
width: 100%;
|
min-height: 1.22em;
|
font-weight: bold;
|
padding: 0 0.25em;
|
}
|
.popup_name {
|
color: @green;
|
.popup_icon {
|
background: @green;
|
color: #fff;
|
padding: 0.2em 0.35em;
|
border-radius: 0.15em;
|
margin-right: 0.3em;
|
font-size: 0.3em;
|
}
|
}
|
.popup_item {
|
width: 8.3em;
|
margin: 0 auto;
|
padding: 0.35em 0;
|
border-bottom: #f5f5f5 solid 0.01em;
|
|
.zxgm {
|
height: 0.8em;
|
width: 2em;
|
border-radius: 0.1em;
|
border: #ddd solid 0.01em;
|
span {
|
font-size: 0.3em;
|
}
|
}
|
}
|
span {
|
font-size: 0.4em;
|
}
|
.buts {
|
width: 100%;
|
height: 1.22em;
|
|
/deep/ .van-button {
|
border: none;
|
font-size: 1em;
|
color: @green;
|
}
|
p {
|
height: 100%;
|
flex: 1;
|
}
|
& > p:last-child {
|
border-left: #f5f5f5 solid 0.01em;
|
color: @green;
|
}
|
}
|
}
|
|
.popup_head {
|
display: flex;
|
justify-content: center;
|
align-items: center;
|
padding: 0.25em;
|
background: #fff;
|
width: 100%;
|
position: fixed;
|
top: 1.22em;
|
z-index: 999;
|
|
/deep/ .van-cell {
|
background: none;
|
}
|
|
/deep/ .van-field__left-icon .van-icon,
|
.van-field__right-icon .van-icon {
|
font-size: 1.5em;
|
}
|
|
/deep/ .van-field__control {
|
font-size: 1.5em;
|
}
|
|
.popup_input {
|
background: #f7f8fa;
|
@inpH: 0.9em;
|
height: @inpH;
|
flex: 1;
|
border-radius: @inpH / 2;
|
display: flex;
|
align-items: center;
|
margin-right: 0.5em;
|
}
|
}
|
|
.trading_card {
|
width: 9.5em;
|
margin: 0.25em auto 0;
|
border-radius: 0.25em;
|
background: #fff;
|
.card_buy {
|
height: 1.33em;
|
color: @green;
|
box-shadow: 0 -0.05333rem 0.26667rem #0000000d;
|
|
span {
|
font-size: 0.45em;
|
font-weight: 600;
|
margin-left: 0.2em;
|
}
|
}
|
.card_label2,
|
.card_label1 {
|
margin: 0 auto;
|
width: 9em;
|
border-bottom: #f5f5f5 solid 0.01em;
|
}
|
|
.card_label2 {
|
height: 1.1em;
|
color: #323233;
|
span {
|
font-size: 0.4em;
|
font-weight: 500;
|
}
|
& > span:last-child {
|
color: @grey-two;
|
font-size: 0.36em;
|
}
|
.gp {
|
margin-top: 0.22em;
|
color: @grey-two;
|
font-size: 0.9em;
|
}
|
.app {
|
color: @green;
|
font-size: 0.6em;
|
}
|
.label_name {
|
color: @green;
|
width: 14em;
|
}
|
span.zje {
|
color: @red;
|
font-size: 0.48em;
|
}
|
span.zt {
|
color: @green;
|
}
|
}
|
|
.card_label1 {
|
color: @green;
|
height: 1.33em;
|
|
span {
|
font-size: 0.4em;
|
}
|
.label_icon {
|
background: @green;
|
color: #fff;
|
padding: 0.2em 0.35em;
|
border-radius: 0.15em;
|
margin-right: 0.3em;
|
font-size: 0.3em;
|
}
|
}
|
|
.label_icon {
|
background: @green;
|
color: #fff;
|
padding: 0.2em 0.35em;
|
border-radius: 0.15em;
|
margin-right: 0.3em;
|
font-size: 0.3em !important;
|
}
|
}
|
|
.head_right {
|
color: @green;
|
font-size: 0.4em;
|
}
|
}
|
</style>
|