|
@@ -90,7 +90,7 @@ class After extends Base
|
|
|
} else {
|
|
|
$goon = Db::name('good_platform')
|
|
|
->alias('a')
|
|
|
- ->field("b.creater,b.createrid,b.supplierNo")
|
|
|
+ ->field("b.creater,b.createrid,b.supplierNo,b.supplierName")
|
|
|
->join('good b', 'b.spuCode=a.spuCode', 'left')
|
|
|
->where(['a.skuCode' => $oder['skuCode']])
|
|
|
->findOrEmpty();
|
|
@@ -109,7 +109,7 @@ class After extends Base
|
|
|
|
|
|
$supplier = $supplier['data'];
|
|
|
|
|
|
- $names = $userCommon->handle('getCodeAndName', ['code' => [$oder['customer_code'], $oder['supplierNo']]]);
|
|
|
+
|
|
|
|
|
|
|
|
|
|
|
@@ -157,11 +157,11 @@ class After extends Base
|
|
|
"good_code" => $oder['good_code'],
|
|
|
"good_name" => $oder['good_name'],
|
|
|
"customer_code" => $oder['customer_code'],
|
|
|
- "customer_name" => $names['data'][$oder['customer_code']] ?? '',
|
|
|
+ "customer_name" =>$oder['customerName'],
|
|
|
"apply_id" => $rm,
|
|
|
"apply_name" => $ri,
|
|
|
'supplierNo' => $goon['supplierNo'],
|
|
|
- 'supplierName' => $supplier['name'],
|
|
|
+ 'supplierName' => $goon['supplierName'],
|
|
|
"cgder" => $wsm['contactor_name'] ?? '',
|
|
|
"cgderid" => $wsm['contactor'] ?? 0,
|
|
|
"person" => $supplier['person'] ?? '',
|
|
@@ -177,7 +177,7 @@ class After extends Base
|
|
|
"except_code" => $param['except_code'],
|
|
|
"order_type" => $orderout['order_type'],
|
|
|
'companyNo' => $oder['supplierNo'],
|
|
|
- 'companyName' => $names['data'][$oder['supplierNo']] ?? '',
|
|
|
+ 'companyName' => $oder['supplierName'],
|
|
|
"status" => 1,
|
|
|
"is_del" => 0,
|
|
|
"addtime" => date("Y-m-d H:i:s"),
|
|
@@ -213,13 +213,13 @@ class After extends Base
|
|
|
$process = ["order_code" => $returnCode, "order_id" => $create, "order_status" => $in['status'], "order_type" => 'SHD', "before_status" => 0, 'holder_id' => $in['apply_id']];
|
|
|
ProcessOrder::AddProcess(['id' => $this->uid, 'nickname' => $this->uname], $process);
|
|
|
Db::commit();
|
|
|
- return app_show(0, "售后申请单新建成功", ["returnCode" => $returnCode]);
|
|
|
+ return json_show(0, "售后申请单新建成功", ["returnCode" => $returnCode]);
|
|
|
}
|
|
|
Db::rollback();
|
|
|
return error_show(1005, "售后申请单新建失败");
|
|
|
- } catch (Exception $e) {
|
|
|
+ } catch (Exception $exception) {
|
|
|
Db::rollback();
|
|
|
- return error_show(1005, $e->getMessage());
|
|
|
+ return json_show(1005, $exception->getMessage());
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -384,6 +384,8 @@ class After extends Base
|
|
|
|
|
|
|
|
|
$int = isset($goon['cat_id']) && $goon['cat_id'] != 0 ? made($goon['cat_id']) : [];
|
|
|
+ $info['can'] = $int;
|
|
|
+
|
|
|
$addcode = '';
|
|
|
if ($info['addr_code'] != "") {
|
|
|
list($a, $b, $c) = explode(",", $info['addr_code']);
|
|
@@ -401,27 +403,27 @@ class After extends Base
|
|
|
->alias("a")
|
|
|
|
|
|
->where(["a.wsm_code" => $info['return_wsm']])
|
|
|
- ->field("a.name as wsm_name,a.wsm_code,a.contactor_name,a.position,a.mobile,a.addrs_code,a.addr,a.companyNo,a.supplierNo")
|
|
|
+
|
|
|
->find();
|
|
|
|
|
|
}
|
|
|
|
|
|
- $userCommon = \app\admin\common\User::getIns();
|
|
|
- $names = $userCommon->handle('getCodeAndName', ['code' => [
|
|
|
- $wsmcode['supplierNo'] ?? '',
|
|
|
- $wsmcode['companyNo'] ?? '',
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- ]]);
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
|
|
|
if ($info['return_wsm'] != '') {
|
|
|
$info['wsm_supplierNo'] = $wsmcode['supplierNo'] ?? "";
|
|
|
- $info['wsm_supplier'] = $names['data'][$wsmcode['supplierNo']] ?? '';
|
|
|
- $info['wsm_customer_name'] = $names['data'][$wsmcode['companyNo']] ?? '';
|
|
|
+ $info['wsm_supplier'] = $wsmcode['supplierName'];
|
|
|
+ $info['wsm_customer_name'] = $wsmcode['companyName'];
|
|
|
$info['wsm_customer_code'] = $wsmcode['companyNo'] ?? "";
|
|
|
$info['wsm_code'] = isset($wsmcode['wsm_code']) ? $wsmcode['wsm_code'] : "";
|
|
|
- $info['wsm_name'] = isset($wsmcode['wsm_name']) ? $wsmcode['wsm_name'] : "";
|
|
|
+ $info['wsm_name'] = isset($wsmcode['name']) ? $wsmcode['name'] : "";
|
|
|
}
|
|
|
|
|
|
|
|
@@ -433,8 +435,6 @@ class After extends Base
|
|
|
|
|
|
|
|
|
|
|
|
- $info['can'] = $int;
|
|
|
-
|
|
|
|
|
|
isset($wsmcode['contactor_name']) ? $info['contactor'] = $wsmcode['contactor_name'] : '';
|
|
|
isset($wsmcode['mobile']) ? $info['mobile'] = $wsmcode['mobile'] : '';
|
|
@@ -446,14 +446,15 @@ class After extends Base
|
|
|
|
|
|
$info['spuCode'] = $orderinfo['good_code'];
|
|
|
$info['skuCode'] = $orderinfo['skuCode'];
|
|
|
- $info['return_tag'] = $info['return_tag'] == 0 ? "" : $info['return_tag'];
|
|
|
- $info['is_th'] = $info['is_th'] == 0 ? "" : $info['is_th'];
|
|
|
+ $info['return_tag'] = $info['return_tag'] == 0 ? "" : $info['return_tag'];
|
|
|
+ $info['is_th'] = $info['is_th'] == 0 ? "" : $info['is_th'];
|
|
|
|
|
|
return app_show(0, "获取成功", $info);
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
public function status()
|
|
|
{
|
|
|
try {
|
|
@@ -500,7 +501,9 @@ class After extends Base
|
|
|
if (in_array($param['status'], [6, 9]) == false) throw new Exception('选项错误');
|
|
|
break;
|
|
|
case 9:
|
|
|
- if (in_array($param['status'], [2, 4, 5]) == false) throw new Exception('选项错误');
|
|
|
+ if ((($info['is_receive'] == 1) && (in_array($param['status'], [2, 4]) == false) || (($info['is_receive'] == 0) && (in_array($param['status'], [2, 5]) == false)))) throw new Exception('选项错误');
|
|
|
+
|
|
|
+
|
|
|
|
|
|
if ($param['status'] == 4) {
|
|
|
if ($param['contactor'] == '') throw new Exception('收货人不能为空');
|
|
@@ -510,22 +513,13 @@ class After extends Base
|
|
|
}
|
|
|
break;
|
|
|
case 2:
|
|
|
- if (in_array($param['status'], [10, 4, 5]) == false) throw new Exception('选项错误');
|
|
|
- if ($param['status'] == 4) {
|
|
|
- if ($param['wsm_code'] == '') throw new Exception('请填写退回仓库');
|
|
|
- else {
|
|
|
- $ware = Db::name('warehouse_info')
|
|
|
- ->field('contactor_name contactor,mobile,addr,addrs_code addr_code')
|
|
|
- ->where(['wsm_code' => $param['wsm_code'], 'is_del' => 0])
|
|
|
- ->findOrEmpty();
|
|
|
- if (empty($ware)) throw new Exception('该仓库不存在');
|
|
|
- else $param = array_merge($param, $ware);
|
|
|
- }
|
|
|
- }
|
|
|
+
|
|
|
+ if ((($info['is_receive'] == 1) && (in_array($param['status'], [10, 11]) == false) || (($info['is_receive'] == 0) && (in_array($param['status'], [10, 5]) == false)))) throw new Exception('选项错误');
|
|
|
|
|
|
break;
|
|
|
case 10:
|
|
|
- if (in_array($param['status'], [2, 4, 5]) == false) throw new Exception('选项错误');
|
|
|
+ if ((($info['is_receive'] == 1) && (in_array($param['status'], [2, 4]) == false) || (($info['is_receive'] == 0) && (in_array($param['status'], [2, 5]) == false)))) throw new Exception('选项错误');
|
|
|
+
|
|
|
if ($param['status'] == 4) {
|
|
|
if ($param['contactor'] == '') throw new Exception('收货人不能为空');
|
|
|
if ($param['mobile'] == '') throw new Exception('联系电话不能为空');
|
|
@@ -573,7 +567,7 @@ class After extends Base
|
|
|
|
|
|
|
|
|
if ($info['status'] == 9) {
|
|
|
- if ($param['status'] == 4) $info['return_tag'] = 1;
|
|
|
+ if (in_array($param['status'],[4,5])) $info['return_tag'] = 1;
|
|
|
else $info['return_tag'] = 2;
|
|
|
}
|
|
|
|
|
@@ -1317,8 +1311,17 @@ class After extends Base
|
|
|
->update($returninfo);
|
|
|
|
|
|
if ($up) {
|
|
|
+
|
|
|
+
|
|
|
+ $temp = Db::name('order_return_child')
|
|
|
+ ->field('id')
|
|
|
+ ->where(['is_del' => 0, 'returnCode' => $bkcode])
|
|
|
+ ->findOrEmpty();
|
|
|
+ if (empty($temp)) $info['status'] = 5;
|
|
|
+ else $info['status'] = 12;
|
|
|
+
|
|
|
$old_info_status = $info['status'];
|
|
|
- $info['status'] = 5;
|
|
|
+
|
|
|
$info['updatetime'] = date("y-m-d H:i:s");
|
|
|
$ro = Db::name("order_return")->save($info);
|
|
|
if ($ro) {
|
|
@@ -1341,281 +1344,281 @@ class After extends Base
|
|
|
]);
|
|
|
|
|
|
|
|
|
- $thNo = makeNo("ST");
|
|
|
- $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"],
|
|
|
- "total_fee" => round($sale['sale_price'] * $info["error_num"], 2),
|
|
|
- "good_price" => $sale['sale_price'],
|
|
|
- "platform_id" => $sale['platform_id'],
|
|
|
- "return_msg" => $info["error_msg"],
|
|
|
- "return_num" => $info["error_num"],
|
|
|
- "normal_num" => 0,
|
|
|
- "received_num" => 0,
|
|
|
- "apply_id" => $info['apply_id'],
|
|
|
- "apply_name" => $info['apply_name'],
|
|
|
- "cgder" => $info['cgder'],
|
|
|
- "cgderid" => $info['cgderid'],
|
|
|
- "person" => $info['person'],
|
|
|
- "person_id" => $info['person_id'],
|
|
|
- "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" => $info["customer_code"],
|
|
|
- "customer_name" => $info["customer_name"],
|
|
|
- "status" => $info['return_tag'] == 1 ? 4 : 1,
|
|
|
- "addtime" => date("Y-m-d H:i:s"),
|
|
|
- "updatetime" => date("Y-m-d H:i:s"),
|
|
|
- 'supplierNo' => $info['supplierNo'],
|
|
|
- 'supplierName' => $info['supplierName'],
|
|
|
- 'companyNo' => $info['companyNo'],
|
|
|
- 'companyName' => $info['companyName'],
|
|
|
- ];
|
|
|
- $sav = Db::name("order_back")->insert($thdata, true);
|
|
|
- if ($sav) {
|
|
|
-
|
|
|
-
|
|
|
- ActionLog::logAdd(['id' => $this->uid, 'nickname' => $this->uname], [
|
|
|
- "order_code" => $thdata['thNo'],
|
|
|
- "status" => $thdata['status'],
|
|
|
- "action_remark" => '',
|
|
|
- "action_type" => "create"
|
|
|
- ], "CKTHD", $thdata['status'], $thdata);
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- if ($thdata['status'] == 1) {
|
|
|
-
|
|
|
-
|
|
|
- $uids = Db::name('user_role')
|
|
|
- ->where(['is_del' => 0, 'roleid' => [31, 41], 'status' => 1])
|
|
|
- ->column('uid');
|
|
|
-
|
|
|
- ProcessOrder::AddProcess(['id' => $this->uid, 'nickname' => $this->uname], [
|
|
|
- "order_type" => 'CKTHD',
|
|
|
- "order_code" => $thdata['thNo'],
|
|
|
- "order_id" => $sav,
|
|
|
- "order_status" => $thdata['status'],
|
|
|
- "before_status" => 0,
|
|
|
- 'handle_user_list' => implode(',', array_merge($uids, [$sale['cgderid']])),
|
|
|
- ]);
|
|
|
- } else {
|
|
|
- ProcessOrder::AddProcess(['id' => $this->uid, 'nickname' => $this->uname], [
|
|
|
- "order_type" => 'CKTHD',
|
|
|
- "order_code" => $thdata['thNo'],
|
|
|
- "order_id" => $sav,
|
|
|
- "order_status" => $thdata['status'],
|
|
|
- "before_status" => 0
|
|
|
- ]);
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- Db::execute("UPDATE `wsm_standing_book` SET `thNo`=CONCAT(IFNULL(`thNo`,''),',{$thNo}'),`updatetime`='" . date('Y-m-d H:i:s') . "' WHERE FIND_IN_SET('{$bkcode}',`returnCode`)");
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
|
|
|
-
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- if ($info['return_tag'] == 1) {
|
|
|
- $sale['th_num'] += $info['error_num'];
|
|
|
- if ($sale['th_num'] == $sale['send_num'] && $sale['wsend_num'] == 0) {
|
|
|
- $sale['status'] = 3;
|
|
|
- }
|
|
|
- $sale['th_fee'] += round($info['error_num'] * $sale['sale_price'], 2);
|
|
|
- $sale['updatetime'] = date("Y-m-d H:i:s");
|
|
|
- $uap = Db::name("sale")->save($sale);
|
|
|
-
|
|
|
- if ($uap == false) throw new Exception('销售单订单更新失败');
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
|
|
|
- if ($sale['is_stock'] == 0) {
|
|
|
- $ordernum = Db::name("order_num")
|
|
|
- ->where(['orderCode' => $info['orderCode']])
|
|
|
- ->find();
|
|
|
- if ($ordernum == false) throw new Exception('未找到关联采购单1');
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- $ordernum['send_num'] -= $info['error_num'];
|
|
|
- $orderup = Db::name("order_num")->save($ordernum);
|
|
|
-
|
|
|
- if ($orderup == false) throw new Exception('关联数据更新失败');
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- $cgd = Db::name("purchease_order")
|
|
|
- ->where(["cgdNo" => $ordernum['cgdNo'], "is_del" => 0])
|
|
|
- ->findOrEmpty();
|
|
|
- if (empty($cgd)) throw new Exception('未找到采购单数据');
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- $cgd['th_num'] += $info['error_num'];
|
|
|
- if ($cgd['th_num'] == $cgd['send_num'] && $cgd['wsend_num'] == 0) {
|
|
|
- $cgd['status'] = 4;
|
|
|
- }
|
|
|
- $cgd['th_fee'] += round($info['error_num'] * $cgd['good_price'], 2);
|
|
|
- $cgd['updatetime'] = date("Y-m-d H:i:s");
|
|
|
- $cgdup = Db::name("purchease_order")->save($cgd);
|
|
|
-
|
|
|
- if ($cgdup == false) throw new Exception('采购单数据更新失败');
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- $sabebn = Db::name("sale_info")
|
|
|
- ->where([["orderCode", "=", $info['orderCode']], ["num", ">", 0]])
|
|
|
- ->select()
|
|
|
- ->toArray();
|
|
|
- if (!empty($sabebn)) {
|
|
|
- $total_num = $info["error_num"];
|
|
|
- foreach ($sabebn as $ve) {
|
|
|
- $tempnum = 0;
|
|
|
- if ($total_num == 0) break;
|
|
|
- if ($total_num >= $ve['num']) {
|
|
|
- $tempnum = $ve['num'];
|
|
|
- $total_num -= $ve['num'];
|
|
|
- $ve['th_num'] += $ve['num'];
|
|
|
- $ve['num'] = 0;
|
|
|
- } else {
|
|
|
- $tempnum = $total_num;
|
|
|
- $ve['num'] -= $total_num;
|
|
|
- $ve['th_num'] += $total_num;
|
|
|
- $total_num = 0;
|
|
|
- }
|
|
|
-
|
|
|
- if ($info['except_code'] == 1) {
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- $up = Db::name("sale_info")->save($ve);
|
|
|
-
|
|
|
- if ($up == false) throw new Exception('可售商品Bn库存数入库失败');
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- $bnin = GoodStockInfo::ReturnBn($info['returnCode'], $ve['id'], $tempnum);
|
|
|
- if ($bnin == false) throw new Exception('可售商品Bn库存数入库失败');
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- }
|
|
|
- }
|
|
|
- if ($info['error_num'] >= $out['send_num']) {
|
|
|
- $out['status'] = 4;
|
|
|
- $out['updatetime'] = date("Y-m-d H:i:s");
|
|
|
- $upout = Db::name("order_out")->save($out);
|
|
|
- if ($upout == false) throw new Exception('出库单数据更新失败');
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
|
|
|
- }
|
|
|
- $data = [
|
|
|
- "orderCode" => $info['orderCode'],
|
|
|
- "th_type" => 3,
|
|
|
- "th_num" => $info['error_num'],
|
|
|
- "th_fee" => round($sale['sale_price'] * $info["error_num"], 2),
|
|
|
- "thCode" => $thNo,
|
|
|
- "spuCode" => $sale['good_code'],
|
|
|
- "good_name" => $sale['good_name'],
|
|
|
- "cat_id" => $sale['cat_id'],
|
|
|
- "apply_id" => $info['apply_id'],
|
|
|
- "apply_name" => $info['apply_name'],
|
|
|
- "addtime" => date("Y-m-d H:i:s"),
|
|
|
- "status" => 1,
|
|
|
- "is_del" => 0
|
|
|
- ];
|
|
|
- $inse = Db::name("th_data")->insert($data);
|
|
|
- if ($inse == false) throw new Exception('退货单更新失败');
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- Db::commit();
|
|
|
- return app_show(0, "退货单新建成功", ["thNo" => $thNo]);
|
|
|
- }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
- Db::rollback();
|
|
|
- return error_show(1004, '退货失败');
|
|
|
+ Db::commit();
|
|
|
+ return json_show(0, '退货成功');
|
|
|
} catch (Exception $e) {
|
|
|
Db::rollback();
|
|
|
- return error_show(1004, $e->getMessage());
|
|
|
+ return json_show(1004, $e->getMessage());
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -1636,11 +1639,11 @@ class After extends Base
|
|
|
->field('id,status,apply_id')
|
|
|
->where([
|
|
|
['returnCode', '=', $data['returnCode']],
|
|
|
- ['is_del', '=', 0],
|
|
|
- ['status', '<>', 8]
|
|
|
+ ['is_del', '=', 0]
|
|
|
])->findOrEmpty();
|
|
|
|
|
|
- if (!$rs) throw new Exception('该售后单记录不存在');
|
|
|
+ if (empty($rs)) throw new Exception('该售后单记录不存在');
|
|
|
+ if (in_array($rs['status'], [4, 12, 5, 8])) throw new Exception('不允许取消');
|
|
|
|
|
|
|
|
|
$res = Db::name('order_return')->where(['id' => $rs['id']])->update(['status' => 8, 'updatetime' => date('Y-m-d H:i:s')]);
|