Переглянути джерело

Merge branch 'version1.5' into dev_wf

wufeng 2 роки тому
батько
коміт
5aff9b25dd

+ 3 - 0
app/admin/controller/Consult.php

@@ -2064,6 +2064,9 @@ class Consult extends Base
                 $kh=Db::name("customer_info")->where(['companyNo'=>$value['khNo']])->find();
                 $value['khname']= isset($kh['companyName'])?$kh['companyName']:"";
             }
+            $consult =Db::name("consult_bids")->where(["infoNo"=>$value['infoNo'],"createrid"=>$this->uid,"is_del"=>0])
+                ->find();
+            $value['is_feed'] =$consult==false?0:1;
             $value['metal_name']=isset($value['metal_id'])&& $value['metal_id']!=0?$this->noble[$value['metal_id']]:"";
             $data[]=$value;
         }

+ 4 - 3
app/admin/controller/Proorder.php

@@ -44,8 +44,9 @@ public function waitlist(){
     $size = isset($this->post['size']) && $this->post['size'] !==""? intval($this->post['size']) :"10";
     $where = [['is_del',"=",0],['a.status',"=",1]];
     $role=$this->checkRole();
+    $comd='';
     if(!empty($role['write'])){
-        $where[]=["roleid","=",$role['roleid']];
+        $comd.="FIND_IN_SET({$role['roleid']},roleid) >0";
     }
     $order_code= isset($this->post['order_code']) && $this->post['order_code'] !==""? intval($this->post['order_code']):"";
     if($order_code!=""){
@@ -59,12 +60,12 @@ public function waitlist(){
     if($action_uid!=""){
         $where[]=["a.action_uid","=",$action_uid];
     }
-    $count = Db::name('process_wait')->alias("a")->leftJoin("workflow b","a.order_type=b.order_type and a.order_code=b.order_code")->where($where)->count();
+    $count = Db::name('process_wait')->alias("a")->leftJoin("workflow b","a.order_type=b.order_type and a.order_code=b.order_code")->where($comd)->where($where)->count();
     $total = ceil("$count/$size");
     $page = $page>$total ? $total:$page;
     $list = Db::name('process_wait')->alias("a")->leftJoin("workflow b","a.order_type=b.order_type and a.order_code=b.order_code")
         ->field("a.wait_id apply_id,a.wait_name apply_name,a.addtime,a.action_uid,a.action_name,a.order_status,a.order_type,a.order_process,a.order_code,a.order_id,a.id")
-        ->where($where)->page($page,$size)->order("a.addtime desc")->select();
+        ->where($where)->where($comd)->page($page,$size)->order("a.addtime desc")->select();
     $data=[];//->field("status,order_name,process_name")
     foreach ($list as $value) {
         $str = Db::name("process")->where(['process_type' => $value['order_type']])->field("process_name,status")->find();

+ 5 - 3
app/admin/controller/Purch.php

@@ -155,6 +155,8 @@ class Purch extends Base
 
             $inorder= Db::name("purchease_in")->where(['cgdNo'=>$value['cgdNo'],"is_del"=>0])->select();
             $value['child']=empty($inorder)? [] : $inorder;
+            $value['send_num'] -=$value['th_num'];
+            $value['total_fee'] =round($value['total_fee']-$value['th_fee'],2);
             $data[]=$value;
         }
         return app_show(0,"获取成功",["list"=>$data ,"count"=>$count]);
@@ -269,7 +271,8 @@ class Purch extends Base
         $data['can'] = $int;
         $data['goodinfo'] = $goon;
         $data['purcheasediff'] = $dom;
-
+        $data['send_num'] -=$data['th_num'];
+        $data['total_fee'] =round($data['total_fee']-$data['th_fee'],2);
         if(isset($data['companyNo'])&&$data['companyNo']!=""){
             $company = Db::name("business")->where(["companyNo"=>$data['companyNo']])->find();
         }
@@ -857,8 +860,7 @@ class Purch extends Base
 
         if (empty($data)) return error_show(1004, "未找到该采购单数据");
         if ($data['status'] != 0) return error_show(1005, '该状态下不允许修改实时金价');
-        $sale_price =  round($data['demo_fee'] / $data['good_num'] + $data['open_fee'] / $data['good_num'] +
-            $data['weight']  * $param["gold_price"] + $data['teach_fee'] *  $data['weight']  +
+        $sale_price =  round($data['demo_fee'] / $data['good_num'] + $data['open_fee'] / $data['good_num'] +$data['weight']  * $param["gold_price"] + $data['teach_fee'] *  $data['weight']  +
             $data['pakge_fee'] +  $data['mark_fee'] + $data['cert_fee'] +$data['nake_fee'] + $data['delivery_fee'],2);
         $total_price = round($data['good_num']*$sale_price,2);
 

+ 44 - 0
app/admin/controller/Purchin.php

@@ -823,8 +823,11 @@ class Purchin extends Base
 
             //需要在详情页把相关退货记录原样取出来,所以这里把if去掉,所有记录都入purchease_return表
 //            if($info['status']==5){
+                $returnCode=makeNo("CR");
                 $data=[
+                    "returnCode"=>$returnCode,
                     "wsm_in_code"=>$incode,
+                    "cgdNo"=>$cgdinfo['cgdNo'],
                     "wsm_num"=>$wsm_num,
                     "reissue_num"=>$reissue_num,
                     "return_num"=>$return_num,
@@ -999,6 +1002,47 @@ class Purchin extends Base
 
     }
 
+    public function returnList(){
+        $page = isset($this->post['page']) && $this->post['page'] !=="" ? intval($this->post['page']):"1";
+        $size = isset($this->post['size']) && $this->post['size'] !=="" ? intval($this->post['size']):"10";
+        $where = [['a.is_del',"=",0],['b.is_del',"=",0]];
+        $cgdNo = isset($this->post['cgdNo']) && $this->post['cgdNo']!="" ? trim($this->post['cgdNo']):"";
+        if($cgdNo!=""){
+            $where[]=['a.cgdNo',"like", "%$cgdNo%"];
+        }
+        $returnCode= isset($this->post['returnCode']) && $this->post['returnCode']!="" ? trim($this->post['returnCode']):"";
+        if($returnCode!=""){
+            $where[]=['a.returnCode',"like", "%$returnCode%"];
+        }
+        $good_type_code=isset($this->post['good_type_code']) && $this->post['good_type_code']!==""? trim($this->post['good_type_code']):"";
+        if($good_type_code !=""){
+            $where[]= ["b.spuCode",'like',"%$good_type_code%"];
+        }
+        $good_name=isset($this->post['good_name']) && $this->post['good_name']!==""? trim($this->post['good_name']):"";
+        if($good_name !=""){
+            $where[]= ["b.good_name",'like',"%$good_name%"];
+        }
+        $status=isset($this->post['status']) && $this->post['status']!==""? trim($this->post['status']):"";
+        if($status!=""){
+            $where[]= ["a.status",'=',$status];
+        }
+        $count = Db::name('purchease_return')->alias('a')->join("purchease_order b","b.cgdNo=a.cgdNo","left")
+            ->where($where)->count();
+        $total = ceil($count / $size);
+        $page = $page >= $total ? $total : $page;
+        $list = Db::name('purchease_return')->alias('a')->join("purchease_order b","b.cgdNo=a.cgdNo","left")
+            ->where($where)->page($page,$size)
+            ->field("a.returnCode,b.spuCode,a.good_catid,a.return_num,a.good_price,a.good_total,
+        a.post_company,a.post_fee,a.status,a.cgdNo,b.good_name,b.order_type")->order("a.addtime desc")->select();
+        $data=[];
+        foreach ($list as $value){
+            $value['can']= isset($value['good_catid']) && $value['good_catid'] !=0 ? made($value['good_catid']):[];
+            $data[]=$value;
+        }
+        return app_show(0,"获取成功",['list'=>$data,'count'=>$count]);
+
+    }
+
 //    public function ReturnStatus(){
 //        $incode = isset($this->post['wsm_in_code'])&&$this->post['wsm_in_code']!="" ? trim($this->post['wsm_in_code']) :"";
 //        if($incode==""){

+ 18 - 2
app/admin/controller/Resign.php

@@ -776,6 +776,21 @@ class Resign extends Base
         if($goodnake==false){
             return error_show(1004,"未找到成本数据");
         }
+        $top_cat = made($good['cat_id']);
+        $top_cat_id = isset($top_cat[0])?$top_cat[0]:"";
+        if($good['is_gold_price']==1 && $top_cat_id==6){
+            $gold = Db::name("gold_price1")->where(["type"=>$good['noble_metal'],"is_del"=>0,"status"=>1])->order("addtime desc")
+                ->find();
+          //  $weight =  $good['noble_weight']*$info['good_num'];
+            $sale_price =  round($good['demo_fee'] / $info['good_num'] + $good['open_fee'] / $info['good_num'] +
+                $good['noble_weight'] * $gold["price"] + $goodnake['cost_fee'] * $good['noble_weight']  +
+                $goodnake['package_fee'] +  $goodnake['mark_fee'] + $goodnake['cert_fee'] +$goodnake['nake_fee'] + $goodnake['delivery_fee'],2);
+            $total_price = round($info['good_num']*$sale_price,2);
+        }else{
+            $sale_price = $goodnake['nake_total'];
+            $total_price = round($info['good_num']*$sale_price,2);
+        }
+
         $cgdCode = makeNo("CG");
 
         $cg =["cgdNo"=>$cgdCode,
@@ -786,8 +801,8 @@ class Resign extends Base
             "spuCode"=>$info['spuCode'],
             "good_name"=>$info['good_name'],
             "good_num"=>$info['good_num'],
-            "good_price"=>$goodnake['nake_total'],
-            "total_fee"=>round($goodnake['nake_total']*$info['good_num'],2),
+            "good_price"=>$sale_price,
+            "total_fee"=>$total_price,
             "pakge_fee"=>isset($goodnake['package_fee'])? $goodnake['package_fee']:0,
             "cert_fee"=>isset($goodnake['cert_fee'])? $goodnake['cert_fee']:0,
             "open_fee"=>$good['open_fee'],
@@ -805,6 +820,7 @@ class Resign extends Base
             "send_status"=>1,
             "send_num"=>"0",
             "wsend_num"=>$info['good_num'],
+            "weight"=>$good['noble_weight'],
             "remark"=>"",
             "status"=>0,//0表示初始化
             "lasttime"=>$info['lasttime'],

+ 2 - 1
app/admin/route/app.php

@@ -234,7 +234,8 @@ Route::rule('catratedit','admin/Cat/ratedit');
 Route::rule('catwlist',"admin/Cat/wlist");
 
 Route::rule('backcreate','admin/Purchback/create');
-Route::rule('backlist','admin/Purchback/list');
+//Route::rule('backlist','admin/Purchback/list');
+Route::rule('backlist','admin/Purch/returnList');
 Route::rule('backstatus','admin/Purchback/status');
 Route::rule('backfe','admin/Purchback/backfe');
 Route::rule('backinfo','admin/Purchback/info');