初始上传
This commit is contained in:
218
app/shop/view/account/balance.html
Executable file
218
app/shop/view/account/balance.html
Executable file
@@ -0,0 +1,218 @@
|
||||
<style>
|
||||
/* 提示弹出框 */
|
||||
.layui-card-body .content{width: 50%;}
|
||||
.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}
|
||||
.table-title {cursor: pointer}
|
||||
.layui-layout-admin .screen{margin-bottom: 15px;}
|
||||
.layui-layout-admin .layui-form-item .layui-input-inline{background-color: #fff;}
|
||||
</style>
|
||||
|
||||
<div class="layui-card card-common card-brief panel-content">
|
||||
<div class="layui-card-header simple">
|
||||
<span class="card-title">余额概况</span>
|
||||
</div>
|
||||
<div class="layui-card-body">
|
||||
<div class="content">
|
||||
<p class="title">总余额</p>
|
||||
<p class="money">{$total_balance + $total_balance_money}</p>
|
||||
<p class="bottom-title">
|
||||
<span>现金余额:{$total_balance_money}</span>
|
||||
<span>储值余额:{$total_balance}</span>
|
||||
</p>
|
||||
</div>
|
||||
<div class="content">
|
||||
<p class="title">累计消费余额</p>
|
||||
<p class="money">{$total_consume_money}</p>
|
||||
<p class="bottom-title">
|
||||
<span> </span>
|
||||
<span> </span>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="screen layui-collapse" lay-filter="selection_panel">
|
||||
<div class="layui-colla-item">
|
||||
<form class="layui-colla-content layui-form layui-show">
|
||||
<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">发生方式</label>
|
||||
<div class="layui-input-inline">
|
||||
<select name="from_type">
|
||||
<option value="">全部</option>
|
||||
{foreach $from_type as $k => $val}
|
||||
<option value="{$k}">{$val.type_name}</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
</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>
|
||||
</div>
|
||||
</form>
|
||||
</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' onclick="location.hash = ns.hash('shop/member/editmember?member_id={{d.member_id}}')">
|
||||
<p class="layui-elip">{{d.nickname}}</p>
|
||||
<p class="layui-elip">{{d.mobile}}</p>
|
||||
</div>
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<script>
|
||||
var form, laydate;
|
||||
layui.use(['laydate','form', 'element'], function(){
|
||||
form = layui.form;
|
||||
laydate = layui.laydate;
|
||||
|
||||
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.account_type = 'balance,balance_money';
|
||||
table.reload({
|
||||
page: {
|
||||
curr: 1
|
||||
},
|
||||
where: data.field
|
||||
});
|
||||
return false;
|
||||
});
|
||||
|
||||
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("shop/memberaccount/accountdetail"),
|
||||
where: {
|
||||
account_type: 'balance,balance_money'
|
||||
},
|
||||
cols: [
|
||||
[{
|
||||
templet: '#memberInfo',
|
||||
title: '会员信息',
|
||||
width: '20%',
|
||||
unresize: 'false'
|
||||
}, {
|
||||
title: '金额变化',
|
||||
width: '10%',
|
||||
unresize: 'false',
|
||||
align: 'right',
|
||||
templet: function (d) {
|
||||
if (d.account_data > 0) return '+' + parseFloat(d.account_data).toFixed(2);
|
||||
return parseFloat(d.account_data).toFixed(2);
|
||||
}
|
||||
}, {
|
||||
title: '账户类型',
|
||||
width: '10%',
|
||||
unresize: 'false',
|
||||
templet: function (data) {
|
||||
return data.account_type == 'balance' ? '储值余额' : '现金余额';
|
||||
}
|
||||
}, {
|
||||
field: 'type_name',
|
||||
title: '发生方式',
|
||||
width: '15%',
|
||||
unresize: 'false'
|
||||
}, {
|
||||
field: 'create_time',
|
||||
title: '发生时间',
|
||||
width: '20%',
|
||||
unresize: 'false',
|
||||
templet: function(data) {
|
||||
return ns.time_to_date(data.create_time);
|
||||
}
|
||||
}, {
|
||||
field: 'remark',
|
||||
title: '备注',
|
||||
width: '25%',
|
||||
unresize: 'false'
|
||||
}]
|
||||
]
|
||||
});
|
||||
})
|
||||
|
||||
/**
|
||||
* 七天时间
|
||||
*/
|
||||
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>
|
||||
348
app/shop/view/account/coupon.html
Executable file
348
app/shop/view/account/coupon.html
Executable file
@@ -0,0 +1,348 @@
|
||||
<style>
|
||||
.layui-card-body .content{width: 33.3%;}
|
||||
.layui-card-body .bottom-title{color: #909399;font-size: 14px;margin-top: 5px;}
|
||||
.table-bottom .layui-table-page {position: inherit;text-align: right}
|
||||
.table-tab .layui-tab-content{margin-bottom: 0;}
|
||||
.screen {margin-top: 15px}
|
||||
.table-title {cursor: pointer}
|
||||
.layui-layout-admin .layui-form-item .layui-input-inline{background-color: #fff;}
|
||||
</style>
|
||||
|
||||
<div class="layui-card card-common card-brief panel-content">
|
||||
<div class="layui-card-header simple">
|
||||
<span class="card-title">优惠券概况</span>
|
||||
</div>
|
||||
<div class="layui-card-body">
|
||||
<div class="content">
|
||||
<p class="title">累计发放</p>
|
||||
<p class="money">{$total_count}</p>
|
||||
</div>
|
||||
<div class="content">
|
||||
<p class="title">已使用</p>
|
||||
<p class="money">{$used_count}</p>
|
||||
</div>
|
||||
<div class="content">
|
||||
<p class="title">待使用</p>
|
||||
<p class="money">{$not_used_count}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="screen layui-collapse" lay-filter="selection_panel">
|
||||
<div class="layui-colla-item">
|
||||
<form class="layui-colla-content layui-form layui-show">
|
||||
<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">获取方式:</label>
|
||||
<div class="layui-input-inline">
|
||||
<select name="get_type">
|
||||
<option value="">全部</option>
|
||||
{foreach $get_type as $k => $val}
|
||||
<option value="{$k}">{$val}</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
</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>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-tab table-tab" lay-filter="coupon_tab">
|
||||
<ul class="layui-tab-title">
|
||||
<li class="layui-this" lay-id="">全部</li>
|
||||
<li lay-id="1">已领取</li>
|
||||
<li lay-id="2">已使用</li>
|
||||
<li lay-id="3">已过期</li>
|
||||
</ul>
|
||||
<div class="layui-tab-content">
|
||||
<!-- 列表 -->
|
||||
<table id="coupon" lay-filter="coupon"></table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<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' onclick="location.hash = ns.hash('shop/member/editmember?member_id={{d.member_id}}')">
|
||||
<p class="layui-elip">{{d.nickname}}</p>
|
||||
<p class="layui-elip">{{d.mobile}}</p>
|
||||
</div>
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<script type="text/html" id="operation">
|
||||
<div class="table-btn" align="right">
|
||||
{{# if(d.state == 1){ }}
|
||||
<a class="layui-btn" lay-event="recovery">回收</a>
|
||||
{{# } }}
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<script type="text/html" id="toolbarOperation">
|
||||
<button class="layui-btn layui-btn-primary" lay-event="recovery">批量回收</button>
|
||||
</script>
|
||||
|
||||
<script type="text/html" id="batchOperation">
|
||||
<button class="layui-btn layui-btn-primary" lay-event="recovery">批量回收</button>
|
||||
</script>
|
||||
|
||||
<script>
|
||||
var form, laydate, element, getType = {:json_encode($get_type)};
|
||||
layui.use(['laydate','form', 'element'], function(){
|
||||
form = layui.form;
|
||||
laydate = layui.laydate;
|
||||
element = layui.element;
|
||||
|
||||
element.on('tab(coupon_tab)', function(){
|
||||
table.reload({
|
||||
page: {curr: 1},
|
||||
where: {'state': this.getAttribute('lay-id')},
|
||||
})
|
||||
});
|
||||
|
||||
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.state = this.getAttribute('lay-id');
|
||||
|
||||
table.reload({
|
||||
page: {
|
||||
curr: 1
|
||||
},
|
||||
where: data.field
|
||||
});
|
||||
return false;
|
||||
});
|
||||
|
||||
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: '#coupon',
|
||||
url: ns.url("shop/memberaccount/coupon"),
|
||||
cols: [
|
||||
[{
|
||||
type: 'checkbox',
|
||||
width: '3%',
|
||||
unresize: 'false'
|
||||
},{
|
||||
templet: '#memberInfo',
|
||||
title: '会员信息',
|
||||
width: '20%',
|
||||
unresize: 'false'
|
||||
}, {
|
||||
field: 'coupon_name',
|
||||
title: '优惠券',
|
||||
width: '10%',
|
||||
unresize: 'false',
|
||||
templet: function(data) {
|
||||
return `<a href="`+ ns.href('coupon://shop/coupon/detail', {coupon_type_id: data.coupon_type_id }) +`" target="_blank" class="text-color">`+ data.coupon_name +`</a>`;
|
||||
}
|
||||
}, {
|
||||
title: '类型',
|
||||
width: '10%',
|
||||
unresize: 'false',
|
||||
templet: function (data) {
|
||||
return data.type == 'reward' ? '满减券' : '折扣券';
|
||||
}
|
||||
}, {
|
||||
title: '获取方式',
|
||||
width: '10%',
|
||||
unresize: 'false',
|
||||
templet: function(data) {
|
||||
return getType[data.get_type] ? getType[data.get_type] : '';
|
||||
}
|
||||
}, {
|
||||
title: '状态',
|
||||
width: '12%',
|
||||
unresize: 'false',
|
||||
templet: function (data) {
|
||||
var str = '';
|
||||
switch (data.state) {
|
||||
case 1:
|
||||
str = '已领取';
|
||||
break;
|
||||
case 2:
|
||||
str = '已使用';
|
||||
break;
|
||||
case 3:
|
||||
str = '已过期';
|
||||
break;
|
||||
}
|
||||
return str;
|
||||
}
|
||||
}, {
|
||||
title: '领取时间',
|
||||
width: '15%',
|
||||
unresize: 'false',
|
||||
templet: function(data) {
|
||||
return ns.time_to_date(data.fetch_time);
|
||||
}
|
||||
}, {
|
||||
title: '使用时间',
|
||||
width: '15%',
|
||||
templet: function(data) {
|
||||
return data.use_time ? ns.time_to_date(data.use_time) : '';
|
||||
}
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
width: '5%',
|
||||
templet: '#operation'
|
||||
}
|
||||
]
|
||||
],
|
||||
parseData: function(data){
|
||||
data.data.list = data.data.list.map(function (item) {
|
||||
item.LAY_DISABLED = item.state != 1;
|
||||
return item;
|
||||
})
|
||||
return {
|
||||
"code": data.code,
|
||||
"msg": data.message,
|
||||
"count": data.data.count,
|
||||
"data": data.data.list
|
||||
};
|
||||
},
|
||||
toolbar: '#toolbarOperation',
|
||||
bottomToolbar: "#batchOperation"
|
||||
});
|
||||
|
||||
table.tool(function(obj) {
|
||||
var data = obj.data;
|
||||
switch (obj.event) {
|
||||
case 'recovery': //编辑
|
||||
recoveryCoupon([{coupon_type_id: data.coupon_type_id, coupon_id: data.coupon_id}]);
|
||||
break;
|
||||
}
|
||||
})
|
||||
|
||||
/**
|
||||
* 批量操作
|
||||
*/
|
||||
table.bottomToolbar(function(obj) {
|
||||
if (obj.data.length < 1) {
|
||||
layer.msg('请选择要操作的数据');
|
||||
return;
|
||||
}
|
||||
switch (obj.event) {
|
||||
case "recovery":
|
||||
var id_array = new Array();
|
||||
for (i in obj.data) id_array.push({coupon_type_id: obj.data[i].coupon_type_id, coupon_id: obj.data[i].coupon_id});
|
||||
recoveryCoupon(id_array);
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* 批量操作
|
||||
*/
|
||||
table.toolbar(function(obj) {
|
||||
if (obj.data.length < 1) {
|
||||
layer.msg('请选择要操作的数据');
|
||||
return;
|
||||
}
|
||||
switch (obj.event) {
|
||||
case "recovery":
|
||||
var id_array = new Array();
|
||||
for (i in obj.data) id_array.push({coupon_type_id: obj.data[i].coupon_type_id, coupon_id: obj.data[i].coupon_id});
|
||||
recoveryCoupon(id_array);
|
||||
break;
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
function recoveryCoupon(data) {
|
||||
layer.confirm('回收将会收回会员领取的待使用的优惠券,已使用的将无法回收,确定要回收所选优惠券吗?', function(index) {
|
||||
layer.close(index);
|
||||
$.ajax({
|
||||
url: ns.url("coupon://shop/coupon/recoverycoupon"),
|
||||
data: {
|
||||
coupon_list: JSON.stringify(data)
|
||||
},
|
||||
dataType: 'JSON',
|
||||
type: 'POST',
|
||||
success: function(res) {
|
||||
layer.msg(res.message);
|
||||
if (res.code == 0) {
|
||||
table.reload();
|
||||
}
|
||||
}
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 七天时间
|
||||
*/
|
||||
function datePick(date_num,event_obj){
|
||||
$(".date-picker-btn").removeClass("selected");
|
||||
$(event_obj).addClass('selected');
|
||||
|
||||
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>
|
||||
352
app/shop/view/account/dashboard.html
Executable file
352
app/shop/view/account/dashboard.html
Executable file
@@ -0,0 +1,352 @@
|
||||
|
||||
<style>
|
||||
.survey .layui-card {background:#f2f3f5;vertical-align:top;width:50%;display:inline-block;border-radius:0;float:left;margin-top:10px;box-shadow:unset;}
|
||||
.survey .layui-card-header {font-size:14px;box-shadow:unset;border:0;}
|
||||
.survey .layui-card:nth-child(3n) {margin-right:0;}
|
||||
.survey {box-shadow:unset;}
|
||||
.layui-card-body {font-size:24px;padding-top:0px;cursor:pointer;}
|
||||
.layui-card.layui-input-inline {padding-left:40px;box-sizing:border-box;}
|
||||
.tab-status {height:41px;}
|
||||
.layui-card.layui-input-inline {position:relative;}
|
||||
.stat-name {justify-content:space-between;}
|
||||
.layui-elem-quote .time {font-size:12px;margin-left:10px;}
|
||||
.screen-title {font-size:14px;font-weight:600;}
|
||||
.stat-list {margin-top:10px;display:flex;flex-wrap:wrap;}
|
||||
.stat-item {padding:15px;box-sizing:border-box;margin-right:10px;width:calc((100% - 30px) / 4);margin-bottom:10px;border:1px solid #eee;}
|
||||
.stat-name span {position:relative;}
|
||||
.stat-name .iconfont {margin-left:5px;cursor:pointer;}
|
||||
.stat-name>a {float:right;margin-top:1px;font-size:14px;font-weight:normal;}
|
||||
.stat-list .stat-item:nth-child(4n) {margin-right:0;}
|
||||
.stat-value {font-size:24px;margin-top:15px;}
|
||||
@media screen and (max-width:1580px) {.stat-list .stat-item {width:calc((100% - 20px) / 3);}
|
||||
.stat-list .stat-item:nth-child(4n) {margin-right:10px;}
|
||||
.stat-list .stat-item:nth-child(3n) {margin-right:0;}
|
||||
}
|
||||
.survey {margin:20px 0px;background:#f2f3f5;display:flex;}
|
||||
.survey.stat .layui-card {width:150px !important;}
|
||||
.survey.stat {margin-left:0;margin-right:0;height:90px;margin-top:10px;}
|
||||
.survey.stat .layui-card-body {padding-top:0px;}
|
||||
.symbol {padding:35px 20px;font-size:18px;}
|
||||
.stat-text {padding:35px 10px;font-size:14px;}
|
||||
.date-btn {height:32px;line-height:32px;font-size:14px;padding:0 10px;display:inline-block;box-sizing:border-box;float:left;cursor:pointer;}
|
||||
.layui-form-center {display:inline-block;}
|
||||
.js-prompt-top {color:#C8C9CC;font-size:14px;z-index:999;margin-left:5px;cursor:pointer;}
|
||||
#time_fission {border: 1px solid #eee;padding: 7px 10px;}
|
||||
.layui-layout-admin .layui-body .body-content{padding: 0; background-color: transparent;}
|
||||
.main-wrap .common-wrap{margin-right: 0;margin-left: 0;}
|
||||
</style>
|
||||
|
||||
<div id="app">
|
||||
<div class="main-wrap">
|
||||
<div class="common-wrap">
|
||||
<div class="head">
|
||||
<span class="title">统计报表</span>
|
||||
<span class="sub-title">更新时间:{:date('Y-m-d H:i:s')}</span>
|
||||
</div>
|
||||
<div class="body">
|
||||
<div class="layui-input-inline">
|
||||
<div class="layui-inline layui-inline-margin" id="time_fission">
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" id="start_time" name="start_time" autocomplete="off" class="layui-input" placeholder="请输入开始时间" value="{notempty name='$start_time'}{$start_time|date='Y-m-d H:i:s'}{/notempty}">
|
||||
<i class="iconfont iconriqi"></i>
|
||||
</div>
|
||||
<div class="layui-form-center">-</div>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" id="end_time" name="end_time" autocomplete="off" class="layui-input" placeholder="请输入结束时间" value="{notempty name='$end_time'}{$end_time|date='Y-m-d H:i:s'}{/notempty}">
|
||||
<i class="iconfont iconriqi"></i>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-input-inline">
|
||||
<div class="date-btn text-color selected" onclick="datePick(2, this)">今日</div>
|
||||
<div class="date-btn selected" onclick="datePick(1, this)">昨日</div>
|
||||
<div class="date-btn selected" onclick="datePick(3, this)">本周</div>
|
||||
<div class="date-btn selected" onclick="datePick(4, this)">本月</div>
|
||||
</div>
|
||||
<div class="survey">
|
||||
<div class="layui-card layui-input-inline" >
|
||||
<div class="layui-card-header">
|
||||
<span class="hint">预计收入(元) </span>
|
||||
<span class="iconfont iconwenhao js-prompt-top" data-tips="统计时间内,店铺收入的金额减去支出的金额"></span>
|
||||
</div>
|
||||
<div class="layui-card-body">
|
||||
<span class="num total_income" v-text="$options.filters.moneyFormat(realIncome)">0.00</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-card layui-input-inline" >
|
||||
<div class="layui-card-header">
|
||||
<span class="hint">收入总额(元) </span>
|
||||
<span class="iconfont iconwenhao js-prompt-top" data-tips="统计时间内,店铺收入的金额(订单收入、会员充值、会员开卡等)"></span>
|
||||
</div>
|
||||
<div class="layui-card-body">
|
||||
<span class="num total_income" v-text="$options.filters.moneyFormat(totalIncome)">0.00</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-card layui-input-inline" >
|
||||
<div class="layui-card-header">
|
||||
<span class="hint">支出总额(元) </span>
|
||||
<span class="iconfont iconwenhao js-prompt-top" data-tips="统计时间内,店铺支出的金额(退款、会员提现、现金红包等)"></span>
|
||||
</div>
|
||||
<div class="layui-card-body">
|
||||
<span class="num total_expenditure" v-text="$options.filters.moneyFormat(totalDisburse)">0.00</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-clear"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="common-wrap">
|
||||
<div class="head">
|
||||
<span class="title">收入概况</span>
|
||||
</div>
|
||||
<div class="body">
|
||||
<div class="survey stat">
|
||||
<div class="layui-card layui-input-inline">
|
||||
<div class="layui-card-header">
|
||||
<span class="hint">收入总额</span>
|
||||
</div>
|
||||
<div class="layui-card-body">
|
||||
<span class="num total_income" v-text="$options.filters.moneyFormat(totalIncome)">0.00</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="symbol"> = </div>
|
||||
|
||||
<template v-for="(item, index) in incomeData">
|
||||
<div class="symbol" v-if="index > 0"> + </div>
|
||||
<div class="stat-text" v-text="item.title"></div>
|
||||
</template>
|
||||
</div>
|
||||
|
||||
<div class="stat-list">
|
||||
<div class="stat-item" v-for="(item, index) in incomeData" :key="index">
|
||||
<div class="stat-name">
|
||||
<span><span v-text="item.title"></span><i class="iconfont iconwenhao js-prompt-top" :data-tips="item.desc"></i></span>
|
||||
<a :href="url(item.url)" class="text-color" target="_blank">明细</a>
|
||||
</div>
|
||||
<div class="stat-value" v-text="$options.filters.moneyFormat(item.value)">0.00</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="common-wrap">
|
||||
<div class="head">
|
||||
<span class="title">支出概况</span>
|
||||
</div>
|
||||
<div class="body">
|
||||
<div class="survey stat">
|
||||
<div class="layui-card layui-input-inline">
|
||||
<div class="layui-card-header">
|
||||
<span class="hint">支出总额</span>
|
||||
</div>
|
||||
<div class="layui-card-body">
|
||||
<span class="num total_income" v-text="$options.filters.moneyFormat(totalDisburse)">0.00</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="symbol"> = </div>
|
||||
|
||||
<template v-for="(item, index) in disburseData">
|
||||
<div class="symbol" v-if="index > 0"> + </div>
|
||||
<div class="stat-text" v-text="item.title"></div>
|
||||
</template>
|
||||
</div>
|
||||
|
||||
<div class="stat-list">
|
||||
<div class="stat-item" v-for="(item, index) in disburseData" :key="index">
|
||||
<div class="stat-name">
|
||||
<span><span v-text="item.title"></span><i class="iconfont iconwenhao js-prompt-top" :data-tips="item.desc"></i></span>
|
||||
<a :href="url(item.url)" class="text-color" target="_blank">明细</a>
|
||||
</div>
|
||||
<div class="stat-value" v-text="$options.filters.moneyFormat(item.value)">0.00</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="STATIC_JS/vue.js"></script>
|
||||
<script>
|
||||
var laydate;
|
||||
layui.use(['laydate'], function () {
|
||||
laydate = layui.laydate;
|
||||
//立即执行不生效
|
||||
setTimeout(function(){
|
||||
new LayDate({
|
||||
elem: '#time_fission',
|
||||
type: 'datetime',
|
||||
rangeId:['start_time','end_time'],
|
||||
max: '{:date("Y-m-d")}',
|
||||
done: function(value, date, endDate){
|
||||
var time_arr = value.split(' - ');
|
||||
var start_time = time_arr[0];
|
||||
var end_time = time_arr[1];
|
||||
getIncomeData({start_time: dateToTime(start_time), end_time: dateToTime(end_time)});
|
||||
getDisburseData({start_time: dateToTime(start_time), end_time: dateToTime(end_time)});
|
||||
$('input[name="start_time"]').val(time_arr[0]);
|
||||
$('input[name="end_time"]').val(time_arr[1]);
|
||||
}
|
||||
});
|
||||
}, 200)
|
||||
});
|
||||
|
||||
var vue = new Vue({
|
||||
el: '#app',
|
||||
data: {
|
||||
totalIncome: {$total_income}, //总收入
|
||||
totalDisburse: {$total_disburse}, // 总支出
|
||||
incomeData: {:json_encode($income_data)}, // 收入组成
|
||||
disburseData: {:json_encode($disburse_data)} // 支出组成
|
||||
},
|
||||
computed: {
|
||||
realIncome: function(){
|
||||
return this.totalIncome - this.totalDisburse;
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
url: function(href){
|
||||
return ns.href(href)
|
||||
}
|
||||
},
|
||||
filters: {
|
||||
/**
|
||||
* 金额格式化输出
|
||||
* @param {Object} money
|
||||
*/
|
||||
moneyFormat(money) {
|
||||
if (isNaN(parseFloat(money))) return money;
|
||||
return parseFloat(money).toFixed(2);
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
/**
|
||||
* 查询收入数据
|
||||
* @param data
|
||||
*/
|
||||
function getIncomeData(data) {
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
dataType: 'JSON',
|
||||
url: ns.url("shop/account/income"),
|
||||
data: data,
|
||||
success: function(res) {
|
||||
vue.incomeData = res.data;
|
||||
var total = 0;
|
||||
res.data.forEach(function(item){
|
||||
total += parseFloat(item.value);
|
||||
});
|
||||
vue.totalIncome = total;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询支出数据
|
||||
* @param data
|
||||
*/
|
||||
function getDisburseData(data) {
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
dataType: 'JSON',
|
||||
url: ns.url("shop/account/disburse"),
|
||||
data: data,
|
||||
success: function(res) {
|
||||
vue.disburseData = res.data;
|
||||
var total = 0;
|
||||
res.data.forEach(function(item){
|
||||
total += parseFloat(item.value);
|
||||
});
|
||||
vue.totalDisburse = total;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function datePick(date_type,event_obj) {
|
||||
$(".date-btn").removeClass("select");
|
||||
$(".date-btn").removeClass("text-color");
|
||||
$(event_obj).addClass('select');
|
||||
$(event_obj).addClass('text-color');
|
||||
|
||||
var beginTime, endTime;
|
||||
var now = new Date();
|
||||
|
||||
switch (date_type) {
|
||||
case 1:
|
||||
now.setDate(now.getDate() - 1);
|
||||
var Year = now.getFullYear();
|
||||
var Month = now.getMonth() + 1;
|
||||
var Day = now.getDate();
|
||||
if (Month < 10) Month = '0' + Month;
|
||||
if (Day < 10) Day = '0' + Day;
|
||||
|
||||
beginTime = Year + "-" + Month + "-" + Day + ' 00:00:00'; //格式 Y-m-d
|
||||
endTime = Year + "-" + Month + "-" + Day + ' 23:59:59'; //格式 Y-m-d
|
||||
break;
|
||||
case 2:
|
||||
var Year = now.getFullYear();
|
||||
var Month = now.getMonth() + 1;
|
||||
var Day = now.getDate();
|
||||
if (Month < 10) Month = '0' + Month;
|
||||
if (Day < 10) Day = '0' + Day;
|
||||
|
||||
beginTime = Year + "-" + Month + "-" + Day + ' 00:00:00'; //格式 Y-m-d
|
||||
endTime = Year + "-" + Month + "-" + Day + ' 23:59:59'; //格式 Y-m-d
|
||||
break;
|
||||
case 3:
|
||||
var Year = now.getFullYear();
|
||||
var Month = now.getMonth() + 1;
|
||||
var Day = now.getDate();
|
||||
if (Month < 10) Month = '0' + Month;
|
||||
if (Day < 10) Day = '0' + Day;
|
||||
|
||||
var week_day = now.getDay();
|
||||
if (week_day == 0) //星期天表示 0 故当星期天的时候,获取上周开始的时候
|
||||
{
|
||||
week_day = 7;
|
||||
}
|
||||
|
||||
now.setDate(Day - week_day + 1);
|
||||
|
||||
var prev_year = now.getFullYear();
|
||||
var prev_month = now.getMonth() + 1;
|
||||
var prev_day = now.getDate();
|
||||
if (prev_month < 10) prev_month = '0' + prev_month;
|
||||
if (prev_day < 10) prev_day = '0' + prev_day;
|
||||
|
||||
beginTime = prev_year + "-" + prev_month + "-" + prev_day + ' 00:00:00'; //格式 Y-m-d
|
||||
endTime = Year + "-" + Month + "-" + Day + ' 23:59:59'; //格式 Y-m-d
|
||||
break;
|
||||
case 4:
|
||||
var beginTimes = now.getFullYear(); //开始计算
|
||||
var Month = now.getMonth() + 1; //getMonth()是以0开始的月份
|
||||
var Day = now.getDate();
|
||||
if (Month < 10) Month = '0' + Month;
|
||||
if (Day < 10) Day = '0' + Day;
|
||||
|
||||
beginTime = beginTimes + "-" + Month + "-01 00:00:00"; //格式 Y-m-d
|
||||
endTime = beginTimes + "-" + Month + "-" + Day + ' 23:59:59'; //格式 Y-m-d
|
||||
break;
|
||||
}
|
||||
|
||||
new LayDate({
|
||||
elem: '#time_fission',
|
||||
type: 'datetime',
|
||||
rangeId: ['start_time', 'end_time'],
|
||||
value: beginTime + ' - ' + endTime,
|
||||
max: '{:date("Y-m-d")}'
|
||||
});
|
||||
|
||||
$('#start_time').val(beginTime);
|
||||
$('#end_time').val(endTime);
|
||||
|
||||
getIncomeData({start_time: dateToTime(beginTime), end_time: dateToTime(endTime)})
|
||||
getDisburseData({start_time: dateToTime(beginTime), end_time: dateToTime(endTime)})
|
||||
}
|
||||
|
||||
function dateToTime(date){
|
||||
return new Date(date).getTime() / 1000;
|
||||
}
|
||||
</script>
|
||||
178
app/shop/view/account/growth.html
Executable file
178
app/shop/view/account/growth.html
Executable file
@@ -0,0 +1,178 @@
|
||||
<style>
|
||||
.screen {margin-top: 15px}
|
||||
.table-title {cursor: pointer}
|
||||
.layui-layout-admin .screen {margin-top: 0;margin-bottom: 15px;}
|
||||
.layui-layout-admin .layui-form-item .layui-input-inline{background-color: #fff;}
|
||||
.table-bottom .layui-table-page {position: inherit;text-align: right}
|
||||
</style>
|
||||
|
||||
<div class="screen layui-collapse" lay-filter="selection_panel">
|
||||
<div class="layui-colla-item">
|
||||
<form class="layui-colla-content layui-form layui-show">
|
||||
<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">发生方式:</label>
|
||||
<div class="layui-input-inline">
|
||||
<select name="from_type">
|
||||
<option value="">全部</option>
|
||||
{foreach $from_type as $k => $val}
|
||||
<option value="{$k}">{$val.type_name}</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
</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>
|
||||
</div>
|
||||
</form>
|
||||
</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' onclick="location.hash = ns.hash('shop/member/editmember?member_id={{d.member_id}}')">
|
||||
<p class="layui-elip">{{d.nickname}}</p>
|
||||
<p class="layui-elip">{{d.mobile}}</p>
|
||||
</div>
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<script>
|
||||
var form, laydate;
|
||||
layui.use(['laydate','form', 'element'], function(){
|
||||
form = layui.form;
|
||||
laydate = layui.laydate;
|
||||
|
||||
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.account_type = 'growth';
|
||||
table.reload({
|
||||
page: {
|
||||
curr: 1
|
||||
},
|
||||
where: data.field
|
||||
});
|
||||
return false;
|
||||
});
|
||||
|
||||
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("shop/memberaccount/accountdetail"),
|
||||
where: {
|
||||
account_type: 'growth'
|
||||
},
|
||||
cols: [
|
||||
[{
|
||||
templet: '#memberInfo',
|
||||
title: '会员信息',
|
||||
width: '20%',
|
||||
unresize: 'false'
|
||||
}, {
|
||||
title: '成长值变化',
|
||||
width: '15%',
|
||||
unresize: 'false',
|
||||
templet: function (d) {
|
||||
if (d.account_data > 0) return '+' + parseInt(d.account_data);
|
||||
return parseInt(d.account_data);
|
||||
}
|
||||
}, {
|
||||
field: 'type_name',
|
||||
title: '发生方式',
|
||||
width: '15%',
|
||||
unresize: 'false'
|
||||
}, {
|
||||
field: 'create_time',
|
||||
title: '发生时间',
|
||||
width: '20%',
|
||||
unresize: 'false',
|
||||
templet: function(data) {
|
||||
return ns.time_to_date(data.create_time);
|
||||
}
|
||||
}, {
|
||||
field: 'remark',
|
||||
title: '备注',
|
||||
width: '30%',
|
||||
unresize: 'false'
|
||||
}]
|
||||
]
|
||||
});
|
||||
})
|
||||
|
||||
/**
|
||||
* 七天时间
|
||||
*/
|
||||
function datePick(date_num,event_obj){
|
||||
$(".date-picker-btn").removeClass("selected");
|
||||
$(event_obj).addClass('selected');
|
||||
|
||||
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>
|
||||
200
app/shop/view/account/point.html
Executable file
200
app/shop/view/account/point.html
Executable file
@@ -0,0 +1,200 @@
|
||||
<style>
|
||||
.layui-card-body .content{width: 33.3%;}
|
||||
.layui-card-body .bottom-title{color: #909399;font-size: 14px;margin-top: 5px;}
|
||||
.table-bottom .layui-table-page {position: inherit;text-align: right}
|
||||
.table-tab .layui-tab-content{margin-bottom: 0;}
|
||||
.js-prompt-top{color: #C8C9CC;font-size: 14px;z-index: 999;margin-left: 5px;cursor: pointer;}
|
||||
.table-title {cursor: pointer}
|
||||
.layui-layout-admin .screen{margin: 15px 0;}
|
||||
.layui-layout-admin .layui-form-item .layui-input-inline { background-color: #fff; }
|
||||
</style>
|
||||
|
||||
<div class="layui-card card-common card-brief panel-content">
|
||||
<div class="layui-card-header simple">
|
||||
<span class="card-title">积分概况</span>
|
||||
</div>
|
||||
<div class="layui-card-body">
|
||||
<div class="content">
|
||||
<p class="title">可用积分</p>
|
||||
<p class="money">{$total_usable_point}</p>
|
||||
</div>
|
||||
<div class="content">
|
||||
<p class="title">累计发放积分</p>
|
||||
<p class="money">{$grant_point}</p>
|
||||
</div>
|
||||
<div class="content">
|
||||
<p class="title">累计使用积分</p>
|
||||
<p class="money">{$consume_point}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="screen layui-collapse" lay-filter="selection_panel">
|
||||
<div class="layui-colla-item">
|
||||
<form class="layui-colla-content layui-form layui-show">
|
||||
<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">发生方式</label>
|
||||
<div class="layui-input-inline">
|
||||
<select name="from_type">
|
||||
<option value="">全部</option>
|
||||
{foreach $from_type as $k => $val}
|
||||
<option value="{$k}">{$val.type_name}</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
</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>
|
||||
</div>
|
||||
</form>
|
||||
</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' onclick="location.hash = ns.hash('shop/member/editmember?member_id={{d.member_id}}')">
|
||||
<p class="layui-elip">{{d.nickname}}</p>
|
||||
<p class="layui-elip">{{d.mobile}}</p>
|
||||
</div>
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<script>
|
||||
var form, laydate;
|
||||
layui.use(['laydate','form', 'element'], function(){
|
||||
form = layui.form;
|
||||
laydate = layui.laydate;
|
||||
|
||||
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.account_type = 'point';
|
||||
table.reload({
|
||||
page: {
|
||||
curr: 1
|
||||
},
|
||||
where: data.field
|
||||
});
|
||||
return false;
|
||||
});
|
||||
|
||||
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("shop/memberaccount/accountdetail"),
|
||||
where: {
|
||||
account_type: 'point'
|
||||
},
|
||||
cols: [
|
||||
[{
|
||||
templet: '#memberInfo',
|
||||
title: '会员信息',
|
||||
width: '20%',
|
||||
unresize: 'false'
|
||||
}, {
|
||||
title: '积分变化',
|
||||
width: '10%',
|
||||
align:'right',
|
||||
unresize: 'false',
|
||||
templet: function (d) {
|
||||
if (d.account_data > 0) return '+' + parseInt(d.account_data);
|
||||
return parseInt(d.account_data);
|
||||
}
|
||||
}, {
|
||||
field: 'type_name',
|
||||
title: '发生方式',
|
||||
align:'center',
|
||||
unresize: 'false'
|
||||
}, {
|
||||
field: 'create_time',
|
||||
title: '发生时间',
|
||||
unresize: 'false',
|
||||
templet: function(data) {
|
||||
return ns.time_to_date(data.create_time);
|
||||
}
|
||||
}, {
|
||||
field: 'remark',
|
||||
title: '备注',
|
||||
unresize: 'false'
|
||||
}]
|
||||
]
|
||||
});
|
||||
})
|
||||
|
||||
/**
|
||||
* 七天时间
|
||||
*/
|
||||
function datePick(date_num,event_obj){
|
||||
$(".date-picker-btn").removeClass("selected");
|
||||
$(event_obj).addClass('selected');
|
||||
|
||||
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>
|
||||
390
app/shop/view/account/point_config.html
Executable file
390
app/shop/view/account/point_config.html
Executable file
@@ -0,0 +1,390 @@
|
||||
<style>
|
||||
.layui-card-body .content{width: 33.3%;}
|
||||
.layui-card-body .bottom-title{color: #909399;font-size: 14px;margin-top: 5px;}
|
||||
.table-bottom .layui-table-page{top: 0;position: static;}
|
||||
.table-tab .layui-tab-content{margin-bottom: 0;}
|
||||
.layui-layout-admin .screen{margin-bottom: 15px;}
|
||||
.align-center {text-align: center!important;}
|
||||
.layui-table td, .layui-table th {padding: 15px}
|
||||
</style>
|
||||
|
||||
<div class="layui-card card-common card-brief panel-content">
|
||||
<div class="layui-card-header simple">
|
||||
<span class="card-title">积分概况</span>
|
||||
</div>
|
||||
<div class="layui-card-body">
|
||||
<div class="content">
|
||||
<p class="title">可用积分 <a href="{:href_url('shop/memberaccount/point')}" class="text-color">明细</a></p>
|
||||
<p class="money">{$total_usable_point}</p>
|
||||
</div>
|
||||
<div class="content">
|
||||
<p class="title">累计发放积分 <a href="{:href_url('shop/memberaccount/point')}" class="text-color">明细</a></p>
|
||||
<p class="money">{$grant_point}</p>
|
||||
</div>
|
||||
<div class="content">
|
||||
<p class="title">累计使用积分 <a href="{:href_url('shop/memberaccount/point')}" class="text-color">明细</a></p>
|
||||
<p class="money">{$consume_point}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-card card-common card-brief">
|
||||
<div class="layui-card-header simple">
|
||||
<span class="card-title">积分规则</span>
|
||||
</div>
|
||||
<div class="layui-card-body" style="padding: 10px 25px!important;">
|
||||
<table class="layui-table" lay-skin="nob">
|
||||
<colgroup>
|
||||
<col width="20%">
|
||||
<col width="50%">
|
||||
<col width="15%">
|
||||
<col width="15%">
|
||||
</colgroup>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>规则名称</th>
|
||||
<th>规则详情</th>
|
||||
<th>更新时间</th>
|
||||
<th class="align-center">操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{foreach name="$rule" item="vo"}
|
||||
<tr>
|
||||
<td>{$vo.title}</td>
|
||||
<td>{$vo.content}</td>
|
||||
<td>{if $vo.update_time}{:time_to_date($vo.update_time)}{else/}-{/if}</td>
|
||||
<td class="align-center"><a href="{:href_url($vo.url)}" class="text-color" target="_blank">查看</a></td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
<tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-card card-common card-brief">
|
||||
<div class="layui-card-header simple">
|
||||
<span class="card-title">积分操作</span>
|
||||
</div>
|
||||
<div class="layui-card-body" style="padding: 10px 25px!important;">
|
||||
<button class="layui-btn" onclick="clearpoint()">积分清零</button>
|
||||
<button class="layui-btn" onclick="reset()">积分重置</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-card card-common card-brief">
|
||||
<div class="layui-card-header simple">
|
||||
<span class="card-title">积分任务</span>
|
||||
</div>
|
||||
<div class="layui-card-body" style="padding: 10px 25px!important;">
|
||||
<span id="point_task_config_desc"></span>
|
||||
<a class="text-color" onclick="pointTaskConfig()" href="javascript:;">设置</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script id="clear_html" type="text/html">
|
||||
<div class="layui-form member-form" id="reset_label" lay-filter="form">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label sm">说明:</label>
|
||||
<div class="layui-input-block">
|
||||
<textarea name="remark" class="layui-textarea len-long" maxlength="150"></textarea>
|
||||
</div>
|
||||
<div class="word-aux sm"><p>积分清零后会将会员现有的积分全部清零,请谨慎操作</p></div>
|
||||
</div>
|
||||
<div class="form-row sm">
|
||||
<button class="layui-btn" lay-submit lay-filter='clear_bth'>确定</button>
|
||||
<button class="layui-btn layui-btn-primary" lay-submit lay-filter='clear_close_bth'>取消</button>
|
||||
</div>
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<script id="point_task_config" type="text/html">
|
||||
<div class="layui-form member-form" lay-filter="form">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label sm">任务状态:</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="radio" name="status" value="1" title="开启" {{# if(d.status == 1){ }} checked {{# } }} lay-filter="status">
|
||||
<input type="radio" name="status" value="0" title="关闭" {{# if(d.status == 0){ }} checked {{# } }} lay-filter="status">
|
||||
</div>
|
||||
</div>
|
||||
<div id="point_status_on" {{# if(d.status == 0){ }}style="display:none;"{{# } }}>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label sm">任务类型:</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="radio" name="type" value="clear" title="清零" {{# if(d.type == 'clear'){ }} checked {{# } }}>
|
||||
<input type="radio" name="type" value="reset" title="重置" {{# if(d.type == 'reset'){ }} checked {{# } }}>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label sm">任务时间:</label>
|
||||
<div class="layui-input-block">
|
||||
<div class="layui-input-inline">
|
||||
<input type="hidden" name="time_type" value="1"/>
|
||||
每年
|
||||
</div>
|
||||
<div class="layui-input-inline len-short">
|
||||
<select name="month" lay-filter="month1">
|
||||
{{# d.month_arr.forEach((item)=>{ }}
|
||||
<option value="{{item.id}}" {{# if(d.month == item.id){ }}selected{{# } }}>{{item.name}}</option>
|
||||
{{# }) }}
|
||||
</select>
|
||||
</div>
|
||||
<div class="layui-input-inline len-short">
|
||||
<select name="day">
|
||||
{{# d.day_arr.forEach((item)=>{ }}
|
||||
<option value="{{item.id}}" {{# if(d.day == item.id){ }}selected{{# } }}>{{item.name}}</option>
|
||||
{{# }) }}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-row sm">
|
||||
<button class="layui-btn" lay-submit lay-filter='point_task_config_save'>确定</button>
|
||||
<button class="layui-btn layui-btn-primary" lay-filter='point_task_config_cancel'>取消</button>
|
||||
</div>
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<script>
|
||||
var form, laydate, laytpl;
|
||||
layui.use(['laydate','form', 'element', 'laytpl'], function(){
|
||||
form = layui.form;
|
||||
laydate = layui.laydate;
|
||||
laytpl = layui.laytpl;
|
||||
});
|
||||
|
||||
var clear_tag = false;
|
||||
var clear_index;
|
||||
function clearpoint(){
|
||||
|
||||
laytpl($("#clear_html").html()).render([], function(html) {
|
||||
clear_index = layer.open({
|
||||
title: '积分清零',
|
||||
skin: 'layer-tips-class',
|
||||
type: 1,
|
||||
area: ['600px'],
|
||||
content: html,
|
||||
success: function(){
|
||||
form.on('submit(clear_bth)', function(obj) {
|
||||
var field = obj.field;
|
||||
if (clear_tag) return;
|
||||
clear_tag = true;
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: ns.url("shop/memberaccount/pointclear"),
|
||||
dataType: 'JSON',
|
||||
data: field,
|
||||
success: function(res) {
|
||||
clear_tag = false;
|
||||
layer.msg(res.message);
|
||||
if (res.code >= 0) {
|
||||
listenerHash(); // 刷新页面
|
||||
layer.closeAll();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
form.on('submit(clear_close_bth)', function(obj) {
|
||||
clear_tag = false;
|
||||
layer.close(clear_index);
|
||||
})
|
||||
}
|
||||
});
|
||||
});
|
||||
form.render();
|
||||
}
|
||||
|
||||
var reset_tag = false;
|
||||
|
||||
function reset() {
|
||||
if (reset_tag) return;
|
||||
reset_tag = true;
|
||||
layer.confirm('您确定要将会员现有的积分全部重置吗(重置后会员的积分以及积分记录全都会被删除)?', {
|
||||
btn: ['确定', '取消'] //按钮
|
||||
}, function (index) {
|
||||
layer.close(index);
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: ns.url("shop/memberaccount/pointreset"),
|
||||
dataType: 'JSON',
|
||||
success: function (res) {
|
||||
reset_tag = false;
|
||||
layer.msg(res.message);
|
||||
if (res.code >= 0) {
|
||||
listenerHash(); // 刷新页面
|
||||
}
|
||||
}
|
||||
});
|
||||
}, function () {
|
||||
reset_tag = false;
|
||||
layer.closeAll();
|
||||
});
|
||||
}
|
||||
|
||||
//积分任务设置
|
||||
var point_task_config = {:json_encode($point_task_config)};
|
||||
var task_index = null;
|
||||
function pointTaskConfigDesc(){
|
||||
var desc = '';
|
||||
if(point_task_config['status'] == 0){
|
||||
desc += '无任务';
|
||||
}else{
|
||||
switch(Number(point_task_config['time_type'])){
|
||||
case 1:
|
||||
var time_arr = point_task_config['time'].split('/');
|
||||
var month = time_arr[0];
|
||||
var day = time_arr[1];
|
||||
desc += '每年'+month+'月'+day+'日';
|
||||
break;
|
||||
}
|
||||
switch(point_task_config['type']){
|
||||
case 'clear':
|
||||
desc += '积分清零';
|
||||
break;
|
||||
case 'reset':
|
||||
desc += '积分重置';
|
||||
break;
|
||||
}
|
||||
desc += '<span style="padding-left:10px;"></span>下次任务时间:'+ns.time_to_date(point_task_config['cron_time'], 'Y-m-d');
|
||||
}
|
||||
$("#point_task_config_desc").html(desc);
|
||||
}
|
||||
pointTaskConfigDesc();
|
||||
function pointTaskConfig(){
|
||||
function _render(callback){
|
||||
_timeToField(point_task_config);
|
||||
point_task_config.month_arr = _getMonth();
|
||||
point_task_config.day_arr = _getDay(point_task_config['month1']);
|
||||
laytpl($("#point_task_config").html()).render(point_task_config, function(html) {
|
||||
callback(html);
|
||||
})
|
||||
}
|
||||
|
||||
function _open(html, callback){
|
||||
task_index = layer.open({
|
||||
title: '积分任务',
|
||||
skin: 'layer-tips-class',
|
||||
type: 1,
|
||||
area: ['600px'],
|
||||
content: html,
|
||||
success: function(){
|
||||
$(".layui-layer-content").css('height','auto');
|
||||
form.render();
|
||||
callback();
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function _getMonth(){
|
||||
var arr = [];
|
||||
for(let i = 1; i <= 12; i ++){
|
||||
arr.push({
|
||||
id : i,
|
||||
name : i + '月',
|
||||
})
|
||||
}
|
||||
return arr;
|
||||
}
|
||||
|
||||
function _getDay(month) {
|
||||
month = Number(month);
|
||||
var day_num = 30;
|
||||
if([2].indexOf(month) > -1){
|
||||
day_num = 29;
|
||||
}else if([1,3,5,7,8,10,12].indexOf(month) > -1){
|
||||
day_num = 31;
|
||||
}
|
||||
var arr = [];
|
||||
for(let i = 1; i <= day_num; i ++){
|
||||
arr.push({
|
||||
id : i,
|
||||
name : i + '日',
|
||||
})
|
||||
}
|
||||
return arr;
|
||||
}
|
||||
|
||||
function _monthSelect(){
|
||||
form.on('select(month1)', function (data){
|
||||
var month = data.value;
|
||||
var day_arr = _getDay(month);
|
||||
let html = '';
|
||||
day_arr.forEach((item)=>{
|
||||
html += '<option value="'+ item.id +'">'+ item.name +'</option>';
|
||||
})
|
||||
$("select[name='day1']").html(html);
|
||||
form.render();
|
||||
})
|
||||
}
|
||||
|
||||
function _statusChange(){
|
||||
form.on('radio(status)', function (data){
|
||||
var status = data.value;
|
||||
var dom = $("#point_status_on");
|
||||
if(status == 1){
|
||||
dom.show();
|
||||
}else{
|
||||
dom.hide();
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function _timeToField(field){
|
||||
switch(Number(field.time_type)){
|
||||
case 1:
|
||||
var time_arr = field.time.split('/');
|
||||
field.month = time_arr[0];
|
||||
field.day = time_arr[1];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
function _fieldToTime(field){
|
||||
switch(Number(field.time_type)){
|
||||
case 1:
|
||||
field.time = field.month+'/'+field.day;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
function _save(){
|
||||
form.on('submit(point_task_config_save)', function(data) {
|
||||
var field = data.field;
|
||||
_fieldToTime(field);
|
||||
if (clear_tag) return;
|
||||
clear_tag = true;
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: ns.url("shop/memberaccount/pointtaskconfig"),
|
||||
dataType: 'JSON',
|
||||
data: field,
|
||||
success: function(res) {
|
||||
clear_tag = false;
|
||||
layer.msg(res.message);
|
||||
if (res.code >= 0) {
|
||||
point_task_config = res.data;
|
||||
pointTaskConfigDesc();
|
||||
layer.close(task_index);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function _cancel(){
|
||||
$("button[lay-filter='point_task_config_cancel']").on('click', function() {
|
||||
layer.close(task_index);
|
||||
});
|
||||
}
|
||||
|
||||
_render((res)=>{
|
||||
_open(res, ()=>{
|
||||
_statusChange();
|
||||
_monthSelect();
|
||||
_save();
|
||||
_cancel();
|
||||
})
|
||||
})
|
||||
}
|
||||
</script>
|
||||
Reference in New Issue
Block a user