Ver Fonte

业务公司优化,企业客户组织优化

wufeng há 2 anos atrás
pai
commit
9d2a49cf9d
2 ficheiros alterados com 10 adições e 8 exclusões
  1. 5 4
      app/controller/CustomerOrg.php
  2. 5 4
      app/controller/Headquarters.php

+ 5 - 4
app/controller/CustomerOrg.php

@@ -103,12 +103,12 @@ class CustomerOrg extends BaseController
     public function list()
     {
 
-        $param = $this->request->only(['pid' => '', 'companyNo' => '', 'creater' => '', 'name' => '', 'start' => '', 'end' => '', 'status' => '', 'company_name' => ''], 'post', 'trim');
+        $param = $this->request->only(['pid' => 0, 'companyNo' => '', 'creater' => '', 'name' => '', 'start' => '', 'end' => '', 'status' => '', 'company_name' => ''], 'post', 'trim');
 //        $pid =  isset($this->post['pid']) &&$this->post['pid']!=="" ?intval($this->post['pid']): "0";
         $where = [['ci.is_del', "=", 0]];
 
         $condition = [['co.is_del', "=", 0]];
-        if ($param['pid'] !== "") $condition[] = ["co.pid", "=", $param['pid']];
+        if (intval($param['pid']) !== "") $condition[] = ["co.pid", "=", intval($param['pid'])];
 
 //        $companyNo = isset($this->post['companyNo']) && $this->post['companyNo'] !=="" ? trim($this->post['companyNo']):"";
         if ($param['companyNo'] !== "") $where[] = ['ci.companyNo', "like", '%' . $param['companyNo'] . '%'];
@@ -161,7 +161,7 @@ class CustomerOrg extends BaseController
             ->alias('co')
 //            ->leftJoin("depart_user u", "u.uid=co.createrid AND u.is_del=0")
             ->where($condition)
-            ->order("co.addtime desc")
+            ->group('co.pid')
             ->column("co.pid");
         if (!empty($pidlist)) $where[] = [["ci.itemid", "in", $pidlist]];
         else {
@@ -169,9 +169,10 @@ class CustomerOrg extends BaseController
             else $where[] = ['ci.itemid', '=', $param['pid']];
 
         }
+
         $list = Db::name($this->table_name)
             ->alias('co')
-            ->field("co.id,co.name,co.creater,co.status,co.addtime,0 KH,c.name company_name")
+            ->field("co.id,co.name,co.creater,co.status,co.addtime,0 kh,c.name company_name")
             ->where($condition)
             ->leftJoin('account_item b', 'b.account_id=co.createrid')
             ->leftJoin('company_item c', 'c.id=b.itemid')

+ 5 - 4
app/controller/Headquarters.php

@@ -495,13 +495,13 @@ class Headquarters extends BaseController
 
             Db::name('business')
                 ->where(['id' => $param['id'], 'is_del' => 0])
-                ->update($param);
+                ->update(array_merge($param, ['updatetime' => date("Y-m-d H:i:s")]));
 
             Db::name('headquarters')
                 ->where(['code' => $info['companyNo'], 'is_del' => 0])
                 ->update([
                     'invoice_addr' => $param['inv_addr'],
-                    'invoice_mobile' => $param['mobile'],
+                    'invoice_mobile' => $param['invoice_mobile'],
                     'invoice_bank' => $param['inv_bank'],
                     'invoice_bankNo' => $param['inv_bankNo'],
                     'invoice_title' => $param['invoice_title'],
@@ -1051,14 +1051,14 @@ class Headquarters extends BaseController
     //供应商升级成业务公司
     public function supplerUpgrade()
     {
-        $post = $this->request->only(['code', 'inv_bank', 'inv_bankNo', 'inv_addr', 'mobile', 'uid', 'uname', 'invoice_title'], 'post', 'trim');
+        $post = $this->request->only(['code', 'inv_bank', 'inv_bankNo', 'inv_addr', 'invoice_mobile', 'uid', 'uname', 'invoice_title'], 'post', 'trim');
 
         $val = Validate::rule([
             'code|供应商编码' => 'require',
             'inv_bank|银行名称' => 'require|max:255',
             'inv_bankNo|银行卡号' => 'require|number',
             'inv_addr|联系地址' => 'require|max:255',
-            'mobile|联系电话' => 'require',
+            'invoice_mobile' => 'require',
             'invoice_title|公司抬头' => 'require',
         ]);
 
@@ -1110,6 +1110,7 @@ class Headquarters extends BaseController
                     'inv_scope' => $res['scope'],
                     'license_img' => $res['license_img'],
                     'invoice_title' => $post['invoice_title'],
+                    'invoice_mobile' => $post['invoice_mobile'],
                     'status' => 1,
                     'is_del' => 0,
                     'addtime' => $date,