|
|
@@ -1,236 +1,333 @@
|
|
|
<template>
|
|
|
<div class="cf-value admin-page">
|
|
|
- <PageHeader title="CF值(平台积分)管理">
|
|
|
- <div class="filters">
|
|
|
- <el-input v-model="searchUserId" placeholder="用户ID/用户名搜索" class="filter-input-200" clearable @keyup.enter.native="searchBalance" />
|
|
|
- <el-button type="primary" @click="searchBalance">查询余额</el-button>
|
|
|
- </div>
|
|
|
+ <PageHeader title="CF值管理">
|
|
|
+ <span class="tip-text">数据源:统一账本 cf_balance(实时)</span>
|
|
|
</PageHeader>
|
|
|
|
|
|
- <el-tabs v-model="activeTab">
|
|
|
- <el-tab-pane label="余额列表" name="balances">
|
|
|
- <div class="adm-table-wrap">
|
|
|
-<el-table :data="balanceList" v-loading="loadingBalance" border stripe height="100%">
|
|
|
- <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 label="用户" width="140">
|
|
|
- <template slot-scope="{ row }">{{ row.userName || '用户' + row.userId }}</template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column prop="familyId" label="家庭ID" width="100">
|
|
|
- <template slot="header">
|
|
|
- <span class="sort-header" @click.stop="onSortClick('familyId', $event)">家庭ID<span v-if="sortIndex('familyId') !== null" class="sort-index" :class="sortClass('familyId') === 'sort-asc' ? 'sort-asc-badge' : 'sort-desc-badge'">{{ sortIndex('familyId') }}</span>{{ sortIcon('familyId') }}</span>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column prop="totalEarned" label="累计获得" width="100">
|
|
|
- <template slot="header">
|
|
|
- <span class="sort-header" @click.stop="onSortClick('totalEarned', $event)">累计获得<span v-if="sortIndex('totalEarned') !== null" class="sort-index" :class="sortClass('totalEarned') === 'sort-asc' ? 'sort-asc-badge' : 'sort-desc-badge'">{{ sortIndex('totalEarned') }}</span>{{ sortIcon('totalEarned') }}</span>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column prop="available" label="可用" width="80">
|
|
|
- <template slot="header">
|
|
|
- <span class="sort-header" @click.stop="onSortClick('available', $event)">可用<span v-if="sortIndex('available') !== null" class="sort-index" :class="sortClass('available') === 'sort-asc' ? 'sort-asc-badge' : 'sort-desc-badge'">{{ sortIndex('available') }}</span>{{ sortIcon('available') }}</span>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column prop="frozen" label="冻结" width="80">
|
|
|
- <template slot="header">
|
|
|
- <span class="sort-header" @click.stop="onSortClick('frozen', $event)">冻结<span v-if="sortIndex('frozen') !== null" class="sort-index" :class="sortClass('frozen') === 'sort-asc' ? 'sort-asc-badge' : 'sort-desc-badge'">{{ sortIndex('frozen') }}</span>{{ sortIcon('frozen') }}</span>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column prop="withdrawn" label="已提现" width="80">
|
|
|
- <template slot="header">
|
|
|
- <span class="sort-header" @click.stop="onSortClick('withdrawn', $event)">已提现<span v-if="sortIndex('withdrawn') !== null" class="sort-index" :class="sortClass('withdrawn') === 'sort-asc' ? 'sort-asc-badge' : 'sort-desc-badge'">{{ sortIndex('withdrawn') }}</span>{{ sortIcon('withdrawn') }}</span>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column prop="exchanged" label="已兑换" width="80">
|
|
|
- <template slot="header">
|
|
|
- <span class="sort-header" @click.stop="onSortClick('exchanged', $event)">已兑换<span v-if="sortIndex('exchanged') !== null" class="sort-index" :class="sortClass('exchanged') === 'sort-asc' ? 'sort-asc-badge' : 'sort-desc-badge'">{{ sortIndex('exchanged') }}</span>{{ sortIcon('exchanged') }}</span>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column label="操作" width="100">
|
|
|
- <template slot-scope="{ row }">
|
|
|
- <el-button type="text" size="small" @click="viewLogs(row.userId)">流水</el-button>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- </el-table>
|
|
|
+ <el-tabs v-model="activeTab" @tab-click="handleTabChange">
|
|
|
+ <!-- 个人余额 -->
|
|
|
+ <el-tab-pane label="个人余额" name="members">
|
|
|
+ <div class="filters">
|
|
|
+ <el-input
|
|
|
+ v-model="memberFilter.keyword"
|
|
|
+ placeholder="成员昵称/手机/用户ID"
|
|
|
+ class="filter-input-200"
|
|
|
+ clearable
|
|
|
+ @keyup.enter.native="searchMembers"
|
|
|
+ />
|
|
|
+ <el-input
|
|
|
+ v-model="memberFilter.familyId"
|
|
|
+ placeholder="家庭ID"
|
|
|
+ class="filter-input-120"
|
|
|
+ clearable
|
|
|
+ @keyup.enter.native="searchMembers"
|
|
|
+ />
|
|
|
+ <el-button type="primary" @click="searchMembers">查询</el-button>
|
|
|
+ <el-button @click="resetMembers">重置</el-button>
|
|
|
+ </div>
|
|
|
+ <div class="adm-table-wrap">
|
|
|
+ <el-table :data="memberList" v-loading="loadingMember" border stripe height="100%">
|
|
|
+ <el-table-column label="成员" min-width="130" show-overflow-tooltip>
|
|
|
+ <template slot-scope="{ row }">{{ row.memberName || ('成员' + row.memberId) }}</template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="userId" label="用户ID" width="90" />
|
|
|
+ <el-table-column label="家庭" min-width="140" show-overflow-tooltip>
|
|
|
+ <template slot-scope="{ row }">{{ row.familyName || ('家庭' + (row.familyId || '-')) }}</template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="totalEarned" label="累计获得" width="100" />
|
|
|
+ <el-table-column prop="available" label="可用" width="90">
|
|
|
+ <template slot-scope="{ row }"><span class="num-strong">{{ row.available }}</span></template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="frozen" label="冻结" width="90" />
|
|
|
+ <el-table-column prop="withdrawn" label="已提现" width="90" />
|
|
|
+ <el-table-column prop="exchanged" label="已兑换消费" width="110" />
|
|
|
+ <el-table-column label="更新时间" width="160">
|
|
|
+ <template slot-scope="{ row }">{{ fmtDate(row.updatedAt) }}</template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="操作" width="90" fixed="right">
|
|
|
+ <template slot-scope="{ row }">
|
|
|
+ <el-button type="text" size="small" @click="viewMemberLogs(row)">流水</el-button>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
</div>
|
|
|
- <el-pagination v-if="balanceTotal > 0" :current-page="balancePage" :page-size="balanceSize" :total="balanceTotal" layout="prev, pager, next" @current-change="pageBalances" />
|
|
|
+ <el-pagination
|
|
|
+ v-if="memberTotal > 0"
|
|
|
+ class="pagination-mt"
|
|
|
+ :current-page="memberPage"
|
|
|
+ :page-size="memberSize"
|
|
|
+ :total="memberTotal"
|
|
|
+ layout="total, prev, pager, next"
|
|
|
+ @current-change="pageMembers"
|
|
|
+ />
|
|
|
</el-tab-pane>
|
|
|
|
|
|
- <el-tab-pane label="流水查询" name="logs">
|
|
|
+ <!-- 家庭合计 -->
|
|
|
+ <el-tab-pane label="家庭合计" name="families">
|
|
|
<div class="filters">
|
|
|
- <el-input v-model="logUserId" placeholder="用户ID" class="filter-input-200" clearable @keyup.enter.native="searchLogs" />
|
|
|
- <el-button type="primary" @click="searchLogs">查询流水</el-button>
|
|
|
+ <el-input
|
|
|
+ v-model="familyFilter.keyword"
|
|
|
+ placeholder="家庭名称"
|
|
|
+ class="filter-input-200"
|
|
|
+ clearable
|
|
|
+ @keyup.enter.native="searchFamilies"
|
|
|
+ />
|
|
|
+ <el-button type="primary" @click="searchFamilies">查询</el-button>
|
|
|
+ <el-button @click="resetFamilies">重置</el-button>
|
|
|
</div>
|
|
|
- <div class="adm-table-wrap">
|
|
|
-<el-table :data="logList" v-loading="loadingLog" border stripe height="100%">
|
|
|
- <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 label="用户" width="120">
|
|
|
- <template slot-scope="{ row }">{{ row.userName || '用户' + row.userId }}</template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column prop="type" label="类型" width="100">
|
|
|
- <template slot-scope="{ row }">
|
|
|
- <StatusTag :type="typeTag(row.type)" size="small" :text="row.type" />
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column prop="amount" label="数量" width="80">
|
|
|
- <template slot="header">
|
|
|
- <span class="sort-header" @click.stop="onSortClick('amount', $event)">数量<span v-if="sortIndex('amount') !== null" class="sort-index" :class="sortClass('amount') === 'sort-asc' ? 'sort-asc-badge' : 'sort-desc-badge'">{{ sortIndex('amount') }}</span>{{ sortIcon('amount') }}</span>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column prop="balanceAfter" label="变动后余额" width="100">
|
|
|
- <template slot="header">
|
|
|
- <span class="sort-header" @click.stop="onSortClick('balanceAfter', $event)">变动后余额<span v-if="sortIndex('balanceAfter') !== null" class="sort-index" :class="sortClass('balanceAfter') === 'sort-asc' ? 'sort-asc-badge' : 'sort-desc-badge'">{{ sortIndex('balanceAfter') }}</span>{{ sortIcon('balanceAfter') }}</span>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column prop="refType" label="来源" width="130">
|
|
|
- <template slot="header">
|
|
|
- <span class="sort-header" @click.stop="onSortClick('refType', $event)">来源<span v-if="sortIndex('refType') !== null" class="sort-index" :class="sortClass('refType') === 'sort-asc' ? 'sort-asc-badge' : 'sort-desc-badge'">{{ sortIndex('refType') }}</span>{{ sortIcon('refType') }}</span>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column prop="refId" label="关联ID" width="80">
|
|
|
- <template slot="header">
|
|
|
- <span class="sort-header" @click.stop="onSortClick('refId', $event)">关联ID<span v-if="sortIndex('refId') !== null" class="sort-index" :class="sortClass('refId') === 'sort-asc' ? 'sort-asc-badge' : 'sort-desc-badge'">{{ sortIndex('refId') }}</span>{{ sortIcon('refId') }}</span>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column prop="remark" label="备注" min-width="160" show-overflow-tooltip>
|
|
|
- <template slot="header">
|
|
|
- <span class="sort-header" @click.stop="onSortClick('remark', $event)">备注<span v-if="sortIndex('remark') !== null" class="sort-index" :class="sortClass('remark') === 'sort-asc' ? 'sort-asc-badge' : 'sort-desc-badge'">{{ sortIndex('remark') }}</span>{{ sortIcon('remark') }}</span>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column prop="createdAt" label="时间" width="160">
|
|
|
- <template slot="header">
|
|
|
- <span class="sort-header" @click.stop="onSortClick('createdAt', $event)">时间<span v-if="sortIndex('createdAt') !== null" class="sort-index" :class="sortClass('createdAt') === 'sort-asc' ? 'sort-asc-badge' : 'sort-desc-badge'">{{ sortIndex('createdAt') }}</span>{{ sortIcon('createdAt') }}</span>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- </el-table>
|
|
|
+ <div class="adm-table-wrap">
|
|
|
+ <el-table :data="familyList" v-loading="loadingFamily" border stripe height="100%">
|
|
|
+ <el-table-column prop="familyId" label="家庭ID" width="90" />
|
|
|
+ <el-table-column prop="familyName" label="家庭名称" min-width="160" show-overflow-tooltip />
|
|
|
+ <el-table-column prop="memberCount" label="成员数" width="90" />
|
|
|
+ <el-table-column prop="totalEarned" label="累计获得" width="100" />
|
|
|
+ <el-table-column prop="available" label="家庭CF值(可用)" width="160">
|
|
|
+ <template slot-scope="{ row }"><span class="num-strong">{{ row.available }}</span></template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="frozen" label="冻结" width="90" />
|
|
|
+ <el-table-column prop="withdrawn" label="已提现" width="90" />
|
|
|
+ <el-table-column prop="exchanged" label="已兑换消费" width="110" />
|
|
|
+ <el-table-column label="更新时间" width="160">
|
|
|
+ <template slot-scope="{ row }">{{ fmtDate(row.updatedAt) }}</template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="操作" width="90" fixed="right">
|
|
|
+ <template slot-scope="{ row }">
|
|
|
+ <el-button type="text" size="small" @click="viewFamilyLogs(row)">明细</el-button>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
</div>
|
|
|
- <el-pagination v-if="logTotal > 0" :current-page="logPage" :page-size="logSize" :total="logTotal" layout="prev, pager, next" @current-change="pageLogs" />
|
|
|
+ <el-pagination
|
|
|
+ v-if="familyTotal > 0"
|
|
|
+ class="pagination-mt"
|
|
|
+ :current-page="familyPage"
|
|
|
+ :page-size="familySize"
|
|
|
+ :total="familyTotal"
|
|
|
+ layout="total, prev, pager, next"
|
|
|
+ @current-change="pageFamilies"
|
|
|
+ />
|
|
|
+ </el-tab-pane>
|
|
|
+
|
|
|
+ <!-- 流水明细 -->
|
|
|
+ <el-tab-pane label="流水明细" name="logs">
|
|
|
+ <div class="filters">
|
|
|
+ <el-input
|
|
|
+ v-model="logFilter.familyId"
|
|
|
+ placeholder="家庭ID"
|
|
|
+ class="filter-input-120"
|
|
|
+ clearable
|
|
|
+ @keyup.enter.native="searchLogs"
|
|
|
+ />
|
|
|
+ <el-input
|
|
|
+ v-model="logFilter.memberId"
|
|
|
+ placeholder="成员ID"
|
|
|
+ class="filter-input-120"
|
|
|
+ clearable
|
|
|
+ @keyup.enter.native="searchLogs"
|
|
|
+ />
|
|
|
+ <el-button type="primary" @click="searchLogs">查询</el-button>
|
|
|
+ <el-button @click="resetLogs">重置</el-button>
|
|
|
+ <span v-if="logFilter.familyId && currentFamilyName" class="tip-text">
|
|
|
+ 当前家庭:{{ currentFamilyName }}
|
|
|
+ </span>
|
|
|
+ </div>
|
|
|
+ <div class="adm-table-wrap">
|
|
|
+ <el-table :data="logList" v-loading="loadingLog" border stripe height="100%">
|
|
|
+ <el-table-column label="成员" min-width="120" show-overflow-tooltip>
|
|
|
+ <template slot-scope="{ row }">{{ row.memberName || ('成员' + row.memberId) }}</template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="familyId" label="家庭ID" width="90" />
|
|
|
+ <el-table-column label="类型" width="110">
|
|
|
+ <template slot-scope="{ row }">
|
|
|
+ <StatusTag :type="typeTag(row.type)" size="small" :text="typeLabel(row.type)" />
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="数量" width="90">
|
|
|
+ <template slot-scope="{ row }">
|
|
|
+ <span :class="row.amount >= 0 ? 'num-plus' : 'num-minus'">{{ row.amount > 0 ? '+' : '' }}{{ row.amount }}</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="balanceAfter" label="变动后余额" width="110" />
|
|
|
+ <el-table-column prop="refType" label="来源" width="140" show-overflow-tooltip />
|
|
|
+ <el-table-column prop="remark" label="备注" min-width="180" show-overflow-tooltip />
|
|
|
+ <el-table-column label="时间" width="160">
|
|
|
+ <template slot-scope="{ row }">{{ fmtDate(row.createdAt) }}</template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+ </div>
|
|
|
+ <el-pagination
|
|
|
+ v-if="logTotal > 0"
|
|
|
+ class="pagination-mt"
|
|
|
+ :current-page="logPage"
|
|
|
+ :page-size="logSize"
|
|
|
+ :total="logTotal"
|
|
|
+ layout="total, prev, pager, next"
|
|
|
+ @current-change="pageLogs"
|
|
|
+ />
|
|
|
</el-tab-pane>
|
|
|
</el-tabs>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import SortMixin from '@/mixins/SortMixin'
|
|
|
import ListStateMixin from '@/mixins/ListStateMixin'
|
|
|
-import { getCfValueBalance, getCfValueLogs, getCfValueAllBalances, searchUsers } from '@/api/admin'
|
|
|
+import { getCfMemberBalances, getCfFamilySummary, getCfAdminLogs } from '@/api/admin'
|
|
|
|
|
|
export default {
|
|
|
name: 'CfValueManage',
|
|
|
- mixins: [SortMixin, ListStateMixin],
|
|
|
+ mixins: [ListStateMixin],
|
|
|
data() {
|
|
|
return {
|
|
|
- activeTab: 'balances',
|
|
|
- searchUserId: '',
|
|
|
- logUserId: '',
|
|
|
- sortableColumns: { id: 'ID', createdAt: '时间', familyId: '家庭ID', totalEarned: '累计获得', available: '可用', frozen: '冻结', withdrawn: '已提现', exchanged: '已兑换', amount: '数量', balanceAfter: '变动后余额', refType: '来源', refId: '关联ID', remark: '备注' },
|
|
|
- // Balances
|
|
|
- balanceList: [],
|
|
|
- loadingBalance: false,
|
|
|
- balancePage: 1,
|
|
|
- balanceSize: 20,
|
|
|
- balanceTotal: 0,
|
|
|
- // Logs
|
|
|
+ activeTab: 'members',
|
|
|
+ // 个人余额
|
|
|
+ memberFilter: { keyword: '', familyId: '' },
|
|
|
+ memberList: [],
|
|
|
+ loadingMember: false,
|
|
|
+ memberPage: 1,
|
|
|
+ memberSize: 20,
|
|
|
+ memberTotal: 0,
|
|
|
+ // 家庭合计
|
|
|
+ familyFilter: { keyword: '' },
|
|
|
+ familyList: [],
|
|
|
+ loadingFamily: false,
|
|
|
+ familyPage: 1,
|
|
|
+ familySize: 20,
|
|
|
+ familyTotal: 0,
|
|
|
+ // 流水
|
|
|
+ logFilter: { familyId: '', memberId: '' },
|
|
|
logList: [],
|
|
|
loadingLog: false,
|
|
|
logPage: 1,
|
|
|
logSize: 20,
|
|
|
- logTotal: 0
|
|
|
+ logTotal: 0,
|
|
|
+ currentFamilyName: ''
|
|
|
}
|
|
|
},
|
|
|
mounted() {
|
|
|
- this.loadBalances()
|
|
|
+ this.loadMembers()
|
|
|
},
|
|
|
methods: {
|
|
|
- resolveUserNames(items, idField) {
|
|
|
- if (!items || items.length === 0) return Promise.resolve()
|
|
|
- var ids = []
|
|
|
- items.forEach(function(item) {
|
|
|
- if (item[idField] && ids.indexOf(item[idField]) === -1) ids.push(item[idField])
|
|
|
- })
|
|
|
- var nameMap = {}
|
|
|
- var self = this
|
|
|
- return Promise.all(ids.map(function(id) {
|
|
|
- return searchUsers({ keyword: String(id) })
|
|
|
- .then(function(res) {
|
|
|
- if (res.data && res.data.length > 0) {
|
|
|
- var u = res.data[0]
|
|
|
- nameMap[id] = u.nickname || u.realName || '用户' + id
|
|
|
- } else {
|
|
|
- nameMap[id] = '用户' + id
|
|
|
- }
|
|
|
- })
|
|
|
- .catch(function() {
|
|
|
- nameMap[id] = '用户' + id
|
|
|
- })
|
|
|
- })).then(function() {
|
|
|
- items.forEach(function(item) {
|
|
|
- item.userName = nameMap[item[idField]] || '用户' + item[idField]
|
|
|
- })
|
|
|
- })
|
|
|
+ // ListStateMixin 约定的刷新入口
|
|
|
+ loadList() {
|
|
|
+ this.handleTabChange()
|
|
|
+ },
|
|
|
+ handleTabChange() {
|
|
|
+ if (this.activeTab === 'families') {
|
|
|
+ this.loadFamilies()
|
|
|
+ } else if (this.activeTab === 'logs') {
|
|
|
+ this.loadLogs()
|
|
|
+ } else {
|
|
|
+ this.loadMembers()
|
|
|
+ }
|
|
|
+ },
|
|
|
+ fmtDate(v) {
|
|
|
+ if (!v) return '-'
|
|
|
+ const d = new Date(v)
|
|
|
+ if (isNaN(d.getTime())) return String(v)
|
|
|
+ const p = n => (n < 10 ? '0' + n : '' + n)
|
|
|
+ return d.getFullYear() + '-' + p(d.getMonth() + 1) + '-' + p(d.getDate()) + ' ' + p(d.getHours()) + ':' + p(d.getMinutes()) + ':' + p(d.getSeconds())
|
|
|
+ },
|
|
|
+ typeLabel(type) {
|
|
|
+ const map = {
|
|
|
+ earn: '获取',
|
|
|
+ spend: '消费',
|
|
|
+ freeze: '冻结',
|
|
|
+ unfreeze: '解冻',
|
|
|
+ withdraw: '提现',
|
|
|
+ adjust: '管理员调整',
|
|
|
+ skip: '未发放'
|
|
|
+ }
|
|
|
+ return map[type] || type
|
|
|
},
|
|
|
typeTag(type) {
|
|
|
- const map = { earn: 'success', spend: 'warning', freeze: 'info', unfreeze: 'info', withdraw: 'primary' }
|
|
|
+ const map = { earn: 'success', spend: 'warning', freeze: 'info', unfreeze: 'info', withdraw: 'primary', adjust: 'danger', skip: 'info' }
|
|
|
return map[type] || 'info'
|
|
|
},
|
|
|
- loadList() { this.loadBalances() },
|
|
|
- loadData() { this.searchLogs() },
|
|
|
- loadBalances() {
|
|
|
- this.loadingBalance = true
|
|
|
- const params = { page: this.balancePage, size: this.balanceSize }
|
|
|
- if (this.sortState.length > 0) params.sort = this.sortState
|
|
|
- getCfValueAllBalances(params).then(async res => {
|
|
|
+ // ---- 个人余额 ----
|
|
|
+ loadMembers() {
|
|
|
+ this.loadingMember = true
|
|
|
+ const params = {
|
|
|
+ page: this.memberPage,
|
|
|
+ size: this.memberSize,
|
|
|
+ keyword: this.memberFilter.keyword || undefined,
|
|
|
+ familyId: this.memberFilter.familyId || undefined
|
|
|
+ }
|
|
|
+ getCfMemberBalances(params).then(res => {
|
|
|
if (res.code === 200) {
|
|
|
- this.balanceList = res.data.records || []
|
|
|
- this.balanceTotal = res.data.total || 0
|
|
|
- await this.resolveUserNames(this.balanceList, 'userId')
|
|
|
+ this.memberList = (res.data && res.data.records) || []
|
|
|
+ this.memberTotal = (res.data && res.data.total) || 0
|
|
|
}
|
|
|
- }).finally(() => { this.loadingBalance = false })
|
|
|
+ }).catch(e => this.$message.error(e.message || '加载个人CF失败'))
|
|
|
+ .finally(() => { this.loadingMember = false })
|
|
|
+ },
|
|
|
+ pageMembers(page) { this.memberPage = page; this.loadMembers() },
|
|
|
+ searchMembers() { this.memberPage = 1; this.loadMembers() },
|
|
|
+ resetMembers() {
|
|
|
+ this.memberFilter = { keyword: '', familyId: '' }
|
|
|
+ this.memberPage = 1
|
|
|
+ this.loadMembers()
|
|
|
},
|
|
|
- pageBalances(page) {
|
|
|
- this.balancePage = page
|
|
|
- this.loadBalances()
|
|
|
+ viewMemberLogs(row) {
|
|
|
+ this.logFilter = { familyId: '', memberId: String(row.memberId || '') }
|
|
|
+ this.currentFamilyName = ''
|
|
|
+ this.logPage = 1
|
|
|
+ this.activeTab = 'logs'
|
|
|
+ this.loadLogs()
|
|
|
+ },
|
|
|
+ // ---- 家庭合计 ----
|
|
|
+ loadFamilies() {
|
|
|
+ this.loadingFamily = true
|
|
|
+ const params = {
|
|
|
+ page: this.familyPage,
|
|
|
+ size: this.familySize,
|
|
|
+ keyword: this.familyFilter.keyword || undefined
|
|
|
+ }
|
|
|
+ getCfFamilySummary(params).then(res => {
|
|
|
+ if (res.code === 200) {
|
|
|
+ this.familyList = (res.data && res.data.records) || []
|
|
|
+ this.familyTotal = (res.data && res.data.total) || 0
|
|
|
+ }
|
|
|
+ }).catch(e => this.$message.error(e.message || '加载家庭CF失败'))
|
|
|
+ .finally(() => { this.loadingFamily = false })
|
|
|
},
|
|
|
- searchBalance() {
|
|
|
- if (!this.searchUserId) { this.loadBalances(); return }
|
|
|
- this.loadingBalance = true
|
|
|
-getCfValueBalance({ userId: this.searchUserId }).then(async res => {
|
|
|
- if (res.code === 200) {
|
|
|
- this.balanceList = [res.data]
|
|
|
- this.balanceTotal = 1
|
|
|
- await this.resolveUserNames(this.balanceList, 'userId')
|
|
|
- }
|
|
|
- }).finally(() => { this.loadingBalance = false })
|
|
|
+ pageFamilies(page) { this.familyPage = page; this.loadFamilies() },
|
|
|
+ searchFamilies() { this.familyPage = 1; this.loadFamilies() },
|
|
|
+ resetFamilies() {
|
|
|
+ this.familyFilter = { keyword: '' }
|
|
|
+ this.familyPage = 1
|
|
|
+ this.loadFamilies()
|
|
|
},
|
|
|
- viewLogs(userId) {
|
|
|
- this.logUserId = String(userId)
|
|
|
+ viewFamilyLogs(row) {
|
|
|
+ this.logFilter = { familyId: String(row.familyId || ''), memberId: '' }
|
|
|
+ this.currentFamilyName = row.familyName || ('家庭' + row.familyId)
|
|
|
+ this.logPage = 1
|
|
|
this.activeTab = 'logs'
|
|
|
- this.searchLogs()
|
|
|
+ this.loadLogs()
|
|
|
},
|
|
|
- searchLogs() {
|
|
|
- if (!this.logUserId) return
|
|
|
+ // ---- 流水 ----
|
|
|
+ loadLogs() {
|
|
|
this.loadingLog = true
|
|
|
- this.logPage = 1
|
|
|
- const params = { userId: this.logUserId, page: 1, size: this.logSize }
|
|
|
- if (this.sortState.length > 0) params.sort = this.sortState
|
|
|
- getCfValueLogs(params).then(async res => {
|
|
|
- if (res.code === 200) {
|
|
|
- this.logList = res.data.records || []
|
|
|
- this.logTotal = res.data.total || 0
|
|
|
- await this.resolveUserNames(this.logList, 'userId')
|
|
|
- }
|
|
|
- }).finally(() => { this.loadingLog = false })
|
|
|
+ const params = {
|
|
|
+ page: this.logPage,
|
|
|
+ size: this.logSize,
|
|
|
+ familyId: this.logFilter.familyId || undefined,
|
|
|
+ memberId: this.logFilter.memberId || undefined
|
|
|
+ }
|
|
|
+ getCfAdminLogs(params).then(res => {
|
|
|
+ if (res.code === 200) {
|
|
|
+ this.logList = (res.data && res.data.records) || []
|
|
|
+ this.logTotal = (res.data && res.data.total) || 0
|
|
|
+ }
|
|
|
+ }).catch(e => this.$message.error(e.message || '加载CF流水失败'))
|
|
|
+ .finally(() => { this.loadingLog = false })
|
|
|
},
|
|
|
- pageLogs(page) {
|
|
|
- this.logPage = page
|
|
|
- this.searchLogs()
|
|
|
+ pageLogs(page) { this.logPage = page; this.loadLogs() },
|
|
|
+ searchLogs() { this.logPage = 1; this.loadLogs() },
|
|
|
+ resetLogs() {
|
|
|
+ this.logFilter = { familyId: '', memberId: '' }
|
|
|
+ this.currentFamilyName = ''
|
|
|
+ this.logPage = 1
|
|
|
+ this.loadLogs()
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -238,7 +335,12 @@ getCfValueBalance({ userId: this.searchUserId }).then(async res => {
|
|
|
|
|
|
<style scoped>
|
|
|
.cf-value { padding: 24px; }
|
|
|
-
|
|
|
-/* == C 批内联清理工具类 == */
|
|
|
+.filters { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
|
|
|
.filter-input-200 { width: 200px; }
|
|
|
-</style>
|
|
|
+.filter-input-120 { width: 120px; }
|
|
|
+.pagination-mt { margin-top: 12px; text-align: right; }
|
|
|
+.num-strong { font-weight: 600; color: #303133; }
|
|
|
+.num-plus { color: #67c23a; font-weight: 600; }
|
|
|
+.num-minus { color: #f56c6c; font-weight: 600; }
|
|
|
+.tip-text { font-size: 12px; color: #909399; }
|
|
|
+</style>
|