Commit 246bf10e authored by chenqikuai's avatar chenqikuai

fix

parent 871807ee
......@@ -55,6 +55,7 @@ export const lang = {
time: "Block Age",
hash: "Block Hash",
txCount: "Txns",
txCount_single: "Txn",
blockRevenue: "Block Revenue",
mineRevenue: "Mining Income",
packingAddress: "Pack Addr",
......@@ -94,6 +95,10 @@ export const lang = {
},
trade: {
title: "All Txns",
filterSucceedTx: "查看成功的交易",
filterFailedTx: "查看失败的交易",
filterSentTx: "查看发出的交易",
filterReceivedTx: "查看接收的交易",
count: "Txns",
totalTip: "All",
tip: "show the last 100,000 entries",
......
......@@ -55,6 +55,7 @@ export const lang = {
time: "块龄",
hash: "区块哈希",
txCount: "交易数量",
txCount_single: "交易数量",
blockRevenue: "区块收益",
mineRevenue: "挖矿收益",
packingAddress: "打包地址",
......@@ -94,6 +95,10 @@ export const lang = {
},
trade: {
title: "全部交易",
filterSucceedTx: "查看成功的交易",
filterFailedTx: "查看失败的交易",
filterSentTx: "查看发出的交易",
filterReceivedTx: "查看接收的交易",
count: "条交易",
totalTip: "全部",
tip: "显示最近10万条",
......
......@@ -8,7 +8,7 @@
{{ txCount }}
</div>
<div class="text-xs font-bold text-footer-color-light">
{{ $t('lang.block.txCount') }}
{{ txCount === 1 ? $t('lang.block.txCount_single') : $t('lang.block.txCount') }}
</div>
</div>
<div class="msgBox flex-shrink-0 flex-grow mt-3.5 ml-2">
......
import {
getAddressTxCount,
getAddrTxList,
getAddressTxCountOrigin,
getAddrTxList_another,
getMakerAddr,
getMakerAddrCount,
getVoterAddr,
......@@ -44,6 +44,7 @@ export default Vue.extend({
packList: [] as iPack[],
loadingVote: false,
loadingPack: false,
selectedTxRecordFilterValue: "all",
};
},
watch: {
......@@ -53,6 +54,10 @@ export default Vue.extend({
this.getMaker();
this.getVoter();
},
selectedTxRecordFilterValue(newValue) {
this.pages.currentPage = 1;
this.getTxList();
},
},
mounted() {
this.getAllExecBalance();
......@@ -61,6 +66,30 @@ export default Vue.extend({
this.getVoter();
},
computed: {
txRecordFilterOptionList() {
return [
{
name: this.$t("lang.trade.title"),
value: "all",
},
{
name: this.$t("lang.trade.filterSucceedTx"),
value: "filterSucceedTx",
},
{
name: this.$t("lang.trade.filterFailedTx"),
value: "filterFailedTx",
},
{
name: this.$t("lang.trade.filterSentTx"),
value: "filterSentTx",
},
{
name: this.$t("lang.trade.filterReceivedTx"),
value: "filterReceivedTx",
},
];
},
tabList() {
return [
{
......@@ -107,6 +136,108 @@ export default Vue.extend({
}
)?.account?.frozen;
},
txRecordReqParams(): any {
switch (this.selectedTxRecordFilterValue) {
case "all":
return [
{
match_one: [
{
key: "from",
value: this.$route.query.address as string,
},
{
key: "to",
value: this.$route.query.address as string,
},
],
match: [],
},
];
case "filterSucceedTx":
return [
{
match_one: [
{
key: "from",
value: this.$route.query.address as string,
},
{
key: "to",
value: this.$route.query.address as string,
},
],
match: [
{
query: {
match_one: [
{
key: "is_para",
value: true,
},
{
key: "success",
value: true,
},
],
},
},
],
},
];
case "filterFailedTx":
return [
{
match_one: [
{
key: "from",
value: this.$route.query.address as string,
},
{
key: "to",
value: this.$route.query.address as string,
},
],
match: [
{
key: "success",
value: false,
},
{
key: "is_para",
value: false,
},
],
},
];
case "filterSentTx":
return [
{
match_one: [
{
key: "from",
value: this.$route.query.address as string,
},
],
match: [],
},
];
case "filterReceivedTx":
return [
{
match_one: [
{
key: "to",
value: this.$route.query.address as string,
},
],
match: [],
},
];
default:
return [];
}
},
},
methods: {
getAllExecBalance() {
......@@ -140,15 +271,15 @@ export default Vue.extend({
},
getTxList() {
this.loadingTxRecordTable = true;
getAddressTxCount(this.$route.query.address as string).then((res) => {
getAddressTxCountOrigin(this.txRecordReqParams).then((res) => {
if (res.error === null) {
this.total1 = res.result;
this.pages.total = res.result;
// this.pages.total = res.result > 10000 ? 10000 : res.result;
getAddrTxList(
this.$route.query.address as string,
getAddrTxList_another(
this.pages.currentPage,
this.pages.pageSize
this.pages.pageSize,
this.txRecordReqParams[0]
).then((res) => {
if (res.error === null) {
this.txRecordList = this.checkGroup(res.result);
......@@ -214,10 +345,10 @@ export default Vue.extend({
pageChange(page: number) {
this.pages.currentPage = page;
this.loadingTxRecordTable = true;
getAddrTxList(
this.$route.query.address as string,
getAddrTxList_another(
this.pages.currentPage,
this.pages.pageSize
this.pages.pageSize,
this.txRecordReqParams[0]
).then((res) => {
if (res.error === null) {
this.txRecordList = this.checkGroup(res.result);
......
......@@ -175,7 +175,7 @@ export function statSearch(times: number[]) {
});
}
export function getAddressTxCount(addr: string) {
export function getAddressTxCount(addr: string, matches = [] as any[]) {
return axios(expandApi, {
method: "post",
params: {
......@@ -193,13 +193,24 @@ export function getAddressTxCount(addr: string) {
value: addr,
},
],
match: [],
match: matches,
},
],
},
});
}
export function getAddressTxCountOrigin(params: any) {
return axios(expandApi, {
method: "post",
params: {
id: 1,
method: "Tx.TxCount",
params,
},
});
}
export function getAllPos33TicketCount() {
return axios(yccApi, {
method: "post",
......@@ -255,6 +266,27 @@ export function getAddrTxList(addr: string, number: number, size: number) {
});
}
export function getAddrTxList_another(
number: number,
size: number,
objContainMatchOneAndMatch: any
) {
return axios(expandApi, {
method: "post",
params: {
id: 1,
method: "Tx.TxList",
params: [
{
...objContainMatchOneAndMatch,
sort: [{ key: "height", ascending: false }],
page: { number, size },
},
],
},
});
}
export function getMakerAddrCount(addr: string) {
return axios(expandApi, {
method: "post",
......
......@@ -10,7 +10,7 @@
:frozen="frozen"
></m-address-overview>
<div
class="rounded-twoPx overflow-hidden shadow-shadow1"
class="rounded-twoPx shadow-shadow1 bg-white"
style="margin-top: 15px;"
>
<m-tabs
......@@ -19,6 +19,13 @@
:tabList="tabList"
></m-tabs>
<div v-if="focusedTab === 'txRecord'">
<div>
<Select
:selectedValue="selectedTxRecordFilterValue"
:optionList="txRecordFilterOptionList"
@change="(v) => (selectedTxRecordFilterValue = v)"
></Select>
</div>
<!-- <div class="bg-white text-text-color pl-3.5"> -->
<!-- {{ $t('lang.trade.txTotal', [total1]) }} -->
<!-- ({{ $t('lang.trade.tip2') }}) -->
......@@ -108,6 +115,8 @@ import address from '@/mixin/address'
import VueTypedMixins from 'vue-typed-mixins'
import MAddressOverview from './components/m-address-overview/index.vue'
import MTxItem from '@/components/mobile/m-txItem.vue'
import Select from '@/components/pc/Select.vue'
export default VueTypedMixins(address).extend({
components: {
MChainSearch,
......@@ -115,6 +124,7 @@ export default VueTypedMixins(address).extend({
MTabs,
MPageContainer,
MVotePack,
Select,
MTxItem,
},
})
......
......@@ -27,10 +27,9 @@
></TabList>
<DataFilter
v-if="focusedTab === 'txRecord'"
:optionList="optionList"
:setValue="(v) => (selectedOption = v)"
:hideSelect="true"
:value="selectedOption"
:optionList="txRecordFilterOptionList"
:setValue="(v) => (selectedTxRecordFilterValue = v)"
:value="selectedTxRecordFilterValue"
>
<template #left>
{{ $t('lang.trade.txTotal', [total1]) }}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment