Bläddra i källkod

Merge branch 'version1.5' of ssh://192.168.10.210:10022/wugg/stock into version1.5

panlumeng 3 år sedan
förälder
incheckning
92a844951f
3 ändrade filer med 114 tillägg och 12 borttagningar
  1. 104 1
      app/admin/controller/After.php
  2. 9 10
      app/admin/controller/Consult.php
  3. 1 1
      app/admin/controller/Sale.php

+ 104 - 1
app/admin/controller/After.php

@@ -248,7 +248,7 @@ class After extends \app\BaseController
         if($remark!=''){
             $info['remark'] =$remark;
         }
-        if($status==3){
+        if($status==3 && $info['is_receive']==1){
             $post =isset($this->post['is_post'])&&$this->post['is_post']!==""? intval($this->post['is_post']):"";
             if($post===""){
                 return error_show(1005,"参数is_post不能为空");
@@ -755,4 +755,107 @@ class After extends \app\BaseController
         }
         return app_show(0,"获取成功",$list);
     }
+
+    public function  setdelivery(){
+        $bkcode = isset($this->post['returnCode']) && $this->post['returnCode']!="" ? trim($this->post['returnCode']):"";
+        if($bkcode==""){
+            return error_show(1005,"参数returnCode 不能为空");
+        }
+        $info = Db::name("order_return")->where(['returnCode'=>$bkcode])->find();
+        if(empty($info)){
+            return error_show(1005,"未找到售后数据");
+        }
+        if(($info['is_receive']==0&&$info['status']!=3)||($info['is_receive']==1&&$info['status']!=4) ){
+            return error_show(1005,"售后单流程状态有误");
+        }
+        $out=Db::name("order_out")->where(["outCode"=>$info["outCode"]])->find();
+        $is_th = isset($this->post['is_th'])&&$this->post['is_th']!=="" ? intval($this->post['is_th']):"";
+        if($is_th===""){
+            return error_show(1005,"参数is_th不能为空");
+        }
+        $company=isset($this->post['company'])&&$this->post['company']!=""?trim($this->post['company']):"";
+        $post_code=isset($this->post['post_code'])&&$this->post['post_code']!=""?trim($this->post['post_code']):"";
+        $post_fee=isset($this->post['post_fee'])&&$this->post['post_fee']!==""?floatval($this->post['post_fee']):"";
+        if($is_th==1){
+            if($company==""){
+                return error_show(1005,"参数company不能为空");
+            }
+            if($post_code==""){
+                return error_show(1005,"参数post_code不能为空");
+            }
+            if($post_fee==""){
+                return error_show(1005,"参数post_fee不能为空");
+            }
+        }
+        try {
+            $returninfo = Db::name("order_returninfo")->where(["returnCode"=>$bkcode])->find();
+            if($returninfo==false){
+                $returninfo=[
+                    "returnCode"=>$bkcode,
+                    "return_wsm"=>"",
+                    "contactor"=>"",
+                    "mobile"=>"",
+                    "addr"=>"",
+                    "addr_code"=>"",
+                    "post_code"=>$post_code,
+                    "post_company"=>$company,
+                    "post_fee"=>$post_fee,
+                    "gys_remark"=>"",
+                    "addtime"=>date("Y-m-d H:i:s")
+                ];
+            }else{
+                $returninfo['post_fee']=$post_fee;
+                $returninfo['post_company']=$company;
+                $returninfo['post_code']=$post_code;
+            }
+            $up =Db::name("order_returninfo")->save($returninfo);
+            if($up){
+                $info['status']=5;
+                $info['updatetime']=date("y-m-d H:i:s");
+                $ro =Db::name("order_return")->save($info);
+                if($ro){
+                    $thNo =makeNo("TH");
+                    $thdata=[
+                        "thNo"=>$thNo,
+                        "orderCode"=>$out["orderCode"],
+                        "outCode"=>$out["outCode"],
+                        "order_type"=>$info["order_type"],
+                        "returnCode"=>$info["returnCode"],
+                        "good_code"=>$info["good_code"],
+                        "good_name"=>$info["good_name"],
+                        "return_wsm"=>$returninfo["return_wsm"],
+                        "defective_wsm"=>'',
+                        "return_msg"=>$out["error_msg"],
+                        "return_num"=>$info["total_num"],
+                        "normal_num"=>0,
+                        "received_num"=>0,
+                        "defective_num"=>0,
+                        "loss_num"=>0,
+                        "contactor"=>$returninfo["contactor"],
+                        "mobile"=>$returninfo["mobile"],
+                        "addr"=>$returninfo["addr"],
+                        "addr_code"=>$returninfo["addr_code"],
+                        "return_code"=>$info["error_code"],
+                        "post_fee"=>$returninfo["post_fee"],
+                        "post_code"=>$returninfo["post_code"],
+                        "post_company"=>$returninfo["post_company"],
+                        "customer_code"=>$returninfo["customer_code"],
+                        "status"=>1,
+                        "addtime"=>date("Y-m-d H:i:s"),
+                        "updatetime"=>date("Y-m-d H:i:s")
+                    ];
+                    $sav= Db::name("order_back")->insert($thdata);
+                    if($sav){
+                        Db::commit();
+                        return app_show(0,"退货单新建成功",["thNo"=>$thNo]);
+                    }
+                }
+            }
+            Db::rollback();
+            return error_show(1004,'退货失败');
+        }catch (\Exception $e){
+            Db::rollback();
+            return error_show(1004,$e->getMessage());
+        }
+    }
 }

