Commit b1384976 by 朱继来

调整售后列表

parent a43d4027
......@@ -439,5 +439,12 @@ class ApiController extends Controller
$this->ExportLayui($OrderServiceModel->lists($request));
}
// 售后单操作
public function ApiOrderServiceAction($request)
{
$OrderServiceModel = new OrderServiceModel;
$this->Export($OrderServiceModel->action($request));
}
}
......@@ -1507,9 +1507,9 @@ Class OrderController extends Controller
if($request->isMethod('post')){
$data['data'] = $request->input();
$data['k1'] = time();
$data['k2'] = md5(md5($data['k1']).'fh6y5t4rr351d2c3bryi');
$data['operator_id'] = $request->user->userId;
$data['k1'] = time();
$data['k2'] = md5(md5($data['k1']).'fh6y5t4rr351d2c3bryi');
$data['operator_id'] = $request->user->userId;
$data['operator_name'] = $request->user->name;
$update_url = Config('website.api_domain').'service/apply';
......
......@@ -30,7 +30,7 @@ class OrderServiceLogModel extends Model
$log['ip'] = get_client_ip(0, true);
$log['create_time'] = time();
$actionLog = $this->insert($log);
$actionLog = self::insert($log);
if (!$actionLog) return false;
......
......@@ -4,6 +4,7 @@ namespace App\Model;
use Illuminate\Database\Eloquent\Model;
use Request;
use App\Model\UserMainModel;
use App\Model\OrderServiceLogModel;
class OrderServiceModel extends Model
{
......@@ -112,9 +113,41 @@ class OrderServiceModel extends Model
$v['service_status_val'] = array_get(Config('order_service.service_status'), $v['service_status'], '');
$v['refund_status_val'] = array_get(Config('order_service.refund_status'), $v['refund_status'], '');
$v['return_status_val'] = array_get(Config('order_service.return_status'), $v['return_status'], '');
$v['auditor_time'] = $v['auditor_time'] ? date('Y-m-d H:i:s', $v['auditor_time']) : '';
}
return $data;
}
// 操作
public function action($request)
{
$id = $request->input('id', 0);
if (!$id) return [-1, '参数缺失'];
$data = [];
$data['service_status'] = $request->input('service_status', 1);
$data['update_time'] = time();
if ($data['service_status'] == 3) {
$data['auditor_id'] = $request->user->userId;
$data['auditor_name'] = $request->user->name;
$data['auditor_time'] = time();
}
$this->where('id', $id)->update($data);
switch ($data['service_status']) {
case -1: $event = '取消申请'; break;
case 2: $event = '提交申请'; break;
case 3: $event = '审核通过申请'; break;
}
OrderServiceLogModel::addLog($id, $request->user->userId, $event);
return [0, '成功'];
}
}
\ No newline at end of file
......@@ -17,9 +17,9 @@ return [
// 退货状态
'return_status' => [
1 => '待生成',
2 => '待退款',
3 => '已退款',
1 => '无需退货',
2 => '等待入库',
3 => '已入库',
],
// 退货状态
......
......@@ -11,30 +11,34 @@ layui.use(['form', 'table', 'laydate'], function(){
elem: '#end_time' //指定元素
});
table.render({
id: 'list'
,elem: '#sample'
,url: '/api/ApiOrderServiceList' //数据接口
,method:'post'
,cellMinWidth: 80 //全局定义常规单元格的最小宽度
,page: true //开启分页
,cols: [[ //表头
{title: '序号', type: 'numbers', fixed: 'left', width: 80}
,{field: 'service_sn', title: '售后单号', width: 100}
,{field: 'order_sn', title: '订单编号', width: 150}
,{field: 'user_account', title: '用户账号', width: 100}
,{field: 'apply_name', title: '申请人', width: 120}
,{field: 'auditor_name', title: '审核人', width: 120}
,{field: 'service_status_val', title: '售后状态', width: 120}
,{field: 'refund_status_val', title: '退款状态', width: 120}
,{field: 'return_status_val', title: '退款状态', width: 120}
,{field: 'create_time', title: '申请时间', width: 180}
,{field: 'auditor_time', title: '审核时间', width: 180}
,{title: '操作', align:'center', fixed: 'right', toolbar: '#list_action', width: 200}
]]
,limit: 10
,limits: [10, 20, 50,]
});
var renderTable = function() {
table.render({
id: 'list'
,elem: '#sample'
,url: '/api/ApiOrderServiceList' //数据接口
,method:'post'
,cellMinWidth: 80 //全局定义常规单元格的最小宽度
,page: true //开启分页
,cols: [[ //表头
{title: '序号', type: 'numbers', fixed: 'left', width: 80}
,{field: 'service_sn', title: '售后单号', width: 170}
,{field: 'order_sn', title: '订单编号', width: 150}
,{field: 'user_account', title: '用户账号', width: 150}
,{field: 'apply_name', title: '申请人', width: 120}
,{field: 'auditor_name', title: '审核人', width: 120}
,{field: 'service_status_val', title: '售后状态', templet: '#status', width: 120}
,{field: 'refund_status_val', title: '退款状态', width: 120}
,{field: 'return_status_val', title: '退货状态', width: 120}
,{field: 'create_time', title: '申请时间', width: 180}
,{field: 'auditor_time', title: '审核时间', width: 180}
,{title: '操作', align:'center', fixed: 'right', toolbar: '#list_action', width: 200}
]]
,limit: 10
,limits: [10, 20, 50,]
});
};
renderTable();
form.on('submit(load)', function(data) {
//执行重载
......@@ -48,43 +52,93 @@ layui.use(['form', 'table', 'laydate'], function(){
return false;
});
// 导出
$('.export').click(function() {
var account = $('input[name=account]').val(),
goods_name = $('input[name=goods_name]').val(),
order_sn = $('input[name=order_sn]').val(),
begin_time = $('input[name=begin_time]').val(),
end_time = $('input[name=end_time]').val(),
url = '/export/selfSampleExport';
if (!account && !goods_name && !order_sn && !begin_time && !end_time) {
layer.msg('请选择筛选条件');
return false;
// tool操作
table.on('tool(list)', function(obj){ //注:tool是工具条事件名,test是table原始容器的属性lay-filter="对应的值"
var data = obj.data; //获得当前行数据
var layEvent = obj.event; //获得 lay-event 对应的值(也可以是表头的 event 参数对应的值)
var tr = obj.tr; //获得当前行 tr 的DOM对象
var title = '';
var content = '';
var url = '/api/ApiOrderServiceAction';
var datax = [];
if(layEvent === 'submit'){ // 提交
title = '提交申请';
content = '确定提交该申请吗?';
datax = {id: data.id, service_status: 2};
} else if(layEvent === 'audit'){ // 审核
title = '审核申请';
content = '确定审核该申请吗?';
datax = {id: data.id, service_status: 3};
}else if(layEvent === 'cancel'){ // 取消
title = '取消申请';
content = '确定取消该申请吗?';
datax = {id: data.id, service_status: -1};
}
layer.confirm('确定导出数据吗?', {
title: '导出数据'
,btn: ['确定', '取消']
}, function(){
layer.closeAll('dialog'); // 确定时关闭弹框
window.location.href = url+'?account='+account+'&goods_name='+goods_name+'&order_sn='+order_sn+'&begin_time='+begin_time+'&end_time='+end_time;
});
})
layer.open({
title: title,
content: content,
btn: ['确认', '取消'],
yes: function(index) {
$.ajax({
url : url,
type: 'post',
data: datax,
dataType: 'json',
success: function(resp) {
console.log(resp)
if (resp.errcode == 0) {
layer.msg(resp.errmsg);
renderTable(); // 重新加载table
$('.search').trigger("click"); // 触发搜索按钮
// 工具尺邀约记录导出
$('.invite_export').click(function() {
var url = '/export/rulesInviteExport';
return false;
}
layer.confirm('确定导出数据吗?', {
title: '导出数据'
,btn: ['确定', '取消']
}, function(){
layer.closeAll('dialog'); // 确定时关闭弹框
layer.alert(resp.errmsg);
},
error: function(err) {
console.log(err)
}
})
layer.msg(title+'中...', {icon: 16, time: 0, shade: 0.3}); // 阻止重复提交
return false;
},
cancel: function(index) {
layer.close(index);
}
})
});
// 导出
// $('.export').click(function() {
// var account = $('input[name=account]').val(),
// goods_name = $('input[name=goods_name]').val(),
// order_sn = $('input[name=order_sn]').val(),
// begin_time = $('input[name=begin_time]').val(),
// end_time = $('input[name=end_time]').val(),
// url = '/export/selfSampleExport';
// if (!account && !goods_name && !order_sn && !begin_time && !end_time) {
// layer.msg('请选择筛选条件');
// return false;
// }
// layer.confirm('确定导出数据吗?', {
// title: '导出数据'
// ,btn: ['确定', '取消']
// }, function(){
// layer.closeAll('dialog'); // 确定时关闭弹框
window.location.href = url;
});
})
// window.location.href = url+'?account='+account+'&goods_name='+goods_name+'&order_sn='+order_sn+'&begin_time='+begin_time+'&end_time='+end_time;
// });
// })
});
\ No newline at end of file
......@@ -104,6 +104,28 @@
<table id="sample" lay-filter="list"></table>
<script type="text/html" id="status">
@{{# if (d.service_status == 3) { }}
<div style="color:green;">已审核</div>
@{{# } else if (d.service_status == 2) { }}
<div style="color:red;">待审核</div>
@{{# } else if (d.service_status == 1) { }}
<div style="color:red;">待提交</div>
@{{# } else { }}
<div style="color:#ccc;">已取消</div>
@{{# } }}
</script>
<script type="text/html" id="list_action">
<a class="btn btn-xs btn-info" href="/web/selfSampleLog?user_id=@{{ d.user_id }}" target="_blank">领取和邀约记录</a>
<a class="btn btn-xs btn-outline btn-info" href="/web/orderServiceDetails?user_id=@{{ d.user_id }}&id=@{{ d.id }}" target="_blank">详情</a>
@{{# if (d.service_status == 1) { }}
<a class="btn btn-xs btn-outline btn-success" lay-event="submit">提交</a>
<a class="btn btn-xs btn-outline btn-danger" lay-event="cancel">取消</a>
@{{# } else if (d.service_status == 2) { }}
<a class="btn btn-xs btn-outline btn-success" lay-event="audit">审核</a>
<a class="btn btn-xs btn-outline btn-danger" lay-event="cancel">取消</a>
@{{# } }}
</script>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment