edit-cancel-select_car
This commit is contained in:
@@ -533,8 +533,8 @@ class Orders extends HD_Controller
|
||||
}
|
||||
if (!$item_id) return $this->show_json(SYS_CODE_FAIL, '请选择车辆!');
|
||||
|
||||
if ($row['status'] >= 3) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '用户已确,不能修改!');
|
||||
if ($row['status'] > 3) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '已开票,不能修改!');
|
||||
}
|
||||
$res = $this->orders_model->update(['item_id' => $item_id], ['id' => $id]);
|
||||
if (!$res) {
|
||||
@@ -839,17 +839,20 @@ class Orders extends HD_Controller
|
||||
if(!$row || !$row['item_id']){
|
||||
return $this->show_json(SYS_CODE_FAIL, '参数错误');
|
||||
}
|
||||
if($row['status']>5){
|
||||
return $this->show_json(SYS_CODE_FAIL, '用户已确认车辆不能修改');
|
||||
}else if ($row['status']==5){
|
||||
$ck_row = $this->order_ckcars_model->get(['o_id'=>$row['id']]);
|
||||
if($ck_row['status']>=2){
|
||||
return $this->show_json(SYS_CODE_FAIL, '用户已确认车辆不能修改');
|
||||
}
|
||||
$bill_row = $this->order_bills_model->get(['o_id'=>$id]);
|
||||
$car_row = $this->order_ckcars_model->get(['o_id'=>$id]);
|
||||
if($row['status']>3 || $bill_row['status']==2){
|
||||
return $this->show_json(SYS_CODE_FAIL, '订单已开票,不能修改');
|
||||
}
|
||||
$res = $this->orders_model->update(['item_id'=>0],['id'=>$row['id']]);
|
||||
$res = $this->orders_model->update(['item_id'=>0,'status'=>2],['id'=>$row['id']]);
|
||||
if($res){
|
||||
$this->items_model->update(['status' => 1,'bill_time'=>'0000-00-00 00:00:00'], ['id' => $row['item_id']]);
|
||||
//用户确认签名,删除重签签名
|
||||
$con_row = $this->order_contracts_model->get(['o_id'=>$id,'type'=>2]);
|
||||
if($con_row){
|
||||
$this->order_contracts_model->delete(['o_id'=>$id,'type'=>2]);
|
||||
$this->order_ckcars_model->update(['status'=>0],['id'=>$car_row['id']]);
|
||||
}
|
||||
return $this->show_json(SYS_CODE_SUCCESS, '保存成功');
|
||||
}else{
|
||||
return $this->show_json(SYS_CODE_FAIL, '保存失败');
|
||||
|
||||
@@ -662,15 +662,18 @@
|
||||
}, 'json');
|
||||
},
|
||||
cancelItem:function(){
|
||||
$.post("/receiver/orders/edit_ckcar", {id:this.info.id}, function (data) {
|
||||
if (data.code) {
|
||||
layer.msg(data.msg, {time: 2000, icon: 1}, function () {
|
||||
$.form.reload();
|
||||
});
|
||||
} else {
|
||||
layer.msg(data.msg, {icon: 2});
|
||||
}
|
||||
}, 'json');
|
||||
var that = this;
|
||||
layer.confirm('你确定取消分配吗?', {icon: 3, title:'提示'}, function(index){
|
||||
$.post("/receiver/orders/edit_ckcar", {id:that.info.id}, function (data) {
|
||||
if (data.code) {
|
||||
layer.msg(data.msg, {time: 2000, icon: 1}, function () {
|
||||
$.form.reload();
|
||||
});
|
||||
} else {
|
||||
layer.msg(data.msg, {icon: 2});
|
||||
}
|
||||
}, 'json');
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -28,6 +28,7 @@ class Contract extends Wxapp{
|
||||
|
||||
$this->load->model("biz/biz_model");
|
||||
$this->load->model("sys/sys_company_model");
|
||||
$this->load->model('app/liche/app_liche_orders_model');
|
||||
$this->load->library('receiver/orders_entity');
|
||||
}
|
||||
|
||||
@@ -215,9 +216,15 @@ class Contract extends Wxapp{
|
||||
];
|
||||
$result = $this->contracts_model->update($update,['id'=>$row['id']]);
|
||||
if($result){
|
||||
$this->ckcars_model->update(['status'=>2],['o_id'=>$id]);
|
||||
//生成支付订单
|
||||
$this->orders_entity->check_finish_v2($id,$this->session);
|
||||
//判断尾款是否支付
|
||||
if($this->app_liche_orders_model->count(['o_id'=>$id,'status'=>1,'type'=>3])){ //尾款已支付
|
||||
$this->ckcars_model->update(['status'=>3],['o_id'=>$id]);
|
||||
$this->orders_model->update(['status'=>3],['id'=>$id]);
|
||||
}else{
|
||||
$this->ckcars_model->update(['status'=>2],['o_id'=>$id]);
|
||||
//生成支付订单
|
||||
$this->orders_entity->check_finish_v2($id,$this->session);
|
||||
}
|
||||
$redis->delete($cache_key);
|
||||
throw new Exception('签名成功', API_CODE_SUCCESS);
|
||||
}else{
|
||||
|
||||
@@ -382,6 +382,9 @@ class Orders_entity{
|
||||
if(!$this->order_row || !$p_row){
|
||||
return false;
|
||||
}
|
||||
if($this->ci->app_liche_orders_model->count(['status>='=>0,'type'=>3])){ //存在尾款订单
|
||||
return true;
|
||||
}
|
||||
$car_json = json_decode($this->order_row['car_json'],true);
|
||||
$color = isset($car_json['color']) ? $car_json['color'] : '';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user