add-api-pdf_sa
This commit is contained in:
@@ -62,6 +62,13 @@ require_once APPPATH.'controllers/wxapp/Wxapp.php';
|
||||
throw new Exception('参数错误', API_CODE_INVILD_PARAM);
|
||||
}
|
||||
$fill_info = $this->orders_v2_entity->pdf_data($row);
|
||||
$sa_div = '';
|
||||
if($fill_info['sa']){
|
||||
$sa_div = "<div style=\"margin-top:20px;text-align:right;\">编号【{$row['sid']}】</div>
|
||||
<div style=\"margin-top:10px;\"><b>附件二 补充信息</b></div>
|
||||
<div>经充分协商,双方约定:</div>
|
||||
<div>{$fill_info['sa']}</div>";
|
||||
}
|
||||
$car_html = "<div style=\"margin-top:20px;text-align:center;font-weight:bold;font-size:4.266vw;\"><b>汽车购买协议</b></div>
|
||||
<div style=\"background-color:#f8f8f8;border:#ebebeb 1px solid;box-sizing:border-box;margin-top:4vw;padding:4vw;border-radius:1.333vw;line-height:2;word-break:break-all;word-wrap:break-word;font-size:3.2vw;color:#666;overflow-x:hidden;\">
|
||||
<div style=\"text-align:right;\">编号【{$row['sid']}】</div>
|
||||
@@ -107,6 +114,7 @@ require_once APPPATH.'controllers/wxapp/Wxapp.php';
|
||||
<div><b>其中,</b></div>
|
||||
<div>1.定金(元):{$fill_info['price_book']}</div>
|
||||
<div>2.整车尾款(元):{$fill_info['last_price']}</div>
|
||||
{$sa_div}
|
||||
</div>";
|
||||
$list[] = [
|
||||
'title' => '购车协议',
|
||||
|
||||
@@ -87,6 +87,7 @@ class CusorderV2 extends Wxapp{
|
||||
$business_id = $this->input_param('business_id'); //商务政策id
|
||||
$car_city_id = $this->input_param('c_city_id');//上牌城市
|
||||
$pro = $this->input_param('pro'); //省市数组
|
||||
$sa = $this->input_param('sa'); //补充协商
|
||||
|
||||
$row = $this->customers_model->get(['id'=>$cus_id]);
|
||||
$series_row = $this->auto_series_model->get(['id'=>$car_id]);
|
||||
@@ -212,7 +213,7 @@ class CusorderV2 extends Wxapp{
|
||||
}
|
||||
|
||||
$o_id = $this->orders_model->add($data);
|
||||
if($o_id){
|
||||
if(is_numeric($o_id)){
|
||||
$userinfo = $this->app_liche_users_model->get(['mobile'=>$data['mobile']],'id');
|
||||
$this->orders_v2_entity->add_book_order($o_id,$userinfo['id']);
|
||||
if($payway){ //全款服务费和尾款订单
|
||||
@@ -221,7 +222,8 @@ class CusorderV2 extends Wxapp{
|
||||
//更新客户下单时间
|
||||
$this->customers_model->update(array('order_time' => date('Y-m-d H:i:s')),['id'=>$cus_id]);
|
||||
$this->customers_entity->add_log($cus_id, $this->session['uid'], $this->session['uname'], '生成订单', 6);
|
||||
|
||||
//补充协商
|
||||
$sa && $this->order_datas_entity->up_data($o_id,['sa'=>$sa]);
|
||||
return ['id'=>$o_id,'pay_img'=>$orders_entity->pay_img($o_id)];
|
||||
}else{
|
||||
throw new Exception('创建失败', ERR_PARAMS_ERROR);
|
||||
@@ -326,6 +328,7 @@ class CusorderV2 extends Wxapp{
|
||||
$srv_arr = $this->input_param('srv_arr');
|
||||
$fines = $this->input_param('fines');
|
||||
$business_id = $this->input_param('business_id'); //商务政策id
|
||||
$sa = $this->input_param('sa'); //补充协商
|
||||
|
||||
$row = $this->orders_model->get(['id'=>$id]);
|
||||
$series_row = $this->auto_series_model->get(['id'=>$car_id]);
|
||||
@@ -426,6 +429,8 @@ class CusorderV2 extends Wxapp{
|
||||
$result = $this->orders_model->update($data,['id'=>$row['id']]);
|
||||
if($result){
|
||||
$this->orders_v2_entity->edit_order($data,$row);
|
||||
//补充协商
|
||||
$sa && $this->order_datas_entity->up_data($row['id'],['sa'=>$sa]);
|
||||
throw new Exception('修改成功', API_CODE_SUCCESS);
|
||||
}else{
|
||||
throw new Exception('修改失败', ERR_PARAMS_ERROR);
|
||||
@@ -582,6 +587,9 @@ class CusorderV2 extends Wxapp{
|
||||
$admin_row = $this->app_user_model->get(['id'=>$row['sale_id']],'uname');
|
||||
$data['admin_name'] = $admin_row['uname'];
|
||||
}
|
||||
//获取补充协议
|
||||
$order_data = $this->receiver_order_datas_model->get(['o_id'=>$row['id']],'sa');
|
||||
$data['sa'] = $order_data['sa'] ? $order_data['sa'] : '';
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
||||
@@ -106,4 +106,21 @@ class Order_datas_entity{
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新数据
|
||||
* @param $oid
|
||||
* @param $data
|
||||
* @return void
|
||||
*/
|
||||
public function up_data($oid,$data){
|
||||
if(!$data){
|
||||
return false;
|
||||
}
|
||||
$row = $this->ci->receiver_order_datas_model->get(['o_id'=>$oid]);
|
||||
if(!$row){
|
||||
$this->ci->receiver_order_datas_model->add(['o_id'=>$oid,'c_time'=>time()]);
|
||||
}
|
||||
$res = $this->ci->receiver_order_datas_model->update($data,['o_id'=>$oid]);
|
||||
return $res;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -493,6 +493,10 @@ class Orders_v2_entity{
|
||||
'last_price' => $fill_info['last_price'],
|
||||
];
|
||||
$pdf_path = 'pdf/car_tpl.pdf';
|
||||
if($fill_info['sa']){
|
||||
$fill_data['sa'] = $fill_info['sa'];
|
||||
$pdf_path = 'pdf/car_sa_tpl.pdf';
|
||||
}
|
||||
$save_path = "pdf/{$this->order_row['sid']}/car.pdf";
|
||||
$this->ci->load->library('pdftk');
|
||||
$req = $this->ci->pdftk->esign_fill_pdf($pdf_path,$save_path,$fill_data);
|
||||
@@ -556,6 +560,7 @@ class Orders_v2_entity{
|
||||
$business_id = $info_json['business_id'] ? $info_json['business_id'] : 0;
|
||||
$data = [];
|
||||
|
||||
$biz = $this->ci->biz_model->get(['id'=>$row['biz_id']]);
|
||||
//车辆信息
|
||||
$money_json = json_decode($row['money_json'],true);
|
||||
$money_json['price_discount'] && $row['price'] = $row['price'] - $money_json['price_discount'];
|
||||
@@ -607,6 +612,12 @@ class Orders_v2_entity{
|
||||
$data['vin'] = $items['vin'];
|
||||
$data['delivery'] = $delivery;
|
||||
}
|
||||
$data['sa'] = '';
|
||||
if($biz['type']==1){
|
||||
$this->ci->load->model('receiver/order/receiver_order_datas_model');
|
||||
$order_data = $this->ci->receiver_order_datas_model->get(['o_id'=>$row['id']]);
|
||||
$order_data['sa'] && $data['sa'] = $order_data['sa'];
|
||||
}
|
||||
if(!$type){
|
||||
$services = [];
|
||||
$srv_arr = json_decode($row['srv_ids'],true);
|
||||
|
||||
Executable
BIN
Binary file not shown.
Reference in New Issue
Block a user