|
@@ -424,10 +424,10 @@ class After extends Base
|
|
|
'returnCode' => 'require',
|
|
|
'status' => 'require|number|in:1,2,4,5,6,9,10',
|
|
|
'remark' => 'requireIf:status,6|requireIf:status,2|requireIf:status,10',
|
|
|
- 'contactor|收货人' => 'requireIf:status,4',
|
|
|
- 'mobile|联系电话' => 'requireIf:status,4',
|
|
|
- 'addr_code|省市区编码' => 'requireIf:status,4',
|
|
|
- 'addr|退货地址' => 'requireIf:status,4',
|
|
|
+// 'contactor|收货人' => 'requireIf:status,4',
|
|
|
+// 'mobile|联系电话' => 'requireIf:status,4',
|
|
|
+// 'addr_code|省市区编码' => 'requireIf:status,4',
|
|
|
+// 'addr|退货地址' => 'requireIf:status,4',
|
|
|
]);
|
|
|
|
|
|
if ($val->check($param) == false) throw new Exception($val->getError());
|
|
@@ -452,12 +452,33 @@ class After extends Base
|
|
|
case 9:
|
|
|
if (in_array($param['status'], [2, 4]) == false) throw new Exception('选项错误');
|
|
|
if ($this->level !== 3) throw new Exception('当前状态下只能由供应商账号操作');
|
|
|
+ if ($param['status'] == 4) {
|
|
|
+ if ($param['contactor'] == '') throw new Exception('收货人不能为空');
|
|
|
+ if ($param['mobile'] == '') throw new Exception('联系电话不能为空');
|
|
|
+ if ($param['addr_code'] == '') throw new Exception('省市区编码不能为空');
|
|
|
+ if ($param['addr'] == '') throw new Exception('退货地址不能为空');
|
|
|
+ }
|
|
|
break;
|
|
|
case 2:
|
|
|
if (in_array($param['status'], [10, 4]) == false) throw new Exception('选项错误');
|
|
|
+ if($param['wsm_code']=='') throw new Exception('请填写退回仓库');
|
|
|
+ else{
|
|
|
+ $ware = Db::name('warehouse_info')
|
|
|
+ ->field('contactor_name contactor,mobile,addr,addr_code')
|
|
|
+ ->where(['wsm_code'=>$param['wsm_code'],'is_del'=>0])
|
|
|
+ ->findOrEmpty();
|
|
|
+ if(empty($ware)) throw new Exception('该仓库不存在');
|
|
|
+ else $param = array_merge($param,$ware);
|
|
|
+ }
|
|
|
break;
|
|
|
case 10:
|
|
|
if (in_array($param['status'], [2, 4]) == false) throw new Exception('选项错误');
|
|
|
+ if ($param['status'] == 4) {
|
|
|
+ if ($param['contactor'] == '') throw new Exception('收货人不能为空');
|
|
|
+ if ($param['mobile'] == '') throw new Exception('联系电话不能为空');
|
|
|
+ if ($param['addr_code'] == '') throw new Exception('省市区编码不能为空');
|
|
|
+ if ($param['addr'] == '') throw new Exception('退货地址不能为空');
|
|
|
+ }
|
|
|
break;
|
|
|
}
|
|
|
|
|
@@ -1150,21 +1171,19 @@ class After extends Base
|
|
|
//客户发货
|
|
|
public function setdelivery()
|
|
|
{
|
|
|
- $param = $this->request->only(['returnCode', 'is_th', 'company', 'post_code', 'post_fee'], 'post', 'trim');
|
|
|
+ $param = $this->request->only(['returnCode', 'company', 'post_code', 'post_fee'], 'post', 'trim');
|
|
|
|
|
|
$val = Validate::rule([
|
|
|
'returnCode|售后申请单编号' => 'require',
|
|
|
- 'is_th|供应商是否退货' => 'require|in:0,1',
|
|
|
- 'company|快递公司名' => 'requireIf:is_th,1|max:255',
|
|
|
- 'post_code|快递单号' => 'requireIf:is_th,1|max:255',
|
|
|
- 'post_fee|快递费用' => 'requireIf:is_th,1|float',
|
|
|
+ 'company|快递公司名' => 'require|max:255',
|
|
|
+ 'post_code|快递单号' => 'require|max:255',
|
|
|
+ 'post_fee|快递费用' => 'require|float',
|
|
|
]);
|
|
|
|
|
|
if ($val->check($param) == false) return json_show(1004, $val->getError());
|
|
|
|
|
|
|
|
|
$bkcode = $param['returnCode'];
|
|
|
-// $is_th = $param['is_th'];
|
|
|
$company = $param['company'];
|
|
|
$post_code = $param['post_code'];
|
|
|
$post_fee = $param['post_fee'];
|
|
@@ -1174,7 +1193,7 @@ class After extends Base
|
|
|
// return error_show(1005,"参数returnCode 不能为空");
|
|
|
// }
|
|
|
$info = Db::name("order_return")
|
|
|
- ->where(['returnCode' => $bkcode])
|
|
|
+ ->where(['is_del' => 0, 'returnCode' => $bkcode])
|
|
|
->findOrEmpty();
|
|
|
if (empty($info)) return error_show(1005, "未找到售后数据");
|
|
|
|
|
@@ -1211,7 +1230,7 @@ class After extends Base
|
|
|
|
|
|
Db::startTrans();
|
|
|
try {
|
|
|
- $returninfo = Db::name("order_returninfo")->where(["returnCode"=>$bkcode])->find();
|
|
|
+ $returninfo = Db::name("order_returninfo")->where(["returnCode" => $bkcode])->find();
|
|
|
// if($returninfo==false){
|
|
|
// $returninfo=[
|
|
|
// "returnCode"=>$bkcode,
|
|
@@ -1293,7 +1312,7 @@ class After extends Base
|
|
|
"post_code" => $returninfo["post_code"],
|
|
|
"post_company" => $returninfo["post_company"],
|
|
|
"customer_code" => $info["customer_code"],
|
|
|
- "status" => $info['return_tag'] == 1 ? 4 : 1,
|
|
|
+ "status" => $info['return_tag'] == 1 ? 4 : 1, //return_tag==1退回供应商,status:4完成退货,1待验收
|
|
|
"addtime" => date("Y-m-d H:i:s"),
|
|
|
"updatetime" => date("Y-m-d H:i:s")
|
|
|
];
|
|
@@ -1382,6 +1401,8 @@ class After extends Base
|
|
|
// }else{
|
|
|
//
|
|
|
// }
|
|
|
+
|
|
|
+ //退回供应商的时候,处理库存
|
|
|
if ($info['return_tag'] == 1) {
|
|
|
$sale['th_num'] += $info['error_num'];
|
|
|
if ($sale['th_num'] == $sale['send_num'] && $sale['wsend_num'] == 0) {
|