Commit 827fd2c4 by 朱继来

Merge branch 'master' of http://119.23.72.7/zhujilai/Order into zjl_brand_20200608

parents 33587241 c7d0c372
Showing with 5396 additions and 1216 deletions
...@@ -309,7 +309,12 @@ Class AddOrderController extends Controller ...@@ -309,7 +309,12 @@ Class AddOrderController extends Controller
{ {
if ($request->isMethod('post')) { if ($request->isMethod('post')) {
$url = Config('website.search-skuid'); $url = Config('website.search-skuid');
$data['id'] = $request->input('sku_id'); $data['id'] = $request->input('sku_id');
$user_id = $request->input('user_id', 0);
if ($user_id) {
$data['uid'] = $user_id;
}
$data['k1'] = time(); $data['k1'] = time();
$data['k2'] = md5(md5($data['k1']).'fh6y5t4rr351d2c3bryi'); $data['k2'] = md5(md5($data['k1']).'fh6y5t4rr351d2c3bryi');
...@@ -870,6 +875,7 @@ Class AddOrderController extends Controller ...@@ -870,6 +875,7 @@ Class AddOrderController extends Controller
{ {
if ($request->isMethod('post')) { if ($request->isMethod('post')) {
$add_type = $request->input('add_type', ''); // 新增类型 $add_type = $request->input('add_type', ''); // 新增类型
$goods_type = $request->input('goods_type', 1); // 商品类型
if ($add_type) { if ($add_type) {
$data['add_goods_name'] = $request->input('add_goods_name', ''); $data['add_goods_name'] = $request->input('add_goods_name', '');
...@@ -891,11 +897,20 @@ Class AddOrderController extends Controller ...@@ -891,11 +897,20 @@ Class AddOrderController extends Controller
$data['add_type'] = $add_type; $data['add_type'] = $add_type;
$data['operator_id'] = $request->user->userId; $data['operator_id'] = $request->user->userId;
$url = Config('website.order_api_domain').'/order/addgoods'; if ($goods_type == 1 && !$add_type) {
$data['k1'] = time();
$data['k2'] = md5(md5($data['k1']).'fh6y5t4rr351d2c3bryi');
$url = Config('website.api_domain').'/order/jointaddgoods';
$res = json_decode(curlApi($url, $data, 'post'), true);
$response = json_decode(curlApi($url, $data, 'post'), true); return ['errcode' => $res['err_code'], 'errmsg' => $res['err_msg'], 'data' => $res['data']];
}
$url = Config('website.order_api_domain').'/order/addgoods';
$res = json_decode(curlApi($url, $data, 'post'), true);
return ['errcode' => $response['errcode'], 'errmsg' => $response['errmsg']]; return ['errcode' => $res['errcode'], 'errmsg' => $res['errmsg']];
} }
} }
......
...@@ -493,6 +493,15 @@ Class OrderController extends Controller ...@@ -493,6 +493,15 @@ Class OrderController extends Controller
$perm = new PermController; $perm = new PermController;
$sale_list = $perm->getUserByDepartmentId(Config('perm_args.sales_department_id')); // 获取所有的销售 $sale_list = $perm->getUserByDepartmentId(Config('perm_args.sales_department_id')); // 获取所有的销售
if ($tid == 1) {
$info['buyers'] = $perm->getUserByCondition('', 39); // 获取采购员, ID - 39
$all_sales = $perm->getUserByDepartmentId(Config('perm_args.sales_department_id'), 0); // 获取所有在职的销售
$info['cc_sales'] = $all_sales ? array_merge($info['buyers'], $all_sales) : $info['buyers'];
} else {
$admin = (object) array('userId' => 1000, 'name' => 'admin', 'status' => 0);
array_unshift($sale_list, $admin);
}
//获取订单列表 //获取订单列表
$url = Config('website.api_domain').'order/getAllOrder'; $url = Config('website.api_domain').'order/getAllOrder';
...@@ -679,7 +688,7 @@ Class OrderController extends Controller ...@@ -679,7 +688,7 @@ Class OrderController extends Controller
public function templateData(Request $request, $id, $view_id) public function templateData(Request $request, $id, $view_id)
{ {
$info = $this->orderDetail($request, $id); $info = $this->orderDetail($request, $id);
$this->pageHeader($request, $info, '订单详情'); $this->pageHeader($request, $info, '订单详情');
if ($info['order_info']['order_goods_type'] == 2 && in_array($info['order_info']['order_type'], [1, 3])) { // 平台自营订单 if ($info['order_info']['order_goods_type'] == 2 && in_array($info['order_info']['order_type'], [1, 3])) { // 平台自营订单
...@@ -772,19 +781,14 @@ Class OrderController extends Controller ...@@ -772,19 +781,14 @@ Class OrderController extends Controller
} }
} else { } else {
$perm = new PermController; $perm = new PermController;
$info['buyers'] = $perm->getRoleUsers($request, '采购员'); // $info['buyers'] = $perm->getRoleUsers($request, '采购员');
$info['buyers'] = $perm->getUserByDepartmentId(8, 0); // 采购部
} }
// 账期订单跳转到详情页 // 非待审核、待付款则跳转到列表页
if ($info['order_info']['status'] == 4) { if(!in_array($info['order_info']['status'], [1, 2])){
return redirect('/details/'.$id); $redirect_url = $info['order_info']['order_goods_type'] == 1 ? '/list' : '/self_order';
} return redirect($redirect_url);
// 待审核才可以
if(!in_array($info['order_info']['status'], [-1, 1, 2])){
$redirect = $info['order_info']['order_goods_type'] == 1 ? '/list' : '/self_order';
return redirect('/prompt')->with(['message'=>"该订单不符合人工审单条件~【status:{$info['order_info']['status']}】",'url' =>$redirect, 'jumpTime'=>3,'status'=>false]);
} }
$data['k1'] = time(); $data['k1'] = time();
...@@ -796,28 +800,23 @@ Class OrderController extends Controller ...@@ -796,28 +800,23 @@ Class OrderController extends Controller
$info['api_dgk_config'] = $res['data']['data']; $info['api_dgk_config'] = $res['data']['data'];
$info['api_dgk_config_one'] = array_keys($res['data']['data']); // 一级分类 $info['api_dgk_config_one'] = array_keys($res['data']['data']); // 一级分类
return view('detail', $info); return view('changeOrder', $info);
} }
//删除单个商品操作 //删除单个商品操作
public function ajaxdeletegoods(Request $request) public function ajaxdeletegoods(Request $request)
{ {
$collert = $request->input(); $collert = $request->input();
$operator_id = $request->user->userId; $operator_id = $request->user->userId;
if(!$request->isMethod('post') || !$collert['rec_id']){ if(!$request->isMethod('post') || !$collert['rec_id']) return array('errcode'=>1, 'errmsg'=>'错误操作');
return array('errcode'=>1, 'errmsg'=>'错误操作');
}
if(!$collert['reason']){ if(!$collert['reason']) return array('errcode'=>Error::E_NOT_EXISTS,'errmsg'=>'请填写删除原因');
errorLog(Error::E_NOT_EXISTS, '请填写删除原因');
return array('errcode'=>Error::E_NOT_EXISTS,'errmsg'=>'请填写删除原因');
}
$url = Config('website.api_domain').'order/deleteGoods'; $url = Config('website.api_domain').'order/deleteGoods';
$check['k1'] = time(); $check['k1'] = time();
$check['k2'] = md5(md5($check['k1']).'fh6y5t4rr351d2c3bryi'); $check['k2'] = md5(md5($check['k1']).'fh6y5t4rr351d2c3bryi');
$resData = array( $resData = array(
"reason"=>$collert['reason'], "reason"=>$collert['reason'],
...@@ -848,9 +847,7 @@ Class OrderController extends Controller ...@@ -848,9 +847,7 @@ Class OrderController extends Controller
$pay_time_limit = $payTime == 'other' ? $payTimeOther : $payTime; $pay_time_limit = $payTime == 'other' ? $payTimeOther : $payTime;
} else { } else {
$pay_time_limit = $request->input('pay_time_limit'); $pay_time_limit = $request->input('pay_time_limit');
} }
$url = Config('website.api_domain').'order/changeOrder';
$check['k1'] = time(); $check['k1'] = time();
$check['k2'] = md5(md5($check['k1']).'fh6y5t4rr351d2c3bryi'); $check['k2'] = md5(md5($check['k1']).'fh6y5t4rr351d2c3bryi');
...@@ -888,6 +885,24 @@ Class OrderController extends Controller ...@@ -888,6 +885,24 @@ Class OrderController extends Controller
"product_use_classone_sn" => $request->input('product_use_classone_sn', ''), // 终端客户信息 一级分类 "product_use_classone_sn" => $request->input('product_use_classone_sn', ''), // 终端客户信息 一级分类
"product_use_classtwo_sn" => $request->input('product_use_classtwo_sn', ''), // 终端客户信息 二级分类 "product_use_classtwo_sn" => $request->input('product_use_classtwo_sn', ''), // 终端客户信息 二级分类
]; ];
$is_temp_save = $request->input('is_temp_save', '');
if ($is_temp_save) { // 临时保存接口
$resData['payTime'] = $payTime;
$resData['payTimeOther'] = $payTimeOther;
$url = Config('website.api_domain').'order/tempSaveOrder';
} else {
$auditor_role = $request->input('auditor_role', 1); // 当前操作人角色
$order_goods_type = $request->input('order_goods_type', 1);
if ($order_goods_type == 1) {
$resData['status'] = $auditor_role == 3 ? 1 : 2; // 角色为‘查看自己’时,状态为待审核,否则为待付款
}
$url = Config('website.api_domain').'order/changeOrder';
}
// dd(curlApi($url, $resData, "POST")); // dd(curlApi($url, $resData, "POST"));
$temp = json_decode(curlApi($url, $resData, "POST"), true); $temp = json_decode(curlApi($url, $resData, "POST"), true);
...@@ -895,6 +910,40 @@ Class OrderController extends Controller ...@@ -895,6 +910,40 @@ Class OrderController extends Controller
} }
} }
// 主管审核
public function ajaxAuditPass(Request $request)
{
if ($request->isMethod('post')) {
$data['order_id'] = $request->input('order_id', '');
$data['operator_id'] = $request->user->userId;
$data['k1'] = time();
$data['k2'] = md5(md5($data['k1']).'fh6y5t4rr351d2c3bryi');
$url = Config('website.api_domain').'order/managerAudit';
$temp = json_decode(curlApi($url, $data, "POST"), true);
return array('errcode'=>$temp['err_code'], 'errmsg'=>$temp['err_msg']);
}
}
// 反审
public function ajaxReAudit(Request $request)
{
if ($request->isMethod('post')) {
$data['order_id'] = $request->input('order_id', '');
$data['operator_id'] = $request->user->userId;
$data['k1'] = time();
$data['k2'] = md5(md5($data['k1']).'fh6y5t4rr351d2c3bryi');
$url = Config('website.api_domain').'order/reAudit';
$temp = json_decode(curlApi($url, $data, "POST"), true);
return array('errcode'=>$temp['err_code'], 'errmsg'=>$temp['err_msg']);
}
}
// 驳回调价信息 // 驳回调价信息
public function ajaxRejected(Request $request) public function ajaxRejected(Request $request)
{ {
...@@ -1482,13 +1531,13 @@ Class OrderController extends Controller ...@@ -1482,13 +1531,13 @@ Class OrderController extends Controller
$temp = json_decode(curlApi($url, $userData, "POST"), true); $temp = json_decode(curlApi($url, $userData, "POST"), true);
// 消息通知 // 消息通知
$mobile = isset($temp['data']['order_info']['user_info']['msg_mobile']) ? $temp['data']['order_info']['user_info']['msg_mobile'] : ''; // $mobile = isset($temp['data']['order_info']['user_info']['msg_mobile']) ? $temp['data']['order_info']['user_info']['msg_mobile'] : '';
if (!$mobile) { // if (!$mobile) {
// $mobile = isset($temp['data']['order_info']['user_info']['mobile']) ? $temp['data']['order_info']['user_info']['mobile'] : ''; // // $mobile = isset($temp['data']['order_info']['user_info']['mobile']) ? $temp['data']['order_info']['user_info']['mobile'] : '';
$user = DB::connection('order')->table('lie_user_main')->where('user_id', $temp['data']['order_info']['user_id'])->select('mobile')->first(); // $user = DB::connection('order')->table('lie_user_main')->where('user_id', $temp['data']['order_info']['user_id'])->select('mobile')->first();
$mobile = $user ? $user->mobile : ''; // $mobile = $user ? $user->mobile : '';
} // }
// 获取操作记录 // 获取操作记录
$actionLog = DB::connection('order')->table('lie_order_action_log')->where('order_id', $id)->orderBy('create_time', 'DESC')->orderBy('log_id', 'DESC')->get(); $actionLog = DB::connection('order')->table('lie_order_action_log')->where('order_id', $id)->orderBy('create_time', 'DESC')->orderBy('log_id', 'DESC')->get();
...@@ -1497,7 +1546,7 @@ Class OrderController extends Controller ...@@ -1497,7 +1546,7 @@ Class OrderController extends Controller
$erpPayLog = DB::connection('order')->table('lie_erp_pay_log')->where('order_id', $id)->orderBy('create_time', 'DESC')->orderBy('log_id', 'DESC')->get(); $erpPayLog = DB::connection('order')->table('lie_erp_pay_log')->where('order_id', $id)->orderBy('create_time', 'DESC')->orderBy('log_id', 'DESC')->get();
$response = [ $response = [
'user_mobile' => $mobile, // 'user_mobile' => $mobile,
'order_info' => $temp['data']['order_info'], 'order_info' => $temp['data']['order_info'],
'user_info' => $temp['data']['order_info']['user_info'], 'user_info' => $temp['data']['order_info']['user_info'],
'company_info' => $temp['data']['order_info']['company_info'], 'company_info' => $temp['data']['order_info']['company_info'],
...@@ -2020,10 +2069,13 @@ Class OrderController extends Controller ...@@ -2020,10 +2069,13 @@ Class OrderController extends Controller
{ {
$id = $request->input('id'); $id = $request->input('id');
$cc_email = $request->input('cc_email', ''); // 额外抄送人 $cc_email = $request->input('cc_email', ''); // 额外抄送人
$info = $this->orderDetail($request, $id); $info = $this->orderDetail($request, $id);
//循环订单详情 //循环订单详情
foreach ($info['order_items_info'] as $key => $value) { foreach ($info['order_items_info'] as $key => $value) {
if(empty($value['batch'])) return ['errcode'=>-1,'errmsg'=>'商品:'.$tmp['goods'].'缺少批次<br/>'.'请填写批次后再发送'];
if(empty($value['buyerName'])) return ['errcode'=>-1,'errmsg'=>'商品:'.$tmp['goods'].'缺少采购人员<br/>'.'请填写采购后再发送'];
$tmp['orderNum'] = $info['order_temp_info']['erp_sn']; $tmp['orderNum'] = $info['order_temp_info']['erp_sn'];
$tmp['goods'] = $value['goods_name']; $tmp['goods'] = $value['goods_name'];
$tmp['purchasingPrice'] = $value['goods_price'];//采购价 $tmp['purchasingPrice'] = $value['goods_price'];//采购价
...@@ -2035,23 +2087,9 @@ Class OrderController extends Controller ...@@ -2035,23 +2087,9 @@ Class OrderController extends Controller
$tmp['remarks'] = $value['remarks']; $tmp['remarks'] = $value['remarks'];
$tmp['material'] = $value['erp_rec_id']; $tmp['material'] = $value['erp_rec_id'];
$tmp['purchasing'] = !empty($value['buyerName'])?$value['buyerName']:''; $tmp['purchasing'] = !empty($value['buyerName'])?$value['buyerName']:'';
$tmp['projectId'] = $key+1; $tmp['projectId'] = $key+1;
$tmp['deliveryTime'] = $value['batch']; //批次
if(empty($value['batch'])){ $tmp['send_email'] = !empty($value['send_email'])?$value['send_email']:'';
$msg = '商品:'.$tmp['goods'].'缺少批次<br/>'.'请填写批次后再发送';
echo json_encode(['errcode'=>-1,'errmsg'=>$msg]);
exit;
}
if(empty($value['buyerName'])){
$msg = '商品:'.$tmp['goods'].'缺少采购人员<br/>'.'请填写采购后再发送';
echo json_encode(['errcode'=>-1,'errmsg'=>$msg]);
exit;
}
//批次
$tmp['deliveryTime'] = $value['batch'];
$tmp['send_email'] = !empty($value['send_email'])?$value['send_email']:'';
$data['data'][] = $tmp; $data['data'][] = $tmp;
} }
...@@ -2073,15 +2111,14 @@ Class OrderController extends Controller ...@@ -2073,15 +2111,14 @@ Class OrderController extends Controller
$cc_send_mail_array = Config('config.cc_email'); // 固定抄送人 $cc_send_mail_array = Config('config.cc_email'); // 固定抄送人
$perm = new PermController; $perm = new PermController;
$manager_email = $perm->getManager($request); // 获取上级主管邮箱 $manager_email = $perm->getManager($request->user->userId); // 获取上级主管邮箱
if ($manager_email) { if ($manager_email) {
$cc_send_mail_array = array_merge($cc_send_mail_array, $manager_email); // 合并上级主管邮箱 $cc_send_mail_array = array_merge($cc_send_mail_array, $manager_email); // 合并上级主管邮箱
} }
$cc_send_mail_array[] = $request->user->email; // 默认抄送给自己 $cc_send_mail_array[] = $request->user->email; // 默认抄送给自己
$cc_send_mail_array = array_unique($cc_send_mail_array); // 去重
$cc_send_mail_array = array_unique($cc_send_mail_array); // 去重
$cc_email_arr = []; $cc_email_arr = [];
...@@ -2094,23 +2131,21 @@ Class OrderController extends Controller ...@@ -2094,23 +2131,21 @@ Class OrderController extends Controller
} }
} }
$data['ccUser'] = array_unique(array_merge($cc_send_mail_array, $cc_email_arr)); $data['ccUser'] = array_unique(array_merge($cc_send_mail_array, $cc_email_arr));
$data['combined'] = $info['order_info']['order_amount']; $data['combined'] = $info['order_info']['order_amount'];
$data['order_amount'] = $info['order_info']['order_amount']; $data['order_amount'] = $info['order_info']['order_amount'];
$data['date'] = date('Y-m-d',time()); $data['date'] = date('Y-m-d',time());
$data['kefu_remark'] = $info['order_temp_info']['kefu_remark']; // 客服备注 $data['kefu_remark'] = $info['order_temp_info']['kefu_remark']; // 客服备注
$CmsModel = new CmsModel(); $CmsModel = new CmsModel();
$data['id'] = $CmsModel->getUserName($info['order_info']['sale_id']); //获取业务员 $data['id'] = $CmsModel->getUserName($info['order_info']['sale_id']); //获取业务员
$data['order_id'] = intval($id); $data['order_id'] = intval($id);
$data['operator_id'] = intval($request->user->userId); $data['operator_id'] = intval($request->user->userId);
$data['operator_event'] = '发送邮件成功,收件人邮箱:'.json_encode($send_mail_array).',抄送人邮箱:'.json_encode($data['ccUser']); $data['operator_event'] = '发送邮件成功,收件人邮箱:'.json_encode($send_mail_array).',抄送人邮箱:'.json_encode($data['ccUser']);
// 推入到邮件队列 // 推入到邮件队列
$QueuedModel = new QueuedModel(); $QueuedModel = new QueuedModel();
$queued_name = 'send_buyer_mail'; $queued_name = 'send_buyer_mail';
$QueuedModel->pushAmq('ichunt_order_msg', $queued_name, $queued_name, json_encode($data)); $QueuedModel->pushAmq('ichunt_order_msg', $queued_name, $queued_name, json_encode($data));
return ['errcode'=>0, 'errmsg'=>'推送到邮件队列成功,请稍等...']; return ['errcode'=>0, 'errmsg'=>'推送到邮件队列成功,请稍等...'];
......
...@@ -344,29 +344,52 @@ ...@@ -344,29 +344,52 @@
// } // }
// 获取角色对应的主管邮箱 // 获取角色对应的主管邮箱
public function getManager($request) // public function getManager($request)
{ // {
$role = $this->getUserRole($request); // 当前用户角色 // $role = $this->getUserRole($request); // 当前用户角色
$manager_key = array_search($role, Config('perm_args.manager_to_kefu')); // 获取对应的主管key // $manager_key = array_search($role, Config('perm_args.manager_to_kefu')); // 获取对应的主管key
if (!$manager_key) return false; // if (!$manager_key) return false;
$role_name = array_search($manager_key, Config('perm_args.roles')); // 获取主管对应的角色名称 // $role_name = array_search($manager_key, Config('perm_args.roles')); // 获取主管对应的角色名称
if (!$role_name) return false; // if (!$role_name) return false;
$res = $this->getRoleUsers($request, $role_name); // 获取角色对应的用户 // $res = $this->getRoleUsers($request, $role_name); // 获取角色对应的用户
$email = []; // $email = [];
if ($res) { // if ($res) {
foreach ($res as $v) { // foreach ($res as $v) {
$email[] = $v->email; // $email[] = $v->email;
} // }
// }
// return $email;
// }
// 获取角色对应的主管邮箱
public function getManager($userId)
{
// 获取当前所在部门
$department_id = DB::table('user_info')->where('userId', $userId)->value('department_id');
if (!$department_id) return false;
$map = [];
$map['department_id'] = $department_id;
$map['position_id'] = 63; // 销售经理
$email = DB::table('user_info')->where($map)->select('email')->get();
if (empty($email)) return false;
foreach ($email as $v) {
$data[] = $v->email;
} }
return $email; return $data;
} }
/* 订单系统权限调整 --- 20200511 */ /* 订单系统权限调整 --- 20200511 */
......
...@@ -126,7 +126,7 @@ class ReturnController extends Controller ...@@ -126,7 +126,7 @@ class ReturnController extends Controller
$map['sale_id'] = $request->input('sale_id', ''); $map['sale_id'] = $request->input('sale_id', '');
// 非管理员、查看下级,只能看到自己的退货单 // 非管理员、查看下级,只能看到自己的退货单
if (!in_array($info['role'], [1, 2])) { if ($info['role'] == 3) {
$map['create_uid'] = $request->user->userId; $map['create_uid'] = $request->user->userId;
} }
......
...@@ -42,7 +42,9 @@ Route::group(['middleware' => 'web'], function () { ...@@ -42,7 +42,9 @@ Route::group(['middleware' => 'web'], function () {
Route::get('/change/{id}', 'OrderController@changeOrder'); Route::get('/change/{id}', 'OrderController@changeOrder');
Route::match(['get', 'post'], '/sendSales/{id?}', 'OrderController@sendSales'); Route::match(['get', 'post'], '/sendSales/{id?}', 'OrderController@sendSales');
Route::post('/ajaxdeletegoods', 'OrderController@ajaxdeletegoods'); Route::post('/ajaxdeletegoods', 'OrderController@ajaxdeletegoods');
Route::post('/ajaxSaveChange', 'OrderController@ajaxSaveChange'); Route::post('/ajaxSaveChange', 'OrderController@ajaxSaveChange');
Route::post('/ajaxAuditPass', 'OrderController@ajaxAuditPass');
Route::post('/ajaxReAudit', 'OrderController@ajaxReAudit');
Route::get('/check/{id}', 'OrderController@check'); Route::get('/check/{id}', 'OrderController@check');
Route::match(['get', 'post'], '/applyAdjust/{id}', 'OrderController@applyAdjust'); Route::match(['get', 'post'], '/applyAdjust/{id}', 'OrderController@applyAdjust');
Route::match(['get', 'post'], '/send/{id}', 'OrderController@send'); Route::match(['get', 'post'], '/send/{id}', 'OrderController@send');
......
...@@ -251,7 +251,8 @@ ...@@ -251,7 +251,8 @@
// 获取SKU信息 // 获取SKU信息
$('.get-sku').click(function() { $('.get-sku').click(function() {
var sku_id = $(this).siblings('.search-sku').val(); var sku_id = $(this).siblings('.search-sku').val();
var user_id = $('.user_id').val() || 0;
if (!sku_id) { if (!sku_id) {
layer.msg('请输入SKU_ID'); layer.msg('请输入SKU_ID');
...@@ -266,7 +267,7 @@ ...@@ -266,7 +267,7 @@
$.ajax({ $.ajax({
url: '/ajax/getSku', url: '/ajax/getSku',
type: 'post', type: 'post',
data: {sku_id : sku_id.trim()}, data: {sku_id : sku_id.trim(), user_id: user_id},
dataType: 'json', dataType: 'json',
success: function (resp) { console.log(resp) success: function (resp) { console.log(resp)
if (resp.errcode != 0) { if (resp.errcode != 0) {
...@@ -680,7 +681,7 @@ ...@@ -680,7 +681,7 @@
var supplier_id = $(this).data('sup_id'); var supplier_id = $(this).data('sup_id');
var supplier_name = $(this).data('sup_name'); var supplier_name = $(this).data('sup_name');
if (supplier_id == '7' || supplier_name.toLowerCase() == 'digikey') { if (supplier_id == '7' || supplier_name.toString().toLowerCase() == 'digikey') {
is_dgk = true; is_dgk = true;
} }
}) })
......
+(function($){
$.lie = $.lie || {version: "v1.0.0"};
$.extend($.lie, {
changeOrder:{
//人工审单
index: function(){
// 删除商品
$('.order-change-table tbody').delegate('.deletegoods', 'click', function(){
var self = $(this);
var rec_id = self.data('id');
var goods_type = self.data('type');
var order_type_extend = $('#order_type_extend').val();
var content = '';
var is_add = self.parents('tr').find('.is_add').val(); // 新增的商品
if (is_add) {
content += '确定删除新增的商品吗?';
} else {
content += '<div><textarea type="text" class="reason" style="width:300px;height: 100px"></textarea></div><span class="error">请填写删除商品原因,100字以内</span>';
}
layer.open({
title: '删除商品'
,content: content
,btn:['确定', '取消']
,yes: function(index, layero){
var reason = $('.reason').val();
if(!reason && !is_add){
layer.tips('请填写删除商品原因',$('.reason'));
return false;
}
if (goods_type == 1) { // 联营删除
self.parents('tr').find('.change_status').val(-1); // 调整状态
self.parents('tr').find('.change_status_val').html('<i class="error">已取消</i>'); // 调整状态
self.parents('tr').find('.del_reason').val(reason); // 删除原因
self.parents('tr').find('input').attr('readonly', 'readonly'); // 设置当前行input只读
calculate(self);
self.hide(); // 隐藏当前删除按钮
layer.close(index);
} else { // 自营删除
$.ajax({
type: 'post',
url:'/ajaxdeletegoods',
data:{rec_id: rec_id, goods_type: goods_type, reason: reason},
dataType: 'json',
success: function(resp) {
if(resp.errcode == 0) {
location.reload();//刷新本页
return false;
}
layer.msg(resp.errmsg);
return false;
}
});
}
}
,btn2: function(index, layero){
layer.close(index);
}
});
})
/**
* 计算各项费用
* @param {String} self [当前删除商品对象]
* @return {[type]} [description]
*/
function calculate(self='')
{
var rec_id = '';
var curr_sup = '';
if (self) {
var rec_id = self.data('id');
var curr_sup = self.parents('tr').data('sup'); // 当前行供应商
}
var goods_total = 0; // 商品总额
var supplier = []; // 各供应商商品小计数组
var is_supplier_exists = false; // 明细是否还存在同供应商商品,默认false不存在
var goods_len = 0; // 明细条数
$('.order-change-table').find('tbody tr').each(function() {
var id = $(this).find('.change_rec_id').val();
var status = $(this).find('.change_status').val();
if (id == rec_id) return true; // 过滤本次删除商品
if (status == -1) return true; // 结束本次循环
var sup = $(this).data('sup');
if (sup == curr_sup) is_supplier_exists = true;
var num = parseInt($(this).find('.num').val()) || 0;
var price = parseFloat($(this).find('.price').val()) || 0;
if (supplier.hasOwnProperty(sup)) { // 判断当前key是否存在于数组中
supplier[sup] += parseFloat(num * price).toFixed(2);
} else {
supplier[sup] = parseFloat(num * price).toFixed(2);
}
goods_total += parseFloat(num * price);
goods_len++;
});
// 附加费存在 且 明细不存在同供应商商品
if ($('.extend-fee-table').length > 0 && !is_supplier_exists) {
// 若不存在,则删除指定的附加费
var extend_fee_total = 0;
$('.extend-fee-table').find('tbody tr').each(function(){
var sup = $(this).data('sup');
if (sup == curr_sup) {
$(this).remove();
return true;
}
$(this).find('.sup_amount').val(supplier[sup]);
$(this).find('.sup_amount_val').text(supplier[sup]);
var extend_fee = parseInt($(this).find('.adjust_extend_fee').val()) || 0;
extend_fee_total += extend_fee;
})
$('.extra_fee').html(extend_fee_total);
$('input[name="extra_fee"]').val(extend_fee_total);
}
var extra_fee = $('input[name="extra_fee"]').val() ? parseFloat($('input[name="extra_fee"]').val()) : 0;
var freight_fee = $('input[name="freight_fee"]').val() ? parseFloat($('input[name="freight_fee"]').val()) : 0; // 运费
var total = parseFloat(goods_total + freight_fee + extra_fee).toFixed(2);
goods_total = goods_total.toFixed(2);
$('.goods_total').html(goods_total);
$('input[name="goods_amount"]').val(goods_total);
$('input[name="order_amount"]').val(total);
$('.total').html(total);
$('.advance').val((total*0.3).toFixed(2));
if (goods_len == 1) { // 若明细条数为1,则隐藏所有的删除按钮
$('.deletegoods').hide();
}
}
// 判断付款类型
if (order_pay_type == 1 || order_pay_type == 4) { // 全款和货到猎芯付款
$('.order_all_pay').attr('checked', true);
$('.order_advance_pay').parent('label').show();
} else if (order_pay_type == 2) { // 预付款
$('.order_advance_pay').attr('checked', true);
$('.order_advance_pay').parent('label').show();
$('.show-advance-pay').show(); // 定金模块
} else if (order_pay_type == 3) { // 账期
$('.order_account_period').attr('checked', true);
$('.show-pay-time').hide();
}
// 选择付款类型
$('input[name=order_pay_type]').click(function(){
var val = $(this).val();
if (val == 2) {
$('.show-advance-pay').show(); // 定金
$('.show-pay-time').show(); // 付款时间
} else if (val == 3) {
$('.show-advance-pay').hide();
$('.show-pay-time').hide();
} else {
$('.show-advance-pay').hide();
$('.show-pay-time').show();
}
})
// 输入数量、单价校验
$('#checkOrderForm').off().delegate('.only_number', 'keyup', function(){
if($(this).val() == '') return false;
if(!(/^\d{0,7}(\.\d{0,4})?$/g.test( $(this).val()))){//判断输入是否合法,不合法强制转换
if(isNaN(parseFloat($(this).val()))){
layer.msg('只能是数字和小数组成');
$(this).val('');
}else{
$(this).val(parseFloat($(this).val()).toFixed(4));
}
}
if ($(this).val() < 0) {
layer.msg('只能是正整数');
$(this).val('');
return false;
}
if($(this).val() > 999999.9999){
$(this).val(999999.9999);
}
if($(this).val().length > 11){
$(this).val($(this).val().slice(0,11));
}
});
// 调整价格
$('.order-change-table').off().delegate('input', 'blur', function(e){
e.preventDefault();
calculate();
// var table = $('.order-change-table');
// var goods_total = 0;
// var supplier = [];
// $(table).find('tbody tr').each(function(){
// var num = parseInt($(this).find('.num').val()) || 0;
// var price = parseFloat($(this).find('.price').val()) || 0;
// goods_total += parseFloat(num * price);
// var sup = $(this).data('sup');
// if (supplier.hasOwnProperty(sup)) { // 判断当前key是否存在于数组中
// supplier[sup] += parseFloat(num * price).toFixed(2);
// } else {
// supplier[sup] = parseFloat(num * price).toFixed(2);
// }
// });
// // 附加费商品金额设置
// $('.extend-fee-table').find('tbody tr').each(function(){
// var sup = $(this).data('sup');
// $(this).find('.sup_amount').val(supplier[sup]);
// $(this).find('.sup_amount_val').text(supplier[sup]);
// })
// var extra_fee = $('input[name="extra_fee"]').val() ? parseFloat($('input[name="extra_fee"]').val()) : 0;
// var freight_fee = $('input[name="freight_fee"]').val() ? parseFloat($('input[name="freight_fee"]').val()) : 0; // 运费
// var total = parseFloat(goods_total + freight_fee + extra_fee).toFixed(2);
// goods_total = goods_total.toFixed(2);
// $('.goods_total').html(goods_total);
// $('input[name="goods_amount"]').val(goods_total);
// $('input[name="order_amount"]').val(total);
// $('.total').html(total);
// $('.advance').val((total*0.3).toFixed(2));
return false;
})
// 根据供应商调整附加费
$('.extend-fee-table').delegate('input', 'keyup', function(){
var table = $('.extend-fee-table');
var goods_total = parseFloat($('.goods_total').text());
var freight_fee = $('input[name="freight_fee"]').val() ? parseFloat($('input[name="freight_fee"]').val()) : 0; // 运费
var extend_fee_total = 0;
$(table).find('tbody tr').each(function(){
var extend_fee = parseInt($(this).find('.adjust_extend_fee').val()) || 0;
extend_fee_total += extend_fee;
});
var total = parseFloat(goods_total + freight_fee + extend_fee_total).toFixed(2);
$('.extra_fee').html(extend_fee_total);
$('input[name="extra_fee"]').val(extend_fee_total);
$('input[name="order_amount"]').val(total);
$('.total').html(total);
})
// 调整运费
$('.freight_fee').on('keyup', function() {
var freight_fee = parseFloat($(this).val());
if (!freight_fee) freight_fee = 0;
$(this).val(freight_fee);
var goods_total = parseFloat($('.goods_total').text());
var total = parseFloat(goods_total + freight_fee).toFixed(2);
$('.total').html(total);
})
$('.advance').on('blur',function(){
var val = $(this).val();
if (val == '') {
layer.tips('预付定金不能为空', $(this));
return false;
} else if (val == 0) {
layer.tips('预付定金为0,请更换付款方式:货到深圳仓付款', $(this));
}
})
// 用户来源 -- 其他
$('input[name="client_source"]').on('click', function(){
if($(this).val() == 1){
$('.client-input-other').show();
} else {
$('.client-input-other').hide();
}
});
// 设置折扣
$('.set_goods_price').off().on('blur', function(){
var val = $(this).val();
if (!val) {
layer.msg('折扣值不能为空');
val = 1;
}
if (isNaN(parseFloat(val))) {
layer.msg('折扣值只能是数字和小数组成');
val = 1;
}
if (val <= 0 || val > 1) {
layer.msg('折扣值只能大于0且小于等于1');
val = 1;
}
var discount = parseFloat(val).toFixed(2);
$(this).val(discount);
$('.order-change-table').find('tbody tr').each(function(){
var price = $(this).find('.price').val();
var origin_price = $(this).find('.price').data('price');
var discount_price = 0;
if (val == 1) {
discount_price = origin_price;
} else {
discount_price = parseFloat(price * discount).toFixed(4);
}
$(this).find('.price').val(discount_price);
})
$('.order-change-table input').triggerHandler('keyup'); // 自动触发
})
// 选择付款时间
$('.payTime').change(function(){
var val = $(this).val();
if (val == 'other') {
$('.customArea').show();
} else {
$('.customArea').hide();
}
})
// 提交表单
$('.checkOrder').click(function(){
var is_newClient = $('input[name=is_newClient]:checked').val();
var client_source = $('input[name=client_source]:checked').val();
var order_status = $('input[name=order_status]:checked').val();
var pay_type = $('input[name=order_pay_type]:checked').val(); // 订单付款类型
var reason = $('input[name=reason]:checked').val();
var payTime = $('.payTime').val();
var payTimeOther = $('.payTimeOther').val();
var order_goods_type = $('input[name=order_goods_type]').val();
var order_id = $('input[name=order_id]').val();
var business_type = $('input[name=business_type]').val();
// 若存在digikey商品,终端客户信息必填 2020-4-26
if (is_dgk_exists) {
var customer_cn = $('.customer_cn').val();
var customer_en = $('.customer_en').val();
var customer_type = $('.customer_type').val();
var product_use_classone_sn = $('.product_use_classone_sn').val();
var product_use_classtwo_sn = $('.product_use_classtwo_sn').val();
if (!customer_cn) {
layer.msg('请填写终端中文名称');
return false;
}
if (!customer_en) {
layer.msg('请填写终端英文名称');
return false;
}
var en_reg = /^[a-zA-Z0-9\.\s\,\(\)]+$/;
if(!en_reg.test(customer_en)){
layer.msg('请填写全英文名称');
return false;
}
if (customer_type == '') {
layer.msg('请选择客户类型');
return false;
}
if (product_use_classone_sn == '') {
layer.msg('请选择产品用途一级分类');
return false;
}
}
if (isNewClient) {
if (client_source == null) {
layer.msg('请选择用户来源渠道!');
return false;
} else if (client_source == 1) {
if ($('#input-other-source').val() == '') {
layer.msg('请填写其他来源');
return false;
}
}
}
// 审核不通过
if (order_status == -1) {
$('.input-cancel-reason').click();
return false;
}
// 正常订单校验数量、单价
if (business_type == 0) {
var change_price = false;
var change_goods_number = false;
var change_str = '';
$('.order-change-table').find('tbody tr').each(function(){
var goods_number = $(this).find('.change_goods_number').val();
var price = $(this).find('.price').val();
var goods_name = $(this).find('.change_goods_name').val();
if (goods_number == '' || goods_number == 0) {
change_goods_number = true;
change_str += goods_name+'数量不能为0或空 ';
}
if (price == '' || price == 0) {
change_price = true;
change_str += goods_name+'单价不能为0或空 ';
}
})
if (change_price || change_goods_number) {
layer.alert(change_str)
return false;
}
}
// 预付款
if (pay_type == 2) {
var deposit_amount = $('input[name=deposit_amount]').val();
if (deposit_amount == '') {
layer.msg('请填写定金金额');
return false;
}else if (deposit_amount == 0) {
layer.msg('定金金额不能为0');
return false;
}
}
// 非账期订单选择付款时间
if (pay_type != 3) {
if (payTime == '') {
layer.msg('请选择付款时间');
return false;
}
if (payTime == 'other' && payTimeOther == '') {
layer.msg('请填写自定义时间');
return false;
}
if (payTimeOther) {
var reg = /\d/;
if (!reg.test(payTimeOther)) {
layer.msg('格式错误');
return false;
}
if (payTimeOther < 1 || payTimeOther > 30) {
layer.msg('自定义时间限制在1-30天');
return false;
}
}
}
if (!is_manager && order_goods_type != 1) { // 非管理员或经理权限和非联营订单需要判断商品价格是否低于80%以下
// 设置默认值false
$('input[name=check_failed]').val(0);
$('input[name=change_pay_type]').val(0);
var check_failed_info = '';
// 检查商品单价
$('.order-change-table').find('tbody tr').each(function(){
var origin_price = parseFloat($(this).find('.price').data('origin'));
var price = parseFloat($(this).find('.price').val()) || 0;
var goods_name = $(this).find('.change_goods_name').val();
limit_price = (origin_price * 0.8).toFixed(4);
// 若商品单价降价幅度小于或等于20%则赋值
if (price <= limit_price) {
check_failed_info += '型号:'+goods_name+',单价:'+origin_price+' -> '+price+' | ';
$('input[name=check_failed]').val(1);
$('input[name=check_failed_info]').val(check_failed_info);
}
});
// 预付款时设置
if (pay_type == 2) {
$('input[name=change_pay_type]').val(1);
}
}
var currencySign = currency == 1 ? '¥' : '$';
var goods_amount = parseFloat($('.goods_total').text());
var order_amount = parseFloat($('.total').text());
var extra_fee = $('input[name=extra_fee]').val() ? $('input[name=extra_fee]').val() : 0;
var freight_fee = $('input[name=freight_fee]').val() ? $('input[name=freight_fee]').val() : 0;
var last_paid = parseFloat(order_amount + parseFloat(pay_preferential)).toFixed(2); // 实际支付金额
var order_type_extend = $('#order_type_extend').val();
var content = '<div class="submit-check">';
content += '<p class="error">请核对订单金额,谨慎操作!</p>';
content += '<p><label>商品总金额:</label>'+currencySign + goods_amount+'</p>';
content += '<p><label>优惠金额:</label>'+discount_amount+'</p>'+
'<p><label>附加费金额:</label>'+extra_fee+'</p>'+
'<p><label>运费金额:</label>'+freight_fee+'</p>'+
'<p><label>订单总金额:</label><span class="error">'+currencySign + order_amount+'</span></p>';
if (order_goods_type == 1) {
content += '</div>';
var url = '/details/'+order_id;
} else {
content += '<p><label>支付优惠:</label>'+pay_preferential+'</p>'+
'<p><label>实际支付金额:</label><span class="error">'+currencySign + last_paid +'</span></p>'+
'</div>';
var url = '/details/'+order_id+'?tags=self';
}
// 弹出提示
layer.open({
area: ['360px'],
title: '提示信息',
content: content,
btn:['确定', '取消'],
yes: function(index, layero){
$.ajax({
url : '/ajaxSaveChange',
type: 'post',
data: $('#checkOrderForm').serialize(),
dataType: 'json',
success: function (resp) {
if(resp.errcode === 0){
layer.msg(resp.errmsg || '操作成功');
setTimeout(function(){
// location.reload();
location.href = url;
}, 1000);
} else {
layer.alert(resp.errmsg || '网络异常', function() {
location.reload();
});
}
},
error: function (res) {
console.log(res);
}
})
// layer.msg('审核提交中...', {icon: 16, time: 0, shade: 0.3}); // 阻止重复提交
},
btn2: function(index, layero){
layer.close(index);
}
});
})
// 临时保存
$('.tempSave').click(function() {
var order_id = $('input[name=order_id]').val();
var datax = $('#checkOrderForm').serialize() + '&is_temp_save=1';
// 弹出提示
layer.open({
area: ['360px'],
title: '提示信息',
content: '确定临时保存编辑的信息吗?',
btn:['确定', '取消'],
yes: function(index, layero){
$.ajax({
url : '/ajaxSaveChange',
type: 'post',
data: datax,
dataType: 'json',
success: function (resp) {
if(resp.errcode === 0){
layer.msg(resp.errmsg || '操作成功');
setTimeout(function(){
location.href = '/details/'+order_id;;
}, 1000);
} else {
layer.alert(resp.errmsg || '网络异常', function() {
location.reload();
});
}
},
error: function (res) {
console.log(res);
}
})
layer.msg('保存中...', {icon: 16, time: 0, shade: 0.3}); // 阻止重复提交
},
btn2: function(index, layero){
layer.close(index);
}
});
})
// 弹出临时保存的订单信息
$('.viewTempSave').click(function(){
// 弹出提示
layer.open({
type: 1,
title: '临时保存信息',
content: $('#temp-save-info'),
area: ['700px', '600px'],
btn: ['应用', '取消'],
yes: function(index, layero){
// 调整终端客户
if (temp_save_info.customer_cn) {
$('.customer_cn').val(temp_save_info.customer_cn);
$('.customer_en').val(temp_save_info.customer_en);
$('.customer_type').val(temp_save_info.customer_type);
$('.product_use_classone_sn').val(temp_save_info.product_use_classone_sn);
$('.product_use_classone_sn').change(); // 添加change事件
$('.product_use_classtwo_sn').val(temp_save_info.product_use_classtwo_sn);
}
$('.order_pay_type').val(temp_save_info.order_pay_type); // 调整付款类型
$('#kefu_remark').val(temp_save_info.kefu_remark); // 客服备注
$('.advance').val(temp_save_info.deposit_amount); // 调整定金
// 调整付款时间
if (temp_save_info.payTime == 'other') {
$('.payTime').val(temp_save_info.payTime);
$('.customArea').show();
$('.payTimeOther').val(temp_save_info.payTimeOther);
} else {
$('.payTime').val(temp_save_info.payTime);
}
// 调整明细
var items = temp_save_info.change_info;
var items_len = 0;
var new_str = ''; // 新增商品数据
var curr_no = 1; // 标记当前行序号
// 明细取消禁用
$('.deletegoods').attr('disabled', false).css('pointer-events', 'auto');
for (var i in items) {
if (!items[i].is_add) {
$('.change_item_'+i).find('.change_goods_price').val(items[i].goods_price);
$('.change_item_'+i).find('.change_goods_number').val(items[i].goods_number);
if (items[i].status == -1) {
$('.change_item_'+i).find('.change_status').val(items[i].status);
$('.change_item_'+i).find('.change_status').next('.change_status_val').html('<i class="error">已取消</i>');
}
}
items_len++;
}
for (var i in items) {
if (!items[i].is_add) continue;
if (!items[i].add_type) {
var sup = items[i].canal ? items[i].supplier_id+'.'+items[i].canal : items[i].supplier_id;
new_str += '<tr data-sup="'+sup+'">';
} else {
new_str += '<tr>';
}
new_str += '<td>'+i+'</td>\
<td>\
<input type="hidden" name="change_info['+i+'][supplier_name]" value="'+items[i].supplier_name+'">\
<p>'+items[i].supplier_name+'</p>\
</td>\
<td>\
<input class="change_goods_name" type="hidden" name="change_info['+i+'][goods_name]" value="'+items[i].goods_name+'">\
<p>'+items[i].goods_name+'</p>\
</td>\
<td>\
<input class="only_number num change_goods_number" name="change_info['+i+'][goods_number]" value="'+items[i].goods_number+'">\
</td>\
<td>\
<input class="price only_number" name="change_info['+i+'][goods_price]" data-price="'+items[i].goods_price+'" value="'+items[i].goods_price+'">\
</td>\
<td>\
<input class="change_status" type="hidden" name="change_info['+i+'][status]" value="1">\
<span class="change_status_val">正常<i style="color:green;">(新增)</i></span>\
</td>';
if (!items[i].add_type) {
new_str += '<td>\
<a class="btn btn-xs btn-danger deletegoods" href="javascript:;" data-id="" data-type="1">删除</a>\
<input class="is_add" type="hidden" name="change_info['+i+'][is_add]" value="1" />\
<input type="hidden" name="change_info['+i+'][goods_id]" value="'+items[i].goods_id+'" />\
</td>';
} else { // 新增无skuid商品
new_str += '<td>\
<a class="btn btn-xs btn-danger deletegoods" href="javascript:;" data-id="" data-type="1">删除</a>\
<input class="is_add" type="hidden" name="change_info['+i+'][is_add]" value="1" />\
<input type="hidden" name="change_info['+i+'][add_type]" value="1" />\
<input type="hidden" name="change_info['+i+'][order_id]" value="'+items[i].order_id+'" />\
<input type="hidden" name="change_info['+i+'][goods_id]" value="'+items[i].goods_id+'" />\
<input type="hidden" name="change_info['+i+'][brand_name]" value="'+items[i].brand_name+'" />\
<input type="hidden" name="change_info['+i+'][delivery_time]" value="'+items[i].delivery_time+'" />\
<input type="hidden" name="change_info['+i+'][buyer_id]" value="'+items[i].buyer_id+'" />\
<input type="hidden" name="change_info['+i+'][batch]" value="'+items[i].batch+'" />\
<input type="hidden" name="change_info['+i+'][remarks]" value="'+items[i].remarks+'" />\
</td>';
}
new_str += '</tr>';
}
$('.order-change-table').find('tbody').append(new_str);
$('.order-change-table').find('tbody input').trigger('blur'); // 自动触发
// 调整附加费
var extend_fee_items = temp_save_info.change_extend_fee;
var extend = '';
for (var i in extend_fee_items) {
extend += '<tr data-sup="'+i+'">\
<td>\
<p>'+extend_fee_items[i].supplier_name+'</p>\
<input type="hidden" name="change_extend_fee['+i+'][supplier_name]" value="'+extend_fee_items[i].supplier_name+'">\
</td>\
<td>\
<input type="hidden" name="change_extend_fee['+i+'][amount]" class="sup_amount" value="'+extend_fee_items[i].amount+'">\
<p class="sup_amount_val">'+extend_fee_items[i].amount+'</p>\
</td>\
<td>\
<input class="adjust_extend_fee only_number" name="change_extend_fee['+i+'][extend_fee]" value="'+extend_fee_items[i].extend_fee+'">\
<input type="hidden" name="change_extend_fee['+i+'][count]" value="'+extend_fee_items[i].count+'">\
<input type="hidden" name="change_extend_fee['+i+'][ladder_max]" value="'+extend_fee_items[i].ladder_max+'">\
</td>\
</tr>';
}
$('.extend-fee-table').find('tbody').empty().append(extend);
$('.extend-fee-table').find('tbody input').trigger('keyup'); // 自动触发
layer.msg('应用成功,请在当前页面审单');
layer.close(index)
$('.viewTempSave').hide();
},
btn2: function(index, layero){
layer.close(index)
}
});
})
// 弹出已调价的订单信息
$('.checkAdjusted').click(function(){
var adjusted_info = $('.adjusted_order').html();
var order_id = $('input[name=order_id]').val();
var order_goods_type = $('input[name=order_goods_type]').val();
var layer_btn = is_manager ? ['通过', '驳回'] : [];
var url = order_goods_type == 1 ? '/details/'+order_id : '/details/'+order_id+'?tags=self';
// 弹出提示
layer.open({
title: '调价后的订单信息',
content: adjusted_info,
area: ['700px', '400px'],
btn: layer_btn,
yes: function(index, layero){
$.ajax({
url : '/ajaxSaveChange',
type: 'post',
data: $('#adjustedOrderForm').serialize()+'&order_status=2',
dataType: 'json',
success: function (resp) {
if(resp.errcode === 0){
layer.msg(resp.errmsg || '操作成功');
setTimeout(function(){
location.href = url;
}, 1000);
} else {
layer.alert(resp.errmsg || '网络异常');
}
},
error: function (res) {
console.log(res);
}
})
},
btn2: function(index, layero){
$.ajax({
url : '/ajaxRejected',
type: 'post',
data: $('#adjustedOrderForm').serialize()+'&order_status=1',
dataType: 'json',
success: function (resp) {
if(resp.errcode === 0){
layer.msg(resp.errmsg || '操作成功');
setTimeout(function(){
// location.reload();
location.href = url;
}, 1000);
} else {
layer.alert(resp.errmsg || '网络异常');
}
},
error: function (res) {
console.log(res);
}
})
}
});
})
},
}
});
})(jQuery)
\ No newline at end of file
+(function($){
$.lie = $.lie || {version: "v1.0.0"};
$.extend($.lie, {
order:{
details:function(){
var self = this;
var action_type=$('.action_type').val();
if(action_type=='changeShipping'){
self.changeShipping();
}
if(action_type=='changeInvoice'){
self.changeInvoice();
}
if(action_type=='cancelPay'){
self.cancelPay();
}
if(action_type=='send'){
self.send();
}
if(action_type=='account'){
self.account();
}
if(action_type=='sendSales'){
self.sendSales();
}
if(action_type=='changeOrder'){
self.changeOrder();
}
if(action_type=='refund'){
self.refund();
}
self.selfOrder();
$.lie.droplist($('.droplist'));
var order_sn = $('.order-save').attr('ordersn');
//附加款修改
$('#edit_other_money').on('click', function () {
$('#other_money_input').show();
});
//附加款保存
$('.edit-save').on('click', function() {
var other_money = parseFloat($('#other_money_input').val());
$('#other_money').html(other_money);
$('#other_money_input').hide();
$('.real-total').html( parseFloat($('#order-total').html()) + other_money );
});
// ajax提交
$('form.ajaxSubmit').on('submit', function(){
$(this).ajaxSubmit(function(resp){
// resp = $.parseJSON(resp);
if(resp.errcode === 0){
layer.msg(resp.errmsg || '操作成功');
setTimeout(function(){
location.reload();
}, 1000);
} else {
layer.alert(resp.errmsg || '网络异常');
}
})
return false;
});
// 临时确认收款
$('.sure-pay-all').click(function(){
var order_id = $('#order_id').val();
var cid = $(this).data('cid');
var serial_number = $('input[name="serial_number"]').val();
if (serial_number.length == 0) {
layer.alert('请输入流水号');
return false;
}
var layer_win = layer.open({
title:'收款确认',
content: '请仔细核对订单金额后确认',
btn:['确认', '取消'],
btn1:function(){
$.ajax({
url:'/checkPay/'+order_id,
data: {order_id : order_id, cid : cid, serial_number : serial_number},
type:'post',
dataType: 'json',
success:function(resp){
if(resp.errcode == 0){
location.reload();
return false;
} else {
layer.alert(resp.errmsg || '网络异常');
}
},
error:function(){
layer.alert('网络异常');
}
});
},
btn2:function(){
return true;
}
})
})
// 尾款对账
$('.last-check').click(function(){
var order_id = $(this).data('id');
$.ajax({
url:'/checkPay/'+order_id,
data: {order_id : order_id, last_check : 1},
type:'post',
dataType: 'json',
success:function(resp){
console.log()
location.href = '/checkPay/'+order_id;
},
error:function(){
layer.alert('网络异常');
}
});
})
//确认收款
$('.sure-pay').click(function(){
var param = {};
param.order_id = $('#order_id').val();
var no = $(this).parent().parent().find('input[name="out_trace_no"]');
var no_val = no.val();
if(no.length > 0){
if(no_val){
param.out_trace_no = no_val;
} else {
// 流水号不存在
layer.alert('请输入流水号');
return false;
}
}
//弹窗
var layer_win = layer.open({
title:'收款确认',
content:$('#sure-pay').html(),
btn:['确认', '取消'],
//提交事件
btn1:function(){
param.status = $('.layui-layer-content input[name="status"]:checked').val();
var info = $('.layui-layer-content textarea[name="info"]').val();
param.pay_error_info = info;
if(param.status == 2){
if(!info){
layer.tips('请输入异常原因', $('.layui-layer-content textarea[name="info"]'));
return false;
} else {
param.pay_error_info = info;
}
}
$.ajax({
url:'/checkPay/'+param.order_id,
data: param,
type:'post',
dataType: 'json',
success:function(resp){
if(resp.errcode == 0){
location.reload();
return false;
} else {
layer.alert(resp.errmsg || '网络异常');
}
},
error:function(){
layer.alert('网络异常');
}
});
},
btn2:function(){
return true;
}
});
});
// 查看物流轨迹
$('.view-shipping').click(function () {
var order_id = $('#order_id').val();
var user_id = $('#user_id').val();
var type = $(this).data('type');
$.ajax({
url : '/ajax/shipping',
type: 'post',
data: {order_id : order_id, user_id : user_id, type : type},
success: function(resp) {
if (resp.errcode == 0) {
var data = resp.data;
var content = '';
if (data.constructor == Array) { // 判断返回结果是否为数组
for (var i = 0; i < data.length; i++) {
content += '<p><span style="margin-right:10px;">'+data[i]['AcceptTime']+'</span>'+data[i]['AcceptStation']+'<span></span></p>'
}
} else {
content = data;
}
layer.open({
title: '物流轨迹',
area: ['800px', '600px'],
content: content,
btn: [],
})
} else {
layer.alert(resp.errmsg || '网络异常');
}
},
error: function(err) {
console.log(err);
}
})
})
// 点击物流展开
$('.click-down').click(function() {
$(this).parents('tbody').find('.other-infos').show();
$(this).hide();
$(this).parents('tbody').find('.click-up').show();
})
// 点击物流收起
$('.click-up').click(function() {
$(this).parents('tbody').find('.other-infos').hide();
$(this).hide();
$(this).parents('tbody').find('.click-down').show();
})
// 线下转账
$('.offline-paid').click(function() {
var order_id = $(this).data('id');
var order_sn = $(this).data('sn');
var content = '<div>确定要使用“线下转账”的付款方式吗?</div><div style="margin-top:5px; color:red;">选择“线下转账”,订单会立即同步至ERP,但必须由财务在“出库前”完成付款确认,否则无法出库。</div>';
layer.open({
title:'提示信息',
content: content,
btn:['确认', '取消'],
//提交事件
btn1:function(){
$.ajax({
url: '/ajax/offlinePaid',
data: {order_id: order_id, order_sn: order_sn},
type:'post',
dataType: 'json',
success:function(resp){
if(resp.errcode == 0){
layer.msg(resp.errmsg || '操作成功');
setTimeout(function(){
location.reload();
}, 1000);
return false;
} else {
layer.alert(resp.errmsg || '网络异常');
}
},
error:function(){
layer.alert('网络异常');
}
});
},
btn2:function(index){
layer.close(index);
}
});
})
// 编辑合同信息
$('.contract_info_edit').click(function(){
var order_id = $('input[name=order_id]').val();
var content = $('.contract_info:hidden').html();
layer.open({
area:['500px'],
title: '编辑合同信息',
content: content,
btn: ['确认', '取消'],
btn1: function () {
var contract_com_name = $('.layui-layer-content').find('.contract_com_name').val();
var contract_com_addr = $('.layui-layer-content').find('.contract_com_addr').val();
var contract_link_name = $('.layui-layer-content').find('.contract_link_name').val();
var contract_link_tel = $('.layui-layer-content').find('.contract_link_tel').val();
if (!contract_com_name) {
layer.tips('请填写公司名称', $('.layui-layer-content').find('.contract_com_name'));
return false;
}
if (!contract_com_addr) {
layer.tips('请填写公司地址', $('.layui-layer-content').find('.contract_com_addr'));
return false;
}
if (!contract_link_name) {
layer.tips('请填写联系人', $('.layui-layer-content').find('.contract_link_name'));
return false;
}
if (!contract_link_tel) {
layer.tips('请填写联系电话', $('.layui-layer-content').find('.contract_link_tel'));
return false;
}
var datax = {
order_id: order_id,
contract_com_name : contract_com_name,
contract_com_addr : contract_com_addr,
contract_link_name : contract_link_name,
contract_link_tel : contract_link_tel,
};
$.ajax({
url: '/ajax/editContract',
data: datax,
type:'post',
dataType: 'json',
success:function(resp){
if(resp.errcode == 0){
layer.msg(resp.errmsg || '操作成功');
setTimeout(function(){
location.reload();
}, 1000);
return false;
} else {
layer.alert(resp.errmsg || '网络异常');
}
},
error:function(){
layer.alert('网络异常');
}
});
},
btn2: function (index) {
layer.close(index);
}
})
})
//上传图片按扭事件
$(document).on('click', '#upload-contract', function(){
var order_id = $(this).data('id');
var form = $('<form id="formUpload" enctype="multipart/form-data">\
<input type="file" name="upload" accept="application/pdf">\
</form>');
form.appendTo('body');
form.find('input').change(function(){
// 预览图片
var file = this;
var formData = new FormData();
formData.append('upload', this.files[0]);
formData.append('source', 1);
formData.append('k1', k1);
formData.append('k2', k2);
$.ajax({
url : UploadImgUrl+'oss/upload',
type : 'post',
data : formData,
dataType : 'json',
cache : false,
processData: false,
contentType: false,
xhrFields: {withCredentials: true},
success : function(res){
if(res.code == 200){
layer.msg(res.message);
var data = res.data;
$.ajax({
url: '/ajax/uploadContract',
type: 'post',
data: {order_id: order_id, url: data[0]},
dataType: 'json',
success: function(res) {
if (res.errcode == 0) {
location.reload();
return false;
}
layer.msg(res.errmsg);
},
error : function(err){
console.log(err);
}
})
return false;
}
layer.msg(res.message);
},
error : function(err){
console.log(err);
}
})
});
form.find('input[type="file"]').trigger('click');
})
// 编辑商品明细
$('.edit-item').click(function() {
var order_id = $('#order_id').val();
var order_goods_type = $('#order_goods_type').val();
var rec_id = $(this).data('id');
var item_batch = $(this).data('batch');
var item_remarks = $(this).data('remarks');
if (order_goods_type == 1) {
var item_buyer_id = $(this).data('bid');
var buyer_count = buyers.length;
var html = '';
for (var i = 0; i < buyer_count; i++) {
if (item_buyer_id && item_buyer_id == buyers[i].userId) {
html += '<option value="'+buyers[i].userId+'" selected>'+buyers[i].name+'</option>';
} else {
html += '<option value="'+buyers[i].userId+'">'+buyers[i].name+'</option>';
}
}
}
var content = '';
content = '<div class="form-horizontal">\
<div class="form-group">';
if (order_goods_type == 1) {
content += '<label class="col-sm-3 control-label"><i class="error">*</i> 批次</label>';
} else {
content += '<label class="col-sm-3 control-label"> 批次</label>';
}
content += '<div class="col-sm-9">\
<input type="text" class="form-control" name="batch" value="'+item_batch+'" placeholder="请填写批次" style="width:200px;">\
</div>\
</div>';
if (order_goods_type == 1) {
content += '<div class="form-group">\
<label class="col-sm-3 control-label">采购员</label>\
<div class="col-sm-9" style="width:230px;">\
<select class="form-control buyer_id selectpicker" name="buyer_id" data-live-search="true" data-size="7">\
<option value="">请选择采购员</option>\
'+html+'\
</select>\
</div>\
</div>';
}
content += '<div class="form-group">';
content += '<label class="col-sm-3 control-label">备注</label>';
content += '<div class="col-sm-9">\
<textarea class="form-control" name="remarks" placeholder="请填写备注" style="width:200px;">'+item_remarks+'</textarea>\
</div>\
</div>\
</div>';
layer.open({
area: ['400px'],
title:'编辑明细',
content: content,
btn:['确认', '取消'],
//提交事件
btn1:function(){
var batch = $('input[name=batch]').val();
var buyer_id = $('select[name=buyer_id]').val() || 0;
var remarks = $('textarea[name=remarks]').val();
if (order_goods_type == 1 && !batch) {
layer.tips('请填写批次', $('input[name=batch]'));
return false;
}
$.ajax({
url: '/api/update_order_items',
data: {order_id: order_id, id: rec_id, batch: batch, buyer_id: buyer_id, remarks: remarks},
type:'post',
dataType: 'json',
success:function(resp){
if(resp.errcode == 0){
layer.msg(resp.errmsg || '操作成功');
setTimeout(function(){
location.reload();
}, 1000);
return false;
} else {
layer.alert(resp.errmsg || '网络异常');
}
},
error:function(){
layer.alert('网络异常');
}
});
},
btn2:function(index){
layer.close(index);
}
});
$(".buyer_id").selectpicker();
$('.layui-layer-content').css('overflow', 'visible');
})
// 自营申请收款 --- 2020.4.21
$('.selfcheckpay').click(function() {
var order_id = $('#order_id').val();
var content = $('.apply-paid:hidden').html();
layer.open({
area: ['500px'],
title:'申请收款信息',
content: content,
btn:['确认', '取消'],
btn1: function() {
var id = $('.layui-layer-content').find('input[name=pay_id]').val();
var pay_type = $('.layui-layer-content').find('input[name=pay_type]:checked').val();
var file_name = $('.layui-layer-content').find('input[name=file_name]').val();
var remarks = $('.layui-layer-content').find('textarea[name=remarks]').val();
if (!pay_type) {
layer.tips('请选择付款方式', $('.layui-layer-content').find('.chekck-pay-type'));
return false;
}
if (!file_name) {
layer.tips('请上传转账凭证', $('.layui-layer-content').find('.chekck-img-url'));
return false;
}
$.ajax({
url: '/api/ajaxApplyPaid',
data: {id: id, order_id: order_id, pay_type: pay_type, file_name: file_name, remarks: remarks},
type:'post',
dataType: 'json',
success:function(resp){
if(resp.errcode == 0){
layer.msg(resp.errmsg || '操作成功');
setTimeout(function(){
location.reload();
}, 1000);
return false;
} else {
layer.alert(resp.errmsg || '网络异常');
}
},
error:function(){
layer.alert('网络异常');
}
});
},
btn2: function(index) {
layer.close(index)
}
})
})
// 申请收款 --- 转账凭证图片上传
$('body').delegate('#preview', 'click', function(){
var form = $('<form id="formUpload" enctype="multipart/form-data" style="display:none;">\
<input type="file" name="upload" accept="image/jpeg, image/jpg, image/png, image/gif">\
</form>');
form.find('input').change(function(){
// 上传图片到OSS
var url = URL_api+'oss/upload';
var formData = new FormData();
formData.append('upload', this.files[0]);
formData.append('source', 1); //内部调用接口
var times = Math.round(new Date().getTime()/1000);
formData.append('k1', times);
formData.append('k2', hex_md5(hex_md5(String(times))+'fh6y5t4rr351d2c3bryi'));
//上传图片
$.ajax({
url : url,
type : 'post',
data : formData,
dataType : 'json',
cache : false,
processData: false,
contentType: false,
xhrFields: {withCredentials: true},
success : function(res){
console.log(res)
if(res.code == 200){
var data = res.data;
$('.layui-layer-content').find('#imgUrl').val(data[0]); // 将图片URL添加到隐藏域
$('.layui-layer-content').find('#imghead').attr('src', data[0]);
layer.tips(res.message, $('.layui-layer-content').find('.chekck-img-url'));
}else{
var errMsg = res.err_msg ? res.err_msg : res.message;
layer.tips(errMsg, $('.layui-layer-content').find('.chekck-img-url'));
}
return false;
},
error : function(err){
console.log(err);
}
})
})
form.find('input[type="file"]').trigger('click');
})
},
//物流信息
changeShipping:function() {
region.init('.address-info', $('.address-info .s_province').attr('default') || 0, $('.address-info .s_city').attr('default') || 0, $('.address-info .s_county').attr('default') || 0);
$('select.shipping').on('change', function() {
var v = $(this).val();
var name = $(this).find('option[value="'+v+'"]').html();
$(this).siblings('input').val(name);
});
var order_id = $('input[name=order_id]').val();
if (tags) {
var url = '/details/'+order_id+'?tags='+tags;
} else {
var url = '/details/'+order_id;
}
$('form').on('submit', function(){
$(this).ajaxSubmit({
data: {order_id: order_id},
dataType:'json',
success:function(resp){
if(resp.errcode == 0){
location.href = url;
} else {
layer.alert(resp.errmsg || '网络异常');
}
}
});
return false;
});
},
//发票信息
changeInvoice:function() {
var order_id = $('input[name=order_id]').val();
$('#inv_type').click(function(){
var val = $(this).val();
if (val == 1) { // 不开票
$('.tax_title_section').hide();
$('.add_tax').hide();
$('input[name=tax_title]').val('');
$('input[name=tax_no]').val('');
$('input[name=bank_name]').val('');
$('input[name=bank_account]').val('');
$('input[name=company_phone]').val('');
$('textarea[name=company_address]').val('');
} else if (val == 2) { // 普票
$('.tax_title_section').show();
$('.add_tax').hide();
$('.invoice_title').attr('colspan', 3);
$('input[name=tax_no]').val('');
$('input[name=bank_name]').val('');
$('input[name=bank_account]').val('');
$('input[name=company_phone]').val('');
$('textarea[name=company_address]').val('');
} else { // 增票
$('.tax_title_section').show();
$('.add_tax').show();
$('.invoice_title').attr('colspan', 0);
}
})
if (tags) {
var url = '/details/'+order_id+'?tags='+tags;
} else {
var url = '/details/'+order_id;
}
$('form').on('submit', function(){
$(this).ajaxSubmit({
data: {order_id: order_id},
dataType:'json',
success:function(resp){
if(resp.errcode == 0){
location.href = url;
} else {
layer.alert(resp.errmsg || '网络异常');
}
}
});
return false;
});
},
//发货
send:function(){
//发货方式改变事件
$('select[name="shipping_id"]').change(function(){
var shipping_id = $(this).val();
$(this).parents('tr').find('input[name="shipping_name"]').val($(this).find('option:selected').html());
if(shipping_id > 0){
$(this).parents('tr').find('.shipping_no').show();
} else {
$(this).parents('tr').find('.shipping_no').hide();
}
});
$('select[name="shipping_id"]').each(function(){
$(this).trigger('change');
});
//修改发货信息
$('.tabs-box.send a.btn.modify').click(function(){
var rec_id = $(this).attr('rec_id');
$(this).parents('tr').hide();
$(this).parents('table').find('tr[rec_id="'+rec_id+'"]').show();
});
//全选事件
$('input.send-all-selected').click(function(){
var checked = $(this).is(':checked');
$('input[name="rec_id[]"]').each(function(){
this.checked = checked;
});
});
//批量发货
$('.btn.batch-send').click(function(){
var param = {};
if($('input.batch-shipping-no').val())
{
param.shipping_no = $('input.batch-shipping-no').val();
}
else
{
$('input.batch-shipping-no').focus();
layer.tips('请输入快递单号', $('input.batch-shipping-no'));
return false;
}
if($('select.batch-shipping-code').val())
{
param.shipping_id = $('select.batch-shipping-code').val();
param.shipping_name = $('select.batch-shipping-code option:selected').html();
}
else
{
$('input.batch-shipping-code').focus();
layer.tips('请选择快递公司', $('input.batch-shipping-code'));
return false;
}
param.order_id = $('#order_id').val();
$.ajax({
url: '/send/'+param.order_id,
data: param,
type:'post',
dataType:'json',
error:function(){
layer.alert('网络异常');
},
success:function(resp){
if(resp.errcode == 0){
location.reload();
} else {
layer.alert(resp.errmsg || '网络异常');
}
}
})
});
//发货事件
$('.tabs-box.send .goods-send').click(function(){
var tr = $(this).parents('tr');
var param = {};
param.order_id = $('#order_id').val();
param.shipping_id = tr.find('select[name="shipping_id"]').val();
param.shipping_name = tr.find('input[name="shipping_name"]').val();
param.shipping_no = tr.find('input[name="shipping_no"]').val();
if($('select.batch-shipping-code').val())
{
param.shipping_id = $('select.batch-shipping-code').val();
param.shipping_name = $('select.batch-shipping-code option:selected').html();
}
if(!param.order_id){
layer.alert('订单号不存在');
return false;
}
if(param.shipping_id > 0 && !param.shipping_name){
layer.tips('请输入快递单号', tr.find('input[name="shipping_no"]'));
return false;
}
/*$.ajax({
url:sysConfig.siteUrl + '/Admin/Order/send',
data: param,
type:'post',
dataType:'json',
error:function(){
layer.alert('网络异常');
},
success:function(resp){
if(resp.errcode == 0){
location.reload();
} else {
layer.msg(resp.errmsg || '网络异常');
}
}
})*/
});
},
// 推送业务员
sendSales: function() {
$('.send_sales').click(function(){
var sale_id = $('input[name=sale_id]:checked').val();
var sale_name = $('input[name=sale_id]:checked').next('span').text();
if (sale_id == null) {
layer.msg('请选择业务员!');
return false;
}
// 弹出提示
layer.open({
title: '提醒',
content: '<div>确定推送到 <i class="error">'+sale_name+'</i> 吗?</div>',
btn:['确定', '取消'],
yes: function(index, layero){
$.ajax({
url : '/sendSales',
type: 'post',
data: $('#sendSalesForm').serialize(),
dataType: 'json',
success: function (resp) {
if(resp.errcode === 0){
layer.msg(resp.errmsg || '操作成功');
setTimeout(function(){
location.reload();
}, 1000);
} else {
layer.alert(resp.errmsg || '网络异常');
}
},
error: function (res) {
console.log(res);
}
})
layer.msg('订单推送中...', {icon: 16, time: 0, shade: 0.3}); // 阻止重复提交
},
btn2: function(index, layero){
layer.close(index);
}
});
return false;
})
},
// 自营操作
selfOrder: function() {
// 填写快递单
$('.self_express').click(function(){
var order_id = $(this).data('id');
inputExpress(order_id, '填写快递单号', '/ajaxSelfExpress', 1);
})
// 填写发票快递单
$('.self_invoice_express').click(function(){
var order_id = $(this).data('id');
inputExpress(order_id, '填写发票快递单', '/ajaxSelfExpress', 2);
})
/**
* [inputExpress description]
* @param {[order_id]} order_id [order_id]
* @param {[type]} title [标题]
* @param {[type]} url [url]
* @param {[type]} type [1.订单快递单 2. 发票快递单]
* @return {[type]} [description]
*/
function inputExpress(order_id, title, url, type) {
var shipping_section = '';
shipping_section += '<div class="form-group">'+
'<select name="shipping_id" class="shipping_id" style="width: 100%;margin-bottom: 20px;">'+
'<option value="">请选择快递公司</option>';
for(var i in shippings_info) {
shipping_section += '<option value="'+i+'">'+shippings_info[i]+'</option>';
}
shipping_section += '<input type="text" class="express_no" name="express_no" value="" style="width:100%;" placeholder="请填写快递单号" />'+
'</select>'+
'</div>';
layer.open({
title: title
,content: shipping_section
,btn:['确定', '取消']
,yes: function(index, layero){
var shipping_id = $('.shipping_id').val();
var express_no = $('.express_no').val();
if(!shipping_id){
layer.tips('请选择快递公司',$('.shipping_id'));
return false;
}
if(!express_no){
layer.tips('快递单号不能为空',$('.express_no'));
return false;
}
$.ajax({
url: url,
type: 'post',
data: {order_id:order_id, shipping_id:shipping_id, express_no:express_no, type:type},
dataType:'json',
success: function(resp) {
if(resp.errcode === 0){
layer.msg(resp.errmsg || '操作成功');
setTimeout(function(){
location.reload();
}, 1000);
} else {
layer.alert(resp.errmsg || '网络异常');
}
},
error: function(err) {
console.log(err)
}
})
}
,btn2: function(index, layero){
layer.close(index);
}
});
}
// 自营审单
$('.self-check').click(function(){
var order_id = $(this).data('id');
layer.open({
title: '审核自营线下订单',
content: '确定审核通过吗?',
btn:['通过', '不通过'],
yes: function(index, layero){
$.ajax({
url: '/ajax/selfCheck',
type: 'post',
data: {order_id: order_id, status: 4},
dataType:'json',
success: function(resp) {
if(resp.errcode === 0){
layer.msg(resp.errmsg || '操作成功');
setTimeout(function(){
location.reload();
}, 1000);
} else {
layer.alert(resp.errmsg || '网络异常');
}
},
error: function(err) {
console.log(err)
}
})
},
btn2: function(index, layero){ // 不通过--取消订单
$.ajax({
url: '/ajax/selfCheck',
type: 'post',
data: {order_id: order_id, status: -1},
dataType:'json',
success: function(resp) {
if(resp.errcode === 0){
layer.msg(resp.errmsg || '操作成功');
setTimeout(function(){
location.reload();
}, 1000);
} else {
layer.alert(resp.errmsg || '网络异常');
}
},
error: function(err) {
console.log(err)
}
})
}
});
})
// 自营对账
$('.self-sure-pay').click(function(){
var order_id = $('#order_id').val();
// var serial_number = $('input[name="serial_number"]').val();
// if (serial_number.length == 0) {
// layer.alert('请输入流水号');
// return false;
// }
var content = '';
var trans_amount = 0;
// 财务对账
if (role == 9) {
var trans_amount = $('input[name=trans_amount]').val();
if (!trans_amount) {
layer.msg('请输入客户线下转账金额');
return false;
}
content += '<div>';
if (parseFloat(trans_amount) == parseFloat(order_amount)) {
content += '<p><i class="fa fa-check-circle" style="color:green;"></i> 应付金额和对账金额一致</p>';
} else {
content += '<p><i class="fa fa-warning error"></i> 应付金额和对账金额不一致,请谨慎核对!</p>';
}
content += '<p>应付金额:<span class="error">'+order_amount+'</span></p>';
content += '<p>对账金额:<span class="error">'+trans_amount+'</span></p>';
content += '</div>';
} else {
content = '请仔细核对订单金额后确认';
}
layer.open({
title: '确认提示',
area: ['360px', '240px'],
content: content,
btn:['确认', '取消'],
btn1:function(){
$.ajax({
url:'/self_check_pay/'+order_id,
// data: {order_id : order_id, serial_number : serial_number},
data: {order_id: order_id, trans_amount: trans_amount},
type:'post',
dataType: 'json',
success:function(resp){
if(resp.errcode == 0){
layer.msg(resp.errmsg);
location.reload();
return false;
} else {
layer.alert(resp.errmsg || '网络异常');
}
},
error:function(){
layer.alert('网络异常');
}
});
layer.msg('订单对账中...', {icon: 16, time: 0, shade: 0.3});
},
btn2:function(){
return true;
}
})
})
},
// 退货退款
refund: function() {
// 正整数输入框限制
$('.int_num').off().on('keyup', function(){
var val = $(this).val();
if(!val) return false;
if (!(/^[1-9]\d*$/g.test(val))) {
layer.msg('只能是正整数');
$(this).val('');
}
if($(this).val().length > 9){
$(this).val($(this).val().slice(0, 9));
}
});
// 浮点数输入框限制
$('.float_num').off().on('keyup', function(){
var val = $(this).val();
if(!val) return false;
if(!(/^\d{0,7}(\.\d{0,4})?$/g.test(val))){//判断输入是否合法,不合法强制转换
if(isNaN(parseFloat(val))){
layer.msg('只能是数字');
$(this).val('');
}else{
$(this).val(parseFloat(val).toFixed(4));
}
}
if(val > 999999.9999){
$(this).val(999999.9999);
}
if(val.length > 11){
$(this).val(val.slice(0,11));
}
});
// 填写退货数量
$('.refund_num').keyup(function() {
var unshipped_num = parseInt($(this).parents('tr').find('.unshipped_num').val()); // 未发货数量
var single_pre_price = parseFloat($(this).parents('tr').find('.single_pre_price').val()); // 均摊单价
var val = $(this).val(); // 退货数量
if (val > unshipped_num) {
layer.msg('不能超过未发货数量');
$(this).val('');
}
// 退款小计
var single_amount = parseFloat(single_pre_price * val).toFixed(4);
$(this).parents('tr').find('.single_refund_amount').text(currency_sign + single_amount);
// 退款总额
var refund_total = 0;
$('.refund-table').find('tbody tr').each(function(){
var num = parseInt($(this).find('.refund_num').val()) || 0;
var price = parseFloat($(this).find('.single_pre_price').val()) || 0;
refund_total += parseFloat(num * price);
});
// 差价
var price_fall = $('.price_fall').val();
refund_amount = parseFloat(refund_total - price_fall).toFixed(2);
refund_total = refund_total.toFixed(2);
$('.all_refund_amount').val(refund_total);
$('.all_refund_amount_val').text(currency_sign + refund_total);
$('.refund_amount').text(currency_sign + refund_amount);
})
// 调整差价
$('.price_fall').keyup(function() {
var val = $(this).val();
var all_refund_amount = $('.all_refund_amount').val();
var refund_total = parseFloat(all_refund_amount - val).toFixed(2);
// 退款总额不存在,则差价设置为0
if (!all_refund_amount) {
$(this).val(0);
return false;
}
// 若差价大于或等于退款总额,则差价设置为0
if (parseFloat(val) >= parseFloat(all_refund_amount)) {
$(this).val(0);
$('.refund_amount').text(currency_sign + all_refund_amount);
return false;
}
$('.refund_amount').text(currency_sign + refund_total);
})
// 提交表单
$('.refundApply').click(function() {
var goods_count = 0; // 商品数量
var refund_eq_true = []; // 退货数量与未发货数量相等
var refund_empty = []; // 退货数量为空
// 表单退货数量
$('.refund-table').find('tbody tr').each(function(){
var num = parseInt($(this).find('.refund_num').val());
var unshipped_num = parseInt($(this).find('.unshipped_num').val());
// 为空标记
if (!num) refund_empty.push(0);
// 数量等于未发货数量标记
if (num == unshipped_num) refund_eq_true.push(1);
goods_count++;
});
if (refund_empty.length == goods_count) {
layer.msg('请填写退货数量');
return false;
}
if (refund_eq_true.length == goods_count) {
layer.msg('不能选择全部退货数量,请检查数量');
return false;
}
var order_id = $('input[name=order_id]').val();
var refund_reason = $('.refund_reason').val();
if (!refund_reason) {
layer.msg('请选择退货原因');
return false;
}
layer.open({
title: '提示信息',
content: '确认提交退货申请?',
btn: ['确认', '取消'],
yes: function(index, layero){
$.ajax({
url : '/refund/' + order_id,
type: 'post',
data: $('#refundForm').serialize(),
dataType: 'json',
success: function (resp) {
if(resp.errcode === 0){
layer.msg(resp.errmsg || '操作成功');
setTimeout(function(){
location.href = '/details/' + order_id; // 退款列表
}, 1000);
} else {
layer.alert(resp.errmsg || '网络异常');
}
},
error: function (res) {
console.log(res);
}
})
},
btn2: function(index, layero){
layer.close(index);
}
});
})
}
}
});
})(jQuery)
...@@ -5,13 +5,15 @@ ...@@ -5,13 +5,15 @@
goods:{ goods:{
add:function(){ add:function(){
$('.order-change-main').on('click', '.add_goods', function() { $('.order-change-main').on('click', '.add_goods', function() {
var goods_type = $(this).data('type');
layer.open({ layer.open({
area: ['1000px', '400px'], area: ['1000px', '400px'],
type: 1, type: 1,
title: '新增商品', title: '新增商品',
content: $('#addGoods'), content: $('#addGoods'),
btn: ['新增', '取消'], btn: ['新增', '取消'],
btn1: function() { btn1: function(index) {
var sku_id = $('.search-sku').val(); var sku_id = $('.search-sku').val();
var goods_min_num = $('.sku-info').find('.moq').text(); // 最小起订量 var goods_min_num = $('.sku-info').find('.moq').text(); // 最小起订量
var goods_id = $('.sku-info').find('.goods_id').val(); var goods_id = $('.sku-info').find('.goods_id').val();
...@@ -59,6 +61,7 @@ ...@@ -59,6 +61,7 @@
order_id: order_id, order_id: order_id,
goods_id: goods_id, goods_id: goods_id,
goods_num: goods_min_num, goods_num: goods_min_num,
goods_type: goods_type,
}; };
$.ajax({ $.ajax({
...@@ -67,15 +70,94 @@ ...@@ -67,15 +70,94 @@
data: datax, data: datax,
dataType: "json", dataType: "json",
success: function(resp){ success: function(resp){
if(resp.errcode == 0){ if(resp.errcode != 0){
layer.msg(resp.errmsg || '操作成功'); layer.alert(resp.errmsg || '网络异常');
return false;
}
layer.msg(resp.errmsg || '操作成功');
if (goods_type == 1) {
// 添加商品明细
var html = '';
var goods_len = 0; // 明细条数
$('.order-change-table').find('tbody tr').each(function() {
goods_len++
})
if (goods_len == 1) {
$('.deletegoods').attr('disabled', false).css('pointer-events', 'auto');
}
var curr_no = goods_len + 1; // 当前添加行序号
var data = eval('('+resp.data+')');
var order_item = data.item; // 当前新增商品信息
var sup = order_item.canal ? order_item.supplier_id+'.'+order_item.canal : order_item.supplier_id;
html += '<tr data-sup="'+sup+'">\
<td>'+curr_no+'</td>\
<td>\
<input type="hidden" name="change_info['+curr_no+'][supplier_id]" value="'+order_item.supplier_id+'">\
<input type="hidden" name="change_info['+curr_no+'][supplier_name]" value="'+order_item.supplier_name+'">\
<p>'+order_item.supplier_name+'</p>\
</td>\
<td>\
<input class="change_goods_name" type="hidden" name="change_info['+curr_no+'][goods_name]" value="'+order_item.goods_name+'">\
<p>'+order_item.goods_name+'</p>\
</td>\
<td>\
<input class="only_number num change_goods_number" name="change_info['+curr_no+'][goods_number]" value="'+order_item.goods_number+'">\
</td>\
<td>\
<input class="price only_number" name="change_info['+curr_no+'][goods_price]" data-price="'+order_item.goods_price+'" value="'+order_item.goods_price+'">\
</td>\
<td>\
<input class="change_status" type="hidden" name="change_info['+curr_no+'][status]" value="1">\
<span class="change_status_val">正常<i style="color:green;">(新增)</i></span>\
</td>\
<td>\
<a class="btn btn-xs btn-danger deletegoods" href="javascript:;" data-id="" data-type="1">删除</a>\
<input class="is_add" type="hidden" name="change_info['+curr_no+'][is_add]" value="1" />\
<input type="hidden" name="change_info['+curr_no+'][goods_id]" value="'+order_item.goods_id+'" />\
<input type="hidden" name="change_info['+curr_no+'][canal]" value="'+order_item.canal+'" />\
</td>\
</tr>';
$('.order-change-table').find('tbody').append(html);
$('.order-change-table').find('tbody input').trigger('blur'); // 自动触发
// 添加附加费
var extend_fee_items = data.extend_fee_items;
var extend = '';
for (var i in extend_fee_items) {
extend += '<tr data-sup="'+i+'">\
<td>\
<p>'+extend_fee_items[i].supplier_name+'</p>\
<input type="hidden" name="change_extend_fee['+i+'][supplier_name]" value="'+extend_fee_items[i].supplier_name+'">\
</td>\
<td>\
<input type="hidden" name="change_extend_fee['+i+'][amount]" class="sup_amount" value="'+extend_fee_items[i].amount+'">\
<p class="sup_amount_val">'+extend_fee_items[i].amount+'</p>\
</td>\
<td>\
<input class="adjust_extend_fee only_number" name="change_extend_fee['+i+'][extend_fee]" value="'+extend_fee_items[i].extend_fee+'">\
<input type="hidden" name="change_extend_fee['+i+'][count]" value="'+extend_fee_items[i].count+'">\
<input type="hidden" name="change_extend_fee['+i+'][ladder_max]" value="'+extend_fee_items[i].ladder_max+'">\
</td>\
</tr>';
}
$('.extend-fee-table').find('tbody').empty().append(extend);
$('.extend-fee-table').find('tbody input').trigger('keyup'); // 自动触发
layer.close(index);
} else {
setTimeout(function(){ setTimeout(function(){
location.reload(); location.reload();
}, 1000); }, 1000);
return false; }
} else {
layer.alert(resp.errmsg || '网络异常');
}
}, },
}) })
...@@ -91,10 +173,6 @@ ...@@ -91,10 +173,6 @@
var val = $(this).val(); var val = $(this).val();
if (val.toLowerCase() == 'digikey') { if (val.toLowerCase() == 'digikey') {
// layer.tips('暂不能添加digikey商品', $(this)); // 临时添加
// $(this).val('');
// return false;
$('.skuid-info').css('display', 'block'); $('.skuid-info').css('display', 'block');
$('.layui-layer-iframe .layui-layer-btn, .layui-layer-page .layui-layer-btn').css('padding-top', '50px'); $('.layui-layer-iframe .layui-layer-btn, .layui-layer-page .layui-layer-btn').css('padding-top', '50px');
} else { } else {
...@@ -104,13 +182,15 @@ ...@@ -104,13 +182,15 @@
}) })
$('.order-change-main').on('click', '.add_goods_no_skuid', function() { $('.order-change-main').on('click', '.add_goods_no_skuid', function() {
var goods_type = $(this).data('type');
layer.open({ layer.open({
area: ['600px'], area: ['600px'],
type: 1, type: 1,
title: '新增商品', title: '新增商品',
content: $('#addGoodsNoSkuid'), content: $('#addGoodsNoSkuid'),
btn: ['新增', '取消'], btn: ['新增', '取消'],
btn1: function() { btn1: function(index) {
var order_id = $('#order_id').val(); var order_id = $('#order_id').val();
var add_goods_name = $('input[name=add_goods_name]').val(); var add_goods_name = $('input[name=add_goods_name]').val();
var add_brand_name = $('input[name=add_brand_name]').val(); var add_brand_name = $('input[name=add_brand_name]').val();
...@@ -176,38 +256,88 @@ ...@@ -176,38 +256,88 @@
return false; return false;
} }
var datax = { if (goods_type == 1) { // 联营
add_type: 1, var html = '';
order_id: order_id, var goods_len = 0; // 明细条数
add_goods_name: add_goods_name,
add_brand_name: add_brand_name, $('.order-change-table').find('tbody tr').each(function() {
add_supplier_name: add_supplier_name, goods_len++
add_goods_id: add_goods_id, })
add_goods_number: add_goods_number,
add_goods_price: add_goods_price, var curr_no = goods_len + 1; // 当前添加行序号
add_delivery_time: add_delivery_time,
add_buyer_id: add_buyer_id, html += '<tr>\
add_batch: add_batch, <td>'+curr_no+'</td>\
add_remarks: add_remarks, <td>\
}; <input type="hidden" name="change_info['+curr_no+'][supplier_name]" value="'+add_supplier_name+'">\
<p>'+add_supplier_name+'</p>\
$.ajax({ </td>\
type: "POST", <td>\
url: '/ajax/addGoods', <input class="change_goods_name" type="hidden" name="change_info['+curr_no+'][goods_name]" value="'+add_goods_name+'">\
data: datax, <p>'+add_goods_name+'</p>\
dataType: "json", </td>\
success: function(resp){ <td>\
if(resp.errcode == 0){ <input class="only_number num change_goods_number" name="change_info['+curr_no+'][goods_number]" value="'+add_goods_number+'">\
layer.msg(resp.errmsg || '操作成功'); </td>\
setTimeout(function(){ <td>\
location.reload(); <input class="price only_number" name="change_info['+curr_no+'][goods_price]" data-price="'+add_goods_price+'" value="'+add_goods_price+'">\
}, 1000); </td>\
return false; <td>\
} else { <input class="change_status" type="hidden" name="change_info['+curr_no+'][status]" value="1">\
layer.alert(resp.errmsg || '网络异常'); <span class="change_status_val">正常<i style="color:green;">(新增)</i></span>\
} </td>\
}, <td>\
}) <a class="btn btn-xs btn-danger deletegoods" href="javascript:;" data-id="" data-type="1">删除</a>\
<input class="is_add" type="hidden" name="change_info['+curr_no+'][is_add]" value="1" />\
<input type="hidden" name="change_info['+curr_no+'][add_type]" value="1" />\
<input type="hidden" name="change_info['+curr_no+'][order_id]" value="'+order_id+'" />\
<input type="hidden" name="change_info['+curr_no+'][goods_id]" value="'+add_goods_id+'" />\
<input type="hidden" name="change_info['+curr_no+'][brand_name]" value="'+add_brand_name+'" />\
<input type="hidden" name="change_info['+curr_no+'][delivery_time]" value="'+add_delivery_time+'" />\
<input type="hidden" name="change_info['+curr_no+'][buyer_id]" value="'+add_buyer_id+'" />\
<input type="hidden" name="change_info['+curr_no+'][batch]" value="'+add_batch+'" />\
<input type="hidden" name="change_info['+curr_no+'][remarks]" value="'+add_remarks+'" />\
</td>\
</tr>';
$('.order-change-table').find('tbody').append(html);
$('.order-change-table').find('tbody input').trigger('blur'); // 自动触发
layer.close(index);
} else {
var datax = {
add_type: 1,
order_id: order_id,
add_goods_name: add_goods_name,
add_brand_name: add_brand_name,
add_supplier_name: add_supplier_name,
add_goods_id: add_goods_id,
add_goods_number: add_goods_number,
add_goods_price: add_goods_price,
add_delivery_time: add_delivery_time,
add_buyer_id: add_buyer_id,
add_batch: add_batch,
add_remarks: add_remarks,
};
$.ajax({
type: "POST",
url: '/ajax/addGoods',
data: datax,
dataType: "json",
success: function(resp){
if(resp.errcode == 0){
layer.msg(resp.errmsg || '操作成功');
setTimeout(function(){
location.reload();
}, 1000);
return false;
} else {
layer.alert(resp.errmsg || '网络异常');
}
},
})
}
}, },
btn2: function(index) { btn2: function(index) {
...@@ -215,7 +345,7 @@ ...@@ -215,7 +345,7 @@
} }
}) })
$("#add_buyer_id").selectpicker(); // $("#add_buyer_id").selectpicker();
$('.layui-layer-content').css('overflow', 'visible'); $('.layui-layer-content').css('overflow', 'visible');
}) })
......
+(function($){
$.lie = $.lie || {version: "v1.0.0"};
$.extend($.lie, {
order:{
index:function(){
var self = this;
$.lie.droplist($('.droplist'));
$('#search').on('submit', function(e){
e.stopPropagation();
$(this).find('input.time').each(function(){
var val = $(this).val();
$(this).val(Date.parse(val) ? Date.parse(val) / 1000 : '');
});
return true;
});
// 特殊字符编码
function specialCode(chr)
{
switch (chr) {
case '!': return '%21'; break;
case '"': return '%22'; break;
case '#': return '%23'; break;
case '$': return '%24'; break;
case '%': return '%25'; break;
case '&': return '%26'; break;
case '\'': return '%27'; break;
case '(': return '%28'; break;
case ')': return '%29'; break;
case '*': return '%2A'; break;
case '+': return '%2B'; break;
case ',': return '%2C'; break;
case '/': return '%2F'; break;
case ':': return '%3A'; break;
case ';': return '%3B'; break;
case '<': return '%3C'; break;
case '=': return '%3D'; break;
case '>': return '%3E'; break;
case '?': return '%3F'; break;
case '@': return '%40'; break;
case '[': return '%5B'; break;
case ']': return '%5D'; break;
case '\\': return '%5C'; break;
case '|': return '%7C'; break;
default: return ''; break;
}
}
// 查找特殊字符
function specialStr(str)
{
var reg = new RegExp("[!\"#$%&'()*+,/:;<=>?@\\[\\]\\|]");
var len = str.length;
var rs = '';
for (var i = 0; i < len; i++) {
var val = str.substr(i, 1);
if (reg.test(val)) {
rs = rs + specialCode(val);;
} else {
rs = rs + val;
}
}
return rs;
}
// 搜索、导出条件
function orderListCommon(url, type) { // type-订单类型
var order_type = $('#order_type').data('default'),
order_contain = $('input[name=order_contain]').val(),
order_sn = $('input[name=order_sn]').val(),
erp_sn = $('input[name=erp_sn]').val(),
goods_name = $('input[name=goods_name]').val(),
select_time_type = $('#select_time_type').data('default'),
time_start = $('input[name="time_start"]').val(),
time_end = $('input[name="time_end"]').val(),
// order_type_a = $('#order_type_a').data('default'),
order_pay_type = $('#order_pay_type').val() ? $('#order_pay_type').val() : '',
order_status = $('#order_status').val() ? $('#order_status').val() : '',
sale_type = $('#sale_type').val() ? $('#sale_type').val() : '',
shipping_name = $('#shipping_name').val() ? $('#shipping_name').val() : '',
order_send = $('#order_send').val(),
order_source_pf = $('#order_source_pf').val() ? $('#order_source_pf').val() : '',
order_invoice_status = $('#order_invoice_status').val() ? $('#order_invoice_status').val() : '',
order_source_adtag = $('input[name="order_source_adtag"]').val(),
order_source_ptag = $('input[name="order_source_ptag"]').val(),
erp_order_id = $('#erp_order_id').val() ? $('#erp_order_id').val() : '',
test_order = $('input[name=test_order]'),
is_new = $('#is_new').val() ? $('#is_new').val() : '';
order_payment_mode = $('#order_payment_mode').val() ? $('#order_payment_mode').val() : '',
is_new_order = $('#is_new_order').val() ? $('#is_new_order').val() : '';
business_type = $('#business_type').val() ? $('#business_type').val() : '',
order_type_extend = $('#order_type_extend').val() ? $('#order_type_extend').val() : '',
status_extend = $('#status_extend').val() ? $('#status_extend').val() : '';
if (url == '/export') {
if (type == 1) { // 联营
if (test_order.length) {
if (!order_contain && !order_sn && !erp_sn && !goods_name && !time_start && !time_end && !order_pay_type && !order_status && !shipping_name && !order_send && !order_source_pf && !order_source_adtag && !order_source_ptag && !erp_order_id && !is_new && !is_new_order && !order_payment_mode && !test_order.is(':checked')) {
layer.msg('请选择筛选条件,再导出!');
return false;
}
} else {
if (!order_contain && !order_sn && !erp_sn && !goods_name && !time_start && !time_end && !order_pay_type && !order_status && !shipping_name && !order_send && !order_source_pf && !order_source_adtag && !order_source_ptag && !erp_order_id && !is_new && !is_new_order && !order_payment_mode) {
layer.msg('请选择筛选条件,再导出!');
return false;
}
}
} else { // 自营
if (test_order.length) {
if (!order_contain && !order_sn && !erp_sn && !goods_name && !time_start && !time_end && !order_pay_type && !order_payment_mode && !order_status && !sale_type && !order_invoice_status && !order_source_pf && !order_source_adtag && !order_source_ptag && !is_new && !business_type && !order_type_extend && !status_extend && !test_order.is(':checked')) {
layer.msg('请选择筛选条件,再导出!');
return false;
}
} else {
if (!order_contain && !order_sn && !erp_sn && !goods_name && !time_start && !time_end && !order_pay_type && !order_payment_mode && !order_status && !sale_type && !order_invoice_status && !order_source_pf && !order_source_adtag && !order_source_ptag && !is_new && !business_type && !order_type_extend && !status_extend) {
layer.msg('请选择筛选条件,再导出!');
return false;
}
}
}
}
var listUrl = url;
listUrl += '?order_type=' + order_type;
if (order_contain) {
listUrl += '&order_contain=' + specialStr(order_contain);
}
if (order_sn) {
listUrl += '&order_sn=' + order_sn;
}
if (erp_sn) {
listUrl += '&erp_sn=' + erp_sn;
}
if (goods_name) {
listUrl += '&goods_name=' + specialStr(goods_name);
}
if (select_time_type) {
listUrl += '&select_time_type=' + select_time_type;
}
if(time_start){
time_start = Date.parse(time_start) / 1000;
listUrl += '&time_start='+time_start;
}
if(time_end){
time_end = Date.parse(time_end) / 1000 + (24*60*60-1);
listUrl += '&time_end='+time_end;
}
// if (order_type_a) {
// listUrl += '&order_type_a=' + order_type_a;
// }
if (order_pay_type) {
listUrl += '&order_pay_type=' + order_pay_type;
}
if (order_status) {
listUrl += '&order_status=' + order_status;
}
if (sale_type) {
listUrl += '&sale_type=' + sale_type;
}
if (shipping_name) {
listUrl += '&shipping_name=' + shipping_name;
}
if (order_send) {
listUrl += '&order_send=' + order_send;
}
if (order_source_pf) {
listUrl += '&order_source_pf=' + order_source_pf;
}
if (order_invoice_status) {
listUrl += '&order_invoice_status=' + order_invoice_status;
}
if (order_source_adtag) {
listUrl += '&order_source_adtag=' + order_source_adtag;
}
if (order_source_ptag) {
listUrl += '&order_source_ptag=' + order_source_ptag;
}
if (erp_order_id) {
listUrl += '&erp_order_id=' + erp_order_id;
}
if (is_new) {
listUrl += '&is_new=' + is_new;
}
if (is_new_order) {
listUrl += '&is_new_order=' + is_new_order;
}
if (order_payment_mode) {
listUrl += '&order_payment_mode=' + order_payment_mode;
}
if (business_type) {
listUrl += '&business_type=' + business_type;
}
if (order_type_extend) {
listUrl += '&order_type_extend=' + order_type_extend;
}
if (status_extend) {
listUrl += '&status_extend=' + status_extend;
}
if (test_order.is(':checked')) {
listUrl += '&test_order=' + 1;
}
if (url == '/export') {
listUrl += '&order_goods_type='+type;
}
return listUrl;
}
// 联营搜索
$('.searchOrder').click(function(){
var listUrl = orderListCommon('/list', 1);
location.href = listUrl;
})
// 自营搜索
$('.search_self_order').click(function(){
var listUrl = orderListCommon('/self_order', 2);
location.href = listUrl;
})
// 联营导出订单
$('.exportExcel').click(function() {
var listUrl = orderListCommon('/export', 1);
$.get(listUrl, function(resp) {
if (resp.err_code != 0) {
layer.msg(resp.err_msg);
return false;
}
window.open(resp.data, '_blank');
})
layer.msg('推入导出系统中...', {icon: 16, time: 1000, shade: 0.3}); // 阻止重复提交
})
// 自营导出订单
$('.self_export').click(function() {
var listUrl = orderListCommon('/export', 2);
$.get(listUrl, function(resp) {
if (resp.err_code != 0) {
layer.msg(resp.err_msg);
return false;
}
window.open(resp.data, '_blank');
})
layer.msg('推入导出系统中...', {icon: 16, time: 1000, shade: 0.3}); // 阻止重复提交
})
// 选择查看测试订单
$('input[name=test_order]').click(function(){
if ($(this).is(':checked')) {
$(this).val(1);
} else {
$(this).val('');
}
})
// 下载合同
$('.download-contract').click(function(){
var order_id = $(this).data('id');
$.ajax({
url: '/ajaxDownloadContract',
type: 'post',
data: {order_id:order_id},
dataType: 'json',
success: function(resp) {
if (resp.errcode != 0) {
layer.msg(resp.msg);
return false;
}
location.href = resp.data;
},
error: function(err) {
console.log(err)
}
})
})
// 切换类型时,清空输入框内容
$('.dropdown-menu>li').click(function(){
var val = $(this).data('val'); // 当前值
var def = $(this).parents('.droplist').data('default'); // 默认值
if (val !== def) {
if ($(this).parents('.droplist').attr('name') == 'order_type') {
$('input[name=order_contain]').val(''); // 清空
}
$(this).parents('.droplist').data('default', val); // 赋值
}
})
// 展示列表下的内容
$('.show-list').click(function(){
var self = $(this);
var nextTr = self.parent('tr').next('.show-other-content');
var order_id = self.parent('tr').data('oid');
var order_goods_type = self.parent('tr').data('type');
if (nextTr.css('display') == 'none') {
self.parent('tr').siblings('.show-other-content').hide();
nextTr.show();
// 请求api接口,获取明细
$.ajax({
url: '/api/getOrderItems',
type: 'post',
data: {order_id:order_id},
dataType: 'json',
success: function(resp) {
if (resp.errcode == 0) {
var data = resp.data;
var len = data.length;
var html = '';
for (var i = 0; i < len; i++) {
if (i < 2) {
html += '<tr>\
<td>'+data[i].goods_name+'</td>\
<td>'+data[i].brand_name+'</td>\
<td>'+data[i].goods_number+'</td>\
<td>'+data[i].goods_price_format+'</td>\
<td>'+data[i].single_pre_price_format+'</td>\
<td>'+data[i].single_pre_price_amount+'</td>';
if (order_goods_type == 1) {
html += '<td>'+data[i].supplier_name+'</td>';
}
html += '<td>'+data[i].delivery_time+'</td>';
if (order_goods_type == 1) {
var rec_id = data[i].rec_id;
$.ajax({
url: '/api/getOrderItemsTrack',
type: 'post',
data: {rec_id: rec_id},
dataType: 'json',
async: false,
success: function(relt) {
if (relt.errcode == 0) {
html += '<td colspan="5"><a class="order-track" data-rid="'+rec_id+'">'+relt.data+'</a></td>';
} else {
html += '<td colspan="5"></td>';
}
}
})
}
html += '</tr>';
}
}
if (len > 2) {
var details_url = order_goods_type == 1 ? '/details/'+order_id : '/details/'+order_id+'?tags=self';
html += '<tr>\
<td colspan="14" style="text-align: center;"><a href="'+details_url+'" target="_blank">查看更多明细...</a></td>\
</tr>';
}
// 插入到tbody
self.parent('tr').next('.show-other-content').find('.list-item-table>tbody').empty().append(html);
return false;
}
layer.msg(resp.msg);
},
error: function(err) {
console.log(err)
}
})
} else {
nextTr.hide();
}
})
// ERP订单列表
$('.searchErpOrder').click(function(){
var order_type = $('#order_type').data('default'),
order_contain = $('input[name=order_contain]').val(),
time_start = $('input[name="time_start"]').val(),
time_end = $('input[name="time_end"]').val(),
order_status = $('#order_status').val(),
order_send = $('#order_send').val(),
order_source = $('#order_source').val(),
listUrl = '/erp_order';
listUrl += '?order_type=' + order_type;
if (order_contain) {
listUrl += '&order_contain=' + specialStr(order_contain);
}
if(time_start){
time_start = Date.parse(time_start) / 1000;
listUrl += '&time_start='+time_start;
}
if(time_end){
time_end = Date.parse(time_end) / 1000 + (24*60*60-1);
listUrl += '&time_end='+time_end;
}
if (order_status) {
listUrl += '&order_status=' + order_status;
}
if (order_send) {
listUrl += '&order_send=' + order_send;
}
if (order_source) {
listUrl += '&order_source=' + order_source;
}
location.href = listUrl;
})
// 点击获取订单其他信息
$('.order-other-info').click(function(){
var page_type = $('#page_type').val(); // 区分页面 1-联营,2-自营,3-ERP
orderOtherInfo(page_type);
})
// 管理账户直接显示订单其他信息
if (manager == 1) {
var page_type = $('#page_type').val();
orderOtherInfo(page_type, 1);
}
// 订单其他信息:已付款, 下单用户数, 付款用户数, 金额
function orderOtherInfo(pid, is_manager=0) {
var order_contain = $('input[name=order_contain]').val(),
time_start = $('input[name="time_start"]').val(),
time_end = $('input[name="time_end"]').val();
if(time_start){
time_start = Date.parse(time_start) / 1000;
}
if(time_end){
time_end = Date.parse(time_end) / 1000 + (24*60*60-1);
}
var datax = {
order_type : $('#order_type').data('default'),
order_contain : specialStr(order_contain),
order_sn : $('input[name=order_sn]').val(),
erp_sn : $('input[name=erp_sn]').val(),
goods_name : $('input[name=goods_name]').val(),
time_start : time_start,
time_end : time_end,
order_pay_type : $('#order_pay_type').val() ? $('#order_pay_type').val() : '',
order_status : $('#order_status').val() ? $('#order_status').val() : '',
sale_type : $('#sale_type').val() ? $('#sale_type').val() : '',
shipping_name : $('#shipping_name').val() ? $('#shipping_name').val() : '',
order_send : $('#order_send').val(),
order_source_pf : $('#order_source_pf').val() ? $('#order_source_pf').val() : '',
order_invoice_status : $('#order_invoice_status').val() ? $('#order_invoice_status').val() : '',
order_source_adtag : $('input[name="order_source_adtag"]').val(),
order_source_ptag : $('input[name="order_source_ptag"]').val(),
erp_order_id : $('#erp_order_id').val() ? $('#erp_order_id').val() : '',
test_order : $('input[name=test_order]').is(':checked') ? 1 : 0,
is_new : $('#is_new').val() ? $('#is_new').val() : '',
order_payment_mode : $('#order_payment_mode').val() ? $('#order_payment_mode').val() : '',
is_new_order : $('#is_new_order').val() ? $('#is_new_order').val() : '',
business_type : $('#business_type').val() ? $('#business_type').val() : '',
pid : pid,
is_manager : is_manager,
};
$.ajax({
type: "POST",
url: '/ajax/orderOtherInfoLoading',
data: datax,
dataType: "json",
success: function(resp){
if (resp.err_code != 0) {
layer.msg(resp.err_msg);
return false;
}
var data = resp.data;
var html = '';
if (pid != 3) {
html += ',<span class="paid_order_count">'+data.paid_order_count+'单已付款(包含预付款),</span><span class="user_count">下单用户数为'+data.user_count+'人,</span><span class="paid_user_count">付款用户数为'+data.paid_user_count+'人,</span>';
}
html += '<span class="rmb_count">应付金额 ¥'+data.pay_count.rmb_count+',</span><span class="usd_count">$'+data.pay_count.usd_count+',</span><span class="rmb_pay">实收金额 ¥'+data.pay_count.rmb_pay+',</span><span class="usd_pay">$'+data.pay_count.usd_pay+',</span>';
if (pid != 3 && data.noreason_count) {
html += '<span class="error">共有'+data.noreason_count+'单已取消订单未填写取消原因</span>';
}
$('.show-other-info').append(html);
$('.order-other-info').hide();
},
})
}
},
}
});
})(jQuery)
+(function($){
$.lie = $.lie || {version: "v1.0.0"};
$.extend($.lie, {
audit: {
index:function() {
// 主管审核
$('.manager-audit').click(function() {
var order_id = $(this).data('id');
// 弹出提示
layer.open({
area: ['360px'],
title: '提示信息',
content: '确定审核通过该订单吗?',
btn:['确定', '取消'],
yes: function(index, layero){
$.ajax({
url : '/ajaxAuditPass',
type: 'post',
data: {order_id: order_id},
dataType: 'json',
success: function (resp) {
if(resp.errcode === 0){
layer.msg(resp.errmsg || '操作成功');
setTimeout(function(){
location.reload();
}, 1000);
} else {
layer.alert(resp.errmsg || '网络异常', function() {
location.reload();
});
}
},
error: function (res) {
console.log(res);
}
})
layer.msg('提交中...', {icon: 16, time: 0, shade: 0.3}); // 阻止重复提交
},
btn2: function(index, layero){
layer.close(index);
}
});
})
// 反审
$('.re-audit').click(function() {
var order_id = $(this).data('id');
// 弹出提示
layer.open({
area: ['360px'],
title: '提示信息',
content: '确定再次审核该订单吗?',
btn:['确定', '取消'],
yes: function(index, layero){
$.ajax({
url : '/ajaxReAudit',
type: 'post',
data: {order_id: order_id},
dataType: 'json',
success: function (resp) {
if(resp.errcode === 0){
layer.msg(resp.errmsg || '操作成功');
window.open('/change/' + order_id, '_blank')
return false;
}
layer.alert(resp.errmsg || '网络异常');
return false;
},
error: function (res) {
console.log(res);
}
})
layer.msg('提交中...', {icon: 16, time: 0, shade: 0.3}); // 阻止重复提交
},
btn2: function(index, layero){
layer.close(index);
}
});
})
},
}
})
})(jQuery)
\ No newline at end of file
+(function($){
$.lie = $.lie || {version: "v1.0.0"};
$.extend($.lie, {
cancel: {
// 取消订单弹框
cancelorder:function () {
// 填写订单取消原因
$('.input-cancel-reason').click(function(){
var self = $(this);
var order_id = self.data('oid');
var type = self.data('type');
var title = '';
switch (type) {
case 2: title = '取消订单'; break;
case 3: title = '订单审核不通过'; break;
case 4: title = '填写订单取消原因'; break;
case 5: title = '填写退货退款原因'; break;
default: title = '填写订单取消原因'; break;
}
var content = '<div class="form-group">'+
'<label>网站数据不准: </label>'+
'<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="品牌不准">品牌不准</label>'+
'</div>'+
'</div>'+
'<div class="form-group">'+
'<label>更改订单信息: </label>'+
'<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="更改付款方式">更改付款方式</label>'+
'</div>'+
'</div>'+
'<div class="form-group">'+
'<label>额外附加费: </label>'+
'<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="3C商检">3C商检</label>'+
'<label class="radio-inline"><input type="radio" name="cancel_reason" value="运费">运费</label>'+
'</div>'+
'</div>'+
'<div class="form-group">'+
'<label>客户需求变动: </label>'+
'<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>'+
'</div>'+
'</div>'+
'<div class="form-group">'+
'<label>其他问题: </label>'+
'<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" style="display:none;">'+
'<textarea class="form-control" name="input-other-reason" placeholder="请填写其他原因"></textarea>'+
'</div>'+
'</div>';
layer.open({
area: ['800px'],
title: title,
content: content,
btn:['确认', '取消'],
btn1:function(index){
var cancel_reason = $('input[name=cancel_reason]:checked').val();
// $select = new Array();
// $('input[name=cancel_reason]:checked').each(function(data,select_check){
// $select[data] = ($(select_check).val());
// })
// cancel_reason = $select.join(', ');
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;
}
}
// 退货退款弹出层
if (type == 5) {
self.siblings('.refund_reason').val(cancel_reason);
self.siblings('.refund_reason_val').empty().text(cancel_reason);
layer.close(index);
return false; // 阻止继续执行
}
$.ajax({
url:'/ajaxCancel',
data: {order_id: order_id, cancel_reason: cancel_reason, type: type},
type:'post',
dataType: 'json',
success:function(resp){
if(resp.errcode == 0){
// self.remove();
layer.msg(resp.errmsg);
location.reload();
// layer.close();
} else {
layer.alert(resp.errmsg || '网络异常');
}
},
error:function(){
layer.alert('网络异常');
}
});
},
btn2:function(index){
layer.close(index);
}
})
})
// 显示或隐藏 其他输入框
$(document).delegate('input[name=cancel_reason]', 'click', function() {
var cancel_reason = $('input[name=cancel_reason]:checked').val();
if (cancel_reason == 1) {
$('.input-other-reason').show();
$('.layui-layer-content').css('height', 'auto');
} else {
$('.input-other-reason').hide();
$('.layui-layer-content').css('height', 'auto');
}
})
},
}
})
})(jQuery)
\ No newline at end of file
+(function($){
$.lie = $.lie || {version: "v1.0.0"};
$.extend($.lie, {
send_mail: {
index:function() {
// 发送邮件
$(document).on('click','.send_mail', function(data){
var order_id = $(this).data('id');
var cc_sales_count = cc_sales.length;
var html = '';
for (var i = 0; i < cc_sales_count; i++) {
html += '<option value="'+cc_sales[i].userId+'">'+cc_sales[i].name+'</option>';
}
var content = '<div class="form-group">\
<label class="col-sm-4 control-label">是否有额外的抄送人员?</label>\
<div class="col-sm-8">\
<select id="cc_email" name="cc_email" class="form-control cc_email selectpicker" data-live-search="true" data-size="7" title="全部" multiple>\
'+html+'\
</select>\
</div>\
</div>\
<p style="padding-top: 50px;"><i class="error"> * </i>若无额外抄送人,直接点击‘确认’按钮即可</p>';
layer.open({
area: ['600px', '200px'],
title:'邮件抄送',
content: content,
btn:['确认', '取消'],
//提交事件
btn1:function(){
var cc_email = $('#cc_email').val();
$.ajax({
url: '/send_mail',
data: {id: order_id, cc_email: cc_email},
type:'post',
dataType: 'json',
success:function(resp){
if(resp.errcode == 0){
layer.msg(resp.errmsg || '操作成功');
setTimeout(function(){
location.reload();
}, 1000);
return false;
} else {
layer.alert(resp.errmsg || '网络异常');
}
},
error:function(){
layer.alert('网络异常');
}
});
},
btn2:function(index){
layer.close(index);
}
});
$(".cc_email").selectpicker({
actionsBox:true, //在下拉选项添加选中所有和取消选中的按钮
countSelectedText:"已选中{0}项",
selectedTextFormat:"count > 5",
selectAllText: '全选',
deselectAllText: '取消全选',
})
$('.layui-layer-content').css('overflow', 'visible');
})
},
}
})
})(jQuery)
\ No newline at end of file
+(function($){
$.lie = $.lie || {version: "v1.0.0"};
$.extend($.lie, {
track: {
orderTrack:function() {
// 查看订单明细跟踪
$('.list-item-table').off().delegate('.order-track', 'click', function () {
var rid = $(this).data('rid');
$.ajax({
url : '/ajax/getOrderItemsTrack',
type: 'post',
data: {rec_id : rid},
success: function(resp) {
if (resp.errcode == 0) {
var data = resp.data;
var content = '<table class="table">\
<tr>\
<th width="30%">时间</th>\
<th>说明</th>\
<th width="13%">负责人</th>\
</tr>';
for (var i = 0; i < data.length; i++) {
content += '<tr><td>'+data[i].create_time+'</td><td>'+data[i].track_content+',数量:'+data[i].track_num+'</td><td>'+data[i].create_name+'</td></tr>';
}
content += '</table>';
layer.open({
title: '订单明细跟踪',
area: ['600px', '400px'],
content: content,
btn: [],
})
} else {
layer.alert(resp.errmsg || '网络异常');
}
},
error: function(err) {
console.log(err);
}
})
})
},
}
})
})(jQuery)
\ No newline at end of file
...@@ -387,7 +387,7 @@ ...@@ -387,7 +387,7 @@
$('.return_num').keyup(function() { $('.return_num').keyup(function() {
var removal_number = parseInt($(this).parents('tr').find('.removal_number').val()); // 出库数量 var removal_number = parseInt($(this).parents('tr').find('.removal_number').val()); // 出库数量
var single_pre_price = parseFloat($(this).parents('tr').find('.single_pre_price').val()); // 均摊单价 var single_pre_price = parseFloat($(this).parents('tr').find('.single_pre_price').val()); // 均摊单价
var pay_amount = $('.pay_amount').val(); var pay_amount = parseFloat($('.pay_amount').val());
var val = $(this).val(); // 退货数量 var val = $(this).val(); // 退货数量
if (val > removal_number) { if (val > removal_number) {
......
...@@ -9,6 +9,8 @@ ...@@ -9,6 +9,8 @@
@include('orderlist.css') @include('orderlist.css')
@include('orderlist.js') @include('orderlist.js')
<script src="/js/orderamount.js"></script>
</head> </head>
<body class=""> <body class="">
......
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>订单管理后台 | 人工审单</title>
<script>document.domain="{{ Config::get('website.domain') }}";</script>
@include('detail.css')
@include('changeOrder.js')
</head>
<body class="">
<div id="wrapper">
<!-- layouts.navigation -->
@include('layouts.navigation')
<div id="page-wrapper" class="gray-bg">
<div class="row">
@include('changeOrder.content')
</div>
</div>
</div>
</body>
<div class="tabs-box adjusted_order" style="display: none;">
<div class="order-change-main">
<form id="adjustedOrderForm" class="form-horizontal table-responsive">
<input type="hidden" name="order_id" value="{{$order_info['order_id']}}">
<input type="hidden" name="sale_id" value="{{$order_info['sale_id']}}">
<input type="hidden" name="extra_fee" value="{{$order_temp_info['extra_fee']}}">
<input type="hidden" name="freight_fee" value="{{$order_temp_info['freight_fee']}}">
<input type="hidden" name="goods_amount" value="{{$order_temp_info['goods_amount']}}">
<input type="hidden" name="deposit_amount" value="{{$order_temp_info['deposit_amount']}}">
<input type="hidden" name="order_pay_type" value="{{$order_temp_info['order_pay_type']}}">
<input type="hidden" name="pay_time_limit" value="{{$order_temp_info['pay_time_limit']}}">
<input type="hidden" name="cancel_reason" value="{{isset($order_info['cancle_reason']) ? $order_info['cancle_reason'] : ''}}">
<table class="table table-bordered table-hover">
<thead>
<tr>
<th>型号</th>
<th>调整数量</th>
<th>调整单价</th>
</tr>
</thead>
<tbody>
@if (isset($order_temp_info['change_info']))
@foreach ($order_temp_info['change_info'] as $k => $v)
<tr>
<td>
<input type="hidden" name="change_info[{{$k}}][goods_name]" value="{{$v['goods_name']}}">
<p>{{$v['goods_name']}}</p>
</td>
<td>
<input type="hidden" name="change_info[{{$k}}][goods_number]" value="{{$v['goods_number']}}">
<p>{{$v['goods_number']}}</p>
</td>
<td>
<input type="hidden" name="change_info[{{$k}}][goods_price]" value="{{$v['goods_price']}}">
<p>{{$v['goods_price']}}</p>
</td>
</tr>
@endforeach
@endif
</tbody>
</table>
<hr>
<table class="table table-bordered table-hover">
<tr>
<th width="20%">订单类型:</th>
<td>
@if ($order_temp_info['order_pay_type'] == 1)
全款
@elseif ($order_temp_info['order_pay_type'] == 2)
预付款
@else
账期
@endif
</td>
</tr>
<tr>
<th>商品总额:</th>
<td>{{$order_temp_info['goods_amount']}}</td>
</tr>
<tr>
<th>优惠金额:</th>
<td>{{$order_price_info['discount_amount']}}</td>
</tr>
<tr>
<th>附加费:</th>
<td>{{$order_temp_info['extra_fee']}}</td>
</tr>
<tr>
<th>运费:</th>
<td>{{$order_temp_info['freight_fee']}}</td>
</tr>
<?php $order_amount_temp = $order_temp_info['goods_amount'] + $order_price_info['discount_amount'] + $order_temp_info['extra_fee'] + $order_temp_info['freight_fee']; ?>
<tr>
<th>订单总额:</th>
<td>{{$order_amount_temp}}</td>
</tr>
@if ($order_info['order_goods_type'] == 2)
<tr>
<th>支付优惠:</th>
<td>{{$order_price_info['pay_preferential'] ? $order_price_info['pay_preferential'] : 0}}</td>
</tr>
<tr>
<th>实际支付金额:</th>
<td>{{$order_amount_temp + $order_price_info['pay_preferential']}}</td>
</tr>
@endif
@if ($order_temp_info['order_pay_type'] == 2)
<tr>
<th>定金:</th>
<td>{{$order_temp_info['deposit_amount']}}</td>
</tr>
@endif
<tr>
<th>付款时间:</th>
<td>{{$order_temp_info['pay_time_limit'].'天'}}</td>
</tr>
</table>
</form>
</div>
</div>
<div class="wrapper">
@include('layouts.header')
<?php
$currency = $order_info['currency'] == 2 ? '$' : '¥';
?>
<div class="page-content order-details">
<style>
.submit-check { margin: 0 auto; width: 200px; }
/* 提交审核弹框label */
.submit-check label { display: inline-block; width: 120px; text-align: right;}
</style>
<div class="tabs-box">
<div class="order-change-main">
@if (($order_info['order_goods_type'] == 1 && $order_info['status'] == 1) || ($order_info['order_goods_type'] == 2 && $order_info['adjust_count'] < 2))
<form id="checkOrderForm" class="form-horizontal table-responsive">
<input type="hidden" name="auditor_role" value="{{ $role }}" >
<input type="hidden" name="order_sn" value="{{$order_info['order_sn']}}">
<input type="hidden" name="user_id" value="{{$order_info['user_id']}}">
<input type="hidden" id="order_id" name="order_id" value="{{$order_info['order_id']}}">
<input type="hidden" name="order_goods_type" value="{{$order_info['order_goods_type']}}">
<input type="hidden" name="sale_id" value="{{$order_info['sale_id']}}">
<input type="hidden" name="goods_amount" value="{{$order_price_info['goods_price']}}">
<input type="hidden" name="order_amount" value="{{$order_info['order_amount']}}">
<input type="hidden" name="cancel_reason" value="{{isset($order_info['cancle_reason']) ? $order_info['cancle_reason'] : ''}}">
<input type="hidden" name="check_failed" value="">
<input type="hidden" name="check_failed_info" value="">
<input type="hidden" name="change_pay_type" value="">
<input type="hidden" name="business_type" value="{{$order_temp_info['business_type']}}">
<?php $isNewClient = App\Http\Controllers\isNewClient($order_info['order_goods_type'], $order_info['user_id'], $order_info['create_time']); ?>
@if ($isNewClient)
<!-- 用户来源 -->
<p>用户来源</p>
<table class="table table-bordered table-hover check-table">
<tr class="client_source_row">
<td class="check-table-title" width="20%">用户来源:</td>
<td>
<div class="multi-reason">
<label><input type="radio" name="client_source" value="QQ群">QQ群</label>
<label><input type="radio" name="client_source" value="微信群">微信群</label>
<label><input type="radio" name="client_source" value="微信公众号">微信公众号</label>
<label><input type="radio" name="client_source" value="朋友介绍">朋友介绍</label>
<label><input type="radio" name="client_source" value="线下广告">线下广告</label>
<label><input type="radio" name="client_source" value="地推">地推</label>
<label><input type="radio" name="client_source" value="1">其他</label>
</div>
<div class="client-input-other" style="display: none;">
<textarea name="input-other-source" id="input-other-source" placeholder="请填写其他来源"></textarea>
</div>
</td>
</tr>
</table>
@endif
<!-- 存在digikey商品的时候展示 -->
@if ($is_dgk_exists)
<style>
#checkOrderForm .row { margin-left: 0px !important; margin-right: 0px !important; }
#checkOrderForm .form-group { margin-left: 0px !important; }
.change-order-end-client input { width: 300px; }
.change-order-end-client select { width: 200px; }
</style>
<div class="change-order-end-client">
<h4>终端客户信息 <span class="title-tips"><i class="fa fa-info-circle"></i>digikey渠道商品必填,其他渠道可不填写</span></h4>
<input type="hidden" class="customer_id" name="customer_id" value="{{ $order_extra ? $order_extra['id'] : '' }}">
<div class="row">
<div class="col-sm-6">
<div class="form-group">
<span><i class="text-danger">*</i> 终端中文名称:</span>
<input type="text" class="customer_cn" name="customer_cn" value="{{ $order_extra ? $order_extra['customer_cn'] : '' }}">
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<span><i class="text-danger">*</i> 客户类型:</span>
<select class="layui-select customer_type" name="customer_type">
<option value="">请选择</option>
@if (Config('params.end_user_type'))
@foreach (Config('params.end_user_type') as $k => $v)
<option value="{{ $k }}">{{ $v }}</option>
@endforeach
@endif
</select>
</div>
</div>
</div>
<div class="row">
<div class="col-sm-6">
<div class="form-group">
<span><i class="text-danger">*</i> 终端英文名称:</span>
<input type="text" class="customer_en" name="customer_en" value="{{ $order_extra ? $order_extra['customer_en'] : '' }}">
<a href="https://translate.google.cn/" target="_blank">谷歌翻译</a>
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<span><i class="text-danger">*</i> 产品用途:</span>
<select class="layui-select product_use_classone_sn" name="product_use_classone_sn">
<option value="">请选择</option>
@if ($api_dgk_config_one)
@foreach ($api_dgk_config_one as $k=>$v)
<option value="{{ $k }}">{{ $v }}</option>
@endforeach
@endif
</select>
<select class="layui-select product_use_classtwo_sn" name="product_use_classtwo_sn"></select>
</div>
</div>
</div>
</div>
<hr/>
@endif
<div>
<a class="btn btn-info add_goods" data-type="{{ $order_info['order_goods_type'] }}" style="float: right; margin-bottom: 5px;">新增商品</a>
@if ($order_info['order_goods_type'] == 1)
<a class="btn btn-primary add_goods_no_skuid" data-type="{{ $order_info['order_goods_type'] }}" style="float: right; margin-bottom: 5px; margin-right: 5px;">新增无SKUID</a>
@endif
</div>
<!-- 调价 -->
<table class="table table-bordered table-hover order-change-table">
<thead>
<th width="5%">序号</th>
<th width="20%">供应商</th>
<th>型号</th>
<th>调整数量</th>
<th>调整单价</th>
<!-- 销售类型为预售时展示 -->
@if ($order_info['sale_type'] == 2)
<th>交期时间/天</th>
<th>锁定库存</th>
@endif
<td>状态</td>
<th width="5%">操作</th>
</thead>
<tbody>
@foreach ($order_items_info as $k=>$v)
<tr class="change_item_{{$v['rec_id']}}" data-sup="{{$v['canal'] ? $v['supplier_id'].'.'.$v['canal'] : $v['supplier_id']}}">
<input class="change_rec_id" type="hidden" name="change_rec_id" value="{{ $v['rec_id'] }}">
<td>{{ $k+1 }}</td>
<td>
<input type="hidden" name="change_info[{{$v['rec_id']}}][supplier_name]" value="{{$v['supplier_name']}}">
<p>{{$v['supplier_name']}}</p>
</td>
<td>
<input class="change_goods_name" type="hidden" name="change_info[{{$v['rec_id']}}][goods_name]" value="{{$v['goods_name']}}">
<p>{{$v['goods_name']}}</p>
</td>
<td>
<input class="only_number num change_goods_number" name="change_info[{{$v['rec_id']}}][goods_number]" value="{{$v['goods_number']}}" <?= $v['status'] == -1 ? 'readonly' : '' ?>>
</td>
<td>
<input class="price only_number change_goods_price" name="change_info[{{$v['rec_id']}}][goods_price]" data-origin="{{$v['original_price']}}" data-price="{{$v['goods_price']}}" value="{{$v['goods_price']}}" <?= $v['status'] == -1 ? 'readonly' : '' ?>>
</td>
<!-- 销售类型为预售时展示 -->
@if ($order_info['sale_type'] == 2)
<td>
<input type="text" class="only_number" name="change_info[{{$v['rec_id']}}][delivery_time]" value="{{$v['delivery_time']}}" placeholder="请填写天数">
</td>
<td>
<!-- 未锁库存 -->
@if (!$v['is_lock'])
<label>
<input type="checkbox" name="change_info[{{$v['rec_id']}}][is_lock]" value="{{$v['goods_id']}}">
<span>锁定库存,可用库存:<b class="text-danger">{{ App\Http\Controllers\getSelfStock($v['goods_id']) }}</b></span>
</label>
@endif
</td>
@endif
<td>
<input class="change_status" type="hidden" name="change_info[{{$v['rec_id']}}][status]" value="{{$v['status']}}">
<span class="change_status_val"><?= $v['status'] == 1 ? '正常' : '<i class="error">已取消</i>' ?></span>
</td>
@if (in_array($order_info['status'], [1, 2]) && $v['status'] == 1)
<td><a class="btn btn-xs btn-danger deletegoods" href="javascript:;" data-id="<?= $v['rec_id'] ?>" data-type="{{ $order_info['order_goods_type'] }}">删除</a></td>
@else
<td></td>
@endif
<input type="hidden" class="del_reason" name="change_info[{{$v['rec_id']}}][del_reason]">
</tr>
@endforeach
</tbody>
</table>
<textarea name="kefu_remark" id="kefu_remark" class="form-control" placeholder="客服备注信息" style="resize: none;">{{$order_temp_info['kefu_remark']}}</textarea>
@if ($order_info['order_goods_type'] == 2)
<table class="table table-bordered table-hover" style="margin-top:10px;">
<tr>
<th width="20%">批量调价</th>
<td>
<input type="text" class="set_goods_price" name="set_goods_price" value="1">
<span class="text-danger">(批量设置单价,默认值1,折扣范围 0 < <= 1)</span>
</td>
</tr>
</table>
@endif
<?php $extend_fee_items = json_decode($order_temp_info['extend_fee_items'], true); ?>
<!-- 供应商附加费 -->
@if ($extend_fee_items)
<hr/>
<p>附加费设置</p>
<table class="table table-bordered table-hover extend-fee-table">
<thead>
<th width="20%">供应商/渠道</th>
<th>商品金额</th>
<th>调整附加费</th>
</thead>
<tbody>
@foreach ($extend_fee_items as $k => $v)
<tr data-sup="{{$k}}">
<td>
@if (strpos($k, '.') !== false)
<p>
<?php
$sid = explode('.', $k);
// echo App\Http\Controllers\getSupplierName($sid);
if ($sid[0] == 17) { // 联营供应商
echo $sid[1];
} else {
echo $v['supplier_name'];
}
?>
</p>
@else
<p>{{$v['supplier_name']}}</p>
@endif
<input type="hidden" name="change_extend_fee[{{$k}}][supplier_name]" value="{{$v['supplier_name']}}">
</td>
<td>
<input type="hidden" name="change_extend_fee[{{$k}}][amount]" class="sup_amount" value="{{$v['amount']}}">
<p class="sup_amount_val">{{$v['amount']}}</p>
</td>
<td>
<input class="adjust_extend_fee only_number" name="change_extend_fee[{{$k}}][extend_fee]" value="{{$v['extend_fee']}}">
</td>
<input type="hidden" name="change_extend_fee[{{$k}}][count]" value="{{$v['count']}}">
@if (isset($v['ladder_max']))
<input type="hidden" name="change_extend_fee[{{$k}}][ladder_max]" value="{{$v['ladder_max']}}">
@endif
</tr>
@endforeach
</tbody>
</table>
@endif
<hr/>
<table class="table table-bordered table-hover check-table">
@if ($order_info['order_goods_type'] == 1)
<tr>
<td class="check-table-title" width="20%">付款类型:</td>
<td class="check-select">
<label><input class="order_all_pay" type="radio" name="order_pay_type" value="1">全额付款</label>
<!-- 销售类型为现卖时展示 -->
@if ($order_info['sale_type'] == 1)
<label><input class="order_advance_pay" type="radio" name="order_pay_type" value="2">预付首款</label>
<label><input class="order_account_period" type="radio" name="order_pay_type" value="3">账期</label>
<!-- <label><input class="order_cod" type="radio" name="order_pay_type" value="4">货到猎芯付款</label> -->
@endif
</td>
</tr>
@else
<tr>
<td class="check-table-title" width="20%">付款类型:</td>
<td class="check-select">
<label><input class="order_all_pay" type="radio" name="order_pay_type" value="1">全额付款</label>
<label><input class="order_account_period" type="radio" name="order_pay_type" value="3">账期</label>
</td>
</tr>
@endif
</table>
<table class="table table-bordered table-hover">
<tr>
<th width="20%">商品总金额</th>
<td><p class="text-danger">{{$currency}}<span class="goods_total">{{$order_price_info['goods_price']}}</span></p></td>
</tr>
<!-- 销售类型为现卖时展示 -->
@if ($order_info['sale_type'] == 1 && $order_price_info['ext_price'])
<tr>
<th width="20%">附加费金额</th>
<td>
<p class="text-danger">{{$currency}}<span class="extra_fee">{{$order_price_info['ext_price'] ? $order_price_info['ext_price'] : 0}}</span></p>
<input type="hidden" name="extra_fee" autocomplete="off" value="{{$order_price_info['ext_price'] ? $order_price_info['ext_price'] : 0}}">
</td>
</tr>
@endif
@if ($order_info['order_goods_type'] == 2)
<tr>
<th>运费</th>
<td>
<span>{{$currency}}</span>
<input class="only_number freight_fee" type="text" name="freight_fee" value="{{ $order_price_info['shipping_price'] ? $order_price_info['shipping_price'] : 0 }}">
</td>
</tr>
@endif
<tr>
<th width="20%">订单总额</th>
<td>
<p class="text-danger">{{$currency}}<span class="total">{{$order_info['order_amount']}}</span></p>
</td>
</tr>
</table>
<div class="show-advance-pay">
<hr/>
<p>定金调整</p>
<table class="table table-bordered table-hover">
<tr>
<th width="20%">定金金额</th>
<td>
<p class="text-danger">{{$currency}}
<?php
if (!$order_info['advance_amount'] OR $order_info['advance_amount']==0) {
$price = number_format($order_info['order_amount']*(3/10), 2, '.', '');
echo '<input type="text" name="deposit_amount" class="only_number advance" value="'.$price.'">';
} else {
echo '<input type="text" name="deposit_amount" class="only_number advance" value="'.$order_info['advance_amount'].'">';
}
?>
</p>
</td>
</tr>
</table>
</div>
<div class="show-pay-time">
<p>付款时间</p>
<table class="table table-bordered table-hover change-table">
<tr>
<th width="20%">选择付款时间</th>
<td>
<select name="payTime" class="payTime">
<option value="">请选择</option>
<option value="1">1天</option>
<!-- 预售订单默认2天 -->
@if ($order_info['sale_type'] == 2)
<option value="2" selected>2天</option>
@endif
<option value="3">3天</option>
<option value="7">7天</option>
<option value="15">15天</option>
<option value="other">其他</option>
</select>
<div class="customArea">
<input type="text" name="payTimeOther" class="payTimeOther" value="" style="width: 50px;">&nbsp;<span class="error">(自定义天数,限制1~30)</span>
</div>
</td>
</tr>
</table>
</div>
<div class="text-center" style="margin-top: 20px;">
@if ($order_temp_info['temp_save_info'])
<a class="btn btn-primary viewTempSave" style="margin-right: 20px;">变更历史</a>
@endif
@if ($order_info['order_goods_type'] == 1)
<a class="btn btn-info tempSave" style="margin-right: 20px;">保存</a>
@endif
@if ($order_info['order_goods_type'] == 2 && $order_temp_info['status'] == 1)
<a class="btn btn-primary checkAdjusted">查看调价信息</a>
@else
<a class="btn btn-success checkOrder">提交</a>
@endif
</div>
</form>
@endif
@if (($order_info['order_goods_type'] == 1 && $order_info['status'] == 2) || ($order_info['order_goods_type'] != 1 && $order_info['adjust_count'] == 2))
<div class="checked_section">
<div class="checked_left">
<p>交易状态:&nbsp;审核通过,请联系客户及时付款!
@if ($order_info['pay_time'])
<span>订单付款时间截止至:{{date('Y-m-d H:i:s', $order_info['pay_time'])}}</span>
@endif
</p>
<?php
if ($order_info['order_goods_type'] == 2) {
$adjustPriceUrl = "/adjustPrice/".$order_info['order_id']."?tags=self";
} else {
$adjustPriceUrl = "/adjustPrice/".$order_info['order_id'];
}
?>
@if ($order_info['order_goods_type'] == 2 && $order_info['adjust_count'] < 2)
<a class="btn btn-default" href="{{$adjustPriceUrl}}">再次调价</a><span class="warn-tip">每笔订单仅有一次“再次调价”机会</span>
@elseif ($order_info['order_goods_type'] == 1)
<a class="btn btn-default" href="{{$adjustPriceUrl}}">再次调价</a>
@endif
</div>
<!-- 非账期订单显示剩余时间 -->
@if ($order_info['order_pay_type'] != 3)
<div class="checked_right">
<p class="showtime">
<span class="error">剩余付款时间:</span>
<span class="count_time count_day"></span>
<span class="count_time count_hour"></span>
<span class="count_time count_min"></span>
<span class="count_time count_sec"></span>
</p>
<div class="showtime delay_time">
<span class="delay_time_title">延长付款时间:</span>
<select name="payTime" class="payTime">
<option value="">请选择</option>
<option value="1">1天</option>
<option value="3">3天</option>
<option value="7">7天</option>
<option value="15">15天</option>
<option value="other">其他</option>
</select>
<div class="customArea">
<input type="text" name="payTimeOther" class="payTimeOther" value="" style="width: 50px;">&nbsp;<span class="error">(自定义天数,限制1~30)</span>
</div>
<button class="btn btn-info btn-xs delay_confirm">确认</button>
</div>
</div>
@endif
</div>
@endif
@if ($order_info['status'] == -1)
@if ($order_info['cancel_reason'] != '')
<p>交易状态:&nbsp;审核不通过</p>
<p>审核不通过原因:&nbsp;{{$order_info['cancel_reason']}}</p>
@else
<p>交易状态:&nbsp;用戶取消</p>
@endif
@endif
</div>
</div>
<!-- 自营订单客服调价低于80% 显示经理审核 -->
@if ($order_info['order_goods_type'] == 2 && $order_temp_info['status'] == 1)
<script>
$('#checkOrderForm').find('input').attr('disabled', true);
$('#checkOrderForm').find('select').attr('disabled', true);
</script>
@include('changeOrder.adjusted')
@endif
@if ($order_temp_info['temp_save_info'])
@include('changeOrder.tempSave')
@endif
</div>
</div>
@include('changeOrder.addGoods')
@include('changeOrder.addGoodsNoSkuid')
<script>
var is_manager = "{{ in_array($role, [1, 2, 5]) ? true : false }}";
var isNewClient = "{{isset($isNewClient) ? $isNewClient : 0}}";
// var order_amount = "{{$order_info['order_amount']}}";
var currency = "{{$order_info['currency']}}"; // 币种
var order_pay_type = "{{$order_info['order_pay_type']}}"; // 付款类型
var discount_amount = "{{ $order_price_info['discount_amount'] ? $order_price_info['discount_amount'] : 0 }}"; // 优惠券金额
var pay_preferential = "{{ $order_price_info['pay_preferential'] ? $order_price_info['pay_preferential'] : 0 }}"; // 支付优惠(钱包)
var new_client_price = "{{ $order_price_info['new_client_price'] }}";
// 明细数目
var item_count = "{{ count($order_items_info) }}";
if (item_count == 1) {
$('.deletegoods').attr('disabled', true).css('pointer-events', 'none');
}
var rest_time = "{{$order_info['pay_time'] ? $order_info['pay_time'] - time() : NULL}}";
if (rest_time) {
countDown(rest_time);
} else {
$('.checked_right').hide();
}
// 倒计时
function countDown(times){
var timer=null;
timer = setInterval(function(){
var day=0,
hour=0,
minute=0,
second=0;//时间默认值
if (times > 0) {
day = Math.floor(times / (60 * 60 * 24));
hour = Math.floor(times / (60 * 60)) - (day * 24);
minute = Math.floor(times / 60) - (day * 24 * 60) - (hour * 60);
second = Math.floor(times) - (day * 24 * 60 * 60) - (hour * 60 * 60) - (minute * 60);
}
if (day <= 9) day = '0' + day;
if (hour <= 9) hour = '0' + hour;
if (minute <= 9) minute = '0' + minute;
if (second <= 9) second = '0' + second;
$('.count_day').text(day);
$('.count_hour').text(hour);
$('.count_min').text(minute);
$('.count_sec').text(second);
times--;
}, 1000);
if (times <= 0 ) {
clearInterval(timer);
}
}
// 延长付款时间
$('.delay_confirm').click(function(){
var order_id = "{{$order_info['order_id']}}";
var payTime = $('.payTime').val();
var payTimeOther = $('.payTimeOther').val();
var delay_time;
if (payTime == '') {
layer.msg('请选择付款时间');
return false;
}
if (payTime == 'other' && payTimeOther == '') {
layer.msg('请填写自定义时间');
return false;
}
if (payTimeOther) {
var reg = /\d/;
if (!reg.test(payTimeOther)) {
layer.msg('格式错误');
return false;
}
if (payTimeOther < 0 || payTimeOther > 30) {
layer.msg('自定义时间限制在1-30天');
return false;
}
}
if (payTime != '' && payTime != 'other') {
payTimeOther = '';
}
delay_time = payTimeOther ? payTimeOther : payTime;
// 弹出提示
layer.open({
title: '提示信息',
content: '确定延长付款时间吗?',
btn:['取消','确定'],
yes: function(index, layero){
layer.close(index);
},
btn2: function(index, layero){
$.ajax({
url : '/ajaxDelayTime',
type: 'post',
data: {order_id:order_id, delay_time:delay_time},
dataType: 'json',
success: function (resp) {console.log(resp)
if(resp.errcode === 0){
layer.msg(resp.errmsg || '操作成功');
setTimeout(function(){
location.reload();
}, 1000);
} else {
layer.alert(resp.errmsg || '网络异常');
}
},
error: function (res) {
console.log(res);
}
})
}
});
})
// dgk 终端客户信息
var is_dgk_exists = "{{ $is_dgk_exists }}";
if (is_dgk_exists) {
var api_dgk_config = eval('('+'{!! isset($api_dgk_config) ? json_encode($api_dgk_config) : '' !!}'+')');
var customer_type = "{{ $order_extra ? $order_extra['customer_type'] : 0 }}";
var product_use_classone_sn = "{{ $order_extra ? $order_extra['product_use_classone_sn'] : '' }}";
var product_use_classtwo_sn = "{{ $order_extra ? $order_extra['product_use_classtwo_sn'] : '' }}";
$('.order-change-main').delegate('.product_use_classone_sn', 'change', function(data){
var select_key = $('.product_use_classone_sn').find('option:selected').text();
$('.product_use_classtwo_sn').html('');
for(let key in api_dgk_config){
if(key == select_key){
for(var i = 0; i < api_dgk_config[key].length; i++){
$('.product_use_classtwo_sn').append('<option value="'+i+'">'+api_dgk_config[key][i]+'</option>')
}
}
}
})
// select 赋值
if (customer_type) {
$('select[name=customer_type]').val(customer_type);
}
if (product_use_classone_sn) {
$('select[name=product_use_classone_sn]').val(product_use_classone_sn);
$('select[name=product_use_classone_sn]').change(); // 添加change事件
$('select[name=product_use_classtwo_sn]').val(product_use_classtwo_sn);
}
}
$.lie.changeOrder.index();
$.lie.goods.add();
</script>
<script src="/js/jquery-2.2.1.js"></script>
<script src="/js/jquery.form.js"></script>
<script src="/js/bootstrap.min.js"></script>
<script src="/js/bootstrap-select.min.js"></script>
<script src="/layer/layer.js"></script>
<script src="/js/plugins/slimscroll/jquery.slimscroll.min.js"></script>
<script src="/js/plugins/metisMenu/jquery.metisMenu.js"></script>
<script src="/js/inspinia.min.js"></script>
<script src="/js/plugins/DatePicker/WdatePicker.js"></script>
<script src="/js/common.js"></script>
<script src="/js/change_order.js?v=<?= time() ?>"></script>
<script src="/js/goods.js?v=<?= time() ?>"></script>
<style>
#temp-save-info { display: none; }
#tempSaveForm { padding: 15px; }
</style>
<div id="temp-save-info">
<div class="order-change-main">
<form id="tempSaveForm" class="form-horizontal table-responsive">
@if ($order_temp_info['temp_save_info']['customer_cn'])
<table class="table table-bordered table-hover">
<tr class="caption">
<th colspan="4" style="text-align: center; background: #f9f9f9;">终端客户信息</th>
</tr>
<tr>
<th>客户名称(中文)</th>
<th>客户名称(英文)</th>
<th>客户类型</th>
<th>产品用途</th>
</tr>
<tr>
<td><?= $order_temp_info['temp_save_info']['customer_cn'] ?></td>
<td><?= $order_temp_info['temp_save_info']['customer_en'] ?></td>
<td><?= Config('params.end_user_type')[$order_temp_info['temp_save_info']['customer_type']] ?></td>
<td><?= $order_temp_info['temp_save_info']['product_use'] ?></td>
</tr>
</table>
@endif
<table class="table table-bordered table-hover">
<thead>
<tr>
<th width="40%">型号</th>
<th>调整数量</th>
<th>调整单价</th>
<th width="20%">状态</th>
</tr>
</thead>
<tbody>
@if (isset($order_temp_info['temp_save_info']['change_info']))
@foreach ($order_temp_info['temp_save_info']['change_info'] as $k => $v)
<tr>
<td>{{$v['goods_name']}}</td>
<td>{{$v['goods_number']}}</td>
<td>{{$v['goods_price']}}</td>
<td>
<?= $v['status'] == 1 ? '正常' : '<i style="color: red;">已取消</i>' ?>
@if (isset($v['is_add']))
<i style="color: green;">(新增)</i>
@endif
</td>
</tr>
@endforeach
@endif
</tbody>
</table>
<hr>
<table class="table table-bordered table-hover">
<tr>
<th width="20%">订单类型:</th>
<td>
@if ($order_temp_info['temp_save_info']['order_pay_type'] == 1)
全款
@elseif ($order_temp_info['temp_save_info']['order_pay_type'] == 2)
预付款
@else
账期
@endif
</td>
</tr>
<tr>
<th>商品总额:</th>
<td>{{$order_temp_info['temp_save_info']['goods_amount']}}</td>
</tr>
<tr>
<th>优惠金额:</th>
<td>{{$order_price_info['discount_amount']}}</td>
</tr>
<tr>
<th>附加费:</th>
<td>{{$order_temp_info['temp_save_info']['extra_fee']}}</td>
</tr>
<tr>
<th>运费:</th>
<td>{{$order_temp_info['temp_save_info']['freight_fee']}}</td>
</tr>
<?php $order_amount_temp = $order_temp_info['temp_save_info']['goods_amount'] + $order_price_info['discount_amount'] + $order_temp_info['temp_save_info']['extra_fee'] + $order_temp_info['temp_save_info']['freight_fee']; ?>
<tr>
<th>订单总额:</th>
<td>{{$order_amount_temp}}</td>
</tr>
@if ($order_info['order_goods_type'] == 2)
<tr>
<th>支付优惠:</th>
<td>{{$order_price_info['pay_preferential'] ? $order_price_info['pay_preferential'] : 0}}</td>
</tr>
<tr>
<th>实际支付金额:</th>
<td>{{$order_amount_temp + $order_price_info['pay_preferential']}}</td>
</tr>
@endif
@if ($order_temp_info['temp_save_info']['order_pay_type'] == 2)
<tr>
<th>定金:</th>
<td>{{$order_temp_info['temp_save_info']['deposit_amount']}}</td>
</tr>
@endif
<tr>
<th>付款时间:</th>
<td>{{$order_temp_info['temp_save_info']['pay_time_limit'].'天'}}</td>
</tr>
<tr>
<th>客服备注:</th>
<td>{{ $order_temp_info['temp_save_info']['kefu_remark'] }}</td>
</tr>
</table>
</form>
</div>
</div>
<script>
var temp_save_info = '{!! json_encode($order_temp_info["temp_save_info"]) !!}';
temp_save_info = eval('('+temp_save_info+')');
console.log(temp_save_info)
</script>
...@@ -8,8 +8,8 @@ ...@@ -8,8 +8,8 @@
{{ Autograph() }} {{ Autograph() }}
@include('orderlist.css') @include('detail.css')
@include('orderlist.js') @include('detail.js')
</head> </head>
<body class=""> <body class="">
......
<p style="margin-left: 5px;">取消订单</p>
<div class="tabs-box cancelPay-order">
<?php
switch($order_info['status']) {
case 2:
echo '<table class="table">
<tr>
<td width="10%">取消订单原因:</td>
<td>
<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>
</table>';
break;
case -1:
echo '已取消';
break;
}
?>
</div>
\ No newline at end of file
...@@ -18,7 +18,6 @@ ...@@ -18,7 +18,6 @@
<input type="hidden" name="goods_amount" value="{{$order_price_info['goods_price']}}"> <input type="hidden" name="goods_amount" value="{{$order_price_info['goods_price']}}">
<input type="hidden" name="order_amount" value="{{$order_info['order_amount']}}"> <input type="hidden" name="order_amount" value="{{$order_info['order_amount']}}">
<input type="hidden" name="cancel_reason" value="{{isset($order_info['cancle_reason']) ? $order_info['cancle_reason'] : ''}}"> <input type="hidden" name="cancel_reason" value="{{isset($order_info['cancle_reason']) ? $order_info['cancle_reason'] : ''}}">
<input type="hidden" name="user_mobile" value="{{$user_mobile}}">
<input type="hidden" name="check_failed" value=""> <input type="hidden" name="check_failed" value="">
<input type="hidden" name="check_failed_info" value=""> <input type="hidden" name="check_failed_info" value="">
<input type="hidden" name="change_pay_type" value=""> <input type="hidden" name="change_pay_type" value="">
......
...@@ -2,22 +2,11 @@ ...@@ -2,22 +2,11 @@
@include('layouts.header') @include('layouts.header')
<div class="page-content order-details"> <div class="page-content order-details">
@if (!$isPage)
<!-- <ul class="nav nav-tabs">
@if (isset($_REQUEST['tags']) && $_REQUEST['tags'] == 'erp')
<li><a href="{{URL('erp_order')}}">ERP订单</a></li>
@elseif (isset($_REQUEST['tags']) && $_REQUEST['tags'] == 'self')
<li><a href="{{URL('self_order')}}">自营订单</a></li>
@else
<li><a href="{{URL('list')}}">平台订单</a></li>
@endif
<li class="active"><a href="javascript:;">订单详情</a></li>
</ul> -->
@endif
<?php <?php
$route = \Route::current()->getActionName(); $route = \Route::current()->getActionName();
$action_name = explode('@', $route)[1]; $action_name = explode('@', $route)[1];
$currency = $order_info['currency'] == 2 ? '$' : '¥';
$tags = Request::input('tags', '');
?> ?>
<input type="hidden" class="action_type" value="{{$action_name}}"> <input type="hidden" class="action_type" value="{{$action_name}}">
<input type="hidden" id="order_id" name="order_id" value="{{$order_info['order_id']}}"> <input type="hidden" id="order_id" name="order_id" value="{{$order_info['order_id']}}">
...@@ -25,754 +14,67 @@ ...@@ -25,754 +14,67 @@
<input type="hidden" id="new_client_price" name="new_client_price" value="{{$order_price_info['new_client_price']}}"> <input type="hidden" id="new_client_price" name="new_client_price" value="{{$order_price_info['new_client_price']}}">
<input type="hidden" id="order_type_extend" name="order_type_extend" value="{{$order_info['order_type_extend']}}"> <input type="hidden" id="order_type_extend" name="order_type_extend" value="{{$order_info['order_type_extend']}}">
<input type="hidden" id="order_goods_type" name="order_goods_type" value="{{$order_info['order_goods_type']}}"> <input type="hidden" id="order_goods_type" name="order_goods_type" value="{{$order_info['order_goods_type']}}">
<!-- 基本资料 -->
<div class="tabs-box table-responsive"> <div class="tabs-box table-responsive">
<table class="table table-bordered order-express"> @include('detail.detail_base_info')
<?php
$currency = $order_info['currency'] == 2 ? '$' : '¥';
?>
<tr>
@if ($order_info['order_type_extend'])
<th>订单类型</th>
@endif
@if ($order_info['order_goods_type'] == 2)
<th>销售类型</th>
@endif
@if ($order_temp_info['business_type'])
<th>业务类型</th>
@endif
@if ($order_info['order_pay_type'] == 2)
<th>预付款</th>
<th>尾款</th>
@endif
<th>交易状态</th>
<th>支付方式</th>
<th>支付类型</th>
<th>支付状态</th>
<th>支付时间</th>
</tr>
<tr>
@if ($order_info['order_type_extend'])
<td>
<?php
switch ($order_info['order_type_extend']) {
case 1: echo '团购订单'; break;
}
?>
</td>
@endif
@if ($order_info['order_goods_type'] == 2)
<td>{{ $order_info['sale_type'] == 1 ? '现卖' : '预售' }}</td>
@endif
@if ($order_temp_info['business_type'])
<td>{{ Config('params.business_type')[$order_temp_info['business_type']] }}</td>
@endif
@if ($order_info['order_pay_type'] == 2)
<td>{{$currency.$order_info['advance_amount']}}</td>
<td>
{{$currency.number_format($order_info['order_amount'] - $order_info['advance_amount'], 2, '.', '')}}
</td>
@endif
<td>{{ Config('params.order_status')[$order_info['status']] }}</td>
<td>
<?php
if ($order_info['order_pay_type'] == 2) { // 预付款
if (isset($order_pay_log[1]) && $order_pay_log[1]['pay_name'] != '') {
echo $order_pay_log[1]['pay_name'];
} else if (!empty($order_pay_log) && $order_pay_log[0]['pay_name'] != '') {
echo $order_pay_log[0]['pay_name'];
} else {
echo '--';
}
} else {
if (!empty($order_pay_log) && $order_pay_log[0]['pay_name'] != '') {
echo $order_pay_log[0]['pay_name'];
} else {
echo '--';
}
}
?>
</td>
<td>
<?php
if ($order_info['order_pay_type'] == 1) {
if (!empty($order_pay_log)) {
echo '全款';
} else {
echo '--';
}
} else if ($order_info['order_pay_type'] == 2) {
if (isset($order_pay_log[1])) {
echo '尾款';
} else if (!empty($order_pay_log)) {
echo '预付款';
} else {
echo '--';
}
} else if ($order_info['order_pay_type'] == 3) {
if (!empty($order_pay_log)) {
echo '账期';
} else {
echo '--';
}
}
?>
</td>
<td>
<?php
if ($order_info['order_pay_type'] == 2) {
if (isset($order_pay_log[1]) && $order_pay_log[1]['is_paid'] != '') {
echo $order_pay_log[1]['is_paid'] == 1 ? '尾款已支付' : '未支付';
} else if (!empty($order_pay_log) && $order_pay_log[0]['is_paid'] != '') {
echo $order_pay_log[0]['is_paid'] == 1 ? '首款已支付' : '未支付';
} else {
echo '--';
}
} else {
if (!empty($order_pay_log) && $order_pay_log[0]['is_paid'] != '') {
echo $order_pay_log[0]['is_paid'] == 1 ? '已支付' : '未支付';
} else {
echo '--';
}
}
?>
</td>
<td>{{ $order_info['pay_time'] ? date('Y-m-d H:i:s', $order_info['pay_time']) : '' }}</td>
</tr>
</table>
<table class="table table-bordered">
<tr class="caption">
<th colspan="7" style="text-align: center; background: #f9f9f9;">
收货信息
@if (!$isPage)
<!-- 订单状态小于5 且 更新地址权限存在 显示按钮 -->
@if (!isset($_REQUEST['tags']))
@if (in_array($order_info['status'], array(1, 2, 3, 4)) && in_array('update_address', $userPerms))
<a href="/changeShipping/{{$order_info['order_id']}}" class="btn btn-success btn-sm changeBtn">更改收货地址</a>
@endif
@elseif (isset($_REQUEST['tags']) && $_REQUEST['tags'] == 'self')
@if (in_array($order_info['status'], array(1, 2, 4)) && in_array('self_order_update_address', $userPerms))
<a href="/changeShipping/{{$order_info['order_id']}}?tags={{$_REQUEST['tags']}}" class="btn btn-success btn-sm changeBtn">更改收货地址</a>
@endif
@elseif (isset($_REQUEST['tags']) && $_REQUEST['tags'] == 'erp')
<a href="/changeShipping/{{$order_info['order_id']}}?tags={{$_REQUEST['tags']}}" class="btn btn-success btn-sm changeBtn">更改收货地址</a>
@endif
@endif
</th>
</tr>
<tr>
<th>订单编号</th>
<th>京东订单编号</th>
<th>会员账号</th>
<th>收货人</th>
<th>联系电话/手机</th>
<th>配送方式</th>
@if ($order_info['order_shipping_type'] == 2)
<th>自提地址</th>
@else
<th>收货地址</th>
@endif
</tr>
<tr>
<td>{{$order_info['order_sn']}}</td>
<td>{{ $order_temp_info['jd_order_id'] }}</td>
<td>
@if ($user_mobile)
{{$user_mobile}}
@else
{{isset($order_info['user_info']['email']) ? $order_info['user_info']['email'] : ''}}
@endif
</td>
<td>{{$order_address_info['consignee']}}</td>
<td>{{$order_address_info['mobile']}}</td>
@if ($order_info['order_shipping_type'] == 2)
<td>客户自提</td>
<td>{{$order_address_info['address']}}</td>
@else
<td>快递送货</td>
<td>
{{$order_address_info['province_val']}}&nbsp;&nbsp;{{$order_address_info['city_val']}}&nbsp;&nbsp;{{$order_address_info['district_val']}}&nbsp;&nbsp;{{$order_address_info['address']}}
</td>
@endif
</tr>
</table>
@if (!empty($order_invoice_info))
<table class="table table-bordered order-express">
<tr class="caption">
<th colspan="3" style="text-align: center; background: #f9f9f9;">
发票信息
@if (!$isPage)
<!-- 发票状态小于2(已发货)且更改权限存在 显示按钮 -->
@if (!isset($_REQUEST['tags']))
@if(in_array($order_info['status'], [1, 2, 3, 4]) && $order_invoice_info['invoice_status'] < 2 && in_array('update_invoice', $userPerms))
<a href="/changeInvoice/{{$order_info['order_id']}}" class="btn btn-success btn-sm changeBtn">更改发票</a>
@endif
@elseif (isset($_REQUEST['tags']) && $_REQUEST['tags'] == 'self' && isset($extend) && !$extend)
<?php
if ($order_info['status'] > 3) { // 已付款请求财务接口判断是否能修改发票
$isChangeInvoice = App\Http\Controllers\isChangeInvoice($order_info['order_sn']);
if ($isChangeInvoice) {
echo '<a href="/changeInvoice/'.$order_info['order_id'].'?tags='.$_REQUEST['tags'].'" class="btn btn-success btn-sm changeBtn">更改发票</a>';
}
} else {
if ($order_invoice_info['invoice_status'] < 2 && in_array('self_order_update_invoice', $userPerms)) {
echo '<a href="/changeInvoice/'.$order_info['order_id'].'?tags='.$_REQUEST['tags'].'" class="btn btn-success btn-sm changeBtn">更改发票</a>';
}
}
?>
<!-- in_array($order_info['status'], [1, 2, 3, 4]) && $order_invoice_info['invoice_status'] < 2 && in_array('self_order_update_invoice', $userPerms) -->
@elseif (isset($_REQUEST['tags']) && $_REQUEST['tags'] == 'erp')
<a href="/changeInvoice/{{$order_info['order_id']}}?tags={{$_REQUEST['tags']}}" class="btn btn-success btn-sm changeBtn">更改发票</a>
@endif
@endif
</th>
</tr>
<tr>
<td colspan="3">
<table class="table inv">
<tr>
<th>发票类型</th>
<th>发票抬头</th>
<th>公司注册地址</th>
<th>公司电话</th>
<th>税务登记号</th>
<th>开户银行</th>
<th>银行卡号</th>
<th>开票状态</th>
</tr>
@if ($order_invoice_info['inv_type'] == 1)
<tr style="text-align: center;">
<td colspan="8">不开发票</td>
</tr>
@else
<tr>
<td>
<?php
switch ($order_invoice_info['inv_type']) {
case 2: echo '普通发票';break;
case 3: echo '增值税专用发票';break;
case 4: echo '增值税普通发票';break;
}
?>
</td>
<td>{{$order_invoice_info['tax_title']}}</td>
<td>{{$order_invoice_info['company_address']}}</td>
<td>{{$order_invoice_info['company_phone']}}</td>
<td>{{$order_invoice_info['tax_no']}}</td>
<td>{{$order_invoice_info['bank_name']}}</td>
<td>{{$order_invoice_info['bank_account']}}</td>
<td>{{$order_invoice_info['invoice_status_val']}}</td>
</tr>
@endif
</table>
</td>
</tr>
</table>
@endif
<table class="table table-bordered">
<tr class="caption">
<th colspan="4" style="text-align: center; background: #f9f9f9;">合同乙方信息
@if ($order_info['status'] == 1)
<a href="javascript:;" class="btn btn-success btn-sm changeBtn contract_info_edit">编辑</a>
@endif
</th>
</tr>
<tr>
<th>公司名称</th>
<th>公司地址</th>
<th>联系人</th>
<th>联系电话</th>
</tr>
<?php
if ($order_temp_info['contract_com_name']) {
$contract_com_name = $order_temp_info['contract_com_name'];
$contract_com_addr = $order_temp_info['contract_com_addr'];
$contract_link_name = $order_temp_info['contract_link_name'];
$contract_link_tel = $order_temp_info['contract_link_tel'];
} else { // 若未填写乙方信息,则拉取相关数据
// 公司名称
if (isset($order_invoice_info['tax_title']) && $order_invoice_info['tax_title'])
$contract_com_name = $order_invoice_info['tax_title'];
else if (isset($company_info['com_name']) && $company_info['com_name'])
$contract_com_name = $company_info['com_name'];
else
if (isset($user_info))
$contract_com_name = isset($user_info['mobile']) ? $user_info['mobile'] : $user_info['email'];
else
$contract_com_name = '';
// 公司地址
if (isset($order_invoice_info['company_address']) && $order_invoice_info['company_address'])
$contract_com_addr = $order_invoice_info['company_address'];
else if (isset($company_info['com_address']) && $company_info['com_address'])
$contract_com_addr = $company_info['com_address'];
else
$contract_com_addr = $order_address_info['province_val'].$order_address_info['city_val'].$order_address_info['district_val'].$order_address_info['address'];
// 联系人
$contract_link_name = $order_address_info['consignee'];
// 联系电话
if (isset($user_info['mobile']))
$contract_link_tel = $user_info['mobile'];
else
$contract_link_tel = $order_address_info['mobile'];
}
?>
<tr>
<td>{{ $contract_com_name }}</td>
<td>{{ $contract_com_addr }}</td>
<td>{{ $contract_link_name }}</td>
<td>{{ $contract_link_tel }}</td>
</tr>
</table>
<!-- 发票收货地址 -->
@if ($order_invoice_address_info)
<table class="table table-bordered">
<tr class="caption">
<th colspan="3" style="text-align: center; background: #f9f9f9;">
发票收货信息
</th>
</tr>
<tr>
<td colspan="3">
<table class="table table-bordered">
<tr>
<th>收票人</th>
<th>联系电话/手机</th>
<th>收票地址</th>
</tr>
<tr>
<td>{{$order_invoice_address_info['consignee']}}</td>
<td>{{$order_invoice_address_info['mobile']}}</td>
<td>
{{$order_invoice_address_info['province_val']}}&nbsp;&nbsp;{{$order_invoice_address_info['city_val']}}&nbsp;&nbsp;{{$order_invoice_address_info['district_val']}}&nbsp;&nbsp;{{$order_invoice_address_info['address']}}
</td>
</tr>
</table>
</td>
</tr>
</table>
@endif
@if (!empty($order_info['order_source']) && preg_match('/adtag\=/', $order_info['order_source']))
<table class="table table-bordered table-hover">
<tr>
<th width="10%">Adtag值:</th>
<td>{{$order_info['order_source']}}</td>
</tr>
</table>
@endif
<!-- 订单或发票物流 -->
@if (!empty($order_shipping_info) || !empty($order_invoice_shipping_info))
<table class="table table-bordered table-hover">
<tr class="caption">
<th colspan="8" style="text-align: center; background: #f9f9f9;">
物流信息
</th>
</tr>
@if (!empty($order_shipping_info))
<tr>
<th width="5%">订单物流</th>
<th width="5%">快递公司:</th>
<td width="10%">{{$order_shipping_info['shipping_name']}}</td>
<th width="5%">快递单号:</th>
<td width="10%">{{$order_shipping_info['shipping_no']}}</td>
<th width="5%">配送状态:</th>
<td width="10%">
<?php
switch ($order_shipping_info['status']) {
case 0:
case 1: echo '已配送'; break;
case 2: echo '已签收'; break;
default: echo '未配送'; break;
}
?>
</td>
<td width="5%">
<a class="btn btn-xs btn-success view-shipping" data-type="1">查看物流轨迹</a>
</td>
</tr>
@endif
@if (!empty($order_invoice_shipping_info))
<tr>
<th width="5%">发票物流</th>
<th width="5%">快递公司:</th>
<td width="10%">{{$order_invoice_shipping_info['shipping_name']}}</td>
<th width="5%">快递单号:</th>
<td width="10%">{{$order_invoice_shipping_info['shipping_no']}}</td>
<th width="5%">配送状态:</th>
<td width="10%">
<?php
switch ($order_invoice_shipping_info['status']) {
case 0:
case 1: echo '已配送'; break;
case 2: echo '已签收'; break;
default: echo '未配送'; break;
}
?>
</td>
<td width="5%">
<a class="btn btn-xs btn-success view-shipping" data-type="2">查看物流轨迹</a>
</td>
</tr>
@endif
</table>
@endif
<!-- 终端客户信息 -->
@if ($order_extra && $action_name == 'details')
<table class="table table-bordered table-hover">
<tr class="caption">
<th colspan="4" style="text-align: center; background: #f9f9f9;">
终端客户信息
</th>
</tr>
<tr>
<th>客户名称(中文)</th>
<th>客户名称(英文)</th>
<th>客户类型</th>
<th>产品用途</th>
</tr>
<tr>
<td>{{ $order_extra['customer_cn'] }}</td>
<td>{{ $order_extra['customer_en'] }}</td>
<td>{{ Config('params.end_user_type')[$order_extra['customer_type']] }}</td>
<td>{{ $order_extra['product_use'] }}</td>
</tr>
</table>
@endif
</div> </div>
<div>
<div class="tabs-box table-responsive" style="float:left; width: 50%;">
@include('detail.detail_address_info')
</div>
<div class="tabs-box goods-price table-responsive list-item-table"> <div class="tabs-box table-responsive" style="float:right; width: 50%;">
<table class="table"> @include('detail.detail_invoice_address_info')
<thead> </div>
<tr class="caption">
<th>序号</th>
@if ($order_info['order_goods_type'] == 2)
<th>商品ID</th>
<th>商品名</th>
<th>型号</th>
@else
<th>商品ID</th>
<th>商品名</th>
@endif
@if ($order_info['order_goods_type'] == 1)
<th>供应商</th>
@endif
<th>制造商</th>
<!-- ERP或京东订单 -->
@if (in_array($order_info['order_type'], [2, 3]))
<th>采购数量</th>
<th>采购单价</th>
@elseif ($username != 'vpadmin@ichunt.com')
@if ($order_info['order_goods_type'] == 2)
<th>购买数量</th>
<th>购买时单价</th>
@else
<th>采购数量</th>
<th>采购单价</th>
@endif
<th>均摊后单价</th>
@else
<th>商品数量</th>
<th>商品单价</th>
@endif
<th>小计</th>
<th>费用</th>
<th>折扣</th>
<th>合计</th>
<th>货期</th>
@if ($order_info['order_goods_type'] == 1)
<th>采购员</th>
@endif
<th>自采标记</th>
<th >批次</th>
@if ($order_info['order_goods_type'] == 1)
<th>生产跟踪</th>
@endif
<th>备注</th>
<th>操作</th>
<?php
if ($action_name == 'changeOrder' && count($order_items_info) > 1 && in_array($order_info['status'], [1, 2])) {
echo '<th>操作</th>';
}
?>
</tr>
</thead>
<tbody>
@if (!empty($order_items_info))
@foreach ($order_items_info as $key => $v)
<tr>
<td>{{$key+1}}</td>
@if ($order_info['order_goods_type'] == 2)
<td>{{$v['goods_id']}}</td>
<td><a href="{{Config('website.main_url').'item/'.$v['goods_id'].'.html?ptag=order'}}" target="_blank">{{$v['goods_name']}}</a></td>
<td>{{ App\Http\Controllers\getGoodsName($v['goods_id']) }}</td>
@else
<td>{{$v['goods_id']}}</td>
<td><a href="{{Config('website.main_url').'goods_'.$v['goods_id'].'.html?ptag=order'}}" target="_blank">{{$v['goods_name']}}</a></td>
@endif
@if ($order_info['order_goods_type'] == 1)
<td>{{$v['supplier_name']}}</td>
@endif
<td>{{$v['brand_name']}}</td>
<td id="goods_number_{{$v['rec_id']}}">{{$v['goods_number']}}</td>
<td>
<span id="{{$v['rec_id']}}">{{$v['goods_price']}}</span>
</td>
@if (in_array($order_info['order_type'], [2, 3]))
<td>{{ $v['goods_amount_format'] }}</td>
@elseif ($username != 'vpadmin@ichunt.com')
<td>{{$v['single_pre_price_format']}}</td>
<td>{{$v['goods_amount_format']}}</td>
@else
<td>{{ $v['goods_amount_format'] }}</td>
@endif
<td>{{$v['extra_price']}}</td>
<td>{{$v['goods_discount_amount']}}</td>
<td>{{ number_format($v['goods_amount'] + $v['extra_price'] - $v['goods_discount_amount'], 2, '.', '') }}</td>
<td>{{$v['delivery_time']}}</td>
@if ($order_info['order_goods_type'] == 1)
<td> <div class="buyerName">
<?php
echo !empty($v['buyerName'])?$v['buyerName']:'';
?>
</div>
</td>
@endif
<td>
@if($v['self_supplier_type'] == 1)
自采
@elseif($v['self_supplier_type'] == 2)
立创
@else
自采
@endif
</td>
<td class="batch">
<?php echo !empty($v['batch'])?$v['batch']:''; ?>
</td>
@if ($order_info['order_goods_type'] == 1)
<td><a class="order-track" data-rid="{{$v['rec_id']}}">{{ App\Http\Controllers\getLastTrack($v['rec_id']) }}</a></td>
@endif
<td>
@if(!empty($v['remarks']))
{{$v['remarks']}}
@endif
</td>
<td>
<!-- <button type="button" class="btn btn-success btn-xs remarks">编辑</button> -->
@if ($order_info['status'] < 4)
<button type="button" class="btn btn-success btn-xs edit-item" data-id="{{$v['rec_id']}}" data-batch="{{$v['batch']}}" data-bid="{{$v['buyer_id']}}" data-remarks="{{$v['remarks']}}">编辑</button>
@endif
</td>
@if ($action_name == 'changeOrder' && count($order_items_info) > 1 && in_array($order_info['status'], [1, 2]))
<td><a class="btn btn-danger deletegoods" href="javascript:;" data-id="{{$v['rec_id']}}">删除</a></td>
@endif
</tr>
@endforeach
@endif
</tbody>
<tfoot>
@if ($order_info['order_remark'])
<tr>
<td>订单备注信息:</td>
<td colspan="18">{{$order_info['order_remark']}}</td>
</tr>
@endif
@if ($order_temp_info['kefu_remark'])
<tr>
<td>客服备注信息:</td>
<td colspan="18">{{$order_temp_info['kefu_remark']}}</td>
</tr>
@endif
@if ($order_info['order_goods_type'] == 2 && $order_temp_info['business_type'] == 1)
<tr>
<td>项目需求描述:</td>
<td colspan="18">{{$order_temp_info['sample_demand_desc']}}</td>
</tr>
@endif
</tfoot>
</table>
<!-- 退款已处理 -->
@if ($order_refund_info['status'] == 10 && $order_price_info['refund_price'] != 0)
<hr>
<table class="table">
<thead>
<tr class="caption">
<th>退款型号</th>
<th>退款数量</th>
<th>价格</th>
<th>小计</th>
</tr>
</thead>
<tbody>
@foreach ($order_refund_items as $k=>$v)
<tr>
<td>{{$v['goods_name']}}</td>
<td>{{$v['refund_num']}}</td>
<td>{{$currency . $v['single_pre_price']}}</td>
<td>{{$currency . number_format($v['refund_num'] * $v['single_pre_price'], 4)}}</td>
</tr>
@endforeach
<tr>
<td>手动差价</td>
<td></td>
<td></td>
<td>{{'-' . $order_refund_info['price_fall']}}</td>
</tr>
</tbody>
</table>
@endif
</div> </div>
<div class="tabs-box order-total table-responsive"> <?php
<div> if ($order_temp_info['contract_com_name']) {
<table> $contract_com_name = $order_temp_info['contract_com_name'];
<tr> $contract_com_addr = $order_temp_info['contract_com_addr'];
<td>商品总额:</td> $contract_link_name = $order_temp_info['contract_link_name'];
<td>{{$currency}}<span id="order-total" class="amount">{{$order_price_info['goods_price']}}</span></td> $contract_link_tel = $order_temp_info['contract_link_tel'];
</tr> } else { // 若未填写乙方信息,则拉取相关数据
// 公司名称
@if ($order_price_info['new_client_price'] != 0) if (isset($order_invoice_info['tax_title']) && $order_invoice_info['tax_title'])
<tr> $contract_com_name = $order_invoice_info['tax_title'];
@if ($order_info['order_type_extend'] == 1) else if (isset($company_info['com_name']) && $company_info['com_name'])
<td>团购优惠:</td> $contract_com_name = $company_info['com_name'];
@else else
<td>新客价优惠:</td> if (isset($user_info))
@endif $contract_com_name = isset($user_info['mobile']) ? $user_info['mobile'] : $user_info['email'];
<td><span id="order-total" class="amount">{{$order_price_info['new_client_price']}}</span></td> else
</tr> $contract_com_name = '';
@endif
// 公司地址
@if (isset($order_price_info['ext_price'])) if (isset($order_invoice_info['company_address']) && $order_invoice_info['company_address'])
<tr> $contract_com_addr = $order_invoice_info['company_address'];
<td>附加款:</td> else if (isset($company_info['com_address']) && $company_info['com_address'])
<td class="edit-parent-td"> $contract_com_addr = $company_info['com_address'];
{{$currency}}<span id="other_money">{{$order_price_info['ext_price']}}</span> else
</td> $contract_com_addr = $order_address_info['province_val'].$order_address_info['city_val'].$order_address_info['district_val'].$order_address_info['address'];
</tr>
@endif // 联系人
$contract_link_name = $order_address_info['consignee'];
@if ($order_price_info['shipping_price'] != 0)
<tr> // 联系电话
<td>快递费用:</td> if (isset($user_info['mobile']))
<td class="edit-parent-td"> $contract_link_tel = $user_info['mobile'];
{{$currency}}<span id="other_money">{{$order_price_info['shipping_price']}}</span> else
</td> $contract_link_tel = $order_address_info['mobile'];
</tr> }
@endif ?>
@if ($order_price_info['discount_amount'] != 0) <!-- 收货、发票等信息 -->
<tr> <div class="tabs-box table-responsive" style="width: 100%;">
<td>优惠金额:</td> @include('detail.detail_multi_info')
<td class="edit-parent-td"> </div>
<span id="other_money">{{$order_price_info['discount_amount']}}</span>
</td>
</tr>
@endif
@if (isset($order_price_info['refund_price']) && $order_price_info['refund_price'] != 0)
<tr>
<td>退款金额:</td>
<td class="edit-parent-td">
{{$currency}}<span id="other_money">{{$order_price_info['refund_price']}}</span>
</td>
</tr>
@endif
<tr>
<td>订单总额:</td>
<td>
<span style="color:red;font-size:20px">
{{$currency}}<span class="amount">{{$order_info['order_amount']}}</span>
</span>
</td>
</tr>
@if (isset($order_price_info['pay_preferential']) && $order_price_info['pay_preferential'] != 0) <div class="tabs-box goods-price table-responsive list-item-table">
<tr> @include('detail.detail_items_info')
<td>支付优惠:</td>
<td class="edit-parent-td">
<span id="other_money">{{$order_price_info['pay_preferential']}}</span>
</td>
</tr>
<tr>
<td>实际支付金额:</td>
<td class="edit-parent-td">
<span style="color:red;font-size:20px">
{{$currency}}<span class="amount">{{$order_info['order_amount'] + $order_price_info['pay_preferential']}}</span>
</span>
</td>
</tr>
@endif
</table>
</div>
<!-- 非内部采购下单显示付款地址 -->
@if (isset($order_temp_info) && $order_temp_info['order_type'] != 3 && $order_info['status'] < 4)
<p>客户付款地址:{{ Config('website.pay_url').$order_info['order_id'] }}</p>
@endif
</div> </div>
<?php $client_source = App\Http\Controllers\clientSource($order_info['user_id']); ?> <?php $client_source = App\Http\Controllers\clientSource($order_info['user_id']); ?>
...@@ -854,15 +156,22 @@ ...@@ -854,15 +156,22 @@
<a class="btn btn-danger input-cancel-reason" href="javascript:;" data-oid="{{$order_info['order_id']}}" data-type="2">取消订单</a> <a class="btn btn-danger input-cancel-reason" href="javascript:;" data-oid="{{$order_info['order_id']}}" data-type="2">取消订单</a>
@endif @endif
<!-- 判断操作权限 --> @if (in_array('check_order', $userPerms) && $order_info['sale_id'])
@if (in_array($order_info['status'], [1, 2]) && in_array('check_order', $userPerms)) @if ($order_info['status'] == 1)
<a class="btn btn-info" href="{{URL('change', ['order_id'=>$order_info['order_id']])}}">人工审单</a> <a class="btn btn-success" href="{{URL('change', ['order_id'=>$order_info['order_id']])}}" target="_blank">人工审单</a>
@elseif ($order_info['status'] == 2 && in_array($role, [1, 2]))
<a class="btn btn-success re-audit" data-id="{{$order_info['order_id']}}">反审</a>
@endif
@endif
<!-- 主管审核 -->
@if ($order_temp_info['is_manager_audit'] && in_array($role, [1, 2]) && $order_info['status'] == 1)
<a class="btn btn-danger manager-audit" data-id="{{$order_info['order_id']}}">主管审核</a>
@endif @endif
<!-- 判断邮件发送时机 --> <!-- 判断邮件发送时机 -->
@if (!empty($order_temp_info['erp_sn']) ) @if (!empty($order_temp_info['erp_sn']) )
<a class="btn btn-primary send_mail" >发送邮件</a> <a class="btn btn-primary send_mail" data-id="{{ $order_info['order_id'] }}">发送邮件</a>
@endif @endif
<!-- 预付款 管理员完成首款对账后改变'对账'按钮 --> <!-- 预付款 管理员完成首款对账后改变'对账'按钮 -->
@if (in_array($order_info['status'], [2, 3]) && in_array('check_account', $userPerms)) @if (in_array($order_info['status'], [2, 3]) && in_array('check_account', $userPerms))
...@@ -875,7 +184,7 @@ ...@@ -875,7 +184,7 @@
<!-- 线下转账 --> <!-- 线下转账 -->
@if (in_array($order_info['status'], [2, 3]) && in_array('offline_paid', $userPerms)) @if (in_array($order_info['status'], [2, 3]) && in_array('offline_paid', $userPerms))
<a href="javascript:;" data-id="{{$order_info['order_id']}}" data-sn="{{$order_info['order_sn']}}" class="btn btn-success offline-paid">线下转账</a> <!-- <a href="javascript:;" data-id="{{$order_info['order_id']}}" data-sn="{{$order_info['order_sn']}}" class="btn btn-success offline-paid">线下转账</a> -->
@endif @endif
<!-- 回传合同 --> <!-- 回传合同 -->
...@@ -911,8 +220,8 @@ ...@@ -911,8 +220,8 @@
@endif @endif
<!-- 订单审单 --> <!-- 订单审单 -->
@if (in_array($order_info['status'], [1, 2]) && in_array('self_check_order', $userPerms)) @if (in_array($order_info['status'], [1, 2]) && in_array('self_check_order', $userPerms) && $order_info['sale_id'])
<a class="btn btn-info" href="/change/{{$order_info['order_id']}}?tags=self">人工审单</a> <a class="btn btn-info" href="/change/{{$order_info['order_id']}}?tags=self" target="_blank">人工审单</a>
@endif @endif
@if ($order_info['status'] == 2 && in_array('self_check_pay', $userPerms)) @if ($order_info['status'] == 2 && in_array('self_check_pay', $userPerms))
...@@ -945,151 +254,15 @@ ...@@ -945,151 +254,15 @@
@endif @endif
@if (!empty($order_shipping_info['info']) || !empty($order_shipping_inside)) @if (!empty($order_shipping_info['info']) || !empty($order_shipping_inside))
<p>物流信息</p> @include('detail.detail_shipping_info')
<div class="tabs-box table-responsive">
<table class="table table-bordered table-hover">
<thead>
<tr>
<th width="15%">物流时间</th>
<th>物流信息</th>
</tr>
</thead>
<tbody>
@if (!empty($order_shipping_info['info']))
<?php $shippings_info = json_decode($order_shipping_info['info'], true); ?>
@foreach ($shippings_info as $k=>$v)
@if ($k < 4)
<tr>
<td>{{$v['AcceptTime']}}</td>
<td>{{$v['AcceptStation']}}</td>
</tr>
@else
<tr class="other-infos">
<td>{{$v['AcceptTime']}}</td>
<td>{{$v['AcceptStation']}}</td>
</tr>
@endif
@if ($k >= 4 && $k == count($shippings_info)-1)
<tr>
<td colspan="2" class="text-center click-down"><i class="fa fa-angle-double-down">点击展开</i></td>
<td colspan="2" class="text-center click-up"><i class="fa fa-angle-double-up">点击收起</i></td>
</tr>
@endif
@endforeach
@else
@foreach ($order_shipping_inside as $k=>$v)
@if ($k < 4)
<tr>
<td>{{date('Y-m-d H:i:s', $v['create_time'])}}</td>
<td>{{$v['info']}}</td>
</tr>
@else
<tr class="other-infos">
<td>{{date('Y-m-d H:i:s', $v['create_time'])}}</td>
<td>{{$v['info']}}</td>
</tr>
@endif
@if ($k >= 4 && $k == count($order_shipping_inside)-1)
<tr>
<td colspan="2" class="text-center click-down"><i class="fa fa-angle-double-down">点击展开</i></td>
<td colspan="2" class="text-center click-up"><i class="fa fa-angle-double-up">点击收起</i></td>
</tr>
@endif
@endforeach
@endif
</tbody>
</table>
</div>
@endif @endif
@if (!empty($actionLog)) @if (!empty($actionLog))
<p>操作记录</p> @include('detail.detail_action_log')
<div class="tabs-box table-responsive">
<table class="table table-bordered table-hover">
<thead>
<tr>
<th>操作时间</th>
<th>操作人</th>
<th>操作事件</th>
</tr>
</thead>
<tbody>
@foreach ($actionLog as $k=>$v)
@if ($k < 4)
<tr>
<td width="15%">{{date('Y-m-d H:i:s', $v->create_time)}}</td>
<td width="10%">{{App\Http\Controllers\getOperatorName($v->operator_id, $v->operator_type)}}</td>
<td>{{$v->event}}</td>
</tr>
@else
<tr class="other-infos">
<td width="15%">{{date('Y-m-d H:i:s', $v->create_time)}}</td>
<td width="10%">{{App\Http\Controllers\getOperatorName($v->operator_id, $v->operator_type)}}</td>
<td>{{$v->event}}</td>
</tr>
@endif
@if ($k >= 4 && $k == count($actionLog)-1)
<tr>
<td colspan="3" class="text-center click-down"><i class="fa fa-angle-double-down">点击展开</i></td>
<td colspan="3" class="text-center click-up"><i class="fa fa-angle-double-up">点击收起</i></td>
</tr>
@endif
@endforeach
</tbody>
</table>
</div>
@endif @endif
@if (!empty($erpPayLog)) @if (!empty($erpPayLog))
<p>ERP支付记录</p> @include('detail.detail_erp_paid_log')
<div class="tabs-box table-responsive">
<table class="table table-bordered table-hover">
<thead>
<tr>
<th>创建时间</th>
<th>收款单号</th>
<th>收款金额</th>
<th>收款时间</th>
<th>支付状态</th>
<th>取消支付时间</th>
</tr>
</thead>
<tbody>
@foreach ($erpPayLog as $k=>$v)
@if ($k < 4)
<tr>
<td width="15%">{{date('Y-m-d H:i:s', $v->create_time)}}</td>
<td width="10%">{{$v->receipt_sn}}</td>
<td width="10%">{{$v->receipt_amount}}</td>
<td width="10%">{{date('Y-m-d H:i:s', $v->receipt_time)}}</td>
<td>{{$v->status == 1 ? '已支付' : '已取消'}}</td>
<td>{{$v->cancel_time ? date('Y-m-d H:i:s', $v->cancel_time) : ''}}</td>
</tr>
@else
<tr class="other-infos">
<td width="15%">{{date('Y-m-d H:i:s', $v->create_time)}}</td>
<td width="10%">{{$v->receipt_sn}}</td>
<td width="10%">{{$v->receipt_amount}}</td>
<td width="10%">{{date('Y-m-d H:i:s', $v->receipt_time)}}</td>
<td>{{$v->status == 1 ? '已支付' : '已取消'}}</td>
<td>{{$v->cancel_time ? date('Y-m-d H:i:s', $v->cancel_time) : ''}}</td>
</tr>
@endif
@if ($k >= 4 && $k == count($erpPayLog)-1)
<tr>
<td colspan="6" class="text-center click-down"><i class="fa fa-angle-double-down">点击展开</i></td>
<td colspan="6" class="text-center click-up"><i class="fa fa-angle-double-up">点击收起</i></td>
</tr>
@endif
@endforeach
</tbody>
</table>
</div>
@endif @endif
@endif @endif
...@@ -1191,74 +364,14 @@ ...@@ -1191,74 +364,14 @@
$('.order_refund').hide(); $('.order_refund').hide();
} }
var buyers = eval('{!! isset($buyers) ? json_encode($buyers) : '' !!}'); // 采购员集合 var buyers = eval('{!! isset($buyers) ? json_encode($buyers) : '' !!}'); // 采购员集合
var cc_sales = eval('{!! isset($cc_sales) ? json_encode($cc_sales) : '' !!}'); // 抄送人集合 var cc_sales = eval('{!! isset($cc_sales) ? json_encode($cc_sales) : '' !!}'); // 抄送人集合
var URL_api = '{{ Config("website.api_domain") }}'; var URL_api = '{{ Config("website.api_domain") }}';
$.lie.order.details();
$.lie.goods.add();
// 发送邮件
$(document).on('click','.send_mail',function(data){
var cc_sales_count = cc_sales.length;
var html = '';
for (var i = 0; i < cc_sales_count; i++) {
html += '<option value="'+cc_sales[i].userId+'">'+cc_sales[i].name+'</option>';
}
var content = '<div class="form-group">\
<label class="col-sm-4 control-label">是否有额外的抄送人员?</label>\
<div class="col-sm-8">\
<select id="cc_email" name="cc_email" class="form-control cc_email selectpicker" data-live-search="true" data-size="7" title="全部" multiple>\
'+html+'\
</select>\
</div>\
</div>\
<p style="padding-top: 50px;"><i class="error"> * </i>若无额外抄送人,直接点击‘确认’按钮即可</p>';
layer.open({ $.lie.order.details();
area: ['600px', '200px'], $.lie.track.orderTrack();
title:'邮件抄送', $.lie.audit.index();
content: content, $.lie.send_mail.index();
btn:['确认', '取消'], $.lie.cancel.cancelorder();
//提交事件
btn1:function(){
var id = "{{$order_info['order_id']}}";
var cc_email = $('#cc_email').val();
$.ajax({
url: '/send_mail',
data: {id: id, cc_email: cc_email},
type:'post',
dataType: 'json',
success:function(resp){
if(resp.errcode == 0){
layer.msg(resp.errmsg || '操作成功');
setTimeout(function(){
location.reload();
}, 1000);
return false;
} else {
layer.alert(resp.errmsg || '网络异常');
}
},
error:function(){
layer.alert('网络异常');
}
});
},
btn2:function(index){
layer.close(index);
}
});
$(".cc_email").selectpicker({
actionsBox:true, //在下拉选项添加选中所有和取消选中的按钮
countSelectedText:"已选中{0}项",
selectedTextFormat:"count > 5",
selectAllText: '全选',
deselectAllText: '取消全选',
})
$('.layui-layer-content').css('overflow', 'visible');
})
</script> </script>
\ No newline at end of file
<link href="/css/bootstrap.min.css" rel="stylesheet">
<link href="/css/bootstrap-select.min.css" rel="stylesheet">
<link href="/font-awesome/css/font-awesome.css" rel="stylesheet">
<link href="/css/style.css" rel="stylesheet">
<link href="/layer/skin/layer.css" rel="stylesheet">
<link href="/css/order.css" rel="stylesheet">
<link href="/css/detail.css" rel="stylesheet">
\ No newline at end of file
<p>操作记录</p>
<div class="tabs-box table-responsive">
<table class="table table-bordered table-hover">
<thead>
<tr>
<th>操作时间</th>
<th>操作人</th>
<th>操作事件</th>
</tr>
</thead>
<tbody>
<?php foreach ($actionLog as $k=>$v) { ?>
<?php if ($k < 4) { ?>
<tr>
<td width="15%"><?= date('Y-m-d H:i:s', $v->create_time) ?></td>
<td width="10%"><?= App\Http\Controllers\getOperatorName($v->operator_id, $v->operator_type) ?></td>
<td><?= $v->event ?></td>
</tr>
<?php } else { ?>
<tr class="other-infos">
<td width="15%"><?= date('Y-m-d H:i:s', $v->create_time) ?></td>
<td width="10%"><?= App\Http\Controllers\getOperatorName($v->operator_id, $v->operator_type) ?></td>
<td><?= $v->event ?></td>
</tr>
<?php } ?>
<?php if ($k >= 4 && $k == count($actionLog)-1) { ?>
<tr>
<td colspan="3" class="text-center click-down"><i class="fa fa-angle-double-down">点击展开</i></td>
<td colspan="3" class="text-center click-up"><i class="fa fa-angle-double-up">点击收起</i></td>
</tr>
<?php } ?>
<?php } ?>
</tbody>
</table>
</div>
\ No newline at end of file
<div style="width: 100%; height: 40px;">
<h3 style="float: left; width: 100px;">收货信息</h3>
<?php
// <!-- 订单状态小于5 且 更新地址权限存在 显示按钮 -->
if (!$tags) {
if (in_array($order_info['status'], array(1, 2, 3, 4)) && in_array('update_address', $userPerms)) {
echo '<a href="/changeShipping/'.$order_info['order_id'].'" class="btn btn-success btn-sm changeBtn">更改收货地址</a>';
}
} elseif (isset($tags) && $tags == 'self') {
if (in_array($order_info['status'], array(1, 2, 4)) && in_array('self_order_update_address', $userPerms)) {
echo '<a href="/changeShipping/'.$order_info['order_id'].'?tags='.$tags.'" class="btn btn-success btn-sm changeBtn">更改收货地址</a>';
}
}
?>
</div>
<div class="table-responsive">
<table class="table table-bordered text-nowrap">
<tr>
<th width="15%">收货人</th>
<th width="18%">联系电话/手机</th>
<th width="15%">配送方式</th>
<?php if ($order_info['order_shipping_type'] == 2) { ?>
<th>自提地址</th>
<?php } else { ?>
<th>收货地址</th>
<?php } ?>
</tr>
<tr>
<td><?= $order_address_info['consignee'] ?></td>
<td><?= $order_address_info['mobile'] ?></td>
<?php if ($order_info['order_shipping_type'] == 2) { ?>
<td>客户自提</td>
<td><?= $order_address_info['address'] ?></td>
<?php } else { ?>
<td>快递送货</td>
<td>
<?= $order_address_info['province_val'] ?>&nbsp;&nbsp;<?= $order_address_info['city_val'] ?>&nbsp;&nbsp;<?= $order_address_info['district_val'] ?>&nbsp;&nbsp;<?= $order_address_info['address'] ?>
</td>
<?php } ?>
</tr>
</table>
</div>
<div style="width: 100%; height: 40px;">
<h3>基本资料</h3>
</div>
<table class="table table-bordered order-express">
<tr>
<!-- @if ($order_info['order_type_extend'])
<th>订单类型</th>
@endif
@if ($order_info['order_goods_type'] == 2)
<th>销售类型</th>
@endif
@if ($order_temp_info['business_type'])
<th>业务类型</th>
@endif
@if ($order_info['order_pay_type'] == 2)
<th>预付款</th>
<th>尾款</th>
@endif -->
<th width="5%">订单编号</th>
<th>订单状态</th>
<th>用户账号</th>
<th>支付方式</th>
<th>支付状态</th>
<th>支付类型</th>
<th>发货状态</th>
<th>物流单号</th>
<th>京东订单编号</th>
<th width="8%">自动确认收货时间</th>
</tr>
<tr>
<td>{{ $order_info['order_sn'] }}</td>
<td>{{ $order_temp_info['is_manager_audit'] ? '待主管审核' : Config('params.order_status')[$order_info['status']] }}</td>
<td>{{ $user_info['mobile'] ? $user_info['mobile'] : $user_info['email'] }}</td>
<td>
<?php
if ($order_info['order_pay_type'] == 2) { // 预付款
if (isset($order_pay_log[1]) && $order_pay_log[1]['pay_name'] != '') {
echo $order_pay_log[1]['pay_name'];
} else if (!empty($order_pay_log) && $order_pay_log[0]['pay_name'] != '') {
echo $order_pay_log[0]['pay_name'];
} else {
echo '--';
}
} else {
if (!empty($order_pay_log) && $order_pay_log[0]['pay_name'] != '') {
echo $order_pay_log[0]['pay_name'];
} else {
echo '--';
}
}
?>
</td>
<td>
<?php
if ($order_info['order_pay_type'] == 2) {
if (isset($order_pay_log[1]) && $order_pay_log[1]['is_paid'] != '') {
echo $order_pay_log[1]['is_paid'] == 1 ? '尾款已支付' : '未支付';
} else if (!empty($order_pay_log) && $order_pay_log[0]['is_paid'] != '') {
echo $order_pay_log[0]['is_paid'] == 1 ? '首款已支付' : '未支付';
} else {
echo '--';
}
} else {
if (!empty($order_pay_log) && $order_pay_log[0]['is_paid'] != '') {
echo $order_pay_log[0]['is_paid'] == 1 ? '已支付' : '未支付';
} else {
echo '--';
}
}
?>
</td>
<td>
<?php
if ($order_info['order_pay_type'] == 1) {
if (!empty($order_pay_log)) {
echo '全款';
} else {
echo '--';
}
} else if ($order_info['order_pay_type'] == 2) {
if (isset($order_pay_log[1])) {
echo '尾款';
} else if (!empty($order_pay_log)) {
echo '预付款';
} else {
echo '--';
}
} else if ($order_info['order_pay_type'] == 3) {
if (!empty($order_pay_log)) {
echo '账期';
} else {
echo '--';
}
}
?>
</td>
<td>
<?php
if ($order_shipping_info) {
switch ($order_shipping_info['status']) {
case -1: echo '未配送'; break;
case 1: echo '配送中'; break;
case 2: echo '已签'; break;
default: echo '未知'; break;
}
} else {
echo '未发货';
}
?>
</td>
<td>{{ $order_shipping_info ? $order_shipping_info['shipping_no'] : '无' }}</td>
<td>{{ $order_temp_info['jd_order_id'] }}</td>
<td>7天</td>
<!--
@if ($order_info['order_type_extend'])
<td>
<?php
switch ($order_info['order_type_extend']) {
case 1: echo '团购订单'; break;
}
?>
</td>
@endif
@if ($order_info['order_goods_type'] == 2)
<td>{{ $order_info['sale_type'] == 1 ? '现卖' : '预售' }}</td>
@endif
@if ($order_temp_info['business_type'])
<td>{{ Config('params.business_type')[$order_temp_info['business_type']] }}</td>
@endif
@if ($order_info['order_pay_type'] == 2)
<td>{{$currency.$order_info['advance_amount']}}</td>
<td>
{{$currency.number_format($order_info['order_amount'] - $order_info['advance_amount'], 2, '.', '')}}
</td>
@endif
<td>{{ $order_info['pay_time'] ? date('Y-m-d H:i:s', $order_info['pay_time']) : '' }}</td> -->
</tr>
</table>
\ No newline at end of file
<p>ERP支付记录</p>
<div class="tabs-box table-responsive">
<table class="table table-bordered table-hover">
<thead>
<tr>
<th>创建时间</th>
<th>收款单号</th>
<th>收款金额</th>
<th>收款时间</th>
<th>支付状态</th>
<th>取消支付时间</th>
</tr>
</thead>
<tbody>
<?php foreach ($erpPayLog as $k=>$v) { ?>
<?php if ($k < 4) { ?>
<tr>
<td width="15%"><?= date('Y-m-d H:i:s', $v->create_time) ?></td>
<td width="10%"><?= $v->receipt_sn ?></td>
<td width="10%"><?= $v->receipt_amount ?></td>
<td width="10%"><?= date('Y-m-d H:i:s', $v->receipt_time) ?></td>
<td><?= $v->status == 1 ? '已支付' : '已取消' ?></td>
<td><?= $v->cancel_time ? date('Y-m-d H:i:s', $v->cancel_time) : '' ?></td>
</tr>
<?php } else { ?>
<tr class="other-infos">
<td width="15%"><?= date('Y-m-d H:i:s', $v->create_time) ?></td>
<td width="10%"><?= $v->receipt_sn ?></td>
<td width="10%"><?= $v->receipt_amount ?></td>
<td width="10%"><?= date('Y-m-d H:i:s', $v->receipt_time) ?></td>
<td><?= $v->status == 1 ? '已支付' : '已取消' ?></td>
<td><?= $v->cancel_time ? date('Y-m-d H:i:s', $v->cancel_time) : '' ?></td>
</tr>
<?php } ?>
<?php if ($k >= 4 && $k == count($erpPayLog)-1) { ?>
<tr>
<td colspan="6" class="text-center click-down"><i class="fa fa-angle-double-down">点击展开</i></td>
<td colspan="6" class="text-center click-up"><i class="fa fa-angle-double-up">点击收起</i></td>
</tr>
<?php } ?>
<?php } ?>
</tbody>
</table>
</div>
\ No newline at end of file
<div style="width: 100%; height: 40px;">
<h3 style="float: left; width: 100px;">发票收货信息</h3>
</div>
<div class="table-responsive">
<table class="table table-bordered text-nowrap">
<tr>
<th width="15%">收票人</th>
<th width="18%">联系电话/手机</th>
<th>收票地址</th>
</tr>
<tr>
<td><?= $order_invoice_address_info['consignee'] ?></td>
<td><?= $order_invoice_address_info['mobile'] ?></td>
<td>
<?= $order_invoice_address_info['province_val'] ?>&nbsp;&nbsp;<?= $order_invoice_address_info['city_val'] ?>&nbsp;&nbsp;<?= $order_invoice_address_info['district_val'] ?>&nbsp;&nbsp;<?= $order_invoice_address_info['address'] ?>
</td>
</tr>
</table>
</div>
\ No newline at end of file
<div style="width: 100%; height: 40px;">
<h3>商品信息</h3>
</div>
<div class="row-fluid table-responsive">
<table class="table table-hover text-nowrap">
<thead>
<tr class="caption">
<th>序号</th>
<?php if ($order_info['order_goods_type'] == 2) { ?>
<th>商品ID</th>
<th>商品名</th>
<th>型号</th>
<?php } else { ?>
<th>商品ID</th>
<th>商品名</th>
<?php } ?>
<?php if ($order_info['order_goods_type'] == 1) { ?>
<th>供应商</th>
<?php } ?>
<th>制造商</th>
<!-- ERP或京东订单 -->
<?php if (in_array($order_info['order_type'], [2, 3])) { ?>
<th>采购数量</th>
<th>采购单价</th>
<?php } elseif ($username != 'vpadmin@ichunt.com') { ?>
<?php if ($order_info['order_goods_type'] == 2) { ?>
<th>购买数量</th>
<th>购买时单价</th>
<?php } else { ?>
<th>采购数量</th>
<th>采购单价</th>
<?php } ?>
<th>均摊后单价</th>
<?php } else { ?>
<th>商品数量</th>
<th>商品单价</th>
<?php } ?>
<th>小计</th>
<th>费用</th>
<th>折扣</th>
<th>合计</th>
<th>货期</th>
<?php if ($order_info['order_goods_type'] == 1) { ?>
<th>采购员</th>
<?php } ?>
<th>自采标记</th>
<th >批次</th>
<?php if ($order_info['order_goods_type'] == 1) { ?>
<th>生产跟踪</th>
<?php } ?>
<th>备注</th>
<th>状态</th>
<th>来源</th>
<th>操作</th>
<?php
if ($action_name == 'changeOrder' && count($order_items_info) > 1 && in_array($order_info['status'], [1, 2])) {
echo '<th>操作</th>';
}
?>
</tr>
</thead>
<tbody>
<?php if (!empty($order_items_info)) { ?>
<?php foreach ($order_items_info as $key => $v) { ?>
<tr>
<td><?= $key+1 ?></td>
<?php if ($order_info['order_goods_type'] == 2) { ?>
<td><?= $v['goods_id'] ?></td>
<td><a href="<?= Config('website.main_url').'item/'.$v['goods_id'].'.html?ptag=order' ?>" target="_blank"><?= $v['goods_name'] ?></a></td>
<td><?= App\Http\Controllers\getGoodsName($v['goods_id']) ?></td>
<?php } else { ?>
<td><?= $v['goods_id'] ?></td>
<td><a href="<?= Config('website.main_url').'goods_'.$v['goods_id'].'.html?ptag=order' ?>" target="_blank"><?= $v['goods_name'] ?></a></td>
<?php } ?>
<?php if ($order_info['order_goods_type'] == 1) { ?>
<td><?= $v['supplier_name'] ?></td>
<?php } ?>
<td><?= $v['brand_name'] ?></td>
<td id="goods_number_<?= $v['rec_id'] ?>"><?= $v['goods_number'] ?></td>
<td>
<span id="<?= $v['rec_id'] ?>"><?= $v['goods_price'] ?></span>
</td>
<?php if (in_array($order_info['order_type'], [2, 3])) { ?>
<td><?= $v['goods_amount_format'] ?></td>
<?php } elseif ($username != 'vpadmin@ichunt.com') { ?>
<td><?= $v['single_pre_price_format'] ?></td>
<td><?= $v['goods_amount_format'] ?></td>
<?php } else { ?>
<td><?= $v['goods_amount_format'] ?></td>
<?php } ?>
<td><?= $v['extra_price'] ?></td>
<td><?= $v['goods_discount_amount'] ?></td>
<td><?= number_format($v['goods_amount'] + $v['extra_price'] - $v['goods_discount_amount'], 2, '.', '') ?></td>
<td><?= $v['delivery_time'] ?></td>
<?php if ($order_info['order_goods_type'] == 1) { ?>
<td> <div class="buyerName">
<?php
echo !empty($v['buyerName'])?$v['buyerName']:'';
?>
</div>
</td>
<?php } ?>
<td>
<?php
if($v['self_supplier_type'] == 1) {
echo '自采';
} elseif($v['self_supplier_type'] == 2) {
echo '自采';
} else {
echo '自采';
}
?>
</td>
<td class="batch"><?= !empty($v['batch']) ? $v['batch'] : ''; ?> </td>
<?php if ($order_info['order_goods_type'] == 1) { ?>
<td><a class="order-track" data-rid="<?= $v['rec_id'] ?>"><?= App\Http\Controllers\getLastTrack($v['rec_id']) ?></a></td>
<?php } ?>
<td><?= !empty($v['remarks']) ? $v['remarks'] : '' ?></td>
<td><?= $v['status'] == 1 ? '正常' : '<i class="error">已关闭</i>' ?></td>
<td><?= $v['goods_source'] == 1 ? '前台' : '后台' ?></td>
<td>
<!-- <button type="button" class="btn btn-success btn-xs remarks">编辑</button> -->
<?php if (in_array($order_info['status'], [1, 2, 3]) && $v['status'] == 1) { ?>
<button type="button" class="btn btn-success btn-xs edit-item" data-id="<?= $v['rec_id'] ?>" data-batch="<?= $v['batch'] ?>" data-bid="<?= $v['buyer_id'] ?>" data-remarks="<?= $v['remarks'] ?>">编辑</button>
<?php } ?>
</td>
</tr>
<?php } ?>
<?php } ?>
</tbody>
<tfoot>
<?php if ($order_info['order_remark']) { ?>
<tr>
<td>订单备注信息:</td>
<td colspan="20"><?= $order_info['order_remark'] ?></td>
</tr>
<?php } ?>
<?php if ($order_temp_info['kefu_remark']) { ?>
<tr>
<td>客服备注信息:</td>
<td colspan="20"><?= $order_temp_info['kefu_remark'] ?></td>
</tr>
<?php } ?>
<?php if ($order_info['order_goods_type'] == 2 && $order_temp_info['business_type'] == 1) { ?>
<tr>
<td>项目需求描述:</td>
<td colspan="20"><?= $order_temp_info['sample_demand_desc'] ?></td>
</tr>
<?php } ?>
</tfoot>
</table>
<!-- 退款已处理 -->
<?php if ($order_refund_info['status'] == 10 && $order_price_info['refund_price'] != 0) { ?>
<hr>
<table class="table">
<thead>
<tr class="caption">
<th>退款型号</th>
<th>退款数量</th>
<th>价格</th>
<th>小计</th>
</tr>
</thead>
<tbody>
<?php foreach ($order_refund_items as $k=>$v) { ?>
<tr>
<td><?= $v['goods_name'] ?></td>
<td><?= $v['refund_num'] ?></td>
<td><?= $currency . $v['single_pre_price'] ?></td>
<td><?= $currency . number_format($v['refund_num'] * $v['single_pre_price'], 4) ?></td>
</tr>
<?php } ?>
<tr>
<td>手动差价</td>
<td></td>
<td></td>
<td><?= '-' . $order_refund_info['price_fall'] ?></td>
</tr>
</tbody>
</table>
<?php } ?>
</div>
<div class="order-total" style="margin-top: 30px;">
<div>
<table>
<tr>
<td>商品总额:</td>
<td><?= $currency ?><span id="order-total" class="amount"><?= $order_price_info['goods_price'] ?></span></td>
</tr>
<?php if ($order_price_info['new_client_price'] != 0) { ?>
<tr>
<?php if ($order_info['order_type_extend'] == 1) { ?>
<td>团购优惠:</td>
<?php } else { ?>
<td>新客价优惠:</td>
<?php } ?>
<td><span id="order-total" class="amount"><?= $order_price_info['new_client_price'] ?></span></td>
</tr>
<?php } ?>
<?php if (isset($order_price_info['ext_price'])) { ?>
<tr>
<td>附加款:</td>
<td class="edit-parent-td">
<?= $currency ?><span id="other_money"><?= $order_price_info['ext_price'] ?></span>
</td>
</tr>
<?php } ?>
<?php if ($order_price_info['shipping_price'] != 0) { ?>
<tr>
<td>快递费用:</td>
<td class="edit-parent-td">
<?= $currency ?><span id="other_money"><?= $order_price_info['shipping_price'] ?></span>
</td>
</tr>
<?php } ?>
<?php if ($order_price_info['discount_amount'] != 0) { ?>
<tr>
<td>优惠金额:</td>
<td class="edit-parent-td">
<span id="other_money"><?= $order_price_info['discount_amount'] ?></span>
</td>
</tr>
<?php } ?>
<?php if (isset($order_price_info['refund_price']) && $order_price_info['refund_price'] != 0) { ?>
<tr>
<td>退款金额:</td>
<td class="edit-parent-td">
<?= $currency ?><span id="other_money"><?= $order_price_info['refund_price'] ?></span>
</td>
</tr>
<?php } ?>
<tr>
<td>订单总额:</td>
<td>
<span style="color:red;font-size:20px">
<?= $currency ?><span class="amount"><?= $order_info['order_amount'] ?></span>
</span>
</td>
</tr>
<?php if (isset($order_price_info['pay_preferential']) && $order_price_info['pay_preferential'] != 0) { ?>
<tr>
<td>支付优惠:</td>
<td class="edit-parent-td">
<span id="other_money"><?= $order_price_info['pay_preferential'] ?></span>
</td>
</tr>
<tr>
<td>实际支付金额:</td>
<td class="edit-parent-td">
<span style="color:red;font-size:20px">
<?= $currency ?><span class="amount"><?= $order_info['order_amount'] + $order_price_info['pay_preferential'] ?></span>
</span>
</td>
</tr>
<?php } ?>
</table>
</div>
<!-- 非内部采购下单显示付款地址 -->
<?php if (isset($order_temp_info) && $order_temp_info['order_type'] != 3 && $order_info['status'] < 4) { ?>
<p>客户付款地址:<?= Config('website.pay_url').$order_info['order_id'] ?></p>
<?php } ?>
</div>
<div>
<!-- Nav tabs -->
<ul class="nav nav-tabs" role="tablist">
<li role="presentation" class="active"><a href="#order_invoice" aria-controls="order_invoice" role="tab" data-toggle="tab">发票信息</a></li>
<li role="presentation"><a href="#contract_info" aria-controls="contract_info" role="tab" data-toggle="tab">合同乙方信息</a></li>
<?php if (!empty($order_info['order_source']) && preg_match('/adtag\=/', $order_info['order_source'])) { ?>
<li role="presentation"><a href="#adtag_val" aria-controls="adtag_val" role="tab" data-toggle="tab">Adtag值</a></li>
<?php } ?>
<?php if (!empty($order_shipping_info) || !empty($order_invoice_shipping_info)) { ?>
<li role="presentation"><a href="#shipping_info" aria-controls="shipping_info" role="tab" data-toggle="tab">物流信息</a></li>
<?php } ?>
<?php if ($order_extra && $action_name == 'details') { ?>
<li role="presentation"><a href="#end_client_info" aria-controls="end_client_info" role="tab" data-toggle="tab">终端客户信息</a></li>
<?php } ?>
</ul>
<!-- Tab panes -->
<div class="tab-content">
<?php if (!empty($order_invoice_info)) { ?>
<div role="tabpanel" class="tab-pane active" id="order_invoice">
<table class="table table-bordered order-express">
<tr class="caption">
<th colspan="8" style="text-align: center; background: #f9f9f9;"> 发票信息
<?php
//<!-- 发票状态小于2(已发货)且更改权限存在 显示按钮 -->
if (!isset($tags)) {
if(in_array($order_info['status'], [1, 2, 3, 4]) && $order_invoice_info['invoice_status'] < 2 && in_array('update_invoice', $userPerms)) {
echo '<a href="/changeInvoice/'.$order_info['order_id'].'" class="btn btn-success btn-sm changeBtn">更改发票</a>';
}
} elseif ($order_info['status'] != -1 && isset($tags) && $tags == 'self' && isset($extend) && !$extend) {
if ($order_info['status'] > 3) { // 已付款请求财务接口判断是否能修改发票
$isChangeInvoice = App\Http\Controllers\isChangeInvoice($order_info['order_sn']);
if ($isChangeInvoice) {
echo '<a href="/changeInvoice/'.$order_info['order_id'].'?tags='.$tags.'" class="btn btn-success btn-sm changeBtn">更改发票</a>';
}
} else {
if ($order_invoice_info['invoice_status'] < 2 && in_array('self_order_update_invoice', $userPerms)) {
echo '<a href="/changeInvoice/'.$order_info['order_id'].'?tags='.$tags.'" class="btn btn-success btn-sm changeBtn">更改发票</a>';
}
}
}
?>
</th>
</tr>
<tr>
<th>发票类型</th>
<th>发票抬头</th>
<th>公司注册地址</th>
<th>公司电话</th>
<th>税务登记号</th>
<th>开户银行</th>
<th>银行卡号</th>
<th>开票状态</th>
</tr>
<?php if ($order_invoice_info['inv_type'] == 1) { ?>
<tr style="text-align: center;">
<td colspan="8">不开发票</td>
</tr>
<?php } else { ?>
<tr>
<td>
<?php
switch ($order_invoice_info['inv_type']) {
case 2: echo '普通发票';break;
case 3: echo '增值税专用发票';break;
case 4: echo '增值税普通发票';break;
}
?>
</td>
<td><?= $order_invoice_info['tax_title'] ?></td>
<td><?= $order_invoice_info['company_address'] ?></td>
<td><?= $order_invoice_info['company_phone'] ?></td>
<td><?= $order_invoice_info['tax_no'] ?></td>
<td><?= $order_invoice_info['bank_name'] ?></td>
<td><?= $order_invoice_info['bank_account'] ?></td>
<td><?= $order_invoice_info['invoice_status_val'] ?></td>
</tr>
<?php } ?>
</table>
</div>
<?php } ?>
<div role="tabpanel" class="tab-pane" id="contract_info">
<table class="table table-bordered">
<tr class="caption">
<th colspan="4" style="text-align: center; background: #f9f9f9;">合同乙方信息
<?php if ($order_info['status'] == 1) { ?>
<a href="javascript:;" class="btn btn-success btn-sm changeBtn contract_info_edit">编辑</a>
<?php } ?>
</th>
</tr>
<tr>
<th>公司名称</th>
<th>公司地址</th>
<th>联系人</th>
<th>联系电话</th>
</tr>
<tr>
<td><?= $contract_com_name ?></td>
<td><?= $contract_com_addr ?></td>
<td><?= $contract_link_name ?></td>
<td><?= $contract_link_tel ?></td>
</tr>
</table>
</div>
<?php if (!empty($order_info['order_source']) && preg_match('/adtag\=/', $order_info['order_source'])) { ?>
<div role="tabpanel" class="tab-pane" id="adtag_val">
<table class="table table-bordered table-hover">
<tr>
<th width="10%">Adtag值:</th>
<td><?= $order_info['order_source'] ?></td>
</tr>
</table>
</div>
<?php } ?>
<!-- 订单或发票物流 -->
<?php if (!empty($order_shipping_info) || !empty($order_invoice_shipping_info)) { ?>
<div role="tabpanel" class="tab-pane" id="shipping_info">
<table class="table table-bordered table-hover">
<tr class="caption">
<th colspan="8" style="text-align: center; background: #f9f9f9;">
物流信息
</th>
</tr>
<?php if (!empty($order_shipping_info)) { ?>
<tr>
<th width="5%">订单物流</th>
<th width="5%">快递公司:</th>
<td width="10%"><?= $order_shipping_info['shipping_name'] ?></td>
<th width="5%">快递单号:</th>
<td width="10%"><?= $order_shipping_info['shipping_no'] ?></td>
<th width="5%">配送状态:</th>
<td width="10%">
<?php
switch ($order_shipping_info['status']) {
case 0:
case 1: echo '已配送'; break;
case 2: echo '已签收'; break;
default: echo '未配送'; break;
}
?>
</td>
<td width="5%">
<a class="btn btn-xs btn-success view-shipping" data-type="1">查看物流轨迹</a>
</td>
</tr>
<?php } ?>
<?php if (!empty($order_invoice_shipping_info)) { ?>
<tr>
<th width="5%">发票物流</th>
<th width="5%">快递公司:</th>
<td width="10%"><?= $order_invoice_shipping_info['shipping_name'] ?></td>
<th width="5%">快递单号:</th>
<td width="10%"><?= $order_invoice_shipping_info['shipping_no'] ?></td>
<th width="5%">配送状态:</th>
<td width="10%">
<?php
switch ($order_invoice_shipping_info['status']) {
case 0:
case 1: echo '已配送'; break;
case 2: echo '已签收'; break;
default: echo '未配送'; break;
}
?>
</td>
<td width="5%">
<a class="btn btn-xs btn-success view-shipping" data-type="2">查看物流轨迹</a>
</td>
</tr>
<?php } ?>
</table>
</div>
<?php } ?>
<!-- 终端客户信息 -->
<?php if ($order_extra && $action_name == 'details') { ?>
<div role="tabpanel" class="tab-pane" id="end_client_info">
<table class="table table-bordered table-hover">
<tr class="caption">
<th colspan="4" style="text-align: center; background: #f9f9f9;">终端客户信息</th>
</tr>
<tr>
<th>客户名称(中文)</th>
<th>客户名称(英文)</th>
<th>客户类型</th>
<th>产品用途</th>
</tr>
<tr>
<td><?= $order_extra['customer_cn'] ?></td>
<td><?= $order_extra['customer_en'] ?></td>
<td><?= Config('params.end_user_type')[$order_extra['customer_type']] ?></td>
<td><?= $order_extra['product_use'] ?></td>
</tr>
</table>
</div>
<?php } ?>
</div>
</div>
<p>物流信息</p>
<div class="tabs-box table-responsive">
<table class="table table-bordered table-hover">
<thead>
<tr>
<th width="15%">物流时间</th>
<th>物流信息</th>
</tr>
</thead>
<tbody>
<?php if (!empty($order_shipping_info['info'])) { ?>
<?php $shippings_info = json_decode($order_shipping_info['info'], true); ?>
<?php foreach ($shippings_info as $k=>$v) { ?>
<?php if ($k < 4) { ?>
<tr>
<td><?= $v['AcceptTime'] ?></td>
<td><?= $v['AcceptStation'] ?></td>
</tr>
<?php } else { ?>
<tr class="other-infos">
<td><?= $v['AcceptTime'] ?></td>
<td><?= $v['AcceptStation'] ?></td>
</tr>
<?php } ?>
<?php if ($k >= 4 && $k == count($shippings_info)-1) { ?>
<tr>
<td colspan="2" class="text-center click-down"><i class="fa fa-angle-double-down">点击展开</i></td>
<td colspan="2" class="text-center click-up"><i class="fa fa-angle-double-up">点击收起</i></td>
</tr>
<?php } ?>
<?php } ?>
<?php } else { ?>
<?php foreach ($order_shipping_inside as $k=>$v) { ?>
<?php if ($k < 4) { ?>
<tr>
<td><?= date('Y-m-d H:i:s', $v['create_time']) ?></td>
<td><?= $v['info'] ?></td>
</tr>
<?php } else { ?>
<tr class="other-infos">
<td><?= date('Y-m-d H:i:s', $v['create_time']) ?></td>
<td><?= $v['info'] ?></td>
</tr>
<?php } ?>
<?php if ($k >= 4 && $k == count($order_shipping_inside)-1) { ?>
<tr>
<td colspan="2" class="text-center click-down"><i class="fa fa-angle-double-down">点击展开</i></td>
<td colspan="2" class="text-center click-up"><i class="fa fa-angle-double-up">点击收起</i></td>
</tr>
<?php } ?>
<?php } ?>
<?php } ?>
</tbody>
</table>
</div>
\ No newline at end of file
<script src="/js/jquery-2.2.1.js"></script>
<script src="/js/jquery.form.js"></script>
<script src="/js/bootstrap.min.js"></script>
<script src="/js/bootstrap-select.min.js"></script>
<script src="/layer/layer.js"></script>
<script src="/js/plugins/slimscroll/jquery.slimscroll.min.js"></script>
<script src="/js/plugins/metisMenu/jquery.metisMenu.js"></script>
<script src="/js/inspinia.min.js"></script>
<script src="/js/plugins/DatePicker/WdatePicker.js"></script>
<script src="/js/common.js"></script>
<script src="/js/md5.js"></script>
<script src="/js/layui/layui.js"></script>
<script src="/js/details.js?v=<?= time() ?>"></script>
<script src="/js/order_audit.js"></script>
<script src="/js/order_track.js"></script>
<script src="/js/order_cancel.js"></script>
<script src="/js/order_send_email.js"></script>
<script src="/js/refund.js?v=<?= time() ?>"></script>
<p style="margin-left: 5px;">订单发货</p>
<div class="tabs-box send">
<table class="table">
<input type="hidden" id="order_id" value="{{$order_info['order_id']}}">
</table>
<table class="table">
<?php
$html = '';
if ($order_info['order_shipping_type'] == 1) {
switch ($order_shipping_info['status']) {
case 1:
echo '<tr>配送中,物流单号为'.$order_shipping_info['shipping_no'].',配送方式为&nbsp;'.$ship_type[$order_shipping_info['shipping_id']].'</tr>';
break;
case 2:
echo '<tr>已签,订单完成</tr>';
break;
default:
// if (count($order_items_info) > 0) {
// foreach ($order_items_info as $k => $item) {
// $html .= '<tr>
// <td>
// <label>型号名:</label>
// <span>'.$item['goods_name'].'</span>
// </td>';
$html .= '<tr>
<td>
<label>选择快递:</label>
<select class="batch-shipping-code">';
foreach ($shippings as $v) {
$html .= '<option value="'.$v->shipping_id.'">'.$v->shipping_name.'</option>';
}
$html .= '</select>
</td>
<td>
<label>填写单号:</label>
<input type="text" class="batch-shipping-no" value="'.$order_shipping_info['shipping_no'].'" />
</td>
<td><a class="btn btn-default batch-send">确认发货</a></td>
</tr>';
// }
// }
echo $html;
break;
}
} else {
echo '<tr>
<td>线下自提</td>
</tr>';
}
?>
</table>
</div>
\ No newline at end of file
...@@ -289,17 +289,21 @@ ...@@ -289,17 +289,21 @@
</td> </td>
<td class="show-list"> <td class="show-list">
<?php <?php
switch ($v['status']) { if ($order_extend->is_manager_audit) {
case -2: echo '<span class="list-text-no-check"><b>审核未通过</b></span>';break; echo '<span class="list-text-checking"><b>待主管审核</b></span>';
case -1: echo '<span class="list-text-cancel"><b>已取消</b></span>';break; } else {
case 1: echo '<span class="list-text-checking"><b>待审核</b></span>';break; switch ($v['status']) {
case 2: echo '<span class="list-text-pay"><b>待付款</b></span>';break; case -2: echo '<span class="list-text-no-check"><b>审核未通过</b></span>';break;
case 3: echo '<span class="list-text-last-pay"><b>待付尾款</b></span>';break; case -1: echo '<span class="list-text-cancel"><b>已取消</b></span>';break;
case 4: echo '<span class="list-text-send"><b>待发货</b></span>';break; case 1: echo '<span class="list-text-checking"><b>待审核</b></span>';break;
case 7: echo '<span class="list-text-send"><b>部分发货</b></span>';break; case 2: echo '<span class="list-text-pay"><b>待付款</b></span>';break;
case 8: echo '<span class="list-text-confirm"><b>待收货</b></span>';break; case 3: echo '<span class="list-text-last-pay"><b>待付尾款</b></span>';break;
case 10: echo '<span class="list-text-success"><b>交易成功</b></span>';break; case 4: echo '<span class="list-text-send"><b>待发货</b></span>';break;
} case 7: echo '<span class="list-text-send"><b>部分发货</b></span>';break;
case 8: echo '<span class="list-text-confirm"><b>待收货</b></span>';break;
case 10: echo '<span class="list-text-success"><b>交易成功</b></span>';break;
}
}
?> ?>
</td> </td>
<td class="show-list"> {{ Config('params.order_pay_type')[$v['order_pay_type']] }} </td> <td class="show-list"> {{ Config('params.order_pay_type')[$v['order_pay_type']] }} </td>
...@@ -325,12 +329,25 @@ ...@@ -325,12 +329,25 @@
<td class="show-list">{{$username != 'vpadmin@ichunt.com' ? date('Y-m-d H:i:s', $v['create_time']) : date('Y-m-d', $v['create_time'])}}</td> <td class="show-list">{{$username != 'vpadmin@ichunt.com' ? date('Y-m-d H:i:s', $v['create_time']) : date('Y-m-d', $v['create_time'])}}</td>
<td> <td>
<div class="btn-group btn-group-xs" style="width: 240px;"> <div class="btn-group btn-group-xs" style="width: 260px;">
<a class="btn btn-primary" href="{{URL('details', ['order_id'=>$v['order_id']])}}" target="_blank">详情</a> @if (in_array('check_order', $userPerms) && $v['sale_id'])
@if ($v['status'] == 1)
@if (in_array('check_order', $userPerms) && in_array($v['status'], [1, 2, 3])) <a class="btn btn-success" href="{{URL('change', ['order_id'=>$v['order_id']])}}" target="_blank">人工审单</a>
<a class="btn btn-success" href="{{URL('change', ['order_id'=>$v['order_id']])}}" target="_blank">人工审单</a> @elseif ($v['status'] == 2 && in_array($role, [1, 2]))
<a class="btn btn-success re-audit" data-id="{{$v['order_id']}}">反审</a>
@endif
@endif
<!-- 主管审核 -->
@if (isset($order_extend->is_manager_audit) && in_array($role, [1, 2]) && $v['status'] == 1)
<a class="btn btn-danger manager-audit" data-id="{{$v['order_id']}}">主管审核</a>
@endif
@if (!empty($order_extend->erp_sn))
<a class="btn btn-primary send_mail" data-id="{{ $v['order_id'] }}">发送邮件</a>
@endif @endif
<a class="btn btn-primary" href="{{URL('details', ['order_id'=>$v['order_id']])}}" target="_blank">详情</a>
<!-- 管理员和经理或有推送权限显示 --> <!-- 管理员和经理或有推送权限显示 -->
@if ((in_array($role, [1, 2]) || in_array('send_salesman', $userPerms))) @if ((in_array($role, [1, 2]) || in_array('send_salesman', $userPerms)))
...@@ -411,6 +428,7 @@ ...@@ -411,6 +428,7 @@
var erp_order_id = "{{$condition['erp_order_id']}}"; var erp_order_id = "{{$condition['erp_order_id']}}";
var is_new_order = "{{$condition['is_new_order']}}"; var is_new_order = "{{$condition['is_new_order']}}";
var manager = "{{$role}}"; var manager = "{{$role}}";
var cc_sales = eval('{!! isset($cc_sales) ? json_encode($cc_sales) : '' !!}'); // 抄送人集合
if (test_order) { if (test_order) {
$('input[name=test_order]').attr('checked', true); $('input[name=test_order]').attr('checked', true);
...@@ -436,6 +454,10 @@ ...@@ -436,6 +454,10 @@
$('#is_new_order').selectpicker('val', is_new_order); $('#is_new_order').selectpicker('val', is_new_order);
$.lie.order.index(); $.lie.order.index();
$.lie.track.orderTrack();
$.lie.cancel.cancelorder();
$.lie.audit.index();
$.lie.send_mail.index();
// 展开菜单 // 展开菜单
$('#side-menu').children('li').eq(1).addClass('active'); $('#side-menu').children('li').eq(1).addClass('active');
......
...@@ -6,13 +6,14 @@ ...@@ -6,13 +6,14 @@
<script src="/js/plugins/slimscroll/jquery.slimscroll.min.js"></script> <script src="/js/plugins/slimscroll/jquery.slimscroll.min.js"></script>
<script src="/js/plugins/metisMenu/jquery.metisMenu.js"></script> <script src="/js/plugins/metisMenu/jquery.metisMenu.js"></script>
<script src="/js/inspinia.min.js"></script> <script src="/js/inspinia.min.js"></script>
<script src="/js/plugins/DatePicker/WdatePicker.js"></script>
<script src="/js/common.js"></script> <script src="/js/common.js"></script>
<script src="/js/md5.js"></script>
<script src="/js/layui/layui.js"></script> <script src="/js/layui/layui.js"></script>
<script src="/js/order.js?v=<?= time() ?>"></script> <script src="/js/list.js?v=<?= time() ?>"></script>
<script src="/js/orderamount.js"></script> <script src="/js/order_audit.js"></script>
<script src="/js/plugins/DatePicker/WdatePicker.js"></script> <script src="/js/order_track.js"></script>
<script src="/js/order_cancel.js"></script>
<script src="/js/order_send_email.js"></script>
<script src="/js/refund.js?v=<?= time() ?>"></script> <script src="/js/refund.js?v=<?= time() ?>"></script>
<script src="/js/goods.js?v=<?= time() ?>"></script>
...@@ -143,8 +143,8 @@ ...@@ -143,8 +143,8 @@
</div> </div>
</div> </div>
<!-- 管理员、经理、自营客服主管及助理审核 && 待审核状态 --> <!-- 管理员、经理、自营查看 && 待审核状态 -->
@if (in_array($role, [1, 2, 10, 11]) && $return['status'] == 1) @if (in_array($role, [1, 2, 5]) && $return['status'] == 1)
<div class="text-center" style="margin-bottom: 10px;"> <div class="text-center" style="margin-bottom: 10px;">
<button class="btn btn-info return-check" style="margin-right: 10px;" data-type="2" data-id="{{ $return['return_id'] }}">审核通过</button> <button class="btn btn-info return-check" style="margin-right: 10px;" data-type="2" data-id="{{ $return['return_id'] }}">审核通过</button>
<button class="btn btn-danger return-check" data-type="-2" data-id="{{ $return['return_id'] }}">驳回</button> <button class="btn btn-danger return-check" data-type="-2" data-id="{{ $return['return_id'] }}">驳回</button>
......
...@@ -376,7 +376,7 @@ ...@@ -376,7 +376,7 @@
<div class="btn-group btn-group-xs" style="width: 240px;"> <div class="btn-group btn-group-xs" style="width: 240px;">
<a class="btn btn-primary" href="/details/{{$v['order_id']}}?tags=self" target="_blank">详情</a> <a class="btn btn-primary" href="/details/{{$v['order_id']}}?tags=self" target="_blank">详情</a>
@if (in_array('self_check_order', $userPerms) && in_array($v['status'], [1, 2])) @if (in_array('self_check_order', $userPerms) && in_array($v['status'], [1, 2]) && $v['sale_id'])
<a class="btn btn-success" href="/change/{{$v['order_id']}}?tags=self" target="_blank">人工审单</a> <a class="btn btn-success" href="/change/{{$v['order_id']}}?tags=self" target="_blank">人工审单</a>
@endif @endif
...@@ -479,4 +479,6 @@ ...@@ -479,4 +479,6 @@
$('.business_type').selectpicker('val', business_type.split(',')).trigger("change"); $('.business_type').selectpicker('val', business_type.split(',')).trigger("change");
$.lie.order.index(); $.lie.order.index();
$.lie.track.orderTrack();
$.lie.cancel.cancelorder();
</script> </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