优化:分销商流水分为钻石流水和分销商流水
This commit is contained in:
parent
241e374f40
commit
01176a4590
|
|
@ -757,8 +757,12 @@ class Fenxiao extends BaseShop
|
|||
|
||||
return (new FenxiaoApply())->upgradeApplyExamine();
|
||||
}
|
||||
|
||||
// 分销商流水
|
||||
/**
|
||||
* Common: 分销商流水
|
||||
* Author: wu-hui
|
||||
* Time: 2023/03/23 11:40
|
||||
* @return array|mixed
|
||||
*/
|
||||
public function accountStatement(){
|
||||
if(request()->isAjax()){
|
||||
// 参数获取
|
||||
|
|
@ -799,15 +803,25 @@ class Fenxiao extends BaseShop
|
|||
if($startTime != '' && $endTime != '') $condition[] = ['a.create_time','between',[strtotime($startTime),strtotime($endTime)]];
|
||||
elseif($startTime != '' && $endTime == '') $condition[] = ['a.create_time','>=',strtotime($startTime)];
|
||||
elseif($startTime == '' && $endTime != '') $condition[] = ['a.create_time','<=',strtotime($endTime)];
|
||||
// 是否获取钻石:获取钻石-仅获取钻石流水,不获取钻石-获取除钻石外所有流水
|
||||
if($fromType == 'diamond') $condition[] = ['a.type',"=",'diamond'];
|
||||
else $condition[] = ['a.type',"<>",'diamond'];
|
||||
|
||||
|
||||
return(new FenxiaoAccount())->getFenxiaoAccountPageList($condition,$page,$pageSize,'a.id desc', $field,'a',$join);
|
||||
}
|
||||
// 获取流水类型
|
||||
$typeList = Db::name('fenxiao_account')
|
||||
->field('type,type_name')
|
||||
->group('type')
|
||||
->select();
|
||||
if($typeList) $typeList = $typeList->toArray();
|
||||
$typeList = [
|
||||
['type' => 'withdraw','type_name' => '提现'],
|
||||
['type' => 'order','type_name' => '订单结算'],
|
||||
['type' => 'points','type_name' => '积分'],
|
||||
];
|
||||
// $typeList = Db::name('fenxiao_account')
|
||||
// ->field('type,type_name')
|
||||
// ->where('type',"<>",'diamond')
|
||||
// ->group('type')
|
||||
// ->select();
|
||||
// if($typeList) $typeList = $typeList->toArray();
|
||||
$this->assign('typeList',$typeList);
|
||||
|
||||
return $this->fetch('fenxiao/account');
|
||||
|
|
|
|||
|
|
@ -217,4 +217,10 @@ class Memberaccount extends BaseShop
|
|||
return $result;
|
||||
}
|
||||
|
||||
// 钻石流水
|
||||
public function diamond(){
|
||||
|
||||
return $this->fetch('account/diamond');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,197 @@
|
|||
{extend name="app/shop/view/base.html"/}
|
||||
{block name="resources"}
|
||||
<style>
|
||||
/* 提示弹出框 */
|
||||
.card-common:first-of-type{margin-top: 0;}
|
||||
.layui-card-body{display: flex;padding-bottom: 0 !important;padding-right: 50px !important;padding-left: 50px !important;flex-wrap: wrap;}
|
||||
.layui-card-body .content{width: 50%;display: flex;flex-direction: column;margin-bottom: 30px;justify-content: center;}
|
||||
.layui-card-body .content .title{color: #909399;font-size: 14px;}
|
||||
.layui-card-body .money{color: #303133;font-size: 26px;margin-top: 10px;max-width: 250px;}
|
||||
.layui-card-body .bottom-title{color: #909399;font-size: 14px;margin-top: 5px;}
|
||||
.layui-laydate-content tr{border: none;}
|
||||
.layui-table-body .layui-none{height: 56px;line-height: 56px;padding: 0;}
|
||||
.table-bottom .layui-table-page {position: inherit;text-align: right}
|
||||
.table-tab .layui-tab-content{margin-bottom: 0;}
|
||||
.screen {margin-top: 15px}
|
||||
.layui-layout-admin.admin-style-2 .screen{margin-bottom: 15px;}
|
||||
.layui-layout-admin.admin-style-2 .layui-form-item .layui-input-inline{background-color: #fff;}
|
||||
</style>
|
||||
{/block}
|
||||
|
||||
{block name="main"}
|
||||
<!-- 搜索栏 -->
|
||||
<div class="screen layui-collapse" lay-filter="selection_panel">
|
||||
<div class="layui-colla-item">
|
||||
<div class="layui-colla-content layui-form layui-show" lay-filter="search_form">
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-inline">
|
||||
<label class="layui-form-label">昵称/账户</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="search_text" placeholder="请输入会员昵称/账户" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-inline">
|
||||
<label class="layui-form-label">会员ID</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="member_id" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-inline">
|
||||
<label class="layui-form-label">发生时间</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" class="layui-input" name="start_time" placeholder="开始时间" id="start_time" readonly>
|
||||
<i class=" iconrili iconfont calendar"></i>
|
||||
</div>
|
||||
<div class="layui-form-mid">-</div>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" class="layui-input" name="end_time" placeholder="结束时间" id="end_time" readonly>
|
||||
<i class=" iconrili iconfont calendar"></i>
|
||||
</div>
|
||||
<button class="layui-btn layui-btn-primary date-picker-btn date-picker-btn-seven" onclick="datePick(7, this);return false;">近7天</button>
|
||||
<button class="layui-btn layui-btn-primary date-picker-btn date-picker-btn-thirty" onclick="datePick(30, this);return false;">近30天</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<button class="layui-btn" lay-submit="" id="search" lay-filter="search">筛选</button>
|
||||
<button type="reset" lay-submit lay-filter="reset" class="layui-btn layui-btn-primary">重置</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!--表格内容-->
|
||||
<table id="account_detail" lay-filter="account_detail"></table>
|
||||
<!--用户信息-->
|
||||
<script type="text/html" id="memberInfo">
|
||||
<div class='table-title'>
|
||||
<div class='title-pic'>
|
||||
<img layer-src src="{{ns.img(d.headimg)}}" onerror="this.src = '{:img('public/static/img/default_img/head.png')}' ">
|
||||
</div>
|
||||
<div class='title-content'>
|
||||
<p class="layui-elip">昵称:{{d.nickname}}</p>
|
||||
<p class="layui-elip">账户:{{d.username}}</p>
|
||||
</div>
|
||||
</div>
|
||||
</script>
|
||||
{/block}
|
||||
|
||||
{block name="script"}
|
||||
<script>
|
||||
var form, layDate,table;
|
||||
$(function () {
|
||||
layui.use(['laydate','form', 'element'], function(){
|
||||
form = layui.form;
|
||||
layDate = layui.laydate;
|
||||
// 内容初始化
|
||||
form.render('select');
|
||||
layDate.render({
|
||||
elem: '#start_time',
|
||||
type: 'datetime',
|
||||
max: 0,
|
||||
change: function(value, date, endDate){
|
||||
$(".date-picker-btn").removeClass("selected");
|
||||
}
|
||||
});
|
||||
layDate.render({
|
||||
elem: '#end_time',
|
||||
type: 'datetime',
|
||||
max: 0,
|
||||
change: function(value, date, endDate){
|
||||
$(".date-picker-btn").removeClass("selected");
|
||||
}
|
||||
});
|
||||
// 渲染表格
|
||||
table = new Table({
|
||||
elem: '#account_detail',
|
||||
url: ns.url("fenxiao://shop/fenxiao/accountStatement"),
|
||||
where: { from_type: 'diamond' },
|
||||
cols: [[
|
||||
{title: 'ID', field: 'member_id', width: '5%', unresize: 'false', align: 'center'},
|
||||
{templet: '#memberInfo', title: '会员信息', width: '20%', unresize: 'false', align: 'left'},
|
||||
{
|
||||
title: '金额变化', width: '10%', unresize: 'false', align: 'center', templet: function (d) {
|
||||
let money = parseFloat(d.money).toFixed(2);
|
||||
if (money > 0) return '+' + money;
|
||||
return money;
|
||||
}
|
||||
},
|
||||
{title: '变更类型', field: 'type_name', width: '10%', unresize: 'false', align: 'center'},
|
||||
{
|
||||
field: 'create_time', title: '变更时间', width: '20%', unresize: 'false', align: 'center', templet: function (data) {
|
||||
return ns.time_to_date(data.create_time);
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
{title: '备注', field: 'remarks', unresize: 'false', align: 'center'},
|
||||
]]
|
||||
});
|
||||
// 点击搜索
|
||||
form.on('submit(search)', function(data) {
|
||||
// 时间判断
|
||||
if ($('#start_time').val() != '' && $('#end_time').val() != '' && (new Date($('#end_time').val()).getTime() <= new Date($('#start_time').val()).getTime() )) {
|
||||
layer.msg('结束时间不能小于开始时间');
|
||||
return false;
|
||||
}
|
||||
data.field.from_type = 'diamond';
|
||||
// 开始搜索
|
||||
table.reload({
|
||||
page: {
|
||||
curr: 1
|
||||
},
|
||||
where: data.field
|
||||
});
|
||||
return false;
|
||||
});
|
||||
// 重置表单
|
||||
form.on('submit(reset)', function(data) {
|
||||
let field = {
|
||||
"search_text": "",
|
||||
"start_time": "",
|
||||
"end_time": "",
|
||||
"member_id": "",
|
||||
};
|
||||
form.val("search_form", field);
|
||||
layui.form.render();
|
||||
// 刷新表格
|
||||
table.reload({
|
||||
page: {
|
||||
curr: 1
|
||||
},
|
||||
where: field
|
||||
});
|
||||
});
|
||||
})
|
||||
});
|
||||
// 指定时间段
|
||||
function datePick(date_num,event_obj){
|
||||
$(".date-picker-btn").removeClass("selected");
|
||||
$(event_obj).addClass('selected');
|
||||
// alert(new Date().format("yyyy-MM-dd hh:mm"));
|
||||
var now_date = new Date();
|
||||
|
||||
Date.prototype.Format = function (fmt,date_num) { //author: meizz
|
||||
this.setDate(this.getDate()-date_num);
|
||||
var o = {
|
||||
"M+": this.getMonth() + 1, //月份
|
||||
"d+": this.getDate(), //日
|
||||
"H+": this.getHours(), //小时
|
||||
"m+": this.getMinutes(), //分
|
||||
"s+": this.getSeconds(), //秒
|
||||
"q+": Math.floor((this.getMonth() + 3) / 3), //季度
|
||||
"S": this.getMilliseconds() //毫秒
|
||||
};
|
||||
if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
|
||||
for (var k in o)
|
||||
if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
|
||||
return fmt;
|
||||
};
|
||||
// var now_time = new Date().Format("yyyy-MM-dd HH:mm:ss",0);//当前日期
|
||||
var now_time = new Date().Format("yyyy-MM-dd 23:59:59",0);//当前日期
|
||||
var before_time = new Date().Format("yyyy-MM-dd 00:00:00",date_num-1);//前几天日期
|
||||
$("input[name=start_time]").val(before_time,0);
|
||||
$("input[name=end_time]").val(now_time,date_num-1);
|
||||
}
|
||||
</script>
|
||||
{/block}
|
||||
|
|
@ -1789,8 +1789,17 @@ return [
|
|||
'picture' => '',
|
||||
'picture_selected' => '',
|
||||
'sort' => 2,
|
||||
'child_list' => [
|
||||
'child_list' => [],
|
||||
],
|
||||
[
|
||||
'name' => 'MEMBER_ACCOUNT_DIAMOND_LIST',
|
||||
'title' => '钻石流水',
|
||||
'url' => 'shop/memberaccount/diamond',
|
||||
'is_show' => 1,
|
||||
'picture' => '',
|
||||
'picture_selected' => '',
|
||||
'sort' => 2,
|
||||
'child_list' => [],
|
||||
]
|
||||
],
|
||||
],
|
||||
|
|
|
|||
Loading…
Reference in New Issue