+ 9 - 10
app/admin/controller/Consult.php

@@ -1200,14 +1200,14 @@ class Consult extends Base
             return error_show(1004,"参数bargain_price不能为空");
         }
         $bargain_reason =  isset($this->post['bargain_reason'])&& $this->post['bargain_reason']!=""?trim($this->post['bargain_reason']):"";
-        if($bargain_reason===""){
-            return error_show(1004,"参数bargain_reason不能为空");
-        }
+//        if($bargain_reason===""){
+//            return error_show(1004,"参数bargain_reason不能为空");
+//        }
         $infos =Db::name("consult_info")->where(['infoNo'=>$info['infoNo'],"is_del"=>0])->find();
         if($infos==false){
             return error_show(1004,"未找到商品数据");
         }
-        if($infos['status']!=2&&$infos['status']!=3){
+        if($infos['status']!=2&&$infos['status']!=3&&$infos['status']!=7){
             return error_show(1004,"咨询单招标未结束或已确认商品");
         }
         $token = isset($this->post['token'])&& $this->post['token']!='' ? trim($this->post['token']):"";
@@ -1280,7 +1280,7 @@ class Consult extends Base
         if($infos==false){
             return error_show(1004,"未找到商品数据");
         }
-        if($infos['status']!=2&&$infos['status']!=3){
+        if($infos['status']!=2&&$infos['status']!=3&&$infos['status']!=7){
             return error_show(1004,"咨询单招标未结束或已确认商品");
         }
         Db::startTrans();
@@ -1318,7 +1318,7 @@ class Consult extends Base
         if($bids==false){
             return error_show(1004,"未找到商品数据");
         }
-        $coninfo=Db::name("consult_info")->where(["bidNo"=>$bids["infoNo"],"is_del"=>0])->find();
+        $coninfo=Db::name("consult_info")->where(["infoNo"=>$bids["infoNo"],"is_del"=>0])->find();
         if($coninfo==false){
             return error_show(1004,"未找到咨询单数据");
         }
@@ -1327,9 +1327,9 @@ class Consult extends Base
             return error_show(1005,"参数status不能为空");
         }
         $remark = isset($this->post['remark'])&& $this->post['remark']!=""?trim($this->post['remark']):"";
-        if($remark==""){
-            return error_show(1004,"参数remark不能为空");
-        }
+//        if($remark==""){
+//            return error_show(1004,"参数remark不能为空");
+//        }
         $token = isset($this->post['token'])&& $this->post['token']!='' ? trim($this->post['token']):"";
         if($token==''){
             return error_show(1005,"参数token不能为空");
@@ -1350,7 +1350,6 @@ class Consult extends Base
             $info['updatetime'] =date("Y-m-d H:i:s");
             $up =Db::name("bargain_order")->save($info);
             if($up){
-
                 if($status==4||$status==5||$status==6||$status==7){
                     $bids['status']=5;
                        if($status==4){

+ 1 - 1
app/admin/controller/Sale.php

@@ -513,7 +513,7 @@ class Sale extends BaseController
         }
         $good_num =isset($this->post['good_num'])&&$this->post['good_num']!="" ?  intval($this->post['good_num']):"";
         if($good_num===""){
-            return error_show(1003,"参数good_num不能为空");
+            return error_show(1003,"参数 good_num 不能为空");
         }
         $sendtype = isset($this->post['sendtype'])&&$this->post['sendtype']!="" ? intval($this->post['sendtype']):"";
         if($sendtype==""){