350 lines
13 KiB
PHP
350 lines
13 KiB
PHP
|
||
<?php
|
||
|
||
use app\models\Order;
|
||
|
||
/**
|
||
* @author Any
|
||
* @description KISS
|
||
* @date 2021年6月30日
|
||
* @version 1.0.0
|
||
*
|
||
* _____LOG_____
|
||
*
|
||
*/
|
||
$this->title = '充值列表';
|
||
$this->params['breadcrumbs'][] = $this->title;
|
||
|
||
$is_pay = \Yii::$app->request->get('is_pay');
|
||
$start_end_date = \Yii::$app->request->get('start_end_date');
|
||
?>
|
||
<style type="text/css">
|
||
.layui-table-cell {
|
||
height: auto;
|
||
}
|
||
</style>
|
||
<div class="layui-fluid">
|
||
<div class="layui-card">
|
||
<div class="layui-card-header">
|
||
<?= $this->title ?>
|
||
</div>
|
||
<div class="layui-card-header layuiadmin-card-header-auto">
|
||
<div class="layui-form-item">
|
||
<div class="layui-inline layui-float-right layui-form">
|
||
|
||
|
||
<div class="layui-form-item layui-inline">
|
||
<div class="layui-inline">
|
||
<label class="layui-form-label"></label>
|
||
<div class="layui-input-inline">
|
||
<input type="text" name="start_end_date" value="<?= $start_end_date ?>" class="layui-input" id="start_end_date" placeholder="下单日期" autocomplete="off">
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
|
||
<div class="layui-inline layui-form-item">
|
||
<div class="layui-input-inline">
|
||
<select name="is_pay">
|
||
<option value="">全部状态</option>
|
||
<option value="0" <?= $is_pay == 0 ? "selected" : "" ?>>待支付</option>
|
||
<option value="1" <?= $is_pay == 1 ? "selected" : "" ?>>已支付</option>
|
||
</select>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="layui-inline layui-form-item">
|
||
<label class="layui-form-label">关键词</label>
|
||
<div class="layui-input-block">
|
||
<input type="text" name="keywords" placeholder="搜索用户昵称、手机号" autocomplete="off" class="layui-input"
|
||
value="<?= \Yii::$app->request->get("keywords") ?>">
|
||
</div>
|
||
</div>
|
||
<div class="layui-inline">
|
||
<button class="layui-btn layuiadmin-btn-useradmin" lay-submit lay-filter="dtable-search">
|
||
<i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>
|
||
</button>
|
||
|
||
<button type="button" class="layui-btn" lay-submit lay-filter="dtable-export">导出</button>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div class="layui-card-body">
|
||
<table id="dtable" lay-filter="dtable"></table>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<!--工具栏模板-->
|
||
<script type="text/html" id="toolBarTpl">
|
||
<div class="layui-btn-container">
|
||
</div>
|
||
</script>
|
||
|
||
<!--行操作列模板-->
|
||
<script type="text/html" id="rowBarTpl">
|
||
{{# if(d.state == '0'){ }}
|
||
<button class="layui-btn layui-btn-xs layui-bg-red" lay-event="cancel">取消</button>
|
||
{{# } }}
|
||
<button class="layui-btn layui-btn-xs layui-btn-danger layui-hide" lay-event="delete">删除</button>
|
||
</script>
|
||
|
||
|
||
<script type="text/html" id="statusTpl">
|
||
{{# if(d.is_pay == '0'){ }}
|
||
<span class="layui-badge layui-bg-orange">待支付</span>
|
||
{{# } else if(d.is_pay == '1'){ }}
|
||
<span class="layui-badge layui-bg-green">已支付</span>
|
||
{{# } }}
|
||
</script>
|
||
|
||
<script type="text/html" id="phoneTpl">
|
||
<span>用户名:{{d.nickname}}</span><br>
|
||
<span>手机号:{{d.mobile_phone}}</span>
|
||
</script>
|
||
|
||
<script type="text/html" id="dateTpl">
|
||
<span>下单日期:{{d.created_at_cn}}</span><br>
|
||
<span>支付日期:{{d.pay_time_cn}}</span><br>
|
||
</script>
|
||
<script type="text/html" id="ordernoTpl">
|
||
<span>{{d.order_no}}</span><br>
|
||
<!-- <span class="layui-badge layui-bg-blue">分账订单号:{{d.psOrderMulti_cn}}</span><br>-->
|
||
<!-- <span class="layui-badge layui-bg-blue">完结订单号:{{d.psOrderFinish_cn}}</span>-->
|
||
</script>
|
||
|
||
<script type="text/html" id="ball_number">
|
||
<a href="/admin/ball/qc-data?qr_number={{d.goods_id}}" title="跳转球车详情">{{d.goods_id}}</a>
|
||
</script>
|
||
<script>
|
||
<?php $this->beginBlock('js_script_wrap') ?>
|
||
layui.config({
|
||
base: '/statics/layuiadmin/' //静态资源所在路径
|
||
}).extend({
|
||
index: 'lib/index' //主入口模块
|
||
}).use(['index', 'user', 'table', 'form','laydate'], function () {
|
||
var $ = layui.$
|
||
, form = layui.form
|
||
, table = layui.table
|
||
, laydate = layui.laydate
|
||
, admin = layui.admin;
|
||
|
||
//日期范围
|
||
laydate.render({
|
||
elem: '#start_end_date'
|
||
,type: 'datetime'
|
||
,range: true
|
||
});
|
||
|
||
form.render();
|
||
|
||
//search
|
||
form.on('submit(dtable-search)', function (obj) {
|
||
var field = obj.field;
|
||
reload_table_data(field);
|
||
});
|
||
//search
|
||
form.on('submit(dtable-export)', function (obj) {
|
||
var field = obj.field;
|
||
var params = '?'
|
||
$.each(field,function (i,k) {
|
||
params+= i+'='+k+'&'
|
||
})
|
||
params = params.slice(0, -1)
|
||
var url = '<?=\Yii::$app->urlManager->createUrl(['admin/balance/recharge/order-search-export'])?>'+params
|
||
location.href = url;
|
||
});
|
||
|
||
//重新加载表格数据
|
||
function reload_table_data(conf) {
|
||
table.reload('dtable', {
|
||
url:'<?=\Yii::$app->urlManager->createUrl(['admin/balance/recharge/order-search'])?>'
|
||
, page: true
|
||
, where: conf
|
||
});
|
||
}
|
||
|
||
//执行渲染
|
||
table.render({
|
||
//指定原始表格元素选择器(推荐id选择器)
|
||
elem: '#dtable'
|
||
//容器高度
|
||
//,height: 315
|
||
//容器宽度
|
||
//,width: 720
|
||
//设置表头
|
||
, cols: [[
|
||
// {checkbox: true}
|
||
{field: 'id', title: 'ID', width: 80}
|
||
, {field: 'mobile_phone', title: '用户', templet: '#phoneTpl', minWidth: 200}
|
||
, {field: 'pay_price', title: '充值金额', minWidth: 100}
|
||
, {field: 'state', title: '状态', templet: '#statusTpl', minWidth: 100}
|
||
, {field: 'created_at_cn', title: '日期', minWidth: 220, templet: '#dateTpl'}
|
||
// , {title: '操作',fixed: 'right', toolbar: '#rowBarTpl', width: 240}
|
||
]
|
||
]
|
||
, url: '<?=\Yii::$app->urlManager->createUrl(['admin/balance/recharge/order-search'])?>'
|
||
, page: true
|
||
//指向自定义工具栏模板选择器
|
||
, toolbar: '#toolBarTpl'
|
||
//头部工具栏右侧的图标按钮
|
||
, defaultToolbar: []
|
||
, limit: 10
|
||
, limits: [10, 20, 30, 40, 50, 60, 70, 80, 90, 100]
|
||
, title: '<?=$this->title?>'
|
||
, data: []
|
||
, done: function (res, curr, count) {
|
||
setTimeout(function () {
|
||
$(".layui-table-main tr").each(function (index, val) {
|
||
$(".layui-table-fixed").each(function () {
|
||
$($(this).find(".layui-table-body tbody tr")[index]).height($(val).height());
|
||
});
|
||
});
|
||
$(".layui-table-header tr").each(function (index, val) {
|
||
$(".layui-table-fixed").each(function () {
|
||
$($(this).find(".layui-table-header thead tr")[index]).height($(val).height());
|
||
});
|
||
});
|
||
}, 500);
|
||
}
|
||
});
|
||
|
||
|
||
//监听工具条
|
||
table.on('tool(dtable)', function (obj) {
|
||
var row_data = obj.data;
|
||
var lay_event = obj.event;
|
||
var id = row_data.id;
|
||
var confirm_url = null;
|
||
var confirm_tip = null;
|
||
var ids = [];
|
||
ids.push(id);
|
||
|
||
if (lay_event == "cancel") {
|
||
confirm_url = "<?=\Yii::$app->urlManager->createUrl(['admin/mall/order/cancel'])?>";
|
||
confirm_tip = "确定取消此订单吗";
|
||
}
|
||
|
||
if (lay_event == "delete") {
|
||
confirm_url = "<?=\Yii::$app->urlManager->createUrl(['admin/mall/order/delete'])?>";
|
||
confirm_tip = "确定删除此订单吗";
|
||
}
|
||
if (lay_event == "finish") {
|
||
confirm_url = "<?=\Yii::$app->urlManager->createUrl(['admin/mall/order/finish'])?>";
|
||
confirm_tip = "确定将此订单变更为完成吗";
|
||
}
|
||
if (lay_event == "multi") {
|
||
confirm_url = "<?=\Yii::$app->urlManager->createUrl(['admin/mall/order/multi'])?>";
|
||
confirm_tip = "确定此订单发起分账吗";
|
||
}
|
||
if (lay_event == "search_multi") {
|
||
return search_multi(row_data)
|
||
}
|
||
|
||
if (confirm_url != null) {
|
||
layer.confirm(confirm_tip, {
|
||
btn: ['确定', '取消']
|
||
}, function () {
|
||
$.ajax(confirm_url, {
|
||
type: "POST",
|
||
dataType: "json",
|
||
data: {
|
||
ids: ids,
|
||
_csrf: _csrf
|
||
},
|
||
success: function (res) {
|
||
if (res.code == 0) {
|
||
layer.msg(res.msg, {
|
||
offset: '15px'
|
||
, icon: 1
|
||
, time: 1000
|
||
}, function () {
|
||
location.reload();
|
||
});
|
||
} else {
|
||
layer.msg(res.msg, {
|
||
offset: '15px'
|
||
, icon: 2
|
||
, time: 1000
|
||
}, function () {
|
||
});
|
||
}
|
||
},
|
||
error: function (xhr, type, err) {
|
||
layer.msg(xhr.responseText, {
|
||
offset: '15px'
|
||
, icon: 2
|
||
, time: 1000
|
||
}, function () {
|
||
});
|
||
}
|
||
})
|
||
}, function () {
|
||
});
|
||
}
|
||
});
|
||
|
||
//查询分账进度
|
||
function search_multi(data) {
|
||
var loadingMsg = layer.msg('数据请求中...', {icon: 16, shade: [0.5], scrollbar: false, time: 0});
|
||
var confirm_url = "<?=\Yii::$app->urlManager->createUrl(['admin/mall/order/search-multi2'])?>";
|
||
$.ajax(confirm_url, {
|
||
type: "POST",
|
||
dataType: "json",
|
||
data: {
|
||
id: data.id,
|
||
_csrf: _csrf
|
||
},
|
||
success: function (res) {
|
||
if (res.code == 0) {
|
||
layer.close(loadingMsg);
|
||
layer.open({
|
||
type: 1
|
||
,
|
||
title: false //不显示标题栏
|
||
,
|
||
closeBtn: false
|
||
,
|
||
area: '400px;'
|
||
,
|
||
shade: 0.8
|
||
,
|
||
id: 'LAY_layuipro' //设定一个id,防止重复弹出
|
||
,
|
||
btn: ['确认']
|
||
,
|
||
btnAlign: 'c'
|
||
,
|
||
moveType: 1 //拖拽模式,0或者1
|
||
,
|
||
content: '<div style="padding: 50px; line-height: 22px; background-color: #393D49; color: #fff; font-weight: 300;">' + res.msg + '</div>'
|
||
|
||
});
|
||
} else {
|
||
layer.msg(res.msg, {
|
||
offset: '15px'
|
||
, icon: 2
|
||
, time: 1000
|
||
}, function () {
|
||
});
|
||
}
|
||
},
|
||
error: function (xhr, type, err) {
|
||
layer.msg(xhr.responseText, {
|
||
offset: '15px'
|
||
, icon: 2
|
||
, time: 1000
|
||
}, function () {
|
||
});
|
||
}
|
||
})
|
||
}
|
||
|
||
});
|
||
|
||
<?php $this->endBlock(); ?>
|
||
</script>
|
||
<?php $this->registerJs($this->blocks['js_script_wrap'], \yii\web\View::POS_END); ?>
|
||
|