后台用户管理添加充值明细
This commit is contained in:
parent
5a79d38aa0
commit
2ecc7c4309
@ -1,19 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\controller\user;
|
||||
|
||||
use app\admin\logic\user\TagLogic;
|
||||
use app\common\basics\AdminBase;
|
||||
use app\admin\logic\user\LevelLogic;
|
||||
use app\admin\logic\user\TagLogic;
|
||||
use app\admin\logic\user\UserLogic;
|
||||
use app\admin\validate\user\UserValidate;
|
||||
use app\common\basics\AdminBase;
|
||||
use app\common\enum\ClientEnum;
|
||||
use app\common\model\user\UserLevel;
|
||||
use app\common\server\JsonServer;
|
||||
use app\common\enum\ClientEnum;
|
||||
use app\admin\validate\user\UserValidate;
|
||||
use think\exception\ValidateException;
|
||||
|
||||
class User extends AdminBase
|
||||
class User extends AdminBase
|
||||
{
|
||||
public function lists(){
|
||||
public function lists()
|
||||
{
|
||||
if ($this->request->isAjax()) {
|
||||
$get = $this->request->get();
|
||||
return JsonServer::success('', UserLogic::lists($get));
|
||||
@ -26,16 +28,17 @@ class User extends AdminBase
|
||||
]);
|
||||
}
|
||||
|
||||
public function setTag(){
|
||||
if($this->request->isAjax()){
|
||||
public function setTag()
|
||||
{
|
||||
if ($this->request->isAjax()) {
|
||||
$post = $this->request->post();
|
||||
try{
|
||||
try {
|
||||
validate(UserValidate::class)->scene('setTag')->check($post);
|
||||
}catch(ValidateException $e) {
|
||||
} catch (ValidateException $e) {
|
||||
return JsonServer::error($e->getMessage());
|
||||
}
|
||||
$result = UserLogic::setTag($post);
|
||||
if($result === true) {
|
||||
if ($result === true) {
|
||||
return JsonServer::success('设置成功');
|
||||
}
|
||||
return JsonServer::error(UserLogic::getError());
|
||||
@ -45,16 +48,17 @@ class User extends AdminBase
|
||||
]);
|
||||
}
|
||||
|
||||
public function edit(){
|
||||
if($this->request->isAjax()){
|
||||
public function edit()
|
||||
{
|
||||
if ($this->request->isAjax()) {
|
||||
$post = $this->request->post();
|
||||
try{
|
||||
try {
|
||||
validate(UserValidate::class)->scene('edit')->check($post);
|
||||
}catch(ValidateException $e) {
|
||||
} catch (ValidateException $e) {
|
||||
return JsonServer::error($e->getMessage());
|
||||
}
|
||||
$result = UserLogic::edit($post);
|
||||
if($result === true) {
|
||||
if ($result === true) {
|
||||
return JsonServer::success('编辑成功');
|
||||
}
|
||||
return JsonServer::error(UserLogic::getError());
|
||||
@ -69,7 +73,8 @@ class User extends AdminBase
|
||||
]);
|
||||
}
|
||||
|
||||
public function info(){
|
||||
public function info()
|
||||
{
|
||||
$id = $this->request->get('id', '', 'intval');
|
||||
$detail = UserLogic::getInfo($id);
|
||||
return view('', [
|
||||
@ -77,17 +82,18 @@ class User extends AdminBase
|
||||
]);
|
||||
}
|
||||
|
||||
public function adjustAccount(){
|
||||
public function adjustAccount()
|
||||
{
|
||||
if ($this->request->isAjax()) {
|
||||
$post = $this->request->post();
|
||||
try{
|
||||
try {
|
||||
validate(UserValidate::class)->scene('adjustAccount')->check($post);
|
||||
}catch(ValidateException $e) {
|
||||
} catch (ValidateException $e) {
|
||||
return JsonServer::error($e->getError());
|
||||
}
|
||||
|
||||
$result = UserLogic::adjustAccount($post);
|
||||
if($result === true) {
|
||||
if ($result === true) {
|
||||
return JsonServer::success('调整成功');
|
||||
}
|
||||
return JsonServer::error(UserLogic::getError());
|
||||
@ -99,7 +105,8 @@ class User extends AdminBase
|
||||
]);
|
||||
}
|
||||
|
||||
public function adjustLevel(){
|
||||
public function adjustLevel()
|
||||
{
|
||||
if ($this->request->isPost()) {
|
||||
$params = $this->request->post();
|
||||
$result = UserLogic::adjustLevel($params);
|
||||
@ -122,7 +129,7 @@ class User extends AdminBase
|
||||
|
||||
public function adjustFirstLeader()
|
||||
{
|
||||
if($this->request->isPost()) {
|
||||
if ($this->request->isPost()) {
|
||||
$params = $this->request->post();
|
||||
$result = UserLogic::adjustFirstLeader($params);
|
||||
if ($result) {
|
||||
@ -132,7 +139,7 @@ class User extends AdminBase
|
||||
}
|
||||
|
||||
$id = $this->request->get('id/d');
|
||||
$user = \app\common\model\user\User::field('id,sn,nickname,first_leader')->findOrEmpty($id)->toArray();
|
||||
$user = \app\common\model\user\User::field('id,sn,nickname,first_leader')->findOrEmpty($id)->toArray();
|
||||
$firstLeader = \app\common\model\user\User::getUserInfo($user['first_leader']);
|
||||
return view('', [
|
||||
'user_id' => $id,
|
||||
@ -168,4 +175,21 @@ class User extends AdminBase
|
||||
$id = $this->request->get('id/d');
|
||||
return view('', ['id' => $id]);
|
||||
}
|
||||
|
||||
public function costDetails()
|
||||
{
|
||||
if ($this->request->isAjax()) {
|
||||
$get = $this->request->get();
|
||||
if ($get['type'] == 1) {
|
||||
$data = UserLogic::getUserRecharge($get);
|
||||
return JsonServer::success('', $data);
|
||||
}
|
||||
}
|
||||
|
||||
$id = $this->request->get('id/d');
|
||||
$detail = UserLogic::getUser($id);
|
||||
return view('', [
|
||||
'info' => $detail,
|
||||
]);
|
||||
}
|
||||
}
|
||||
@ -6,9 +6,11 @@ use app\api\cache\TokenCache;
|
||||
use app\common\basics\Logic;
|
||||
use app\common\enum\ClientEnum;
|
||||
use app\common\enum\OrderEnum;
|
||||
use app\common\enum\PayEnum;
|
||||
use app\common\logic\AccountLogLogic;
|
||||
use app\common\model\distribution\DistributionOrderGoods;
|
||||
use app\common\model\AccountLog;
|
||||
use app\common\model\RechargeOrder;
|
||||
use app\common\model\Session;
|
||||
use app\common\model\user\User;
|
||||
use app\common\model\user\UserLevel;
|
||||
@ -590,4 +592,43 @@ class UserLogic extends Logic
|
||||
'lists' => $lists,
|
||||
];
|
||||
}
|
||||
|
||||
public static function getUserRecharge($get)
|
||||
{
|
||||
$model = new RechargeOrder();
|
||||
|
||||
$filter_where = [];
|
||||
if (!empty($get['start_time']) && !empty($get['end_time'])) {
|
||||
$start_time = strtotime($get['start_time']);
|
||||
$end_time = strtotime($get['end_time']);
|
||||
$filter_where[] = ['pay_time', 'between', [$start_time, $end_time]];
|
||||
}
|
||||
|
||||
$user = User::where('id', $get['id'])->field('user_money')->find();
|
||||
|
||||
$where = [
|
||||
'user_id' => $get['id'],
|
||||
'pay_status' => PayEnum::ISPAID, // 已支付的
|
||||
];
|
||||
|
||||
$lists = $model::field('id, order_sn, pay_way, pay_time, order_amount')
|
||||
->where($filter_where)
|
||||
->where($where)
|
||||
->page($get['page'], $get['limit'])
|
||||
->order('pay_time desc')
|
||||
->select()
|
||||
->toArray();
|
||||
|
||||
foreach ($lists as &$v) {
|
||||
$v['pay_time'] = date('Y-m-d H:i:s', $v['pay_time']);
|
||||
}
|
||||
|
||||
$count = $model::where($filter_where)->where($where)->count();
|
||||
|
||||
return [
|
||||
'count' => $count,
|
||||
'lists' => $lists,
|
||||
'user_money' => $user['user_money']
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
268
app/admin/view/user/user/cost_details.html
Executable file
268
app/admin/view/user/user/cost_details.html
Executable file
@ -0,0 +1,268 @@
|
||||
{layout name="layout2" /}
|
||||
<style>
|
||||
.layui-form-label {
|
||||
width: 90px;
|
||||
}
|
||||
|
||||
.reqRed::before {
|
||||
content: '*';
|
||||
color: red;
|
||||
margin-right: 5px;
|
||||
}
|
||||
</style>
|
||||
<div class="layui-form" lay-filter="adjust" id="layuiadmin-form-user" style="padding: 20px 30px 0 0;">
|
||||
<input type="hidden" value="{$info.id}" name="id">
|
||||
<div class="layui-fluid">
|
||||
<div class="layui-card">
|
||||
<div class="layui-tab layui-tab-card" lay-filter="adjust">
|
||||
<ul class="layui-tab-title">
|
||||
<li data-type="1" class="layui-this">充值</li>
|
||||
<li data-type="2">佣金</li>
|
||||
<li data-type="3">返补</li>
|
||||
</ul>
|
||||
<div class="layui-tab-content">
|
||||
<!--不可提现金额调整-->
|
||||
<div class="layui-tab-item layui-show">
|
||||
<div class="layui-form-item">
|
||||
<label for="recharge_type" class="layui-form-label">分类:</label>
|
||||
<div class="layui-input-inline">
|
||||
<select name="recharge_type" id="recharge_type" lay-filter="recharge_type">
|
||||
<option value="0">增加余额</option>
|
||||
<option value="1">购买商品减少余额</option>
|
||||
<option value="2">本地生活买单</option>
|
||||
<option value="3">本地生活购买商品</option>
|
||||
<option value="4">返补充值</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">支付时间:</label>
|
||||
<div class="layui-input-inline">
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="start_time" class="layui-input" id="start_time"
|
||||
placeholder="" autocomplete="off">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-input-inline" style="margin-right: 5px;width: 20px;">
|
||||
<label class="layui-form-mid">至</label>
|
||||
</div>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="end_time" class="layui-input" id="end_time"
|
||||
placeholder="" autocomplete="off">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">操作:</label>
|
||||
|
||||
<button class="layui-btn layui-btn-sm layuiadmin-btn-ad {$view_theme_color}" lay-submit
|
||||
lay-filter="recharge-search">查询
|
||||
</button>
|
||||
<button class="layui-btn layui-btn-sm layuiadmin-btn-ad layui-btn-primary " lay-submit
|
||||
lay-filter="recharge-clear-search">清空查询
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<table id="user-recharge" lay-filter="user-recharge"></table>
|
||||
|
||||
<script type="text/html" id="recharge_order_amount">
|
||||
¥ {{d.order_amount}}
|
||||
</script>
|
||||
</div>
|
||||
<!--成长值调整-->
|
||||
<div class="layui-tab-item">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">当前成长值:</label>
|
||||
<div class="layui-input-inline">
|
||||
<label class="layui-form-mid">{$info.user_growth}</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label reqRed">成长值增减:</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="radio" name="growth_handle" value="1" title="增加成长值">
|
||||
<input type="radio" name="growth_handle" value="0" title="扣减成长值">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label reqRed">调整成长值:</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="number" min="0" name="growth" value="" lay-verify="" lay-vertype="tips"
|
||||
placeholder="" autocomplete="off" class="layui-input">
|
||||
<label class="layui-form-mid layui-word-aux">请输入调整的成长值</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label reqRed">备注:</label>
|
||||
<div class="layui-input-block">
|
||||
<textarea type="text" name="growth_remark" autocomplete="off" class="layui-textarea"
|
||||
style="width: 30%;"></textarea>
|
||||
<label class="layui-form-mid layui-word-aux"
|
||||
style="margin-left: 10px;">不超过100字</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!--积分调整-->
|
||||
<div class="layui-tab-item">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">当前积分:</label>
|
||||
<div class="layui-input-inline">
|
||||
<label class="layui-form-mid">{$info.user_integral}</label>
|
||||
<input type="hidden" value="{$info.user_integral}" name="now_integral">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">积分增减:</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="radio" name="integral_handle" value="1" title="增加积分">
|
||||
<input type="radio" name="integral_handle" value="0" title="扣减积分">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">调整积分:</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="integral" value="" lay-verify="" lay-vertype="tips"
|
||||
placeholder="" autocomplete="off" class="layui-input">
|
||||
<label class="layui-form-mid layui-word-aux">请输入调整的积分数量</label>
|
||||
</div>
|
||||
<label class="layui-form-mid">分</label>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">备注:</label>
|
||||
<div class="layui-input-block">
|
||||
<textarea type="text" name="integral_remark" autocomplete="off"
|
||||
class="layui-textarea" style="width: 30%;"></textarea>
|
||||
<label class="layui-form-mid layui-word-aux"
|
||||
style="margin-left: 10px;">不超过100字</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item layui-hide">
|
||||
<input type="button" lay-submit lay-filter="adjust_user-submit" id="adjust_user-submit" value="确认">
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
layui.config({
|
||||
version: "{$front_version}",
|
||||
base: '/static/lib/' //静态资源所在路径
|
||||
}).use(['form', 'element'], function () {
|
||||
var $ = layui.$
|
||||
, form = layui.form
|
||||
, table = layui.table
|
||||
, element = layui.element
|
||||
, laydate = layui.laydate;
|
||||
|
||||
var id = '{$info.id}';
|
||||
|
||||
element.on('tab(adjust)', function () {
|
||||
$('#type').val($(this).attr('data-type'));
|
||||
});
|
||||
|
||||
//日期时间范围
|
||||
laydate.render({
|
||||
elem: '#start_time'
|
||||
, type: 'datetime'
|
||||
, trigger: 'click'
|
||||
, done: function (value, date, endDate) {
|
||||
var startDate = new Date(value).getTime();
|
||||
var endTime = new Date($('#end_time').val()).getTime();
|
||||
if (endTime < startDate) {
|
||||
layer.msg('结束时间不能小于开始时间');
|
||||
$('#start_time').val($('#end_time').val());
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
laydate.render({
|
||||
elem: '#end_time'
|
||||
, type: 'datetime'
|
||||
, trigger: 'click'
|
||||
, done: function (value, date, endDate) {
|
||||
var startDate = new Date($('#start_time').val()).getTime();
|
||||
var endTime = new Date(value).getTime();
|
||||
console.log(startDate);
|
||||
if (endTime < startDate) {
|
||||
layer.msg('结束时间不能小于开始时间');
|
||||
$('#end_time').val($('#start_time').val());
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
//获取列表
|
||||
getList(1); // 初始话充值列表
|
||||
//切换列表
|
||||
element.on('tab(like-tabs)', function (data) {
|
||||
var type = $(this).attr('data-type');
|
||||
// // 重置搜索模块
|
||||
// $('#shop_name').val('');
|
||||
// $('#goods_name').val('');
|
||||
// $('#platform_cate_id').val('');
|
||||
// $('#shop_cate_id').val('');
|
||||
// $('#goods_column_id').val('');
|
||||
// form.render('select');
|
||||
|
||||
// if (type == 4) {
|
||||
// $("#more_audit").show();
|
||||
// }else {
|
||||
// $("#more_audit").hide();
|
||||
// }
|
||||
// if (type == 1 || type == 2 || type == 3) {
|
||||
// $("#more_lower").show();
|
||||
// }else {
|
||||
// $("#more_lower").hide();
|
||||
// }
|
||||
// 重新获取商品列表
|
||||
getList(type);
|
||||
});
|
||||
|
||||
function getList(type) {
|
||||
if (type == 1) {
|
||||
like.tableLists('#user-recharge', '{:url("user.user/costDetails")}?id=' + id + '&type=' + type + '&sel_type=' + $('#recharge_type').val(), [
|
||||
{field: 'id', title: 'id', width: 60, align: 'center'}
|
||||
, {field: 'order_sn', title: '订单号', width: 200}
|
||||
, {field: 'pay_way', title: '支付方式', width: 200}
|
||||
, {field: 'pay_time', title: '支付时间', width: 200}
|
||||
, {field: 'order_amount', title: '支付金额', templet: '#recharge_order_amount', width: 200}
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
// 充值记录筛选
|
||||
form.on('select(recharge_type)', function (data) {
|
||||
getList(1)
|
||||
});
|
||||
|
||||
// 充值监听搜索
|
||||
form.on('submit(recharge-search)', function (data) {
|
||||
var field = data.field;
|
||||
// 执行重载
|
||||
table.reload('user-recharge', {
|
||||
where: field,
|
||||
page: {
|
||||
curr: 1
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// 清空充值搜索条件
|
||||
form.on('submit(recharge-clear-search)', function () {
|
||||
$('#start_time').val('');
|
||||
$('#end_time').val('');
|
||||
|
||||
// 执行重载
|
||||
table.reload('user-recharge', {
|
||||
where: [],
|
||||
page: {
|
||||
curr: 1
|
||||
}
|
||||
});
|
||||
});
|
||||
})
|
||||
</script>
|
||||
@ -178,10 +178,10 @@
|
||||
<script type="text/html" id="user-operation">
|
||||
<a class="layui-btn layui-btn-primary layui-btn-sm" lay-event="info">资料</a>
|
||||
<a class="layui-btn layui-btn-normal layui-btn-sm" lay-event="edit">编辑</a>
|
||||
<a class="layui-btn layui-btn-normal layui-btn-sm" id="adjust_user" lay-event="adjust_user">账户调整</a>
|
||||
<a class="layui-btn layui-btn-normal layui-btn-sm" id="adjust_level" lay-event="adjust_level">等级调整</a>
|
||||
<a class="layui-btn layui-btn-normal layui-btn-sm" id="adjust_first_leader" lay-event="adjust_first_leader">推荐人调整</a>
|
||||
|
||||
<a class="layui-btn layui-btn-normal layui-btn-sm" id="adjust_user" lay-event="adjust_user">账户调整</a>
|
||||
<a class="layui-btn layui-btn-normal layui-btn-sm" id="adjust_level" lay-event="adjust_level">等级调整</a>
|
||||
<a class="layui-btn layui-btn-normal layui-btn-sm" id="adjust_first_leader" lay-event="adjust_first_leader">推荐人调整</a>
|
||||
<a class="layui-btn layui-btn-normal layui-btn-sm" id="cost_details" lay-event="cost_details">支出明细</a>
|
||||
</script>
|
||||
</div>
|
||||
</div>
|
||||
@ -395,7 +395,7 @@
|
||||
,{title: '上级推荐人',width: 90,align: 'center',width: 350, templet: '#first-info'}
|
||||
,{field: 'fans', title: '推荐下级人数',width: 120,align: 'center'}
|
||||
,{title: '注册信息',width: 300,align: 'center', templet: '#register-info'}
|
||||
,{fixed: 'right', title: '操作', width: 420,toolbar: '#user-operation',align: 'center'}
|
||||
,{fixed: 'right', title: '操作', width: 500,toolbar: '#user-operation',align: 'center'}
|
||||
]]
|
||||
,page:true
|
||||
,text: {none: '暂无数据!'}
|
||||
@ -613,6 +613,49 @@
|
||||
}
|
||||
})
|
||||
}
|
||||
if(obj.event === 'cost_details') {
|
||||
var id = obj.data.id;
|
||||
layer.open({
|
||||
type: 2
|
||||
,title: '账户调整'
|
||||
,content: '{:url("user.user/costDetails")}?id='+id
|
||||
,area: ['90%', '90%']
|
||||
,btn: ['确定', '取消']
|
||||
,yes: function(index, layero){
|
||||
var iframeWindow = window['layui-layer-iframe'+ index]
|
||||
,submit = layero.find('iframe').contents().find('#adjust_user-submit');
|
||||
//监听提交
|
||||
iframeWindow.layui.form.on('submit(adjust_user-submit)', function(data){
|
||||
var field = data.field;
|
||||
$.ajax({
|
||||
url:'{:url("user.user/costDetails")}',
|
||||
data:field,
|
||||
type:"post",
|
||||
success:function(res)
|
||||
{
|
||||
if(res.code == 1)
|
||||
{
|
||||
layui.layer.msg(res.msg, {
|
||||
offset: '15px'
|
||||
, icon: 1
|
||||
, time: 1000
|
||||
});
|
||||
layer.close(index); //关闭弹层
|
||||
table.reload('user-lists'); //数据刷新
|
||||
}else{
|
||||
layer.msg(res.msg, {
|
||||
offset: '15px'
|
||||
, icon: 2
|
||||
, time: 1000
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
submit.trigger('click');
|
||||
}
|
||||
})
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user