Commit 69260cac by 朱继来

整合前、后台取消订单、审核不通过接口

parent 47708db9
......@@ -557,13 +557,13 @@ Class AddOrderController extends Controller
} else {
$data['order_id'] = $request->input('order_id');
$data['operator_id'] = $request->user->userId;
$data['cancel_reason'] = '后台审核不通过';
$data['type'] = 3;
$url = Config('website.api_domain').'order/selfCancel';
$url = Config('website.api_domain').'order/cancel';
$data['k1'] = time();
$data['k2'] = md5(md5($data['k1']).'fh6y5t4rr351d2c3bryi');
$temp = json_decode(curlApi($url, $data, "POST"), true);
$event = '自营线下订单审核不通过';
......
......@@ -975,14 +975,7 @@ Class OrderController extends Controller
$order_id = $request->input('order_id', ''); //订单号
$sale_id = $request->input('sale_id', null); //对应销售
$operator_id = $request->user->userId;
$order_status = $request->input('order_status', ''); //审核通过 2 审核不通过(即取消订单) -1
$cancel_reason = $request->input('cancel_reason', '');
$order_sn = $request->input('order_sn', '');
if ($order_status == -1 && !$cancel_reason) {
return array('errcode'=>1, 'errmsg'=>'审核不通过的原因不可为空!');
}
if (!isset($sale_id)) {
return array('errcode'=>1, 'errmsg'=>'请选择订单业务员!');
......@@ -993,12 +986,12 @@ Class OrderController extends Controller
}
//用于后台订单审核
$url = Config('website.api_domain').'order/adminCheck';
$url = Config('website.api_domain').'order/cancel';
$check['k1'] = time();
$check['k2'] = md5(md5($check['k1']).'fh6y5t4rr351d2c3bryi');
$resData = array("cancel_reason"=>$cancel_reason, "order_id"=>$order_id, 'sale_id'=>$sale_id, 'status'=>$order_status, "pf"=>1, "k1"=>$check['k1'], "k2"=>$check['k2'], 'operator_id'=>$operator_id);
$resData = array("cancel_reason"=>$cancel_reason, "order_id"=>$order_id, 'sale_id'=>$sale_id, "pf"=>1, "k1"=>$check['k1'], "k2"=>$check['k2'], 'operator_id'=>$operator_id, 'type' => 3);
$temp = json_decode(curlApi($url, $resData, "POST"), true);
......@@ -1006,7 +999,7 @@ Class OrderController extends Controller
}
}
// 取消订单(仅限审核通过,未付款前)
// 联营取消订单
public function cancelPay(Request $request, $id)
{
if($request->isMethod('post')){
......@@ -1024,12 +1017,12 @@ Class OrderController extends Controller
return array('errcode'=>Error::E_NOT_EXISTS,'errmsg'=>'取消订单的原因不可为空~');
}
$url = Config('website.api_domain').'order/cancelPay';
$url = Config('website.api_domain').'order/cancel';
$check['k1'] = time();
$check['k2'] = md5(md5($check['k1']).'fh6y5t4rr351d2c3bryi');
$resData = array("pf"=>1, "k1"=>$check['k1'], "k2"=>$check['k2'], "order_id"=>$order_id, "cancel_reason"=>$cancel_reason, 'operator_id'=>$operator_id);
$resData = array("pf"=>1, "k1"=>$check['k1'], "k2"=>$check['k2'], "order_id"=>$order_id, "cancel_reason"=>$cancel_reason, 'operator_id'=>$operator_id, 'type' => 2);
$temp = json_decode(curlApi($url,$resData,"POST"), true);
......@@ -1340,7 +1333,7 @@ Class OrderController extends Controller
return $response;
}
// 取消订单
// 自营取消订单
public function ajaxSelfCancel(Request $request)
{
if ($request->isMethod('post')) {
......@@ -1348,13 +1341,13 @@ Class OrderController extends Controller
$cancel_reason = $request->input('reason');
$operator_id = $request->user->userId;
$url = Config('website.api_domain').'order/cancelPay';
$url = Config('website.api_domain').'order/cancel';
$check['k1'] = time();
$check['k2'] = md5(md5($check['k1']).'fh6y5t4rr351d2c3bryi');
$resData = array("pf"=>1, "k1"=>$check['k1'], "k2"=>$check['k2'], "order_id"=>$order_id, "cancel_reason"=>$cancel_reason, 'operator_id'=>$operator_id);
$resData = array("pf"=>1, "k1"=>$check['k1'], "k2"=>$check['k2'], "order_id"=>$order_id, "cancel_reason"=>$cancel_reason, 'operator_id'=>$operator_id, 'type' => 2);
$temp = json_decode(curlApi($url, $resData, "POST"), true);
return array('errcode'=>$temp['err_code'],'errmsg'=>$temp['err_msg']);
......@@ -1698,7 +1691,9 @@ Class OrderController extends Controller
public function checkHistroyOrder(Request $request)
{
// 查找用户订单数,并更新用户表和订单扩展表
$subQuery = OrderModel::where('is_type', '=', 0)->orderBy('order_id');
$subQuery = OrderModel::where('is_type', '=', 0)->where('status', '<>', -1)->orderBy('order_id');
DB::connection('order')->table('lie_order_extend')->update(['is_new' => 0]); // 是否新订单恢复默认值0
OrderModel::from(DB::raw("({$subQuery->toSql()}) as sub"))
->mergeBindings($subQuery->getQuery())
......
......@@ -5,9 +5,9 @@
case 2:
echo '<table class="table">
<tr>
<td>取消订单原因:</td>
<td width="10%">取消订单原因:</td>
<td>
<textarea name="" id="cancel-reason" cols="30" rows="3" placeholder="请输入取消原因"></textarea>
<textarea name="" id="cancel-reason" class="form-control" placeholder="请输入取消原因"></textarea>
</td>
</tr>
<tr><td colspan="20"><a class="btn btn-primary submit">提交</a></td></tr>
......
......@@ -605,7 +605,7 @@
<a class="btn btn-success" href="/change/{{$order_info['order_id']}}?tags=self">人工审单</a>
@endif
@if (in_array($order_info['status'], [2, 3, 4]) && !$extend && in_array('self_order_cancel', $userPerms))
@if (in_array($order_info['status'], [1, 2, 3, 4]) && !$extend && in_array('self_order_cancel', $userPerms))
<a class="btn btn-default self_cancel" href="javascript:;" data-id="{{$order_info['order_id']}}">取消订单</a>
@endif
......
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