From ce307b451fcd0d496b4c2f0172e6301100c6412c Mon Sep 17 00:00:00 2001
From: lxf <1371462558@qq.com>
Date: Thu, 24 Apr 2025 15:04:39 +0800
Subject: [PATCH] feat: 钱包添加黄金
---
src/page/user/Warehouse.vue | 29 ++++--
src/page/user/Warehouse/data.list.vue | 154 +++++++++++++++++++++++++-------------
2 files changed, 118 insertions(+), 65 deletions(-)
diff --git a/src/page/user/Warehouse.vue b/src/page/user/Warehouse.vue
index 043b761..191262e 100644
--- a/src/page/user/Warehouse.vue
+++ b/src/page/user/Warehouse.vue
@@ -1,7 +1,7 @@
<template>
<div class="ware">
<div style="padding: 0 0.4rem 0.4rem">
- <van-tabs v-model="active" color="#0066ed">
+ <van-tabs v-model="active" color="#0066ed" @change="handleTabChange">
<van-tab :title="$t('hj52')" name="2"></van-tab>
<van-tab :title="$t('黄金原油')" name="1"></van-tab>
</van-tabs>
@@ -52,16 +52,16 @@
laber: "ST",
symbolCode: "INR",
symbol: "₹"
+ },
+ {
+ title: this.$t("黄金原油"),
+ assname: this.$t("黄金原油"),
+ name: "1",
+ bgc: "rgb(12, 175, 226)",
+ laber: "USDT",
+ symbolCode: "MYR",
+ symbol: "RM"
}
- // {
- // title: this.$t("黄金原油"),
- // assname: this.$t("黄金原油"),
- // name: "2",
- // bgc: "rgb(12, 175, 226)",
- // laber: "IN",
- // symbolCode: "INR",
- // symbol: "₹"
- // }
// {
// title: this.$t("马来西亚"),
// assname: this.$t("馬股总资产"),
@@ -116,7 +116,7 @@
});
});
let obj = arr.filter(item => item.name == this.active)[0];
- console.log("getMoneys: ", arr, obj);
+ console.log("getMoneys: ", arr);
this.activeObj = obj;
this.tabsArr = arr;
this.$forceUpdate(); // 强制Vue重新渲染
@@ -129,6 +129,13 @@
if (e.name !== "1") {
this.$refs.dataListref.getList(e.laber);
}
+ },
+ handleTabChange(name) {
+ const arr = this.tabsArr.filter(item => item.name === name);
+ if (arr.length > 0) {
+ this.activeObj = arr[0];
+ this.$refs.dataListref.getList(this.activeObj.laber);
+ }
}
}
};
diff --git a/src/page/user/Warehouse/data.list.vue b/src/page/user/Warehouse/data.list.vue
index 03e2e22..9870c9a 100644
--- a/src/page/user/Warehouse/data.list.vue
+++ b/src/page/user/Warehouse/data.list.vue
@@ -17,16 +17,22 @@
:loading-text="$t('hj430')"
@load="onLoad"
>
- <div v-if="actives === 0"
+ <div
+ v-if="actives === 0"
class="sport-content-li"
:style="actives === 1 ? 'height:5.52rem' : 'height:7.52rem'"
v-for="(item, index) in dataList"
:key="index"
- @click="$router.push(`/Stockdetail?codes=${item.positionSn}`)" >
+ @click="$router.push(`/Stockdetail?codes=${item.positionSn}`)"
+ >
<div @click.stop="pushRouter(item)">
-
<div class="title-box" style="justify-content: space-between;">
- <div class="span" :style="item.isListed==false?'color:red;':''">{{ item.stockName }}</div>
+ <div
+ class="span"
+ :style="item.isListed == false ? 'color:red;' : ''"
+ >
+ {{ item.stockName }}
+ </div>
<div
class="states"
:class="item.orderDirection === '买跌' ? 'states-red' : ''"
@@ -39,10 +45,17 @@
<van-row>
<van-col span="8">
<div style="text-align: left">
- <div class="sport-content-title2" >
+ <div class="sport-content-title2">
{{ $t("盈虧") }} ({{ activeObj.symbolCode }})
</div>
- <div class="sport-content-text2" :style="item.profitAndLoseParent.charAt(0)=='-'?'color:#cc1b1b;':'color:#3e9976;'">
+ <div
+ class="sport-content-text2"
+ :style="
+ item.profitAndLoseParent.charAt(0) == '-'
+ ? 'color:#cc1b1b;'
+ : 'color:#3e9976;'
+ "
+ >
₹{{ item.profitAndLose | _toLocaleString }}
</div>
</div>
@@ -52,7 +65,14 @@
<div class="sport-content-title2">
{{ $t("hj141") }} ({{ activeObj.symbolCode }})
</div>
- <div class="sport-content-text2" :style="item.profitAndLoseParent.charAt(0)=='-'?'color:#cc1b1b;':'color:#3e9976;'">
+ <div
+ class="sport-content-text2"
+ :style="
+ item.profitAndLoseParent.charAt(0) == '-'
+ ? 'color:#cc1b1b;'
+ : 'color:#3e9976;'
+ "
+ >
{{ item.profitAndLoseParent }}
</div>
</div>
@@ -103,7 +123,7 @@
{{ $t("hj44") }} ({{ activeObj.symbolCode }})
</div>
<div class="sport-content-text2">
- ₹{{ item.orderFee | _toLocaleString }}
+ ₹{{ item.orderFee | _toLocaleString }}
</div>
</div>
</van-col>
@@ -113,11 +133,11 @@
{{ $t("待补金额") }} ({{ activeObj.symbolCode }})
</div>
<div class="sport-content-text2">
- ₹{{ item.amountToBeCovered | _toLocaleString }}
+ ₹{{ item.amountToBeCovered | _toLocaleString }}
</div>
</div>
</van-col>
- <!-- <van-col span="8">
+ <!-- <van-col span="8">
<div style="text-align: center">
<div class="sport-content-title2">
{{ $t("止損價") }} ({{ activeObj.symbolCode }})
@@ -161,13 +181,14 @@
</div>
</div>
-
- <div v-if="actives === 1"
+ <div
+ v-if="actives === 1"
class="sport-content-li"
:style="actives === 1 ? 'height:5.52rem' : 'height:7.52rem'"
v-for="(item, index) in newdataList"
:key="index"
- @click="$router.push(`/Stockdetail?codes=${item.positionSn}`)" >
+ @click="$router.push(`/Stockdetail?codes=${item.positionSn}`)"
+ >
<div @click.stop="pushRouter(item)">
<div class="title-box" style="justify-content: space-between;">
<div class="span">{{ item.stockName }}</div>
@@ -186,7 +207,14 @@
<div class="sport-content-title2">
{{ $t("盈虧") }} ({{ activeObj.symbolCode }})
</div>
- <div class="sport-content-text2" :style="item.profitAndLoseParent.charAt(0)=='-'?'color:#cc1b1b;':'color:#3e9976;'">
+ <div
+ class="sport-content-text2"
+ :style="
+ item.profitAndLoseParent.charAt(0) == '-'
+ ? 'color:#cc1b1b;'
+ : 'color:#3e9976;'
+ "
+ >
₹{{ item.profitAndLose | _toLocaleString }}
</div>
</div>
@@ -196,7 +224,14 @@
<div class="sport-content-title2">
{{ $t("hj141") }} ({{ activeObj.symbolCode }})
</div>
- <div class="sport-content-text2" :style="item.profitAndLoseParent.charAt(0)=='-'?'color:#cc1b1b;':'color:#3e9976;'">
+ <div
+ class="sport-content-text2"
+ :style="
+ item.profitAndLoseParent.charAt(0) == '-'
+ ? 'color:#cc1b1b;'
+ : 'color:#3e9976;'
+ "
+ >
{{ item.profitAndLoseParent }}
</div>
</div>
@@ -247,11 +282,11 @@
{{ $t("hj44") }} ({{ activeObj.symbolCode }})
</div>
<div class="sport-content-text2">
- ₹{{ item.orderFee | _toLocaleString }}
+ ₹{{ item.orderFee | _toLocaleString }}
</div>
</div>
</van-col>
- <!-- <van-col span="8">
+ <!-- <van-col span="8">
<div style="text-align: center">
<div class="sport-content-title2">
{{ $t("止損價") }} ({{ activeObj.symbolCode }})
@@ -314,7 +349,13 @@
<!-- <div class="right" style="color: rgb(3, 173, 143)">
{{ closeSell.orderNum }}
</div> -->
- <input class="input_box" type="number" :max="closeSell.orderNum" :placeholder="$t('hj262')" v-model="ordernum" />
+ <input
+ class="input_box"
+ type="number"
+ :max="closeSell.orderNum"
+ :placeholder="$t('hj262')"
+ v-model="ordernum"
+ />
</div>
<div class="hang">
<div class="left">{{ $t("類型") }}</div>
@@ -335,8 +376,8 @@
props: {
activeObj: {
type: Object,
- default: {},
- },
+ default: {}
+ }
},
mounted() {
this.getList();
@@ -350,31 +391,31 @@
closeSell: {},
show: false,
actives: 0,
- ordernum:'',
+ ordernum: "",
dataList: [],
- newdataList:[],
+ newdataList: [],
timer: null,
tabsList: [
{
title: this.$t("持倉"),
- key: 0,
+ key: 0
},
{
title: this.$t("平倉"),
- key: 1,
- },
- ],
+ key: 1
+ }
+ ]
};
},
- created(){
- this.dsq()
+ created() {
+ this.dsq();
},
beforeDestroy() {
clearInterval(this.timer); // 在组件销毁前清除定时器
},
methods: {
- dsq(){
+ dsq() {
// this.dataList = [];
this.timer = setInterval(() => {
this.getList();
@@ -383,7 +424,7 @@
pushRouter(item) {
const obj = {
pid: item.stockCode || "",
- type: item.stockGid || "",
+ type: item.stockGid || ""
};
window.localStorage.setItem("kLine", JSON.stringify(obj));
// return;
@@ -398,8 +439,8 @@
if_us: "",
if_zhishu: 0,
sok: "",
- type: item.stockGid,
- },
+ type: item.stockGid
+ }
});
},
onLoad() {
@@ -410,7 +451,7 @@
this.$refs.closeDialog.show = false;
const res = await sell({
positionSn: this.closeSell.positionSn,
- number:this.ordernum
+ number: this.ordernum
});
if (res.status === 0) {
this.dataList = [];
@@ -433,8 +474,9 @@
const res = await getchicang({
state: this.actives,
stockType: laber || this.activeObj.laber,
+ stockCode: "HJYY",
pageNum: 1,
- pageSize: 30,
+ pageSize: 30
});
this.loading = false;
@@ -453,16 +495,21 @@
this.pageNum = 1;
this.finished = false;
}
- const res = await getchicang({
+ const _laber = laber || this.activeObj.laber;
+ let opt = {
state: this.actives,
- stockType: laber || this.activeObj.laber,
+ stockType: _laber,
pageNum: 1,
- pageSize: 30,
- });
+ pageSize: 30
+ };
+ if (_laber === "USDT") {
+ opt.stockCode = "HJYY";
+ }
+ const res = await getchicang(opt);
this.loading = false;
if (res.status === 0) {
- this.dataList = []
+ this.dataList = [];
this.dataList = res.data.list;
this.finished = true;
} else {
@@ -473,51 +520,50 @@
close(item) {
this.closeSell = item;
this.$refs.closeDialog.show = true;
- this.ordernum = ''
+ this.ordernum = "";
},
clickTabs(e) {
this.pageNum = 1;
this.finished = false;
this.actives = e.key;
- this.newdataList = []
- this.dataList = []
+ this.newdataList = [];
+ this.dataList = [];
- if(e.key==1){
+ if (e.key == 1) {
clearInterval(this.timer); // 在组件销毁前清除定时器
// clearTimeout(this.timer);
// setTimeout(()=>{
// clearInterval(this.timer); // 在组件销毁前清除定时器
// },3000)
- this.getLists()
+ this.getLists();
// this.startPolling();
// this.dsq()
- }else{
+ } else {
clearInterval(this.timer); // 在组件销毁前清除定时器
- this.dsq()
+ this.dsq();
}
this.$forceUpdate(); // 强制Vue重新渲染
// this.getList()
// if(e.key !=this.actives){
-
// }else{
// this.actives = e.key;
// this.dsq()
// }
- },
- },
+ }
+ }
};
</script>
<style lang="less" scoped>
- .input_box{
- text-align: right;
- font-size: 16px;
+.input_box {
+ text-align: right;
+ font-size: 16px;
- padding: 0 4px;
- }
+ padding: 0 4px;
+}
.sport-tabs {
// font-family: PingFang SC;
font-family: "DINPro";
--
Gitblit v1.9.3