orders add edit_price_car

This commit is contained in:
qianhy
2023-06-15 13:44:19 +08:00
committed by lccsw
parent aafa17bbe5
commit 47be82d5aa
3 changed files with 58 additions and 0 deletions
@@ -1962,6 +1962,47 @@ class Orders extends HD_Controller
return $this->show_view('receiver/orderv2/edit_price');
}
public function edit_price_car(){
$id = $this->input->get_post('id');
$row = $this->receiver_orders_v2_model->get(['id' => $id]);
if (!$row) {
return $this->show_json(SYS_CODE_FAIL, '订单不存在!');
}
$money_json = json_decode($row['money_json'],true);
if($this->input->method()=='post'){
$price_car = $this->input->post('price_car');
if ($money_json['price_car'] > floatval($price_car)){
return $this->show_json(SYS_CODE_FAIL, '售价不能下调!');
}
$money_json['price_car'] = floatval($price_car);
$updata = [
'money_json' => json_encode($money_json,JSON_UNESCAPED_UNICODE)
];
$res = $this->receiver_orders_v2_model->update($updata,['id'=>$id]);
if($res){
//更新尾款订单
if(!$this->app_liche_orders_model->count(['type'=>3,'status'=>1,'o_id'=>$id])){ //不存在支付尾款更新尾款
$this->app_liche_orders_model->update(['status'=>-1],['type'=>3,'o_id'=>$id,'status'=>0]);
//生成购车订单
$userinfo = $this->app_liche_users_model->get(['mobile'=>$row['mobile']]);
$this->orders_v2_entity->add_order($id,$userinfo['id']);
}
$this->order_status_check_after_adjust_fee($id);
//重新生成合同
$this->order_contracts_model->delete(['o_id'=>$id]);
$url = http_host_com('api')."/wxapp/licheb/protocol/create_pdf?id={$id}";
file_get_contents($url);
// $this->orders_v2_entity->create_pdf($id);
return $this->show_json(SYS_CODE_SUCCESS, '保存成功!');
}else{
return $this->show_json(SYS_CODE_FAIL, '保存失败!');
}
}
$this->data['price_car'] = $money_json['price_car'];
$this->data['id'] = $id;
return $this->show_view('receiver/orderv2/edit_price_car');
}
public function edit_srv(){
$this->load->model('receiver/receiver_services_model','services_model');
$id = $this->input->get_post('id');
@@ -0,0 +1,16 @@
<form class="am-form am-form-horizontal" action="/receiver/orderv2/orders/edit_price_car" data-auto="true" method="post"
style="width: 90%;padding-top: 10px">
<div class="am-form-group">
<label class="am-para-label">车辆售价:</label>
<div class="am-para-input">
<input type="text" value="<?=$price_car?>" name="price_car"/>
</div>
</div>
<div class="am-form-group" style="margin-bottom: 2rem">
<div class="am-para-input">
<input type="hidden" name="id" value="<?=$id?>">
<button class="am-btn am-btn-secondary" type="submit">确定</button>
</div>
</div>
</form>
@@ -29,6 +29,7 @@
({{info.sale_detail}})
</span>
<span v-if="info.is_admin" class="am-btn am-btn-primary am-btn-xs" data-title="修改优惠金额" :data-modal="'/receiver/orderv2/orders/edit_price?id='+info.id">修改优惠</span>
<span v-if="info.is_admin" class="am-btn am-btn-primary am-btn-xs" data-title="修改售价" :data-modal="'/receiver/orderv2/orders/edit_price_car?id='+info.id">修改售价</span>
</label>
</div>