Commit b8dda9f1 by 朱继来

填写取消订单原因

parent 1165eae3
......@@ -347,6 +347,7 @@ Class OrderController extends Controller
$info['user_count'] = $response['data']['user_count'];
$info['paid_user_count'] = $response['data']['paid_user_count'];
$info['paid_order_count'] = $response['data']['paid_order_count'];
$info['noreason_count'] = $response['data']['noreason_count'];
$info['page'] = $show;
return $info;
......@@ -1071,6 +1072,30 @@ Class OrderController extends Controller
return redirect('/change/'.$id);
}
// 填写订单取消原因
public function ajaxInputCancelReason(Request $request)
{
if ($request->isMethod('post')) {
$order_id = $request->input('order_id');
$cancel_reason = $request->input('cancel_reason');
$update = DB::connection('order')->table('lie_order')->where('order_id', $order_id)->update(['cancel_reason' => $cancel_reason]);
if (!$update) return ['errcode' => -1, 'errmsg' => '填写订单取消原因失败'];
// 操作记录
$log['order_id'] = $order_id;
$log['operator_id'] = $request->user->userId;
$log['operator_type'] = 2;
$log['event'] = '再次调价';
$log['ip'] = get_client_ip();
$log['create_time'] = time();
DB::connection('order')->table('lie_order_action_log')->insert($log);
return ['errcode' => 0, 'errmsg' => '填写订单取消原因成功'];
}
}
// 申请再次调价
public function applyAdjust(Request $request, $id)
{
......
......@@ -75,6 +75,8 @@ Route::group(['middleware' => 'web'], function () {
Route::match(['get', 'post'], '/tempcount', 'OrderController@tempCount');
Route::post('/ajaxDownloadContract', 'OrderController@ajaxDownloadContract');
Route::post('/ajaxInputCancelReason', 'OrderController@ajaxInputCancelReason');
});
......
......@@ -230,6 +230,72 @@
})
})
// 填写订单取消原因
$('.input-cancel-reason').click(function(){
var self = $(this);
var order_id = self.data('oid');
var content = '<div class="form-group">'+
'<div class="input-radio">'+
'<label class="radio-inline"><input type="radio" name="cancel_reason" value="平台信任度问题">平台信任度问题</label>'+
'<label class="radio-inline"><input type="radio" name="cancel_reason" value="商品质量不放心">商品质量不放心</label>'+
'<label class="radio-inline"><input type="radio" name="cancel_reason" value="价格问题">价格问题</label>'+
'<label class="radio-inline"><input type="radio" name="cancel_reason" value="货期问题">货期问题</label>'+
'<label class="radio-inline"><input type="radio" name="cancel_reason" value="配套服务问题">配套服务问题</label>'+
'<label class="radio-inline"><input type="radio" name="cancel_reason" value="1">其他</label>'+
'</div>'+
'<div class="input-other-reason">'+
'<textarea class="form-control" name="input-other-reason" placeholder="请填写其他原因"></textarea>'+
'</div>'+
'</div>';
layer.open({
area: ['650px', '220px'],
title: '填写订单取消原因',
content: content,
btn:['确认', '取消'],
btn1:function(){
var cancel_reason = $('input[name=cancel_reason]:checked').val();
var other_reason = $('textarea[name=input-other-reason]').val();
if (cancel_reason == null) {
layer.tips('请选择取消原因', $('.input-radio'));
return false;
} else if (cancel_reason == 1) {
if (other_reason == '') {
layer.tips('请填写其他原因', $('.input-other-reason'));
return false;
} else {
cancel_reason = other_reason;
}
}
$.ajax({
url:'/ajaxInputCancelReason',
data: {order_id : order_id, cancel_reason:cancel_reason},
type:'post',
dataType: 'json',
success:function(resp){
if(resp.errcode == 0){
self.remove();
layer.msg(resp.errmsg);
layer.close();
} else {
layer.alert(resp.errmsg);
}
},
error:function(){
layer.alert('网络异常');
}
});
},
btn2:function(index){
layer.close(index);
}
})
})
// 切换类型时,清空输入框内容
$('.dropdown-menu>li').click(function(){
var val = $(this).data('val'); // 当前值
......
......@@ -425,7 +425,6 @@
</tfoot>
</table>
</div>
......@@ -477,9 +476,10 @@
</div>
</div>
@if (!empty($order_temp_info) && $order_temp_info['status'] == 2)
@if ((!empty($order_temp_info) && $order_temp_info['status'] == 2) || $order_info['status'] == -1)
<div class="tabs-box">
<table class="table table-bordered table-hover">
@if (!empty($order_temp_info) && $order_temp_info['status'] == 2)
<tr>
<td width="10%">是否为新用户:</td>
<td>{{ $order_temp_info['is_newclient'] == 1 ? '是' : '否' }}</td>
......@@ -488,6 +488,14 @@
<td>{{ $order_temp_info['client_source'] }}</td>
@endif
</tr>
@endif
@if ($order_info['status'] == -1)
<tr>
<td width="10%">订单取消原因:</td>
<td>{{ $order_info['cancel_reason'] }}</td>
</tr>
@endif
</table>
</div>
@endif
......
......@@ -290,7 +290,11 @@
?>
@if (in_array('download_contract', $userPerms))
<a class="btn btn-info download-contract" data-id="{{$v['order_id']}}" href="javascript:;">下载合同</a>
<a class="btn btn-default download-contract" data-id="{{$v['order_id']}}" href="javascript:;">下载合同</a>
@endif
@if ($v['status'] == -1 && !$v['cancel_reason'])
<a class="btn btn-danger input-cancel-reason" href="javascript:;" data-oid="{{$v['order_id']}}">填写取消原因</a>
@endif
</div>
</td>
......@@ -394,12 +398,16 @@
付款用户数为{{$paid_user_count}}人,
应付金额 ¥{{$pay_count['rmb_count'] ? $pay_count['rmb_count'] : 0}}, ${{$pay_count['usd_count'] ? $pay_count['usd_count'] : 0}},
实收金额 ¥{{$pay_count['rmb_pay'] ? $pay_count['rmb_pay'] : 0}},
${{$pay_count['usd_pay'] ? $pay_count['usd_pay'] : 0}}
${{$pay_count['usd_pay'] ? $pay_count['usd_pay'] : 0}},
@if ($noreason_count)
<span class="error">共有{{$noreason_count}}单已取消订单未填写取消原因</span>
@endif
</span>
@endif
<?php echo $page; ?>
</div>
<div class="hide" id="sale-container">
<div class="sales">
<table class="table">
......
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