326 lines
13 KiB
PHP
326 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;
|
||
|
||
$status_labels = Order::statusLabels();
|
||
$status = \Yii::$app->request->get('status');
|
||
$cat_id = \Yii::$app->request->get('cat_id');
|
||
?>
|
||
<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-inline layui-form-item">
|
||
<div class="layui-input-inline">
|
||
<select class="layui-select" name="status">
|
||
<option value="" <?=$status === null ? 'selected' : ''?>>全部状态</option>
|
||
<?php foreach ($status_labels as $key => $val):?>
|
||
<option value="<?=$key?>" <?=$status == $key && $status != null ? 'selected' : ''?>><?=$val?></option>
|
||
<?php endforeach;?>
|
||
</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>
|
||
</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 layui-hide" lay-event="cancel">取消</button>
|
||
{{# } }}
|
||
{{# if(d.earnings >= '1'){ }}
|
||
<button class="layui-btn layui-btn-xs layui-bg-blue layui-hide" lay-event="search_multi">分账查询</button>
|
||
{{# } }}
|
||
{{# if(d.earnings == '0' || d.earnings == '2'){ }}
|
||
<button class="layui-btn layui-btn-xs layui-bg-blue layui-hide" lay-event="multi">手动分账</button>
|
||
{{# } }}
|
||
<button class="layui-btn layui-btn-xs layui-btn-danger" lay-event="delete">删除</button>
|
||
</script>
|
||
|
||
|
||
<script type="text/html" id="statusTpl">
|
||
{{# if(d.state == '0'){ }}
|
||
<span class="layui-badge layui-bg-orange">待支付</span>
|
||
{{# } else if(d.state == '1'){ }}
|
||
<span class="layui-badge layui-bg-green">已支付</span>
|
||
{{# } else if(d.state == '2'){ }}
|
||
<span class="layui-badge layui-bg-red">已取消</span>
|
||
{{# } else if(d.state == '3'){ }}
|
||
<span class="layui-badge layui-bg-blue">已完成</span>
|
||
{{# } }}
|
||
</script>
|
||
<script type="text/html" id="earningsTpl">
|
||
{{# if(d.earnings != '-1'){ }}
|
||
<span>金额:{{d.earnings_money}}</span><br>
|
||
{{# } }}
|
||
<span>分账进度:{{d.earnings_cn}}</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.updated_at_cn}}</span>
|
||
</script>
|
||
<script type="text/html" id="ordernoTpl">
|
||
<span>购买订单号:{{d.order_no}}</span><br>
|
||
<span>分账订单号:{{d.psOrderMulti_cn}}</span><br>
|
||
<!-- <span class="layui-badge layui-bg-blue">完结订单号:{{d.psOrderFinish_cn}}</span>-->
|
||
</script>
|
||
|
||
<script>
|
||
<?php $this->beginBlock('js_script_wrap') ?>
|
||
layui.config({
|
||
base: '/statics/layuiadmin/' //静态资源所在路径
|
||
}).extend({
|
||
index: 'lib/index' //主入口模块
|
||
}).use(['index', 'user', 'table','form'], function () {
|
||
var $ = layui.$
|
||
, form = layui.form
|
||
, table = layui.table
|
||
, admin = layui.admin;
|
||
|
||
|
||
form.render();
|
||
|
||
//search
|
||
form.on('submit(dtable-search)', function (obj) {
|
||
var field = obj.field;
|
||
reload_table_data(field);
|
||
});
|
||
|
||
|
||
|
||
//重新加载表格数据
|
||
function reload_table_data(conf){
|
||
table.reload('dtable', {
|
||
url:'<?=\Yii::$app->urlManager->createUrl(['store/mall/order/index'])?>'
|
||
,page: true
|
||
,where: conf
|
||
});
|
||
};
|
||
|
||
//执行渲染
|
||
table.render({
|
||
//指定原始表格元素选择器(推荐id选择器)
|
||
elem: '#dtable'
|
||
//容器高度
|
||
//,height: 315
|
||
//容器宽度
|
||
//,width: 720
|
||
//设置表头
|
||
,cols: [[
|
||
{checkbox: true}
|
||
, {field: 'id', title: 'ID', width: 80}
|
||
, {field: 'order_no', title: '订单号',templet:'#ordernoTpl', minWidth: 220}
|
||
, {field: 'total_price', title: '租赁金额', minWidth: 100}
|
||
, {field: 'yh_price', title: '优惠金额', minWidth: 100}
|
||
, {field: 'total_pay_price', title: '实付金额', minWidth: 100}
|
||
, {field: 'mobile_phone', title: '下单用户',templet:'#phoneTpl', minWidth: 220}
|
||
, {field: 'store_name', title: '门店', minWidth: 320}
|
||
, {field: 'plugin_sign_cn', title: '购买服务', width: 100}
|
||
, {field: 'state', title: '状态', templet:'#statusTpl', width: 100}
|
||
// , {field: 'earnings', title: '门店收益(元)',templet:'#earningsTpl'}
|
||
, {field: 'created_at_cn', title: '起始时间', minWidth: 220, templet:'#dateTpl'}
|
||
// , {title: '操作',fixed: 'right', toolbar: '#rowBarTpl', width:100}
|
||
]
|
||
]
|
||
, url:'<?=\Yii::$app->urlManager->createUrl(['store/mall/order/index'])?>'
|
||
, page:true
|
||
//指向自定义工具栏模板选择器
|
||
, toolbar:'#toolBarTpl'
|
||
//头部工具栏右侧的图标按钮
|
||
, defaultToolbar:['filter', 'print', 'exports']
|
||
, 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(['store/mall/order/cancel'])?>";
|
||
confirm_tip = "确定取消此订单吗";
|
||
}
|
||
|
||
if(lay_event == "delete"){
|
||
confirm_url = "<?=\Yii::$app->urlManager->createUrl(['store/mall/order/delete'])?>";
|
||
confirm_tip = "确定删除此订单吗";
|
||
}
|
||
if(lay_event == "finish"){
|
||
confirm_url = "<?=\Yii::$app->urlManager->createUrl(['store/mall/order/finish'])?>";
|
||
confirm_tip = "确定将此订单变更为完成吗";
|
||
}
|
||
if(lay_event == "multi"){
|
||
confirm_url = "<?=\Yii::$app->urlManager->createUrl(['store/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(['store/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); ?>
|
||
|