Commit 855628e7 by hcy001

1

parent 9241ba94
...@@ -184,11 +184,11 @@ class InquiryItemsModel extends Model ...@@ -184,11 +184,11 @@ class InquiryItemsModel extends Model
if (count($b) == 0 || $b == ""){ if (count($b) == 0 || $b == ""){
return [1001,"插入数据不得为空"]; return [1001,"插入数据不得为空"];
} }
if (empty($b["inquiry_id"])) throw new Exception("询价单ID不得为空",1002); if (empty($b["inquiry_id"])) return [1003, "询价单ID不得为空"];
if (empty($b["brand_s"])) throw new Exception("请选择型号名称",1002); if (empty($b["brand_s"])) return [1003, "请选择型号名称"];
if (empty($b["inquiry_number"])) throw new Exception("请输入询价数量",1004); if (empty($b["inquiry_number"])) return [1003, "请输入询价数量"];
if (empty($b["batch"])) throw new Exception("请输入批次要求",1005); if (empty($b["batch"])) return [1003, "请输入批次要求"];
if (empty($b["delivery_time"])) throw new Exception("请选择交货日期",1006); if (empty($b["delivery_time"])) return [1003, "请选择交货日期"];
try{ try{
$con = DB::connection('rfq'); $con = DB::connection('rfq');
...@@ -273,8 +273,8 @@ class InquiryItemsModel extends Model ...@@ -273,8 +273,8 @@ class InquiryItemsModel extends Model
#更新明细 #更新明细
$brandInfo = json_decode($b["brand_s"],true); $brandInfo = json_decode($b["brand_s"],true);
$b["brand_id"] = $brandInfo[0]["brand_id"]; $b["brand_id"] = $brandInfo[0]["value"];
$b["brand_name"] = $brandInfo[0]["brand_name"]; $b["brand_name"] = $brandInfo[0]["name"];
$updateArr= [ $updateArr= [
"goods_name"=>@$b["goods_name"] ? $b["goods_name"] : "" , "goods_name"=>@$b["goods_name"] ? $b["goods_name"] : "" ,
"brand_id"=>@$b["brand_id"] ? $b["brand_id"] : 0, "brand_id"=>@$b["brand_id"] ? $b["brand_id"] : 0,
......
...@@ -33,7 +33,7 @@ class InquiryModel extends Model ...@@ -33,7 +33,7 @@ class InquiryModel extends Model
$list = $rqpConn->table('inquiry as a') $list = $rqpConn->table('inquiry as a')
->join('inquiry_items as b', 'a.id', '=', 'b.inquiry_id') ->join('inquiry_items as b', 'a.id', '=', 'b.inquiry_id')
->select(DB::Raw("lie_a.inquiry_sn,lie_a.currency,lie_a.status as status_a,lie_a.com_name,lie_a.user_name,lie_a.create_name,lie_a.create_time as inquiry_ctime,lie_b.*")) ->select(DB::Raw("lie_a.inquiry_sn,lie_a.currency,lie_a.status as status_a,lie_a.user_name,lie_a.create_name,lie_b.*"))
->where(function ($query) use ($input) { ->where(function ($query) use ($input) {
if (@$input["types"] == 5){ if (@$input["types"] == 5){
$query->where('a.status', 0); $query->where('a.status', 0);
...@@ -54,6 +54,8 @@ class InquiryModel extends Model ...@@ -54,6 +54,8 @@ class InquiryModel extends Model
break; break;
case "goods_name": case "goods_name":
case "brand_name": case "brand_name":
$query->whereRaw('lie_b.'.$k.' like "' . $v . '%" ');
break;
case "customer_name": case "customer_name":
$query->whereRaw('lie_a.user_name like "' . $v . '%" '); $query->whereRaw('lie_a.user_name like "' . $v . '%" ');
break; break;
...@@ -67,10 +69,10 @@ class InquiryModel extends Model ...@@ -67,10 +69,10 @@ class InquiryModel extends Model
$query->where('b.assign_type', '=', $v); $query->where('b.assign_type', '=', $v);
break; break;
case "start_time": case "start_time":
$query->where('a.create_time', '>=', strtotime($v)); $query->where('b.create_time', '>=', strtotime($v));
break; break;
case "end_time": case "end_time":
$query->where('a.create_time', '<=', strtotime($v) + 86399); $query->where('b.create_time', '<=', strtotime($v) );
break; break;
} }
} }
...@@ -104,6 +106,7 @@ class InquiryModel extends Model ...@@ -104,6 +106,7 @@ class InquiryModel extends Model
->orderBy('b.status', 'desc') ->orderBy('b.status', 'desc')
->paginate(@$input['limit'] ? $input["limit"] : 10, ['*'], 'p', @$page ? $page : 1)->toArray(); ->paginate(@$input['limit'] ? $input["limit"] : 10, ['*'], 'p', @$page ? $page : 1)->toArray();
//getSql("rfq");
if (!$list) return [20001, '没有数据']; if (!$list) return [20001, '没有数据'];
...@@ -120,7 +123,7 @@ class InquiryModel extends Model ...@@ -120,7 +123,7 @@ class InquiryModel extends Model
$v['create_time'] = timeToDate($v['create_time']); //创建时间 $v['create_time'] = timeToDate($v['create_time']); //创建时间
$v["customer_name"] = $v['com_name'] == "" ? $v['user_name'] : $v['com_name']; $v["customer_name"] = $v['user_name'] ;
$currency_sign = $v['currency'] == 1 ? '¥' : '$'; $currency_sign = $v['currency'] == 1 ? '¥' : '$';
......
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