|
@@ -42,6 +42,10 @@ class After extends \app\BaseController
|
|
|
if($num==""){
|
|
|
return error_show(1004,"参数 num 不能为空或零");
|
|
|
}
|
|
|
+ $order_type =isset($this->post['order_type']) &&$this->post['order_type']!=''?intval($this->post['order_type']) :"";
|
|
|
+ if($order_type==""){
|
|
|
+ return error_show(1004,"参数 order_type 不能为空或零");
|
|
|
+ }
|
|
|
$remark =isset($this->post['remark']) &&$this->post['remark']!=''?trim($this->post['remark']) :"";
|
|
|
$except_code =isset($this->post['except_code']) &&$this->post['except_code']!=''?trim($this->post['except_code']) :"";
|
|
|
$img = isset($this->post['img']) &&$this->post['img']!=''?trim($this->post['img']) :"";
|
|
@@ -150,7 +154,8 @@ class After extends \app\BaseController
|
|
|
$total = ceil($count/$size);
|
|
|
$page = $total>=$page ? $page :$total;
|
|
|
$list =Db::name("order_return")->alias("a")->leftJoin("order_returninfo b","a.orderCode=b.orderCode")->where($where)
|
|
|
- ->field("a.*,b.return_wsm,b.contactor,b.mobile,b.addr,b.addr_code,b.post_code,b.post_company,b.post_fee,b.gys_remark")->page($page,$size)->select();
|
|
|
+ ->field("a.*,b.return_wsm,b.contactor,b.mobile,b.addr,b.addr_code,b.post_code,b.post_company,b.post_fee,b.gys_remark")->page($page,$size)
|
|
|
+ ->order("addtime desc")->select();
|
|
|
$data=[];
|
|
|
foreach ($list as $value){
|
|
|
$customer = Db::name("customer_info")->where(["companyNo"=>$value['customer_code']])->find();
|
|
@@ -171,7 +176,7 @@ class After extends \app\BaseController
|
|
|
if($bkcode==""){
|
|
|
return error_show(1005,"参数returnCode 不能为空");
|
|
|
}
|
|
|
- $info = Db::name("order_return")->alias("a")->leftJoin("order_returninfo b","a.orderCode=b.orderCode")
|
|
|
+ $info = Db::name("order_return")->alias("a")->leftJoin("order_returninfo b","a.returnCode=b.returnCode")
|
|
|
->field("a.*,b.return_wsm,b.contactor,b.mobile,b.addr,b.addr_code,b.post_code,b.post_company,b.post_fee,b.gys_remark")
|
|
|
->where(['a.returnCode'=>$bkcode])->find();
|
|
|
if(empty($info)){
|
|
@@ -235,25 +240,48 @@ class After extends \app\BaseController
|
|
|
if(empty($wsm)){
|
|
|
return error_show(1005,"未找到仓库数据");
|
|
|
}
|
|
|
+ $contactor = isset($this->post['contactor']) && $this->post['contactor']!="" ? trim($this->post['contactor'])
|
|
|
+ :"";
|
|
|
+ $mobile = isset($this->post['mobile']) && $this->post['mobile']!="" ? trim($this->post['mobile']):"";
|
|
|
+ $addr = isset($this->post['addr']) && $this->post['addr']!="" ? trim($this->post['addr']):"";
|
|
|
+ $addr_code = isset($this->post['addr_code']) && $this->post['addr_code']!="" ? trim($this->post['addr_code']):"";
|
|
|
+ if($info['is_th']==0){
|
|
|
+ if($contactor==''){
|
|
|
+ return error_show(1005,"参数 contactor 不能为空");
|
|
|
+ }
|
|
|
+ if($mobile==''){
|
|
|
+ return error_show(1005,"参数 mobile 不能为空");
|
|
|
+ }
|
|
|
+ if($addr==''){
|
|
|
+ return error_show(1005,"参数 addr 不能为空");
|
|
|
+ }
|
|
|
+ if($addr_code==''){
|
|
|
+ return error_show(1005,"参数 addr_code 不能为空");
|
|
|
+ }
|
|
|
+ }
|
|
|
Db::startTrans();
|
|
|
try{
|
|
|
- $info['status']=3;
|
|
|
+ $info['status']=$info['order_type']==1?3:4;
|
|
|
$info['updatetime']=date("Y-m-d H:i:s");
|
|
|
$up =Db::name("order_return")->save($info);
|
|
|
if($up){
|
|
|
- $returninfo = Db::name("order_returninfo")->where(["orderCode"=>$bkcode])->find();
|
|
|
+ $returninfo = Db::name("order_returninfo")->where(["returnCode"=>$bkcode])->find();
|
|
|
if(empty($returninfo)){
|
|
|
$returninfo=[
|
|
|
"returnCode"=>$bkcode,
|
|
|
"return_wsm"=>$wsm_code,
|
|
|
- "contactor"=>'',
|
|
|
- "mobile"=>'',
|
|
|
- "addr"=>'',
|
|
|
- "addr_code"=>'',
|
|
|
+ "contactor"=>$contactor,
|
|
|
+ "mobile"=>$mobile ,
|
|
|
+ "addr"=>$addr,
|
|
|
+ "addr_code"=>$addr_code,
|
|
|
"addtime"=>date("Y-m-d H:i:s")
|
|
|
];
|
|
|
}else{
|
|
|
$returninfo['return_wsm'] = $wsm_code;
|
|
|
+ $returninfo['contactor'] = $contactor;
|
|
|
+ $returninfo['mobile'] = $mobile;
|
|
|
+ $returninfo['addr'] = $addr;
|
|
|
+ $returninfo['addr_code'] = $addr_code;
|
|
|
}
|
|
|
$in=Db::name("order_returninfo")->save($returninfo);
|
|
|
if($in){
|
|
@@ -322,7 +350,7 @@ class After extends \app\BaseController
|
|
|
$return_info['post_fee'] = $fee;
|
|
|
Db::startTrans();
|
|
|
try{
|
|
|
- $info['status']=4;
|
|
|
+ $info['status']=$info['order_type']==1?4:5;
|
|
|
$info['updatetime']=date("Y-m-d H:i:s");
|
|
|
$up =Db::name("order_return")->save($info);
|
|
|
if($up){
|
|
@@ -338,6 +366,76 @@ class After extends \app\BaseController
|
|
|
Db::rollback();
|
|
|
return error_show(1004,$e->getMessage());
|
|
|
}
|
|
|
+ }
|
|
|
|
|
|
+ public function GysFeed(){
|
|
|
+ $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,"未找到售后数据");
|
|
|
+ }
|
|
|
+ $isth = isset($this->post['is_th']) && $this->post['is_th']!="" ? intval($this->post['is_th']):"0";
|
|
|
+ $contactor = isset($this->post['contactor']) && $this->post['contactor']!="" ? trim($this->post['contactor'])
|
|
|
+ :"";
|
|
|
+ $mobile = isset($this->post['mobile']) && $this->post['mobile']!="" ? trim($this->post['mobile']):"";
|
|
|
+ $addr = isset($this->post['addr']) && $this->post['addr']!="" ? trim($this->post['addr']):"";
|
|
|
+ $addr_code = isset($this->post['addr_code']) && $this->post['addr_code']!="" ? trim($this->post['addr_code']):"";
|
|
|
+ $remark = isset($this->post['remark']) && $this->post['remark']!="" ? trim($this->post['remark']):"";
|
|
|
+ if($isth==1){
|
|
|
+ if($contactor==''){
|
|
|
+ return error_show(1005,"参数 contactor 不能为空");
|
|
|
+ }
|
|
|
+ if($mobile==''){
|
|
|
+ return error_show(1005,"参数 mobile 不能为空");
|
|
|
+ }
|
|
|
+ if($addr==''){
|
|
|
+ return error_show(1005,"参数 addr 不能为空");
|
|
|
+ }
|
|
|
+ if($addr_code==''){
|
|
|
+ return error_show(1005,"参数 addr_code 不能为空");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ Db::startTrans();
|
|
|
+ try{
|
|
|
+ $info['status']=3;
|
|
|
+ $info['is_th']=$isth;
|
|
|
+ $info['updatetime']=date("Y-m-d H:i:s");
|
|
|
+ $up =Db::name("order_return")->save($info);
|
|
|
+ if($up){
|
|
|
+ $returninfo = Db::name("order_returninfo")->where(["returnCode"=>$bkcode])->find();
|
|
|
+ if(empty($returninfo)){
|
|
|
+ $returninfo=[
|
|
|
+ "returnCode"=>$bkcode,
|
|
|
+ "return_wsm"=>'',
|
|
|
+ "contactor"=>$contactor,
|
|
|
+ "mobile"=>$mobile ,
|
|
|
+ "addr"=>$addr,
|
|
|
+ "addr_code"=>$addr_code,
|
|
|
+ "gys_remark"=>$remark,
|
|
|
+ "addtime"=>date("Y-m-d H:i:s")
|
|
|
+ ];
|
|
|
+ }else{
|
|
|
+ $returninfo['return_wsm'] = '';
|
|
|
+ $returninfo['contactor'] = $contactor;
|
|
|
+ $returninfo['mobile'] = $mobile;
|
|
|
+ $returninfo['addr'] = $addr;
|
|
|
+ $returninfo['gys_remark'] = $remark;
|
|
|
+ $returninfo['addr_code'] = $addr_code;
|
|
|
+ }
|
|
|
+ $in=Db::name("order_returninfo")->save($returninfo);
|
|
|
+ if($in){
|
|
|
+ Db::commit();
|
|
|
+ return app_show(0,"更新成功");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ Db::rollback();
|
|
|
+ return error_show(1004,"更新失败");
|
|
|
+ }catch (\Exception $e){
|
|
|
+ Db::rollback();
|
|
|
+ return error_show(1004,$e->getMessage());
|
|
|
+ }
|
|
|
}
|
|
|
}
|