优化:文创豆变更记录优化

添加:用户持有文创豆信息
This commit is contained in:
wuhui_zzw 2023-11-24 11:03:23 +08:00
parent 047b8b3bd2
commit c6a58e1f9e
2 changed files with 72 additions and 8 deletions

View File

@ -47,13 +47,17 @@ class CulturalSpace extends BaseModel
]);
// 信息获取
$totalContribution = $model->sum('contribution');
$list = $model->select(['id', 'uid', 'contribution'])
$totalVoucherNumber = $model->sum('voucher_number');
$list = $model->select(['id', 'uid', 'contribution','voucher_number'])
->orderBy('id', 'DESC')
->paginate(10)
->toArray();
foreach ($list['data'] as &$item) {
$item['total_proportion'] = (float)sprintf("%.2f", $totalContribution);
$item['ratio'] = (float)sprintf("%.2f", $item['contribution'] / $totalContribution * 100);
$item['total_voucher_number'] = (float)sprintf("%.6f", $totalVoucherNumber);
$item['voucher_number_ratio'] = (float)sprintf("%.6f", $item['voucher_number'] / $totalVoucherNumber * 100);
}
return $list;

View File

@ -72,6 +72,51 @@
<el-col :span="4"><div class="grid-content bg-purple-light">历史文创豆:[[fundData.history_number || 0]]</div></el-col>
</el-row>
</el-tab-pane>
<el-tab-pane label="用户持有统计" name="show_user">
{{--搜索--}}
<el-form :inline="true" :model="search_list">
<el-form-item label="会员ID">
<el-input v-model="search_list.uid" placeholder="请输入会员ID"></el-input>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="clickSearch">查询</el-button>
</el-form-item>
</el-form>
{{--表单--}}
<el-table :data="list" style="width: 100%" v-if="tabs_active == 'show_user'">
<el-table-column align="center" prop="id" label="ID" width="100"></el-table-column>
<el-table-column align="center" prop="member" label="用户信息" width="300">
<template slot-scope="scope">
<div class="user">
<div class="user-avatar">
<img class="avatar-image" :src="scope.row.member.avatar_image || ''" />
</div>
<div class="user-info">
<div class="user-nickname">昵称:[[scope.row.member.nickname || '']]</div>
<div class="user-status">ID[[scope.row.member.uid || '']]</div>
</div>
</div>
</template>
</el-table-column>
<el-table-column align="center" prop="change_front">
<template slot="header" slot-scope="scope">
<span class="label label-default">平台总数</span>
<span class="label label-info">用户持有</span>
<span class="label label-warning">占比(%)</span>
</template>
<template slot-scope="scope">
<span class="label label-default">[[scope.row.total_voucher_number || '0.00' ]]</span>
<span class="label label-info">[[scope.row.voucher_number || '0.00' ]]</span>
<span class="label label-warning">[[scope.row.voucher_number_ratio ? scope.row.voucher_number_ratio + '%' : '0%' ]]</span>
</template>
</el-table-column>
<el-table-column align="center" prop="created_at" label="操作">
<template slot-scope="scope">
<el-button type="primary" @click="seeChangeRecord(scope.row.uid)">变更明细</el-button>
</template>
</el-table-column>
</el-table>
</el-tab-pane>
<el-tab-pane label="明细" name="show_group">
{{--搜索--}}
<el-form :inline="true" :model="search_list">
@ -98,10 +143,16 @@
</div>
</template>
</el-table-column>
<el-table-column align="center" prop="pay_money" label="订单金额"></el-table-column>
<el-table-column align="center" prop="fund_money" label="入账基金"></el-table-column>
<el-table-column align="center" prop="voucher_number" label="用户文创豆"> </el-table-column>
<el-table-column align="center" prop="created_at" label="创建时间"> </el-table-column>
<el-table-column align="center" prop="change_type" label="变更类型" width="100">
<template slot-scope="scope">
<el-tag :type="scope.row.change_type == 1 ? 'danger' : 'success'" disable-transitions>
[[scope.row.change_type == 1 ? '减少' : '增加']]
</el-tag>
</template>
</el-table-column>
<el-table-column align="center" prop="voucher_number" label="变更数量"></el-table-column>
<el-table-column align="center" prop="created_at" label="变更时间"> </el-table-column>
<el-table-column align="center" prop="good_name" label="备注"></el-table-column>
</el-table>
</el-tab-pane>
</el-tabs>
@ -148,18 +199,20 @@
let loading = _this.showLoading();
let link = "{!! yzWebUrl('plugin.cultural-space.admin.fund.getfund') !!}";
if(_this.tabs_active === 'show_group') link = "{!! yzWebUrl('plugin.cultural-space.admin.fund.getfundRecord') !!}";
if(_this.tabs_active === 'show_user') link = "{!! yzWebUrl('plugin.cultural-space.admin.contribution.index') !!}";
$.ajax({
url: link,
type: "post",
data: {
page: _this.page,
search: _this.search_list,
is_get: 1
is_get: 1,
tabs_active: 'show_group',
},
success: function(result) {
loading.close(0);
let data = result.data;
if(_this.tabs_active != 'show_group'){
if(_this.tabs_active == 'show_detail'){
_this.fundData= data;
return;
}
@ -201,7 +254,14 @@
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)'
});
}
},
// 用户持有统计中查看某个用户的变更记录
seeChangeRecord(uid){
this.search_list.member_id = uid;
this.page = 1;
this.tabs_active = 'show_group';
this.getData()
},
},
})
</script>