添加:权重值明细

This commit is contained in:
wuhui_zzw 2023-09-27 14:07:36 +08:00
parent 0fab5fb2b8
commit e5210815ca
4 changed files with 237 additions and 5 deletions

View File

@ -0,0 +1,35 @@
<?php
namespace app\backend\modules\finance\controllers;
use app\common\components\BaseController;
use app\common\helpers\PaginationHelper;
use app\common\models\weightValue\WeightValueLog;
class WeightValueController extends BaseController{
/**
* Common: 进入首页
* Author: wu-hui
* Time: 2023/09/27 13:44
* @return array|string
* @throws \Throwable
*/
public function index(){
//参数获取
$pageSize = request()->input('page_size',10);
$search = request()->input('search');
// 获取列表信息
$field = ['id','member_id','type','change_type','change_quantity','change_front','change_after','remark','created_at'];
$result = WeightValueLog::getList($pageSize,$search,$field);
$data = [
'list' => $result['data'],
'pager' => PaginationHelper::show($result['total'],$result['current_page'],$result['per_page']),
'search' => $search
];
return view('finance.weight.index',$data)->render();
}
}

View File

@ -6142,6 +6142,34 @@ class Menu
]
],
'weight_value_records' => [
'name' => '权重值明细',
'url' => 'finance.weight-value.index',
'url_params' => '',
'permit' => 1,
'menu' => 1,
'icon' => 'fa-file-text-o',
'sort' => 0,
'item' => 'weight_value_records',
'parents' => ['finance'],
'child' => [
'finance_weight_value_see' => [
'name' => '记录',
'url' => 'finance.weight-value.index',
'url_params' => '',
'permit' => 1,
'menu' => 0,
'icon' => '',
'sort' => 0,
'item' => 'finance_weight_value_see',
'parents' => ['finance', 'weight_value_records'],
],
],
],
],

View File

@ -3,11 +3,16 @@ namespace app\common\models\weightValue;
use app\common\models\BaseModel;
use app\common\models\Member;
use function PHPUnit\Framework\isNull;
class WeightValueLog extends BaseModel{
public $timestamps = false;
public $table = 'yz_weight_value_log';
public $casts = [
'created_at' => 'datetime:Y-m-d h:i:s'
];
protected $fillable = [
'uniacid',
'member_id',
@ -22,12 +27,43 @@ class WeightValueLog extends BaseModel{
'remark',
'created_at',
];
/**
* Common: 获取列表
* Author: wu-hui
* Time: 2023/09/27 14:04
* @param $pageSize
* @param $search
* @param string[] $field
* @return array
*/
public function getList($pageSize,$search,$field = ['*']){
// 条件生成
$where = [];
if($search['member_id'] > 0) $where[] = ['member_id','=',$search['member_id']];
// if($search['type'] >= 0 && !is_null($search['type'])) $where[] = ['type','=',$search['type']];
// if($search['change_type'] >= 0 && !is_null($search['type'])) $where[] = ['change_type','=',$search['change_type']];
// 列表获取
$list = self::uniacid()
->select($field)
->where($where)
->with(['member'=>function($query){
$query->select(['uid','nickname','realname','avatar']);
}])
->orderBy('created_at','DESC')
->orderBy('id','DESC')
->paginate($pageSize);
return $list ? $list->toArray() : [];
}
/**
* Common: 一对一关联 用户信息
* Author: wu-hui
* Time: 2023/09/27 13:43
* @return \Illuminate\Database\Eloquent\Relations\HasOne
*/
public function member(){
return $this->hasOne(Member::class, 'uid', 'member_id');
}

View File

@ -0,0 +1,133 @@
@extends('layouts.base')
<style>
.user{
display: inline-flex;
flex-direction: row;
flex-wrap: nowrap;
align-items: center;
justify-content: flex-start;
overflow: hidden;
height: 80px;
}
.user .user-avatar{
height: 50px;
width: 50px;
margin-right: 5px;
border-radius: 50%;
overflow: hidden;
}
.user .user-avatar .avatar-image{
width: 100% !important;
height: 100% !important;
}
.user .user-info{
height: 50px;
text-align: left;
}
.user .user-info .user-nickname{
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.user .user-info .user-status{
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
</style>
@section('content')
<div class="w1200 m0a" id="terminalMerchantsIndex">
{{--顶部搜索--}}
<div class="panel panel-info">
<div class="panel-body">
<form action="" method="post" class="form-horizontal" role="form" id="form1">
<div class="form-group">
<div class="col-sm-11 col-xs-12">
<div class="row row-fix tpl-category-container" >
<div class="col-xs-12 col-sm-8 col-lg-3">
<input class="form-control" name="search[member_id]" type="text" value="{{ $search['member_id'] }}" placeholder="用户ID">
</div>
{{-- <div class="col-xs-12 col-sm-8 col-lg-3">
<select name="search[type]" class="form-control">
<option value="-1">全部权重值类型</option>
<option value="0" @if($search['type'] == '0') selected="selected"@endif>经纪人权重值</option>
</select>
</div>
<div class="col-xs-12 col-sm-8 col-lg-3">
<select name="search[change_type]" class="form-control">
<option value="-1">全部变更类型</option>
<option value="0" @if($search['change_type'] == '0') selected="selected"@endif>减少</option>
<option value="1" @if($search['change_type'] == '1') selected="selected"@endif>增加</option>
</select>
</div>--}}
</div>
</div>
</div>
<div class="form-group">
<div class="col-xs-12 col-sm-6 col-lg-6">
<button class="btn btn-success" id="search"><i class="fa fa-search"></i> 搜索</button>
</div>
</div>
</form>
</div>
</div>
{{--信息列表--}}
<div class="panel panel-default">
<div class="panel-body" style="padding-top: 0;margin-bottom: 30px;overflow: auto;padding-right: 30px;">
<table class="table" style="min-width:1500px;overflow: auto;">
<thead>
<tr>
<th style="text-align:center;width: 80px;">ID</th>
<th style="text-align:left;">用户信息</th>
<th style="text-align:center;">权重值类型</th>
<th style="text-align:center;">变更数量</th>
<th style="text-align:center;">变更后数量</th>
<th style="text-align:center;width: 300px;">备注</th>
<th style="text-align:center;">变更时间</th>
</tr>
</thead>
<tbody>
@foreach ($list as $item)
<tr style="height: 50px;">
<td style="text-align:center;">{{ $item['id'] }}</td>
<td style="text-align:left;" >
<div class="user">
<div class="user-avatar">
<img class="avatar-image" src="{{$item['member']['avatar_image']}}" />
</div>
<div class="user-info">
<div class="user-nickname">昵称:{{ $item['member']['nickname'] }}</div>
<div class="user-status">ID{{ $item['member']['uid'] }}</div>
</div>
</div>
</td>
<td style="text-align:center;">
@if($item['type'] == 0)
经纪人权重值
@else
@endif
</td>
<td style="text-align:center;">
@if($item['change_type'] == 0)
<span class="label label-danger">-{{$item['change_quantity']}}</span>
@else
<span class="label label-success">+{{$item['change_quantity']}}</span>
@endif
</td>
<td style="text-align:center;">
<span class="label label-info">{{$item['change_after']}}</span>
</td>
<td style="text-align:center;">{{$item['remark']}}</td>
<td style="text-align:center;">{{$item['created_at']}}</td>
</tr>
@endforeach
</tbody>
</table>
{!! $pager !!}
</div>
</div>
</div>
<script type="text/javascript"></script>
@endsection