|
@@ -42,7 +42,7 @@ class After extends Base
|
|
|
// return error_show(1004,"参数outCode 不能为空");
|
|
|
// }
|
|
|
$orderout = Db::name("order_out")
|
|
|
- ->field('id,orderCode,wsm_code,send_num,order_type,status')
|
|
|
+ ->field('id,orderCode,wsm_code,send_num,order_type')
|
|
|
->where(["outCode" => $param['outCode'], 'is_del' => 0])
|
|
|
->findOrEmpty();
|
|
|
if (empty($orderout)) return error_show(1005, "未找到发货单数据");
|
|
@@ -182,7 +182,6 @@ class After extends Base
|
|
|
"is_del" => 0,
|
|
|
"addtime" => date("Y-m-d H:i:s"),
|
|
|
"updatetime" => date("Y-m-d H:i:s"),
|
|
|
- 'order_out_status'=>$orderout['status'],
|
|
|
];
|
|
|
$create = Db::name("order_return")->insert($in, true);
|
|
|
$orde = ["order_code" => $returnCode, "status" => $in['status'], "action_remark" => '', "action_type" => "create"];
|
|
@@ -1265,7 +1264,7 @@ class After extends Base
|
|
|
->findOrEmpty();
|
|
|
if (empty($info)) return error_show(1005, "未找到售后数据");
|
|
|
|
|
|
- if (($info['is_receive'] != 0 || $info['status'] != 4)) return error_show(1005, "售后单流程状态有误");
|
|
|
+ if (($info['is_receive'] != 1 || $info['status'] != 4)) return error_show(1005, "售后单流程状态有误");
|
|
|
|
|
|
$out = Db::name("order_out")
|
|
|
->where(["outCode" => $info["outCode"], "is_del" => 0])
|
|
@@ -1297,30 +1296,32 @@ class After extends Base
|
|
|
|
|
|
Db::startTrans();
|
|
|
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")
|
|
|
- ->where(["returnCode" => $bkcode])
|
|
|
- //->save($returninfo)
|
|
|
- ->update($returninfo);
|
|
|
+ $returninfo = Db::name("order_returninfo")->where(["returnCode" => $bkcode])->findOrEmpty();
|
|
|
+ if (empty($returninfo)) {
|
|
|
+ $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")
|
|
|
+ ];
|
|
|
+ $up = Db::name("order_returninfo")->insert($returninfo);
|
|
|
+ } else {
|
|
|
+ $up = Db::name("order_returninfo")
|
|
|
+ ->where(["returnCode" => $bkcode])
|
|
|
+ ->update([
|
|
|
+ 'post_fee' => $post_fee,
|
|
|
+ 'post_company' => $company,
|
|
|
+ 'post_code' => $post_code,
|
|
|
+ 'updatetime' => date("Y-m-d H:i:s"),
|
|
|
+ ]);
|
|
|
+ }
|
|
|
|
|
|
if ($up) {
|
|
|
|
|
@@ -1354,6 +1355,11 @@ class After extends Base
|
|
|
"before_status" => $old_info_status,
|
|
|
'holder_id' => $info['apply_id']
|
|
|
]);
|
|
|
+ Db::commit();
|
|
|
+ return json_show(0, '退货成功');
|
|
|
+ } else throw new Exception('修改售后申请单状态失败');
|
|
|
+
|
|
|
+ } else throw new Exception('退货失败');
|
|
|
|
|
|
//售后退货单数据
|
|
|
// $thNo = makeNo("ST");
|
|
@@ -1624,10 +1630,10 @@ class After extends Base
|
|
|
// Db::commit();
|
|
|
// return app_show(0, "退货单新建成功", ["thNo" => $thNo]);
|
|
|
// }
|
|
|
- }
|
|
|
- }
|
|
|
- Db::commit();
|
|
|
- return json_show(0, '退货成功');
|
|
|
+// }
|
|
|
+// }
|
|
|
+// Db::commit();
|
|
|
+// return json_show(0, '退货成功');
|
|
|
} catch (Exception $e) {
|
|
|
Db::rollback();
|
|
|
return json_show(1004, $e->getMessage());
|