周五定时更新
This commit is contained in:
@@ -194,9 +194,9 @@
|
||||
</div>
|
||||
</li>
|
||||
<!-- 矿机租赁 -->
|
||||
<li @click="handelMachineLease">
|
||||
<!-- <li @click="handelMachineLease">
|
||||
{{ $t(`home.machineLease`) }}
|
||||
</li>
|
||||
</li> -->
|
||||
|
||||
<!-- 工单管理 -->
|
||||
<!-- <li
|
||||
|
||||
@@ -3,6 +3,7 @@ export default {
|
||||
data() {
|
||||
return {
|
||||
pendingPaymentData: [],
|
||||
allPendingData: [],
|
||||
currencyList: [
|
||||
|
||||
|
||||
@@ -27,13 +28,47 @@ export default {
|
||||
methods: {
|
||||
async fetchPendingPaymentData(params) {
|
||||
this.setLoading('loading', true);
|
||||
const res = await summaryOfPendingPayments(params);
|
||||
|
||||
if (res && res.code == 200) {
|
||||
this.pendingPaymentData = res.rows;
|
||||
this.total = res.total;
|
||||
}
|
||||
this.setLoading('loading', false);
|
||||
const firstRes = await summaryOfPendingPayments(params);
|
||||
let allRows = [];
|
||||
if (firstRes && firstRes.code == 200) {
|
||||
const firstRows = Array.isArray(firstRes.rows) ? firstRes.rows : [];
|
||||
const total = Number(firstRes.total || 0);
|
||||
// 若后端做了分页,二次拉取全量数据用于前端全局排序与分页
|
||||
if (total > params.pageSize) {
|
||||
const fullRes = await summaryOfPendingPayments({ ...params, pageNum: 1, pageSize: total });
|
||||
allRows = Array.isArray(fullRes && fullRes.rows) ? fullRes.rows : firstRows;
|
||||
} else {
|
||||
allRows = firstRows;
|
||||
}
|
||||
|
||||
const sortedRows = this.sortRows(allRows);
|
||||
this.allPendingData = sortedRows;
|
||||
this.total = sortedRows.length;
|
||||
this.applySlice();
|
||||
}
|
||||
this.setLoading('loading', false);
|
||||
},
|
||||
sortRows(rows) {
|
||||
const safeRows = Array.isArray(rows) ? rows : [];
|
||||
return safeRows.slice().sort((a, b) => {
|
||||
const aNeed = Number(a && a.needPayAmount != null ? a.needPayAmount : 0);
|
||||
const aStart = Number(a && a.startPayAmount != null ? a.startPayAmount : 0);
|
||||
const bNeed = Number(b && b.needPayAmount != null ? b.needPayAmount : 0);
|
||||
const bStart = Number(b && b.startPayAmount != null ? b.startPayAmount : 0);
|
||||
|
||||
const aPriority = aNeed >= aStart ? 1 : 0;
|
||||
const bPriority = bNeed >= bStart ? 1 : 0;
|
||||
if (bPriority !== aPriority) return bPriority - aPriority;
|
||||
if (bNeed !== aNeed) return bNeed - aNeed;
|
||||
return 0;
|
||||
});
|
||||
},
|
||||
applySlice() {
|
||||
const pageSize = Number(this.pendingPaymentParams.pageSize || 10);
|
||||
const pageNum = Number(this.pendingPaymentParams.pageNum || 1);
|
||||
const start = (pageNum - 1) * pageSize;
|
||||
const end = start + pageSize;
|
||||
this.pendingPaymentData = (this.allPendingData || []).slice(start, end);
|
||||
},
|
||||
handelImg(coin) {
|
||||
console.log(coin,"coin");
|
||||
@@ -73,13 +108,21 @@ export default {
|
||||
this.pendingPaymentParams.pageSize = val
|
||||
this.pendingPaymentParams.pageNum = 1
|
||||
this.currentPage = 1
|
||||
this.fetchPendingPaymentData(this.pendingPaymentParams);
|
||||
if (this.allPendingData && this.allPendingData.length > 0) {
|
||||
this.applySlice();
|
||||
} else {
|
||||
this.fetchPendingPaymentData(this.pendingPaymentParams);
|
||||
}
|
||||
|
||||
},
|
||||
handleCurrentChange(val) {
|
||||
console.log(`当前页: ${val}`);
|
||||
this.pendingPaymentParams.pageNum = val
|
||||
this.fetchPendingPaymentData(this.pendingPaymentParams);
|
||||
if (this.allPendingData && this.allPendingData.length > 0) {
|
||||
this.applySlice();
|
||||
} else {
|
||||
this.fetchPendingPaymentData(this.pendingPaymentParams);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<div v-loading="loading">
|
||||
|
||||
|
||||
<div class="main-title">{{$t('backendSystem.pendingPaymentSummary')}}</div>
|
||||
<el-table
|
||||
:data="pendingPaymentData"
|
||||
@@ -27,7 +27,13 @@
|
||||
<el-table-column prop="maxHeight" :label="$t('backendSystem.allocateHeight')" show-overflow-tooltip/>
|
||||
<el-table-column prop="startPayAmount" :label="$t('backendSystem.startPayAmount')" show-overflow-tooltip/>
|
||||
|
||||
<el-table-column prop="needPayAmount" :label="$t('backendSystem.needPayAmount')" show-overflow-tooltip/>
|
||||
<el-table-column prop="needPayAmount" :label="$t('backendSystem.needPayAmount')" show-overflow-tooltip>
|
||||
<template slot-scope="scope">
|
||||
<span :class="{ 'amount-highlight': Number(scope.row.needPayAmount) >= Number(scope.row.startPayAmount) }">
|
||||
{{ scope.row.needPayAmount }}
|
||||
</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
|
||||
|
||||
@@ -69,4 +75,8 @@ export default {
|
||||
color: #333;
|
||||
margin-bottom: 18px;
|
||||
}
|
||||
.amount-highlight {
|
||||
font-weight: 700;
|
||||
color: #f56c6c;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user