|
@@ -24,6 +24,7 @@ class SupplierService extends Service
|
|
|
|
|
|
$model = Supplier::where('id',$data['id'])->first();
|
|
|
$model->title = $data['title'];
|
|
|
+ $model->code = $data['code'];
|
|
|
$model->address1 = ! empty($data['address1']) ? json_encode($data['address1']) : '';
|
|
|
$model->address2 = $data['address2'] ?? '';
|
|
|
$model->mark = $data['mark'] ?? '';
|
|
@@ -54,6 +55,7 @@ class SupplierService extends Service
|
|
|
|
|
|
$model = new Supplier();
|
|
|
$model->title = $data['title'];
|
|
|
+ $model->code = $data['code'];
|
|
|
$model->mobile = $data['mobile'] ?? "";
|
|
|
$model->address1 = ! empty($data['address1']) ? json_encode($data['address1']) : '';
|
|
|
$model->address2 = $data['address2'] ?? '';
|
|
@@ -140,12 +142,13 @@ class SupplierService extends Service
|
|
|
public function customerList($data,$user){
|
|
|
$model = Supplier::Clear($user,$data);
|
|
|
$model = $model->where('del_time',0)
|
|
|
- ->select('id','title','address1','address2','mobile','crt_id','crt_time','is_main','mark')
|
|
|
+ ->select('id','title','address1','address2','mobile','crt_id','crt_time','is_main','mark','code')
|
|
|
->orderby('id', 'asc');
|
|
|
|
|
|
if(! empty($data['title'])) $model->where('title', 'LIKE', '%'.$data['title'].'%');
|
|
|
if(! empty($data['mobile'])) $model->where('mobile', 'LIKE', '%'.$data['mobile'].'%');
|
|
|
if(! empty($data['mark'])) $model->where('mark', 'LIKE', '%'.$data['mark'].'%');
|
|
|
+ if(! empty($data['code'])) $model->where('code', 'LIKE', '%'.$data['code'].'%');
|
|
|
if(! empty($data['crt_time'][0]) && ! empty($data['crt_time'][1])) {
|
|
|
$return = $this->changeDateToTimeStampAboutRange($data['crt_time']);
|
|
|
$model->where('crt_time','>=',$return[0]);
|
|
@@ -167,6 +170,8 @@ class SupplierService extends Service
|
|
|
*/
|
|
|
public function customerRule(&$data, $user, $is_add = true){
|
|
|
if(empty($data['title'])) return [false,'供应商名称不能为空'];
|
|
|
+ if(empty($data['code'])) return [false,'供应商编码不能为空'];
|
|
|
+
|
|
|
//所属部门 以及 顶级部门
|
|
|
if(empty($data['depart_id'])) {
|
|
|
$data['depart_id'] = $this->getDepart($user);
|