Commit 8c26d154 by 朱继来

Merge branch 'zjl_inquiry_order_20210311'

parents a0cb3837 c33d833e
...@@ -105,7 +105,10 @@ Class AddOrderController extends Controller ...@@ -105,7 +105,10 @@ Class AddOrderController extends Controller
// $info['company'] = (new CmsModel())->getCompany(); // 获取公司组织 // $info['company'] = (new CmsModel())->getCompany(); // 获取公司组织
$info['report_ids'] = $request->input('report_ids', ''); // 询价系统销售报价ID $info['report_ids'] = $request->input('report_ids', ''); // 询价系统销售报价ID
$perm = new PermController;
$info['buyers'] = $perm->getUserByDepartmentId(8, 0); // 获取采购部人员
return view('addInquiryOrder', $info); return view('addInquiryOrder', $info);
} }
...@@ -428,6 +431,16 @@ Class AddOrderController extends Controller ...@@ -428,6 +431,16 @@ Class AddOrderController extends Controller
if ($data['is_new']) { // 新版下单页面,layui格式返回 if ($data['is_new']) { // 新版下单页面,layui格式返回
$data = isset($response['data']['list']) ? $response['data']['list'] : []; $data = isset($response['data']['list']) ? $response['data']['list'] : [];
$perm = new PermController;
$buyers = $perm->getUserByDepartmentId(8, 0); // 获取采购部人员
if (!empty($data)) {
foreach ($data as &$v) {
$v['buyerSelect'] = $this->getPurchaseSelect($buyers, $v['buyer_id']);
}
}
return ['code'=>$response['err_code'], 'msg'=>$response['err_msg'], 'data'=>$data, 'count'=>count($data)]; return ['code'=>$response['err_code'], 'msg'=>$response['err_msg'], 'data'=>$data, 'count'=>count($data)];
} }
...@@ -439,6 +452,21 @@ Class AddOrderController extends Controller ...@@ -439,6 +452,21 @@ Class AddOrderController extends Controller
} }
} }
// 生成采购下拉列表
public function getPurchaseSelect($buyers, $buyer_id)
{
$option = '<option vlaue=""></option>';
foreach ($buyers as $k=>$v) {
if ($v->userId == $buyer_id) {
$option .= '<option vlaue="'.$v->userId.'" selected>'.$v->name.'</option>';
} else {
$option .= '<option vlaue="'.$v->userId.'">'.$v->name.'</option>';
}
}
return $option;
}
// 获取订单赠品信息 // 获取订单赠品信息
public function getOrderGift(Request $request) public function getOrderGift(Request $request)
{ {
...@@ -469,7 +497,7 @@ Class AddOrderController extends Controller ...@@ -469,7 +497,7 @@ Class AddOrderController extends Controller
$data['k1'] = time(); $data['k1'] = time();
$data['k2'] = md5(md5($data['k1']).'fh6y5t4rr351d2c3bryi'); $data['k2'] = md5(md5($data['k1']).'fh6y5t4rr351d2c3bryi');
if ($type == 3) { // 联营批量添加 if ($type == 3 || $type == 4) { // 3-联营批量添加、4-询价单
$url = Config('website.api_domain').'cart/changeNumForJoint'; $url = Config('website.api_domain').'cart/changeNumForJoint';
} else { } else {
$url = Config('website.api_domain').'cart/changeNumByOrderSystem'; $url = Config('website.api_domain').'cart/changeNumByOrderSystem';
...@@ -485,6 +513,47 @@ Class AddOrderController extends Controller ...@@ -485,6 +513,47 @@ Class AddOrderController extends Controller
} }
} }
// 修改购物车字段
public function changeField(Request $request)
{
if ($request->isMethod('post')) {
$uid = $request->input('uid');
$cart_id = $request->input('cart_id');
$goods_price = $request->input('goods_price', 0);
$delivery_time = $request->input('delivery_time', '');
$batch = $request->input('batch', '');
$buyer = $request->input('buyer', 0);
$data = [];
if (!$delivery_time) { // 交期不存在
$goods_price && $data['goods_price'] = $goods_price;
$batch && $data['batch'] = $batch;
if ($buyer) {
$CmsModel = new CmsModel;
$data['buyer_id'] = $CmsModel->getSaleId($buyer);
}
} else { // 修改交期
$goods_data = DB::connection('order')->table('lie_shopping_cart')->where('cart_id', $cart_id)->value('goods_data');
if (!$goods_data) {
$goods_data['delivery_time'] = $delivery_time;
} else {
$goods_data = json_decode($goods_data, true);
$goods_data['delivery_time'] = $delivery_time;
}
$data['goods_data'] = json_encode($goods_data);
}
$res = DB::connection('order')->table('lie_shopping_cart')->where('cart_id', $cart_id)->update($data);
if ($res === false) return ['errcode' => -1, 'errmsg' => '修改失败'];
return ['errcode' => 0, 'errmsg' => '修改成功'];
}
}
// 删除购物车商品 // 删除购物车商品
public function deleteGoods(Request $request) public function deleteGoods(Request $request)
{ {
......
...@@ -106,6 +106,7 @@ Route::group(['middleware' => 'web'], function () { ...@@ -106,6 +106,7 @@ Route::group(['middleware' => 'web'], function () {
Route::post('/ajax/cartList', 'AddOrderController@cartList'); Route::post('/ajax/cartList', 'AddOrderController@cartList');
Route::post('/ajax/getOrderGift', 'AddOrderController@getOrderGift'); Route::post('/ajax/getOrderGift', 'AddOrderController@getOrderGift');
Route::post('/ajax/changeNum', 'AddOrderController@changeNum'); Route::post('/ajax/changeNum', 'AddOrderController@changeNum');
Route::post('/ajax/changeField', 'AddOrderController@changeField');
Route::post('/ajax/deleteGoods', 'AddOrderController@deleteGoods'); Route::post('/ajax/deleteGoods', 'AddOrderController@deleteGoods');
Route::post('/ajax/create', 'AddOrderController@create'); Route::post('/ajax/create', 'AddOrderController@create');
Route::get('/addorder/success', 'AddOrderController@success'); Route::get('/addorder/success', 'AddOrderController@success');
......
...@@ -38,12 +38,12 @@ ...@@ -38,12 +38,12 @@
</div> </div>
</div> </div>
<div class="layui-colla-item client-info"> <!-- <div class="layui-colla-item client-info">
<h2 class="layui-colla-title">终端客户信息</h2> <h2 class="layui-colla-title">终端客户信息</h2>
<div class="layui-colla-content layui-show"> <div class="layui-colla-content layui-show">
@include('addInquiryOrder.dgkInfo') @include('addInquiryOrder.dgkInfo')
</div> </div>
</div> </div> -->
<div class="layui-colla-item order-info"> <div class="layui-colla-item order-info">
<h2 class="layui-colla-title">订单信息</h2> <h2 class="layui-colla-title">订单信息</h2>
......
...@@ -102,14 +102,25 @@ ...@@ -102,14 +102,25 @@
<table id="list" lay-filter="list"></table> <table id="list" lay-filter="list"></table>
<textarea name="remark" id="remark" class="layui-textarea" placeholder="填写订单备注信息"></textarea> <textarea name="remark" id="remark" class="layui-textarea" placeholder="填写订单备注信息"></textarea>
</div>
<script type="text/html" id="buyer_id"> <script>
@{{# if (d.buyer_id != 0) { }} var buyers = eval('{!! json_encode($buyers) !!}');
@{{ d.buyer_id }} </script>
@{{# } }}
</script>
<script type="text/html" id="list_action"> <style>
<a class="btn btn-xs btn-danger" lay-event="del">删除</a> td .layui-form-select{
</script> margin-top: -10px;
</div> margin-left: -15px;
margin-right: -15px;
}
</style>
<script type="text/html" id="t_buyer_id">
<select name="buyer_id" id="buyer_id" lay-filter="buyer_id" data-cid="@{{ d.cart_id }}">
@{{ d.buyerSelect }}
</select>
</script>
<script type="text/html" id="list_action">
<a class="btn btn-xs btn-danger" lay-event="del">删除</a>
</script>
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