Commit d05e9d14 by 朱继来

fix

parents 0b174978 3e5ffe84
...@@ -284,6 +284,23 @@ function getSupplierName($key) ...@@ -284,6 +284,23 @@ function getSupplierName($key)
return $supp_info; return $supp_info;
} }
// 获取自营库存
function getSelfStock($goods_id)
{
if (!$goods_id) return '商品ID不存在';
$url = Config('website.self-stock-url');
$data['sku_id'] = $goods_id;
$response = json_decode(curlApi($url, $data, 'POST'), true);
if ($response['errcode'] == 0) {
return $response['data']['stock'];
} else {
return '未找SKU信息';
}
}
Class OrderController extends Controller Class OrderController extends Controller
{ {
// 首页 // 首页
...@@ -383,6 +400,7 @@ Class OrderController extends Controller ...@@ -383,6 +400,7 @@ Class OrderController extends Controller
$map['time_start'] = $request->input('time_start', ''); $map['time_start'] = $request->input('time_start', '');
$map['time_end'] = $request->input('time_end', ''); $map['time_end'] = $request->input('time_end', '');
$map['order_status'] = $request->input('order_status', ''); $map['order_status'] = $request->input('order_status', '');
$map['sale_type'] = $request->input('sale_type', '');
$map['shipping_name'] = $request->input('shipping_name', ''); $map['shipping_name'] = $request->input('shipping_name', '');
$map['order_send'] = $request->input('order_send', ''); $map['order_send'] = $request->input('order_send', '');
$map['test_order'] = $request->input('test_order', ''); $map['test_order'] = $request->input('test_order', '');
...@@ -969,21 +987,21 @@ Class OrderController extends Controller ...@@ -969,21 +987,21 @@ Class OrderController extends Controller
// 详情页 // 详情页
public function templateData(Request $request, $id, $view_id) public function templateData(Request $request, $id, $view_id)
{ {
$data = $this->orderDetail($request, $id); $info = $this->orderDetail($request, $id);
if ($data['order_info']['order_goods_type'] == 2 && in_array($data['order_info']['order_type'], [1, 3])) { // 平台自营订单 if ($info['order_info']['order_goods_type'] == 2 && in_array($info['order_info']['order_type'], [1, 3])) { // 平台自营订单
if ($request->input('tags') != 'self') { if ($request->input('tags') != 'self') {
return redirect('self_order'); // URL重定向 return redirect('self_order'); // URL重定向
} else { } else {
$this->selfOtherData($data, $id); $this->selfOtherData($info, $id);
} }
} }
return view($view_id, $data); return view($view_id, $info);
} }
// 详情页自营其他数据 // 详情页自营其他数据
public function selfOtherData(&$data, $order_id) public function selfOtherData(&$info, $order_id)
{ {
$shipping = DB::connection('order')->table('lie_shipping')->select('shipping_id', 'shipping_name')->get(); $shipping = DB::connection('order')->table('lie_shipping')->select('shipping_id', 'shipping_name')->get();
...@@ -992,14 +1010,12 @@ Class OrderController extends Controller ...@@ -992,14 +1010,12 @@ Class OrderController extends Controller
$shippingInfo[$v->shipping_id] = $v->shipping_name; $shippingInfo[$v->shipping_id] = $v->shipping_name;
} }
$data['shippings'] = $shippingInfo; $info['shippings'] = $shippingInfo;
} }
$extend = DB::connection('order')->table('lie_order_extend')->where(['order_id' => $order_id, 'order_type' => 3])->first(); $extend = DB::connection('order')->table('lie_order_extend')->where(['order_id' => $order_id, 'order_type' => 3])->first(); // 自营线下订单
$data['extend'] = $extend ? $extend : ''; $info['extend'] = $extend ? $extend : '';
return $data;
} }
// 外部引用 // 外部引用
...@@ -1013,6 +1029,14 @@ Class OrderController extends Controller ...@@ -1013,6 +1029,14 @@ Class OrderController extends Controller
{ {
$info = $this->orderDetail($request, $id); $info = $this->orderDetail($request, $id);
if ($info['order_info']['order_goods_type'] == 2 && in_array($info['order_info']['order_type'], [1, 3])) { // 平台自营订单
if ($request->input('tags') != 'self') {
return redirect('self_order'); // URL重定向
} else {
$this->selfOtherData($info, $id);
}
}
// 账期订单跳转到详情页 // 账期订单跳转到详情页
if ($info['order_info']['status'] == 4) { if ($info['order_info']['status'] == 4) {
return redirect('/details/'.$id); return redirect('/details/'.$id);
...@@ -1224,36 +1248,30 @@ Class OrderController extends Controller ...@@ -1224,36 +1248,30 @@ Class OrderController extends Controller
errorLog(Error::E_FORBIDDEN, '该订单无法再进行调价操作'); errorLog(Error::E_FORBIDDEN, '该订单无法再进行调价操作');
return redirect('/prompt')->with(['message'=>"该订单无法再进行调价操作",'url' =>'/details/'.$id, 'jumpTime'=>3,'status'=>false]); return redirect('/prompt')->with(['message'=>"该订单无法再进行调价操作",'url' =>'/details/'.$id, 'jumpTime'=>3,'status'=>false]);
} }
$url = Config('website.api_domain').'order/applyAdjust';
$data['confirm_time'] = 0; $check['k1'] = time();
$data['pay_time'] = 0; $check['k2'] = md5(md5($check['k1']).'fh6y5t4rr351d2c3bryi');
$data['status'] = 1;
// $data['sale_id'] = 0; // 再次调价调整sale_id
$update = DB::connection('order')->table('lie_order')->where('order_id', $id)->update($data); $resData = array("order_id"=>$id, "pf"=>1, "k1"=>$check['k1'], "k2"=>$check['k2'], "operator_id" => $request->user->userId);
if (!$update) { $temp = json_decode(curlApi($url, $resData, "POST"), true);
errorLog(Error::E_UPDATE_FAILED, '调价操作更新数据失败');
return redirect('/prompt')->with(['message'=>"调价操作更新数据失败!",'url' =>'/details/'.$id, 'jumpTime'=>3,'status'=>false]);
}
$extend = DB::connection('order')->table('lie_order_extend')->where(['order_id' => $id])->first(); // url 标签
$tags = $request->input('tags', '');
if ($extend) {
// 调价失败临时表状态更改
DB::connection('order')->table('lie_order_extend')->where(['order_id' => $id])->update(['status' => 0]);
}
// 操作记录 if ($tags) {
$log['order_id'] = $id; $param = '?tags='.$tags;
$log['operator_id'] = $request->user->userId; } else {
$log['operator_type'] = 2; $param = '';
$log['event'] = '再次调价'; }
$log['ip'] = get_client_ip();
$log['create_time'] = time();
DB::connection('order')->table('lie_order_action_log')->insert($log);
return redirect('/change/'.$id); if ($temp['err_code'] == 0) {
return redirect('/change/'.$id.$param);
} else {
return redirect('/prompt')->with(['message'=>$temp['err_msg'],'url' =>'/details/'.$id.$param, 'jumpTime'=>3,'status'=>false]);
}
} }
// 填写订单取消原因 // 填写订单取消原因
......
...@@ -98,6 +98,9 @@ Route::group(['middleware' => 'web'], function () { ...@@ -98,6 +98,9 @@ Route::group(['middleware' => 'web'], function () {
Route::post('/ajax/create', 'AddOrderController@create'); Route::post('/ajax/create', 'AddOrderController@create');
Route::get('/addorder/success', 'AddOrderController@success'); Route::get('/addorder/success', 'AddOrderController@success');
Route::post('/ajax/selfCheck', 'AddOrderController@selfCheck'); Route::post('/ajax/selfCheck', 'AddOrderController@selfCheck');
Route::post('/ajax/switchSaleType', 'AddOrderController@switchSaleType');
Route::post('/ajax/checkStock', 'AddOrderController@checkStock');
Route::match(['get', 'post'],'/web/{key}', 'WebController@info'); Route::match(['get', 'post'],'/web/{key}', 'WebController@info');
Route::match(['get', 'post'],'/api/{key}', 'ApiController@Entrance'); Route::match(['get', 'post'],'/api/{key}', 'ApiController@Entrance');
......
...@@ -28,8 +28,4 @@ ...@@ -28,8 +28,4 @@
'账期管理' => [ '账期管理' => [
'申请列表' => ['order_account_apply_check'], '申请列表' => ['order_account_apply_check'],
], ],
<<<<<<< HEAD
=======
>>>>>>> zjl_qihuo_20181015
]; ];
\ 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