edit-admin-order_detail
This commit is contained in:
@@ -102,11 +102,12 @@ class Orders extends HD_Controller
|
||||
return $this->show_json(SYS_CODE_FAIL, '订单不存在!');
|
||||
}
|
||||
$money_json = json_decode($row['money_json'], true);
|
||||
$deposit = $row['deposit'];
|
||||
$jsondata = $row['jsondata'] ? json_decode($row['jsondata'], true) : array();
|
||||
$row['info_json'] = json_decode($row['info_json'], true);
|
||||
$row['status'] = intval($row['status']);
|
||||
$row['price'] = number_format($row['price'], 2);
|
||||
$row['deposit'] = number_format($row['deposit'], 2);
|
||||
$row['deposit'] = number_format($deposit, 2);
|
||||
$row['c_time'] = date('Y-m-d', $row['c_time']);
|
||||
$row['sign_status_name'] = $status_arr['list'][$sign['status']];
|
||||
$row['cf_title'] = $customers['cf_title'];
|
||||
@@ -153,10 +154,10 @@ class Orders extends HD_Controller
|
||||
$loan['first_pay'] = 0;
|
||||
if ($money_json['price_loan']) {
|
||||
$srv_money = $this->orders_entity->order_srv_money($row['id']);
|
||||
if ($srv_money > $row['deposit']) {
|
||||
if ($srv_money > $deposit) {
|
||||
$loan['first_pay'] = $money_json['price_car'] - $money_json['price_loan'];
|
||||
} else {
|
||||
$loan['first_pay'] = $money_json['price_car'] - $money_json['price_loan'] - $row['deposit'];
|
||||
$loan['first_pay'] = $money_json['price_car'] - $money_json['price_loan'] - $deposit;
|
||||
}
|
||||
}
|
||||
!$loan['num'] && $loan['num'] = 12;
|
||||
@@ -456,15 +457,23 @@ class Orders extends HD_Controller
|
||||
}
|
||||
$result = $this->order_loans_model->update($update, ['id' => $row['id']]);
|
||||
if ($result && $params['status'] == 3) { //设置完成按揭
|
||||
$this->orders_model->update(['status' => 3], ['id' => $row['o_id']]);
|
||||
$ckcar = $this->order_ckcars_model->get(['o_id' => $row['o_id']]);
|
||||
$replace = [
|
||||
'o_id' => $row['o_id'],
|
||||
'status' => 0,
|
||||
'c_time' => time()
|
||||
];
|
||||
$ckcar && $replace['id'] = $ckcar['id'];
|
||||
$this->order_ckcars_model->replace($replace);
|
||||
$order_row = $this->orders_model->get(['id'=>$row['o_id']],'status');
|
||||
if($order_row['status']==4){ //完成代办
|
||||
$this->orders_model->update(['status' => 5], ['id' => $oid]);
|
||||
if (!$this->order_deliverys_model->count(['o_id' => $oid])) {
|
||||
$this->order_deliverys_model->add(['o_id' => $oid, 'c_time' => time]);
|
||||
}
|
||||
}else{
|
||||
$this->orders_model->update(['status' => 3], ['id' => $row['o_id']]);
|
||||
$ckcar = $this->order_ckcars_model->get(['o_id' => $row['o_id']]);
|
||||
$replace = [
|
||||
'o_id' => $row['o_id'],
|
||||
'status' => 0,
|
||||
'c_time' => time()
|
||||
];
|
||||
$ckcar && $replace['id'] = $ckcar['id'];
|
||||
$this->order_ckcars_model->replace($replace);
|
||||
}
|
||||
}
|
||||
$this->data['params'] = $params;
|
||||
return $result ? $this->show_json(SYS_CODE_SUCCESS, '保存成功') : $this->show_json(SYS_CODE_FAIL, '保存失败');
|
||||
@@ -637,9 +646,13 @@ class Orders extends HD_Controller
|
||||
return $this->show_json(SYS_CODE_FAIL, '修改失败,该订单不处于代办阶段');
|
||||
}
|
||||
$this->order_agents_model->update(['status' => 1], ['o_id' => $oid]);
|
||||
$this->orders_model->update(['status' => 5], ['id' => $oid]);
|
||||
if (!$this->order_deliverys_model->count(['o_id' => $oid])) {
|
||||
$this->order_deliverys_model->add(['o_id' => $oid, 'c_time' => time]);
|
||||
|
||||
$loan = $this->order_loans_model->get(['o_id' => $oid]);
|
||||
if($loan['status']==3){ //判断是否完成代办
|
||||
$this->orders_model->update(['status' => 5], ['id' => $oid]);
|
||||
if (!$this->order_deliverys_model->count(['o_id' => $oid])) {
|
||||
$this->order_deliverys_model->add(['o_id' => $oid, 'c_time' => time]);
|
||||
}
|
||||
}
|
||||
return $this->show_json(SYS_CODE_SUCCESS, '保存成功');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user