Commit d7884a9a by 朱继来

添加联营无SKUID商品

parent 68214dc8
...@@ -789,9 +789,29 @@ Class AddOrderController extends Controller ...@@ -789,9 +789,29 @@ Class AddOrderController extends Controller
public function addGoods(Request $request) public function addGoods(Request $request)
{ {
if ($request->isMethod('post')) { if ($request->isMethod('post')) {
$add_type = $request->input('add_type', ''); // 新增类型
if ($add_type) {
$data['add_goods_name'] = $request->input('add_goods_name', '');
$data['add_brand_name'] = $request->input('add_brand_name', '');
$data['add_supplier_name'] = $request->input('add_supplier_name', '');
$data['add_goods_number'] = $request->input('add_goods_number', 0);
$data['add_goods_price'] = $request->input('add_goods_price', 0);
$data['add_delivery_time'] = $request->input('add_delivery_time', '');
$CmsModel = new CmsModel();
$add_buyer_id = $request->input('add_buyer_id', 0);
$data['add_buyer_id'] = $add_buyer_id ? $CmsModel->getSaleId($add_buyer_id) : 0;
$data['add_batch'] = $request->input('add_batch', '');
$data['add_remarks'] = $request->input('add_remarks', '');
} else {
$data['goods_id'] = $request->input('goods_id');
$data['goods_num'] = $request->input('goods_num');
}
$data['order_id'] = $request->input('order_id'); $data['order_id'] = $request->input('order_id');
$data['goods_id'] = $request->input('goods_id'); $data['add_type'] = $add_type;
$data['goods_num'] = $request->input('goods_num');
$data['operator_id'] = $request->user->userId; $data['operator_id'] = $request->user->userId;
$url = Config('website.order_api_domain').'/order/addgoods'; $url = Config('website.order_api_domain').'/order/addgoods';
......
...@@ -20,4 +20,16 @@ class CmsModel extends Model ...@@ -20,4 +20,16 @@ class CmsModel extends Model
return $user ? $user->name : ''; return $user ? $user->name : '';
} }
// 获取用户ID
public function getSaleId($name='')
{
if (!$name) return false;
$name && $map['name'] = $name;
$user = $this->where($map)->select('userId')->first();
return $user ? $user->userId : 0;
}
} }
\ No newline at end of file
...@@ -88,12 +88,70 @@ ...@@ -88,12 +88,70 @@
content: $('#addGoodsNoSkuid'), content: $('#addGoodsNoSkuid'),
btn: ['新增', '取消'], btn: ['新增', '取消'],
btn1: function() { btn1: function() {
var order_id = $('#order_id').val();
var add_goods_name = $('input[name=add_goods_name]').val();
var add_brand_name = $('input[name=add_brand_name]').val();
var add_supplier_name = $('input[name=add_supplier_name]').val();
var add_goods_number = $('input[name=add_goods_number]').val();
var add_goods_price = $('input[name=add_goods_price]').val();
var add_delivery_time = $('input[name=add_delivery_time]').val();
var add_buyer_id = $('input[name=add_buyer_id]').val();
var add_batch = $('input[name=add_batch]').val();
var add_remarks = $('textarea[name=add_remarks]').val();
var reg = /\d/;
if (!add_goods_name) {
layer.msg('请输入商品名称');
return false;
}
if (!add_brand_name) {
layer.msg('请输入制造商');
return false;
}
if (!add_supplier_name) {
layer.msg('请输入供应商');
return false;
}
if (!add_goods_number) {
layer.msg('请输入采购数量');
return false;
}
if (!reg.test(add_goods_number)) {
layer.msg('格式错误,请输入正确的采购数量');
return false;
}
if (!add_goods_price) {
layer.msg('请输入采购单价');
return false;
}
if (!reg.test(add_goods_price)) {
layer.msg('格式错误,请输入正确的采购单价');
return false;
}
if (!add_delivery_time) {
layer.msg('请输入货期');
return false;
}
var datax = { var datax = {
add_type: 1,
order_id: order_id, order_id: order_id,
goods_id: goods_id, add_goods_name: add_goods_name,
goods_num: goods_min_num, add_brand_name: add_brand_name,
add_supplier_name: add_supplier_name,
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({ $.ajax({
......
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