271 lines
11 KiB
PHP
271 lines
11 KiB
PHP
<?php
|
||
|
||
/**
|
||
* @author Any
|
||
* @description KISS
|
||
* @date 2020-11-5
|
||
* @version 1.0.0
|
||
*
|
||
* _____LOG_____
|
||
*
|
||
*/
|
||
|
||
use yii\widgets\LinkPager;
|
||
use app\models\User;
|
||
|
||
$this->title = '签约列表';
|
||
$this->params['breadcrumbs'][] = $this->title;
|
||
$status = \Yii::$app->request->get('status');
|
||
?>
|
||
<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">
|
||
|
||
</div>
|
||
<div class="layui-inline layui-float-right layui-form">
|
||
<div class="layui-inline layui-form-item">
|
||
<div class="layui-inline">
|
||
<div class="layui-input-inline">
|
||
<input type="text" name="order_no" placeholder="订单号" autocomplete="off"
|
||
class="layui-input" value="<?= \Yii::$app->request->get("order_no") ?>">
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div class="layui-inline layui-form-item">
|
||
<div class="layui-input-inline">
|
||
<select class="layui-select" name="status">
|
||
<option value="" <?= $status === null ? 'selected' : '' ?>>全部</option>
|
||
<option value="0" <?= $status === 0 ? 'selected' : '' ?>>待支付</option>
|
||
<option value="1" <?= $status === 1 ? 'selected' : '' ?>>待签约</option>
|
||
<option value="2" <?= $status === 2 ? 'selected' : '' ?>>已签约</option>
|
||
<option value="3" <?= $status === 3 ? 'selected' : '' ?>>签约失败</option>
|
||
<option value="4" <?= $status === 4 ? 'selected' : '' ?>>已取消</option>
|
||
|
||
</select>
|
||
</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="status">
|
||
{{# if(d.status == 0){ }}
|
||
<span class="layui-badge-rim">待支付</span>
|
||
{{# } else if(d.status == 1){ }}
|
||
<span class="layui-badge-rim">待签约</span>
|
||
{{# } else if(d.status == 2){ }}
|
||
<span class="layui-badge-rim">已签约</span>
|
||
{{# } else if(d.status == 3){ }}
|
||
<span class="layui-badge-rim">签约失败</span>
|
||
{{# } else if(d.status == 4){ }}
|
||
<span class="layui-badge-rim">已取消</span>
|
||
{{# } }}
|
||
</script>
|
||
|
||
<!--行操作列模板-->
|
||
<script type="text/html" id="rowBarTpl">
|
||
{{# if(d.status == 1){ }}
|
||
<a href="javascript:;" class="layui-btn layui-btn-normal layui-btn-xs" lay-event="signing">通过</a>
|
||
<a href="javascript:;" class="layui-btn layui-btn-normal layui-btn-xs" lay-event="refund">退款</a>
|
||
{{# } }}
|
||
</script>
|
||
|
||
<script>
|
||
<?php $this->beginBlock('js_script_wrap') ?>
|
||
layui.config({
|
||
base: '/statics/layuiadmin/' //静态资源所在路径
|
||
}).extend({
|
||
index: 'lib/index' //主入口模块
|
||
}).use(['index', 'user', 'table', 'util'], 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(['admin/signing/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: '订单号'}
|
||
, {field: 'username', title: '用户名'}
|
||
, {field: 'goods_name', title: '商品名称'}
|
||
, {field: 'moy', title: '订单金额'}
|
||
, {field: 'company_name', title: '公司名称'}
|
||
, {field: 'brand_name', title: '品牌名称'}
|
||
, {field: 'product', title: '主营产品'}
|
||
, {field: 'type', title: '业务类型'}
|
||
, {field: 'company_name', title: '公司名称'}
|
||
, {field: 'number', title: '签约年限/数量'}
|
||
, {field: 'remark', title: '备注'}
|
||
, {field: 'status', title: '订单状态', templet: '#status'}
|
||
, {
|
||
field: 'create_time', title: '创建时间', templet: function (d) {
|
||
return layui.util.toDateString(d.create_time * 1000, 'yyyy-MM-dd HH:mm:ss');
|
||
}
|
||
},
|
||
{title: '操作', fixed: 'right', toolbar: '#rowBarTpl',width: 150}
|
||
]
|
||
]
|
||
, url: '<?=\Yii::$app->urlManager->createUrl(['admin/signing/index'])?>'
|
||
, page: true
|
||
//指向自定义工具栏模板选择器
|
||
, toolbar: '#toolBarTpl'
|
||
//头部工具栏右侧的图标按钮
|
||
, defaultToolbar: []
|
||
, limit: 20
|
||
, limits: [10, 20, 30, 40, 50, 60, 70, 80, 90, 100]
|
||
, title: '<?=$this->title?>'
|
||
, data: []
|
||
});
|
||
//监听工具栏
|
||
table.on('tool(dtable)', function (obj) {
|
||
var lay_event = obj.event;
|
||
if (lay_event == 'refund') {
|
||
|
||
confirm_url = '<?=\Yii::$app->urlManager->createUrl(["/admin/signing/refund"])?>';
|
||
|
||
layer.confirm('<input type="text" id="tuihuan" required placeholder="请输入退款理由" autocomplete="off" class="layui-input">', {
|
||
title: '确定退款?',
|
||
btn: ['确定', '取消'],
|
||
|
||
}, function () {
|
||
var reason = $('#tuihuan').val();
|
||
if (reason == ''){
|
||
return false;
|
||
}
|
||
|
||
$.ajax(confirm_url, {
|
||
type: "POST",
|
||
dataType: "json",
|
||
data: {
|
||
id: obj.data.id,
|
||
reason:reason,
|
||
_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 () {
|
||
});
|
||
|
||
return;
|
||
}
|
||
if (lay_event == 'signing') {
|
||
confirm_tip = '确定通过签约?';
|
||
confirm_url = '<?=\Yii::$app->urlManager->createUrl(["/admin/signing/signing"])?>';
|
||
}
|
||
if (confirm_url != null) {
|
||
layer.confirm(confirm_tip, {
|
||
btn: ['确定', '取消']
|
||
}, function () {
|
||
$.ajax(confirm_url, {
|
||
type: "POST",
|
||
dataType: "json",
|
||
data: {
|
||
id: obj.data.id,
|
||
_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 () {
|
||
});
|
||
}
|
||
})
|
||
|
||
});
|
||
<?php $this->endBlock(); ?>
|
||
</script>
|
||
<?php $this->registerJs($this->blocks['js_script_wrap'], \yii\web\View::POS_END); ?>
|