|
@@ -0,0 +1,170 @@
|
|
|
|
|
+<template>
|
|
|
|
|
+ <div class="family-earnings-panel">
|
|
|
|
|
+ <!-- 搜索筛选(familyId 锁定) -->
|
|
|
|
|
+ <el-form :inline="true" class="form-mb20">
|
|
|
|
|
+ <el-form-item>
|
|
|
|
|
+ <el-button type="primary" @click="loadList">刷新</el-button>
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ <el-form-item>
|
|
|
|
|
+ <el-tag size="small" type="info">当前家庭 #{{ familyId }}</el-tag>
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ </el-form>
|
|
|
|
|
+
|
|
|
|
|
+ <div class="adm-table-wrap">
|
|
|
|
|
+ <el-table :data="list" v-loading="loading" border stripe height="100%" @row-click="showDetail">
|
|
|
|
|
+ <el-table-column prop="id" label="ID" width="70">
|
|
|
|
|
+ <template slot="header">
|
|
|
|
|
+ <span class="sort-header" @click.stop="onSortClick('id', $event)">ID<span v-if="sortIndex('id') !== null" class="sort-index" :class="sortClass('id') === 'sort-asc' ? 'sort-asc-badge' : 'sort-desc-badge'">{{ sortIndex('id') }}</span>{{ sortIcon('id') }}</span>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </el-table-column>
|
|
|
|
|
+ <el-table-column prop="familyId" label="家庭ID" width="100" />
|
|
|
|
|
+ <el-table-column label="累计推荐收入" width="140">
|
|
|
|
|
+ <template slot-scope="{ row }">
|
|
|
|
|
+ <span class="adm-num amount-orange">{{ fenToYuan(row.totalEarned) }}</span>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </el-table-column>
|
|
|
|
|
+ <el-table-column label="可支配余额" width="140">
|
|
|
|
|
+ <template slot-scope="{ row }">
|
|
|
|
|
+ <span class="adm-num amount-green">{{ fenToYuan(row.availableAmount) }}</span>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </el-table-column>
|
|
|
|
|
+ <el-table-column label="已提现" width="120">
|
|
|
|
|
+ <template slot-scope="{ row }">
|
|
|
|
|
+ <span class="adm-num">{{ fenToYuan(row.withdrawnAmount) }}</span>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </el-table-column>
|
|
|
|
|
+ <el-table-column label="已分配" width="120">
|
|
|
|
|
+ <template slot-scope="{ row }">
|
|
|
|
|
+ <span class="adm-num">{{ fenToYuan(row.distributedAmount) }}</span>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </el-table-column>
|
|
|
|
|
+ <el-table-column label="更新时间" width="160">
|
|
|
|
|
+ <template slot-scope="{ row }">
|
|
|
|
|
+ {{ row.updatedAt ? formatTime(row.updatedAt) : '-' }}
|
|
|
|
|
+ </template>
|
|
|
|
|
+ <template slot="header">
|
|
|
|
|
+ <span class="sort-header" @click.stop="onSortClick('updatedAt', $event)">更新时间<span v-if="sortIndex('updatedAt') !== null" class="sort-index" :class="sortClass('updatedAt') === 'sort-asc' ? 'sort-asc-badge' : 'sort-desc-badge'">{{ sortIndex('updatedAt') }}</span>{{ sortIcon('updatedAt') }}</span>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </el-table-column>
|
|
|
|
|
+ <el-table-column label="操作" width="100" fixed="right">
|
|
|
|
|
+ <template slot-scope="{ row }">
|
|
|
|
|
+ <el-button size="mini" type="primary" @click.stop="showDetail(row)">详情</el-button>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </el-table-column>
|
|
|
|
|
+ </el-table>
|
|
|
|
|
+ </div>
|
|
|
|
|
+
|
|
|
|
|
+ <!-- 家庭收益详情弹窗 -->
|
|
|
|
|
+ <el-dialog title="家庭收益详情" :visible.sync="detailVisible" width="700px" top="5vh">
|
|
|
|
|
+ <div v-loading="detailLoading">
|
|
|
|
|
+ <el-descriptions :column="2" border v-if="detail">
|
|
|
|
|
+ <el-descriptions-item label="家庭ID">{{ detail.familyId || '-' }}</el-descriptions-item>
|
|
|
|
|
+ <el-descriptions-item label="累计推荐收入">
|
|
|
|
|
+ <span class="adm-num amount-orange">{{ fenToYuan(detail.totalEarned) }}</span>
|
|
|
|
|
+ </el-descriptions-item>
|
|
|
|
|
+ <el-descriptions-item label="可支配余额">
|
|
|
|
|
+ <span class="adm-num amount-green">{{ fenToYuan(detail.availableAmount) }}</span>
|
|
|
|
|
+ </el-descriptions-item>
|
|
|
|
|
+ <el-descriptions-item label="已提现">{{ fenToYuan(detail.withdrawnAmount) }}</el-descriptions-item>
|
|
|
|
|
+ <el-descriptions-item label="已分配">{{ fenToYuan(detail.distributedAmount) }}</el-descriptions-item>
|
|
|
|
|
+ </el-descriptions>
|
|
|
|
|
+
|
|
|
|
|
+ <h4 class="members-title">成员贡献</h4>
|
|
|
|
|
+ <el-table v-if="detail && detail.members && detail.members.length > 0" :data="detail.members" border stripe size="small" :max-height="300">
|
|
|
|
|
+ <el-table-column label="昵称" prop="nickname" min-width="120" />
|
|
|
|
|
+ <el-table-column label="已分配" width="120">
|
|
|
|
|
+ <template slot-scope="{ row }">{{ fenToYuan(row.allocatedAmount) }}</template>
|
|
|
|
|
+ </el-table-column>
|
|
|
|
|
+ <el-table-column label="已消费" width="120">
|
|
|
|
|
+ <template slot-scope="{ row }">{{ fenToYuan(row.consumedAmount) }}</template>
|
|
|
|
|
+ </el-table-column>
|
|
|
|
|
+ <el-table-column label="可用余额" width="120">
|
|
|
|
|
+ <template slot-scope="{ row }"><span class="amount-green">{{ fenToYuan(row.availableAmount) }}</span></template>
|
|
|
|
|
+ </el-table-column>
|
|
|
|
|
+ <el-table-column label="池权限" width="100">
|
|
|
|
|
+ <template slot-scope="{ row }">
|
|
|
|
|
+ <StatusTag size="mini" :type="row.canUseFamilyBalance ? 'success' : 'info'" :text="row.canUseFamilyBalance ? '可用' : '关闭'" />
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </el-table-column>
|
|
|
|
|
+ <el-table-column label="管理员" width="80">
|
|
|
|
|
+ <template slot-scope="{ row }">
|
|
|
|
|
+ <StatusTag v-if="row.isAdmin" type="warning" size="mini" text="是" />
|
|
|
|
|
+ <span v-else>否</span>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </el-table-column>
|
|
|
|
|
+ </el-table>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </el-dialog>
|
|
|
|
|
+ </div>
|
|
|
|
|
+</template>
|
|
|
|
|
+
|
|
|
|
|
+<script>
|
|
|
|
|
+import SortMixin from '@/mixins/SortMixin'
|
|
|
|
|
+import { getFamilyEarningsList, getFamilyEarningsDetail } from '@/api/admin'
|
|
|
|
|
+
|
|
|
|
|
+export default {
|
|
|
|
|
+ name: 'FamilyEarningsPanel',
|
|
|
|
|
+ mixins: [SortMixin],
|
|
|
|
|
+ props: {
|
|
|
|
|
+ familyId: {
|
|
|
|
|
+ type: [Number, String],
|
|
|
|
|
+ default: null
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ data() {
|
|
|
|
|
+ return {
|
|
|
|
|
+ list: [],
|
|
|
|
|
+ loading: false,
|
|
|
|
|
+ detailVisible: false,
|
|
|
|
|
+ detailLoading: false,
|
|
|
|
|
+ detail: null,
|
|
|
|
|
+ sortableColumns: { id: 'ID', updatedAt: '更新时间' }
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ mounted() {
|
|
|
|
|
+ this.loadList()
|
|
|
|
|
+ },
|
|
|
|
|
+ methods: {
|
|
|
|
|
+ async loadList() {
|
|
|
|
|
+ this.loading = true
|
|
|
|
|
+ try {
|
|
|
|
|
+ const params = {}
|
|
|
|
|
+ if (this.familyId != null) params.familyId = this.familyId
|
|
|
|
|
+ if (this.sortState.length > 0) params.sort = this.sortState
|
|
|
|
|
+ const res = await getFamilyEarningsList(params)
|
|
|
|
|
+ this.list = res.data || []
|
|
|
|
|
+ } catch (e) {
|
|
|
|
|
+ this.$message.error('加载失败')
|
|
|
|
|
+ } finally {
|
|
|
|
|
+ this.loading = false
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ async showDetail(row) {
|
|
|
|
|
+ this.detailVisible = true
|
|
|
|
|
+ this.detailLoading = true
|
|
|
|
|
+ try {
|
|
|
|
|
+ const res = await getFamilyEarningsDetail(row.familyId || row.id)
|
|
|
|
|
+ this.detail = res.data || row
|
|
|
|
|
+ } catch (e) {
|
|
|
|
|
+ this.$message.error('加载详情失败')
|
|
|
|
|
+ this.detail = row
|
|
|
|
|
+ } finally {
|
|
|
|
|
+ this.detailLoading = false
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ fenToYuan(fen) {
|
|
|
|
|
+ if (fen === null || fen === undefined) return '0.00'
|
|
|
|
|
+ const num = Number(fen)
|
|
|
|
|
+ if (isNaN(num)) return '0.00'
|
|
|
|
|
+ return (num / 100).toFixed(2)
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+</script>
|
|
|
|
|
+
|
|
|
|
|
+<style scoped>
|
|
|
|
|
+.form-mb20 { margin-bottom: 24px; }
|
|
|
|
|
+.amount-orange { font-weight: bold; color: var(--adm-warning-text); }
|
|
|
|
|
+.amount-green { font-weight: bold; color: var(--adm-success); }
|
|
|
|
|
+.members-title { margin: 24px 0 10px; }
|
|
|
|
|
+</style>
|