|
@@ -88,6 +88,15 @@ class Reorder extends Base
|
|
|
$thnum = array_sum(array_column($returnadr, "return_num"));
|
|
|
$is_addr = 1;
|
|
|
}
|
|
|
+
|
|
|
+ //如果全退,且没有成功的售后申请单 提示使用'订单撤销功能'
|
|
|
+ if ($order['good_num'] == $thnum) {
|
|
|
+ $temp = Db::name("sale_return")
|
|
|
+ ->where(["orderCode" => $ordeCode, "is_del" => 0, "status" => 4])
|
|
|
+ ->count('id');
|
|
|
+ if ($temp == 0) return json_show(1004, '');
|
|
|
+ }
|
|
|
+
|
|
|
$returnCode = makeNo("RN");
|
|
|
Db::startTrans();
|
|
|
try {
|
|
@@ -823,16 +832,16 @@ class Reorder extends Base
|
|
|
$orderinfo = Db::name("sale")->where(["orderCode" => $info["orderCode"]])->findOrEmpty();
|
|
|
if (empty($orderinfo)) return json_show(1004, "未找到订单数据");
|
|
|
|
|
|
- if ($status == 4) {
|
|
|
- if ($info['is_addr'] == 1) {
|
|
|
- $addr = Db::name("sale_returnaddr")
|
|
|
- ->where(['returnCode' => $info['returnCode'], "is_del" => 0])
|
|
|
- ->select()
|
|
|
- ->toArray();
|
|
|
- if (empty($addr)) return json_show(1004, "未找到发货单地址数据");
|
|
|
-
|
|
|
- }
|
|
|
- }
|
|
|
+// if ($status == 4) {
|
|
|
+// if ($info['is_addr'] == 1) {
|
|
|
+// $addr = Db::name("sale_returnaddr")
|
|
|
+// ->where(['returnCode' => $info['returnCode'], "is_del" => 0])
|
|
|
+// ->select()
|
|
|
+// ->toArray();
|
|
|
+// if (empty($addr)) return json_show(1004, "未找到发货单地址数据");
|
|
|
+//
|
|
|
+// }
|
|
|
+// }
|
|
|
// if($status==3){
|
|
|
// $is_th =isset($this->post['is_th'])&&$this->post['is_th']!=="" ? intval($this->post['is_th']):"";
|
|
|
// if($is_th===""){
|
|
@@ -1815,4 +1824,73 @@ class Reorder extends Base
|
|
|
|
|
|
}
|
|
|
|
|
|
+ //获取退货单对应的发货单列表
|
|
|
+ public function getOrderOutList()
|
|
|
+ {
|
|
|
+ $param = $this->request->only(['returnCode', 'page' => 1, 'size' => 10], 'post', 'trim');
|
|
|
+
|
|
|
+ $val = Validate::rule([
|
|
|
+ 'returnCode|售前退货单号' => 'require',
|
|
|
+ 'page|页码' => 'require|number|gt:0',
|
|
|
+ 'size|每页数量' => 'require|number|gt:0|max:200',
|
|
|
+ ]);
|
|
|
+
|
|
|
+ if ($val->check($param) == false) return json_show(1004, $val->getError());
|
|
|
+
|
|
|
+ $where = ['a.is_del' => 0, 'a.returnCode' => $param['returnCode']];
|
|
|
+ $count = Db::name('sale_returnaddr')
|
|
|
+ ->alias('a')
|
|
|
+ ->leftJoin('order_addr b', 'b.id=a.addrid and b.is_del=0')
|
|
|
+ ->where($where)
|
|
|
+ ->count('a.id');
|
|
|
+
|
|
|
+ $list = Db::name('sale_returnaddr')
|
|
|
+ ->alias('a')
|
|
|
+ ->field('a.id,a.outCode,a.send_num,a.return_num,b.contactor,b.mobile,b.addr_code,b.addr,"" addr_code_cn')
|
|
|
+ ->leftJoin('order_addr b', 'b.id=a.addrid and b.is_del=0')
|
|
|
+ ->where($where)
|
|
|
+ ->order(['a.addtime' => 'desc', 'a.id' => 'desc'])
|
|
|
+ ->page($param['page'], $param['size'])
|
|
|
+ ->select()
|
|
|
+ ->toArray();
|
|
|
+
|
|
|
+ foreach ($list as &$value) {
|
|
|
+ if ($value['addr_code'] != '') {
|
|
|
+ $temp = explode(',', $value['addr_code']);
|
|
|
+ $value['addr_code_cn'] = GetAddr(json_encode(['provice_code' => $temp[0], 'city_code' => $temp[1], 'area_code' => $temp[2]]));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return json_show(0, '获取列表成功', ['count' => $count, 'list' => $list]);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ //取消
|
|
|
+ public function cancel()
|
|
|
+ {
|
|
|
+ $param = $this->request->only(['returnCode'], 'post', 'trim');
|
|
|
+
|
|
|
+ $val = Validate::rule([
|
|
|
+ 'returnCode|售前退货申请单号' => 'require|array|max:100',
|
|
|
+ ]);
|
|
|
+
|
|
|
+ if ($val->check($param) == false) return json_show(1004, $val->getError());
|
|
|
+
|
|
|
+ $temp = Db::name('sale_return')
|
|
|
+ ->field('returnCode')
|
|
|
+ ->where(['is_del' => 0, 'returnCode' => $param['returnCode'], 'status' => [11, 12, 4, 5, 13]])
|
|
|
+ ->findOrEmpty();
|
|
|
+ if (!empty($temp)) return json_show(1004, $temp['returnCode'] . '状态有误,不允许取消');
|
|
|
+
|
|
|
+ $rs = Db::name('sale_return')
|
|
|
+ ->where(['is_del' => 0, 'returnCode' => $param['returnCode'], 'status' => [1, 8, 9, 10]])
|
|
|
+ ->update([
|
|
|
+ 'status' => 13,
|
|
|
+ 'updatetime' => date('Y-m-d H:i:s')
|
|
|
+ ]);
|
|
|
+
|
|
|
+ return $rs ? json_show(0, '售前退货申请单取消成功') : json_show(1004, '售前退货申请单取消失败');
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
}
|