调整主持人
This commit is contained in:
@@ -64,6 +64,15 @@ export function getLbDepartmentUserTree(params) {
|
||||
})
|
||||
}
|
||||
|
||||
export function getLbDepartmentUserTreeSumTotalMoney(params) {
|
||||
return request({
|
||||
url: '/lbDepartmentUser/treeSumTotalMoney',
|
||||
method: 'get',
|
||||
params,
|
||||
timeout: 160000
|
||||
})
|
||||
}
|
||||
|
||||
/** 按租户ID与用户ID列表导出 Excel */
|
||||
export function exportLbDepartmentUsers(tenantId, userIds) {
|
||||
return request({
|
||||
|
||||
@@ -213,6 +213,120 @@
|
||||
</div>
|
||||
</el-card>
|
||||
</el-tab-pane>
|
||||
|
||||
<el-tab-pane label="累计交易金额" name="sumTotalMoney">
|
||||
<el-card class="filter-container" shadow="never">
|
||||
<el-form :model="sumTotalMoneyQueryParams" :inline="true" label-width="120px">
|
||||
<el-form-item label="是否活跃">
|
||||
<el-select
|
||||
v-model="sumTotalMoneyQueryParams.isActive"
|
||||
clearable
|
||||
placeholder="全部"
|
||||
style="width: 140px"
|
||||
>
|
||||
<el-option label="活跃" :value="1" />
|
||||
<el-option label="不活跃" :value="0" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="晚于加入日期">
|
||||
<el-date-picker
|
||||
v-model="sumTotalMoneyQueryParams.joinDate"
|
||||
type="date"
|
||||
clearable
|
||||
value-format="yyyy-MM-dd"
|
||||
placeholder="查询加入日期大于该日期的数据"
|
||||
style="width: 280px"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="晚于最后成交日期">
|
||||
<el-date-picker
|
||||
v-model="sumTotalMoneyQueryParams.lastTradeDate"
|
||||
type="date"
|
||||
clearable
|
||||
value-format="yyyy-MM-dd"
|
||||
placeholder="查询最后成交日期大于该日期的数据"
|
||||
style="width: 280px"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="交易开始时间">
|
||||
<el-date-picker
|
||||
v-model="sumTotalMoneyQueryParams.buyStartTime"
|
||||
type="datetime"
|
||||
clearable
|
||||
value-format="yyyy-MM-dd HH:mm:ss"
|
||||
placeholder="请选择交易开始时间"
|
||||
style="width: 280px"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="交易结束时间">
|
||||
<el-date-picker
|
||||
v-model="sumTotalMoneyQueryParams.buyEndTime"
|
||||
type="datetime"
|
||||
clearable
|
||||
value-format="yyyy-MM-dd HH:mm:ss"
|
||||
placeholder="请选择交易结束时间"
|
||||
style="width: 280px"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" :loading="sumTotalMoneyLoading" @click="handleSumTotalMoneyQuery">
|
||||
查询
|
||||
</el-button>
|
||||
<el-button icon="el-icon-delete" @click="resetSumTotalMoneyQuery">清空</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-card>
|
||||
|
||||
<el-card shadow="never" class="sum-total-money-panel">
|
||||
<div class="sum-total-money-toolbar">
|
||||
<el-button
|
||||
type="primary"
|
||||
icon="el-icon-refresh"
|
||||
:loading="sumTotalMoneyLoading"
|
||||
@click="fetchSumTotalMoneyTree"
|
||||
>
|
||||
刷新
|
||||
</el-button>
|
||||
</div>
|
||||
<el-alert
|
||||
:title="`共 ${sumTotalMoneyTotal} 人,累计交易金额:¥ ${formatMoney(sumTotalMoneyTotalAmount)}`"
|
||||
type="info"
|
||||
:closable="false"
|
||||
show-icon
|
||||
class="sum-total-money-alert"
|
||||
/>
|
||||
<el-input
|
||||
v-model="sumTotalMoneyFilterText"
|
||||
clearable
|
||||
placeholder="搜索姓名、用户ID、电话、累计交易金额、自身交易金额"
|
||||
prefix-icon="el-icon-search"
|
||||
class="sum-total-money-filter"
|
||||
/>
|
||||
<div v-loading="sumTotalMoneyLoading" class="sum-total-money-wrap">
|
||||
<el-tree
|
||||
v-if="sumTotalMoneyData.length"
|
||||
ref="sumTotalMoneyTree"
|
||||
:data="sumTotalMoneyData"
|
||||
:props="sumTotalMoneyProps"
|
||||
:filter-node-method="filterSumTotalMoneyNode"
|
||||
node-key="userId"
|
||||
highlight-current
|
||||
>
|
||||
<span
|
||||
slot-scope="{ data }"
|
||||
class="sum-total-money-node"
|
||||
>
|
||||
<span class="sum-total-money-node-name">{{ data.name || '-' }}</span>
|
||||
<span class="sum-total-money-node-meta">用户ID:{{ data.userId || '-' }}</span>
|
||||
<span class="sum-total-money-node-meta">电话:{{ data.phone || '-' }}</span>
|
||||
<span class="sum-total-money-node-meta sum-total-money-amount">累计交易金额:¥ {{ formatMoney(data.tradeMoneySum) }}</span>
|
||||
<span class="sum-total-money-node-meta sum-total-money-self">自身交易金额:¥ {{ formatMoney(data.selfTradeMoney) }}</span>
|
||||
</span>
|
||||
</el-tree>
|
||||
<el-empty v-else description="暂无数据,请点击刷新加载" />
|
||||
</div>
|
||||
</el-card>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
|
||||
<el-dialog :title="dialogTitle" :visible.sync="dialogVisible" width="760px" @close="resetForm">
|
||||
@@ -344,6 +458,7 @@ import {
|
||||
exportLbDepartmentUsers,
|
||||
getLbDepartmentUserList,
|
||||
getLbDepartmentUserTree,
|
||||
getLbDepartmentUserTreeSumTotalMoney,
|
||||
syncLbDepartmentUserFromDailyUserTrade,
|
||||
syncLbDepartmentUserFromLbUser,
|
||||
updateLbDepartmentUser
|
||||
@@ -378,6 +493,18 @@ export default {
|
||||
children: 'children',
|
||||
label: 'name'
|
||||
},
|
||||
sumTotalMoneyLoading: false,
|
||||
sumTotalMoneyData: [],
|
||||
sumTotalMoneyTotal: 0,
|
||||
sumTotalMoneyTotalAmount: 0,
|
||||
sumTotalMoneyFilterText: '',
|
||||
sumTotalMoneyQueryParams: {
|
||||
lastTradeDate: '2026-04-26'
|
||||
},
|
||||
sumTotalMoneyProps: {
|
||||
children: 'children',
|
||||
label: 'name'
|
||||
},
|
||||
parentBindLoading: false,
|
||||
list: [],
|
||||
total: 0,
|
||||
@@ -435,6 +562,13 @@ export default {
|
||||
this.$refs.urgeTree.filter(val)
|
||||
}
|
||||
})
|
||||
},
|
||||
sumTotalMoneyFilterText(val) {
|
||||
this.$nextTick(() => {
|
||||
if (this.$refs.sumTotalMoneyTree) {
|
||||
this.$refs.sumTotalMoneyTree.filter(val)
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
created() {
|
||||
@@ -561,8 +695,12 @@ export default {
|
||||
})
|
||||
},
|
||||
handleTabClick(tab) {
|
||||
if (!tab || tab.name !== 'urge') return
|
||||
if (!tab) return
|
||||
if (tab.name === 'urge') {
|
||||
this.fetchUrgeTree()
|
||||
} else if (tab.name === 'sumTotalMoney') {
|
||||
this.fetchSumTotalMoneyTree()
|
||||
}
|
||||
},
|
||||
buildUrgeTreeParams() {
|
||||
const tenantId = this.getTenantIdFromBusinessHeaders()
|
||||
@@ -731,6 +869,88 @@ export default {
|
||||
this.urgeTreeExportLoading = false
|
||||
})
|
||||
},
|
||||
buildSumTotalMoneyParams() {
|
||||
const tenantId = this.getTenantIdFromBusinessHeaders()
|
||||
const params = { tenantId }
|
||||
const { isActive, joinDate, lastTradeDate, buyStartTime, buyEndTime } = this.sumTotalMoneyQueryParams
|
||||
if (isActive === 0 || isActive === 1) {
|
||||
params.is_active = isActive
|
||||
}
|
||||
if (joinDate) {
|
||||
params.join_date = joinDate
|
||||
}
|
||||
if (lastTradeDate) {
|
||||
params.last_trade_date = lastTradeDate
|
||||
}
|
||||
if (buyStartTime) {
|
||||
params.buy_start_time = buyStartTime
|
||||
}
|
||||
if (buyEndTime) {
|
||||
params.buy_end_time = buyEndTime
|
||||
}
|
||||
return params
|
||||
},
|
||||
handleSumTotalMoneyQuery() {
|
||||
this.fetchSumTotalMoneyTree()
|
||||
},
|
||||
resetSumTotalMoneyQuery() {
|
||||
this.sumTotalMoneyQueryParams = {}
|
||||
this.fetchSumTotalMoneyTree()
|
||||
},
|
||||
fetchSumTotalMoneyTree() {
|
||||
const tenantId = this.getTenantIdFromBusinessHeaders()
|
||||
if (!tenantId) {
|
||||
this.$message.error('未获取到租户ID,请先登录或配置业务请求头中的租户')
|
||||
return
|
||||
}
|
||||
this.sumTotalMoneyLoading = true
|
||||
getLbDepartmentUserTreeSumTotalMoney(this.buildSumTotalMoneyParams())
|
||||
.then((res) => {
|
||||
const hasData = res && Array.isArray(res.data)
|
||||
const isSuccess = res && (res.success === true || res.code === 200 || res.code === 20000 || hasData)
|
||||
if (!isSuccess) {
|
||||
this.$message.error((res && res.message) || '加载部门用户树形结构(累计交易金额)失败')
|
||||
return
|
||||
}
|
||||
this.sumTotalMoneyData = hasData ? res.data : []
|
||||
this.sumTotalMoneyTotal = typeof res.total === 'number' ? res.total : this.sumTotalMoneyData.length
|
||||
this.sumTotalMoneyTotalAmount = this.calculateTotalAmount(this.sumTotalMoneyData)
|
||||
this.sumTotalMoneyFilterText = ''
|
||||
if (res && res.message) {
|
||||
this.$message.success(res.message)
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
this.$message.error('加载部门用户树形结构(累计交易金额)失败')
|
||||
})
|
||||
.finally(() => {
|
||||
this.sumTotalMoneyLoading = false
|
||||
})
|
||||
},
|
||||
calculateTotalAmount(nodes) {
|
||||
let total = 0
|
||||
if (!nodes || !nodes.length) return total
|
||||
nodes.forEach((node) => {
|
||||
if (typeof node.tradeMoneySum === 'number') {
|
||||
total += node.tradeMoneySum
|
||||
}
|
||||
if (node.children && node.children.length) {
|
||||
total += this.calculateTotalAmount(node.children)
|
||||
}
|
||||
})
|
||||
return total
|
||||
},
|
||||
filterSumTotalMoneyNode(value, data) {
|
||||
if (!value) return true
|
||||
const keyword = String(value).trim().toLowerCase()
|
||||
if (!keyword) return true
|
||||
const fields = [data.name, data.userId, data.phone, data.tradeMoneySum, data.selfTradeMoney]
|
||||
return fields.some((field) => field != null && String(field).toLowerCase().includes(keyword))
|
||||
},
|
||||
formatMoney(amount) {
|
||||
if (amount == null || amount === '') return '0.00'
|
||||
return Number(amount).toLocaleString('zh-CN', { minimumFractionDigits: 2, maximumFractionDigits: 2 })
|
||||
},
|
||||
handleEdit(row) {
|
||||
this.dialogTitle = '编辑部门人员'
|
||||
this.isEdit = true
|
||||
@@ -1102,5 +1322,56 @@ export default {
|
||||
float: left;
|
||||
color: #606266;
|
||||
}
|
||||
|
||||
.sum-total-money-panel {
|
||||
.sum-total-money-toolbar {
|
||||
margin-bottom: 12px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
gap: 12px;
|
||||
}
|
||||
}
|
||||
|
||||
.sum-total-money-alert {
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
.sum-total-money-filter {
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
.sum-total-money-wrap {
|
||||
max-height: calc(100vh - 320px);
|
||||
min-height: 400px;
|
||||
overflow: auto;
|
||||
border: 1px solid #ebeef5;
|
||||
border-radius: 4px;
|
||||
padding: 12px;
|
||||
}
|
||||
|
||||
.sum-total-money-node {
|
||||
display: inline-flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
font-size: 14px;
|
||||
line-height: 24px;
|
||||
}
|
||||
|
||||
.sum-total-money-node-name {
|
||||
font-weight: 500;
|
||||
color: #303133;
|
||||
}
|
||||
|
||||
.sum-total-money-node-meta {
|
||||
color: #909399;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.sum-total-money-amount {
|
||||
color: #409eff;
|
||||
font-weight: 500;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user