edit-order-opt
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
class Img extends CI_Controller
|
||||
{
|
||||
|
||||
public function index()
|
||||
{
|
||||
$b64_imgs = $this->input->get('imgs');
|
||||
$arr_imgs = explode(',',base64_decode($b64_imgs));
|
||||
$lists = [];
|
||||
if($arr_imgs){
|
||||
foreach ($arr_imgs as $item) {
|
||||
$lists[] = [
|
||||
'alt' => '',
|
||||
'pid' => '',
|
||||
'src' => build_qiniu_image_url($item),
|
||||
'thumb' => build_qiniu_image_url($item)
|
||||
];
|
||||
}
|
||||
}
|
||||
$data['lists'] = $lists;
|
||||
$data['_title'] = '大图';
|
||||
return $this->load->view('img', $data);
|
||||
}
|
||||
|
||||
public function imgs(){
|
||||
$data = '/liche/0f48c61017285abc0cff63f59ea5a25f.jpg,/liche/be842659e04f9b5b7bf3f9ab1459c611.jpg';
|
||||
echo base64_encode($data);
|
||||
}
|
||||
}
|
||||
@@ -47,12 +47,14 @@ class Upload extends CI_Controller
|
||||
$types = $this->input->get('type');
|
||||
$uptype = $this->input->get('uptype');
|
||||
$source = $this->input->get('source');
|
||||
$field = $this->input->get('field');
|
||||
|
||||
$data['mode'] = $mode ? $mode : '1';
|
||||
$data['types'] = $types;
|
||||
$data['uptype'] = $uptype ? $uptype : 'qiniu';
|
||||
$data['mimes'] = $this->file_mime($data['types']);
|
||||
$data['source'] = $source ? $source : '';
|
||||
$data['field'] = $field ? $field : 'file';
|
||||
$this->load->view('uploadpdf', $data);
|
||||
}
|
||||
|
||||
@@ -145,4 +147,4 @@ class Upload extends CI_Controller
|
||||
|
||||
return join(',', array_unique($mime));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -169,11 +169,11 @@ class Attr extends HD_Controller{
|
||||
* @return bool
|
||||
*/
|
||||
function json_lists(){
|
||||
$s_id = $this->input->post('s_id');
|
||||
$status = $this->input->post('status');
|
||||
$type = $this->input->post('type');
|
||||
$page = $this->input->post('page');
|
||||
$size = $this->input->post('size');
|
||||
$s_id = $this->input->get_post('s_id');
|
||||
$status = $this->input->get_post('status');
|
||||
$type = $this->input->get_post('type');
|
||||
$page = $this->input->get_post('page');
|
||||
$size = $this->input->get_post('size');
|
||||
|
||||
$where = array();
|
||||
$s_id && $where['s_id'] = $s_id;
|
||||
|
||||
@@ -0,0 +1,399 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: lcc
|
||||
* Date: 2022/2/15
|
||||
* Time: 15:35
|
||||
*/
|
||||
class Business extends HD_Controller{
|
||||
|
||||
public function __construct(){
|
||||
parent::__construct();
|
||||
|
||||
$this->load->model('auto/auto_brand_model');
|
||||
$this->load->model('auto/auto_series_model');
|
||||
$this->load->model('auto/auto_attr_model');
|
||||
$this->load->model('auto/auto_cars_model');
|
||||
$this->load->model('auto/auto_business_model');
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
$params = $this->input->get();
|
||||
|
||||
$where = array();
|
||||
if($params['brand_id']){
|
||||
$where['brand_id'] = $params['brand_id'];
|
||||
} else{
|
||||
$params['brand_id'] = '';
|
||||
}
|
||||
|
||||
if($params['s_id']){
|
||||
$where['s_id'] = $params['s_id'];
|
||||
} else{
|
||||
$params['s_id'] = '';
|
||||
}
|
||||
if($params['v_id']){
|
||||
$where['v_id'] = $params['v_id'];
|
||||
} else{
|
||||
$params['V_id'] = '';
|
||||
}
|
||||
if(strlen($params['status']) > 0){
|
||||
$where['status'] = $params['status'];
|
||||
} else {
|
||||
$params['status'] = '';
|
||||
}
|
||||
if($params['city_id']){
|
||||
$where['city_id'] = $params['city_id'];
|
||||
} else{
|
||||
$params['city_id'] = '';
|
||||
}
|
||||
if($params['year']){
|
||||
$where['year'] = $params['year'];
|
||||
}elseif(!isset($params['year'])){
|
||||
$where['year'] = $params['year'] = date('Y');
|
||||
}
|
||||
if($params['month']){
|
||||
$where['month'] = $params['month'];
|
||||
}elseif(!isset($params['month'])){
|
||||
$where['month'] = $params['month'] = intval(date('m'));
|
||||
}
|
||||
$page = $params['page'];
|
||||
$page = !$page ? 1 : $page;
|
||||
$size = $params['size'];
|
||||
$size = !$size ? 20 : $size;
|
||||
|
||||
//获取品牌map
|
||||
$where_brand = array('status > -1' => null);
|
||||
$map_brand = $this->auto_brand_model->map('id', 'name', $where_brand, 'id desc', 0 , 0, 'id, name');
|
||||
//状态
|
||||
$statusAry = array('0' => '关闭', '1' => '开启');
|
||||
|
||||
$total = $this->auto_business_model->count($where);
|
||||
$lists = array();
|
||||
if($total){
|
||||
$orderby = 'id desc';
|
||||
$select = '*';
|
||||
$rows = $this->auto_business_model->select($where, $orderby, $page, $size, $select);
|
||||
if($rows){
|
||||
$s_ids = array_unique(array_column($rows,'s_id'));
|
||||
$attr_ids = array_unique(array_column($rows,'v_id'));
|
||||
$city_ids = array_unique(array_column($rows,'city_id'));
|
||||
//获取车系列表
|
||||
$map_sery = array();
|
||||
if($s_ids){
|
||||
$str_ids = implode(',', $s_ids);
|
||||
$where_sery = array("id in ({$str_ids})" => null);
|
||||
$map_sery = $this->auto_series_model->map('id', 'name', $where_sery, 'id desc', 0, 0, 'id,name');
|
||||
}
|
||||
$map_attr = array();
|
||||
if($attr_ids){
|
||||
$str_ids = implode(',', $attr_ids);
|
||||
$where_attr = array("id in ({$str_ids})" => null);
|
||||
$map_attr = $this->auto_attr_model->map('id', 'title', $where_attr, 'id desc', 0 , 0, 'id, title, type');
|
||||
}
|
||||
if($city_ids){
|
||||
$str_ids = implode(',', $city_ids);
|
||||
$where_city = array("city_id in ({$str_ids})" => null);
|
||||
$map_city = $this->sys_city_model->map('city_id', 'name', $where_city, 'id desc', 0 , 0, 'city_id, name');
|
||||
}
|
||||
//属性按'车型-车身颜色-内饰颜色'排序
|
||||
foreach($rows as $v){
|
||||
$title = "{$map_brand[$v['brand_id']]} {$map_sery[$v['s_id']]} {$map_attr[$v['v_id']]}";
|
||||
$city_cn = $map_city[$v['city_id']];
|
||||
$month = date('Y-m',strtotime("{$v['year']}-{$v['month']}"));
|
||||
$lists[] = array(
|
||||
'id' => $v['id'],
|
||||
'title' => $title,
|
||||
'status' => $v['status'],
|
||||
'price_car' => $v['price_car'] > 0 ? $v['price_car'] : '0.00',
|
||||
'price_floor' => $v['price_floor'] > 0 ? $v['price_floor'] : '0.00',
|
||||
'price_coplus' => $v['price_coplus'] > 0 ? $v['price_coplus'] : '0.00',
|
||||
'price_color' => $v['price_color'] > 0 ? $v['price_color'] : '0.00',
|
||||
'profix_car' => $v['profix_car'],
|
||||
'profix_insure' => $v['profix_insure'],
|
||||
'profix_carno' => $v['profix_carno'],
|
||||
'profix_loan' => $v['profix_loan'],
|
||||
'city_cn'=> $city_cn,
|
||||
'month' => $month,
|
||||
's_effect_time' => $v['s_effect_time'] ? date('Y-m-d',$v['s_effect_time']) : '',
|
||||
'effect_status' => $v['if_effect'] ? '生效中' : '未生效',
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->data['params'] = $params;
|
||||
$this->data['lists'] = $lists;
|
||||
$this->data['statusAry'] = $statusAry;
|
||||
$this->data['brandAry'] = $map_brand;
|
||||
$this->data['cityAry'] = $this->sys_city_model->select(['status'=>1],'id desc',0,0,'city_id,name');
|
||||
$this->data['yearAry'] = $this->auto_business_model->year();
|
||||
$this->data['monthAry'] = $this->auto_business_model->month();
|
||||
$this->data['_title'] = '商务政策管理';
|
||||
$this->show_view('auto/business/lists',true);
|
||||
}
|
||||
|
||||
public function lists()
|
||||
{
|
||||
// TODO: Implement lists() method.
|
||||
}
|
||||
|
||||
public function get()
|
||||
{
|
||||
$id = $this->input->get('id');
|
||||
$map_brand = $this->auto_brand_model->map('id', 'name', ['status>'=>-1], 'id desc', 0 , 0, 'id, name');
|
||||
$city_rows = $this->sys_city_model->select(['status'=>1],'id desc',0,0,'city_id,name');
|
||||
$row = $this->auto_business_model->get(['id'=>$id]);
|
||||
if($id && $row){
|
||||
$info = [
|
||||
'id' => $row['id'],
|
||||
'city_id' => $row['city_id'],
|
||||
'brand_id' => $row['brand_id'],
|
||||
's_id' => $row['s_id'],
|
||||
'v_id' => $row['v_id'],
|
||||
'price_car' => $row['price_car'],
|
||||
'price_floor' => $row['price_floor'],
|
||||
'price_color' => $row['price_color'],
|
||||
'price_coplus' => $row['price_coplus'],
|
||||
'profix_car' => $row['profix_car'],
|
||||
'profix_carno' => $row['profix_carno'],
|
||||
'profix_insure' => $row['profix_insure'],
|
||||
'profix_loan' => $row['profix_loan'],
|
||||
'delivery_day' => $row['delivery_day'],
|
||||
'date' => date('Y-m',strtotime("{$row['year']}-{$row['month']}")),
|
||||
'year' => $row['year'],
|
||||
'month' => intval($row['month']),
|
||||
'colors' => json_decode($row['colors'],true),
|
||||
's_effect_time' => $row['s_effect_time'] ? date('Y-m-d',$row['s_effect_time']) : '',
|
||||
'action' => 'auto/business/edit',
|
||||
];
|
||||
if($this->input->get('type')=='copy'){ //复制
|
||||
$info['month'] = intval(date('m'));
|
||||
$info['action'] = 'auto/business/add';
|
||||
$info['s_effect_time'] = date('Y-m-d');
|
||||
}
|
||||
}else{
|
||||
$info = [
|
||||
'city_id' => '',
|
||||
'brand_id' => '',
|
||||
's_id' => '',
|
||||
'v_id' => '',
|
||||
'price_car' => 0.00,
|
||||
'price_floor' => 0.00,
|
||||
'price_color' => 0.00,
|
||||
'price_coplus' => 0.00,
|
||||
'profix_car' => 0.00,
|
||||
'profix_carno' => 0.00,
|
||||
'profix_insure' => 0.00,
|
||||
'profix_loan' => 0.00,
|
||||
'delivery_day' => 0,
|
||||
'action' => 'auto/business/add',
|
||||
'year' => date('Y'),
|
||||
'month' => intval(date('m')),
|
||||
's_effect_time' => date('Y-m-d'),
|
||||
'colors' => []
|
||||
];
|
||||
}
|
||||
$this->data['info'] = $info;
|
||||
$this->data['brandAry'] = $map_brand;
|
||||
$this->data['city_rows'] = $city_rows;
|
||||
$this->data['yearAry'] = $this->auto_business_model->year();
|
||||
$this->data['monthAry'] = $this->auto_business_model->month();
|
||||
$this->data['_title'] = '添加';
|
||||
$this->show_view('auto/business/get');
|
||||
}
|
||||
|
||||
public function add()
|
||||
{
|
||||
$info = $this->input->post('info');
|
||||
$res = $this->valid_data($info);
|
||||
if(!$res['code']){
|
||||
return $this->show_json(SYS_CODE_FAIL,$res['msg']);
|
||||
}
|
||||
$year = $info['year'];
|
||||
$month = intval($info['month']);
|
||||
$where = [
|
||||
'brand_id' => $info['brand_id'],
|
||||
's_id' => $info['s_id'],
|
||||
'v_id' => $info['v_id'],
|
||||
'city_id' => $info['city_id'],
|
||||
'year' => $year,
|
||||
'month' => $month,
|
||||
'status>='=>0
|
||||
];
|
||||
if($this->auto_business_model->get($where)){
|
||||
return ['code'=>0,'msg'=>'数据已存在'];
|
||||
}
|
||||
$data = [
|
||||
'brand_id' => $info['brand_id'],
|
||||
's_id' => $info['s_id'],
|
||||
'v_id' => $info['v_id'],
|
||||
'city_id' => $info['city_id'],
|
||||
'year' => $year,
|
||||
'month' => $month,
|
||||
'status' => 1,
|
||||
'c_time' => time()
|
||||
];
|
||||
$info['price_car'] && $data['price_car'] = $info['price_car'];
|
||||
$info['price_floor'] && $data['price_floor'] = $info['price_floor'];
|
||||
$info['price_coplus'] && $data['price_coplus'] = $info['price_coplus'];
|
||||
$info['price_color'] && $data['price_color'] = $info['price_color'];
|
||||
$info['profix_car'] && $data['profix_car'] = $info['profix_car'];
|
||||
$info['profix_carno'] && $data['profix_carno'] = $info['profix_carno'];
|
||||
$info['profix_insure'] && $data['profix_insure'] = $info['profix_insure'];
|
||||
$info['profix_loan'] && $data['profix_loan'] = $info['profix_loan'];
|
||||
$info['colors'] && $data['colors'] = json_encode($info['colors'],JSON_UNESCAPED_UNICODE);
|
||||
$info['s_effect_time'] && $data['s_effect_time'] = strtotime($info['s_effect_time']);
|
||||
$info['delivery_day'] && $data['delivery_day'] = $info['delivery_day'];
|
||||
if(time()>$data['s_effect_time']){
|
||||
$data['if_effect'] = 1;
|
||||
}
|
||||
$this->auto_business_model->add($data);
|
||||
return $this->show_json(SYS_CODE_SUCCESS, '添加成功');
|
||||
}
|
||||
|
||||
public function edit()
|
||||
{
|
||||
$info = $this->input->post('info');
|
||||
if(!$this->auto_business_model->get(['id'=>$info['id']])){
|
||||
return $this->show_json(SYS_CODE_FAIL,'参数错误');
|
||||
}
|
||||
$res = $this->valid_data($info);
|
||||
if(!$res['code']){
|
||||
return $this->show_json(SYS_CODE_FAIL,$res['msg']);
|
||||
}
|
||||
$year = $info['year'];
|
||||
$month = intval($info['month']);
|
||||
$where = [
|
||||
'brand_id' => $info['brand_id'],
|
||||
's_id' => $info['s_id'],
|
||||
'v_id' => $info['v_id'],
|
||||
'city_id' => $info['city_id'],
|
||||
'year' => $year,
|
||||
'month' => $month,
|
||||
'status>='=>0,
|
||||
'id !=' => $info['id']
|
||||
];
|
||||
if($this->auto_business_model->get($where)){
|
||||
return ['code'=>0,'msg'=>'数据已存在'];
|
||||
}
|
||||
$data = [
|
||||
'city_id' => $info['city_id'],
|
||||
'brand_id' => $info['brand_id'],
|
||||
's_id' => $info['s_id'],
|
||||
'v_id' => $info['v_id'],
|
||||
'year' => $year,
|
||||
'month' => $month,
|
||||
];
|
||||
$info['price_car'] && $data['price_car'] = $info['price_car'];
|
||||
$info['price_floor'] && $data['price_floor'] = $info['price_floor'];
|
||||
$info['price_coplus'] && $data['price_coplus'] = $info['price_coplus'];
|
||||
$info['price_color'] && $data['price_color'] = $info['price_color'];
|
||||
$info['profix_car'] && $data['profix_car'] = $info['profix_car'];
|
||||
$info['profix_carno'] && $data['profix_carno'] = $info['profix_carno'];
|
||||
$info['profix_insure'] && $data['profix_insure'] = $info['profix_insure'];
|
||||
$info['profix_loan'] && $data['profix_loan'] = $info['profix_loan'];
|
||||
$info['colors'] && $data['colors'] = json_encode($info['colors'],JSON_UNESCAPED_UNICODE);
|
||||
$info['s_effect_time'] && $data['s_effect_time'] = strtotime($info['s_effect_time']);
|
||||
$info['delivery_day'] && $data['delivery_day'] = $info['delivery_day'];
|
||||
if(time()>$data['s_effect_time']){
|
||||
$data['if_effect'] = 1;
|
||||
}
|
||||
$this->auto_business_model->update($data,['id'=>$info['id']]);
|
||||
return $this->show_json(SYS_CODE_SUCCESS, '保存成功');
|
||||
}
|
||||
|
||||
public function del()
|
||||
{
|
||||
// TODO: Implement del() method.
|
||||
}
|
||||
|
||||
public function batch()
|
||||
{
|
||||
// TODO: Implement batch() method.
|
||||
}
|
||||
|
||||
public function export()
|
||||
{
|
||||
// TODO: Implement export() method.
|
||||
}
|
||||
function edit_status(){
|
||||
$id = $this->input->post('id');
|
||||
$field = $this->input->post('field');
|
||||
$value = $this->input->post('value');
|
||||
$status = $this->input->post('status');
|
||||
|
||||
if('status' == $field){
|
||||
$status = $value;
|
||||
}
|
||||
|
||||
$upd = array('status' => $status);
|
||||
|
||||
if(is_numeric($id)){
|
||||
$where = array('id' => $id);
|
||||
} else {
|
||||
$where = array("id in ({$id})" => null);
|
||||
}
|
||||
|
||||
$ret = $this->auto_business_model->update($upd, $where);
|
||||
if(!$ret){
|
||||
return $this->show_json(SYS_CODE_FAIL, '保存失败');
|
||||
}
|
||||
|
||||
return $this->show_json(SYS_CODE_SUCCESS, '保存成功');
|
||||
}
|
||||
|
||||
function add_copy(){
|
||||
$id = $this->input->post('id');
|
||||
$row = $this->auto_business_model->get(['id'=>$id]);
|
||||
if(!$row){
|
||||
return $this->show_json(SYS_CODE_FAIL, '参数错误');
|
||||
}
|
||||
$year = date('Y');
|
||||
$month = date('m');
|
||||
$where = [
|
||||
'brand_id' => $row['brand_id'],
|
||||
's_id' => $row['s_id'],
|
||||
'v_id' => $row['v_id'],
|
||||
'city_id' => $row['city_id'],
|
||||
'year' => $year,
|
||||
'month' => $month,
|
||||
'status>='=>0
|
||||
];
|
||||
if($this->auto_business_model->get($where)){
|
||||
return $this->show_json(SYS_CODE_FAIL, '本月该数据已存在');
|
||||
}
|
||||
$data = [
|
||||
'city_id' => $row['city_id'],
|
||||
'brand_id' => $row['brand_id'],
|
||||
's_id' => $row['s_id'],
|
||||
'v_id' => $row['v_id'],
|
||||
'year' => $year,
|
||||
'month' => $month,
|
||||
'status' => 1,
|
||||
'c_time' => time()
|
||||
];
|
||||
$row['price_car'] && $data['price_car'] = $row['price_car'];
|
||||
$row['price_floor'] && $data['price_floor'] = $row['price_floor'];
|
||||
$row['price_coplus'] && $data['price_coplus'] = $row['price_coplus'];
|
||||
$row['price_color'] && $data['price_color'] = $row['price_color'];
|
||||
$this->auto_business_model->add($data);
|
||||
return $this->show_json(SYS_CODE_SUCCESS, '添加成功');
|
||||
}
|
||||
private function valid_data($info){
|
||||
if(!$info['brand_id']){
|
||||
return ['code'=>0,'msg'=>'请选择品牌'];
|
||||
}
|
||||
if(!$info['s_id']){
|
||||
return ['code'=>0,'msg'=>'请选择车系'];
|
||||
}
|
||||
if(!$info['v_id']){
|
||||
return ['code'=>0,'msg'=>'请选择车型'];
|
||||
}
|
||||
if(!$info['city_id']){
|
||||
return ['code'=>0,'msg'=>'请选择城市'];
|
||||
}
|
||||
return ['code'=>1,'msg'=>'验证成功'];
|
||||
}
|
||||
}
|
||||
@@ -325,11 +325,11 @@ class Cars extends HD_Controller{
|
||||
* @return bool
|
||||
*/
|
||||
function json_get(){
|
||||
$brand_id = $this->input->post('brand_id');
|
||||
$s_id = $this->input->post('s_id');
|
||||
$v_id = $this->input->post('v_id');
|
||||
$cor_id = $this->input->post('cor_id');
|
||||
$incor_id = $this->input->post('incor_id');
|
||||
$brand_id = $this->input->get_post('brand_id');
|
||||
$s_id = $this->input->get_post('s_id');
|
||||
$v_id = $this->input->get_post('v_id');
|
||||
$cor_id = $this->input->get_post('cor_id');
|
||||
$incor_id = $this->input->get_post('incor_id');
|
||||
|
||||
$where = array(
|
||||
'status' => 1,
|
||||
@@ -339,12 +339,12 @@ class Cars extends HD_Controller{
|
||||
);
|
||||
$row = $this->auto_cars_model->get($where);
|
||||
|
||||
$data = array(
|
||||
'id' => $row['id'],
|
||||
'price_car' => $row['price_car']
|
||||
);
|
||||
// $data = array(
|
||||
// 'id' => $row['id'],
|
||||
// 'price_car' => $row['price_car']
|
||||
// );
|
||||
|
||||
$this->data = $data;
|
||||
$this->data = $row;
|
||||
|
||||
return $this->show_json(SYS_CODE_SUCCESS);
|
||||
}
|
||||
|
||||
@@ -66,9 +66,9 @@ class Series extends HD_Controller{
|
||||
* @return bool
|
||||
*/
|
||||
public function json_lists(){
|
||||
$brand_id = $this->input->post('brand_id');
|
||||
$page = $this->input->post('page');
|
||||
$size = $this->input->post('size');
|
||||
$brand_id = $this->input->get_post('brand_id');
|
||||
$page = $this->input->get_post('page');
|
||||
$size = $this->input->get_post('size');
|
||||
|
||||
$where = array('status > -1' => null);
|
||||
$brand_id && $where['brand_id'] = $brand_id;
|
||||
|
||||
@@ -0,0 +1,443 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
require_once COMMPATH.'third_party/PHPExcel.php';
|
||||
|
||||
class Settle extends HD_Controller
|
||||
{
|
||||
|
||||
private $biz_type = [
|
||||
1 => ['liche' => 0.25 , 'partner' => 0.75],
|
||||
2 => ['liche' => 0.35 , 'partner' => 0.65],
|
||||
];
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model('auto/auto_brand_model');
|
||||
$this->load->model('auto/auto_series_model');
|
||||
$this->load->model('auto/auto_attr_model');
|
||||
$this->load->model('auto/auto_business_model');
|
||||
|
||||
$this->load->model('items/items_model');
|
||||
|
||||
$this->load->model('biz/biz_model');
|
||||
$this->load->model('biz/biz_settle_model');
|
||||
$this->load->model('biz/biz_settle_static_model');
|
||||
$this->load->model('biz/biz_info_model');
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
$this->lists();
|
||||
}
|
||||
|
||||
public function lists()
|
||||
{
|
||||
$params = $this->input->get();
|
||||
|
||||
$where = array();
|
||||
$t1 = 'lc_biz_settle';
|
||||
$t2 = 'lc_receiver_orders_v2';
|
||||
|
||||
if($params['biz_id']){
|
||||
$where["$t1.biz_id"] = $params['biz_id'];
|
||||
} else{
|
||||
$params['biz_id'] = '';
|
||||
}
|
||||
|
||||
if($params['brand_id']){
|
||||
$where["$t2.brand_id"] = $params['brand_id'];
|
||||
} else{
|
||||
$params['brand_id'] = '';
|
||||
}
|
||||
|
||||
if($params['s_id']){
|
||||
$where["$t2.s_id"] = $params['s_id'];
|
||||
} else{
|
||||
$params['s_id'] = '';
|
||||
}
|
||||
if($params['v_id']){
|
||||
$where["$t2.v_id"] = $params['v_id'];
|
||||
} else{
|
||||
$params['v_id'] = '';
|
||||
}
|
||||
if($params['year']){
|
||||
$where['year'] = $params['year'];
|
||||
}elseif(!isset($params['year'])){
|
||||
$where['year'] = $params['year'] = date('Y');
|
||||
}
|
||||
if($params['month']){
|
||||
$where['month'] = $params['month'];
|
||||
}elseif(!isset($params['month'])){
|
||||
$where['month'] = $params['month'] = intval(date('m'));
|
||||
}
|
||||
$page = $params['page'];
|
||||
$page = !$page ? 1 : $page;
|
||||
$size = $params['size'];
|
||||
$size = !$size ? 20 : $size;
|
||||
|
||||
//获取品牌map
|
||||
$where_brand = array('status > -1' => null);
|
||||
$map_brand = $this->auto_brand_model->map('id', 'name', $where_brand, 'id desc', 0 , 0, 'id, name');
|
||||
|
||||
$total = $this->biz_settle_model->selectOrders($where, '', '', '',1);
|
||||
$lists = array();
|
||||
if($total){
|
||||
$orderby = "$t1.id desc";
|
||||
$select = "$t1.*,$t2.sid,$t2.name,$t2.mobile,$t2.s_id,$t2.v_id,$t2.brand_id,$t2.cor_id,$t2.item_id";
|
||||
$rows = $this->biz_settle_model->selectOrders($where, $orderby, $page, $size,0, $select);
|
||||
if($rows){
|
||||
$s_ids = array_unique(array_filter(array_column($rows,'s_id')));
|
||||
$cor_ids = array_unique(array_filter(array_column($rows,'cor_id')));
|
||||
$v_ids = array_unique(array_filter(array_column($rows,'v_id')));
|
||||
$attr_ids = array_merge($cor_ids,$v_ids);
|
||||
$item_ids = array_unique(array_filter(array_column($rows,'item_id')));
|
||||
//获取车系列表
|
||||
$map_sery = array();
|
||||
if($s_ids){
|
||||
$str_ids = implode(',', $s_ids);
|
||||
$where_sery = array("id in ({$str_ids})" => null);
|
||||
$map_sery = $this->auto_series_model->map('id', 'name', $where_sery, 'id desc', 0, 0, 'id,name');
|
||||
}
|
||||
$map_attr = array();
|
||||
if($attr_ids){
|
||||
$str_ids = implode(',', $attr_ids);
|
||||
$where_attr = array("id in ({$str_ids})" => null);
|
||||
$map_attr = $this->auto_attr_model->map('id', 'title', $where_attr, 'id desc', 0 , 0, 'id, title, type');
|
||||
}
|
||||
$biz_ids = array_unique(array_column($rows,'biz_id'));
|
||||
$map_biz = [];
|
||||
if($biz_ids){
|
||||
$biz_ids = implode(',',array_filter($biz_ids));
|
||||
$where_biz = ["id in ({$biz_ids})" => null];
|
||||
$map_biz = $this->biz_model->map('id', 'biz_name', $where_biz, '', 0, 0, 'id,biz_name');
|
||||
}
|
||||
$map_item = [];
|
||||
if($item_ids){
|
||||
$str_item_ids = implode(',',$item_ids);
|
||||
$where_item = ["id in ({$str_item_ids})" => null];
|
||||
$map_item = $this->items_model->map('id', 'vin', $where_item, '', 0, 0, 'id,vin');
|
||||
}
|
||||
foreach($rows as $v){
|
||||
$title = "{$map_brand[$v['brand_id']]} {$map_sery[$v['s_id']]} {$map_attr[$v['v_id']]} {$map_attr[$v['cor_id']]}";
|
||||
$month = date('Y-m',strtotime("{$v['year']}-{$v['month']}"));
|
||||
$lists[] = array(
|
||||
'id' => $v['id'],
|
||||
'o_id' => $v['o_id'],
|
||||
'title' => $title,
|
||||
'biz_name' => $map_biz[$v['biz_id']],
|
||||
'profix_car' => $v['profix_car'],
|
||||
'profix_insure' => $v['profix_insure'],
|
||||
'profix_carno' => $v['profix_carno'],
|
||||
'profix_loan' => $v['profix_loan'],
|
||||
'price_trucking' => $v['price_trucking'],
|
||||
'name' => $v['name'],
|
||||
'mobile' => $v['mobile'],
|
||||
'sid' => $v['sid'],
|
||||
'month' => $month,
|
||||
'vin' => $map_item[$v['item_id']]
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->data['params'] = $params;
|
||||
$this->data['lists'] = $lists;
|
||||
$this->data['brandAry'] = $map_brand;
|
||||
$this->data['yearAry'] = $this->auto_business_model->year();
|
||||
$this->data['monthAry'] = $this->auto_business_model->month();
|
||||
$this->data['pager'] = array('count' => ceil($total / $size), 'curr' => $page,'totle'=>$total);
|
||||
$this->data['_title'] = '商家结算管理';
|
||||
$this->show_view('biz/settle/lists',true);
|
||||
}
|
||||
|
||||
public function get(){
|
||||
}
|
||||
|
||||
public function add(){
|
||||
|
||||
}
|
||||
|
||||
public function edit()
|
||||
{
|
||||
}
|
||||
|
||||
public function del()
|
||||
{
|
||||
}
|
||||
|
||||
public function batch()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function export()
|
||||
{
|
||||
$biz_id = $this->input->get('id');
|
||||
$month = $this->input->get('month');
|
||||
$year = date('Y');
|
||||
!$month && $month = intval(date('m'));
|
||||
$where = [
|
||||
'biz_id' => $biz_id,
|
||||
'year' => $year,
|
||||
'month' => $month
|
||||
];
|
||||
$type_arr = $this->biz_settle_static_model->other_price_type();
|
||||
$biz = $this->biz_model->get(['id'=>$biz_id],'biz_name');
|
||||
$row = $this->biz_settle_static_model->get($where);
|
||||
$sheet_data = [];
|
||||
if($row){
|
||||
$sheet_data[] = [
|
||||
'门店','单车总毛利','税后单车总毛利','水平业务总毛利',
|
||||
'店面租金','水电费','店长工资','店员工资',
|
||||
'抽成','拖车费','其它费用','总利润',
|
||||
'狸车分润','合伙人分润','时间'];
|
||||
$row['month_str'] = date('Y-m',strtotime("{$row['year']}-{$row['month']}"));
|
||||
$row['total_need'] = $row['rent'] + $row['wat_ele'] + $row['manager_wage'] + $row['employee_wage'] + $row['commission'] + $row['price_trucking'];
|
||||
$row['price_ml'] = $row['price_total'] - $row['total_need'];
|
||||
$other_price = '';
|
||||
$other_json = json_decode($row['price_other'],true);
|
||||
if($other_json){
|
||||
foreach($other_json as $key=>$val){
|
||||
$type_cn = $type_arr[$val['type']];
|
||||
$other_price .= $val['name'].$val['money']."({$type_cn})\n";
|
||||
}
|
||||
}
|
||||
$sheet_data[] = [
|
||||
$biz['biz_name'],
|
||||
$row['profix_car'],
|
||||
$row['profix_car_after'],
|
||||
$row['price_all'],
|
||||
$row['rent'],
|
||||
$row['wat_ele'],
|
||||
$row['manager_wage'],
|
||||
$row['employee_wage'],
|
||||
$row['commission'],
|
||||
$row['price_trucking'],
|
||||
$other_price,
|
||||
$row['price_ml'],
|
||||
$row['profix_liche'],
|
||||
$row['profix_partner'],
|
||||
$row['month_str']
|
||||
];
|
||||
}
|
||||
$t1 = 'lc_biz_settle';
|
||||
$t2 = 'lc_receiver_orders_v2';
|
||||
$where = [
|
||||
"{$t1}.biz_id" => $biz_id,
|
||||
"{$t1}.year" => $year,
|
||||
"{$t1}.month" => $month
|
||||
];
|
||||
$orderby = "$t1.id desc";
|
||||
$select = "$t1.*,$t2.sid,$t2.name,$t2.mobile,$t2.s_id,$t2.v_id,$t2.brand_id,$t2.cor_id,$t2.item_id";
|
||||
$all_rows = $this->biz_settle_model->selectOrders($where, $orderby, 0, 0,0, $select);
|
||||
$sheet_data2 = [];
|
||||
if($all_rows){
|
||||
$sheet_data2[] = ['门店','订单信息','品牌车型','车架号','单车利润','保险利润','贷款利润','挂牌利润','拖车费','时间'];
|
||||
$s_ids = array_unique(array_filter(array_column($all_rows,'s_id')));
|
||||
$cor_ids = array_unique(array_filter(array_column($all_rows,'cor_id')));
|
||||
$v_ids = array_unique(array_filter(array_column($all_rows,'v_id')));
|
||||
$attr_ids = array_merge($cor_ids,$v_ids);
|
||||
$item_ids = array_unique(array_filter(array_column($all_rows,'item_id')));
|
||||
//获取车系列表
|
||||
$map_sery = array();
|
||||
if($s_ids){
|
||||
$str_ids = implode(',', $s_ids);
|
||||
$where_sery = array("id in ({$str_ids})" => null);
|
||||
$map_sery = $this->auto_series_model->map('id', 'name', $where_sery, 'id desc', 0, 0, 'id,name');
|
||||
}
|
||||
$map_attr = array();
|
||||
if($attr_ids){
|
||||
$str_ids = implode(',', $attr_ids);
|
||||
$where_attr = array("id in ({$str_ids})" => null);
|
||||
$map_attr = $this->auto_attr_model->map('id', 'title', $where_attr, 'id desc', 0 , 0, 'id, title, type');
|
||||
}
|
||||
$map_item = [];
|
||||
if($item_ids){
|
||||
$str_item_ids = implode(',',$item_ids);
|
||||
$where_item = ["id in ({$str_item_ids})" => null];
|
||||
$map_item = $this->items_model->map('id', 'vin', $where_item, '', 0, 0, 'id,vin');
|
||||
}
|
||||
foreach($all_rows as $v){
|
||||
$title = "{$map_brand[$v['brand_id']]} {$map_sery[$v['s_id']]} {$map_attr[$v['v_id']]} {$map_attr[$v['cor_id']]}";
|
||||
$vin = $map_item[$v['item_id']];
|
||||
$month_str = date('Y-m',strtotime("{$v['year']}-{$v['month']}"));
|
||||
$sheet_data2[] = array(
|
||||
$biz['biz_name'],
|
||||
"{$v['name']} {$v['mobile']}",
|
||||
$title,
|
||||
$vin,
|
||||
$v['profix_car'],
|
||||
$v['profix_insure'],
|
||||
$v['profix_loan'],
|
||||
$v['profix_carno'],
|
||||
$v['price_trucking'],
|
||||
$month_str,
|
||||
);
|
||||
}
|
||||
}
|
||||
$cells = array('A','B','C','D','E','F','G','H','I','J','K','L','M', 'N','O','P','Q','R','S','T','U','V','W','X','Y','Z');
|
||||
$obpe = new PHPExcel();
|
||||
if($sheet_data){
|
||||
$obpe->setactivesheetindex(0);
|
||||
foreach($sheet_data as $key=>$val){
|
||||
foreach($val as $k2=>$v2){
|
||||
$cell = $cells[$k2];
|
||||
$k = $key+1;
|
||||
$obpe->getactivesheet()->setcellvalue("{$cell}{$k}", $v2);
|
||||
}
|
||||
}
|
||||
}
|
||||
if($sheet_data2){
|
||||
//创建一个新的工作空间(sheet)
|
||||
$obpe->createSheet();
|
||||
$obpe->setactivesheetindex(1);
|
||||
foreach($sheet_data2 as $key=>$val){
|
||||
foreach($val as $k2=>$v2){
|
||||
$cell = $cells[$k2];
|
||||
$k = $key+1;
|
||||
$obpe->getactivesheet()->setcellvalue("{$cell}{$k}", $v2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$filename = $biz['biz_name']."_{$year}年{$month}月_结算表";
|
||||
|
||||
header("Pragma: public");
|
||||
header("Expires: 0");
|
||||
header("Cache-Control:must-revalidate, post-check=0, pre-check=0");
|
||||
header("Content-Type:application/force-download");
|
||||
header("Content-Type:application/vnd.ms-execl");
|
||||
header("Content-Type:application/octet-stream");
|
||||
header("Content-Type:application/download");;
|
||||
header('Content-Disposition:attachment;filename='. $filename .'.xlsx');
|
||||
header("Content-Transfer-Encoding:binary");
|
||||
|
||||
$writer = PHPExcel_IOFactory::createWriter($obpe, 'Excel2007');
|
||||
$writer->save('php://output');
|
||||
}
|
||||
//统计合计
|
||||
public function lists_static(){
|
||||
$params = $this->input->get();
|
||||
|
||||
$where = [];
|
||||
if($params['year']){
|
||||
$where['year'] = $params['year'];
|
||||
}elseif(!isset($params['year'])){
|
||||
$where['year'] = $params['year'] = date('Y');
|
||||
}
|
||||
if($params['month']){
|
||||
$where['month'] = $params['month'];
|
||||
}elseif(!isset($params['month'])){
|
||||
$where['month'] = $params['month'] = intval(date('m'));
|
||||
}
|
||||
if($params['id']){
|
||||
$where['biz_id'] = $params['id'];
|
||||
}
|
||||
$page = $params['page'];
|
||||
$page = !$page ? 1 : $page;
|
||||
$size = $params['size'];
|
||||
$size = !$size ? 20 : $size;
|
||||
|
||||
$total = $this->biz_settle_static_model->count($where);
|
||||
$lists = array();
|
||||
if($total){
|
||||
$orderby = 'id desc';
|
||||
$select = '*';
|
||||
$rows = $this->biz_settle_static_model->select($where, $orderby, $page, $size, $select);
|
||||
if($rows){
|
||||
$biz_ids = array_unique(array_column($rows,'biz_id'));
|
||||
$map_biz = [];
|
||||
if($biz_ids){
|
||||
$biz_ids = implode(',',$biz_ids);
|
||||
$where_biz = ["id in ({$biz_ids})" => null];
|
||||
$map_biz = $this->biz_model->map('id', 'biz_name', $where_biz, '', 0, 0, 'id,biz_name');
|
||||
}
|
||||
//属性按'车型-车身颜色-内饰颜色'排序
|
||||
foreach($rows as $v){
|
||||
$temp = $v;
|
||||
$temp['biz_name'] = $map_biz[$v['biz_id']];
|
||||
$temp['month_str'] = date('Y-m',strtotime("{$v['year']}-{$v['month']}"));
|
||||
$temp['price_other'] = $v['price_other'] ? json_decode($v['price_other']) : [];
|
||||
$temp['total_need'] = $v['rent'] + $v['wat_ele'] + $v['manager_wage'] + $v['employee_wage'] + $v['commission'] + $v['price_trucking'];
|
||||
$temp['price_ml'] = $v['price_total'] - $temp['total_need'];
|
||||
$lists[] = $temp;
|
||||
}
|
||||
}
|
||||
}
|
||||
$this->data['params'] = $params;
|
||||
$this->data['lists'] = $lists;
|
||||
$this->data['yearAry'] = $this->auto_business_model->year();
|
||||
$this->data['monthAry'] = $this->auto_business_model->month();
|
||||
$this->data['type_arr'] = $this->biz_settle_static_model->other_price_type();
|
||||
$this->data['pager'] = array('count' => ceil($total / $size), 'curr' => $page,'totle'=>$total);
|
||||
$this->data['_title'] = '商家结算管理';
|
||||
$this->show_view('biz/settle/lists_static',true);
|
||||
|
||||
}
|
||||
|
||||
//重新统计
|
||||
public function edit_static(){
|
||||
$id = $this->input->post('id');
|
||||
$row = $this->biz_settle_static_model->get(['id'=>$id]);
|
||||
if(!$row){
|
||||
return $this->show_json(SYS_CODE_FAIL, '参数错误!');
|
||||
}
|
||||
$all_other = 0; //共同承担其它费用
|
||||
$liche_other = 0; //狸车承担其它费用
|
||||
$partner_other = 0; //合伙人承担其它费用
|
||||
$price_other = json_decode($row['price_other'],true);
|
||||
if($price_other){
|
||||
foreach($price_other as $item){
|
||||
if($item['type']==2){
|
||||
$partner_other += $item['money'];
|
||||
}elseif($item['type']==1){
|
||||
$liche_other += $item['money'];
|
||||
}else{
|
||||
$all_other += $item['money'];
|
||||
}
|
||||
}
|
||||
}
|
||||
$biz_info = $this->biz_info_model->get(['biz_id'=>$row['biz_id']]);
|
||||
$type_config = $this->biz_type[$biz_info['type']];
|
||||
$price_need = $row['rent'] + $row['wat_ele'] + $row['employee_wage'] + $row['manager_wage'] + $row['commission'] + $row['price_trucking'];
|
||||
$price_ml = $row['price_total'] - $price_need - $all_other;
|
||||
$update['profix_liche'] = $price_ml*$type_config['liche']-$liche_other;
|
||||
$update['profix_partner'] = $price_ml*$type_config['partner']-$partner_other;
|
||||
$this->biz_settle_static_model->update($update,['id'=>$row['id']]);
|
||||
|
||||
return $this->show_json(SYS_CODE_SUCCESS, '操作成功');
|
||||
}
|
||||
|
||||
public function add_price(){
|
||||
$id = $this->input->get_post('id');
|
||||
$row = $this->biz_settle_static_model->get(['id'=>$id]);
|
||||
if(!$row){
|
||||
return $this->show_json(SYS_CODE_FAIL, '参数错误!');
|
||||
}
|
||||
if($this->input->method()=='post'){
|
||||
$lists = $this->input->post('lists');
|
||||
if(!is_array($lists)){
|
||||
return $this->show_json(SYS_CODE_FAIL, '参数错误!');
|
||||
}
|
||||
$price_other = [];
|
||||
foreach($lists as $key=>$val){
|
||||
if($val['money']){
|
||||
$price_other[] = [
|
||||
'name' => $val['name'],
|
||||
'money' => $val['money'],
|
||||
'type' => $val['type'] ? $val['type'] : 0
|
||||
];
|
||||
}
|
||||
}
|
||||
$up_data['price_other'] = json_encode($price_other,JSON_UNESCAPED_UNICODE);
|
||||
$this->biz_settle_static_model->update($up_data,['id'=>$id]);
|
||||
return $this->show_json(SYS_CODE_SUCCESS, '操作成功');
|
||||
}
|
||||
$lists = $row['price_other'] ? json_decode($row['price_other']) : [];
|
||||
$this->data['id'] = $id;
|
||||
$this->data['lists'] = $lists;
|
||||
$this->data['type_arr'] = $this->biz_settle_static_model->other_price_type();
|
||||
$this->show_view('biz/settle/add');
|
||||
}
|
||||
}
|
||||
@@ -18,7 +18,10 @@ class Store extends HD_Controller
|
||||
$this->load->helper('image_helper');
|
||||
$this->load->model("biz/biz_model");
|
||||
$this->load->model("biz/biz_tagdata_model");
|
||||
$this->load->model("biz/biz_info_model");
|
||||
$this->load->model("biz/biz_trucking_model");
|
||||
$this->load->model('app/licheb/app_licheb_users_model', 'mdLichebUsers');
|
||||
$this->load->model('auto/auto_brand_model');
|
||||
|
||||
$this->load->model("biz/biz_brand_model", 'bizBrand');
|
||||
$this->load->model('area_model');
|
||||
@@ -105,6 +108,7 @@ class Store extends HD_Controller
|
||||
$v['brand_name'] = $brand['brand_name'];
|
||||
$v['c_time'] = date('Y-m-d H:i:s', $v['c_time']);
|
||||
$v['type_name'] = $typeAry[$v['type']];
|
||||
$v['type'] = $v['type'];
|
||||
$bizlists[] = $v;
|
||||
}
|
||||
|
||||
@@ -163,6 +167,7 @@ class Store extends HD_Controller
|
||||
|
||||
if ($id) {
|
||||
$biz = $this->biz_model->get(array('id' => $id, 'status>-1' => null));
|
||||
|
||||
if (!$biz || empty($biz)) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '店铺不存在!');
|
||||
}
|
||||
@@ -216,7 +221,8 @@ class Store extends HD_Controller
|
||||
'province_id' => '350',
|
||||
'type' => 0,
|
||||
'company_id' => 0,
|
||||
'auto_brands' => array()
|
||||
'auto_brands' => array(),
|
||||
'car_brand_id' => 0
|
||||
);//默认福建城市
|
||||
$this->data['biz'] = $biz;
|
||||
}
|
||||
@@ -262,6 +268,11 @@ class Store extends HD_Controller
|
||||
$biz['type'] = intval($this->input->post('type', true));
|
||||
$biz['company_id'] = intval($this->input->post('company_id', true));
|
||||
$biz['srv_company_id'] = intval($this->input->post('srv_company_id', true));
|
||||
$biz['car_brand_id'] = intval($this->input->post('car_brand_id',true));
|
||||
|
||||
if ($biz['type']==1 && !$biz['car_brand_id']){
|
||||
return $this->show_json(SYS_CODE_FAIL, '请选择车型品牌');
|
||||
}
|
||||
|
||||
$auto_brands = $this->input->post('auto_brands');
|
||||
if ($auto_brands) {
|
||||
@@ -329,7 +340,11 @@ class Store extends HD_Controller
|
||||
$biz['type'] = intval($this->input->post('type', true));
|
||||
$biz['company_id'] = intval($this->input->post('company_id', true));
|
||||
$biz['srv_company_id'] = intval($this->input->post('srv_company_id', true));
|
||||
$biz['car_brand_id'] = intval($this->input->post('car_brand_id',true));
|
||||
|
||||
if ($biz['type']==1 && !$biz['car_brand_id']){
|
||||
return $this->show_json(SYS_CODE_FAIL, '请选择车型品牌');
|
||||
}
|
||||
//上传头像
|
||||
$biz['headimg'] = $this->input->post('headimg');
|
||||
|
||||
@@ -997,5 +1012,96 @@ class Store extends HD_Controller
|
||||
end:
|
||||
return array($status, $data, $msg);
|
||||
}
|
||||
|
||||
public function get_info(){
|
||||
$biz_id = $this->input->get('id');
|
||||
if(!$this->biz_model->get(['id'=>$biz_id])){
|
||||
return $this->show_json(SYS_CODE_FAIL, '店铺不存在!');
|
||||
}
|
||||
$base_info = $this->biz_info_model->get(['biz_id'=>$biz_id]);
|
||||
if(!$base_info){
|
||||
$this->biz_info_model->add(['biz_id'=>$biz_id,'c_time'=>time()]);
|
||||
$base_info = $this->biz_info_model->get(['biz_id'=>$biz_id]);
|
||||
}
|
||||
$info = [
|
||||
'id' => $base_info['id'],
|
||||
'biz_id' => $base_info['biz_id'],
|
||||
'name' => $base_info['name'],
|
||||
'mobile' => $base_info['mobile'],
|
||||
'margin' => $base_info['margin'],
|
||||
'area' => $base_info['area'],
|
||||
'rent' => $base_info['rent'],
|
||||
'wat_ele' => $base_info['wat_ele'],
|
||||
'employee_wage' => $base_info['employee_wage'],
|
||||
'manager_wage' => $base_info['manager_wage'],
|
||||
'commission' => $base_info['commission'],
|
||||
's_time' => $base_info['s_time'] ? date('Y-m-d',$base_info['s_time']) : '',
|
||||
'e_time' => $base_info['e_time'] ? date('Y-m-d',$base_info['e_time']) : '',
|
||||
'type' => $base_info['type'],
|
||||
];
|
||||
$brands = [];
|
||||
$b_rows = $this->biz_trucking_model->select(['biz_id'=>$base_info['biz_id'],'status'=>1],'','','','auto_b_id,money');
|
||||
if($b_rows){
|
||||
$auto_b_ids = array_column($b_rows,'auto_b_id');
|
||||
$auto_b_ids = $auto_b_ids ? implode(',',$auto_b_ids) : 0;
|
||||
$where["id in ($auto_b_ids)"] = null;
|
||||
$auto_rows = $this->auto_brand_model->map('id','name',$where,'','','','id,name');
|
||||
foreach($b_rows as $key=>$val){
|
||||
$brands[] = [
|
||||
'id' => $val['auto_b_id'],
|
||||
'name' => $auto_rows[$val['auto_b_id']],
|
||||
'money' => $val['money']
|
||||
];
|
||||
}
|
||||
}
|
||||
$this->data['type_arr'] = [1=>'扩展',2=>'新增'];
|
||||
$this->data['brands'] = $brands;
|
||||
$this->data['info'] = $info;
|
||||
$this->data['_title'] = '编辑门店基本信息';
|
||||
$this->show_view('biz/store/get_info', true);
|
||||
}
|
||||
public function edit_info(){
|
||||
$info = $this->input->post('info');
|
||||
$brands = $this->input->post('brands');
|
||||
|
||||
if(!$this->biz_info_model->get(['id'=>$info['id']])){
|
||||
return $this->show_json(SYS_CODE_FAIL, '错数错误!');
|
||||
}
|
||||
$up_data = [
|
||||
'name' => $info['name'],
|
||||
'mobile' => $info['mobile'],
|
||||
'margin' => $info['margin'],
|
||||
'area' => $info['area'],
|
||||
'rent' => $info['rent'],
|
||||
'wat_ele' => $info['wat_ele'],
|
||||
'employee_wage' => $info['employee_wage'],
|
||||
'manager_wage' => $info['manager_wage'],
|
||||
'commission' => $info['commission'],
|
||||
's_time' => $info['s_time'] ? strtotime($info['s_time']) : 0,
|
||||
'e_time' => $info['e_time'] ? strtotime($info['e_time']) : 0,
|
||||
'type' => $info['type'],
|
||||
];
|
||||
$this->biz_info_model->update($up_data,['id'=>$info['id']]);
|
||||
$b_ids = array_column($brands,'id');
|
||||
if($b_ids){
|
||||
$b_ids = implode(',',$b_ids);
|
||||
$this->biz_trucking_model->update(['status'=>-1],["auto_b_id not in ({$b_ids})"=>null,'biz_id'=>$info['biz_id']]);
|
||||
foreach($brands as $key=>$val){
|
||||
$s_row = $this->biz_trucking_model->get(['biz_id'=>$info['biz_id'],'auto_b_id'=>$val['id']]);
|
||||
$data = [
|
||||
'money' => $val['money'],
|
||||
'status' => 1
|
||||
];
|
||||
if($s_row){
|
||||
$this->biz_trucking_model->update($data,['id'=>$s_row['id']]);
|
||||
}else{
|
||||
$data['biz_id'] = $info['biz_id'];
|
||||
$data['auto_b_id'] = $val['id'];
|
||||
$data['c_time'] = time();
|
||||
$this->biz_trucking_model->add($data);
|
||||
}
|
||||
}
|
||||
}
|
||||
return $this->show_json(SYS_CODE_SUCCESS, '操作成功');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,827 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
class Orders extends HD_Controller
|
||||
{
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model('receiver/order/receiver_orders_v2_model');
|
||||
$this->load->model('receiver/order/receiver_order_status_model');
|
||||
$this->load->model('receiver/order/receiver_order_datas_model');
|
||||
$this->load->model('receiver/order/receiver_order_signs_model', 'order_signs_model');
|
||||
$this->load->model('receiver/order/receiver_order_loans_model', 'order_loans_model');
|
||||
$this->load->model('receiver/order/receiver_order_ckcars_model', 'order_ckcars_model');
|
||||
$this->load->model('receiver/order/receiver_order_bills_model', 'order_bills_model');
|
||||
$this->load->model('receiver/order/receiver_order_agents_model', 'order_agents_model');
|
||||
$this->load->model('receiver/order/receiver_order_deliverys_model', 'order_deliverys_model');
|
||||
$this->load->model('receiver/order/receiver_order_contracts_model', 'order_contracts_model');
|
||||
$this->load->model('receiver/receiver_customers_model', 'customers_model');
|
||||
$this->load->model('auto/auto_series_model');
|
||||
$this->load->model('auto/auto_brand_model');
|
||||
$this->load->model('auto/auto_attr_model');
|
||||
$this->load->model('auto/auto_finance_model');
|
||||
$this->load->model('sys/sys_finance_model');
|
||||
$this->load->model('sys/sys_company_model');
|
||||
$this->load->model('app/liche/app_liche_orders_model');
|
||||
$this->load->model('app/app_checkdata_model');
|
||||
|
||||
$this->load->library('receiver/orders_entity');
|
||||
$this->load->library('receiver/orders_v2_entity');
|
||||
$this->load->library('receiver/orders_status_entity');
|
||||
$this->load->library('receiver/order_datas_entity');
|
||||
$this->load->library('Ordersv2List');
|
||||
$this->load->library('qyrobot');
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
$this->lists();
|
||||
}
|
||||
|
||||
public function lists()
|
||||
{
|
||||
$params = $this->input->get();
|
||||
$statusAry = $this->receiver_order_status_model->statusAry();
|
||||
$status_arr = array();
|
||||
$t1 = 'lc_receiver_orders_v2';
|
||||
$t2 = 'lc_receiver_order_status';
|
||||
foreach ($statusAry as $key => $value) {
|
||||
if (!$value['show']) {
|
||||
continue;
|
||||
}
|
||||
$cate = $where = array();
|
||||
$where = ["$t1.status<>" => -1];
|
||||
if(is_product()){
|
||||
$where["{$t1}.brand_id<>3"] = null;//狸车品牌不显示
|
||||
$where["{$t1}.biz_id<>1"] = null;//biz_id=1不显示
|
||||
}
|
||||
if ($value['list']) {
|
||||
foreach ($value['list'] as $key2 => $value2) {
|
||||
if($key2){
|
||||
$where_s = [];
|
||||
$key==1 && $where_s["{$t1}.payway"] = 0;//分期
|
||||
if($key2){
|
||||
$where_s["{$t2}.pid_status"] = $value['pid_status'];
|
||||
$up_key = $key2+1;
|
||||
$where_s["{$t2}.status in ({$key2},{$up_key})"] = null;
|
||||
}
|
||||
$where_s = array_merge($where,$where_s);
|
||||
$count2 = $this->receiver_orders_v2_model->selectOrders($where_s,'','', '', 1);
|
||||
}else{
|
||||
$where_s = [
|
||||
"id not in (select o_id from lc_receiver_order_status where pid_status={$value['pid_status']} and status=1)" => null
|
||||
];
|
||||
$key==1 && $where_s['payway'] = 0;
|
||||
$where_s = array_merge($where,$where_s);
|
||||
$count2 = $this->receiver_orders_v2_model->count($where_s);
|
||||
}
|
||||
$cate[] = array("id" => $key2, "name" => $value2, "count" => $count2);
|
||||
}
|
||||
}
|
||||
$status_arr[] = array("id" => $key, "name" => $value['name'], "cate" => $cate, "count" => 0);
|
||||
}
|
||||
$where = ["{$t1}.status<>" => -1];
|
||||
if(is_product()){
|
||||
$where["{$t1}.brand_id<>"] = 3;//狸车品牌不显示
|
||||
$where["{$t1}.biz_id<>"] = 1;//biz_id=1不显示
|
||||
}
|
||||
$params['status_pid'] == 5 && $params['status'] = 1;
|
||||
$params['count_all'] = $this->receiver_orders_v2_model->count($where);//全部
|
||||
$params['list_type'] = 'all';
|
||||
$result = $this->ordersv2list->lists($params['status_pid'], $params);
|
||||
$this->data = $result;
|
||||
$this->data['status_arr'] = $status_arr;
|
||||
return $this->show_view($result['view'], true);
|
||||
}
|
||||
|
||||
public function get()
|
||||
{
|
||||
$id = $this->input->get('id');
|
||||
|
||||
$row = $this->receiver_orders_v2_model->get(['id' => $id]);
|
||||
$customers = $this->customers_model->get(['id' => $row['customer_id']], 'cf_title');
|
||||
if (!$row) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '订单不存在!');
|
||||
}
|
||||
$money_json = json_decode($row['money_json'], true);
|
||||
$deposit = $money_json['price_book'];
|
||||
$jsondata = $row['jsondata'] ? json_decode($row['jsondata'], true) : array();
|
||||
$row['price_discount'] = $money_json['price_discount'];
|
||||
//售价详细信息
|
||||
$sale_detail = "指导价:".number_format($money_json['price_car'],2);
|
||||
$money_json['price_discount'] && $sale_detail .= ',优惠金额:'.number_format($money_json['price_discount'],2);
|
||||
$money_json['price_color'] && $sale_detail .= ',颜色加价:'.number_format($money_json['price_color'],2);
|
||||
$money_json['price_coplus'] && $sale_detail .= ',公司加价:'.number_format($money_json['price_coplus'],2);
|
||||
$row['sale_detail'] = $sale_detail;
|
||||
$sale_price = $this->orders_v2_entity->total_price($row['id']);
|
||||
$row['sale_price'] = number_format($sale_price, 2);
|
||||
$row['info_json'] = json_decode($row['info_json'], true);
|
||||
$row['status'] = intval($row['status']);
|
||||
$row['price'] = number_format($money_json['price_car'], 2);
|
||||
$row['deposit'] = number_format($deposit, 2);
|
||||
$row['c_time'] = date('Y-m-d', $row['c_time']);
|
||||
$row['cf_title'] = $customers['cf_title'];
|
||||
$row['payway'] = intval($row['payway']);
|
||||
$row['item_id'] = intval($row['item_id']);
|
||||
$row['cardid'] = $row['info_json']['c_cardid'] ? $row['info_json']['c_cardid'] :'';
|
||||
$row['address'] = $row['info_json']['c_address'] ? $row['info_json']['c_address'] : '';
|
||||
$row['owner_cardid'] = $row['info_json']['c_owner_cardid'] ? $row['info_json']['c_owner_cardid'] : '';
|
||||
$row['credit'] = $row['info_json']['c_credit'] ? $row['info_json']['c_credit'] : '';
|
||||
$row['company'] = $row['info_json']['c_company'] ? $row['info_json']['c_company'] : '';
|
||||
$row['note'] = $jsondata['note'] ? $jsondata['note'] : '';
|
||||
//获取车信息
|
||||
$brand = $this->auto_brand_model->get(['id' => $row['brand_id']], 'name');
|
||||
$serie = $this->auto_series_model->get(['id' => $row['s_id']], 'name');
|
||||
$row['brand_name'] = $brand['name'];
|
||||
$row['s_name'] = $serie['name'];
|
||||
$attr_arr = [$row['v_id'], $row['cor_id'], $row['incor_id']];
|
||||
$attr = $this->auto_attr_model->get_map_by_ids($attr_arr, 'id,title');
|
||||
$row['v_name'] = isset($attr[$row['v_id']]) ? $attr[$row['v_id']][0]['title'] : '';
|
||||
$row['cor_name'] = isset($attr[$row['cor_id']]) ? $attr[$row['cor_id']][0]['title'] : '';
|
||||
$row['incor_name'] = isset($attr[$row['incor_id']]) ? $attr[$row['incor_id']][0]['title'] : '';
|
||||
//获取选择车辆vin
|
||||
if ($row['item_id']) {
|
||||
$this->load->model('items/items_model', 'mdItems');
|
||||
$row_goods = $this->mdItems->get(array('id' => $row['item_id']));
|
||||
$row['vin'] = $row_goods['vin'];
|
||||
}
|
||||
$row['delry_time'] = $row['delry_time'] != '0000-00-00 00:00:00'
|
||||
? str_replace(" 00:00:00", "", $row['delry_time']) : '';
|
||||
//获取车辆服务费
|
||||
$srv_info = $this->orders_v2_entity->order_srv_money($row['id'], 2);
|
||||
$srv_info['total'] = number_format($srv_info['total'], 2);
|
||||
$srv_detail = "";
|
||||
if ($srv_info['list']) {
|
||||
foreach ($srv_info['list'] as $key => $val) {
|
||||
$d = $srv_detail ? ',' : '';
|
||||
$srv_detail .= $d . $val['title'] . ":" . number_format($val['money'], 2);
|
||||
}
|
||||
}
|
||||
$srv_info['detail'] = $srv_detail;
|
||||
$row['srv_info'] = $srv_info;
|
||||
//获取贷款信息
|
||||
if (!$row['payway']) {
|
||||
$loan = $this->order_loans_model->get(['o_id' => $row['id']]);
|
||||
|
||||
$loan['notify_file'] = $loan['notify_file'] ? build_qiniu_image_url($loan['notify_file']) : '';
|
||||
$loan['notify_file_name'] = $loan['notify_file'] ? end(explode('/', $loan['notify_file'])) : '';
|
||||
$loan['lend_file'] = $loan['lend_file'] ? build_qiniu_image_url($loan['lend_file']) : '';
|
||||
$loan['lend_file_name'] = $loan['lend_file'] ? end(explode('/', $loan['lend_file'])) : '';
|
||||
|
||||
$loan['finance_rows'] = $this->sys_finance_model->select(['status' => 1], '', 0, 0, 'id,title');
|
||||
$loan['price_loan'] = $money_json['price_loan'] ? $money_json['price_loan'] : '';
|
||||
$loan['first_pay'] = 0;
|
||||
if ($money_json['price_loan']) {
|
||||
$loan['first_pay'] = $sale_price - $money_json['price_loan'];
|
||||
}
|
||||
!$loan['num'] && $loan['num'] = 12;
|
||||
$loan['loan_time'] = $loan['loan_time'] != '0000-00-00 00:00:00' ? date('Y-m-d', strtotime($loan['loan_time'])) : '';
|
||||
$status_array = $this->receiver_order_status_model->select(['o_id'=>$row['id'],'pid_status'=>1],'','','id,status');
|
||||
$loan['status_array'] = array_column($status_array,'status');
|
||||
$row['loan_info'] = $loan;
|
||||
}
|
||||
//获取审核资料信息
|
||||
$img_data = $this->receiver_order_datas_model->get(['o_id'=>$row['id'],'status>='=>0]);
|
||||
$row['imgs_status'] = $this->order_datas_entity->data_ckinfo($img_data,$row['main_type']);
|
||||
|
||||
//获取开票
|
||||
$bill = $this->order_bills_model->get(['o_id' => $row['id']], 'status,file');
|
||||
$bill_status = $this->receiver_order_status_model->get(['o_id'=>$row['id'],'pid_status'=>3,'status'=>1]); //是否已开票
|
||||
$bill['file'] = $bill['file'] ? build_qiniu_image_url($bill['file']) : '';
|
||||
$bill['file_type'] = $bill['file'] && strstr($bill['file'], '.pdf') ? 'pdf' : 'img';
|
||||
$bill['cardidA'] = $img_data['cardida'];
|
||||
$bill['cardidB'] = $img_data['cardidb'];
|
||||
$bill['business_licence'] = $img_data['business_licence'];
|
||||
$bill['status'] = $bill_status ? 1 : 0;
|
||||
$row_goods['company_id'] && $item_company = $this->sys_company_model->get(['id'=>$row_goods['company_id']],'id,short');
|
||||
if(!$item_company){
|
||||
$item_html = '车辆归属<b>未选择</b>';
|
||||
}else{
|
||||
$item_html = "车辆公司归属<b>【{$item_company['short']}】</b>";
|
||||
}
|
||||
$pay_order = $this->app_liche_orders_model->get(['type'=>3,'status'=>1,'o_id'=>$row['id']],'mch_id');
|
||||
$pay_order && $pay_compay = $this->sys_company_model->get(['wx_mchid' => $pay_order['mch_id']],'id,short');
|
||||
$pay_html = '';
|
||||
if($pay_compay){
|
||||
$ck_html = $pay_compay['id'] == $item_company['id'] ? '<b class="am-text-success">一致</b>' : '<b class="am-text-warning">不一致</b>';
|
||||
$pay_html = "与尾款收款公司<b>【{$pay_compay['short']}】</b> {$ck_html}";
|
||||
}
|
||||
$bill['warning'] = $item_html. $pay_html;
|
||||
$row['bill'] = $bill;
|
||||
//获取合同文件
|
||||
$contracts = $this->order_contracts_model->select(['o_id' => $row['id'], 'status' => 1], '', '', '', 'id,type,file,status');
|
||||
$contract_data = [];
|
||||
if ($contracts) {
|
||||
foreach ($contracts as $key => $val) {
|
||||
$contract_data[$val['type']] = [
|
||||
'type' => $val['type'],
|
||||
'status' => $val['status'],
|
||||
// 'src' => http_host_com('api').'/'.$val['file'],
|
||||
'src' => http_host_com('api').'/wxapp/licheb/protocol/pdf_img?id='.$val['id'],
|
||||
];
|
||||
}
|
||||
}
|
||||
$row['contract_data'] = $contract_data;
|
||||
|
||||
//获取销售员
|
||||
if ($row['sale_id']) {
|
||||
$this->load->model('app/licheb/app_licheb_users_model', 'licheb_users_model');
|
||||
$this->load->model("biz/biz_model");
|
||||
$row_admin = $this->licheb_users_model->get(array('id' => $row['sale_id']));
|
||||
$biz_id = $row_admin['biz_id'];
|
||||
$row_biz = array();
|
||||
if ($biz_id) {
|
||||
$row_biz = $this->biz_model->get(array('id' => $biz_id));
|
||||
}
|
||||
$admin_name = $row_admin ? "{$row_biz['biz_name']} {$row_admin['uname']}" : "";
|
||||
$row['admin_name'] = $admin_name;
|
||||
}
|
||||
$info = $row;
|
||||
$this->data['info'] = $info;
|
||||
|
||||
$this->data['_title'] = '订单详情';
|
||||
return $this->show_view('receiver/orderv2/get/index', true);
|
||||
}
|
||||
|
||||
//添加单条数据
|
||||
public function add()
|
||||
{
|
||||
}
|
||||
|
||||
//编辑单条数据
|
||||
public function edit()
|
||||
{
|
||||
$params = $this->input->post();
|
||||
if (!$params['id']) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '参数错误!');
|
||||
}
|
||||
$result = '';
|
||||
if ($params['type'] == 1) {//修改备注
|
||||
$re = $this->receiver_orders_v2_model->get(['id' => $params['id']]);
|
||||
$jsondata = json_decode($re['jsondata'], true);
|
||||
$jsondata['note'] = $params['note'];
|
||||
$upd = array('jsondata' => json_encode($jsondata, JSON_UNESCAPED_UNICODE));
|
||||
$result = $this->receiver_orders_v2_model->update($upd, ['id' => $params['id']]);
|
||||
} else if ($params['type'] == 2) {//修改营业执照
|
||||
if (!$params['business_licence']) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '请上传营业执照');
|
||||
}
|
||||
if (!$this->order_bills_model->get(['o_id' => $params['id']])) {
|
||||
$this->order_bills_model->add(['o_id' => $params['id'], 'c_time' => time()]);
|
||||
}
|
||||
$result = $this->order_bills_model->update(array('business_licence' => $params['business_licence']), ['o_id' => $params['id']]);
|
||||
}
|
||||
if ($result) {
|
||||
return $this->show_json(SYS_CODE_SUCCESS, '保存成功');
|
||||
} else {
|
||||
return $this->show_json(SYS_CODE_FAIL, '保存失败');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新身份证信息
|
||||
* @return bool
|
||||
*/
|
||||
function edit_cardID()
|
||||
{
|
||||
$o_id = $this->input->post('o_id');
|
||||
$cardidA = $this->input->post('cardidA');
|
||||
$cardidB = $this->input->post('cardidB');
|
||||
if (!$this->receiver_order_datas_model->get(['o_id' => $o_id])) {
|
||||
$this->order_bills_model->add(['o_id' => $o_id, 'c_time' => time()]);
|
||||
}
|
||||
if (!$cardidA || !$cardidB) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '请上传身份证照片');
|
||||
}
|
||||
|
||||
$this->load->library('TcOrc');
|
||||
$cardidA_src = build_qiniu_image_url($cardidA);
|
||||
$result = $this->tcorc->IdentityCard($cardidA_src);
|
||||
if (!$result['code']) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '身份证校验不通过');
|
||||
} else {
|
||||
//校验姓名
|
||||
$uname = $result['data']['Name'];
|
||||
$row_order = $this->receiver_orders_v2_model->get(['id' => $o_id]);
|
||||
if ($uname != $row_order['name']) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '身份证姓名与客户不一致');
|
||||
}
|
||||
}
|
||||
|
||||
$upd = array(
|
||||
'cardidA' => $cardidA,
|
||||
'cardidB' => $cardidB,
|
||||
'status' => 1
|
||||
);
|
||||
$result = $this->order_bills_model->update($upd, ['o_id' => $o_id]);
|
||||
if ($result) {
|
||||
return $this->show_json(SYS_CODE_SUCCESS, '保存成功');
|
||||
} else {
|
||||
return $this->show_json(SYS_CODE_FAIL, '保存失败');
|
||||
}
|
||||
}
|
||||
|
||||
//删除单条数据
|
||||
public function del()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//批量操作(默认修改状态)
|
||||
public function batch()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//导出数据列表
|
||||
public function export()
|
||||
{
|
||||
$params = $this->input->get();
|
||||
$params['page'] = 1;
|
||||
$params['size'] = 10000;
|
||||
$indexs = [];
|
||||
if ($params['export_type']) {
|
||||
$result = $this->orderslist->export_data($params['status_pid'], $params);
|
||||
$fileName = '保险明细';
|
||||
$data = $result['data'];
|
||||
$indexs = $result['indexs'];
|
||||
} else {
|
||||
$fieldAry = $this->orderslist->get_fields($params['status_pid'], 1);
|
||||
foreach ($fieldAry as $key => $value) {
|
||||
$indexs[$key] = $value['title'];
|
||||
}
|
||||
$result = $this->orderslist->lists($params['status_pid'], $params);
|
||||
$fileName = $result['_title'];
|
||||
foreach ($result['lists'] as $key => $value) {
|
||||
$temp = array();
|
||||
foreach ($fieldAry as $key2 => $value2) {
|
||||
$temp[$key2] = $value[$key2];
|
||||
}
|
||||
$data[] = $temp;
|
||||
}
|
||||
array_unshift($data, $indexs);
|
||||
}
|
||||
$this->load->library('excel');
|
||||
return $this->excel->out_csv($data, $indexs, $fileName . "_" . date('YmdHis'));
|
||||
}
|
||||
|
||||
//修改分期
|
||||
public function edit_loan()
|
||||
{
|
||||
$params = $this->input->post();
|
||||
$info = $params['info'];
|
||||
$oid = $params['id'] ? $params['id'] : $info['id'];
|
||||
$file = $_FILES['file'];
|
||||
$row = $this->order_loans_model->get(['o_id' => $oid]);
|
||||
if (!$row) {
|
||||
$this->order_loans_model->add(['o_id' => $oid, 'c_time' => time()]);
|
||||
$row = $this->order_loans_model->get(['o_id' => $oid]);
|
||||
}
|
||||
$update = [];
|
||||
if ($file) { //上传按揭通知函
|
||||
$path = FCPATH . 'temp/';
|
||||
if (!file_exists($path)) {
|
||||
$oldumask = umask(0);
|
||||
mkdir($path, 0777, true);
|
||||
umask($oldumask);
|
||||
}
|
||||
$file_name = md5($file['name'] . uniqid()) . '.' . end(explode('.', $file['name']));
|
||||
$tmp = $path . $file_name;
|
||||
move_uploaded_file($file['tmp_name'], $tmp);
|
||||
|
||||
if (!filesize($tmp)) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '上传文件失败!');
|
||||
}
|
||||
$this->load->library('qiniu');
|
||||
$res = $this->qiniu->save($file_name, file_get_contents($tmp));
|
||||
unlink($tmp);
|
||||
if (!$res) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '上传文件失败!');
|
||||
}
|
||||
if ($params['type']) {
|
||||
$update['lend_file'] = $res['file'];
|
||||
} else {
|
||||
$update['notify_file'] = $res['file'];
|
||||
}
|
||||
$this->data['file_url'] = build_qiniu_image_url($res['file']);
|
||||
}
|
||||
strlen($params['status']) && $update['status'] = $params['status'];
|
||||
if ($params['status'] == 1) { //等待放款
|
||||
$finance_id = $info['finance_id'];
|
||||
$price_loan = $info['loan_info']['price_loan'];
|
||||
if (!$row['notify_file']) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '请先上传按揭通知函!');
|
||||
}
|
||||
if (!$finance_id || !$price_loan) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '请填写完整信息!');
|
||||
}
|
||||
$order_row = $this->receiver_orders_v2_model->get(['id' => $row['o_id']], 'id,mobile,money_json');
|
||||
$money_json = json_decode($order_row['money_json'], true);
|
||||
$money_json['price_loan'] = $price_loan;
|
||||
$this->receiver_orders_v2_model->update(['finance_id' => $finance_id, 'money_json' => json_encode($money_json, JSON_UNESCAPED_UNICODE)], ['id' => $row['o_id']]);
|
||||
//生成购车订单
|
||||
$this->load->model('app/liche/app_liche_users_model');
|
||||
$userinfo = $this->app_liche_users_model->get(['mobile'=>$order_row['mobile']]);
|
||||
$this->orders_v2_entity->add_order($order_row['id'],$userinfo['id']);
|
||||
$result = $this->orders_status_entity->set_status($oid,1,1);
|
||||
}elseif($params['status'] == 2){ //完成按揭
|
||||
$loan_time = $info['loan_info']['loan_time'];
|
||||
if (!$loan_time) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '请选择放款时间!');
|
||||
}
|
||||
if (!$row['lend_file']) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '请先上传按揭放款函!');
|
||||
}
|
||||
$update['loan_time'] = date('Y-m-d H:i:s', strtotime($loan_time));
|
||||
$result = $this->orders_status_entity->set_status($oid,1,2);
|
||||
}
|
||||
if($update){
|
||||
$result = $this->order_loans_model->update($update, ['id' => $row['id']]);
|
||||
}
|
||||
return $result ? $this->show_json(SYS_CODE_SUCCESS, '保存成功') : $this->show_json(SYS_CODE_FAIL, '保存失败');
|
||||
}
|
||||
|
||||
public function edit_item()
|
||||
{
|
||||
$this->load->model("items/items_model");
|
||||
|
||||
$id = $this->input->post('id');
|
||||
$item_id = $this->input->post('item_id');
|
||||
$row = $this->receiver_orders_v2_model->get(['id' => $id]);
|
||||
if (!$row) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '参数错误!');
|
||||
}
|
||||
if (!$item_id) return $this->show_json(SYS_CODE_FAIL, '请选择车辆!');
|
||||
|
||||
if ($this->receiver_order_status_model->get(['o_id'=>$id,'pid_status'=>3,'status'=>1])) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '已开票,不能修改!');
|
||||
}
|
||||
$res = $this->receiver_orders_v2_model->update(['item_id' => $item_id], ['id' => $id]);
|
||||
if (!$res) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '保存失败');
|
||||
}
|
||||
if ($row['item_id'] && $row['item_id'] != $item_id) {
|
||||
$this->items_model->update(['status' => 1], ['id' => $row['item_id']]);
|
||||
}
|
||||
$result = $this->items_model->update(['status' => 2], ['id' => $item_id]);
|
||||
|
||||
if ($result) {
|
||||
$this->orders_status_entity->set_status($id,2,1);
|
||||
}
|
||||
if ($result) {
|
||||
return $this->show_json(SYS_CODE_SUCCESS, '保存成功');
|
||||
} else {
|
||||
return $this->show_json(SYS_CODE_FAIL, '保存失败');
|
||||
}
|
||||
}
|
||||
|
||||
//查看发票信息
|
||||
public function get_bill()
|
||||
{
|
||||
$oid = $this->input->get('oid');
|
||||
$row = $this->receiver_orders_v2_model->get(['id' => $oid]);
|
||||
$bill = $this->order_bills_model->get(['o_id' => $oid]);
|
||||
if (!$row) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '参数错误!');
|
||||
}
|
||||
if (!$bill) {
|
||||
$add_data = [
|
||||
'o_id' => $row['id'],
|
||||
'c_time' => time()
|
||||
];
|
||||
$bill['id'] = $this->order_bills_model->add($add_data);
|
||||
}
|
||||
$bill['src_file'] = $bill['file'] ? build_qiniu_image_url($bill['file']) : '';
|
||||
$bill['bill_time'] = $row['bill_time'] != '0000-00-00 00:00:00' ? $row['bill_time'] : '';
|
||||
$this->data['bill'] = $bill;
|
||||
return $this->show_view('receiver/orderv2/get/get_bill');
|
||||
}
|
||||
|
||||
//编辑发票信息
|
||||
public function edit_bill()
|
||||
{
|
||||
$id = $this->input->post('id');
|
||||
$file = $this->input->post('value');
|
||||
$row_order = $this->receiver_orders_v2_model->get(array('id' => $id));
|
||||
if(!$file || !$row_order){
|
||||
return $this->show_json(SYS_CODE_FAIL, '参数错误');
|
||||
}
|
||||
$row = $this->order_bills_model->get(['o_id' => $row_order['id']]);
|
||||
if(!$row){
|
||||
$this->order_bills_model->add(['c_time'=>time(),'o_id'=>$row_order['id']]);
|
||||
}
|
||||
$update['file'] = $file;
|
||||
$result = $this->order_bills_model->update($update, ['o_id' => $row_order['id']]);
|
||||
if ($result) {
|
||||
//更新开票时间
|
||||
$this->load->model('items/items_model');
|
||||
$bill_time = date('Y-m-d H:i:s');
|
||||
$upd = array('bill_time' => $bill_time);
|
||||
$where = array('id' => $row_order['item_id']);
|
||||
$ret = $this->items_model->update($upd, $where);
|
||||
if ($ret) { //添加开票日志
|
||||
$this->load->library('entity/items_entity');
|
||||
$re_i = $this->items_model->get(['id' => $row_order['item_id']]);
|
||||
$params = array('item_id' => $row_order['item_id'], 'type' => 3, 'uid' => $this->uid, 'uname' => $this->username
|
||||
, 'com_time' => $bill_time, 'biz_id' => $re_i['biz_id'], 'addr_id' => $re_i['addr_id']);
|
||||
$this->items_entity->add_log($params);
|
||||
}
|
||||
$this->receiver_orders_v2_model->update(['bill_time' => $bill_time], ['id' => $row_order['id']]);
|
||||
$this->orders_status_entity->set_status($row_order['id'],3,1);
|
||||
return $this->show_json(SYS_CODE_SUCCESS, '保存成功');
|
||||
} else {
|
||||
return $this->show_json(SYS_CODE_FAIL, '保存失败');
|
||||
}
|
||||
}
|
||||
|
||||
//确定交款
|
||||
public function edit_jk()
|
||||
{
|
||||
$oid = $this->input->post('oid');
|
||||
$row = $this->receiver_orders_v2_model->get(['id' => $oid]);
|
||||
if (!$row) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '参数错误!');
|
||||
}
|
||||
$bill = $this->order_bills_model->get(['o_id' => $oid]);
|
||||
if (!$bill['file'] || !$bill['money']) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '未上传开票文件或未填写到账金额!');
|
||||
}
|
||||
$where = [
|
||||
'o_id' => $oid,
|
||||
'status' => 1,
|
||||
'pay_price>' => 0
|
||||
];
|
||||
$sum = $this->app_liche_orders_model->sum('total_price', $where); //已收金额
|
||||
$need_price = $this->orders_v2_entity->recevable_price($oid); //应收金额
|
||||
if ($sum['total_price'] < $need_price) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '修改失败,已收金额小于应收金额!');
|
||||
}
|
||||
$this->order_bills_model->update(['status' => 2], ['o_id' => $oid]);
|
||||
$this->orders_status_entity->set_status($oid,3,1);
|
||||
return $this->show_json(SYS_CODE_SUCCESS, '保存成功');
|
||||
}
|
||||
|
||||
//获取合同图片
|
||||
public function get_cimgs()
|
||||
{
|
||||
$type = $this->input->get('type');
|
||||
$oid = $this->input->get('oid');
|
||||
$row = $this->order_contracts_model->get(['type' => $type, 'o_id' => $oid]);
|
||||
$info['title'] = '相册标题';
|
||||
$info['id'] = '222';
|
||||
$info['start'] = 0;
|
||||
$data = [];
|
||||
if ($row) {
|
||||
$imgs = json_decode($row['imgs'], true);
|
||||
foreach ($imgs as $key => $val) {
|
||||
$data[] = [
|
||||
'alt' => '图片名',
|
||||
'pid' => $key,
|
||||
'src' => build_qiniu_image_url($val),
|
||||
'thumb' => build_qiniu_image_url($val)
|
||||
];
|
||||
}
|
||||
}
|
||||
$info['data'] = $data;
|
||||
$this->data['info'] = $info;
|
||||
return $this->show_json(SYS_CODE_SUCCESS, '保存成功');
|
||||
}
|
||||
|
||||
//支付列表
|
||||
public function get_paylog()
|
||||
{
|
||||
$params = $this->input->get();
|
||||
if ($params['d_type'] == 'ajax') {
|
||||
$page = $params['page'] = $params['page'] ? intval($params['page']) : 1;
|
||||
$size = $params['size'] = $params['size'] ? intval($params['size']) : 10;
|
||||
$list = [];
|
||||
$where = [
|
||||
'o_id' => $params['id'],
|
||||
'status' => 1,
|
||||
'pay_price>' => 0
|
||||
];
|
||||
$count = $this->app_liche_orders_model->count($where);
|
||||
if ($count) {
|
||||
$rows = $this->app_liche_orders_model->select($where, 'id desc', $page, $size, 'id,total_price,type,pay_time,mch_id,descrip,status,pid,img,admin_id');
|
||||
$type_arr = $this->app_liche_orders_model->get_type_arr();
|
||||
foreach ($rows as $item) {
|
||||
$company = '';
|
||||
if ($item['mch_id']) {
|
||||
$company = $this->sys_company_model->get(['wx_mchid' => $item['mch_id']], 'short');
|
||||
}
|
||||
$opt_name = '用户';
|
||||
if($item['admin_id']){
|
||||
$admin_user = $this->sys_admin_model->get(array('id' => $item['admin_id']),'username');
|
||||
$opt_name = $admin_user['username'];
|
||||
}
|
||||
$list[] = [
|
||||
'id'=> $item['id'],
|
||||
'money' => $item['total_price'],
|
||||
'type_cn' => $type_arr[$item['type']],
|
||||
'pay_time' => $item['pay_time'],
|
||||
'company' => $company ? $company['short'] : '',
|
||||
'opt_name' => $opt_name,
|
||||
'descrip' => $item['descrip'],
|
||||
'img' => $item['img'] ? build_qiniu_image_url($item['img']) : '',
|
||||
];
|
||||
}
|
||||
}
|
||||
$sum = $this->app_liche_orders_model->sum('total_price', ['o_id'=>$params['id'],'status'=>1,'pay_price>'=>0]);
|
||||
$this->data['pay_price'] = $sum['total_price'];
|
||||
$this->data['need_price'] = $this->orders_v2_entity->recevable_price($params['id']);
|
||||
$this->data['list'] = $list;
|
||||
$hasNext = ceil($count / $size) > $page ? 1 : 0;
|
||||
$this->data['commonPage'] = array('page' => $page, 'pageLimit' => $size, 'pageCount' => $count, 'hasNext' => $hasNext);
|
||||
return $this->show_json(SYS_CODE_SUCCESS, '操作成功');
|
||||
}
|
||||
$this->data['id'] = $this->input->get('id');
|
||||
return $this->show_view('receiver/orderv2/get/paylog');
|
||||
}
|
||||
|
||||
//添加支付日志
|
||||
public function add_paylog()
|
||||
{
|
||||
$id = $this->input->get_post('id');
|
||||
$row = $this->receiver_orders_v2_model->get(['id' => $id]);
|
||||
$srv_price = $this->orders_v2_entity->order_srv_money($row['id']);
|
||||
$need_price = $this->orders_v2_entity->recevable_price($row['id']);
|
||||
$car_price = $need_price-$srv_price;
|
||||
if ($this->input->method() == 'post') {
|
||||
$money = $this->input->post('money');
|
||||
$pay_time = $this->input->post('pay_time');
|
||||
$wx_mchid = $this->input->post('wx_mchid');
|
||||
$descrip = $this->input->post('descrip');
|
||||
$type = $this->input->post('type');
|
||||
$img = $this->input->post('img');
|
||||
if (!$money || !$pay_time || !$row || !$wx_mchid) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '参数错误');
|
||||
}
|
||||
$p_row = $this->app_liche_orders_model->get(['pid'=>0,'o_id'=>$row['id']]);
|
||||
$last_p_row = $this->app_liche_orders_model->get(['o_id'=>$row['id'],'type'=>3,'pid'=>$p_row['id'],'status>='=>0]); //尾款父订单
|
||||
|
||||
if($type==6){ //尾款
|
||||
if($money>$car_price){
|
||||
return $this->show_json(SYS_CODE_FAIL, '车款金额错误');
|
||||
}
|
||||
$this->app_liche_orders_model->update(['status'=>-1],['o_id'=>$row['id'],'status'=>0,'type'=>1]); //定金更新成无效订单
|
||||
if(!$this->app_liche_orders_model->count(['pid'=>$last_p_row['id'],'type'=>3,'status'=>1])){
|
||||
$this->app_liche_orders_model->update(['status'=>-1],['o_id'=>$row['id'],'type'=>3]); //尾款更新成无效订单
|
||||
}
|
||||
}else{ //服务费
|
||||
if($money>$srv_price){
|
||||
return $this->show_json(SYS_CODE_FAIL, '服务费金额错误');
|
||||
}
|
||||
$this->app_liche_orders_model->update(['status'=>-1],['o_id'=>$row['id'],'type'=>2,'status'=>0]); //未支付更新成无效订单
|
||||
}
|
||||
$this->load->helper('order');
|
||||
$sid = create_order_no(350200, 'liche', 1, $type);
|
||||
$data = [
|
||||
'o_id' => $row['id'],
|
||||
'sid' => $sid,
|
||||
'pid' => $p_row['id'],
|
||||
'mch_id' => $wx_mchid,
|
||||
'admin_id' => $this->uid,
|
||||
'brand_id' => $row['brand_id'],
|
||||
's_id' => $row['s_id'],
|
||||
'v_id' => $row['v_id'],
|
||||
'cor_id' => $row['cor_id'],
|
||||
'incor_id' => $row['incor_id'],
|
||||
'total_price' => $money,
|
||||
'pay_price' => $money,
|
||||
'type' => $type,
|
||||
'status' => 1,
|
||||
'pay_time' => date('Y-m-d H:i:s',strtotime($pay_time)),
|
||||
'c_time' => time()
|
||||
];
|
||||
$p_row['uid'] && $data['uid'] = $p_row['uid'];
|
||||
$p_row['entrust_uid'] && $data['entrust_uid'] = $p_row['entrust_uid'];
|
||||
$img && $data['img'] = $img;
|
||||
$descrip && $data['descrip'] = $descrip;
|
||||
$this->app_liche_orders_model->add($data);
|
||||
if($this->app_liche_orders_model->count(['status'=>1,'o_id'=>$row['id']])==1 && $money>=100){ //企业微信推送
|
||||
$this->qyrobot->deposit_notify_v2($row['id']);
|
||||
}
|
||||
$where = [
|
||||
'status'=>1,
|
||||
'o_id'=>$row['id'],
|
||||
'pid>'=>0
|
||||
];
|
||||
$last_p_row && $where['id <>'] = $last_p_row['id'];
|
||||
$is_pay = $this->app_liche_orders_model->sum('total_price',$where); //已支付金额
|
||||
if($need_price && $is_pay['total_price']>=$need_price){ //完成支付
|
||||
$last_p_row && $this->app_liche_orders_model->update(['status'=>1],['id'=>$last_p_row['id']]);//完成未支付尾款
|
||||
$this->orders_status_entity->set_status($row['id'],0,1);
|
||||
}
|
||||
if(!$this->order_contracts_model->count(['o_id'=>$row['id']])){ //生成合同
|
||||
$url = http_host_com('api').'/pdfapi/add_pdf?oid='.$row['id'];
|
||||
$pdf_res = file_get_contents($url);
|
||||
}
|
||||
return $this->show_json(SYS_CODE_SUCCESS, '保存成功');
|
||||
}
|
||||
|
||||
$companys = $this->sys_company_model->select(['status' => 1, 'wx_mchid!=' => ''], 'id desc', '', '', 'id,wx_mchid,short');
|
||||
$type = [];
|
||||
$srv_price >0 && $type[] = ['id'=>2,'name'=>'服务费'];
|
||||
$type[] = ['id'=>6,'name'=>'车款'];
|
||||
$this->data['type'] = $type;
|
||||
$this->data['companys'] = $companys;
|
||||
$this->data['id'] = $this->input->get('id');
|
||||
return $this->show_view('receiver/orderv2/get/add_paylog');
|
||||
}
|
||||
//取消配车
|
||||
public function edit_ckcar(){
|
||||
$this->load->model('items/items_model');
|
||||
$id = $this->input->post('id');
|
||||
$row = $this->receiver_orders_v2_model->get(['id'=>$id]);
|
||||
if(!$row || !$row['item_id']){
|
||||
return $this->show_json(SYS_CODE_FAIL, '参数错误');
|
||||
}
|
||||
if ($this->receiver_order_status_model->get(['o_id'=>$id,'pid_status'=>3,'status'=>1])) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '订单已开票,不能修改!');
|
||||
}
|
||||
$res = $this->receiver_orders_v2_model->update(['item_id'=>0],['id'=>$row['id']]);
|
||||
if($res){
|
||||
$this->items_model->update(['status' => 1,'bill_time'=>'0000-00-00 00:00:00'], ['id' => $row['item_id']]);
|
||||
$this->receiver_order_status_model->delete(['o_id'=>$id,'pid_status'=>2,'status'=>1]);
|
||||
return $this->show_json(SYS_CODE_SUCCESS, '保存成功');
|
||||
}else{
|
||||
return $this->show_json(SYS_CODE_FAIL, '保存失败');
|
||||
}
|
||||
}
|
||||
|
||||
//修改图片
|
||||
public function edit_imgs(){
|
||||
$id = $this->input->post('id');
|
||||
$field = $this->input->post('filed');
|
||||
$value = $this->input->post('value');
|
||||
$row = $this->receiver_orders_v2_model->get(['id'=>$id]);
|
||||
if(!$row){
|
||||
return $this->show_json(SYS_CODE_FAIL, '参数错误');
|
||||
}
|
||||
$re_data = $this->receiver_order_datas_model->get(['o_id'=>$id]);
|
||||
if(!$re_data){
|
||||
$re_data_id = $this->eceiver_order_datas_model->add(['c_time'=>time(),'o_id'=>$id]);
|
||||
}else{
|
||||
$re_data_id = $re_data['id'];
|
||||
}
|
||||
if($field=='ins_img' || $field=='other_img'){
|
||||
$val_arr = json_decode($row[$field],true);
|
||||
$val_arr[] = $value;
|
||||
$value = json_encode($val_arr,JSON_UNESCAPED_UNICODE);
|
||||
}
|
||||
$update = [
|
||||
$field => $value
|
||||
];
|
||||
$res = $this->receiver_order_datas_model->update($update,['id'=>$re_data_id]);
|
||||
if($res){
|
||||
$this->orders_status_entity->set_status($id,6,1);
|
||||
return $this->show_json(SYS_CODE_SUCCESS, '保存成功');
|
||||
}else{
|
||||
return $this->show_json(SYS_CODE_FAIL, '保存失败');
|
||||
}
|
||||
}
|
||||
|
||||
public function edit_ckimg(){
|
||||
$type = $this->input->post('type');
|
||||
$ifcheck = $this->input->post('ifcheck');
|
||||
$o_id = $this->input->post('id');
|
||||
$img_data = $this->receiver_order_datas_model->get(['o_id'=>$o_id]);
|
||||
if(!$img_data){
|
||||
return $this->show_json(SYS_CODE_FAIL, '参数错误');
|
||||
}
|
||||
$ck_row = $this->app_checkdata_model->get(['cf_id'=>$img_data['id'],'app_id'=>2,'type'=>$type]);
|
||||
if($ck_row){
|
||||
$update = [
|
||||
'ifcheck' => $ifcheck ? 1 : -1,
|
||||
];
|
||||
$res = $this->app_checkdata_model->update($update,['id'=>$ck_row['id']]);
|
||||
}else{
|
||||
$add_data = [
|
||||
'cf_id' => $img_data['id'],
|
||||
'app_id' => 2,
|
||||
'type' => $type,
|
||||
'datatype' => 'img',
|
||||
'ifcheck' => $ifcheck ? 1 : -1,
|
||||
'c_time' => time()
|
||||
];
|
||||
$res = $this->app_checkdata_model->add($add_data);
|
||||
}
|
||||
if($res){
|
||||
$count = $this->app_checkdata_model->count(['ifcheck'=>1,'cf_id'=>$img_data['id'],'datatype'=>'img']);
|
||||
if($count==5){
|
||||
$this->orders_status_entity->set_status($img_data['o_id'],6,2);
|
||||
}
|
||||
return $this->show_json(SYS_CODE_SUCCESS, '保存成功');
|
||||
}else{
|
||||
return $this->show_json(SYS_CODE_FAIL, '保存失败');
|
||||
}
|
||||
}
|
||||
|
||||
public function test(){
|
||||
$o_id = 10062;
|
||||
$res = $this->orders_v2_entity->create_pdf($o_id);
|
||||
print_r($res);
|
||||
}
|
||||
}
|
||||
@@ -42,13 +42,17 @@ class Company extends HD_Controller{
|
||||
$size = !$size ? 20 : $size;
|
||||
|
||||
$statusAry = $this->company_model->status_ary();
|
||||
$typeAry = $this->company_model->type_ary();
|
||||
|
||||
$count = $this->company_model->count($where);
|
||||
$lists = array();
|
||||
if($count){
|
||||
$orderby = 'id desc';
|
||||
$select = 'id, title, short, status';
|
||||
$select = 'id, title, short, status, city_id,type';
|
||||
$rows = $this->company_model->select($where, $orderby, $page, $size, $select);
|
||||
$city_ids = array_column($rows,'city_id') ? implode(',',array_column($rows,'city_id')) : '';
|
||||
$city_lists = [];
|
||||
$city_ids && $city_lists = $this->sys_city_model->map('city_id','name',["city_id in ({$city_ids})"=>null],'','','','city_id,name');
|
||||
foreach($rows as $k => $v){
|
||||
$lists[] = array(
|
||||
'id' => $v['id'],
|
||||
@@ -56,6 +60,8 @@ class Company extends HD_Controller{
|
||||
'short' => $v['short'],
|
||||
'status' => $v['status'],
|
||||
'status_name' => $statusAry[$v['status']],
|
||||
'type_name' => $typeAry[$v['type']],
|
||||
'city_name' => $city_lists[$v['city_id']] ? $city_lists[$v['city_id']] : '',
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -81,6 +87,8 @@ class Company extends HD_Controller{
|
||||
'img_seal' => $row['img_seal'],
|
||||
'img_seal_url' => $row['img_seal'] ? build_qiniu_image_url($row['img_seal']) : '',
|
||||
'status' => $row['status'],
|
||||
'city_id' => $row['city_id'] ? $row['city_id'] : '',
|
||||
'type' => $row['type']
|
||||
);
|
||||
$action = '/sys/company/edit';
|
||||
$title = '编辑公司';
|
||||
@@ -91,14 +99,19 @@ class Company extends HD_Controller{
|
||||
'credit_code' => '',
|
||||
'wx_mchid' => '',
|
||||
'status' => 0,
|
||||
'city_id' => '',
|
||||
'type' => 0
|
||||
);
|
||||
$action = '/sys/company/add';
|
||||
$title = '新增公司';
|
||||
}
|
||||
|
||||
$city_lists = $this->sys_city_model->select(['status'=>1],'id desc','','','city_id,name');
|
||||
$this->data['city_lists'] = $city_lists;
|
||||
$this->data['info'] = $info;
|
||||
$this->data['action'] = $action;
|
||||
$this->data['statusAry'] = $this->company_model->status_ary();
|
||||
$this->data['typeAry'] = $this->company_model->type_ary();
|
||||
$this->data['_title'] = $title;
|
||||
$this->show_view('sys/company/get');
|
||||
}
|
||||
@@ -113,6 +126,9 @@ class Company extends HD_Controller{
|
||||
if(!$short){
|
||||
return $this->show_json(SYS_CODE_FAIL, '请输入公司简称');
|
||||
}
|
||||
if(!$info['city_id']){
|
||||
return $this->show_json(SYS_CODE_FAIL, '请选择城市');
|
||||
}
|
||||
|
||||
$where = array("title like '{$title}'" => null);
|
||||
$count = $this->company_model->count($where);
|
||||
@@ -126,7 +142,9 @@ class Company extends HD_Controller{
|
||||
'credit_code' => $info['credit_code'] ? $info['credit_code'] : '',
|
||||
'wx_mchid' => $info['wx_mchid'] ? $info['wx_mchid'] : '',
|
||||
'img_seal' => $info['img_seal'] ? $info['img_seal'] : '',
|
||||
'status' => intval($info['status'])
|
||||
'status' => intval($info['status']),
|
||||
'city_id' => $info['city_id'],
|
||||
'type' => intval($info['type'])
|
||||
);
|
||||
|
||||
$id = $this->company_model->add($add);
|
||||
@@ -148,6 +166,9 @@ class Company extends HD_Controller{
|
||||
if(!$short){
|
||||
return $this->show_json(SYS_CODE_FAIL, '请输入公司简称');
|
||||
}
|
||||
if(!$info['city_id']){
|
||||
return $this->show_json(SYS_CODE_FAIL, '请选择城市');
|
||||
}
|
||||
|
||||
$where = array("title like '{$title}'" => null, "id<>{$info['id']}" => null);
|
||||
$count = $this->company_model->count($where);
|
||||
@@ -161,7 +182,9 @@ class Company extends HD_Controller{
|
||||
'credit_code' => $info['credit_code'] ? $info['credit_code'] : '',
|
||||
'wx_mchid' => $info['wx_mchid'] ? $info['wx_mchid'] : '',
|
||||
'img_seal' => $info['img_seal'] ? $info['img_seal'] : '',
|
||||
'status' => intval($info['status'])
|
||||
'status' => intval($info['status']),
|
||||
'city_id' => $info['city_id'],
|
||||
'type' => intval($info['type'])
|
||||
);
|
||||
|
||||
$ret = $this->company_model->update($upd, array('id' => $info['id']));
|
||||
|
||||
@@ -0,0 +1,386 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* 订单管理列表
|
||||
*/
|
||||
class Ordersv2List
|
||||
{
|
||||
private $ci;
|
||||
private $searchTpAry = array('name' => '客户姓名', 'mobile' => '客户手机号', 'sid' => '订单号');
|
||||
private $paywayAry = array(0 => '贷款', 1 => '全款');
|
||||
private $t1 = 'lc_receiver_orders_v2';
|
||||
private $t2 = 'lc_receiver_order_status';
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->ci = &get_instance();
|
||||
$this->ci->load->model('receiver/order/receiver_orders_v2_model', 'mdOrders');
|
||||
$this->ci->load->model('receiver/order/receiver_order_status_model');
|
||||
$this->ci->load->model('receiver/order/receiver_order_agents_model', 'order_agents_model');
|
||||
$this->ci->load->model('app/licheb/app_licheb_users_model', 'mdLichebUsers');
|
||||
$this->ci->load->model('receiver/receiver_customers_model', 'mdCustomers');
|
||||
$this->ci->load->model('receiver/receiver_clues_cfrom_model', 'mdCluesCfrom');
|
||||
$this->ci->load->model("biz/biz_model");
|
||||
$this->ci->load->model('auto/auto_series_model');
|
||||
$this->ci->load->model('auto/auto_brand_model');
|
||||
$this->ci->load->model('auto/auto_attr_model');
|
||||
|
||||
$this->ci->load->library('receiver/orders_v2_entity');
|
||||
$this->ci->load->library('receiver/orders_status_entity');
|
||||
}
|
||||
|
||||
public function lists($status_pid, $params = array())
|
||||
{
|
||||
// $result = $show_info = array();
|
||||
!$params['qdjl_id'] && $params['qdjl_id'] = '';
|
||||
!$params['cf_title'] && $params['cf_title'] = '';
|
||||
!$params['cf_clues'] && $params['cf_clues'] = '';
|
||||
!strlen($params['payway']) && $params['payway'] = '';
|
||||
!$params['biz_type'] && $params['biz_type'] = '';
|
||||
$fieldAry = $this->get_fields($status_pid);
|
||||
$show_info['cfTitleAry'] = $this->ci->mdCustomers->get_sdata('cfrom');//来源类型
|
||||
$show_info['cfCluesAry'] = $this->ci->mdCustomers->get_sdata('cfrom_clues');//线下来源
|
||||
$show_info['paywayAry'] = $this->paywayAry;//付款方式
|
||||
$show_info['bizTypeAry'] = $this->ci->biz_model->type_ary();//门店类型
|
||||
//渠道经理
|
||||
$show_info['qdjl_lists'] = $this->ci->mdLichebUsers->select(array('group_id' => 4, 'status' => 1, 'biz_id<>' => '0')
|
||||
, 'id desc', 0, 0, 'id,uname as name');
|
||||
$result = $this->orders($params);
|
||||
$result['show_info'] = $show_info;
|
||||
$result['fieldAry'] = $fieldAry;
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Notes:全部订单
|
||||
* Created on: 2021/9/18 15:13
|
||||
* Created by: dengbw
|
||||
* @param array $params
|
||||
* @return array
|
||||
*/
|
||||
private function orders($params = array())
|
||||
{
|
||||
$page = $params['page'] = $params['page'] ? intval($params['page']) : 1;
|
||||
$size = $params['size'] = $params['size'] ? intval($params['size']) : 20;
|
||||
$status_arr = $this->ci->receiver_order_status_model->statusAry();
|
||||
$order_status_cn = $this->ci->mdOrders->get_status();
|
||||
$view_type = 'orders';
|
||||
$where = ["{$this->t1}.status>=" => 0];
|
||||
$_title = '全部订单';
|
||||
$view = 'receiver/orderv2/lists';
|
||||
$params['status_pid']==1 && $where["{$this->t1}.payway"] = 0;
|
||||
// if(strlen($params['status_pid']) && $params['status']){
|
||||
// $where["{$this->t2}.pid_status"] = $params['status_pid'];
|
||||
// $where["{$this->t2}.status"] = $params['status'];
|
||||
// }
|
||||
if(is_product()){
|
||||
$where["{$this->t1}.biz_id<>"] = 1;
|
||||
}
|
||||
if ($_SESSION['admin_info']['biz_id']) {
|
||||
$biz_ids = implode(',', $_SESSION['admin_info']['biz_id']);
|
||||
$where["{$this->t1}.biz_id in ($biz_ids)"] = null;
|
||||
}
|
||||
if ($params['biz_type']) {
|
||||
$where["{$this->t1}.biz_id in (select id from lc_biz where type = " . $params['biz_type'] . ' and status=1)'] = null;
|
||||
}
|
||||
if ($params['cf_title'] || $params['cf_clues'] || $params['cfrom_id'] || $params['cfrom_id2']) {
|
||||
$where_c = 'status>=0';
|
||||
if ($params['cfrom_id'] == 24) {
|
||||
$where_c .= ' and cf_id = 24';
|
||||
$params['cfrom_id2'] && $where_c .= ' and t_id = ' . $params['cfrom_id2'];
|
||||
} else {
|
||||
if ($params['cfrom_id2']) {
|
||||
$where_c .= ' and cf_id = ' . $params['cfrom_id2'];
|
||||
} else if ($params['cfrom_id']) {
|
||||
$cf_rows = $this->ci->mdCluesCfrom->select(['pid' => $params['cfrom_id']], '', '', '', 'id');
|
||||
$cf_ids = array_column($cf_rows, 'id');
|
||||
$cf_ids[] = $params['cfrom_id'];
|
||||
$cf_str_ids = implode(',', array_filter($cf_ids));
|
||||
$cf_str_ids && $where_c .= " and cf_id in ({$cf_str_ids})";
|
||||
}
|
||||
}
|
||||
$params['cf_title'] && $where_c .= ' and cf_title = "' . $params['cf_title'] . '"';
|
||||
$params['cf_clues'] && $where_c .= ' and cf_clues = "' . $params['cf_clues'] . '"';
|
||||
$where["{$this->t1}.customer_id in (select id from lc_receiver_customers where " . $where_c . ')'] = null;
|
||||
}
|
||||
if (strlen($params['payway'])) {
|
||||
$where["{$this->t1}.payway"] = $params['payway'];
|
||||
}
|
||||
if ($params['qdjl_id']) {//渠道经理
|
||||
$where["{$this->t1}.biz_id in(select biz_id from lc_app_licheb_channel_biz where uid={$params['qdjl_id']})"] = null;
|
||||
}
|
||||
if ($params['title']) {
|
||||
$where["{$this->t1}.{$params['search_tp']} like '%{$params['title']}%'"] = null;
|
||||
}
|
||||
//创建时间
|
||||
if ($params['c_time']) {
|
||||
$c_time = explode(' ~ ', $params['c_time']);
|
||||
if ($c_time[0]) {
|
||||
$where["{$this->t1}.c_time >="] = strtotime($c_time[0] . ' 00:00:00');
|
||||
}
|
||||
if ($c_time[1]) {
|
||||
$where["{$this->t1}.c_time <="] = strtotime($c_time[1] . ' 23:59:59');
|
||||
}
|
||||
}
|
||||
//开票时间
|
||||
if ($params['bill_time']) {
|
||||
$bill_time = explode(' ~ ', $params['bill_time']);
|
||||
if ($bill_time[0]) {
|
||||
$where["{$this->t1}.bill_time >="] = $bill_time[0] . ' 00:00:00';
|
||||
}
|
||||
if ($bill_time[1]) {
|
||||
$where["{$this->t1}.bill_time <="] = $bill_time[1] . ' 23:59:59';
|
||||
}
|
||||
}
|
||||
if ($params['brand_id']) {//品牌
|
||||
$where["{$this->t1}.brand_id"] = $params['brand_id'];
|
||||
} else {
|
||||
if(is_product()){
|
||||
$where["{$this->t1}.brand_id<>"] = 3;//狸车品牌不显示
|
||||
}
|
||||
$params['brand_id'] = '';
|
||||
}
|
||||
if ($params['s_id']) {//车系
|
||||
$where["{$this->t1}.s_id"] = $params['s_id'];
|
||||
} else {
|
||||
$params['s_id'] = '';
|
||||
}
|
||||
if ($params['v_id']) {//车型
|
||||
$where["{$this->t1}.v_id"] = $params['v_id'];
|
||||
} else {
|
||||
$params['v_id'] = '';
|
||||
}
|
||||
if ($params['cor_id']) {//车身颜色
|
||||
$where["{$this->t1}.cor_id"] = $params['cor_id'];
|
||||
} else {
|
||||
$params['cor_id'] = '';
|
||||
}
|
||||
//销售员筛选
|
||||
if ($params['admin_id']) {
|
||||
$where["{$this->t1}.admin_id"] = $params['admin_id'];
|
||||
} else {
|
||||
if ($params['biz_id_admin']) {//指定店铺所有销售员
|
||||
$where["{$this->t1}.biz_id"] = $params['biz_id_admin'];
|
||||
} else {
|
||||
//指定城市的所有门店
|
||||
$where_biz = array();
|
||||
if ($params['county_id_admin']) {
|
||||
$where_biz['county_id'] = $params['county_id_admin'];
|
||||
} else if ($params['city_id_admin']) {
|
||||
$where_biz['city_id'] = $params['city_id_admin'];
|
||||
}
|
||||
if ($where_biz) {
|
||||
$where_biz['status>-1'] = null;
|
||||
$rows_biz = $this->ci->biz_model->select($where_biz, 'id desc', 0, 0, 'id');
|
||||
if ($rows_biz) {
|
||||
$str_ids = implode(',', array_column($rows_biz, 'id'));
|
||||
$where["{$this->t1}.biz_id in({$str_ids})"] = null;
|
||||
} else {
|
||||
$where["{$this->t1}.biz_id"] = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
!$params['city_id_admin'] && $params['city_id_admin'] = '';
|
||||
!$params['county_id_admin'] && $params['county_id_admin'] = '';
|
||||
!$params['biz_id_admin'] && $params['biz_id_admin'] = '';
|
||||
$params['admin_id'] = '';
|
||||
}
|
||||
if($params['vin']){
|
||||
$where = ["{$this->t1}.status>=" => 0];
|
||||
$where["{$this->t1}.item_id in(select id from lc_items where vin like '%{$params['vin']}%')"] = null;
|
||||
}
|
||||
$fileds = "{$this->t1}.id,{$this->t1}.name,{$this->t1}.mobile,{$this->t1}.brand_id,{$this->t1}.s_id,{$this->t1}.v_id,
|
||||
{$this->t1}.cor_id,{$this->t1}.incor_id,{$this->t1}.money_json,{$this->t1}.payway,{$this->t1}.status,{$this->t1}.c_time,
|
||||
{$this->t1}.biz_id,{$this->t1}.bill_time,{$this->t1}.customer_id,{$this->t1}.owner_name,{$this->t1}.owner_mobile,{$this->t1}.main_type,{$this->t1}.info_json";
|
||||
if(strlen($params['status_pid']) && $params['status']){
|
||||
$where["{$this->t2}.pid_status"] = $params['status_pid'];
|
||||
$up_key = $params['status']+1;
|
||||
$where["{$this->t2}.status in ({$params['status']},{$up_key})"] = null;
|
||||
$count = $this->ci->mdOrders->selectOrders($where,'', '', '', 1);
|
||||
$rows = $this->ci->mdOrders->selectOrders($where, "c_time desc", $page, $size, '',$fileds);
|
||||
}else{
|
||||
if(strlen($params['status'])){
|
||||
$where["id not in (select o_id from lc_receiver_order_status where pid_status={$params['status_pid']} and status=1)"] = null;
|
||||
}
|
||||
$count = $this->ci->mdOrders->count($where);
|
||||
$rows = $this->ci->mdOrders->select($where, "c_time desc", $page, $size,$fileds);
|
||||
}
|
||||
$lists = [];
|
||||
if ($count) {
|
||||
//客户来源
|
||||
$str_rids = implode(',', array_unique(array_column($rows, 'customer_id')));
|
||||
!$str_rids && $str_rids = 0;
|
||||
$customers = $this->ci->mdCustomers->map('id', '', array("id in({$str_rids})" => null),'','','','id,cf_title,cf_clues,cf_id');
|
||||
$cfroms = [];
|
||||
if($customers){
|
||||
foreach($customers as $key=>$val){
|
||||
$cf_id_arr[] = $val[0]['cf_id'];
|
||||
}
|
||||
//获取来源
|
||||
$cfroms = $this->ci->mdCluesCfrom->get_map_by_ids($cf_id_arr, 'id,title');
|
||||
}
|
||||
//门店
|
||||
$str_biz_ids = implode(',', array_unique(array_column($rows, 'biz_id')));
|
||||
!$str_biz_ids && $str_biz_ids = 0;
|
||||
$bizs = $this->ci->biz_model->map('id', 'biz_name', array("id in({$str_biz_ids})" => null));
|
||||
//品牌车型
|
||||
$brand_arr = array_unique(array_column($rows, 'brand_id'));
|
||||
$brands = $this->ci->auto_brand_model->get_map_by_ids($brand_arr, 'id,name');
|
||||
//车系车型
|
||||
$series_arr = array_unique(array_column($rows, 's_id'));
|
||||
$series = $this->ci->auto_series_model->get_map_by_ids($series_arr, 'id,name');
|
||||
//获取属性
|
||||
$v_arr = array_unique(array_column($rows, 'v_id'));
|
||||
$cor_arr = array_unique(array_column($rows, 'cor_id'));
|
||||
$incor_arr = array_unique(array_column($rows, 'incor_id'));
|
||||
$attr_arr = array_merge($v_arr, $cor_arr, $incor_arr);
|
||||
$attr = $this->ci->auto_attr_model->get_map_by_ids($attr_arr, 'id,title');
|
||||
foreach ($rows as $key => $val) {
|
||||
$money_json = json_decode($val['money_json'],true);
|
||||
$info_json = json_decode($val['info_json'],true);
|
||||
$fields = array();
|
||||
$brand_name = isset($brands[$val['brand_id']]) ? $brands[$val['brand_id']][0]['name'] : '';
|
||||
$series_name = isset($series[$val['s_id']]) ? $series[$val['s_id']][0]['name'] : '';
|
||||
$v_name = isset($attr[$val['v_id']]) ? $attr[$val['v_id']][0]['title'] : '';
|
||||
$cor_name = isset($attr[$val['cor_id']]) ? $attr[$val['cor_id']][0]['title'] : '';
|
||||
$fields['o_id'] = $val['id'];
|
||||
$fields['bill_time'] = $val['bill_time'];
|
||||
$fields['mobile'] = $val['mobile'];
|
||||
if(Orders_v2_entity::V2_START_ID<$val['id']){
|
||||
if($val['main_type']){
|
||||
$name = $info_json['c_company'];
|
||||
$mobile = $val['mobile'];
|
||||
}else{
|
||||
$name = $val['owner_name'];
|
||||
$mobile = $val['owner_mobile'];
|
||||
}
|
||||
$open_url = '/receiver/orderv2/orders/get?id=';
|
||||
$fields['name'] = $size > 1000 ? $$name
|
||||
: '<a href="javascript:;" data-open="'.$open_url . $val['id'] . '">' . $name . '<br>' . $mobile . '</a>';
|
||||
|
||||
}else{
|
||||
$open_url = '/receiver/orders/get?id=';
|
||||
$o_tp = '(旧订单)';
|
||||
$fields['name'] = $size > 1000 ? $val['name']
|
||||
: '<a href="javascript:;" data-open="'.$open_url . $val['id'] . '">' . $val['name']. $o_tp . '<br>' . $val['mobile'] . '</a>';
|
||||
}
|
||||
$fields['car_name'] = "{$brand_name}-{$series_name}-{$v_name}-{$cor_name}";
|
||||
$fields['price'] = number_format($money_json['price_car'], 2);
|
||||
$fields['payway_name'] = $this->paywayAry[$val['payway']];
|
||||
$fields['incor_name'] = isset($attr[$val['incor_id']]) ? $attr[$val['incor_id']][0]['title'] : '';
|
||||
if(strlen($params['status_pid']) && $params['status_pid']!=5){
|
||||
$fields['status_name'] = $this->ci->orders_status_entity->last_status_cn($val['id'],$params['status_pid']);
|
||||
}else{
|
||||
$fields['status_name'] = $order_status_cn[$val['status']];
|
||||
}
|
||||
$fields['biz_name'] = $bizs[$val['biz_id']];
|
||||
$fields['c_time'] = date('Y-m-d H:i:s', $val['c_time']);
|
||||
$fields['cf_title'] = $customers[$val['rid']][0]['cf_title'];
|
||||
$fields['cf_clues'] = $customers[$val['rid']][0]['cf_clues'];
|
||||
$fields['cf_name'] = $cfroms[$customers[$val['rid']][0]['cf_id']][0]['title'];
|
||||
$lists[] = $fields;
|
||||
}
|
||||
}
|
||||
$pager = array('count' => ceil($count / $size), 'curr' => $page, 'totle' => $count);
|
||||
$_title = $size > 1000 ? $_title : $_title . '列表';
|
||||
$view_type != 'orders' && $status_arr = [];
|
||||
return array('lists' => $lists, 'pager' => $pager, 'params' => $params, 'status_arr' => $status_arr
|
||||
, 'searchTpAry' => $this->searchTpAry, 'view' => $view, 'view_type' => $view_type, '_title' => $_title);
|
||||
}
|
||||
|
||||
/**
|
||||
* Notes:获取字段
|
||||
* Created on: 2021/10/29 15:38
|
||||
* Created by: dengbw
|
||||
* @param $status_pid
|
||||
* @param int $export
|
||||
* @return array
|
||||
*/
|
||||
public function get_fields($status_pid, $export = 0)
|
||||
{
|
||||
$fields1 = $fields2 = [];
|
||||
if ($export) {
|
||||
$fields1['name'] = ['title' => '客户姓名'];
|
||||
$fields1['mobile'] = ['title' => '客户电话'];
|
||||
} else {
|
||||
$fields1['name'] = ['title' => '客户', 'width' => '14%'];
|
||||
}
|
||||
if (strlen($status_pid) && $status_pid == 0) {
|
||||
$fields2 = ['car_name' => ['title' => '车辆', 'width' => '22%'],
|
||||
'biz_name' => ['title' => '门店', 'width' => '10%'], 'price' => ['title' => '合同价', 'width' => '7%'],
|
||||
'payway_name' => ['title' => '付款', 'width' => '5%'],'admin_name' => ['title' => '销售员', 'width' => '7%'],
|
||||
'cf_title' => ['title' => '来源类型', 'width' => '8%'],'cf_name' => ['title' => '来源','width' => '10%'],
|
||||
'status_name' => ['title' => '合同状态', 'width' => '7%'], 'order_time' => ['title' => '下定时间', 'width' => '12%']];
|
||||
$fields = array_merge($fields1, $fields2);
|
||||
} else if ($status_pid == 1) {
|
||||
$fields2 = ['title' => ['title' => '分期产品', 'width' => '15%'],
|
||||
'price_loan' => ['title' => '贷款金额', 'width' => '10%'], 'c_time' => ['title' => '分期时间', 'width' => '7%'],
|
||||
'cf_title' => ['title' => '来源类型', 'width' => '10%'], 'cf_name' => ['title' => '来源','width' => '10%'],
|
||||
'status_name' => ['title' => '状态', 'width' => '10%']];
|
||||
$fields = array_merge($fields1, $fields2);
|
||||
} else if ($status_pid == 2 || $status_pid == 3 || $status_pid == 4 || $status_pid == 5) {
|
||||
$fields2 = ['car_name' => ['title' => '车辆', 'width' => '27%'],
|
||||
'biz_name' => ['title' => '门店', 'width' => '12%'], 'price' => ['title' => '车辆平台价', 'width' => '9%'],
|
||||
'payway_name' => ['title' => '付款方式', 'width' => '8%'],
|
||||
'cf_title' => ['title' => '来源类型', 'width' => '9%'], 'cf_name' => ['title' => '来源','width' => '10%'],
|
||||
'status_name' => ['title' => '状态', 'width' => '9%']];
|
||||
$status_pid==4 && $fields2['u_time'] = ['title'=>'更新时间','width'=>'9%'];
|
||||
$fields = array_merge($fields1, $fields2);
|
||||
} else {
|
||||
$fields2 = ['car_name' => ['title' => '车辆', 'width' => '27%'],
|
||||
'biz_name' => ['title' => '门店', 'width' => '12%'], 'price' => ['title' => '车辆平台价', 'width' => '9%'],
|
||||
'payway_name' => ['title' => '付款方式', 'width' => '8%'],
|
||||
'cf_title' => ['title' => '来源类型', 'width' => '9%'], 'cf_name' => ['title' => '来源','width' => '10%'],
|
||||
'status_name' => ['title' => '状态', 'width' => '9%'],
|
||||
'c_time' => ['title' => '订单时间', 'width' => '9%']];
|
||||
$fields = array_merge($fields1, $fields2);
|
||||
}
|
||||
return $fields;
|
||||
}
|
||||
/*
|
||||
* 导出数据
|
||||
*/
|
||||
public function export_data($pid,$params){
|
||||
$indexs = [
|
||||
'name' => '客户姓名',
|
||||
'mobile' => '手机号',
|
||||
'c_time' => '订单时间',
|
||||
'bill_time' => '开票时间',
|
||||
'if_ins_db' => '是否代办',
|
||||
'company' => '保险公司',
|
||||
'business_risk' => '商业险金额',
|
||||
'ins_risk' => '交强险金额'
|
||||
];
|
||||
$result = $this->lists($pid, $params);
|
||||
foreach ($result['lists'] as $key => $value) {
|
||||
$temp = [
|
||||
'name' => $value['name'],
|
||||
'mobile' => $value['mobile'],
|
||||
'c_time' => $value['c_time'],
|
||||
'if_ins_db' => '',
|
||||
'company' => '',
|
||||
'business_risk' => '',
|
||||
'ins_risk' => ''
|
||||
];
|
||||
$temp['bill_time'] = $value['bill_time'] != '0000-00-00 00:00:00' ? $value['bill_time'] : '';
|
||||
$agent = $this->ci->order_agents_model->get(['o_id' => $value['o_id']],'jsondata');
|
||||
if($agent){
|
||||
$agent_jsondata = $agent['jsondata'] ? json_decode($agent['jsondata'], true) : '';
|
||||
if (isset($agent_jsondata['if_ins_db']) && $agent_jsondata['if_ins_db']) {
|
||||
$temp['if_ins_db'] = '是';
|
||||
isset($agent_jsondata['company']) && $temp['company'] = $agent_jsondata['company'];
|
||||
isset($agent_jsondata['ins_risk']) && $temp['ins_risk'] = $agent_jsondata['ins_risk'];
|
||||
isset($agent_jsondata['business_risk']) && $temp['business_risk'] = $agent_jsondata['business_risk'];
|
||||
}else{
|
||||
$temp['if_ins_db'] = '否';
|
||||
}
|
||||
}
|
||||
$data[] = $temp;
|
||||
}
|
||||
array_unshift($data, $indexs);
|
||||
return ['data'=>$data,'indexs'=>$indexs];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,300 @@
|
||||
<ul id="myTab" class="nav nav-tabs">
|
||||
<li class="active">
|
||||
<a href="#swzc" data-toggle="tab">
|
||||
商务
|
||||
</a>
|
||||
</li>
|
||||
<li class="dropdown">
|
||||
<a href="#jszc" data-toggle="tab">
|
||||
结算
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
<form id="vue-edit" class="am-form am-form-horizontal tab-content" action="/auto/cars/edit" data-auto="true" method="post" style="width: 90%;padding:25px 30px 20px 0;margin: 0 auto;">
|
||||
<div class="tab-pane fade in active" id="swzc">
|
||||
<div class="am-form-group wp50">
|
||||
<label class="am-para-label">车型:</label>
|
||||
<div class="am-para-input" style="width: 100%;">
|
||||
<select name="brand_id" style="display: inline;width: 100px" v-model="info.brand_id">
|
||||
<option value="">品牌</option>
|
||||
<option :value="i" v-for="(v,i) in brandAry">{{v}}</option>
|
||||
</select>
|
||||
<select name="s_id" style="display: inline;width: 100px" v-model="info.s_id">
|
||||
<option value="">车系</option>
|
||||
<option :value="i" v-for="(v,i) in seryAry">{{v}}</option>
|
||||
</select>
|
||||
<select name="v_id" style="display: inline;width: 100px" v-model="info.v_id">
|
||||
<option value="">车型</option>
|
||||
<option :value="v.id" v-for="(v,i) in attrvAry">{{v.title}}</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group wp50">
|
||||
<label class="am-para-label">城市:</label>
|
||||
<div class="am-para-input">
|
||||
<select name="city_id" v-model="info.city_id">
|
||||
<option value="">城市</option>
|
||||
<option :value="v.city_id" v-for="(v,i) in cityAry">{{v.name}}</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group wp50">
|
||||
<label class="am-para-label">生效时间:</label>
|
||||
<div class="am-para-input">
|
||||
<input type="text" placeholder="" name="price_insure" id="id-time" v-model="info.s_effect_time" autocomplete="off"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group wp50">
|
||||
<label class="am-para-label">时间:</label>
|
||||
<div class="am-para-input">
|
||||
<select name="year" style="display: inline;width: 100px" v-model="info.year">
|
||||
<option value="">年</option>
|
||||
<option :value="v" v-for="(v,i) in yearAry">{{v}}</option>
|
||||
</select>
|
||||
<select name="month" style="display: inline;width: 100px" v-model="info.month">
|
||||
<option value="">月份</option>
|
||||
<option :value="v" v-for="(v,i) in monthAry">{{v}}</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group wp50 fl">
|
||||
<label class="am-para-label">裸车报价:</label>
|
||||
<div class="am-para-input">
|
||||
<input type="text" placeholder="请输入裸车报价" name="price_insure" v-model="info.price_car" style="display: inline;width: 60%"/>
|
||||
<span>元</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group wp50 fl">
|
||||
<label class="am-para-label">车辆底价:</label>
|
||||
<div class="am-para-input">
|
||||
<input type="text" placeholder="请输入底价" name="price_fine" v-model="info.price_floor" style="display: inline;width: 60%"/>
|
||||
<span>元</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="am-form-group wp50">
|
||||
<label class="am-para-label">公司加价:</label>
|
||||
<div class="am-para-input">
|
||||
<input type="text" placeholder="请输入公司加价" name="price_fine" v-model="info.price_coplus" style="display: inline;width: 60%"/>
|
||||
<span>元</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="am-form-group wp50 ">
|
||||
<label class="am-para-label">交车时间:</label>
|
||||
<div class="am-para-input">
|
||||
<input type="text" placeholder="请输入交车时间" name="delivery_day" v-model="info.delivery_day" style="display: inline;width: 100px"/>
|
||||
<span>个工作日</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="am-form-group">
|
||||
<label class="am-para-label">颜色加价:</label>
|
||||
<div class="am-para-input">
|
||||
<input type="text" placeholder="请输入颜色加价" name="price_fine" v-model="info.price_color" style="display: inline;width: 100px"/>
|
||||
<span>元</span>
|
||||
<template v-for="(v,i) in colorattrvAry">
|
||||
<input type="checkbox" :value="v.id" name="color" v-if="v.checked" checked>
|
||||
<input type="checkbox" :value="v.id" name="color" v-else>
|
||||
{{v.title}}
|
||||
</template>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="tab-pane fade" id="jszc">
|
||||
<div class="am-form-group wp50">
|
||||
<label class="am-para-label">单车毛利:</label>
|
||||
<div class="am-para-input">
|
||||
<input type="text" placeholder="请输入单车毛利" name="profix_car" v-model="info.profix_car" style="display: inline;width: 60%"/>
|
||||
<span>元</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group wp50">
|
||||
<label class="am-para-label">上牌毛利:</label>
|
||||
<div class="am-para-input">
|
||||
<input type="text" placeholder="请输入上牌毛利" name="profix_carno" v-model="info.profix_carno" style="display: inline;width: 60%"/>
|
||||
<span>元</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group wp50">
|
||||
<label class="am-para-label">保险毛利:</label>
|
||||
<div class="am-para-input">
|
||||
<input type="text" placeholder="请输入保险毛利" name="profix_insure" v-model="info.profix_insure" style="display: inline;width: 60%"/>
|
||||
<span>元</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group wp50">
|
||||
<label class="am-para-label">贷款毛利:</label>
|
||||
<div class="am-para-input">
|
||||
<input type="text" placeholder="请输入贷款毛利" name="profix_loan" v-model="info.profix_loan" style="display: inline;width: 60%"/>
|
||||
<span>元</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="am-form-group" style="margin-bottom: 2rem">
|
||||
<div class="am-para-input"><button class="am-btn am-btn-secondary" type="button" @click="saveEdit">提交</button></div>
|
||||
</div>
|
||||
</form>
|
||||
<script>
|
||||
require(['laydate'], function (laydate) {
|
||||
laydate.render({
|
||||
elem: '#id-time'
|
||||
});
|
||||
});
|
||||
var loading = 0;
|
||||
var vue_obj;
|
||||
$(function(){
|
||||
vue_obj = new Vue({
|
||||
el: '#vue-edit',
|
||||
data: {
|
||||
info:{'brand_id':'','s_id':'','v_id':''},
|
||||
statusAry:[],
|
||||
brandAry:[],
|
||||
seryAry:[],
|
||||
attrvAry:[],
|
||||
cityAry:[],
|
||||
yearAry:[],
|
||||
monthAry:[],
|
||||
colorattrvAry:[],
|
||||
colors:[],
|
||||
action:''
|
||||
},
|
||||
mounted:function(){
|
||||
var vm = this;
|
||||
vm.info = <?=json_encode($info,JSON_UNESCAPED_UNICODE)?>;
|
||||
vm.action = '<?=$info['action']?>';
|
||||
vm.brandAry = <?=json_encode($brandAry)?>;
|
||||
vm.cityAry = <?=json_encode($city_rows)?>;
|
||||
vm.yearAry = <?=json_encode($yearAry)?>;
|
||||
vm.monthAry = <?=json_encode($monthAry)?>;
|
||||
vm.colors = <?=json_encode($info['colors'])?>;
|
||||
},
|
||||
methods:{
|
||||
saveEdit:function(){
|
||||
var vm = this;
|
||||
|
||||
vm.info.colors = [];
|
||||
vm.info.s_effect_time = $("#id-time").val();
|
||||
if(vm.colorattrvAry.length>0){
|
||||
$("input[name='color']:checked").each(function (index, item) {
|
||||
if ($("input[name='color']:checked").length-1==index) {
|
||||
vm.info.colors.push($(this).val())
|
||||
} else {
|
||||
vm.info.colors.push($(this).val())
|
||||
}
|
||||
});
|
||||
}
|
||||
if(1 == loading){
|
||||
return 0;
|
||||
}
|
||||
loading = 1;
|
||||
$.ajax({
|
||||
url: vm.action,
|
||||
type: 'post',
|
||||
dataType: 'json',
|
||||
data: {info:vm.info},
|
||||
beforeSend: function () {
|
||||
layer.load(1, {
|
||||
shade: [0.1, '#fff'] //0.1透明度的白色背景
|
||||
});
|
||||
},
|
||||
success: function (data) {
|
||||
loading = 0;
|
||||
if (data['code']) {
|
||||
layer.msg(data.msg, {
|
||||
icon: 1,
|
||||
time: 2000
|
||||
}, function () {
|
||||
window.location.reload();
|
||||
});
|
||||
} else {
|
||||
layer.msg(data.msg, {icon: 2});
|
||||
}
|
||||
},
|
||||
complete: function () {
|
||||
loading = 0;
|
||||
layer.closeAll('loading');
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
watch:{
|
||||
'info.brand_id':function(nv, ov){
|
||||
var vm = this;
|
||||
vm.seryAry = {};
|
||||
if(nv > 0){
|
||||
$.get('/auto/series/json_lists',{brand_id:nv},function (data) {
|
||||
if (1 == data.code) {
|
||||
var lists = data.data.list;
|
||||
var seryAry = {};
|
||||
for (var i in lists){
|
||||
var row = lists[i];
|
||||
seryAry[row.id] = row.name;
|
||||
}
|
||||
vm.seryAry = seryAry;
|
||||
if(vm.info.s_id>0 && undefined == seryAry[vm.info.s_id]){
|
||||
vm.info.s_id = '';
|
||||
}
|
||||
}
|
||||
},'json');
|
||||
} else {
|
||||
vm.params.s_id = '';
|
||||
}
|
||||
},
|
||||
'info.s_id':function(nv, ov){
|
||||
var vm = this;
|
||||
var old_s_id = '<?=$info['s_id']?>';
|
||||
if (nv > 0) {
|
||||
//型号
|
||||
$.get('/auto/attr/json_lists',{s_id:nv,'status':1,'type':1},function (response) {
|
||||
if (response.code == 1) {
|
||||
vm.attrvAry = response.data.list;
|
||||
}
|
||||
},'json');
|
||||
$.get('/auto/attr/json_lists',{s_id:nv,'status':1,'type':0},function (response) {
|
||||
if (response.code == 1) {
|
||||
vm.colorattrvAry = response.data.list;
|
||||
if(vm.colors){
|
||||
response.data.list.forEach(function(val,key){
|
||||
var a = vm.colors.indexOf(val.id);
|
||||
if(a>=0){
|
||||
vm.colorattrvAry[key]['checked'] = true;
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
}
|
||||
},'json');
|
||||
} else {
|
||||
vm.attrvAry = [];
|
||||
vm.params.v_id = '';
|
||||
}
|
||||
},
|
||||
'info.v_id':function(nv, ov){
|
||||
var vm = this;
|
||||
var old_v_id = '<?=$info['v_id']?>';
|
||||
if(nv != old_v_id){
|
||||
vm.info.price_car = 0.00;
|
||||
vm.info.price_floor = 0.00;
|
||||
vm.info.price_coplus = 0.00;
|
||||
vm.info.price_color = 0.00;
|
||||
$.get('/auto/cars/json_get',{brand_id:vm.info.brand_id,s_id:vm.info.s_id,v_id:nv},function (response) {
|
||||
if (response.code == 1) {
|
||||
vm.info.price_car = response.data.price_car;
|
||||
vm.info.price_floor = response.data.price_floor;
|
||||
vm.info.price_coplus = response.data.price_coplus;
|
||||
}
|
||||
},'json')
|
||||
}else{
|
||||
vm.info.price_car = <?=$info['price_car']?>;
|
||||
vm.info.price_floor = <?=$info['price_floor']?>;
|
||||
vm.info.price_coplus = <?=$info['price_coplus']?>;
|
||||
vm.info.price_color = <?=$info['price_color']?>;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@@ -0,0 +1,307 @@
|
||||
|
||||
<div class="coms-table-wrap">
|
||||
<div class="coms-table-hd clearfix no-border">
|
||||
<form action="/auto/business" class="form-search" onsubmit="return false">
|
||||
<div class="am-form am-form-horizontal">
|
||||
<div class="am-form-group fl">
|
||||
<label class="am-para-label">车辆属性:</label>
|
||||
<div class="am-para-inline w150">
|
||||
<select name="brand_id" v-model="params.brand_id">
|
||||
<option value="">选择品牌</option>
|
||||
<option :value="i" v-for="(v,i) in brandAry">{{v}}</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="am-para-inline w150">
|
||||
<select name="s_id" v-model="params.s_id">
|
||||
<option value="">选择车系</option>
|
||||
<option :value="i" v-for="(v,i) in seryAry">{{v}}</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="am-para-inline w120">
|
||||
<select name="v_id" v-model="params.v_id">
|
||||
<option value="">选择车型</option>
|
||||
<option :value="v.id" v-for="(v,i) in attrvAry">{{v.title}}</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group">
|
||||
<label class="am-para-label">状态:</label>
|
||||
<div class="am-para-inline w150">
|
||||
<select name="status" v-model="params.status">
|
||||
<option value="">请选择</option>
|
||||
<option :value="i" v-for="(v,i) in statusAry">{{v}}</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group fl">
|
||||
<label class="am-para-label">城市:</label>
|
||||
<div class="am-para-inline w150">
|
||||
<select name="city_id" v-model="params.city_id">
|
||||
<option value="">请选择</option>
|
||||
<option :value="v.city_id" v-for="(v,i) in cityAry">{{v.name}}</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group fl">
|
||||
<label class="am-para-label">年月:</label>
|
||||
<div class="am-para-inline">
|
||||
<div class="am-para-inline w70">
|
||||
<select name="year" v-model="params.year">
|
||||
<option value="">全部</option>
|
||||
<option :value="v" v-for="(v,i) in yearAry">{{v}}</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="am-para-inline w60">
|
||||
<select name="month" v-model="params.month">
|
||||
<option value="">全部</option>
|
||||
<option :value="v" v-for="(v,i) in monthAry">{{v}}</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group fl ml20">
|
||||
<button type="submit" class="am-btn am-btn-sm am-btn-success w100">搜索</button>
|
||||
<a class="am-btn am-btn-sm am-btn-success w100" data-modal="/auto/business/get" data-title="新增">新增</a>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="coms-table-bd">
|
||||
<div class="fr">共有<?= $pager['totle'] ?>条数据</div>
|
||||
<table class="am-table am-table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<th width="5%">
|
||||
<label><input type="checkbox" data-check-target=".ids"></label>
|
||||
<span>ID</span>
|
||||
</th>
|
||||
<th width="10%"><span>裸车报价</span></th>
|
||||
<th width="10%"><span>车辆底价</span></th>
|
||||
<th width="6%"><span>单车利润</span></th>
|
||||
<th width="6%"><span>保险利润</span></th>
|
||||
<th width="6%"><span>贷款利润</span></th>
|
||||
<th width="6%"><span>挂牌利润</span></th>
|
||||
<!--
|
||||
<th width="10%"><span>公司加价</span></th>
|
||||
<th width="10%"><span>颜色加价</span></th>
|
||||
-->
|
||||
<th width="7%"><span>城市</span></th>
|
||||
<th width="7%"><span>时间</span></th>
|
||||
<th width="10%"><span>生效时间</span></th>
|
||||
<th width="7%"><span>是否生效</span></th>
|
||||
<th width=""><span>操作</span></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<template v-for="(v,i) in lists">
|
||||
<tr class="tl">
|
||||
<td colspan="12">车型:<span style="font-weight: 600;color:#FF7F50;">{{v.title}}</span></td>
|
||||
</tr>
|
||||
<tr >
|
||||
<td>
|
||||
<label><input type="checkbox" name="ids[]" class="ids" :value="v.id"/></label>
|
||||
<span>{{v.id}}</span>
|
||||
</td>
|
||||
<td>{{v.price_car}}</td>
|
||||
<td>{{v.price_floor}}</td>
|
||||
<td>{{v.profix_car}}</td>
|
||||
<td>{{v.profix_insure}}</td>
|
||||
<td>{{v.profix_loan}}</td>
|
||||
<td>{{v.profix_carno}}</td>
|
||||
<!--
|
||||
<td>{{v.price_coplus}}</td>
|
||||
<td>{{v.price_color}}</td>
|
||||
-->
|
||||
<td>{{v.city_cn}}</td>
|
||||
<td>{{v.month}}</td>
|
||||
<td>{{v.s_effect_time}}</td>
|
||||
<td>{{v.effect_status}}</td>
|
||||
<td>
|
||||
<a :data-modal="'/auto/business/get?id='+v.id+'&type=copy'" class="am-btn am-btn-success am-btn-xs">
|
||||
复制
|
||||
</a>
|
||||
<a href="javascript:void(0);" class="am-btn am-btn-primary am-btn-xs"
|
||||
:data-modal="'/auto/business/get?id='+v.id" :data-title="v.title">编辑</a>
|
||||
<a :data-update="v.id" data-action="/auto/business/edit_status" class="am-btn am-btn-danger am-btn-xs"
|
||||
data-field="status" data-value="0" v-if="1==v.status">关闭</a>
|
||||
<a :data-update="v.id" data-action="/auto/business/edit_status" class="am-btn am-btn-success am-btn-xs"
|
||||
data-field="status" data-value="1" v-if="0==v.status">开启</a>
|
||||
</td>
|
||||
</tr>
|
||||
</template>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="coms-table-ft clearfix">
|
||||
<div class="hander am-form">
|
||||
<label class="fl mr5"><input type="checkbox" data-check-target=".ids">全选</label>
|
||||
<div class="am-para-inline w120">
|
||||
<select data-update-group="" data-list-target=".ids" data-action="/auto/cars/edit_status"
|
||||
data-field="status">
|
||||
<option value="">批量操作</option>
|
||||
<option value="0">关闭</option>
|
||||
<option value="1">开启</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="coms-pagination fr mr20">
|
||||
<?php page_view($pager) ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
require(['laydate'], function (laydate) {
|
||||
laydate.render({
|
||||
elem: '#id-time',
|
||||
format:'yyyy-MM'
|
||||
});
|
||||
});
|
||||
var vue_obj;
|
||||
var loading = 0;
|
||||
$(function(){
|
||||
vue_obj = new Vue({
|
||||
el: '.coms-table-wrap',
|
||||
data: {
|
||||
params:[],
|
||||
lists:[],
|
||||
statusAry:[],
|
||||
brandAry:[],
|
||||
seryAry:[],
|
||||
attrvAry:[],
|
||||
cityAry:[],
|
||||
yearAry :[],
|
||||
monthAry :[],
|
||||
info_edit:{}
|
||||
},
|
||||
mounted:function() {
|
||||
var vm = this;
|
||||
var lists = [];
|
||||
lists = <?=json_encode($lists)?>;
|
||||
vm.params = <?=json_encode($params)?>;
|
||||
vm.statusAry = <?=json_encode($statusAry)?>;
|
||||
vm.brandAry = <?=json_encode($brandAry)?>;
|
||||
vm.cityAry = <?=json_encode($cityAry)?>;
|
||||
vm.yearAry = <?=json_encode($yearAry)?>;
|
||||
vm.monthAry = <?=json_encode($monthAry)?>;
|
||||
|
||||
vm.lists = lists;
|
||||
},
|
||||
methods:{
|
||||
set_edit:function(index, type){
|
||||
var vm = this;
|
||||
var row = vm.lists[index];
|
||||
if(1 == type){
|
||||
if(undefined != vm.info_edit.index){
|
||||
//旧的编辑取消
|
||||
vm.lists[vm.info_edit.index].edit = 0;
|
||||
}
|
||||
row.edit = 1;
|
||||
vm.info_edit = JSON.parse(JSON.stringify(row));
|
||||
vm.info_edit.index = index;
|
||||
} else {
|
||||
row.edit = 0;
|
||||
vm.info_edit = {};
|
||||
}
|
||||
},
|
||||
save_edit:function(){
|
||||
var vm = this;
|
||||
if(1 == loading){
|
||||
return 0;
|
||||
}
|
||||
loading = 1;
|
||||
|
||||
$.ajax({
|
||||
url: 'auto/cars/edit',
|
||||
type: 'post',
|
||||
dataType: 'json',
|
||||
data: {info:vm.info_edit},
|
||||
beforeSend: function () {
|
||||
layer.load(1, {
|
||||
shade: [0.1, '#fff'] //0.1透明度的白色背景
|
||||
});
|
||||
},
|
||||
success: function (data) {
|
||||
loading = 0;
|
||||
if (data['code']) {
|
||||
layer.msg(data.msg, {
|
||||
icon: 1,
|
||||
time: 2000
|
||||
}, function () {
|
||||
$.form.reload();
|
||||
});
|
||||
} else {
|
||||
layer.msg(data.msg, {icon: 2});
|
||||
}
|
||||
},
|
||||
complete: function () {
|
||||
loading = 0;
|
||||
layer.closeAll('loading');
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
watch:{
|
||||
'params.brand_id':function(nv, ov){
|
||||
var vm = this;
|
||||
vm.seryAry = {};
|
||||
if(nv > 0){
|
||||
$.ajax({
|
||||
url: '/auto/series/json_lists',
|
||||
type: 'post',
|
||||
dataType: 'json',
|
||||
data: {brand_id:nv},
|
||||
beforeSend: function () {},
|
||||
success: function (data) {
|
||||
if (1 == data.code) {
|
||||
var lists = data.data.list;
|
||||
var seryAry = {};
|
||||
for (var i in lists){
|
||||
var row = lists[i];
|
||||
seryAry[row.id] = row.name;
|
||||
}
|
||||
vm.seryAry = seryAry;
|
||||
if(vm.params.s_id>0 && undefined == seryAry[vm.params.s_id]){
|
||||
vm.params.s_id = '';
|
||||
}
|
||||
}
|
||||
},
|
||||
complete: function () {
|
||||
loading = 0;
|
||||
layer.closeAll('loading');
|
||||
}
|
||||
});
|
||||
} else {
|
||||
vm.params.s_id = '';
|
||||
}
|
||||
},
|
||||
'params.s_id':function(nv, ov){
|
||||
var vm = this;
|
||||
if (nv > 0) {
|
||||
//型号
|
||||
$.ajax({
|
||||
type: 'post',
|
||||
url: '/auto/attr/json_lists',
|
||||
dataType: 'json',
|
||||
data: {
|
||||
s_id: nv,
|
||||
status: 1,
|
||||
type: 1
|
||||
},
|
||||
success: function (response) {
|
||||
if (response.code == 1) {
|
||||
vm.attrvAry = response.data.list;
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
vm.attrvAry = [];
|
||||
vm.params.v_id = '';
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
<?php page_script($pager) ?>
|
||||
});
|
||||
</script>
|
||||
|
||||
@@ -0,0 +1,73 @@
|
||||
<form id="vue-edit" class="am-form am-form-horizontal" data-auto="true" method="post" style="width: 90%;padding-top: 10px">
|
||||
<div class="am-form-group">
|
||||
<template v-if="lists.length>0">
|
||||
<div v-for="(item,key) in lists">
|
||||
<label class="am-para-label pl5">
|
||||
<input type="text" placeholder="名称" name="" v-model="item.name"/>
|
||||
</label>
|
||||
<div class="am-para-input form-group input-group">
|
||||
<input type="number" class="" placeholder="金额" v-model="item.money" style="display:inline;width:100px">
|
||||
<select class="ml5" v-model="item.type" style="display:inline;width:100px;">
|
||||
<option v-for="(v,k) in type_arr" :value="k">{{v}}</option>
|
||||
</select>
|
||||
<a href="javascript:;" v-if="key==0" class="am-btn am-btn-sm am-btn-default ml10" @click="add_list">+</a>
|
||||
<a href="javascript:;" v-else @click="remove(key)" class="am-btn am-btn-sm am-btn-default ml10" @click="add_list">-</a>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<template v-else>
|
||||
<a href="javascript:;" class="am-btn am-btn-sm am-btn-default ml10" @click="add_list">+</a>
|
||||
</template>
|
||||
</div>
|
||||
|
||||
<div class="am-form-group" style="margin-bottom: 2rem">
|
||||
<div class="am-para-input">
|
||||
<a href="javascript:;" class="am-btn am-btn-secondary" type="button" @click="saveEdit">保存</a>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<script>
|
||||
var loading = 0;
|
||||
var vue_obj;
|
||||
$(function(){
|
||||
vue_obj = new Vue({
|
||||
el: '#vue-edit',
|
||||
data: {
|
||||
lists:[],
|
||||
id: '',
|
||||
type_arr:[]
|
||||
},
|
||||
mounted:function(){
|
||||
this.lists = <?=json_encode($lists,JSON_UNESCAPED_UNICODE)?>;
|
||||
this.id = '<?=$id?>',
|
||||
this.type_arr = <?=json_encode($type_arr,JSON_UNESCAPED_UNICODE)?>
|
||||
},
|
||||
methods:{
|
||||
saveEdit:function(){
|
||||
$.post('/biz/settle/add_price',{'id':this.id,'lists':this.lists},function(data){
|
||||
if (data.code) {
|
||||
layer.msg(data.msg, {time: 2000, icon: 1}, function () {
|
||||
layer.closeAll()
|
||||
$.form.reload();
|
||||
});
|
||||
} else {
|
||||
layer.msg(data.msg, {icon: 2});
|
||||
}
|
||||
},'json');
|
||||
},
|
||||
add_list:function(){
|
||||
null_tmp = {
|
||||
'name' : '',
|
||||
'money': 0.00,
|
||||
'type':0
|
||||
}
|
||||
this.lists.push(null_tmp)
|
||||
},
|
||||
remove:function(index){
|
||||
this.lists.splice(index,1)
|
||||
}
|
||||
},
|
||||
watch:{}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@@ -0,0 +1,248 @@
|
||||
<div class="coms-table-wrap">
|
||||
<div class="coms-table-hd clearfix no-border">
|
||||
<form action="/biz/settle" class="form-search" onsubmit="return false">
|
||||
<div class="am-form am-form-horizontal">
|
||||
<div class="am-form-group fl">
|
||||
<label class="am-para-label">车辆属性:</label>
|
||||
<div class="am-para-inline w150">
|
||||
<select name="brand_id" v-model="params.brand_id">
|
||||
<option value="">选择品牌</option>
|
||||
<option :value="i" v-for="(v,i) in brandAry">{{v}}</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="am-para-inline w150">
|
||||
<select name="s_id" v-model="params.s_id">
|
||||
<option value="">选择车系</option>
|
||||
<option :value="i" v-for="(v,i) in seryAry">{{v}}</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="am-para-inline w120">
|
||||
<select name="v_id" v-model="params.v_id">
|
||||
<option value="">选择车型</option>
|
||||
<option :value="v.id" v-for="(v,i) in attrvAry">{{v.title}}</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group fl">
|
||||
<label class="am-para-label">年月:</label>
|
||||
<div class="am-para-inline">
|
||||
<div class="am-para-inline w70">
|
||||
<select name="year" v-model="params.year">
|
||||
<option value="">全部</option>
|
||||
<option :value="v" v-for="(v,i) in yearAry">{{v}}</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="am-para-inline w60">
|
||||
<select name="month" v-model="params.month">
|
||||
<option value="">全部</option>
|
||||
<option :value="v" v-for="(v,i) in monthAry">{{v}}</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group fl ml20">
|
||||
<input type="hidden" value="<?=$params['biz_id']?>" name="biz_id">
|
||||
<button type="submit" class="am-btn am-btn-sm am-btn-success w100">搜索</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="coms-table-bd">
|
||||
<table class="am-table am-table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<th width="5%">
|
||||
<span>ID</span>
|
||||
</th>
|
||||
<th width="10%"><span>门店</span></th>
|
||||
<th width="20%"><span>订单信息</span></th>
|
||||
<th width="10%"><span>单车利润</span></th>
|
||||
<th width="10%"><span>保险利润</span></th>
|
||||
<th width="6%"><span>贷款利润</span></th>
|
||||
<th width="6%"><span>挂牌利润</span></th>
|
||||
<th width="6%"><span>拖车费</span></th>
|
||||
<th width="6%"><span>时间</span></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<template v-for="(v,i) in lists">
|
||||
<tr >
|
||||
<td>
|
||||
<span>{{v.id}}</span>
|
||||
</td>
|
||||
<td>{{v.biz_name}}</td>
|
||||
<td>
|
||||
<a href="javascript:;" :data-open="'/receiver/orderv2/orders/get?id='+v.o_id">
|
||||
{{v.name}} {{v.mobile}}<br>
|
||||
{{v.title}} {{v.vin}}
|
||||
</a>
|
||||
</td>
|
||||
<td>{{v.profix_car}}</td>
|
||||
<td>{{v.profix_insure}}</td>
|
||||
<td>{{v.profix_loan}}</td>
|
||||
<td>{{v.profix_carno}}</td>
|
||||
<td>{{v.price_trucking}}</td>
|
||||
<td>{{v.month}}</td>
|
||||
</tr>
|
||||
</template>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="coms-table-ft clearfix">
|
||||
<div class="coms-pagination fr mr20">
|
||||
<?php page_view($pager) ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
require(['laydate'], function (laydate) {
|
||||
laydate.render({
|
||||
elem: '#id-time',
|
||||
format:'yyyy-MM'
|
||||
});
|
||||
});
|
||||
var vue_obj;
|
||||
var loading = 0;
|
||||
$(function(){
|
||||
vue_obj = new Vue({
|
||||
el: '.coms-table-wrap',
|
||||
data: {
|
||||
params:[],
|
||||
lists:[],
|
||||
brandAry:[],
|
||||
seryAry:[],
|
||||
attrvAry:[],
|
||||
yearAry :[],
|
||||
monthAry :[],
|
||||
info_edit:{}
|
||||
},
|
||||
mounted:function() {
|
||||
var vm = this;
|
||||
var lists = [];
|
||||
lists = <?=json_encode($lists)?>;
|
||||
vm.params = <?=json_encode($params)?>;
|
||||
vm.brandAry = <?=json_encode($brandAry)?>;
|
||||
vm.yearAry = <?=json_encode($yearAry)?>;
|
||||
vm.monthAry = <?=json_encode($monthAry)?>;
|
||||
|
||||
vm.lists = lists;
|
||||
},
|
||||
methods:{
|
||||
set_edit:function(index, type){
|
||||
var vm = this;
|
||||
var row = vm.lists[index];
|
||||
if(1 == type){
|
||||
if(undefined != vm.info_edit.index){
|
||||
//旧的编辑取消
|
||||
vm.lists[vm.info_edit.index].edit = 0;
|
||||
}
|
||||
row.edit = 1;
|
||||
vm.info_edit = JSON.parse(JSON.stringify(row));
|
||||
vm.info_edit.index = index;
|
||||
} else {
|
||||
row.edit = 0;
|
||||
vm.info_edit = {};
|
||||
}
|
||||
},
|
||||
save_edit:function(){
|
||||
var vm = this;
|
||||
if(1 == loading){
|
||||
return 0;
|
||||
}
|
||||
loading = 1;
|
||||
|
||||
$.ajax({
|
||||
url: 'auto/cars/edit',
|
||||
type: 'post',
|
||||
dataType: 'json',
|
||||
data: {info:vm.info_edit},
|
||||
beforeSend: function () {
|
||||
layer.load(1, {
|
||||
shade: [0.1, '#fff'] //0.1透明度的白色背景
|
||||
});
|
||||
},
|
||||
success: function (data) {
|
||||
loading = 0;
|
||||
if (data['code']) {
|
||||
layer.msg(data.msg, {
|
||||
icon: 1,
|
||||
time: 2000
|
||||
}, function () {
|
||||
$.form.reload();
|
||||
});
|
||||
} else {
|
||||
layer.msg(data.msg, {icon: 2});
|
||||
}
|
||||
},
|
||||
complete: function () {
|
||||
loading = 0;
|
||||
layer.closeAll('loading');
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
watch:{
|
||||
'params.brand_id':function(nv, ov){
|
||||
var vm = this;
|
||||
vm.seryAry = {};
|
||||
if(nv > 0){
|
||||
$.ajax({
|
||||
url: '/auto/series/json_lists',
|
||||
type: 'post',
|
||||
dataType: 'json',
|
||||
data: {brand_id:nv},
|
||||
beforeSend: function () {},
|
||||
success: function (data) {
|
||||
if (1 == data.code) {
|
||||
var lists = data.data.list;
|
||||
var seryAry = {};
|
||||
for (var i in lists){
|
||||
var row = lists[i];
|
||||
seryAry[row.id] = row.name;
|
||||
}
|
||||
vm.seryAry = seryAry;
|
||||
if(vm.params.s_id>0 && undefined == seryAry[vm.params.s_id]){
|
||||
vm.params.s_id = '';
|
||||
}
|
||||
}
|
||||
},
|
||||
complete: function () {
|
||||
loading = 0;
|
||||
layer.closeAll('loading');
|
||||
}
|
||||
});
|
||||
} else {
|
||||
vm.params.s_id = '';
|
||||
}
|
||||
},
|
||||
'params.s_id':function(nv, ov){
|
||||
var vm = this;
|
||||
if (nv > 0) {
|
||||
//型号
|
||||
$.ajax({
|
||||
type: 'post',
|
||||
url: '/auto/attr/json_lists',
|
||||
dataType: 'json',
|
||||
data: {
|
||||
s_id: nv,
|
||||
status: 1,
|
||||
type: 1
|
||||
},
|
||||
success: function (response) {
|
||||
if (response.code == 1) {
|
||||
vm.attrvAry = response.data.list;
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
vm.attrvAry = [];
|
||||
vm.params.v_id = '';
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
<?php page_script($pager) ?>
|
||||
});
|
||||
</script>
|
||||
|
||||
@@ -0,0 +1,138 @@
|
||||
<div class="coms-table-wrap">
|
||||
<div class="coms-table-hd clearfix no-border">
|
||||
<form action="/biz/settle/lists_static" class="form-search" onsubmit="return false">
|
||||
<div class="am-form am-form-horizontal">
|
||||
<div class="am-form-group fl">
|
||||
<label class="am-para-label">年月:</label>
|
||||
<div class="am-para-inline">
|
||||
<div class="am-para-inline w70">
|
||||
<select name="year" v-model="params.year">
|
||||
<option value="">全部</option>
|
||||
<option :value="v" v-for="(v,i) in yearAry">{{v}}</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="am-para-inline w60">
|
||||
<select name="month" v-model="params.month">
|
||||
<option value="">全部</option>
|
||||
<option :value="v" v-for="(v,i) in monthAry">{{v}}</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group fl ml20">
|
||||
<input type="hidden" value="<?=$params['id']?>" name="id">
|
||||
<button type="submit" class="am-btn am-btn-sm am-btn-success w100">搜索</button>
|
||||
</div>
|
||||
<div class="am-form-group fl ml20">
|
||||
<button type="button" id="export" class="am-btn am-btn-sm am-btn-success w100">导出</button>
|
||||
</div>
|
||||
</div>
|
||||
</form> </div>
|
||||
<div class="coms-table-bd">
|
||||
<table class="am-table am-table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<th width="5%">
|
||||
<span>ID</span>
|
||||
</th>
|
||||
<th width="10%"><span>门店</span></th>
|
||||
<th width="10%"><span>单车总毛利</span></th>
|
||||
<th width="10%"><span>税后单车总毛利</span></th>
|
||||
<th width="6%"><span>水平业务总毛利</span></th>
|
||||
<th width="12%"><span>门店费用</span></th>
|
||||
<th width="12%"><span>其它费用</span></th>
|
||||
<th width="6%"><span>总利润</span></th>
|
||||
<th width="10%"><span>分润</span></th>
|
||||
<th width="6%"><span>时间</span></th>
|
||||
<th width="8%"><span>操作</span></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<template v-for="(v,i) in lists">
|
||||
<tr>
|
||||
<td>
|
||||
<span>{{v.id}}</span>
|
||||
</td>
|
||||
<td>{{v.biz_name}}</td>
|
||||
<td>{{v.profix_car}}</td>
|
||||
<td>{{v.profix_car_after}}</td>
|
||||
<td>{{v.price_all}}</td>
|
||||
<td>
|
||||
店面租金:{{v.rent}}<br>
|
||||
水电费:{{v.wat_ele}}<br>
|
||||
店长工资:{{v.manager_wage}}<br>
|
||||
店员工资:{{v.employee_wage}}<br>
|
||||
抽成:{{v.commission}}<br>
|
||||
拖车费:{{v.price_trucking}}<br>
|
||||
总费用:{{v.total_need}}
|
||||
</td>
|
||||
<td>
|
||||
<template v-for="item in v.price_other">
|
||||
{{item.name}}:{{item.money}}({{type_arr[item.type]}})<br>
|
||||
</template>
|
||||
</td>
|
||||
<td>{{v.price_ml}}</td>
|
||||
<td>
|
||||
狸车分润:{{v.profix_liche}}<br>
|
||||
合伙人分润:{{v.profix_partner}}
|
||||
</td>
|
||||
<td>{{v.month_str}}</td>
|
||||
<td>
|
||||
<a :data-open="'biz/settle?biz_id='+v.biz_id+'&month='+v.month" href="javascript:;">查看明细</a><br>
|
||||
<a :data-modal="'biz/settle/add_price?id='+v.id" data-title="新增费用" href="javascript:;">新增费用</a><br>
|
||||
<a data-ajax="post" data-action="biz/settle/edit_static" :data-params-id="v.id" href="javascript:;">重新结算</a>
|
||||
</td>
|
||||
</tr>
|
||||
</template>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="coms-table-ft clearfix">
|
||||
<div class="coms-pagination fr mr20">
|
||||
<?php page_view($pager) ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
require(['laydate'], function (laydate) {
|
||||
laydate.render({
|
||||
elem: '#id-time',
|
||||
format:'yyyy-MM'
|
||||
});
|
||||
});
|
||||
var vue_obj;
|
||||
var loading = 0;
|
||||
$(function(){
|
||||
vue_obj = new Vue({
|
||||
el: '.coms-table-wrap',
|
||||
data: {
|
||||
params:[],
|
||||
lists:[],
|
||||
yearAry :[],
|
||||
monthAry :[],
|
||||
type_arr : [],
|
||||
},
|
||||
mounted:function() {
|
||||
var vm = this;
|
||||
vm.lists = <?=json_encode($lists)?>;
|
||||
vm.params = <?=json_encode($params)?>;
|
||||
vm.yearAry = <?=json_encode($yearAry)?>;
|
||||
vm.monthAry = <?=json_encode($monthAry)?>;
|
||||
vm.type_arr = <?=json_encode($type_arr)?>;
|
||||
},
|
||||
methods:{
|
||||
},
|
||||
watch:{
|
||||
}
|
||||
});
|
||||
$('#export').on('click', function () {
|
||||
var href = $.menu.parseUri(window.location.href);
|
||||
var count = <?=$pager['totle']?>;
|
||||
layer.msg('导出中请耐心等待几秒钟......');
|
||||
href = href.replace("lists_static?", "export?");
|
||||
window.location.href = href;
|
||||
});
|
||||
<?php page_script($pager) ?>
|
||||
});
|
||||
</script>
|
||||
|
||||
@@ -283,6 +283,18 @@
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<template v-if="info.type==1">
|
||||
<div class="am-form-group">
|
||||
<label class="am-para-label">车型品牌:</label>
|
||||
<div class="am-para-input wp20" v-if="info.type==1">
|
||||
<select name="car_brand_id" v-model="info.car_brand_id">
|
||||
<option v-for="(v,i) in auto_brands" :value="v.id">
|
||||
{{v.name}}
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="am-form-group">
|
||||
<label class="am-para-label">销售公司:</label>
|
||||
<div class="am-para-input wp20">
|
||||
@@ -301,6 +313,7 @@
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<div class="am-form-group">
|
||||
<label class="am-para-label">授权品牌:</label>
|
||||
<div class="am-para-input">
|
||||
|
||||
@@ -0,0 +1,307 @@
|
||||
<form id="vue-edit" class="am-form am-form-horizontal" :action="action" 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 w300">
|
||||
<input type="text" placeholder="输入联系人" name="brand_name" v-model="info.name"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group">
|
||||
<label class="am-para-label">联系电话:</label>
|
||||
<div class="am-para-input w300">
|
||||
<input type="text" placeholder="输入联系电话" name="" v-model="info.mobile"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group">
|
||||
<label class="am-para-label">类型:</label>
|
||||
<div class="am-para-input w150">
|
||||
<select v-model="info.type">
|
||||
<option v-for="(v,i) in type_arr" :value="i">{{v}}</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group">
|
||||
<label class="am-para-label">保证金:</label>
|
||||
<div class="am-para-input w150">
|
||||
<input type="text" placeholder="输入保证金" name="" type="number" v-model="info.margin"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group">
|
||||
<label class="am-para-label">面积:</label>
|
||||
<div class="am-para-input w150">
|
||||
<input type="text" placeholder="输入面积" name="" type="number" v-model="info.area"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group">
|
||||
<label class="am-para-label">租金(月):</label>
|
||||
<div class="am-para-input w150">
|
||||
<input type="text" placeholder="输入租金" name="" type="number" v-model="info.rent"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group">
|
||||
<label class="am-para-label">水电(月):</label>
|
||||
<div class="am-para-input w150">
|
||||
<input type="text" placeholder="输入水电" name="" type="number" v-model="info.wat_ele"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group">
|
||||
<label class="am-para-label">人工工资:</label>
|
||||
<div class="am-para-input w150">
|
||||
<input type="text" placeholder="输入人工工资" name="" type="number" v-model="info.employee_wage"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group">
|
||||
<label class="am-para-label">店长工资:</label>
|
||||
<div class="am-para-input w150">
|
||||
<input type="text" placeholder="输入店长工资" name="" type="number" v-model="info.manager_wage"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group">
|
||||
<label class="am-para-label">裸车抽成:</label>
|
||||
<div class="am-para-input w150">
|
||||
<input type="text" placeholder="输入裸车抽成" name="" type="number" v-model="info.commission"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group">
|
||||
<label class="am-para-label">拖车费:</label>
|
||||
<div class="am-para-input w150">
|
||||
<button type="button" class="am-btn am-btn-default am-btn-sm" @click="brandModal">选择品牌</button>
|
||||
</div>
|
||||
<div class="am-g mt5" v-if="selectedBrands.length>0">
|
||||
<template v-for="(v,i) in selectedBrands">
|
||||
<div class="col-sm-2 text-center">
|
||||
<div>{{v.name}}</div>
|
||||
<div>
|
||||
<input value="" class="wp80" type="number" v-model="v.money" placeholder="拖车金额">
|
||||
</div>
|
||||
<div>
|
||||
</template>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group">
|
||||
<label class="am-para-label">合作时间:</label>
|
||||
<div class="am-para-input">
|
||||
<input type="text" id="s_time" style="width:200px;display:inline" placeholder="开始时间" name="" autocomplete="off" v-model="info.s_time"/>
|
||||
<input type="text" id="e_time" style="width:200px;display:inline" placeholder="结束时间" name="" autocomplete="off" v-model="info.e_time"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group" style="margin-bottom: 2rem">
|
||||
<div class="am-para-input">
|
||||
<button class="am-btn am-btn-secondary" type="button" @click="saveEdit">保存</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="brand-modal" style="display: none;">
|
||||
<div class="modal-body">
|
||||
<div class="header">
|
||||
<form class="form-inline">
|
||||
<div class="form-group">
|
||||
<div class="input-group" style="width: 80px;">
|
||||
</div>
|
||||
<div class="input-group">
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div style="padding-top: 10px;">
|
||||
<div class="vuetable-body-wrapper">
|
||||
<table class="vuetable table table-middle table-hover fixed">
|
||||
<colgroup>
|
||||
<col class="vuetable-col-title" style="width: 50%;">
|
||||
<col class="vuetable-col-actions text-right" style="width: 10%;">
|
||||
</colgroup>
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="vuetable-th-slot-title">商家名</th>
|
||||
<th class="vuetable-th-slot-actions text-right">操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tfoot></tfoot>
|
||||
<tbody class="vuetable-body">
|
||||
<tr v-for="(v,i) in brandsList">
|
||||
<td class="vuetable-slot">
|
||||
{{v.name}}
|
||||
</td>
|
||||
<td class="vuetable-slot text-right">
|
||||
<button type='button' v-if="v.is_checked==0 || !v.is_checked" class="btn btn-sm btn-success"
|
||||
@click="addItem(i)">添加
|
||||
</button>
|
||||
<button type='button' v-if="v.is_checked==1" class="btn btn-sm btn-danger"
|
||||
@click="removeItem(v)">删除
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="clearfix">
|
||||
<span class="pull-left text-muted">第{{brandsPage.page}}页(每页{{brandsPage.pageLimit}}条,共{{brandsPage.pageCount}}条)</span>
|
||||
<nav class="pull-right" aria-label="Page navigation">
|
||||
<ul class="pagination pagination-sm">
|
||||
<li>
|
||||
<a href="javascript:void(0);" @click="beforeShopPage();" aria-label="上一页">
|
||||
<span class="glyphicon glyphicon-menu-left"></span>
|
||||
</a>
|
||||
</li>
|
||||
<li v-if="brandsPage.hasNext">
|
||||
<a href="javascript:void(0);" @click="afterShopPage();" aria-label="下一页">
|
||||
<span class="glyphicon glyphicon-menu-right"></span>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
<script>
|
||||
require(['laydate'], function (laydate) {
|
||||
laydate.render({
|
||||
elem: '#s_time',
|
||||
});
|
||||
laydate.render({
|
||||
elem: '#e_time',
|
||||
});
|
||||
});
|
||||
var loading = 0;
|
||||
var vue_obj;
|
||||
$(function(){
|
||||
vue_obj = new Vue({
|
||||
el: '#vue-edit',
|
||||
data: {
|
||||
info:{},
|
||||
action:'/biz/store/store/edit_info',
|
||||
brandsList: [],
|
||||
brandsPage: [],
|
||||
selectedBrands: [],
|
||||
type_arr: []
|
||||
},
|
||||
mounted:function(){
|
||||
var vm = this;
|
||||
vm.info = <?=$info ? json_encode($info) : '{}'?>;
|
||||
vm.selectedBrands = <?=json_encode($brands,JSON_UNESCAPED_UNICODE)?>;
|
||||
vm.type_arr = <?=json_encode($type_arr,JSON_UNESCAPED_UNICODE)?>;
|
||||
},
|
||||
methods:{
|
||||
saveEdit:function(){
|
||||
var vm = this;
|
||||
if(1 == loading){
|
||||
return 0;
|
||||
}
|
||||
loading = 1;
|
||||
|
||||
vm.info.s_time = $("#s_time").val();
|
||||
vm.info.e_time = $("#e_time").val();
|
||||
$.ajax({
|
||||
url: vm.action,
|
||||
type: 'post',
|
||||
dataType: 'json',
|
||||
data: {info:vm.info,brands:vm.selectedBrands},
|
||||
beforeSend: function () {
|
||||
layer.load(1, {
|
||||
shade: [0.1, '#fff'] //0.1透明度的白色背景
|
||||
});
|
||||
},
|
||||
success: function (data) {
|
||||
loading = 0;
|
||||
if (1 == data.code) {
|
||||
layer.msg(data.msg, {
|
||||
icon: 1,
|
||||
time: 2000
|
||||
}, function () {
|
||||
$.form.reload();
|
||||
});
|
||||
} else {
|
||||
layer.msg(data.msg, {icon: 2});
|
||||
}
|
||||
},
|
||||
complete: function () {
|
||||
loading = 0;
|
||||
layer.closeAll('loading');
|
||||
}
|
||||
});
|
||||
},
|
||||
//选择商家
|
||||
brandModal: function () {
|
||||
var that = this;
|
||||
layer.open({
|
||||
type: 1,
|
||||
area: ['55%', '80%'], //宽高
|
||||
content: $('#brand-modal'),
|
||||
title: '选择商家',
|
||||
shade: false,
|
||||
btn: ['选好了'],
|
||||
yes: function (index) {
|
||||
layer.close(index);
|
||||
}
|
||||
});
|
||||
data = {
|
||||
//page: that.brandsThPage,
|
||||
//ids: that.sys_type_id == 1 ? that.info.brandIds : that.info.bizIds,
|
||||
};
|
||||
$.post('/common/brands',data,function(json){
|
||||
var brandsList = json.data.itemsList;
|
||||
that.brandsPage = json.data.itemsPage;
|
||||
brandsList.map(function (_item, _index) {
|
||||
brandsList[_index]['money'] = 0.00
|
||||
for (var index in that.selectedBrands) {
|
||||
var item = that.selectedBrands[index];
|
||||
var id = item.id;
|
||||
if (id == _item.id) {
|
||||
brandsList[_index].is_checked = 1;
|
||||
break;
|
||||
} else {
|
||||
brandsList[_index].is_checked = 0;
|
||||
}
|
||||
}
|
||||
})
|
||||
that.brandsList = brandsList;
|
||||
},'json');
|
||||
},
|
||||
beforeShopPage: function () {
|
||||
var vm = this;
|
||||
if (vm.brandsThPage == 1) {
|
||||
alert('已经是第一页了');
|
||||
return;
|
||||
}
|
||||
vm.brandsThPage--;
|
||||
return this.brandModal();
|
||||
},
|
||||
afterShopPage: function () {
|
||||
var vm = this;
|
||||
vm.brandsThPage++;
|
||||
return this.brandModal();
|
||||
},
|
||||
removeBrand: function (index) {
|
||||
var vm = this;
|
||||
vm.selectedBrands.splice(index, 1);
|
||||
},
|
||||
addItem: function (index) {
|
||||
var vm = this;
|
||||
var brand_id = vm.brandsList[index]['id'];
|
||||
var _shop = {
|
||||
id: brand_id,
|
||||
name: vm.brandsList[index]['name'],
|
||||
money: vm.brandsList[index]['money'],
|
||||
};
|
||||
vm.selectedBrands.push(_shop);
|
||||
vm.brandsList[index]['is_checked'] = 1;
|
||||
},
|
||||
removeItem: function (item) {
|
||||
var vm = this;
|
||||
this.selectedBrands = this.selectedBrands.filter(function (_item) {
|
||||
var id = _item.id;
|
||||
return id != item.id;
|
||||
})
|
||||
this.brandsList.map(function (_item, _index) {
|
||||
if (item.id == _item.id) {
|
||||
vm.brandsList[_index].is_checked = 0;
|
||||
}
|
||||
})
|
||||
},
|
||||
},
|
||||
watch:{}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@@ -153,6 +153,12 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="6" class="align-r">
|
||||
<?if($v['type']==2){?>
|
||||
<a data-open="/biz/store/store/get_info?id=<?= $v['id'] ?>"
|
||||
class="am-btn am-btn-primary am-btn-xs">基本信息</a>
|
||||
<a data-open="/biz/settle/lists_static?id=<?= $v['id'] ?>"
|
||||
class="am-btn am-btn-primary am-btn-xs">结算统计</a>
|
||||
<?}?>
|
||||
<a data-open="/biz/situation/get?id=<?= $v['id'] ?>"
|
||||
class="am-btn am-btn-primary am-btn-xs">概况</a>
|
||||
<a href="javascript:void(0);" class="am-btn am-btn-primary am-btn-xs"
|
||||
|
||||
@@ -0,0 +1,81 @@
|
||||
<script type="text/javascript" src="/static/js/common/jquery-3.0.0.js"></script>
|
||||
<script type="text/javascript" src="/static/js/plugin/layer/layer.js"></script>
|
||||
<script>
|
||||
//调用示例
|
||||
var json = {
|
||||
// "title": "", //相册标题
|
||||
// "id": 123, //相册id
|
||||
// "start": 0, //初始显示的图片序号,默认0
|
||||
"data": <?=json_encode($lists,JSON_UNESCAPED_UNICODE)?>
|
||||
};
|
||||
var num = 0;
|
||||
layer.photos({
|
||||
photos: json
|
||||
,anim: 5 //0-6的选择,指定弹出图片动画类型,默认随机(请注意,3.0之前的版本用shift参数)
|
||||
,closeBtn: 1,
|
||||
tab:function () {
|
||||
num=0;
|
||||
$("#layui-layer-photos").parent().append('<div class="icon" style="position:relative;width:100%;text-align:center;cursor:pointer;">\n' +
|
||||
'\t\t<img src="/img/xuanzhuan.png" style="width:30px;height:30px;">\n' +
|
||||
'\t</div>');
|
||||
}
|
||||
});
|
||||
//旋转图片
|
||||
$(document).on("click", ".icon img", function (e) {
|
||||
num = (num + 90) % 360;
|
||||
$(".layui-layer.layui-layer-page.layui-layer-photos").css('background', 'black');//旋转之后背景色设置为黑色,不然在旋转长方形图片时会留下白色空白
|
||||
$("#layui-layer-photos").css('transform', 'rotate(' + num + 'deg)');
|
||||
});
|
||||
//图片放大缩小
|
||||
$(document).on("mousewheel DOMMouseScroll", ".layui-layer-phimg", function (e) {
|
||||
var delta = (e.originalEvent.wheelDelta && (e.originalEvent.wheelDelta > 0 ? 1 : -1)) || // chrome & ie
|
||||
(e.originalEvent.detail && (e.originalEvent.detail > 0 ? -1 : 1)); // firefox
|
||||
var imagep = $(".layui-layer-phimg").parent().parent();
|
||||
var image = $(".layui-layer-phimg").parent();
|
||||
var h = image.height();
|
||||
var w = image.width();
|
||||
var img_url = $("#imglayer").attr("src");
|
||||
// 创建对象
|
||||
var img = new Image();
|
||||
// 改变图片的src
|
||||
img.src = img_url;
|
||||
var width = img.width;
|
||||
var height = img.height;
|
||||
debugger;
|
||||
if (delta > 0) {
|
||||
if (h < (window.innerHeight)) {
|
||||
h = h * 1.05;
|
||||
w = w * 1.05;
|
||||
width = width * 1.05;
|
||||
height = height * 1.05;
|
||||
}
|
||||
} else if (delta < 0) {
|
||||
if (h > 100) {
|
||||
h = h * 0.95;
|
||||
w = w * 0.95;
|
||||
width = width * 0.95;
|
||||
height = height * 0.95;
|
||||
}
|
||||
}
|
||||
imagep.css("top", (window.innerHeight - h) / 2);
|
||||
imagep.css("left", (window.innerWidth - w) / 2);
|
||||
image.height(h);
|
||||
image.width(w);
|
||||
imagep.height(h);
|
||||
imagep.width(w);
|
||||
var current = $("#current").val();
|
||||
if ((current / 90) % 2 == 1) {
|
||||
$('#imglayer').css("width", h);
|
||||
$('#imglayer').css("margin-top", -(w - h) / 2);
|
||||
if (height < width) {
|
||||
$('#imglayer').css("margin-left", (w - h) / 2);
|
||||
}
|
||||
} else {
|
||||
$('#imglayer').css("width", w);
|
||||
$('#imglayer').css("margin-top", 0);
|
||||
if (height < width) {
|
||||
$('#imglayer').css("margin-left", 0);
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
@@ -0,0 +1,77 @@
|
||||
<form class="am-form am-form-horizontal" action="/receiver/orderv2/orders/add_paylog" data-auto="true" method="post"
|
||||
style="width: 90%;padding-top: 10px">
|
||||
<input type="hidden" name="id" value="<?= $id ?>">
|
||||
<div class="am-form-group">
|
||||
<label class="am-para-label">支付金额:</label>
|
||||
<div class="am-para-input">
|
||||
<input type="number" value="" name="money">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="am-form-group">
|
||||
<label class="am-para-label">订单类型:</label>
|
||||
<div class="am-para-input w150">
|
||||
<select name="type">
|
||||
<?foreach($type as $item){?>
|
||||
<option value="<?=$item['id']?>"><?=$item['name']?></option>
|
||||
<?}?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="am-form-group">
|
||||
<label class="am-para-label">收款公司:</label>
|
||||
<div class="am-para-input w150">
|
||||
<select name="wx_mchid">
|
||||
<?foreach($companys as $item){?>
|
||||
<option value="<?=$item['wx_mchid']?>"><?=$item['short']?></option>
|
||||
<?}?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="am-form-group">
|
||||
<label class="am-para-label">支付截图:</label>
|
||||
<div class="am-para-input">
|
||||
<button type="button" class="am-btn am-btn-default am-btn-sm"
|
||||
data-file="1" data-type="jpg,png,gif,png,jpeg"
|
||||
data-uptype="qiniu" data-field="img"><i class="am-icon-cloud-upload"></i> 选择要上传的文件
|
||||
</button>
|
||||
|
||||
<input type="hidden" name="img"
|
||||
onchange="$(this).next('img').attr('src', $(this).data('srcs') || this.value)"
|
||||
value="" class="layui-input">
|
||||
<img data-tips-image style="height:auto;max-height:32px;min-width:32px"
|
||||
src=""/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="am-form-group">
|
||||
<label class="am-para-label">支付时间:</label>
|
||||
<div class="am-para-input">
|
||||
<input type="text" value="" id="pay_time" name="pay_time" autocomplete="off">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="am-form-group">
|
||||
<label class="am-para-label">备注:</label>
|
||||
<div class="am-para-input">
|
||||
<textarea name="descrip"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="am-form-group" style="margin-bottom: 2rem">
|
||||
<div class="am-para-input">
|
||||
<button class="am-btn am-btn-secondary" type="submit">保存</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<script>
|
||||
require(['laydate'], function (laydate) {
|
||||
laydate.render({
|
||||
elem: '#pay_time'
|
||||
, type: 'date'
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@@ -0,0 +1,175 @@
|
||||
<div class="am-panel am-panel-default" v-if="info.status>0">
|
||||
<div class="am-panel-hd">
|
||||
<span style="font-size: 20px">代办服务</span>
|
||||
<span style="float:right;margin-top:5px">
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div class="am-panel-bd am-g" style="margin-top: 10px;margin-bottom: 10px;">
|
||||
<form id="agent_form">
|
||||
<div class="am-form-inline">
|
||||
<div class="am-form-group am-u-lg-6">
|
||||
<label class="am-para-label label-width"><span class="span-bold">车牌号:</span></label>
|
||||
<div class="am-para-input">
|
||||
<label class="am-para-label" style="width: 50%"><input type="text" name="car_num"
|
||||
v-model="info.agent.car_num"></label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group am-u-lg-6">
|
||||
<label class="am-para-label label-width"><span class="span-bold">挂牌是否代办:</span></label>
|
||||
<div class="am-para-input">
|
||||
<label class="am-checkbox-inline">
|
||||
<input type="radio" name="if_listed_db" value="0" v-model="info.agent.if_listed_db"> 否
|
||||
</label>
|
||||
<label class="am-checkbox-inline">
|
||||
<input type="radio" name="if_listed_db" value="1" v-model="info.agent.if_listed_db"> 是
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-inline">
|
||||
<div class="am-form-group am-u-lg-12"></div>
|
||||
</div>
|
||||
<div class="am-form-inline">
|
||||
<div class="am-form-group am-u-lg-6">
|
||||
<label class="am-para-label label-width"><span class="span-bold">保险公司:</span></label>
|
||||
<div class="am-para-input">
|
||||
<label class="am-para-label" style="width: 50%"><input type="text" name="company"
|
||||
v-model="info.agent.company"></label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group am-u-lg-6">
|
||||
<label class="am-para-label label-width"><span class="span-bold">保险是否代办:</span></label>
|
||||
<div class="am-para-input">
|
||||
<label class="am-checkbox-inline">
|
||||
<input type="radio" name="if_ins_db" value="0" v-model="info.agent.if_ins_db"> 否
|
||||
</label>
|
||||
<label class="am-checkbox-inline">
|
||||
<input type="radio" name="if_ins_db" value="1" v-model="info.agent.if_ins_db"> 是
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-inline">
|
||||
<div class="am-form-group am-u-lg-12"></div>
|
||||
</div>
|
||||
<div class="am-form-inline">
|
||||
<div class="am-form-group am-u-lg-6">
|
||||
<label class="am-para-label label-width"><span class="span-bold">保险到期时间:</span></label>
|
||||
<div class="am-para-input">
|
||||
<label class="am-para-label" style="width: 50%"><input type="text" name="ins_time" id="ins_time"
|
||||
value="<?= $info['agent']['ins_time'] ?>"></label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-inline">
|
||||
<div class="am-form-group am-u-lg-12"></div>
|
||||
</div>
|
||||
<div class="am-form-inline">
|
||||
<div class="am-form-group am-u-lg-6">
|
||||
<label class="am-para-label label-width"><span class="span-bold">交强险费用:</span></label>
|
||||
<div class="am-para-input">
|
||||
<label class="am-para-label" style="width: 50%"><input type="text" name="ins_risk"
|
||||
v-model="info.agent.ins_risk"></label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group am-u-lg-6">
|
||||
<label class="am-para-label label-width"><span class="span-bold">商业险费用:</span></label>
|
||||
<div class="am-para-input">
|
||||
<label class="am-para-label" style="width: 50%"><input type="text" name="business_risk"
|
||||
v-model="info.agent.business_risk"></label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-inline">
|
||||
<div class="am-form-group am-u-lg-12" style="margin-top: 5px;">
|
||||
<div class="admin-content">
|
||||
<label class="am-para-label label-width"><span class="span-bold">登记证:</span></label>
|
||||
<div class="am-para-input">
|
||||
<div class="am-form-group am-form-file">
|
||||
<button type="button" class="am-btn am-btn-default am-btn-sm fl"
|
||||
data-file="1" data-mark="file" data-type="pdf,jpg,png,gif,png,jpeg"
|
||||
data-uptype="qiniu" data-params-source="vue_obj.register_img">
|
||||
<i class="am-icon-cloud-upload"></i> 选择要上传的文件
|
||||
</button>
|
||||
<div class="photo-upload mt10 fl">
|
||||
<div class="photo-upload-item" v-for="(v,i) in register_img">
|
||||
<a :href="v.src" target="_blank" :data-value='v.value' class="ml10 mt5"
|
||||
style="width:100px;line-height:20px;">{{v.title}}</a>
|
||||
<span class="photo-upload-item-remove">
|
||||
<i class="fa fa-remove" data-rm-vue="vue_obj.register_img" :data-index="i"></i>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-inline">
|
||||
<div class="am-form-group am-u-lg-12" style="margin-top: 5px;">
|
||||
<div class="admin-content">
|
||||
<label class="am-para-label label-width"><span class="span-bold">行驶证:</span></label>
|
||||
<div class="am-para-input">
|
||||
<div class="am-form-group am-form-file">
|
||||
<button type="button" class="am-btn am-btn-default am-btn-sm fl"
|
||||
data-file="1" data-mark="file" data-type="pdf,jpg,png,gif,png,jpeg"
|
||||
data-uptype="qiniu" data-params-source="vue_obj.car_imgs">
|
||||
<i class="am-icon-cloud-upload"></i> 选择要上传的文件
|
||||
</button>
|
||||
<div class="photo-upload mt10 fl">
|
||||
<div class="photo-upload-item" v-for="(v,i) in car_imgs">
|
||||
<a :href="v.src" target="_blank" :data-value='v.value' class="ml10 mt5"
|
||||
style="width:100px;line-height:20px;">{{v.title}}</a>
|
||||
<span class="photo-upload-item-remove">
|
||||
<i class="fa fa-remove" data-rm-vue="vue_obj.car_imgs" :data-index="i"></i>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-inline">
|
||||
<div class="am-form-group am-u-lg-12">
|
||||
<label class="am-para-label label-width"><span class="span-bold">保险单:</span></label>
|
||||
<div class="am-para-input">
|
||||
<div class="am-form-group am-form-file">
|
||||
<button type="button" class="am-btn am-btn-default am-btn-sm fl"
|
||||
data-file="5" data-mark="file" data-type="pdf,jpg,png,gif,png,jpeg"
|
||||
data-params-source="vue_obj.bx_imgs">
|
||||
<i class="am-icon-cloud-upload"></i> 选择要上传的文件
|
||||
</button>
|
||||
<div class="photo-upload mt10 fl">
|
||||
<div class="photo-upload-item" v-for="(v,i) in bx_imgs">
|
||||
<a :href="v.src" target="_blank" :data-value='v.value' class="ml10 mt5"
|
||||
style="width:100px;line-height:20px;">{{v.title}}</a>
|
||||
<span class="photo-upload-item-remove">
|
||||
<i class="fa fa-remove" data-rm-vue="vue_obj.bx_imgs" :data-index="i"></i>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-inline am-u-lg-12">
|
||||
<div class="am-form-group am-u-lg-12" style="margin-top: 15px;">
|
||||
<a href='javascript:;' class='am-btn am-btn-primary am-btn-xs' @click="save_agent">
|
||||
保存
|
||||
</a>
|
||||
<template v-if="info.status>=4">
|
||||
<a class='am-btn am-btn-primary am-btn-xs ml10' v-if="info.agent && info.agent.status==0" data-ajax="post"
|
||||
data-action="/receiver/orders/edit_agentfh" :data-params-oid="info.id">
|
||||
完成代办
|
||||
</a>
|
||||
<a class='am-btn am-btn-default am-active am-btn-xs ml10' v-else>
|
||||
已完成代办
|
||||
</a>
|
||||
</template>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,251 @@
|
||||
<div class="am-panel am-panel-default">
|
||||
<div class="am-panel-hd">
|
||||
<span style="font-size: 20px">资料审核</span>
|
||||
<span style="float:right;margin-top:5px">
|
||||
</span>
|
||||
</div>
|
||||
<div class="am-form-group clearfix" >
|
||||
<div class="" v-if="info.main_type==1">
|
||||
<p class="am-text-default mb10 ml30 pt15 pb10">
|
||||
营业执照:
|
||||
</p>
|
||||
<ul class="photopic-list ml30 clearfix">
|
||||
<?if($info['imgs_status']['business_licence']['imgs'][0]){?>
|
||||
<li>
|
||||
<a target="_blank" class="pic" id="layer-photos-demo-21">
|
||||
<img src="<?=$info['imgs_status']['business_licence']['imgs'][0]?>" @click="show_carimg(21)"/>
|
||||
</a>
|
||||
<div class="f12 tc"></div>
|
||||
</li>
|
||||
<?}else{?>
|
||||
<li>
|
||||
<a href="javascript:void(0);" class="pic" data-file="1" data-type="jpg,png,gif,png,jpeg"
|
||||
data-uptype="qiniu" data-field="business_licence" data-mark="compalbum">
|
||||
<input type="hidden" class="" name="business_licence" data-type="1" value="" onchange="upImg('business_licence',this)">
|
||||
<img src="/static/images/webuploader/add_img_pic.png" />
|
||||
</a>
|
||||
<div class="tc f12"></div>
|
||||
</li>
|
||||
<?}?>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="" v-else>
|
||||
<p class="am-text-default mb10 ml30 pt15 pb10">
|
||||
身份证:
|
||||
<!--
|
||||
<?if($info['imgs_status']['cardida']['status']==0 && $info['imgs_status']['cardida']['imgs']){?>
|
||||
<button data-ajax="post" data-action="/receiver/orderv2/orders/edit_ckimg" data-params-ifcheck="1" data-params-type="1" data-params-id="<?=$info['id']?>" class="am-btn am-btn-xs am-btn-primary">审核通过</button>
|
||||
<button data-ajax="post" data-action="/receiver/orderv2/orders/edit_ckimg" data-params-ifcheck="0" data-params-type="1" data-params-id="<?=$info['id']?>" class="am-btn am-btn-xs am-btn-danger">审核不通过</button>
|
||||
<?}?>
|
||||
-->
|
||||
</p>
|
||||
<ul class="photopic-list ml30 clearfix">
|
||||
<?if($info['imgs_status']['cardida']['imgs'][0]){?>
|
||||
<li>
|
||||
<a target="_blank" class="pic" id="layer-photos-demo-21">
|
||||
<img src="<?=$info['imgs_status']['cardida']['imgs'][0]?>" @click="show_carimg(21)"/>
|
||||
</a>
|
||||
<div class="f12 tc">身份证正面</div>
|
||||
<!--
|
||||
<div class="f16">审核结果:
|
||||
<span class="am-text-<?=$info['imgs_status']['cardida']['status_cls']?>"><?=$info['imgs_status']['cardida']['status_cn']?></span>
|
||||
</div>
|
||||
-->
|
||||
</li>
|
||||
<?}else{?>
|
||||
<li>
|
||||
<a href="javascript:void(0);" class="pic" data-file="1" data-type="jpg,png,gif,png,jpeg"
|
||||
data-uptype="qiniu" data-field="cardida" data-mark="compalbum">
|
||||
<input type="hidden" class="cardida" name="cardida" data-type="1" value="" onchange="upImg('cardida',this)">
|
||||
<img src="/static/images/webuploader/add_img_pic.png" />
|
||||
</a>
|
||||
<div class="tc f12">身份证正面</div>
|
||||
</li>
|
||||
<?}?>
|
||||
<?if($info['imgs_status']['cardida']['imgs'][1]){?>
|
||||
<li>
|
||||
<a target="_blank" class="pic" id="layer-photos-demo-22">
|
||||
<img src="<?=$info['imgs_status']['cardida']['imgs'][1]?>" @click="show_carimg(22)"/>
|
||||
</a>
|
||||
<!--
|
||||
<div class="f12 tc">身份证反面</div>
|
||||
<div class="f16">审核结果:
|
||||
<span class="am-text-<?=$info['imgs_status']['cardida']['status_cls']?>"><?=$info['imgs_status']['cardida']['status_cn']?></span>
|
||||
</div>
|
||||
-->
|
||||
</li>
|
||||
<?}else{?>
|
||||
<li>
|
||||
<a href="javascript:void(0);" class="pic" data-file="1" data-type="jpg,png,gif,png,jpeg"
|
||||
data-uptype="qiniu" data-field="cardidb" data-mark="compalbum">
|
||||
<input type="hidden" class="cardidb" name="cardidb" data-type="1" value="" onchange="upImg('cardidb',this)">
|
||||
<img src="/static/images/webuploader/add_img_pic.png" />
|
||||
</a>
|
||||
<div class="tc f12">身份证反面</div>
|
||||
</li>
|
||||
<?}?>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="">
|
||||
<p class="am-text-default mb10 ml30 pt15 pb10">国补资料:</p>
|
||||
<ul class="photopic-list ml30 clearfix">
|
||||
<?if($info['imgs_status']['register_img']['imgs'][0]){?>
|
||||
<li>
|
||||
<a target="_blank" class="pic" id="layer-photos-demo-31">
|
||||
<img src="<?=$info['imgs_status']['register_img']['imgs'][0]?>" @click="show_carimg(31)"/>
|
||||
</a>
|
||||
<div class="f12 tc">登记证</div>
|
||||
<!--
|
||||
<div class="f16">审核结果:
|
||||
<span class="am-text-<?=$info['imgs_status']['register_img']['status_cls']?>"><?=$info['imgs_status']['register_img']['status_cn']?></span>
|
||||
</div>
|
||||
<?if($info['imgs_status']['register_img']['status']==0){?>
|
||||
<div class="mt20">
|
||||
<button data-ajax="post" data-action="/receiver/orderv2/orders/edit_ckimg" data-params-ifcheck="1" data-params-type="2" data-params-id="<?=$info['id']?>" class="am-btn am-btn-xs am-btn-primary">审核通过</button>
|
||||
<button data-ajax="post" data-action="/receiver/orderv2/orders/edit_ckimg" data-params-ifcheck="0" data-params-type="2" data-params-id="<?=$info['id']?>" class="am-btn am-btn-xs am-btn-danger">审核不通过</button>
|
||||
</div>
|
||||
<?}?>
|
||||
-->
|
||||
</li>
|
||||
<?}else{?>
|
||||
<li>
|
||||
<a href="javascript:void(0);" class="pic" data-file="1" data-type="jpg,png,gif,png,jpeg"
|
||||
data-uptype="qiniu" data-field="register_img" data-mark="compalbum">
|
||||
<input type="hidden" class="register_img" name="register_img" data-type="1" value="" onchange="upImg('register_img',this)">
|
||||
<img src="/static/images/webuploader/add_img_pic.png" />
|
||||
</a>
|
||||
<div class="tc f12">登记证</div>
|
||||
</li>
|
||||
<?}?>
|
||||
<?if($info['imgs_status']['car_img']['imgs'][0]){?>
|
||||
<li>
|
||||
<a target="_blank" class="pic" id="layer-photos-demo-32">
|
||||
<img src="<?=$info['imgs_status']['car_img']['imgs'][0]?>" @click="show_carimg(32)"/>
|
||||
</a>
|
||||
<div class="f12 tc">行驶证</div>
|
||||
<!--
|
||||
<div class="f16">审核结果:
|
||||
<span class="am-text-<?=$info['imgs_status']['car_img']['status_cls']?>"><?=$info['imgs_status']['car_img']['status_cn']?></span>
|
||||
</div>
|
||||
<?if($info['imgs_status']['car_img']['status']==0){?>
|
||||
<div class="mt20">
|
||||
<button data-ajax="post" data-action="/receiver/orderv2/orders/edit_ckimg" data-params-ifcheck="1" data-params-type="3" data-params-id="<?=$info['id']?>" class="am-btn am-btn-xs am-btn-primary">审核通过</button>
|
||||
<button data-ajax="post" data-action="/receiver/orderv2/orders/edit_ckimg" data-params-ifcheck="0" data-params-type="3" data-params-id="<?=$info['id']?>" class="am-btn am-btn-xs am-btn-danger">审核不通过</button>
|
||||
</div>
|
||||
<?}?>
|
||||
-->
|
||||
</li>
|
||||
<?}else{?>
|
||||
<li>
|
||||
<a href="javascript:void(0);" class="pic" data-file="1" data-type="jpg,png,gif,png,jpeg"
|
||||
data-uptype="qiniu" data-field="car_img" data-mark="compalbum">
|
||||
<input type="hidden" class="car_img" name="car_img" data-type="1" value="" onchange="upImg('car_img',this)">
|
||||
<img src="/static/images/webuploader/add_img_pic.png" />
|
||||
</a>
|
||||
<div class="tc f12">行驶证</div>
|
||||
</li>
|
||||
<?}?>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="am-form-group clearfix" >
|
||||
<div class="">
|
||||
<p class="am-text-default mb10 ml30 pt15 pb10">
|
||||
保单:
|
||||
<!--
|
||||
<?if($info['imgs_status']['ins_img']['status']==0 && $info['imgs_status']['ins_img']['imgs']){?>
|
||||
<button data-ajax="post" data-action="/receiver/orderv2/orders/edit_ckimg" data-params-ifcheck="1" data-params-type="4" data-params-id="<?=$info['id']?>" class="am-btn am-btn-xs am-btn-primary">审核通过</button>
|
||||
<button data-ajax="post" data-action="/receiver/orderv2/orders/edit_ckimg" data-params-ifcheck="0" data-params-type="4" data-params-id="<?=$info['id']?>" class="am-btn am-btn-xs am-btn-danger">审核不通过</button>
|
||||
<?}?>
|
||||
-->
|
||||
</p>
|
||||
<ul class="photopic-list ml30 clearfix">
|
||||
<?if($info['imgs_status']['ins_img']['imgs']){?>
|
||||
<? foreach ($info['imgs_status']['ins_img']['imgs'] as $key=>$val) {?>
|
||||
<li>
|
||||
<?if(strpos($val,'.pdf') !== false){?>
|
||||
<a href="<?=$val?>" target="_blank" class="pic">
|
||||
</a>
|
||||
<?}else{?>
|
||||
<a target="_blank" class="pic" id="layer-photos-demo-41">
|
||||
<img src="<?=$val?>" @click="show_carimg(41)"/>
|
||||
</a>
|
||||
<?}?>
|
||||
<!--
|
||||
<div class="f16">审核结果:
|
||||
<span class="am-text-<?=$info['imgs_status']['ins_img']['status_cls']?>"><?=$info['imgs_status']['ins_img']['status_cn']?></span>
|
||||
</div>
|
||||
-->
|
||||
</li>
|
||||
<?}?>
|
||||
<?}?>
|
||||
<li>
|
||||
<a href="javascript:void(0);" class="pic" data-file="1" data-mark="file" data-type="jpg,png,gif,png,jpeg,pdf"
|
||||
data-uptype="qiniu" data-field="ins_img">
|
||||
<input type="hidden" class="ins_img" name="ins_img" data-type="1" value="" onchange="upImg('ins_img',this)">
|
||||
<img src="/static/images/webuploader/add_img_pic.png" />
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group clearfix" >
|
||||
<div class="">
|
||||
<p class="am-text-default mb10 ml30 pt15 pb10">
|
||||
交车合照:
|
||||
<!--
|
||||
<?if($info['imgs_status']['other_img']['status']==0 && $info['imgs_status']['other_img']['imgs']){?>
|
||||
<button data-ajax="post" data-action="/receiver/orderv2/orders/edit_ckimg" data-params-ifcheck="1" data-params-type="5" data-params-id="<?=$info['id']?>" class="am-btn am-btn-xs am-btn-primary">审核通过</button>
|
||||
<button data-ajax="post" data-action="/receiver/orderv2/orders/edit_ckimg" data-params-ifcheck="0" data-params-type="5" data-params-id="<?=$info['id']?>" class="am-btn am-btn-xs am-btn-danger">审核不通过</button>
|
||||
<?}?>
|
||||
-->
|
||||
</p>
|
||||
<ul class="photopic-list ml30 clearfix">
|
||||
<?if($info['imgs_status']['other_img']['imgs']){?>
|
||||
<? foreach ($info['imgs_status']['other_img']['imgs'] as $key=>$val) {?>
|
||||
<li>
|
||||
<a target="_blank" class="pic" id="layer-photos-demo-5<?=$key?>">
|
||||
<img src="<?=$val?>" @click="show_carimg(5<?=$key?>)"/>
|
||||
</a>
|
||||
<!--
|
||||
<div class="f16">审核结果:
|
||||
<span class="am-text-<?=$info['imgs_status']['other_img']['status_cls']?>"><?=$info['imgs_status']['other_img']['status_cn']?></span>
|
||||
</div>
|
||||
-->
|
||||
</li>
|
||||
<?}?>
|
||||
<?}?>
|
||||
<li>
|
||||
<a href="javascript:void(0);" class="pic" data-file="1" data-type="jpg,png,gif,png,jpeg"
|
||||
data-uptype="qiniu" data-field="other_img" data-mark="compalbum">
|
||||
<input type="hidden" class="other_img" name="other_img" data-type="1" value="" onchange="upImg('other_img',this)">
|
||||
<img src="/static/images/webuploader/add_img_pic.png" />
|
||||
</a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
function upImg(field,obj) {
|
||||
var value;
|
||||
if(field=='ins_img' || field=='other_img'){
|
||||
value = $(obj).val();
|
||||
}else{
|
||||
value = $(obj).val();
|
||||
}
|
||||
$.post("/receiver/orderv2/orders/edit_imgs", {
|
||||
'id': <?=$info['id']?>,
|
||||
'filed': field,
|
||||
'value': value,
|
||||
}, function (data) {
|
||||
if (data.code) {
|
||||
layer.msg(data.msg, {time: 2000, icon: 1}, function () {
|
||||
$.form.reload();
|
||||
});
|
||||
} else {
|
||||
layer.msg(data.msg, {icon: 2});
|
||||
}
|
||||
}, 'json');
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,94 @@
|
||||
<form id="vue-bill" class="am-form am-form-horizontal" action="/receiver/orders/edit_bill" data-auto="true" method="post"
|
||||
style="width: 90%;padding-top: 10px">
|
||||
<input type="hidden" name="id" v-model="info.id">
|
||||
<div class="am-form-group">
|
||||
<label class="am-para-label">到账金额:</label>
|
||||
<div class="am-para-input w150">
|
||||
<input type="number" id="fp_money" name="money" v-model="info.money"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="am-form-group">
|
||||
<label class="am-para-label">发票文件:</label>
|
||||
|
||||
<div class="am-para-input">
|
||||
<div class="am-form-group am-form-file">
|
||||
<button type="button" class="am-btn am-btn-default am-btn-sm fl"
|
||||
data-file="1" data-mark="file" data-type="pdf,jpg,png,gif,png,jpeg"
|
||||
data-uptype="qiniu" data-params-source="vue_bill.bill_file">
|
||||
<i class="am-icon-cloud-upload"></i> 选择要上传的文件
|
||||
</button>
|
||||
<div class="photo-upload mt10 fl">
|
||||
<div class="photo-upload-item" v-if="bill_file.src.length>0">
|
||||
<a :href="bill_file.src" target="_blank" :data-value='bill_file.value' class="ml10 mt5"
|
||||
style="width:100px;line-height:20px;">{{bill_file.title}}</a>
|
||||
<span class="photo-upload-item-remove">
|
||||
<i class="fa fa-remove" data-rm-vue="vue_bill.bill_file"></i>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<input type="hidden" name="file" v-model="info.file" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="am-form-group" v-if="info.bill_time">
|
||||
<label class="am-para-label">开票时间:</label>
|
||||
<div class="am-para-input w150" style="line-height:39px;">
|
||||
{{info.bill_time}}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="am-form-group" style="margin-bottom: 2rem">
|
||||
<div class="am-para-input">
|
||||
<button class="am-btn am-btn-secondary" type="button" @click="saveEdit">保存</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<script>
|
||||
var vue_bill;
|
||||
var loading = false;
|
||||
$(function(){
|
||||
vue_bill = new Vue({
|
||||
el: '#vue-bill',
|
||||
data: {
|
||||
info: {},
|
||||
bill_file:{src:'',value:'',title:''}
|
||||
},
|
||||
mounted: function () {
|
||||
var that = this;
|
||||
that.info = <?=json_encode($bill, JSON_UNESCAPED_UNICODE)?>;
|
||||
that.bill_file = {
|
||||
src: that.info.src_file,
|
||||
value: that.info.file,
|
||||
title: that.info.file.substring(that.info.file.lastIndexOf("/")+1)
|
||||
};
|
||||
},
|
||||
methods:{
|
||||
saveEdit:function(){
|
||||
if(loading){
|
||||
return;
|
||||
}
|
||||
loading = true;
|
||||
var post_data = $('#vue-bill').serialize();
|
||||
$.post("/receiver/orderv2/orders/edit_bill", post_data, function (data) {
|
||||
if (data.code) {
|
||||
layer.msg(data.msg, {time: 2000, icon: 1}, function () {
|
||||
window.location.reload();
|
||||
});
|
||||
} else {
|
||||
layer.msg(data.msg, {icon: 2});
|
||||
loading = false;
|
||||
}
|
||||
}, 'json');
|
||||
}
|
||||
},
|
||||
watch:{
|
||||
"bill_file.value":function(nv, ov){
|
||||
this.info.file = nv;
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@@ -0,0 +1,656 @@
|
||||
<style type="text/css">
|
||||
.span-bold {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.am-para-label-con {
|
||||
font-weight: 400;
|
||||
line-height: 37px;
|
||||
text-align: left;
|
||||
font-size: 1.6rem;
|
||||
}
|
||||
|
||||
.input-group {
|
||||
width: 100%;
|
||||
padding-right: 30px;
|
||||
}
|
||||
|
||||
.input-group-addon {
|
||||
padding: 0px 0px 0px 0px;
|
||||
font-size: 1.6rem;
|
||||
font-weight: normal;
|
||||
line-height: 0px;
|
||||
color: #333;
|
||||
text-align: right;
|
||||
background-color: #fff;
|
||||
border: 0px solid #fff;
|
||||
border-radius: 0px;
|
||||
width: 110px;
|
||||
}
|
||||
|
||||
.table-td {
|
||||
width: 20%;
|
||||
padding-top: 15px;
|
||||
line-height: 37px;
|
||||
font-size: 1.6rem;
|
||||
}
|
||||
|
||||
.label-width {
|
||||
width: 120px;
|
||||
}
|
||||
|
||||
.input-left {
|
||||
margin-left: 150px;
|
||||
}
|
||||
|
||||
.group-width {
|
||||
width: 45%;
|
||||
height: 56px;
|
||||
}
|
||||
|
||||
.my-ul ul li {
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
.my-panel {
|
||||
padding: 10px;
|
||||
border: 1px solid #ddd;
|
||||
height: 90px;
|
||||
}
|
||||
|
||||
.btn-group .disabled {
|
||||
background-color: #eee;
|
||||
opacity: 1;
|
||||
}
|
||||
.hidden{
|
||||
display: none;
|
||||
}
|
||||
.photopic-list li{
|
||||
float: left;
|
||||
margin-right:20px ;
|
||||
}
|
||||
.photopic-list .pic{
|
||||
width: 150px;
|
||||
height: 150px;
|
||||
line-height: 150px;
|
||||
border: 1px solid #e5e5e5;
|
||||
overflow: hidden;
|
||||
display: block;
|
||||
margin:5px 0 10px;
|
||||
padding:0;
|
||||
font-size: 0;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.photopic-list .pic img{
|
||||
max-width: 100%;
|
||||
max-height: 100%;
|
||||
border:none;
|
||||
padding:0 ;
|
||||
display: inline-block;
|
||||
vertical-align: middle;
|
||||
}
|
||||
</style>
|
||||
<div id="vue-edit" class="am-form am-form-horizontal" style="width: 98%;padding-top: 10px">
|
||||
<div class="am-u-lg-12">
|
||||
<!-- 基本信息 -->
|
||||
<div class="am-panel am-panel-default">
|
||||
<div class="am-panel-hd">
|
||||
<span style="font-size: 20px">基本信息</span>
|
||||
<span class="ml10">{{info.sid}}</span>
|
||||
<span style="float:right;margin-top:5px">
|
||||
</span>
|
||||
</div>
|
||||
<div class="am-panel-bd am-g" style="margin-top: 10px;margin-bottom: 10px;">
|
||||
<div class="am-form-inline">
|
||||
<div class="am-form-group am-u-lg-4">
|
||||
<label class="am-para-label label-width"><span class="span-bold">下单时间:</span></label>
|
||||
<div class="am-para-input">
|
||||
<label class="am-para-label-con">{{info.c_time}}</label>
|
||||
</div>
|
||||
</div>
|
||||
<!--
|
||||
<div class="am-form-group am-u-lg-4">
|
||||
<label class="am-para-label label-width"><span class="span-bold">订单状态:</span></label>
|
||||
<div class="am-para-input">
|
||||
<label class="am-para-label-con">{{info.sign_status_name}}</label>
|
||||
</div>
|
||||
</div>
|
||||
-->
|
||||
<div class="am-form-group am-u-lg-4">
|
||||
<label class="am-para-label label-width"><span class="span-bold">渠道来源:</span></label>
|
||||
<div class="am-para-input">
|
||||
<label class="am-para-label-con">{{info.cf_title}}</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 客户信息 -->
|
||||
<div class="am-panel am-panel-default">
|
||||
<div class="am-panel-hd">
|
||||
<span style="font-size: 20px">客户信息</span>
|
||||
<span style="float:right;margin-top:5px">
|
||||
</span>
|
||||
</div>
|
||||
<div class="am-panel-bd am-g" style="margin-top: 10px;margin-bottom: 10px;">
|
||||
<div>
|
||||
<div class="am-form-inline">
|
||||
<div class="am-form-group am-u-lg-6">
|
||||
<label class="am-para-label label-width"><span class="span-bold">客户姓名:</span></label>
|
||||
<div class="am-para-input">
|
||||
<label class="am-para-label-con">{{info.name}}</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group am-u-lg-6">
|
||||
<label class="am-para-label label-width"><span class="span-bold">客户手机号:</span></label>
|
||||
<div class="am-para-input">
|
||||
<label class="am-para-label-con">{{info.mobile}}</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!--车主信息-->
|
||||
<template v-if="info.main_type==1"> <!--公司-->
|
||||
<div class="am-form-inline">
|
||||
<div class="am-form-group am-u-lg-6">
|
||||
<label class="am-para-label label-width"><span class="span-bold">企业名称:</span></label>
|
||||
<div class="am-para-input">
|
||||
<label class="am-para-label-con">{{info.company}}</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group am-u-lg-6">
|
||||
<label class="am-para-label label-width"><span class="span-bold">企业信用代码:</span></label>
|
||||
<div class="am-para-input">
|
||||
<label class="am-para-label-con">{{info.credit}}</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<template v-else> <!--个人-->
|
||||
<div class="am-form-inline">
|
||||
<div class="am-form-group am-u-lg-6">
|
||||
<label class="am-para-label label-width"><span class="span-bold">车主证号码:</span></label>
|
||||
<div class="am-para-input">
|
||||
<label class="am-para-label-con">{{info.owner_cardid}}</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group am-u-lg-6">
|
||||
<label class="am-para-label label-width"><span class="span-bold">车主地址:</span></label>
|
||||
<div class="am-para-input">
|
||||
<label class="am-para-label-con">{{info.address}}</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!--订单明细-->
|
||||
<? require_once "oinfo.php" ?>
|
||||
<!-- 合同信息 -->
|
||||
<div class="am-panel am-panel-default">
|
||||
<div class="am-panel-hd">
|
||||
<span style="font-size: 20px">合同信息</span>
|
||||
<span style="float:right;margin-top:5px">
|
||||
</span>
|
||||
</div>
|
||||
<div class="am-panel-bd am-g" style="margin-top: 10px;margin-bottom: 10px;">
|
||||
<div class="am-form-inline">
|
||||
<div class="am-form-group am-u-lg-12">
|
||||
<label class="am-para-label label-width"><span class="span-bold">合同信息:</span></label>
|
||||
<div class="am-form am-form-inline" v-if="info.contract_data">
|
||||
<div class="am-form-group" v-if="info.contract_data[0]">
|
||||
<a :href="info.contract_data[0]['src']" target="_blank" class="am-btn am-btn-default am-btn-sm">
|
||||
汽车购车协议
|
||||
</a><br>
|
||||
</div>
|
||||
<div class="am-form-group ml10" v-if="info.contract_data[1]">
|
||||
<a :href="info.contract_data[1]['src']" target="_blank" class="am-btn am-btn-default am-btn-sm">
|
||||
委托服务协议
|
||||
</a><br>
|
||||
</div>
|
||||
<div class="am-form-group ml10" v-if="info.contract_data[3]">
|
||||
<a :href="info.contract_data[3]['src']" target="_blank" class="am-btn am-btn-default am-btn-sm">
|
||||
车辆交付
|
||||
</a><br>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 发票信息 -->
|
||||
<div class="am-panel am-panel-default">
|
||||
<div class="am-panel-hd">
|
||||
<span style="font-size: 20px">发票信息</span>
|
||||
<span style="float:right;margin-top:5px">
|
||||
</span>
|
||||
</div>
|
||||
<div class="am-panel-bd am-g" style="margin-top: 10px;margin-bottom: 10px;">
|
||||
<div class="am-form-inline">
|
||||
<div class="am-form-group am-u-lg-12" style="margin-bottom:15px;" v-if="info.bill && info.bill.warning">
|
||||
<span class="ml70 f18" v-html="info.bill.warning"></span>
|
||||
</div>
|
||||
<div class="am-form-group am-u-lg-12">
|
||||
<label class="am-para-label label-width"><span class="span-bold">发票:</span></label>
|
||||
<div class="am-para-input">
|
||||
<div class="am-form-inline">
|
||||
<!--
|
||||
<div class="am-form-group">
|
||||
<label class="input-group-btn" style="width: 50px;">
|
||||
<a href="javascript:;"
|
||||
:data-modal="'/receiver/orderv2/orders/get_bill?oid='+info.id"
|
||||
data-title="编辑发票信息" class="am-btn am-btn-default am-btn-sm">
|
||||
上传文件
|
||||
</a>
|
||||
</label>
|
||||
</div>
|
||||
-->
|
||||
<div class="am-form-group">
|
||||
<a href="javascript:void(0);" class="am-btn am-btn-default am-btn-sm" data-file="1" data-type="jpg,png,gif,png,jpeg"
|
||||
data-uptype="qiniu" data-field="bill_file">
|
||||
<input type="hidden" class="bill_file" name="bill_file" data-type="1" value="" onchange="upBill(this)">
|
||||
<i class="am-icon-cloud-upload"></i> 选择要上传的文件
|
||||
</a>
|
||||
</div>
|
||||
<div class="am-form-group" v-if="info.bill && info.bill.file">
|
||||
<div v-if="info.bill.file_type=='img'" id="layer-photos-demo-1"
|
||||
class="layer-photos-demo fl ml10">
|
||||
<img :layer-src="info.bill.file"
|
||||
:src="info.bill.file" class="w100" alt="查看发票" @click="show_carimg(1)"
|
||||
style="height:auto;max-height:32px;max-width:50px;margin-left: 5px">
|
||||
</div>
|
||||
<a v-else :href="info.bill.file" target="_blank" class="mt5"
|
||||
style="width:100px;line-height:20px;margin-left:5px;">查看发票</a>
|
||||
</div>
|
||||
<div class="am-form-group ml10">
|
||||
<template v-if="info.bill && (info.bill.cardidA||info.bill.business_licence)">
|
||||
<a class='am-btn am-btn-primary am-btn-xs' v-if="!info.bill.status"
|
||||
data-ajax="post" data-action="/receiver/orderv2/orders/edit_jk"
|
||||
:data-params-oid="info.id">
|
||||
交款确定
|
||||
</a>
|
||||
<span class='am-btn am-btn-default am-active am-btn-xs' v-else>已确认开票</span>
|
||||
</template>
|
||||
<a class='am-btn am-btn-default am-btn-xs'
|
||||
data-modal="/receiver/orderv2/orders/get_paylog?id=<?= $info['id'] ?>" data-title="收款记录">
|
||||
收款记录
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!--贷款明细-->
|
||||
<? require_once "loaninfo.php" ?>
|
||||
<!--资料审核-->
|
||||
<? require_once "ckinfo.php" ?>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
require(['laydate'], function (laydate) {
|
||||
//日期范围
|
||||
laydate.render({
|
||||
elem: '#loan_time'
|
||||
, type: 'date'
|
||||
});
|
||||
laydate.render({
|
||||
elem: '#ins_time'
|
||||
, type: 'date'
|
||||
});
|
||||
});
|
||||
var vue_obj;
|
||||
var xz_num = 0;
|
||||
var xz_name = "xuan_zhuan_<?=time()?>";
|
||||
$(document).ready(function () {
|
||||
vue_obj = new Vue({
|
||||
el: '#vue-edit',
|
||||
data: {
|
||||
info: [],
|
||||
carslist: [],
|
||||
page: [],
|
||||
bx_imgs: [],
|
||||
car_imgs: [],
|
||||
register_img: [],
|
||||
brand_list: [],
|
||||
series_list: [],
|
||||
v_list: [],
|
||||
cor_list: [],
|
||||
incor_list: [],
|
||||
brand_id: '',
|
||||
s_id: '',
|
||||
v_id: '',
|
||||
cor_id: '',
|
||||
incor_id: '',
|
||||
vin: ''
|
||||
},
|
||||
mounted: function () {
|
||||
var that = this;
|
||||
that.info = <?=json_encode($info, JSON_UNESCAPED_UNICODE)?>;
|
||||
that.brand_id = <?=$info['brand_id']?>,
|
||||
that.s_id = <?=$info['s_id']?>,
|
||||
that.v_id = <?=$info['v_id']?>,
|
||||
that.cor_id = <?=$info['cor_id']?>,
|
||||
that.incor_id = <?=$info['incor_id']?>,
|
||||
that.bx_imgs = <?=json_encode($info['bx_imgs'])?>,
|
||||
that.car_imgs = <?=json_encode($info['car_imgs'])?>,
|
||||
that.register_img = <?=json_encode($info['register_img'])?>
|
||||
},
|
||||
computed: {},
|
||||
created: function () {
|
||||
},
|
||||
methods: {
|
||||
setauto: function (type) {
|
||||
var that = this;
|
||||
var p_data = {'tp': 1, 'type': type};
|
||||
if (type == 2) {
|
||||
p_data['pid'] = that.brand_id;
|
||||
} else if (type == 3) {
|
||||
p_data['pid'] = that.s_id;
|
||||
}
|
||||
$.get("/common/auto", p_data, function (result) {
|
||||
if (type == 1) {
|
||||
that.brand_list = result.data
|
||||
} else if (type == 2) {
|
||||
that.series_list = result.data
|
||||
} else if (type == 3) {
|
||||
that.v_list = result.data[3]
|
||||
that.cor_list = result.data[4]
|
||||
that.incor_list = result.data[5]
|
||||
}
|
||||
})
|
||||
},
|
||||
carModal: function () {
|
||||
var that = this
|
||||
that.setauto(1);
|
||||
that.setauto(2);
|
||||
that.setauto(3);
|
||||
that.getCars(1);
|
||||
layer.open({
|
||||
type: 1,
|
||||
area: ['60%', '85%'], //宽高
|
||||
content: $('#car-modal'),
|
||||
title: '选择车辆',
|
||||
shade: false,
|
||||
btn: ['保存'],
|
||||
yes: function (index) {
|
||||
$.post("/receiver/orderv2/orders/edit_item", {
|
||||
'id': that.info.id,
|
||||
'item_id': that.info.item_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');
|
||||
}
|
||||
});
|
||||
},
|
||||
getCars: function (page) {
|
||||
var vm = this;
|
||||
$.ajax({
|
||||
url: '/common/items',
|
||||
type: 'post',
|
||||
dataType: 'json',
|
||||
data: {
|
||||
page: page,
|
||||
select_id: vm.info.item_id,
|
||||
brand_id: vm.brand_id,
|
||||
s_id: vm.s_id,
|
||||
v_id: vm.v_id,
|
||||
cor_id: vm.cor_id,
|
||||
incor_id: vm.incor_id,
|
||||
vin: vm.vin
|
||||
},
|
||||
success: function (re) {
|
||||
var carslist = re.data.list;
|
||||
vm.page = re.data.page;
|
||||
carslist.map(function (_item, _index) {
|
||||
if (vm.info.item_id == _item.id) {
|
||||
carslist[_index].selected = 1;
|
||||
} else {
|
||||
carslist[_index].selected = 0;
|
||||
}
|
||||
});
|
||||
vm.carslist = carslist;
|
||||
}
|
||||
});
|
||||
},
|
||||
setCars: function (cars, checked) {
|
||||
var vm = this;
|
||||
var carslist = vm.carslist;
|
||||
carslist.map(function (_item, _index) {
|
||||
carslist[_index].selected = 0;
|
||||
});
|
||||
vm.carslist = carslist;
|
||||
if (checked) {
|
||||
vm.info.item_id = cars.id;
|
||||
cars.selected = 1;
|
||||
} else {
|
||||
vm.info.item_id = 0;
|
||||
}
|
||||
},
|
||||
beforeUsersPage: function () {
|
||||
var vm = this;
|
||||
if (vm.page.page == 1) {
|
||||
layer.msg('已经是第一页了');
|
||||
return;
|
||||
}
|
||||
vm.page.page--;
|
||||
vm.getCars(vm.page.page);
|
||||
},
|
||||
afterUsersPage: function () {
|
||||
var vm = this;
|
||||
vm.page.page++;
|
||||
vm.getCars(vm.page.page);
|
||||
},
|
||||
finish_loan: function (status) {
|
||||
var that = this;
|
||||
if (status == 2) {
|
||||
var loan_time = $('#loan_time').val();
|
||||
// if (!loan_time) {
|
||||
// layer.msg("请填写放款时间");
|
||||
// return;
|
||||
// }
|
||||
this.info.loan_info.loan_time = loan_time;
|
||||
}
|
||||
$.post("/receiver/orderv2/orders/edit_loan", {'info': this.info, 'status': status}, function (data) {
|
||||
console.dir(data);
|
||||
if (data.code) {
|
||||
layer.msg(data.msg, function () {
|
||||
$.form.reload();
|
||||
});
|
||||
} else {
|
||||
layer.msg(data.msg);
|
||||
}
|
||||
}, 'json');
|
||||
},
|
||||
upTz: function (type, event) {
|
||||
var that = this;
|
||||
var formData = new FormData();
|
||||
formData.append("file", $(event.currentTarget).get(0).files[0]); //上传一个files对象
|
||||
formData.append('id', this.info.id);
|
||||
formData.append('type', type);
|
||||
if (type) {
|
||||
var loan_time = $('#loan_time').val();
|
||||
if (!loan_time) {
|
||||
layer.msg("请填写放款时间");
|
||||
return;
|
||||
}
|
||||
formData.append('loan_time', loan_time);
|
||||
}
|
||||
$.ajax({//jQuery方法,此处可以换成其它请求方式
|
||||
url: '/receiver/orderv2/orders/edit_loan',
|
||||
dataType: "json",
|
||||
type: "post",
|
||||
data: formData,
|
||||
processData: false,//不去处理发送的数据
|
||||
contentType: false,//不去设置Content-Type请求头
|
||||
error: function (res) {
|
||||
layer.msg('上传失败')
|
||||
return;
|
||||
},
|
||||
success: function (res) {
|
||||
console.dir(res)
|
||||
if (res.code) {
|
||||
layer.msg(res.msg, function () {
|
||||
$.form.reload();
|
||||
});
|
||||
} else {
|
||||
layer.msg(res.msg);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
})
|
||||
},
|
||||
show_carimg: function (type) {
|
||||
layer.photos({
|
||||
photos: '#layer-photos-demo-' + type,
|
||||
anim: 5, //0-6的选择,指定弹出图片动画类型,默认随机(请注意,3.0之前的版本用shift参数)
|
||||
tab: function () {
|
||||
xz_num = 0;
|
||||
$("#layui-layer-photos").parent().append('<div style="position:relative;width:100%;text-align:center;cursor:pointer;">\n' +
|
||||
'\t\t<img id="' + xz_name + '" src="/img/xuanzhuan.png" style="width:30px;height:30px;">\n' +
|
||||
'\t</div>');
|
||||
}
|
||||
});
|
||||
},
|
||||
//保存身份证
|
||||
save_cardID: function () {
|
||||
var that = this;
|
||||
var data_post = {
|
||||
o_id: that.info.id,
|
||||
cardidA: that.info.bill.cardidA.value,
|
||||
cardidB: that.info.bill.cardidB.value
|
||||
};
|
||||
$.post("/receiver/orderv2/orders/edit_cardID", data_post, function (data) {
|
||||
if (data.code) {
|
||||
layer.msg(data.msg, {time: 2000, icon: 1}, function () {
|
||||
$.form.reload();
|
||||
});
|
||||
} else {
|
||||
layer.msg(data.msg, {icon: 2});
|
||||
}
|
||||
}, 'json');
|
||||
},
|
||||
save_edit: function (type) {
|
||||
var that = this;
|
||||
var data_post;
|
||||
if (type == 1) {
|
||||
data_post = {type: type, id: that.info.id, note: that.info.note};
|
||||
} else if (type == 2) {
|
||||
data_post = {
|
||||
type: type,
|
||||
id: that.info.id,
|
||||
business_licence: that.info.bill.business_licence.value
|
||||
};
|
||||
}
|
||||
$.post("/receiver/orderv2/orders/edit", data_post, function (data) {
|
||||
if (data.code) {
|
||||
layer.msg(data.msg, {time: 2000, icon: 1}, function () {
|
||||
$.form.reload();
|
||||
});
|
||||
} else {
|
||||
layer.msg(data.msg, {icon: 2});
|
||||
}
|
||||
}, 'json');
|
||||
},
|
||||
cancelItem:function(){
|
||||
var that = this;
|
||||
layer.confirm('你确定取消分配吗?', {icon: 3, title:'提示'}, function(index){
|
||||
$.post("/receiver/orderv2/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');
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
//旋转图片
|
||||
$(document).on("click", "#" + xz_name, function (e) {
|
||||
console.log("xz_num=" + xz_num);
|
||||
xz_num = (xz_num + 90) % 360;
|
||||
$(".layui-layer.layui-layer-page.layui-layer-photos").css('background', 'black');//旋转之后背景色设置为黑色,不然在旋转长方形图片时会留下白色空白
|
||||
$("#layui-layer-photos").css('transform', 'rotate(' + xz_num + 'deg)');
|
||||
});
|
||||
//图片放大缩小
|
||||
$(document).on("mousewheel DOMMouseScroll", ".layui-layer-phimg", function (e) {
|
||||
var delta = (e.originalEvent.wheelDelta && (e.originalEvent.wheelDelta > 0 ? 1 : -1)) || // chrome & ie
|
||||
(e.originalEvent.detail && (e.originalEvent.detail > 0 ? -1 : 1)); // firefox
|
||||
var imagep = $(".layui-layer-phimg").parent().parent();
|
||||
var image = $(".layui-layer-phimg").parent();
|
||||
var h = image.height();
|
||||
var w = image.width();
|
||||
var img_url = $("#imglayer").attr("src");
|
||||
// 创建对象
|
||||
var img = new Image();
|
||||
// 改变图片的src
|
||||
img.src = img_url;
|
||||
var width = img.width;
|
||||
var height = img.height;
|
||||
debugger;
|
||||
if (delta > 0) {
|
||||
if (h < (window.innerHeight)) {
|
||||
h = h * 1.05;
|
||||
w = w * 1.05;
|
||||
width = width * 1.05;
|
||||
height = height * 1.05;
|
||||
}
|
||||
} else if (delta < 0) {
|
||||
if (h > 100) {
|
||||
h = h * 0.95;
|
||||
w = w * 0.95;
|
||||
width = width * 0.95;
|
||||
height = height * 0.95;
|
||||
}
|
||||
}
|
||||
imagep.css("top", (window.innerHeight - h) / 2);
|
||||
imagep.css("left", (window.innerWidth - w) / 2);
|
||||
image.height(h);
|
||||
image.width(w);
|
||||
imagep.height(h);
|
||||
imagep.width(w);
|
||||
var current = $("#current").val();
|
||||
if ((current / 90) % 2 == 1) {
|
||||
$('#imglayer').css("width", h);
|
||||
$('#imglayer').css("margin-top", -(w - h) / 2);
|
||||
if (height < width) {
|
||||
$('#imglayer').css("margin-left", (w - h) / 2);
|
||||
}
|
||||
} else {
|
||||
$('#imglayer').css("width", w);
|
||||
$('#imglayer').css("margin-top", 0);
|
||||
if (height < width) {
|
||||
$('#imglayer').css("margin-left", 0);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
function upBill(obj) {
|
||||
var value = $(obj).val();
|
||||
$.post("/receiver/orderv2/orders/edit_bill", {
|
||||
'id': <?=$info['id']?>,
|
||||
'value': value,
|
||||
}, function (data) {
|
||||
if (data.code) {
|
||||
layer.msg(data.msg, {time: 2000, icon: 1}, function () {
|
||||
$.form.reload();
|
||||
});
|
||||
} else {
|
||||
layer.msg(data.msg, {icon: 2});
|
||||
}
|
||||
}, 'json');
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,612 @@
|
||||
<link rel="stylesheet" type="text/css" href="/static/css/font-awesome.min.css?v=1581252500">
|
||||
<div class="bs-example bs-example-tabs" data-example-id="togglable-tabs" style="font-size:15px;">
|
||||
<div id="recom-stat"></div>
|
||||
<ul class="nav nav-tabs" role="tablist">
|
||||
<li role="presentation" class="<?= !strlen($params['status_pid']) ? 'active' : '' ?>">
|
||||
<a href="javascript:void (0);" data-open="/receiver/orders">
|
||||
全部
|
||||
<?= $params['count_all'] > 0 ? '<span style="background-color:#ff6600" class="am-badge am-round">' . $params['count_all'] . '</span>' : '' ?>
|
||||
</a>
|
||||
</li>
|
||||
<? foreach ($status_arr as $v) { ?>
|
||||
<li role="presentation"
|
||||
class="<? if (strlen($params['status_pid']) && $params['status_pid'] == $v['id']) { ?>active<? } ?>">
|
||||
<? if ($v['cate']) { ?>
|
||||
<a href="javascript:void (0);" class="dropdown-toggle" data-toggle="dropdown">
|
||||
<?= $v['name'] ?>
|
||||
<?= $v['count'] > 0 ? '<span style="background-color:#ff6600" class="am-badge am-round">' . $v['count'] . '</span>' : '' ?>
|
||||
<?= $v['cate'] ? ' <span class="caret"></span>' : '' ?>
|
||||
</a>
|
||||
<ul class="dropdown-menu">
|
||||
<? if ($v['cate']) { ?>
|
||||
<li class="<?= strlen($params['status_pid']) && !strlen($params['status']) && $params['status_pid'] == $v['id'] ? 'active' : '' ?>">
|
||||
<a href="javascript:void (0);"
|
||||
data-open="/receiver/orders?status_pid=<?= $v['id'] ?>">
|
||||
全部
|
||||
</a>
|
||||
</li>
|
||||
<? } ?>
|
||||
<? foreach ($v['cate'] as $v2) { ?>
|
||||
<li class="<?= strlen($params['status']) && $params['status_pid'] == $v['id'] && $params['status'] == $v2['id'] ? 'active' : '' ?>">
|
||||
<a href="javascript:void (0);"
|
||||
data-open="/receiver/orders?status_pid=<?= $v['id'] ?>&status=<?= $v2['id'] ?>">
|
||||
<?= $v2['name'] ?>
|
||||
<?= $v2['count'] > 0 ? '<span style="background-color:#ff6600" class="am-badge am-round">' . $v2['count'] . '</span>' : '' ?>
|
||||
</a>
|
||||
</li>
|
||||
<? } ?>
|
||||
</ul>
|
||||
<? } else { ?>
|
||||
<a href="javascript:void (0);"
|
||||
data-open="/receiver/orders?status_pid=<?= $v['id'] ?>">
|
||||
<?= $v['name'] ?>
|
||||
<?= $v['count'] > 0 ? '<span style="background-color:#ff6600" class="am-badge am-round">' . $v['count'] . '</span>' : '' ?>
|
||||
</a>
|
||||
<? } ?>
|
||||
</li>
|
||||
<? } ?>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="coms-table-wrap mt10">
|
||||
<form class="form-search coms-table-hd clearfix no-border" onsubmit="return false"
|
||||
action="/receiver/orders">
|
||||
<div class="am-form am-form-horizontal">
|
||||
<div class="am-form-group fl">
|
||||
<label class="am-para-label w100">客户搜索:</label>
|
||||
<div class="am-para-inline w100">
|
||||
<select name="search_tp" id="search_tp">
|
||||
<?php foreach ($searchTpAry as $key => $value) { ?>
|
||||
<option value="<?= $key ?>"
|
||||
<?= $key == $params['search_tp'] ? 'selected' : '' ?>><?= $value ?></option>
|
||||
<? } ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group fl">
|
||||
<div class="am-para-inline w260">
|
||||
<input id="title" name="title" type="text" value="<?= $params['title'] ?>"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="am-form-group fl">
|
||||
<div class="am-form-group" style="margin-bottom: 0px;"></div>
|
||||
<label class="am-para-label w100">订单时间:</label>
|
||||
<div class="am-form-group fl">
|
||||
<div class="am-para-inline w300">
|
||||
<input id="id-create-time" name="c_time" type="text" value="<?= $params['c_time'] ?>"
|
||||
placeholder="订单时间范围" autocomplete="off"/>
|
||||
</div>
|
||||
<div class="am-para-inline" style="padding-top: 5px;">
|
||||
<a class="mr10 id-day-btn" href="javascript:void (0);" data-date="today">今天</a>
|
||||
<a class="mr10 id-day-btn" href="javascript:void (0);" data-date="yesterday">昨日</a>
|
||||
<a class="mr10 id-day-btn" href="javascript:void (0);" data-date="7day">最近7天</a>
|
||||
<a class="mr10 id-day-btn" href="javascript:void (0);" data-date="30day">最近30天</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group" style="margin-bottom: 0px;"></div>
|
||||
<div class="am-form-group fl">
|
||||
<label class="am-para-label w100">来源类型:</label>
|
||||
<div class="am-para-inline w100">
|
||||
<select name="cf_title" v-model="params.cf_title">
|
||||
<option value="">请选择</option>
|
||||
<option :value="v" v-for="(v,i) in show_info.cfTitleAry">{{v}}</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group fl">
|
||||
<label class="am-para-label w100">线下来源:</label>
|
||||
<div class="am-form-group am-para-inline w150">
|
||||
<select name="cf_clues" v-model="params.cf_clues">
|
||||
<option value="">请选择</option>
|
||||
<option :value="v" v-for="(v,i) in show_info.cfCluesAry">{{v}}</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group fl">
|
||||
<label class="am-para-label w100">线上来源:</label>
|
||||
<div class="am-form-group am-para-inline w120">
|
||||
<select name="cfrom_id" v-model="cfrom_id">
|
||||
<option value=0>请选择</option>
|
||||
<template v-for="(v,i) in cfroms">
|
||||
<option :value="v.id">{{v.title}}</option>
|
||||
</template>
|
||||
</select>
|
||||
</div>
|
||||
<div class="am-form-group am-para-inline w150">
|
||||
<select name="cfrom_id2" v-model="cfrom_id2">
|
||||
<option value=0>请选择</option>
|
||||
<template v-for="(v,i) in cfroms2">
|
||||
<option :value="v.id">{{v.title}}</option>
|
||||
</template>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group fl">
|
||||
<label class="am-para-label w100">付款方式:</label>
|
||||
<div class="am-para-inline w100">
|
||||
<select name="payway" v-model="params.payway">
|
||||
<option value="">请选择</option>
|
||||
<option :value="i" v-for="(v,i) in show_info.paywayAry">{{v}}</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group" style="margin-bottom: 0px;"></div>
|
||||
<div class="am-form-group fl">
|
||||
<label class="am-para-label w100">车型:</label>
|
||||
<div class="am-para-inline w120">
|
||||
<select name="brand_id" v-model="params.brand_id">
|
||||
<option value="">选择品牌</option>
|
||||
<option :value="v.id" v-for="(v,i) in brandAry">{{v.name}}</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="am-para-inline w120">
|
||||
<select name="s_id" v-model="params.s_id">
|
||||
<option value="">选择车系</option>
|
||||
<option :value="v.id" v-for="(v,i) in seryAry">{{v.name}}</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="am-para-inline w120">
|
||||
<select name="v_id" v-model="params.v_id">
|
||||
<option value="">选择车型</option>
|
||||
<option :value="v.id" v-for="(v,i) in attrvAry">{{v.title}}</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="am-para-inline w120">
|
||||
<select name="cor_id" v-model="params.cor_id">
|
||||
<option value="">车身颜色</option>
|
||||
<option :value="v.id" v-for="(v,i) in attrcorAry">{{v.title}}</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group fl">
|
||||
<label class="am-para-label w100">渠道经理:</label>
|
||||
<div class="am-para-inline w100">
|
||||
<select name="qdjl_id" v-model="params.qdjl_id">
|
||||
<option value=''>请选择</option>
|
||||
<option :value="v.id" v-for="(v,i) in show_info.qdjl_lists">{{v.name}}</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group fl">
|
||||
<label class="am-para-label w100">门店类型:</label>
|
||||
<div class="am-para-inline w100">
|
||||
<select name="biz_type" v-model="params.biz_type">
|
||||
<option value="">请选择</option>
|
||||
<option :value="i" v-for="(v,i) in show_info.bizTypeAry">{{v}}</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group" style="margin-bottom: 0px;"></div>
|
||||
<div class="am-form-group fl">
|
||||
<label class="am-para-label w100">销售员:</label>
|
||||
<div class="am-para-inline w120">
|
||||
<select title="城市" name="city_id_admin" v-model="params.city_id_admin">
|
||||
<option value="">选择城市</option>
|
||||
<option :value="v.id" v-for="(v,i) in admins.cityAry">{{v.name}}</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="am-para-inline w120">
|
||||
<select title="行政区" name="county_id_admin" v-model="params.county_id_admin">
|
||||
<option value="">选择行政区</option>
|
||||
<option :value="v.id" v-for="(v,i) in admins.countyAry">{{v.name}}</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="am-para-inline w120">
|
||||
<select name="biz_id_admin" v-model="params.biz_id_admin">
|
||||
<option value="">门店</option>
|
||||
<template v-for="(v,i) in admins.bizAry">
|
||||
<option :value="v.id">{{v.title}}</option>
|
||||
</template>
|
||||
</select>
|
||||
</div>
|
||||
<div class="am-para-inline w120">
|
||||
<select name="admin_id" v-model="params.admin_id">
|
||||
<option value="">销售员</option>
|
||||
<template v-for="(v,i) in admins.list">
|
||||
<option :value="v.id">{{v.title}}</option>
|
||||
</template>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group fl">
|
||||
<label class="am-para-label w100">车架号:</label>
|
||||
<div class="am-para-inline w260">
|
||||
<input name="vin" type="text" value="<?= $params['vin'] ?>"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group" style="margin-bottom: 0px;"></div>
|
||||
<div class="am-form-group fl" style="margin-bottom: 0px;">
|
||||
<div class="am-form-group fl ml10">
|
||||
<button type="submit" class="am-btn am-btn-success am-btn-sm w100">搜索</button>
|
||||
</div>
|
||||
<div class="am-form-group fl ml10">
|
||||
<button type="button" class="am-btn am-btn-success am-btn-sm w100" @click="reset">重置</button>
|
||||
</div>
|
||||
<div class="am-form-group fl ml10">
|
||||
<button type="button" @click="export_out(0)" class="am-btn am-btn-success am-btn-sm w100">导出
|
||||
</button>
|
||||
</div>
|
||||
<div class="am-form-group fl ml10">
|
||||
<button type="button" @click="export_out(1)" class="am-btn am-btn-success am-btn-sm">导出保险明细
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<div class="coms-table-bd">
|
||||
<div class="am-form-group fr mr10">
|
||||
<span>共<?= intval($pager['totle']) ?>个订单</span>
|
||||
</div>
|
||||
<table class="am-table am-table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<th width="14%"><span>客户</span></th>
|
||||
<th width="24%"><span>车辆</span></th>
|
||||
<th width="11%"><span>门店</span></th>
|
||||
<th width="8%"><span>车辆平台价</span></th>
|
||||
<th width="6%"><span>付款方式</span></th>
|
||||
<th width="8%"><span>来源类型</span></th>
|
||||
<th width="10%"><span>来源</span></th>
|
||||
<th width="8%"><span>状态</span></th>
|
||||
<th width="12%"><span>订单时间</span></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php if ($lists) {
|
||||
foreach ($lists as $v) { ?>
|
||||
<tr>
|
||||
<td><?= $v['name'] ?></td>
|
||||
<td><?= $v['car_name'] ?></td>
|
||||
<td><?= $v['biz_name'] ?></td>
|
||||
<td><?= $v['price'] ?></td>
|
||||
<td><?= $v['payway_name'] ?></td>
|
||||
<td><?= $v['cf_title'] ?></td>
|
||||
<td>
|
||||
<?if($v['cf_name']){?><?= $v['cf_name'] ?>(线上)<br><?}?>
|
||||
<?if($v['cf_clues']){?><?= $v['cf_clues'] ?>(线下)<?}?>
|
||||
</td>
|
||||
<td><?= $v['status_name'] ?></td>
|
||||
<td><?= $v['c_time'] ?></td>
|
||||
</tr>
|
||||
<?php }
|
||||
} ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="coms-table-ft clearfix">
|
||||
<div class="hander am-form">
|
||||
</div>
|
||||
<div class="coms-pagination fr mr20">
|
||||
<?php page_view($pager) ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
require(['laydate', 'autocomplete'], function (laydate) {
|
||||
laydate.render({
|
||||
elem: '#id-create-time', range: '~'
|
||||
});
|
||||
$('.id-day-btn').click(function () {
|
||||
var type = $(this).data('date'), date = '', d_obj = new Date();
|
||||
switch (type) {
|
||||
case 'today':
|
||||
date = d_obj.Format('yyyy-MM-dd');
|
||||
date = date + ' ~ ' + date;
|
||||
break;
|
||||
case 'yesterday':
|
||||
date = (new Date(d_obj.getTime() - 86400000)).Format('yyyy-MM-dd');
|
||||
date = date + ' ~ ' + date;
|
||||
break;
|
||||
case '7day':
|
||||
date = (new Date(d_obj.getTime() - 86400000 * 7)).Format('yyyy-MM-dd') + ' ~ ' + d_obj.Format('yyyy-MM-dd');
|
||||
break;
|
||||
case '30day':
|
||||
date = (new Date(d_obj.getTime() - 86400000 * 30)).Format('yyyy-MM-dd') + ' ~ ' + d_obj.Format('yyyy-MM-dd');
|
||||
break;
|
||||
}
|
||||
$('#id-create-time').val(date);
|
||||
});
|
||||
});
|
||||
|
||||
$(function () {
|
||||
vue_obj = new Vue({
|
||||
el: '.coms-table-wrap',
|
||||
data: {
|
||||
params: [],
|
||||
searchTpAry: [],
|
||||
brandAry: [],
|
||||
seryAry: [],
|
||||
attrvAry: [],
|
||||
attrcorAry: [],//车身颜色选项
|
||||
admins: {cityAry: [], countyAry: [], bizAry: [], list: []},
|
||||
lists: [],
|
||||
show_info: {cfTitleAry: [], qdjl_lists: []},
|
||||
cfrom_id:<?=$params['cfrom_id'] ? $params['cfrom_id'] : 0?>,
|
||||
cfrom_id2:<?=$params['cfrom_id2'] ? $params['cfrom_id2'] : 0?>,
|
||||
cfroms: [],
|
||||
cfroms2: [],
|
||||
},
|
||||
mounted: function () {
|
||||
var vm = this;
|
||||
vm.lists = <?=json_encode($lists)?>;
|
||||
vm.params = <?=json_encode($params)?>;
|
||||
vm.show_info = <?=json_encode($show_info)?>;
|
||||
vm.getCfroms();
|
||||
vm.init_brands();
|
||||
vm.init_citys();
|
||||
},
|
||||
methods: {
|
||||
getCfroms: function () {
|
||||
var that = this
|
||||
$.get('/receiver/clues/get_cfroms', function (result) {
|
||||
that.cfroms = result.data.data
|
||||
});
|
||||
if (that.cfrom_id > 0) {
|
||||
var url = that.cfrom_id == 24 ? '/common/material' : '/receiver/clues/get_cfroms';
|
||||
$.get(url, {'id': that.cfrom_id}, function (result) {
|
||||
that.cfroms2 = result.data.data
|
||||
});
|
||||
}
|
||||
},
|
||||
export_out: function (type) {
|
||||
var count = <?=$pager['totle']?>;
|
||||
if (count > 10000) {
|
||||
layer.msg('单次导出数据不能超过10000');
|
||||
return false;
|
||||
}
|
||||
var href = $.menu.parseUri(window.location.href);
|
||||
href = href.replace("orders?", "orders/export?export_type="+type+"&");
|
||||
window.location.href = href;
|
||||
},
|
||||
init_brands: function () {
|
||||
var vm = this;
|
||||
$.ajax({
|
||||
url: '/auto/brand/json_lists',
|
||||
type: 'post',
|
||||
dataType: 'json',
|
||||
data: {status: 1},
|
||||
beforeSend: function () {
|
||||
},
|
||||
success: function (data) {
|
||||
if (1 == data.code) {
|
||||
vm.brandAry = data.data.list;
|
||||
}
|
||||
},
|
||||
complete: function () {
|
||||
}
|
||||
});
|
||||
},
|
||||
init_citys: function () {
|
||||
var vm = this;
|
||||
$.ajax({
|
||||
type: 'get',
|
||||
url: '/common/area',
|
||||
dataType: 'json',
|
||||
data: {
|
||||
id: '350',
|
||||
key: 'city',
|
||||
type: 1
|
||||
},
|
||||
success: function (response) {
|
||||
if (response.code == 1) {
|
||||
vm.cityAry = response.data;
|
||||
vm.admins.cityAry = JSON.parse(JSON.stringify(response.data));
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
reset: function () {
|
||||
var that = this;
|
||||
$("#search_tp").val('name');
|
||||
$("#title").val('');
|
||||
$("#id-create-time").val('');
|
||||
that.cfrom_id = 0;
|
||||
that.cfrom_id2 = 0;
|
||||
that.params.cf_title = '';
|
||||
that.params.cf_clues = '';
|
||||
that.params.payway = '';
|
||||
that.params.brand_id = '';
|
||||
that.params.city_id_admin = '';
|
||||
that.params.qdjl_id = '';
|
||||
that.params.biz_type = '';
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
'cfrom_id': function (nv, ov) {
|
||||
var that = this;
|
||||
if (nv == '') {
|
||||
that.cfrom_id2 = 0;
|
||||
that.cfroms = [];
|
||||
} else {
|
||||
var url = nv == 24 ? '/common/material' : '/receiver/clues/get_cfroms';
|
||||
$.get(url, {'id': nv}, function (result) {
|
||||
that.cfroms2 = result.data.data;
|
||||
if (that.cfrom_id2 > 0) {
|
||||
var cfrom_id2 = '0';
|
||||
for (var i in that.cfroms) {
|
||||
var county = that.cfroms[i];
|
||||
if (county.id == that.cfrom_id2) {
|
||||
cfrom_id2 = county.id;
|
||||
break;
|
||||
}
|
||||
}
|
||||
that.cfrom_id2 = cfrom_id2;
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
'params.brand_id': function (nv, ov) {
|
||||
var vm = this;
|
||||
vm.seryAry = {};
|
||||
if (nv > 0) {
|
||||
$.ajax({
|
||||
url: '/auto/series/json_lists',
|
||||
type: 'post',
|
||||
dataType: 'json',
|
||||
data: {brand_id: nv},
|
||||
beforeSend: function () {
|
||||
},
|
||||
success: function (data) {
|
||||
if (1 == data.code) {
|
||||
var lists = data.data.list;
|
||||
var seryAry = {};
|
||||
for (var i in lists) {
|
||||
var row = lists[i];
|
||||
seryAry[row.id] = row.name;
|
||||
}
|
||||
vm.seryAry = lists;
|
||||
if (vm.params.s_id > 0 && undefined == seryAry[vm.params.s_id]) {
|
||||
vm.params.s_id = '';
|
||||
}
|
||||
}
|
||||
},
|
||||
complete: function () {
|
||||
loading = 0;
|
||||
layer.closeAll('loading');
|
||||
}
|
||||
});
|
||||
} else {
|
||||
vm.params.s_id = '';
|
||||
}
|
||||
},
|
||||
'params.s_id': function (nv, ov) {
|
||||
var vm = this;
|
||||
if (nv > 0) {
|
||||
//车身颜色
|
||||
$.ajax({
|
||||
type: 'post',
|
||||
url: '/auto/attr/json_lists',
|
||||
dataType: 'json',
|
||||
data: {
|
||||
s_id: nv,
|
||||
status: 1,
|
||||
type: 0
|
||||
},
|
||||
success: function (response) {
|
||||
if (response.code == 1) {
|
||||
vm.attrcorAry = response.data.list;
|
||||
}
|
||||
}
|
||||
});
|
||||
//型号
|
||||
$.ajax({
|
||||
type: 'post',
|
||||
url: '/auto/attr/json_lists',
|
||||
dataType: 'json',
|
||||
data: {
|
||||
s_id: nv,
|
||||
status: 1,
|
||||
type: 1
|
||||
},
|
||||
success: function (response) {
|
||||
if (response.code == 1) {
|
||||
vm.attrvAry = response.data.list;
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
vm.attrcorAry = [];
|
||||
vm.attrvAry = [];
|
||||
vm.params.cor_id = '';
|
||||
vm.params.v_id = '';
|
||||
}
|
||||
},
|
||||
'params.city_id_admin': function (nv, ov) {
|
||||
var that = this;
|
||||
if (nv == '') {
|
||||
that.admins.countyAry = [];
|
||||
that.params.county_id_admin = '';
|
||||
} else {
|
||||
if (nv.substring(0, 4) != that.params.county_id_admin.substring(0, 4)) {
|
||||
that.params.county_id_admin = '';
|
||||
}
|
||||
$.ajax({
|
||||
type: 'get',
|
||||
url: '/common/area',
|
||||
dataType: 'json',
|
||||
data: {
|
||||
id: nv,
|
||||
key: 'county',
|
||||
type: 1
|
||||
},
|
||||
success: function (response) {
|
||||
if (response.code == 1) {
|
||||
that.admins.countyAry = response.data;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
'params.county_id_admin': function (nv, ov) {
|
||||
var that = this;
|
||||
if (nv == '') {
|
||||
that.admins.bizAry = [];
|
||||
that.params.biz_id_admin = '';
|
||||
} else {
|
||||
$.ajax({
|
||||
type: 'post',
|
||||
url: '/biz/store/store/json_lists',
|
||||
dataType: 'json',
|
||||
data: {
|
||||
city_id: that.params.city_id_admin,
|
||||
county_id: that.params.county_id_admin,
|
||||
status: 1
|
||||
},
|
||||
success: function (response) {
|
||||
if (response.code == 1) {
|
||||
that.admins.bizAry = response.data.list;
|
||||
if (that.params.biz_id_admin > 0) {
|
||||
var biz_id = '';
|
||||
for (var i in that.admins.bizAry) {
|
||||
if (that.params.biz_id_admin == that.admins.bizAry[i].id) {
|
||||
biz_id = that.params.biz_id_admin;
|
||||
break;
|
||||
}
|
||||
}
|
||||
that.params.biz_id_admin = biz_id;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
'params.biz_id_admin': function (nv, ov) {
|
||||
var that = this;
|
||||
if (nv == '') {
|
||||
that.admins.list = [];
|
||||
that.params.admin_id = '';
|
||||
} else {
|
||||
$.ajax({
|
||||
type: 'post',
|
||||
url: '/app/licheb/member/json_lists',
|
||||
dataType: 'json',
|
||||
data: {
|
||||
biz_id: nv,
|
||||
status: 1
|
||||
},
|
||||
success: function (response) {
|
||||
if (response.code == 1) {
|
||||
that.admins.list = response.data.list;
|
||||
if (that.params.admin_id > 0) {
|
||||
var admin_id = '';
|
||||
for (var i in that.admins.list) {
|
||||
if (that.params.admin_id == that.admins.list[i].id) {
|
||||
admin_id = that.params.admin_id;
|
||||
break;
|
||||
}
|
||||
}
|
||||
that.params.admin_id = admin_id;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
<?php page_script($pager) ?>
|
||||
});
|
||||
</script>
|
||||
@@ -0,0 +1,106 @@
|
||||
<div class="am-panel am-panel-default" v-if="!info.payway && info.loan_info">
|
||||
<div class="am-panel-hd">
|
||||
<span style="font-size: 20px">分期明细</span>
|
||||
<span style="float:right;margin-top:5px">
|
||||
</span>
|
||||
</div>
|
||||
<div class="am-panel-bd am-g" style="margin-top: 10px;margin-bottom: 10px;" v-if="info.loan_info.finance_rows">
|
||||
<div class="am-form-inline">
|
||||
<div class="am-form-group am-u-lg-6">
|
||||
<label class="am-para-label label-width"><span class="span-bold">金融机构:</span></label>
|
||||
<div class="am-para-input">
|
||||
<select style="width:150px" v-model="info.finance_id">
|
||||
<option v-for="item in info.loan_info.finance_rows" :value="item.id">{{item.title}}</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group am-u-lg-6">
|
||||
<label class="am-para-label label-width"><span class="span-bold">贷款金额:</span></label>
|
||||
<div class="am-para-input">
|
||||
<label class="am-para-label">
|
||||
<input type="text" v-model="info.loan_info.price_loan">
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-inline">
|
||||
<div class="am-form-group am-u-lg-6">
|
||||
<label class="am-para-label label-width"><span class="span-bold">首付:</span></label>
|
||||
<div class="am-para-input">
|
||||
<label class="am-para-label-con">{{info.loan_info.first_pay}}</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="am-form-group am-u-lg-6">
|
||||
<?if ($info['loan_info']['status_array'] && in_array(1,$info['loan_info']['status_array'])){?>
|
||||
<label class="am-para-label label-width"><span class="span-bold">放款时间:</span></label>
|
||||
<div class="am-para-input">
|
||||
<label class="am-para-label">
|
||||
<input type="text" id="loan_time" v-model="info.loan_info.loan_time" autocomplete="off">
|
||||
</label>
|
||||
</div>
|
||||
<?}?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-inline">
|
||||
<div class="am-form-group am-u-lg-6">
|
||||
<label class="am-para-label label-width"><span class="span-bold">按揭通知函:</span></label>
|
||||
<div class="am-para-input">
|
||||
<div class="am-form-inline">
|
||||
<div class="am-form-group">
|
||||
<label class="input-group-btn" style="width: 50px;"><span
|
||||
class="am-btn am-btn-default am-btn-sm">
|
||||
<i class="am-icon-cloud-upload"></i> 选择文件
|
||||
<input type="file" style="display: none;" accept="jpg,png,gif,png,jpeg" @change="upTz(0,$event)"></span>
|
||||
</label>
|
||||
</div>
|
||||
<div class="am-form-group ml10" v-if="info.loan_info.notify_file">
|
||||
<a :href="info.loan_info.notify_file" target="_blank" class='mt5' title="查看文件">
|
||||
{{info.loan_info.notify_file_name}}
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group am-u-lg-6">
|
||||
<div class="am-form-group am-u-lg-6">
|
||||
<?if ($info['loan_info']['status_array'] && in_array(1,$info['loan_info']['status_array'])){?>
|
||||
<label class="am-para-label label-width"><span class="span-bold">按揭放款函:</span></label>
|
||||
<div class="am-para-input">
|
||||
<div class="am-form-inline">
|
||||
<template>
|
||||
<div class="am-form-group">
|
||||
<label class="input-group-btn" style="width: 50px;"><span
|
||||
class="am-btn am-btn-default am-btn-sm">
|
||||
<i class="am-icon-cloud-upload"></i> 选择文件
|
||||
<input type="file" style="display: none;" accept="jpg,png,gif,png,jpeg" @change="upTz(1,$event)"></span>
|
||||
</label>
|
||||
</div>
|
||||
</template>
|
||||
<div class="am-form-group ml10" v-if="info.loan_info.lend_file">
|
||||
<a :href="info.loan_info.lend_file" target="_blank" class='mt5' title="查看文件">
|
||||
{{info.loan_info.lend_file_name}}
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?}?>
|
||||
</div>
|
||||
<div class="am-form-group am-u-lg-6">
|
||||
<div class="am-form-group ml10">
|
||||
<?if(!$info['loan_info']['status_array']){?>
|
||||
<a href='javascript:;' @click="finish_loan(1)"
|
||||
class='am-btn am-btn-primary am-btn-xs'>等待放款</a>
|
||||
<?}elseif ($info['loan_info']['status_array'] && in_array(1,$info['loan_info']['status_array']) && !in_array(2,$info['loan_info']['status_array'])){?>
|
||||
<a href='javascript:;' @click="finish_loan(2)"
|
||||
class='am-btn am-btn-primary am-btn-xs'>按揭完成</a>
|
||||
<?}else{?>
|
||||
<a href="javascript:"
|
||||
class="am-btn am-btn-default am-active am-btn-xs">已完成按揭</a>
|
||||
<?}?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,233 @@
|
||||
<div class="am-panel am-panel-default">
|
||||
<div class="am-panel-hd">
|
||||
<span style="font-size: 20px">订单明细</span>
|
||||
<span style="float:right;margin-top:5px">
|
||||
</span>
|
||||
</div>
|
||||
<div class="am-panel-bd am-g" style="margin-top: 10px;margin-bottom: 10px;">
|
||||
<div class="am-form-inline">
|
||||
<div class="am-form-group am-u-lg-6">
|
||||
<label class="am-para-label label-width"><span class="span-bold">品牌车型:</span></label>
|
||||
<div class="am-para-input">
|
||||
<label class="am-para-label-con">{{info.brand_name}}{{info.s_name}}</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group am-u-lg-6">
|
||||
<label class="am-para-label label-width"><span class="span-bold">车辆级别:</span></label>
|
||||
<div class="am-para-input">
|
||||
<label class="am-para-label-con">{{info.v_name}}</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-inline">
|
||||
<div class="am-form-group am-u-lg-6">
|
||||
<label class="am-para-label label-width"><span class="span-bold">车辆售价:</span></label>
|
||||
<div class="am-para-input">
|
||||
<label class="am-para-label-con wp90">
|
||||
{{info.sale_price}}
|
||||
<span class="text-danger" v-if="info.sale_detail">
|
||||
({{info.sale_detail}})
|
||||
</span>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group am-u-lg-6">
|
||||
<label class="am-para-label label-width"><span class="span-bold">车身颜色:</span></label>
|
||||
<div class="am-para-input">
|
||||
<label class="am-para-label-con">{{info.cor_name}}</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-inline">
|
||||
<div class="am-form-group am-u-lg-6">
|
||||
<label class="am-para-label label-width"><span class="span-bold">定金金额:</span></label>
|
||||
<div class="am-para-input">
|
||||
<label class="am-para-label-con">{{info.deposit}}</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group am-u-lg-6">
|
||||
<label class="am-para-label label-width"><span class="span-bold">内饰颜色:</span></label>
|
||||
<div class="am-para-input">
|
||||
<label class="am-para-label-con">{{info.incor_name}}</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-inline">
|
||||
<div class="am-form-group am-u-lg-6">
|
||||
<label class="am-para-label label-width"><span class="span-bold">服务费:</span></label>
|
||||
<div class="am-para-input" style="margin-left:120px">
|
||||
<label class="am-para-label-con" v-if="info.srv_info">{{info.srv_info.total}}<template v-if="info.srv_info.detail">({{info.srv_info.detail}})</template></label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group am-u-lg-6">
|
||||
<label class="am-para-label label-width"><span class="span-bold">付款方式:</span></label>
|
||||
<div class="am-para-input">
|
||||
<label class="am-para-label-con">
|
||||
<span v-if="info.payway">全款</span>
|
||||
<span v-else>贷款</span>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-inline">
|
||||
<div class="am-form-group am-u-lg-6">
|
||||
<label class="am-para-label label-width"><span class="span-bold">销售员:</span></label>
|
||||
<div class="am-para-input">
|
||||
<label class="am-para-label-con">{{info.admin_name}}</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group am-u-lg-6">
|
||||
<label class="am-para-label label-width"><span class="span-bold">期望交付时间:</span></label>
|
||||
<div class="am-para-input">
|
||||
<label class="am-para-label-con">{{info.delry_time}}</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-inline">
|
||||
<div class="am-form-group am-u-lg-6">
|
||||
<label class="am-para-label label-width"><span class="span-bold">车辆信息:</span></label>
|
||||
<div class="am-para-input">
|
||||
<label class="am-para-label-con">
|
||||
<span v-if="info.item_id">
|
||||
<a href="javascript:void(0);" :data-modal="'/items/goods/goods/get_info?id='+info.item_id"
|
||||
data-title="车辆信息">{{info.vin}}</a>
|
||||
</span>
|
||||
<span v-else>未选择</span>
|
||||
<a @click="cancelItem" v-if="info.item_id" class='am-btn am-btn-default am-btn-xs'>取消分配</a>
|
||||
<a @click="carModal" v-else class='am-btn am-btn-primary am-btn-xs'>车辆分配</a>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group am-u-lg-12">
|
||||
<label class="am-para-label label-width"><span class="span-bold">备注:</span></label>
|
||||
<div class="am-para-input">
|
||||
<label class="am-para-label" style="width: 70%">
|
||||
<textarea rows="2" v-model="info.note"></textarea>
|
||||
</label>
|
||||
<a @click="save_edit(1)" class='am-btn am-btn-primary am-btn-xs'
|
||||
style="margin-left: 20px;margin-top: 5px;">保存备注</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="car-modal" style="display: none;">
|
||||
<div class="modal-body">
|
||||
<form class="form-search coms-table-hd clearfix no-border" action="" style="padding-left: 0px;padding-right: 0px;">
|
||||
<input type="hidden" name="status_pid"
|
||||
value="<?= $params['status_pid'] != -99 ? $params['status_pid'] : '' ?>">
|
||||
<input type="hidden" name="status_id" value="<?= $params['status_id'] ?>">
|
||||
<div class="am-form am-form-horizontal">
|
||||
<div class="am-form-group fl">
|
||||
<label class="am-para-label w60">品牌:</label>
|
||||
<div class="am-para-inline w100">
|
||||
<select v-model="brand_id">
|
||||
<option v-for="item in brand_list" :value="item.id">
|
||||
{{item.name}}
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group fl">
|
||||
<label class="am-para-label w50">车系:</label>
|
||||
<div class="am-para-inline w100">
|
||||
<select v-model="s_id">
|
||||
<option value="0">全部</option>
|
||||
<option v-for="item in series_list" :value="item.id">
|
||||
{{item.name}}
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group fl">
|
||||
<label class="am-para-label w80">车辆级别:</label>
|
||||
<div class="am-para-inline w100">
|
||||
<select v-model="v_id">
|
||||
<option value="0">全部</option>
|
||||
<option v-for="item in v_list" :value="item.id">
|
||||
{{item.name}}
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group fl">
|
||||
<label class="am-para-label w80">车身颜色:</label>
|
||||
<div class="am-para-inline w80">
|
||||
<select v-model="cor_id">
|
||||
<option value="0">全部</option>
|
||||
<option v-for="item in cor_list" :value="item.id">
|
||||
{{item.name}}
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group fl">
|
||||
<label class="am-para-label w80">内饰颜色:</label>
|
||||
<div class="am-para-inline w80">
|
||||
<select v-model="incor_id">
|
||||
<option value="0">全部</option>
|
||||
<option v-for="item in incor_list" :value="item.id">
|
||||
{{item.name}}
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group fl">
|
||||
<label class="am-para-label w60">车架号:</label>
|
||||
<div class="am-para-inline">
|
||||
<input type="text" v-model="vin"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group fl">
|
||||
<div class="am-form-group fl ml10">
|
||||
<a href="javascript:;" @click="carModal" class="am-btn am-btn-success am-btn-sm w100">搜索</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<table class="am-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>品牌车型</th>
|
||||
<th>车型</th>
|
||||
<th>车身颜色</th>
|
||||
<th>内饰颜色</th>
|
||||
<th>车架号</th>
|
||||
<th>操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr v-for="(v,i) in carslist">
|
||||
<td>{{v.brand_name}}{{v.series_name}}</td>
|
||||
<td>{{v.v_name}}</td>
|
||||
<td>{{v.cor_name}}</td>
|
||||
<td>{{v.incor_name}}</td>
|
||||
<td>{{v.vin}}</td>
|
||||
<td>
|
||||
<a v-if="v.selected==0" href="javascript:void(0);" @click="setCars(v,1)"
|
||||
class="btn btn-primary btn-sm">选择</a>
|
||||
<a v-else-if="v.selected==1" href="javascript:void(0);" @click="setCars(v,0)"
|
||||
class="btn btn-default btn-sm">移除</a>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="clearfix">
|
||||
<span class="pull-left text-muted">第{{page.page}}页(每页{{page.pageLimit}}条,共{{page.pageCount}}条)</span>
|
||||
<nav class="pull-right" aria-label="Page navigation">
|
||||
<ul class="pagination pagination-sm">
|
||||
<li>
|
||||
<a href="javascript:void(0);" @click="beforeUsersPage();" aria-label="上一页">
|
||||
<span class="glyphicon glyphicon-menu-left"></span>
|
||||
</a>
|
||||
</li>
|
||||
<li v-if="page.hasNext">
|
||||
<a href="javascript:void(0);" @click="afterUsersPage();" aria-label="下一页">
|
||||
<span class="glyphicon glyphicon-menu-right"></span>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,96 @@
|
||||
<div class="coms-table-wrap mt10" id="paylog_content" style="min-height:400px;overflow:hidden">
|
||||
<div class="align-r">
|
||||
<a class="am-btn am-btn-primary am-btn-xs mr10" data-modal="/receiver/orderv2/orders/add_paylog?id=<?=$id?>">添加收款记录</a>
|
||||
</div>
|
||||
<div class="">
|
||||
<table class="am-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>付款金额</th>
|
||||
<th>类型</th>
|
||||
<th>收款公司</th>
|
||||
<th>操作人</th>
|
||||
<th>备注</th>
|
||||
<th>支付截图</th>
|
||||
<th>付款时间</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr v-for="item in list">
|
||||
<td>{{item.money}}</td>
|
||||
<td>{{item.type_cn}}</td>
|
||||
<td>{{item.company}}</td>
|
||||
<td>{{item.opt_name}}</td>
|
||||
<td>{{item.descrip}}</td>
|
||||
<td>
|
||||
<a :href="item.img" target="_blank" v-if="item.img"><img :src="item.img" class="w100 layui-layer-phimg"></a>
|
||||
</td>
|
||||
<td>{{item.pay_time}}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="clearfix" v-if="page">
|
||||
<span class="pull-left text-muted">第{{page.page}}页(每页{{page.pageLimit}}条,共{{page.pageCount}}条)</span>
|
||||
<nav class="pull-right mr10" aria-label="Page navigation">
|
||||
<ul class="pagination pagination-sm">
|
||||
<li>
|
||||
<a href="javascript:void(0);" @click="beforePage();" aria-label="上一页">
|
||||
<span class="glyphicon glyphicon-menu-left"></span>
|
||||
</a>
|
||||
</li>
|
||||
<li v-if="page.hasNext">
|
||||
<a href="javascript:void(0);" @click="afterPage();" aria-label="下一页">
|
||||
<span class="glyphicon glyphicon-menu-right"></span>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
<div class="align-r ml15" v-if="pay_price">应收总额:{{need_price}},已收总额:{{pay_price}}  </div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
$(function () {
|
||||
vue_obj = new Vue({
|
||||
el: '#paylog_content',
|
||||
data:{
|
||||
id:<?=$id?$id:''?>,
|
||||
page: [],
|
||||
list:[],
|
||||
pay_price: '',
|
||||
need_price: '',
|
||||
},
|
||||
mounted: function () {
|
||||
this.getData(1);
|
||||
},
|
||||
methods: {
|
||||
getData: function(page){
|
||||
var that = this;
|
||||
$.get('/receiver/orderv2/orders/get_paylog',{id:that.id,page:page,'d_type':'ajax'},function(result){
|
||||
if(result.code){
|
||||
that.list = result.data.list;
|
||||
that.page = result.data.commonPage;
|
||||
that.pay_price = result.data.pay_price;
|
||||
that.need_price = result.data.need_price;
|
||||
}
|
||||
});
|
||||
},
|
||||
beforePage: function () {
|
||||
var vm = this;
|
||||
if (vm.page.page == 1) {
|
||||
layer.msg('已经是第一页了');
|
||||
return;
|
||||
}
|
||||
vm.page.page--;
|
||||
vm.getData(vm.page.page);
|
||||
},
|
||||
afterPage: function () {
|
||||
var vm = this;
|
||||
vm.page.page++;
|
||||
vm.getData(vm.page.page);
|
||||
},
|
||||
}
|
||||
})
|
||||
})
|
||||
</script>
|
||||
@@ -0,0 +1,614 @@
|
||||
<link rel="stylesheet" type="text/css" href="/static/css/font-awesome.min.css?v=1581252500">
|
||||
<div class="bs-example bs-example-tabs" data-example-id="togglable-tabs" style="font-size:15px;">
|
||||
<div id="recom-stat"></div>
|
||||
<ul class="nav nav-tabs" role="tablist">
|
||||
<li role="presentation" class="<?= !strlen($params['status_pid']) ? 'active' : '' ?>">
|
||||
<a href="javascript:void (0);" data-open="/receiver/orderv2/orders">
|
||||
全部
|
||||
<?= $params['count_all'] > 0 ? '<span style="background-color:#ff6600" class="am-badge am-round">' . $params['count_all'] . '</span>' : '' ?>
|
||||
</a>
|
||||
</li>
|
||||
<? foreach ($status_arr as $v) { ?>
|
||||
<li role="presentation"
|
||||
class="<? if (strlen($params['status_pid']) && $params['status_pid'] == $v['id']) { ?>active<? } ?>">
|
||||
<? if ($v['cate']) { ?>
|
||||
<a href="javascript:void (0);" class="dropdown-toggle" data-toggle="dropdown">
|
||||
<?= $v['name'] ?>
|
||||
<?= $v['count'] > 0 ? '<span style="background-color:#ff6600" class="am-badge am-round">' . $v['count'] . '</span>' : '' ?>
|
||||
<?= $v['cate'] ? ' <span class="caret"></span>' : '' ?>
|
||||
</a>
|
||||
<ul class="dropdown-menu">
|
||||
<? if ($v['cate']) { ?>
|
||||
<li class="<?= strlen($params['status_pid']) && !strlen($params['status']) && $params['status_pid'] == $v['id'] ? 'active' : '' ?>">
|
||||
<a href="javascript:void (0);"
|
||||
data-open="/receiver/orderv2/orders?status_pid=<?= $v['id'] ?>">
|
||||
全部
|
||||
</a>
|
||||
</li>
|
||||
<? } ?>
|
||||
<? foreach ($v['cate'] as $v2) { ?>
|
||||
<li class="<?= strlen($params['status']) && $params['status_pid'] == $v['id'] && $params['status'] == $v2['id'] ? 'active' : '' ?>">
|
||||
<a href="javascript:void (0);"
|
||||
data-open="/receiver/orderv2/orders?status_pid=<?= $v['id'] ?>&status=<?= $v2['id'] ?>">
|
||||
<?= $v2['name'] ?>
|
||||
<?= $v2['count'] > 0 ? '<span style="background-color:#ff6600" class="am-badge am-round">' . $v2['count'] . '</span>' : '' ?>
|
||||
</a>
|
||||
</li>
|
||||
<? } ?>
|
||||
</ul>
|
||||
<? } else { ?>
|
||||
<a href="javascript:void (0);"
|
||||
data-open="/receiver/orderv2/orders?status_pid=<?= $v['id'] ?>">
|
||||
<?= $v['name'] ?>
|
||||
<?= $v['count'] > 0 ? '<span style="background-color:#ff6600" class="am-badge am-round">' . $v['count'] . '</span>' : '' ?>
|
||||
</a>
|
||||
<? } ?>
|
||||
</li>
|
||||
<? } ?>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="coms-table-wrap mt10">
|
||||
<form class="form-search coms-table-hd clearfix no-border" onsubmit="return false"
|
||||
action="/receiver/orderv2/orders">
|
||||
<div class="am-form am-form-horizontal">
|
||||
<div class="am-form-group fl">
|
||||
<label class="am-para-label w100">客户搜索:</label>
|
||||
<div class="am-para-inline w100">
|
||||
<select name="search_tp" id="search_tp">
|
||||
<?php foreach ($searchTpAry as $key => $value) { ?>
|
||||
<option value="<?= $key ?>"
|
||||
<?= $key == $params['search_tp'] ? 'selected' : '' ?>><?= $value ?></option>
|
||||
<? } ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group fl">
|
||||
<div class="am-para-inline w260">
|
||||
<input id="title" name="title" type="text" value="<?= $params['title'] ?>"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="am-form-group fl">
|
||||
<div class="am-form-group" style="margin-bottom: 0px;"></div>
|
||||
<label class="am-para-label w100">订单时间:</label>
|
||||
<div class="am-form-group fl">
|
||||
<div class="am-para-inline w300">
|
||||
<input id="id-create-time" name="c_time" type="text" value="<?= $params['c_time'] ?>"
|
||||
placeholder="订单时间范围" autocomplete="off"/>
|
||||
</div>
|
||||
<div class="am-para-inline" style="padding-top: 5px;">
|
||||
<a class="mr10 id-day-btn" href="javascript:void (0);" data-date="today">今天</a>
|
||||
<a class="mr10 id-day-btn" href="javascript:void (0);" data-date="yesterday">昨日</a>
|
||||
<a class="mr10 id-day-btn" href="javascript:void (0);" data-date="7day">最近7天</a>
|
||||
<a class="mr10 id-day-btn" href="javascript:void (0);" data-date="30day">最近30天</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group" style="margin-bottom: 0px;"></div>
|
||||
<div class="am-form-group fl">
|
||||
<label class="am-para-label w100">来源类型:</label>
|
||||
<div class="am-para-inline w100">
|
||||
<select name="cf_title" v-model="params.cf_title">
|
||||
<option value="">请选择</option>
|
||||
<option :value="v" v-for="(v,i) in show_info.cfTitleAry">{{v}}</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group fl">
|
||||
<label class="am-para-label w100">线下来源:</label>
|
||||
<div class="am-form-group am-para-inline w150">
|
||||
<select name="cf_clues" v-model="params.cf_clues">
|
||||
<option value="">请选择</option>
|
||||
<option :value="v" v-for="(v,i) in show_info.cfCluesAry">{{v}}</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group fl">
|
||||
<label class="am-para-label w100">线上来源:</label>
|
||||
<div class="am-form-group am-para-inline w120">
|
||||
<select name="cfrom_id" v-model="cfrom_id">
|
||||
<option value=0>请选择</option>
|
||||
<template v-for="(v,i) in cfroms">
|
||||
<option :value="v.id">{{v.title}}</option>
|
||||
</template>
|
||||
</select>
|
||||
</div>
|
||||
<div class="am-form-group am-para-inline w150">
|
||||
<select name="cfrom_id2" v-model="cfrom_id2">
|
||||
<option value=0>请选择</option>
|
||||
<template v-for="(v,i) in cfroms2">
|
||||
<option :value="v.id">{{v.title}}</option>
|
||||
</template>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group fl">
|
||||
<label class="am-para-label w100">付款方式:</label>
|
||||
<div class="am-para-inline w100">
|
||||
<select name="payway" v-model="params.payway">
|
||||
<option value="">请选择</option>
|
||||
<option :value="i" v-for="(v,i) in show_info.paywayAry">{{v}}</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group" style="margin-bottom: 0px;"></div>
|
||||
<div class="am-form-group fl">
|
||||
<label class="am-para-label w100">车型:</label>
|
||||
<div class="am-para-inline w120">
|
||||
<select name="brand_id" v-model="params.brand_id">
|
||||
<option value="">选择品牌</option>
|
||||
<option :value="v.id" v-for="(v,i) in brandAry">{{v.name}}</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="am-para-inline w120">
|
||||
<select name="s_id" v-model="params.s_id">
|
||||
<option value="">选择车系</option>
|
||||
<option :value="v.id" v-for="(v,i) in seryAry">{{v.name}}</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="am-para-inline w120">
|
||||
<select name="v_id" v-model="params.v_id">
|
||||
<option value="">选择车型</option>
|
||||
<option :value="v.id" v-for="(v,i) in attrvAry">{{v.title}}</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="am-para-inline w120">
|
||||
<select name="cor_id" v-model="params.cor_id">
|
||||
<option value="">车身颜色</option>
|
||||
<option :value="v.id" v-for="(v,i) in attrcorAry">{{v.title}}</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group fl">
|
||||
<label class="am-para-label w100">渠道经理:</label>
|
||||
<div class="am-para-inline w100">
|
||||
<select name="qdjl_id" v-model="params.qdjl_id">
|
||||
<option value=''>请选择</option>
|
||||
<option :value="v.id" v-for="(v,i) in show_info.qdjl_lists">{{v.name}}</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group fl">
|
||||
<label class="am-para-label w100">门店类型:</label>
|
||||
<div class="am-para-inline w100">
|
||||
<select name="biz_type" v-model="params.biz_type">
|
||||
<option value="">请选择</option>
|
||||
<option :value="i" v-for="(v,i) in show_info.bizTypeAry">{{v}}</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group" style="margin-bottom: 0px;"></div>
|
||||
<div class="am-form-group fl">
|
||||
<label class="am-para-label w100">销售员:</label>
|
||||
<div class="am-para-inline w120">
|
||||
<select title="城市" name="city_id_admin" v-model="params.city_id_admin">
|
||||
<option value="">选择城市</option>
|
||||
<option :value="v.id" v-for="(v,i) in admins.cityAry">{{v.name}}</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="am-para-inline w120">
|
||||
<select title="行政区" name="county_id_admin" v-model="params.county_id_admin">
|
||||
<option value="">选择行政区</option>
|
||||
<option :value="v.id" v-for="(v,i) in admins.countyAry">{{v.name}}</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="am-para-inline w120">
|
||||
<select name="biz_id_admin" v-model="params.biz_id_admin">
|
||||
<option value="">门店</option>
|
||||
<template v-for="(v,i) in admins.bizAry">
|
||||
<option :value="v.id">{{v.title}}</option>
|
||||
</template>
|
||||
</select>
|
||||
</div>
|
||||
<div class="am-para-inline w120">
|
||||
<select name="admin_id" v-model="params.admin_id">
|
||||
<option value="">销售员</option>
|
||||
<template v-for="(v,i) in admins.list">
|
||||
<option :value="v.id">{{v.title}}</option>
|
||||
</template>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group fl">
|
||||
<label class="am-para-label w100">车架号:</label>
|
||||
<div class="am-para-inline w260">
|
||||
<input name="vin" type="text" value="<?= $params['vin'] ?>"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group" style="margin-bottom: 0px;"></div>
|
||||
<div class="am-form-group fl" style="margin-bottom: 0px;">
|
||||
<div class="am-form-group fl ml10">
|
||||
<button type="submit" class="am-btn am-btn-success am-btn-sm w100">搜索</button>
|
||||
</div>
|
||||
<div class="am-form-group fl ml10">
|
||||
<button type="button" class="am-btn am-btn-success am-btn-sm w100" @click="reset">重置</button>
|
||||
</div>
|
||||
<div class="am-form-group fl ml10">
|
||||
<button type="button" @click="export_out(0)" class="am-btn am-btn-success am-btn-sm w100">导出
|
||||
</button>
|
||||
</div>
|
||||
<!--
|
||||
<div class="am-form-group fl ml10">
|
||||
<button type="button" @click="export_out(1)" class="am-btn am-btn-success am-btn-sm">导出保险明细
|
||||
</button>
|
||||
</div>
|
||||
-->
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<div class="coms-table-bd">
|
||||
<div class="am-form-group fr mr10">
|
||||
<span>共<?= intval($pager['totle']) ?>个订单</span>
|
||||
</div>
|
||||
<table class="am-table am-table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<th width="14%"><span>客户</span></th>
|
||||
<th width="24%"><span>车辆</span></th>
|
||||
<th width="11%"><span>门店</span></th>
|
||||
<th width="8%"><span>车辆平台价</span></th>
|
||||
<th width="6%"><span>付款方式</span></th>
|
||||
<th width="8%"><span>来源类型</span></th>
|
||||
<th width="10%"><span>来源</span></th>
|
||||
<th width="8%"><span>状态</span></th>
|
||||
<th width="12%"><span>订单时间</span></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php if ($lists) {
|
||||
foreach ($lists as $v) { ?>
|
||||
<tr>
|
||||
<td><?= $v['name'] ?></td>
|
||||
<td><?= $v['car_name'] ?></td>
|
||||
<td><?= $v['biz_name'] ?></td>
|
||||
<td><?= $v['price'] ?></td>
|
||||
<td><?= $v['payway_name'] ?></td>
|
||||
<td><?= $v['cf_title'] ?></td>
|
||||
<td>
|
||||
<?if($v['cf_name']){?><?= $v['cf_name'] ?>(线上)<br><?}?>
|
||||
<?if($v['cf_clues']){?><?= $v['cf_clues'] ?>(线下)<?}?>
|
||||
</td>
|
||||
<td><?= $v['status_name'] ?></td>
|
||||
<td><?= $v['c_time'] ?></td>
|
||||
</tr>
|
||||
<?php }
|
||||
} ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="coms-table-ft clearfix">
|
||||
<div class="hander am-form">
|
||||
</div>
|
||||
<div class="coms-pagination fr mr20">
|
||||
<?php page_view($pager) ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
require(['laydate', 'autocomplete'], function (laydate) {
|
||||
laydate.render({
|
||||
elem: '#id-create-time', range: '~'
|
||||
});
|
||||
$('.id-day-btn').click(function () {
|
||||
var type = $(this).data('date'), date = '', d_obj = new Date();
|
||||
switch (type) {
|
||||
case 'today':
|
||||
date = d_obj.Format('yyyy-MM-dd');
|
||||
date = date + ' ~ ' + date;
|
||||
break;
|
||||
case 'yesterday':
|
||||
date = (new Date(d_obj.getTime() - 86400000)).Format('yyyy-MM-dd');
|
||||
date = date + ' ~ ' + date;
|
||||
break;
|
||||
case '7day':
|
||||
date = (new Date(d_obj.getTime() - 86400000 * 7)).Format('yyyy-MM-dd') + ' ~ ' + d_obj.Format('yyyy-MM-dd');
|
||||
break;
|
||||
case '30day':
|
||||
date = (new Date(d_obj.getTime() - 86400000 * 30)).Format('yyyy-MM-dd') + ' ~ ' + d_obj.Format('yyyy-MM-dd');
|
||||
break;
|
||||
}
|
||||
$('#id-create-time').val(date);
|
||||
});
|
||||
});
|
||||
|
||||
$(function () {
|
||||
vue_obj = new Vue({
|
||||
el: '.coms-table-wrap',
|
||||
data: {
|
||||
params: [],
|
||||
searchTpAry: [],
|
||||
brandAry: [],
|
||||
seryAry: [],
|
||||
attrvAry: [],
|
||||
attrcorAry: [],//车身颜色选项
|
||||
admins: {cityAry: [], countyAry: [], bizAry: [], list: []},
|
||||
lists: [],
|
||||
show_info: {cfTitleAry: [], qdjl_lists: []},
|
||||
cfrom_id:<?=$params['cfrom_id'] ? $params['cfrom_id'] : 0?>,
|
||||
cfrom_id2:<?=$params['cfrom_id2'] ? $params['cfrom_id2'] : 0?>,
|
||||
cfroms: [],
|
||||
cfroms2: [],
|
||||
},
|
||||
mounted: function () {
|
||||
var vm = this;
|
||||
vm.lists = <?=json_encode($lists)?>;
|
||||
vm.params = <?=json_encode($params)?>;
|
||||
vm.show_info = <?=json_encode($show_info)?>;
|
||||
vm.getCfroms();
|
||||
vm.init_brands();
|
||||
vm.init_citys();
|
||||
},
|
||||
methods: {
|
||||
getCfroms: function () {
|
||||
var that = this
|
||||
$.get('/receiver/clues/get_cfroms', function (result) {
|
||||
that.cfroms = result.data.data
|
||||
});
|
||||
if (that.cfrom_id > 0) {
|
||||
var url = that.cfrom_id == 24 ? '/common/material' : '/receiver/clues/get_cfroms';
|
||||
$.get(url, {'id': that.cfrom_id}, function (result) {
|
||||
that.cfroms2 = result.data.data
|
||||
});
|
||||
}
|
||||
},
|
||||
export_out: function (type) {
|
||||
var count = <?=$pager['totle']?>;
|
||||
if (count > 10000) {
|
||||
layer.msg('单次导出数据不能超过10000');
|
||||
return false;
|
||||
}
|
||||
var href = $.menu.parseUri(window.location.href);
|
||||
href = href.replace("orders?", "orders/export?export_type="+type+"&");
|
||||
window.location.href = href;
|
||||
},
|
||||
init_brands: function () {
|
||||
var vm = this;
|
||||
$.ajax({
|
||||
url: '/auto/brand/json_lists',
|
||||
type: 'post',
|
||||
dataType: 'json',
|
||||
data: {status: 1},
|
||||
beforeSend: function () {
|
||||
},
|
||||
success: function (data) {
|
||||
if (1 == data.code) {
|
||||
vm.brandAry = data.data.list;
|
||||
}
|
||||
},
|
||||
complete: function () {
|
||||
}
|
||||
});
|
||||
},
|
||||
init_citys: function () {
|
||||
var vm = this;
|
||||
$.ajax({
|
||||
type: 'get',
|
||||
url: '/common/area',
|
||||
dataType: 'json',
|
||||
data: {
|
||||
id: '350',
|
||||
key: 'city',
|
||||
type: 1
|
||||
},
|
||||
success: function (response) {
|
||||
if (response.code == 1) {
|
||||
vm.cityAry = response.data;
|
||||
vm.admins.cityAry = JSON.parse(JSON.stringify(response.data));
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
reset: function () {
|
||||
var that = this;
|
||||
$("#search_tp").val('name');
|
||||
$("#title").val('');
|
||||
$("#id-create-time").val('');
|
||||
that.cfrom_id = 0;
|
||||
that.cfrom_id2 = 0;
|
||||
that.params.cf_title = '';
|
||||
that.params.cf_clues = '';
|
||||
that.params.payway = '';
|
||||
that.params.brand_id = '';
|
||||
that.params.city_id_admin = '';
|
||||
that.params.qdjl_id = '';
|
||||
that.params.biz_type = '';
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
'cfrom_id': function (nv, ov) {
|
||||
var that = this;
|
||||
if (nv == '') {
|
||||
that.cfrom_id2 = 0;
|
||||
that.cfroms = [];
|
||||
} else {
|
||||
var url = nv == 24 ? '/common/material' : '/receiver/clues/get_cfroms';
|
||||
$.get(url, {'id': nv}, function (result) {
|
||||
that.cfroms2 = result.data.data;
|
||||
if (that.cfrom_id2 > 0) {
|
||||
var cfrom_id2 = '0';
|
||||
for (var i in that.cfroms) {
|
||||
var county = that.cfroms[i];
|
||||
if (county.id == that.cfrom_id2) {
|
||||
cfrom_id2 = county.id;
|
||||
break;
|
||||
}
|
||||
}
|
||||
that.cfrom_id2 = cfrom_id2;
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
'params.brand_id': function (nv, ov) {
|
||||
var vm = this;
|
||||
vm.seryAry = {};
|
||||
if (nv > 0) {
|
||||
$.ajax({
|
||||
url: '/auto/series/json_lists',
|
||||
type: 'post',
|
||||
dataType: 'json',
|
||||
data: {brand_id: nv},
|
||||
beforeSend: function () {
|
||||
},
|
||||
success: function (data) {
|
||||
if (1 == data.code) {
|
||||
var lists = data.data.list;
|
||||
var seryAry = {};
|
||||
for (var i in lists) {
|
||||
var row = lists[i];
|
||||
seryAry[row.id] = row.name;
|
||||
}
|
||||
vm.seryAry = lists;
|
||||
if (vm.params.s_id > 0 && undefined == seryAry[vm.params.s_id]) {
|
||||
vm.params.s_id = '';
|
||||
}
|
||||
}
|
||||
},
|
||||
complete: function () {
|
||||
loading = 0;
|
||||
layer.closeAll('loading');
|
||||
}
|
||||
});
|
||||
} else {
|
||||
vm.params.s_id = '';
|
||||
}
|
||||
},
|
||||
'params.s_id': function (nv, ov) {
|
||||
var vm = this;
|
||||
if (nv > 0) {
|
||||
//车身颜色
|
||||
$.ajax({
|
||||
type: 'post',
|
||||
url: '/auto/attr/json_lists',
|
||||
dataType: 'json',
|
||||
data: {
|
||||
s_id: nv,
|
||||
status: 1,
|
||||
type: 0
|
||||
},
|
||||
success: function (response) {
|
||||
if (response.code == 1) {
|
||||
vm.attrcorAry = response.data.list;
|
||||
}
|
||||
}
|
||||
});
|
||||
//型号
|
||||
$.ajax({
|
||||
type: 'post',
|
||||
url: '/auto/attr/json_lists',
|
||||
dataType: 'json',
|
||||
data: {
|
||||
s_id: nv,
|
||||
status: 1,
|
||||
type: 1
|
||||
},
|
||||
success: function (response) {
|
||||
if (response.code == 1) {
|
||||
vm.attrvAry = response.data.list;
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
vm.attrcorAry = [];
|
||||
vm.attrvAry = [];
|
||||
vm.params.cor_id = '';
|
||||
vm.params.v_id = '';
|
||||
}
|
||||
},
|
||||
'params.city_id_admin': function (nv, ov) {
|
||||
var that = this;
|
||||
if (nv == '') {
|
||||
that.admins.countyAry = [];
|
||||
that.params.county_id_admin = '';
|
||||
} else {
|
||||
if (nv.substring(0, 4) != that.params.county_id_admin.substring(0, 4)) {
|
||||
that.params.county_id_admin = '';
|
||||
}
|
||||
$.ajax({
|
||||
type: 'get',
|
||||
url: '/common/area',
|
||||
dataType: 'json',
|
||||
data: {
|
||||
id: nv,
|
||||
key: 'county',
|
||||
type: 1
|
||||
},
|
||||
success: function (response) {
|
||||
if (response.code == 1) {
|
||||
that.admins.countyAry = response.data;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
'params.county_id_admin': function (nv, ov) {
|
||||
var that = this;
|
||||
if (nv == '') {
|
||||
that.admins.bizAry = [];
|
||||
that.params.biz_id_admin = '';
|
||||
} else {
|
||||
$.ajax({
|
||||
type: 'post',
|
||||
url: '/biz/store/store/json_lists',
|
||||
dataType: 'json',
|
||||
data: {
|
||||
city_id: that.params.city_id_admin,
|
||||
county_id: that.params.county_id_admin,
|
||||
status: 1
|
||||
},
|
||||
success: function (response) {
|
||||
if (response.code == 1) {
|
||||
that.admins.bizAry = response.data.list;
|
||||
if (that.params.biz_id_admin > 0) {
|
||||
var biz_id = '';
|
||||
for (var i in that.admins.bizAry) {
|
||||
if (that.params.biz_id_admin == that.admins.bizAry[i].id) {
|
||||
biz_id = that.params.biz_id_admin;
|
||||
break;
|
||||
}
|
||||
}
|
||||
that.params.biz_id_admin = biz_id;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
'params.biz_id_admin': function (nv, ov) {
|
||||
var that = this;
|
||||
if (nv == '') {
|
||||
that.admins.list = [];
|
||||
that.params.admin_id = '';
|
||||
} else {
|
||||
$.ajax({
|
||||
type: 'post',
|
||||
url: '/app/licheb/member/json_lists',
|
||||
dataType: 'json',
|
||||
data: {
|
||||
biz_id: nv,
|
||||
status: 1
|
||||
},
|
||||
success: function (response) {
|
||||
if (response.code == 1) {
|
||||
that.admins.list = response.data.list;
|
||||
if (that.params.admin_id > 0) {
|
||||
var admin_id = '';
|
||||
for (var i in that.admins.list) {
|
||||
if (that.params.admin_id == that.admins.list[i].id) {
|
||||
admin_id = that.params.admin_id;
|
||||
break;
|
||||
}
|
||||
}
|
||||
that.params.admin_id = admin_id;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
<?php page_script($pager) ?>
|
||||
});
|
||||
</script>
|
||||
@@ -28,6 +28,23 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group">
|
||||
<label class="am-para-label">城市:</label>
|
||||
<div class="am-para-input wp50">
|
||||
<select name="city_id" v-model="info.city_id">
|
||||
<option value="">选择城市</option>
|
||||
<option v-for="(item,i) in city_lists" :value="item.city_id">{{item.name}}</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group">
|
||||
<label class="am-para-label">公司类型:</label>
|
||||
<div class="am-para-input wp50">
|
||||
<select name="type" v-model="info.type">
|
||||
<option v-for="(v,i) in typeAry" :value="i">{{v}}</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group">
|
||||
<label class="am-para-label">状态:</label>
|
||||
<div class="am-para-input wp50">
|
||||
@@ -49,12 +66,15 @@
|
||||
data: {
|
||||
info:{},
|
||||
statusAry:[],
|
||||
action:''
|
||||
typeAry:[],
|
||||
action:'',
|
||||
city_lists:<?=json_encode($city_lists)?>,
|
||||
},
|
||||
mounted:function(){
|
||||
var vm = this;
|
||||
vm.info = <?=json_encode($info)?>;
|
||||
vm.statusAry = <?=json_encode($statusAry)?>;
|
||||
vm.typeAry = <?=json_encode($typeAry)?>;
|
||||
vm.action = '<?=$action?>';
|
||||
},
|
||||
methods:{
|
||||
|
||||
@@ -33,6 +33,8 @@
|
||||
<th width="15%"><span>ID</span></th>
|
||||
<th width="25%"><span>公司名称</span></th>
|
||||
<th width="10%"><span>公司简称</span></th>
|
||||
<th width="10%"><span>城市</span></th>
|
||||
<th width="10%"><span>公司类型</span></th>
|
||||
<th width="10%"><span>状态</span></th>
|
||||
<th width=""><span>操作</span></th>
|
||||
</tr>
|
||||
@@ -42,6 +44,8 @@
|
||||
<td>{{v.id}}</td>
|
||||
<td>{{v.title}}</td>
|
||||
<td>{{v.short}}</td>
|
||||
<td>{{v.city_name}}</td>
|
||||
<td>{{v.type_name}}</td>
|
||||
<td>{{v.status_name}}</td>
|
||||
<td>
|
||||
<a href="javascript:void(0);" :data-modal="'sys/company/get?id='+v.id"
|
||||
|
||||
@@ -44,7 +44,14 @@
|
||||
var url = ret.url || ret.site_url;
|
||||
var file_url = ret.file_url || url;
|
||||
var file_title = ret.file_title || file.file_title || file.md5;
|
||||
var field = '<?=$field?>';
|
||||
$('#' + file.id).attr('data-md5', file.md5).attr('data-src', url).attr('data-value', file_url).attr('data-title', file_title);
|
||||
top.$('[name="<?=$field?>"]').map(function () {
|
||||
img_value = file_url;
|
||||
top.$(this).attr('data-srcs', url).attr('data-md5', file.md5).val(img_value).trigger('change');
|
||||
});
|
||||
var index = top.layer.getFrameIndex(window.name);
|
||||
top.layer.close(index);
|
||||
}
|
||||
|
||||
function confirmSelected() {
|
||||
|
||||
@@ -41,5 +41,12 @@ class Pdfapi extends CI_Controller {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function add_pdf(){
|
||||
$o_id = $this->input->get('oid');
|
||||
$this->load->library('receiver/orders_v2_entity');
|
||||
if($o_id){
|
||||
$res = $this->orders_v2_entity->create_pdf($o_id);
|
||||
die(json_encode($res,JSON_UNESCAPED_UNICODE));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
<?php
|
||||
ini_set("display_errors", "On");//打开错误提示
|
||||
ini_set("error_reporting",E_ALL);//显示所有错误
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
class Welcome extends CI_Controller {
|
||||
@@ -8,4 +10,6 @@ class Welcome extends CI_Controller {
|
||||
$this->load->view('welcome_message');
|
||||
}
|
||||
|
||||
public function test(){
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,159 @@
|
||||
<?php
|
||||
|
||||
class Biz extends HD_Controller
|
||||
{
|
||||
private $biz_type = [
|
||||
1 => ['liche' => 0.25 , 'partner' => 0.75],
|
||||
2 => ['liche' => 0.35 , 'partner' => 0.65],
|
||||
];
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model('receiver/order/receiver_orders_v2_model','orders_model');
|
||||
$this->load->model('auto/auto_business_model');
|
||||
$this->load->model('biz/biz_model');
|
||||
$this->load->model('biz/biz_info_model');
|
||||
$this->load->model('biz/biz_settle_model');
|
||||
$this->load->model('biz/biz_settle_static_model');
|
||||
$this->load->model('biz/biz_trucking_model');
|
||||
}
|
||||
|
||||
public function settle(){
|
||||
$size = $this->input->get('size');
|
||||
!$size && $size = 5;
|
||||
|
||||
$t1 = 'lc_receiver_order_status';
|
||||
$t2 = 'lc_receiver_orders_v2';
|
||||
$t3 = 'lc_biz_settle';
|
||||
$t4 = 'lc_biz';
|
||||
|
||||
$fields = "$t2.*,$t4.city_id";
|
||||
$where = [
|
||||
"$t1.pid_status" => 5,
|
||||
"$t1.status" => 1,
|
||||
"$t2.status>=" => 0,
|
||||
"$t3.id is null" => null,
|
||||
"$t4.type" => 2
|
||||
];
|
||||
|
||||
$this->db->from("$t1");
|
||||
$this->db->join("$t2", "$t2.id=$t1.o_id",'left');
|
||||
$this->db->join("$t3", "$t3.o_id=$t1.o_id",'left');
|
||||
$this->db->join("$t4", "$t4.id=$t2.biz_id",'left');
|
||||
|
||||
$this->db->select($fields);
|
||||
$this->db->where($where);
|
||||
$this->db->order_by("$t2.id ASC");
|
||||
$this->db->limit($size);
|
||||
$rows = $this->db->get()->result_array();
|
||||
if($rows){
|
||||
foreach($rows as $key=>$val){
|
||||
//获取创建订单当月商务政策
|
||||
$b_where = [
|
||||
'city_id ' => $val['city_id'],
|
||||
'brand_id' => $val['brand_id'],
|
||||
's_id' => $val['s_id'],
|
||||
'v_id' => $val['v_id'],
|
||||
'status' => 1
|
||||
];
|
||||
$b_where['year'] = date('Y',$val['c_time']);
|
||||
$b_where['month'] = intval(date('m',$val['c_time']));
|
||||
$b_row_one = $this->auto_business_model->get($b_where);
|
||||
//获取开票日期商务政策
|
||||
$b_row_two = $b_row_one;
|
||||
if(date('Y-m',strtotime($val['bill_time']))!=date('Y-m',$val['c_time'])) {
|
||||
$b_where['year'] = date('Y',strtotime($val['bill_time']));
|
||||
$b_where['month'] = intval(date('m',strtotime($val['bill_time'])));
|
||||
$b_row_two = $this->auto_business_model->get($b_where);
|
||||
}
|
||||
$truck_row = $this->biz_trucking_model->get(['auto_b_id'=>$val['brand_id'],'biz_id'=>$val['biz_id'],'status'=>1]);
|
||||
$price_trucking = $truck_row['money'] ? $truck_row['money'] : 0;
|
||||
$add_data = [
|
||||
'biz_id' => $val['biz_id'],
|
||||
'o_id' => $val['id'],
|
||||
'profix_car' => $b_row_one['profix_car'] ? $b_row_one['profix_car'] : 0,
|
||||
'profix_insure' => $b_row_two['profix_insure'] ? $b_row_two['profix_insure'] : 0,
|
||||
'profix_loan' => $b_row_two['profix_loan'] ? $b_row_two['profix_loan'] : 0,
|
||||
'profix_carno' => $b_row_two['profix_carno'] ? $b_row_two['profix_carno'] : 0,
|
||||
'price_trucking' => $price_trucking,
|
||||
'year' => date('Y'),
|
||||
'month' => intval(date('m')),
|
||||
'c_time' => time()
|
||||
];
|
||||
$this->biz_settle_model->add($add_data);
|
||||
}
|
||||
}else{
|
||||
echo 'finish';
|
||||
}
|
||||
}
|
||||
|
||||
//统计前一个月利润
|
||||
public function merage(){
|
||||
$size = $this->input->get('size');
|
||||
!$size && $size = 5;
|
||||
|
||||
$t1 = 'lc_biz_settle';
|
||||
$t2 = 'lc_biz_settle_static';
|
||||
|
||||
$fields = "$t1.*";
|
||||
$where = [
|
||||
"$t1.year" => date('Y',strtotime("last month")),
|
||||
//"$t1.month" => date('m',strtotime('last month')),
|
||||
"$t1.month" => date('m'),
|
||||
"$t2.id is null" => null
|
||||
];
|
||||
|
||||
$this->db->from("$t1");
|
||||
$this->db->join("$t2", "$t2.biz_id=$t1.biz_id",'left');
|
||||
|
||||
$this->db->select($fields);
|
||||
$this->db->where($where);
|
||||
$this->db->group_by("$t1.biz_id");
|
||||
$this->db->limit($size);
|
||||
$rows = $this->db->get()->result_array();
|
||||
if($rows){
|
||||
foreach($rows as $key=>$val){
|
||||
$where = [
|
||||
'biz_id' => $val['biz_id'],
|
||||
'year' => $val['year'],
|
||||
'month' => $val['month']
|
||||
];
|
||||
if(!$this->biz_settle_static_model->get($where)){
|
||||
$biz = $this->biz_model->get(['id'=>$val['biz_id']]);
|
||||
$biz_info = $this->biz_info_model->get(['biz_id'=>$val['biz_id']]);
|
||||
$total_car = $this->biz_settle_model->count($where);
|
||||
$sum_car = $this->biz_settle_model->sum('profix_car',$where);
|
||||
$sum_insure = $this->biz_settle_model->sum('profix_insure',$where);
|
||||
$sum_loan = $this->biz_settle_model->sum('profix_loan',$where);
|
||||
$sum_carno = $this->biz_settle_model->sum('profix_carno',$where);
|
||||
$price_all = $sum_insn['profix_insure']+$sum_loan['profix_loan']+$sum_carno['profix_carno'];
|
||||
$sum_trucking = $this->biz_settle_model->sum('price_trucking',$where);
|
||||
$data = [
|
||||
'biz_id' => $val['biz_id'],
|
||||
'profix_car' => $sum_car['profix_car'],
|
||||
'profix_car_after' => sprintf("%.2f",$sum_car['profix_car']/1.13),
|
||||
'price_all' => $price_all,
|
||||
'price_trucking' => $sum_trucking['price_trucking'],
|
||||
'rent' => $biz_info['rent'],
|
||||
'wat_ele' => $biz_info['wat_ele'],
|
||||
'employee_wage' => $biz_info['employee_wage'],
|
||||
'manager_wage' => $biz_info['manager_wage'],
|
||||
'commission' => $biz_info['commission'] * $total_car,
|
||||
'year' => $val['year'],
|
||||
'month' => $val['month'],
|
||||
'c_time' => time()
|
||||
];
|
||||
$data['price_total'] = $data['price_all']+$data['profix_car_after'];
|
||||
$type_config = $this->biz_type[$biz_info['type']];
|
||||
$price_need = $data['price_total'] - $data['rent'] - $data['wat_ele'] - $data['employee_wage'] - $data['manager_wage'] - $data['commission'] - $data['price_trucking'];
|
||||
$data['profix_liche'] = $price_need*$type_config['liche'];
|
||||
$data['profix_partner'] = $price_need*$type_config['partner'];
|
||||
$this->biz_settle_static_model->add($data);
|
||||
}
|
||||
}
|
||||
}else{
|
||||
echo 'finish';
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
<?php
|
||||
/**
|
||||
* Notes:博饼任务
|
||||
* Created on: 2021/8/20 17:15
|
||||
* Created by: dengbw
|
||||
*/
|
||||
class Liche extends HD_Controller
|
||||
{
|
||||
public function __construct(){
|
||||
parent::__construct();
|
||||
$this->load->model('receiver/order/receiver_order_contracts_model');
|
||||
$this->load->model('receiver/order/receiver_orders_v2_model');
|
||||
|
||||
$this->load->library('receiver/orders_v2_entity');
|
||||
}
|
||||
|
||||
//获取未签名pdf
|
||||
public function un_sign_pdf(){
|
||||
$row = $this->receiver_order_contracts_model->get(['o_id>='=>Orders_v2_entity::V2_START_ID,'flag'=>0,'file !='=>'','status'=>1]);
|
||||
$receiver = $this->receiver_orders_v2_model->get(['id' => $row['o_id']]);
|
||||
if(file_exists(FCPATH.$row['file']) && $receiver){
|
||||
$companys = $this->orders_v2_entity->get_biz_mchid($receiver['biz_id']);
|
||||
$url = http_host_com();
|
||||
$width = 130;
|
||||
$s_img = build_qiniu_image_url($companys['company']['img_seal']);
|
||||
if($row['type']==1){
|
||||
$page = 2;
|
||||
$height = 380;
|
||||
$s_img = build_qiniu_image_url($companys['srv_company']['img_seal']);
|
||||
}elseif ($row['type']==3){
|
||||
$page = 1;
|
||||
$height = 620;
|
||||
} else{
|
||||
$page = 3;
|
||||
$height = 160;
|
||||
}
|
||||
$data = [
|
||||
'id' => $row['id'],
|
||||
'o_id' => $row['o_id'],
|
||||
's_page' => $page,
|
||||
'width' => $width,
|
||||
'height' => $height,
|
||||
's_img' => $s_img,
|
||||
'file_url' => $url.'/'.$row['file']
|
||||
];
|
||||
die(json_encode($data,JSON_UNESCAPED_UNICODE));
|
||||
}else{
|
||||
$this->receiver_order_contracts_model->update(['flag'=>1],['id'=>$row['id']]);
|
||||
}
|
||||
}
|
||||
|
||||
//覆盖pdf文件
|
||||
public function up_pdf(){
|
||||
$id = $this->input->post('id');
|
||||
$row = $this->receiver_order_contracts_model->get(['id'=>$id,'flag'=>0]);
|
||||
if($row){
|
||||
$file_path_arr = explode('/',$row['file']);
|
||||
// $file_name = array_pop($file_path_arr);
|
||||
// $file_name = 'test.pdf';
|
||||
// $file_path = implode('/',$file_path_arr);
|
||||
// $res = move_uploaded_file($_FILES['file']['tmp_name'],FCPATH.$file_path.'/'.$file_name);
|
||||
move_uploaded_file($_FILES['file']['tmp_name'],FCPATH.$row['file']);
|
||||
$res = $this->receiver_order_contracts_model->update(['flag'=>1],['id'=>$row['id']]);
|
||||
if($res){
|
||||
$data = [
|
||||
'code' => 1,
|
||||
'msg' => '保存成功'
|
||||
];
|
||||
die(json_encode($data,JSON_UNESCAPED_UNICODE));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,101 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
class Order extends CI_Controller{
|
||||
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model('receiver/order/receiver_orders_model');
|
||||
$this->load->model('receiver/order/receiver_orders_v2_model');
|
||||
}
|
||||
|
||||
public function index(){
|
||||
$size = $this->input->get('size');
|
||||
!$size && $size = 5;
|
||||
|
||||
$t1 = 'lc_receiver_orders';
|
||||
$t2 = 'lc_receiver_orders_v2';
|
||||
|
||||
$fields = "$t1.*";
|
||||
$where = [
|
||||
"$t1.status>=" => 0,
|
||||
"$t2.id is null" => null
|
||||
];
|
||||
|
||||
$this->db->from("$t1");
|
||||
$this->db->join("$t2", "$t2.id=$t1.id",'left');
|
||||
|
||||
$this->db->select($fields);
|
||||
$this->db->where($where);
|
||||
$this->db->order_by("$t1.id asc");
|
||||
$this->db->limit($size);
|
||||
$rows = $this->db->get()->result_array();
|
||||
if($rows){
|
||||
foreach($rows as $key=>$val){
|
||||
echo "执行old_id:{$val['id']}<br>";
|
||||
if($val['status']==7){
|
||||
$status = 2;
|
||||
}elseif($val['status']==6){
|
||||
$status = 1;
|
||||
}else{
|
||||
$status = 0;
|
||||
}
|
||||
$money_json = json_decode($val['money_json'],true);
|
||||
!$money_json['price_book'] && $money_json['price_book'] = $val['deposit'];
|
||||
$data = [
|
||||
'id' => $val['id'],
|
||||
'sid' => $val['sid'],
|
||||
'clue_id' => $val['clue_id'],
|
||||
'customer_id' => $val['rid'],
|
||||
'name' => $val['name'],
|
||||
'mobile' => $val['mobile'],
|
||||
'main_type' => $val['main_type'],
|
||||
'payway' => $val['payway'],
|
||||
'finance_id' => $val['finance_id'],
|
||||
'srv_ids' => $val['srv_ids'],
|
||||
'fines' => $val['fine_ids'],
|
||||
'brand_id' => $val['brand_id'],
|
||||
's_id' => $val['s_id'],
|
||||
'v_id' => $val['v_id'],
|
||||
'cor_id' => $val['cor_id'],
|
||||
'incor_id' => $val['incor_id'],
|
||||
'item_id' => $val['item_id'],
|
||||
'biz_id' => $val['biz_id'],
|
||||
'sale_id' => $val['admin_id'],
|
||||
'info_json' => $val['info_json'],
|
||||
'car_json' => $val['car_json'],
|
||||
'money_json' => $val['money_json'],
|
||||
'jsondata' => $val['jsondata'],
|
||||
'delry_time' => $val['delry_time'],
|
||||
'order_time' => $val['order_time'],
|
||||
'bill_time' => $val['bill_time'],
|
||||
'c_time' => $val['c_time'],
|
||||
'u_time' => $val['u_time'],
|
||||
'status' => $status
|
||||
];
|
||||
$res = $this->receiver_orders_v2_model->add($data);
|
||||
if($res){
|
||||
echo "执行成功:{$val['id']}<br>";
|
||||
}else{
|
||||
echo "执行失败:{$val['id']}<br>";
|
||||
}
|
||||
}
|
||||
|
||||
$where = [
|
||||
"$t1.status>=" => 0,
|
||||
"$t2.id is null" => null
|
||||
];
|
||||
|
||||
$this->db->from("$t1");
|
||||
$this->db->join("$t2", "$t2.id=$t1.id",'left');
|
||||
|
||||
$this->db->select($fields);
|
||||
$this->db->where($where);
|
||||
$res = $this->db->count_all_results();
|
||||
echo "剩余:{$res}<br>";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -33,7 +33,8 @@ class Plan extends CI_Controller
|
||||
$plan[] = array('url' => base_url(array('plan', 'licheb', 'customer_level')), 'interval' => 1);//更新客户等级
|
||||
$plan[] = array('url' => base_url(array('plan', 'licheb', 'visit_sales_sms')), 'interval' => 1);//给销售发送待回访短信
|
||||
$plan[] = array('url' => base_url(array('plan', 'licheb', 'customer_manager_sms')), 'interval' => 1);//给店长发送待分配短信
|
||||
$plan[] = array('url' => base_url(array('plan', 'licheb', 'inventory_log')), 'interval' => 5);//更新车辆调拨状态
|
||||
|
||||
$plan[] = array('url' => base_url(array('plan', 'biz', 'settle')), 'interval' => 1);
|
||||
$this->plan = $plan;
|
||||
}
|
||||
|
||||
|
||||
@@ -521,4 +521,9 @@ abstract class Wxapp extends HD_Controller{
|
||||
}
|
||||
return $h5_host;
|
||||
}
|
||||
|
||||
//获取当前门店id
|
||||
protected function get_biz_id(){
|
||||
return $this->session['new_biz_id'] ? $this->session['new_biz_id'] : intval($this->session['biz_id']);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,79 @@
|
||||
<?php
|
||||
defined('WXAPP_APP') OR exit('No direct script access allowed');
|
||||
/**
|
||||
* Created by vim
|
||||
* User: lcc
|
||||
* Desc: 商务政策
|
||||
* Date: 2021/03/11
|
||||
* Time: 10:22
|
||||
*/
|
||||
require_once APPPATH . 'controllers/wxapp/Wxapp.php';
|
||||
class Business extends Wxapp{
|
||||
function __construct($inputs, $app_key){
|
||||
parent::__construct($inputs, $app_key);
|
||||
|
||||
$this->login_white = array();//登录白名单
|
||||
$this->check_status = array();//用户状态校验
|
||||
$this->check_mobile = array();//需要手机号
|
||||
$this->check_headimg =array();//授权微信信息
|
||||
$this->load->model('auto/auto_cars_model');
|
||||
$this->load->model('auto/auto_business_model');
|
||||
$this->load->model("biz/biz_model");
|
||||
}
|
||||
|
||||
protected function get(){
|
||||
$biz_id = $this->get_biz_id();
|
||||
$s_id = $this->input_param('car_id');
|
||||
$v_id = $this->input_param('v_id');
|
||||
$color_id = $this->input_param('color_id');
|
||||
$main_type = $this->input_param('main_type');
|
||||
$biz = $this->biz_model->get(['id'=>$biz_id],'city_id');
|
||||
$city_id = $biz['city_id'];
|
||||
$where = [
|
||||
's_id'=>$s_id,
|
||||
'v_id'=>$v_id,
|
||||
'status'=>1,
|
||||
'if_effect'=>1,
|
||||
'city_id'=>$city_id,
|
||||
'year' => date('Y'),
|
||||
'month' => intval(date('m'))
|
||||
];
|
||||
$row = $this->auto_business_model->get($where);
|
||||
if(!$row){
|
||||
throw new Exception('当前地区不支持销售该车型', API_CODE_FAIL);
|
||||
}
|
||||
$car['price_car'] = $row['price_car'];
|
||||
$car['price_floor'] = $row['price_floor'];
|
||||
$dis_money = $car['price_car'] - $car['price_floor'];
|
||||
|
||||
$where_car = array(
|
||||
's_id'=>$s_id,
|
||||
'v_id' => $v_id,
|
||||
);
|
||||
$v_id!=113 && $where_car['status'] = 1;//哪吒 U 2021款Pro400巡航版 不判断状态
|
||||
$c_row = $this->auto_cars_model->get($where_car,'',$city_id);
|
||||
$dis_fine_money = $c_row['price_fine_floor']>0 && $c_row['price_fine']-$c_row['price_fine_floor']>0 ? $c_row['price_fine']-$c_row['price_fine_floor'] : 0;
|
||||
|
||||
$dis_money_list = [500,1000,2000];
|
||||
$dis_fine_money_list = [500,1000,1500];
|
||||
$deposit_list = [2000,3000,5000];
|
||||
$color_arr = json_decode($row['colors'],true);
|
||||
$price_color = in_array($color_id,$color_arr) ? $row['price_color'] : 0;
|
||||
$price_coplus = $main_type ? $row['price_coplus'] : 0;
|
||||
|
||||
$data = [
|
||||
'id' => $row['id'],
|
||||
'price' => $car['price_car'] ? floatval($car['price_car']) : 0,
|
||||
'dis_money' => $dis_money,
|
||||
'dis_money_list' => $dis_money_list,
|
||||
'fine_money' => floatval($car['price_fine']),
|
||||
'dis_fine_money' => $dis_fine_money,
|
||||
'dis_fine_money_list' => $dis_fine_money_list,
|
||||
'deposit_list' => $deposit_list,
|
||||
'price_color' => floatval($price_color),
|
||||
'price_coplus' => floatval($price_coplus)
|
||||
];
|
||||
return $data;
|
||||
|
||||
}
|
||||
}
|
||||
@@ -62,6 +62,7 @@ class Series extends Wxapp{
|
||||
$auto_brands = $jsondata['auto_brands'] ? $jsondata['auto_brands'] : [0];
|
||||
|
||||
$str_brands = implode(',',$auto_brands);
|
||||
!$str_brands && $str_brands = 0;
|
||||
$where["id in ($str_brands)"] = null;
|
||||
}
|
||||
$count = $this->auto_brand_model->count($where);
|
||||
@@ -100,7 +101,6 @@ class Series extends Wxapp{
|
||||
if($rows){
|
||||
$first = [];
|
||||
$brand_arr = array_unique(array_column($rows,'brand_id'));
|
||||
$brands = [];
|
||||
$brand_ids = implode(',',$brand_arr);
|
||||
if($brand_ids){
|
||||
$where = [
|
||||
@@ -130,8 +130,6 @@ class Series extends Wxapp{
|
||||
$type = $this->input_param('type');
|
||||
$page = $this->input_param('page');
|
||||
$size = $this->input_param('size');
|
||||
$v_id = $this->input_param('v_id');
|
||||
$cor_id = $this->input_param('color_id');
|
||||
|
||||
!$page && $page = 1;
|
||||
!$size && $size = 20;
|
||||
@@ -209,13 +207,20 @@ class Series extends Wxapp{
|
||||
throw new Exception('当前车型暂无库存', ERR_PARAMS_ERROR);
|
||||
}
|
||||
$dis_fine_money = $car['price_fine_floor']>0 && $car['price_fine']-$car['price_fine_floor']>0 ? $car['price_fine']-$car['price_fine_floor'] : 0;
|
||||
$dis_fine_money_list = [500,1000,1500];
|
||||
$dis_money = $car['price_car'] - $car['price_floor'];
|
||||
$dis_money_list = [500,1000,2000];
|
||||
$data = [
|
||||
'price' => $car['price_car'] ? floatval($car['price_car']) : 0,
|
||||
'deposit' => $car['price_book'] ? floatval($car['price_book']) : 0,
|
||||
'dis_money' => $car['price_car'] - $car['price_floor'],
|
||||
'dis_money' => $dis_money,
|
||||
'dis_money_list' => $dis_money_list,
|
||||
'fine_money' => floatval($car['price_fine']),
|
||||
'dis_fine_money' => $dis_fine_money,
|
||||
'dis_fine_money_list' => $dis_fine_money_list,
|
||||
'deposit_list' => [2000,3000,5000],
|
||||
];
|
||||
return $data;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -22,12 +22,17 @@ class Order extends Wxapp{
|
||||
$this->uid = $this->session['uid'];
|
||||
$this->load->model('apporder/order_purchase_model');
|
||||
$this->load->model('receiver/order/receiver_orders_model');
|
||||
$this->load->model('receiver/order/receiver_orders_v2_model');
|
||||
$this->load->model('receiver/order/receiver_order_contracts_model');
|
||||
$this->load->model('receiver/order/receiver_order_status_model');
|
||||
$this->load->model('receiver/order/receiver_order_deliverys_model','order_deliverys_model');
|
||||
|
||||
$this->load->model('auto/auto_series_model');
|
||||
$this->load->model('auto/auto_brand_model');
|
||||
$this->load->model('auto/auto_attr_model');
|
||||
|
||||
$this->load->model('app/liche/app_liche_orders_model');
|
||||
$this->load->library('receiver/orders_v2_entity');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -132,7 +137,7 @@ class Order extends Wxapp{
|
||||
$oid && $where['o_id'] = $oid;
|
||||
$total = $this->app_liche_orders_model->count($where);
|
||||
if($total){
|
||||
$fileds = 'id,o_id,sid,brand_id,s_id,v_id,cor_id,incor_id';
|
||||
$fileds = 'id,o_id,sid,brand_id,s_id,v_id,cor_id,incor_id,c_time';
|
||||
$rows = $this->app_liche_orders_model->select($where,'id desc',$page,$size,$fileds);
|
||||
//品牌车型
|
||||
$brand_arr = array_unique(array_column($rows,'brand_id'));
|
||||
@@ -148,9 +153,16 @@ class Order extends Wxapp{
|
||||
$attrs = $this->auto_attr_model->get_map_by_ids($attr_id_arr,'id,title,jsondata');
|
||||
|
||||
$type_arr = $this->app_liche_orders_model->get_type_arr();
|
||||
$contract_type_arr = $this->receiver_order_contracts_model->get_types(1);
|
||||
foreach($rows as $key=>$val){
|
||||
$order = $this->receiver_orders_model->get(['id'=>$val['o_id']],'payway,price,brand_id,s_id,v_id,cor_id,money_json');
|
||||
$money_json = json_decode($order['money_json'],true);
|
||||
$owner_name = '';
|
||||
if($val['o_id']>=Orders_v2_entity::V2_START_ID){
|
||||
$order = $this->receiver_orders_v2_model->get(['id'=>$val['o_id']],'owner_name,main_type,id,payway,brand_id,s_id,sid,v_id,cor_id,money_json,info_json');
|
||||
$info_json = json_decode($order['info_json'],true);
|
||||
$owner_name = $order['main_type'] ? $info_json['c_company'] : $order['owner_name'];
|
||||
}else{
|
||||
$order = $this->receiver_orders_model->get(['id'=>$val['o_id']],'payway,price,brand_id,s_id,sid,v_id,cor_id,money_json');
|
||||
}
|
||||
$select_car = false;
|
||||
if($order['brand_id'] && $order['s_id'] && $order['cor_id']){
|
||||
$select_car = true;
|
||||
@@ -182,29 +194,64 @@ class Order extends Wxapp{
|
||||
if($v['type']==3){
|
||||
$last_orders = [];
|
||||
$last_rows = $this->app_liche_orders_model->select(['pid'=>$v['id'],'status'=>1],'id asc',0,0,'total_price,pay_time');
|
||||
$pay_price = 0; //已支付金额
|
||||
foreach($last_rows as $v2){
|
||||
$pay_price += $v2['total_price'];
|
||||
$last_orders[] = [
|
||||
'price' => $v2['total_price'],
|
||||
'pay_time' => $v2['pay_time'],
|
||||
'pay_cn' => $v2['total_price'] == $v['total_price'] ? '全部支付' : '部分支付'
|
||||
'pay_cn' => '支付'
|
||||
];
|
||||
}
|
||||
$is_pay = $this->app_liche_orders_model->sum('total_price',['status'=>1,'uid'=>$uid,'pid'=>$v['id']]); //已支付金额
|
||||
$setValue['no_pay_price'] = $v['total_price'] - $is_pay['total_price'];
|
||||
$setValue['no_pay_price'] = $v['total_price'] - $pay_price;
|
||||
$setValue['sub_order'] = $last_orders;
|
||||
}
|
||||
$sub_order[] = $setValue;
|
||||
}
|
||||
}
|
||||
$agree = $this->receiver_order_contracts_model->count(['o_id'=>$val['o_id'],'status'=>1]) ? true : false;
|
||||
$contract_list = [];
|
||||
if($agree){
|
||||
$contracts = $this->receiver_order_contracts_model->select(['o_id'=>$val['o_id'],'status'=>1],'','','','id,type,file');
|
||||
foreach ($contracts as $item) {
|
||||
$contract_list[] = [
|
||||
'title' => $contract_type_arr[$item['type']],
|
||||
'url' => http_host_com('api').'/wxapp/licheb/protocol/pdf_img?id='.$item['id']
|
||||
];
|
||||
}
|
||||
}
|
||||
$ckcar_status = false;
|
||||
$agent_ck = $this->receiver_order_status_model->count(['o_id'=>$val['o_id'],'status'=>1,'pid_status'=>4]);
|
||||
$user_ck = $this->receiver_order_status_model->count(['o_id'=>$val['o_id'],'status'=>2,'pid_status'=>4]);
|
||||
if($agent_ck && !$user_ck){
|
||||
$ckcar_status = true;
|
||||
}
|
||||
//获取随车信息
|
||||
$delivery = $this->order_deliverys_model->get(['o_id'=>$val['o_id']],'status,info,tool,remark');
|
||||
$ckcar_data = [
|
||||
'info' => $delivery['info'] ? explode(',',$delivery['info']) : [],
|
||||
'tool' => $delivery['tool'] ? explode(',',$delivery['tool']) : [],
|
||||
'remark' => $delivery['remark'] ? $delivery['remark'] : ''
|
||||
];
|
||||
$list[] = [
|
||||
'oid' => $order['id'],
|
||||
'title' => $brand_name.$serie_name,
|
||||
'owner_name' => $owner_name,
|
||||
'cover' => $cover,
|
||||
'price' => $money_json['price_discount'] ? $money_json['price_car'] - $money_json['price_discount'] : $money_json['price_car'],
|
||||
'sid' => $val['sid'],
|
||||
'price' => $this->orders_v2_entity->total_price($order['id']),
|
||||
'sid' => $order['sid'],
|
||||
'payway' => $order['payway'],
|
||||
'type' => $select_car,
|
||||
'info' => $info,
|
||||
'sub_order' => $sub_order,
|
||||
'agree' => $agree,
|
||||
'ckcar_status' => $ckcar_status, //是否显示确认车辆
|
||||
'version' => $attrs[$val['v_id']] ? $attrs[$val['v_id']][0]['title'] : '',
|
||||
'color' => $attrs[$val['cor_id']] ? $attrs[$val['cor_id']][0]['title'] : '',
|
||||
'in_color' => $attrs[$val['incor_id']] ? $attrs[$val['incor_id']][0]['title'].'内饰' : '',
|
||||
'contract_list' => $contract_list,
|
||||
'ckcar_data' => $ckcar_data,
|
||||
'c_time' => date('Y-m-d H:i:s',$val['c_time'])
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,21 +17,90 @@ class Pay extends Wxapp{
|
||||
|
||||
$this->load->model('app/liche/app_liche_orders_model');
|
||||
$this->load->model('receiver/order/receiver_orders_model','orders_model');
|
||||
$this->load->model('receiver/order/receiver_orders_v2_model');
|
||||
|
||||
$this->load->model('auto/auto_brand_model');
|
||||
$this->load->model('auto/auto_series_model');
|
||||
$this->load->model('auto/auto_attr_model');
|
||||
|
||||
$this->load->model('biz/biz_model');
|
||||
$this->load->model("sys/sys_company_model");
|
||||
|
||||
$this->load->library('receiver/orders_entity');
|
||||
$this->load->library('receiver/orders_v2_entity');
|
||||
|
||||
$this->uid = $this->session['uid'];
|
||||
}
|
||||
|
||||
//获取订单信息
|
||||
public function get_order(){
|
||||
$sid = $this->input_param('sid');
|
||||
$row = $this->app_liche_orders_model->get(['sid'=>$sid,'pid>'=>0]);
|
||||
if(!$row){
|
||||
throw new Exception('订单不存在', API_CODE_FAIL);
|
||||
}
|
||||
$order_type = $this->app_liche_orders_model->get_type_arr();
|
||||
$order_info = [];
|
||||
$price = $row['total_price'];
|
||||
$pay_status = $row['status'] ? true:false;
|
||||
if($row['type']!=4){
|
||||
$order = $this->receiver_orders_v2_model->get(['id'=>$row['o_id']]);
|
||||
$money_json = json_decode($order['money_json'],true);
|
||||
//品牌车型
|
||||
$brands = $this->auto_brand_model->get(['id'=>$order['brand_id']],'id,name');
|
||||
//车系车型
|
||||
$series = $this->auto_series_model->get(['id'=>$order['s_id']],'id,name','id,name');
|
||||
$brand_name = $brands['name'] ? $brands['name'] : '';
|
||||
$serie_name = $series['name'] ? $series['name'] : '';
|
||||
//获取车辆属性
|
||||
$attr_id_arr = [
|
||||
$order['v_id'], $order['cor_id'], $order['incor_id']
|
||||
];
|
||||
$attrs = $this->auto_attr_model->get_map_by_ids($attr_id_arr,'id,title,jsondata');
|
||||
$cover = '';
|
||||
if($attrs[$order['cor_id']]){
|
||||
$jsondata = json_decode($attrs[$order['cor_id']][0]['jsondata'],true);
|
||||
$cover = build_qiniu_image_url($jsondata['img']);
|
||||
}
|
||||
$order_info = [
|
||||
'title' => $brand_name.$serie_name,
|
||||
'cover' => $cover,
|
||||
'price' => $money_json['price_discount'] ? $money_json['price_car'] - $money_json['price_discount'] : $money_json['price_car'],
|
||||
'version' => $attrs[$order['v_id']] ? $attrs[$order['v_id']][0]['title'] : '',
|
||||
'color' => $attrs[$order['cor_id']] ? $attrs[$order['cor_id']][0]['title'] : '',
|
||||
'in_color' => $attrs[$order['incor_id']] ? $attrs[$order['incor_id']][0]['title'] : '',
|
||||
];
|
||||
}
|
||||
if($row['type']==3){ //尾款
|
||||
$is_pay = $this->app_liche_orders_model->sum('total_price',['status'=>1,'pid'=>$row['id']]); //已支付尾款金额
|
||||
$price = $row['total_price'] - $is_pay['total_price'];
|
||||
if($price<=0){
|
||||
$price = $row['total_price'];
|
||||
$pay_status = true;
|
||||
}
|
||||
}
|
||||
$data = [
|
||||
'nickname' => $this->session['nickname'],
|
||||
'headimg' => $this->session['headimg'],
|
||||
'text' => '我在狸车平台上相中了一款好车,需要你帮忙付款,感恩~',
|
||||
'type' => $row['type'],
|
||||
'type_cn' => $order_type[$row['type']],
|
||||
'price' => $price,
|
||||
'pay_status' => $pay_status,
|
||||
'order_info' => $order_info
|
||||
];
|
||||
return $data;
|
||||
}
|
||||
//支付
|
||||
public function put(){
|
||||
$sid = $this->input_param('sid');
|
||||
$price = $this->input_param('price');
|
||||
$row = $this->app_liche_orders_model->get(['sid'=>$sid,"(uid={$this->uid} or entrust_uid={$this->uid})"=>null]);
|
||||
$type = $this->input_param('type');
|
||||
if($type){ //代付
|
||||
$row = $this->app_liche_orders_model->get(['sid'=>$sid]);
|
||||
}else{
|
||||
$row = $this->app_liche_orders_model->get(['sid'=>$sid,"(uid={$this->uid} or entrust_uid={$this->uid})"=>null]);
|
||||
}
|
||||
$type_arr = $this->app_liche_orders_model->get_type_arr();
|
||||
if(!$row){
|
||||
throw new Exception('订单不存在', API_CODE_FAIL);
|
||||
@@ -39,16 +108,18 @@ class Pay extends Wxapp{
|
||||
if($row['status']==1){
|
||||
throw new Exception('订单已支付', API_CODE_FAIL);
|
||||
}
|
||||
if($row['type']==3){ //判断服务费是否支付
|
||||
$srv_pay = $this->app_liche_orders_model->count(['o_id'=>$row['o_id'],'type'=>2,'status'=>0]);
|
||||
if($srv_pay){
|
||||
throw new Exception('请先支付委托服务费', API_CODE_FAIL);
|
||||
if($row['o_id']<=Orders_v2_entity::V2_START_ID) {
|
||||
if ($row['type'] == 3) { //判断服务费是否支付
|
||||
$srv_pay = $this->app_liche_orders_model->count(['o_id' => $row['o_id'], 'type' => 2, 'status' => 0]);
|
||||
if ($srv_pay) {
|
||||
throw new Exception('请先支付委托服务费', API_CODE_FAIL);
|
||||
}
|
||||
}
|
||||
}
|
||||
if($row['type']==1){ //判断是否存在未支付意向金
|
||||
$inten_pay = $this->app_liche_orders_model->count(['o_id'=>$row['o_id'],'type'=>4,'status'=>0]);
|
||||
if($inten_pay){
|
||||
throw new Exception('请先支付意向金', API_CODE_FAIL);
|
||||
if ($row['type'] == 1) { //判断是否存在未支付意向金
|
||||
$inten_pay = $this->app_liche_orders_model->count(['o_id' => $row['o_id'], 'type' => 4, 'status' => 0]);
|
||||
if ($inten_pay) {
|
||||
throw new Exception('请先支付意向金', API_CODE_FAIL);
|
||||
}
|
||||
}
|
||||
}
|
||||
if($row['total_price']>0){
|
||||
@@ -73,7 +144,8 @@ class Pay extends Wxapp{
|
||||
$sub_data = [
|
||||
'o_id' => $row['o_id'],
|
||||
'sid' => $sid,
|
||||
'uid' => $this->uid,
|
||||
'uid' => $row['uid'],
|
||||
'pay_uid' => $this->uid,
|
||||
'mch_id' => $row['mch_id'],
|
||||
'pid' => $row['id'],
|
||||
'brand_id' => $row['brand_id'],
|
||||
@@ -82,11 +154,10 @@ class Pay extends Wxapp{
|
||||
'cor_id' => $row['cor_id'],
|
||||
'incor_id' => $row['incor_id'],
|
||||
'total_price' => $total,
|
||||
'entrust_uid' => $row['entrust_uid'],
|
||||
'type' => 3,
|
||||
'c_time' => time()
|
||||
];
|
||||
$entrust_user = $this->orders_entity->entrust_user($row['o_id']);
|
||||
$entrust_user['id'] && $sub_data['entrust_uid'] = $entrust_user['id'];
|
||||
$res = $this->app_liche_orders_model->add($sub_data);
|
||||
if(!$res){
|
||||
throw new Exception('创建订单失败', API_CODE_FAIL);
|
||||
@@ -101,11 +172,18 @@ class Pay extends Wxapp{
|
||||
if($this->uid<=10){
|
||||
$total = 0.01;
|
||||
}
|
||||
$order_row = $this->orders_model->get(['id'=>$row['o_id']],'name,brand_id,s_id,biz_id');
|
||||
if($row['id']>=Orders_v2_entity::V2_START_ID){
|
||||
$order_row = $this->receiver_orders_v2_model->get(['id'=>$row['o_id']],'name,brand_id,s_id,biz_id');
|
||||
}else{
|
||||
$order_row = $this->orders_model->get(['id'=>$row['o_id']],'name,brand_id,s_id,biz_id');
|
||||
}
|
||||
$brand_row = $this->auto_brand_model->get(['id'=>$order_row['brand_id']],'name');
|
||||
$s_row = $this->auto_series_model->get(['id'=>$order_row['s_id']],'name');
|
||||
$biz_row = $this->biz_model->get(['id'=>$order_row['biz_id']],'biz_name,company_id');
|
||||
$company_row = $this->sys_company_model->get(['id'=>$biz_row['company_id']],'short');
|
||||
if($row['id']>=Orders_v2_entity::V2_START_ID){
|
||||
$company_row = $this->sys_company_model->get(['id'=>$row['company_id']],'short');
|
||||
}
|
||||
$type_name = $type_arr[$row['type']];
|
||||
$description = "{$brand_row['name']}{$s_row['name']}-{$order_row['name']}-{$biz_row['biz_name']}-{$type_name}-{$company_row['short']}";
|
||||
$this->config->load('wxpay');
|
||||
|
||||
@@ -14,8 +14,20 @@ class Protocol extends Wxapp{
|
||||
function __construct($inputs, $app_key){
|
||||
parent::__construct($inputs, $app_key);
|
||||
|
||||
$this->login_white = 'all';//登录白名单
|
||||
$this->login_white = ['get'];//登录白名单
|
||||
$this->load->model('receiver/order/receiver_orders_v2_model');
|
||||
$this->load->model('receiver/receiver_services_model','services_model');
|
||||
$this->load->model('receiver/order/receiver_order_contracts_model');
|
||||
$this->load->model('receiver/order/receiver_order_deliverys_model','deliverys_model');
|
||||
|
||||
$this->load->model('auto/auto_series_model');
|
||||
$this->load->model('auto/auto_brand_model');
|
||||
$this->load->model('auto/auto_attr_model');
|
||||
$this->load->model("items/items_model");
|
||||
|
||||
$this->load->library('receiver/orders_v2_entity');
|
||||
$this->load->library('receiver/orders_status_entity');
|
||||
$this->load->library('pdftk');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -36,4 +48,225 @@ class Protocol extends Wxapp{
|
||||
$data['content'] = $content;
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取支付同意html内容
|
||||
*/
|
||||
protected function get_html(){
|
||||
$oid = $this->input_param('oid');
|
||||
$type = $this->input_param('type');
|
||||
if($type==1){
|
||||
return $this->ck_html($oid);
|
||||
}
|
||||
$row = $this->receiver_orders_v2_model->get(['id'=>$oid]);
|
||||
if(!$row ){
|
||||
throw new Exception('参数错误', API_CODE_INVILD_PARAM);
|
||||
}
|
||||
$fill_info = $this->orders_v2_entity->pdf_data($row);
|
||||
$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>
|
||||
<div style=\"text-indent:6.4vw;\">本《汽车购买协议》(“本协议”),由您(“狸车用户”)与下述签署本协议的狸车销售公司或其关联公司 (以下统称“狸车公司”),于本协议附件一所载明的协议签署日签署。</div>
|
||||
<div style=\"text-indent:6.4vw;\">依据《中华人民共和国民法典》及有关法律的规定,就您购买车辆所涉事宜,双方在诚实守信、平等自愿的基础上,经充分协商,达成交易文件,供双方予以遵守。</div>
|
||||
<div style=\"margin-top:10px;\"><b>价格支付</b></div>
|
||||
<div style=\"text-indent:6.4vw;\">您需在签署本协议时向狸车公司支付所定车辆应付的定金。如您在本协议签署前已就购买汽车事宜向狸车公司支付了意向金,则您已支付意向金将按本条前述约定自动转为定金,超出定金金额的剩余意向金(如有)自动构成尾款的一部分。如您拒绝向狸车公司支付剩余汽车价款或在接到狸车公司通知后在指定时间内未支付剩余汽车价款,狸车公司无需另行通知您且已收取的认购定金将不予返还。</div>
|
||||
<div style=\"text-indent:6.4vw;\">虽有前述规定,双方均同意,汽车交付前,若因非主观过错出现了无法预见的重大变故,直接导致无法继续履行本协议,经您与狸车公司协商一致后,可解除本协议且已收取的定金及意向金中超出定金金额的款项(如有)将进行退还。</div>
|
||||
<div style=\"margin-top:10px;\"><b>配置变更</b></div>
|
||||
<div style=\"text-indent:6.4vw;\">定金支付后,车型配置方案将不可更改,同时您确认狸车公司可以立即配车。但经双方协商一致且狸车公司书面同意后,您可以变更本协议附件中的相关内容,双方将按变更后的约定继续履行本协议。</div>
|
||||
<div style=\"margin-top:10px;\"><b>车辆交付</b></div>
|
||||
<div style=\"text-indent:6.4vw;\">狸车公司预计将于定金支付后的 {$fill_info['give_time']} 日向您交付汽车。(该时间仅供参考,实际交付时间可能根据车辆配置、提车城市等因素提前或延后)。狸车公司收到尾款后向您交付汽车,并随同汽车一并向您交付与汽车相关的《保修保养手册》、《用户手册》等文件(“随车文件”)以及车辆钥匙、充电枪等物品(“随车工具”)。</div>
|
||||
<div style=\"margin-top:10px;\"><b>补贴约定</b></div>
|
||||
<div style=\"text-indent:6.4vw;\">鉴于新能源汽车购车补贴在您购车时已作扣除,为便于狸车公司能够从相关主管部门获得该等补贴或保障狸车公司在无法获得该等补贴时权益不受损害,您应按照狸车公司不时要求的必要行动以及提供狸车公司不时要求的信息和文件。另外,鉴于国家和地方关于新能源汽车购车补贴的法律法规及政策可能不时发生变化,狸车公司会在其发生变化的同时相应调整实际购车总价、尾款;因此,您最终需支付的实际购车总价、尾款应以交付通知中列明的金额为准。</div>
|
||||
<div style=\"margin-top:10px;\"><b>适用法律</b></div>
|
||||
<div style=\"text-indent:6.4vw;\">本协议应受中华人民共和国法律管辖并据其进行解释。因本协议引起的以及与本协议有关的一切争议,首先应由双方通过友好协商解决。如果双方未能通过协商解决该等争议,则任何一方有权向狸车公司所在地有管辖权的人民法院提起诉讼。如需仲裁,双方另行协商签订相关补充条款。</div>
|
||||
<div style=\"margin-top:10px;\"><b>协议生效</b></div>
|
||||
<div style=\"text-indent:6.4vw;\">本协议的所有附件构成本协议不可分割的一部分。本协议自您点击确认“我已阅读并同意”或双方签字、盖章且狸车公司收到您支付的定金后立即生效。</div>
|
||||
<div style=\"margin-top:10px;\">狸车用户:</div>
|
||||
<div>
|
||||
<div style=\"text-indent:6.4vw;\">签署:{$fill_info['name']}</div>
|
||||
<div style=\"text-indent:6.4vw;\">日期:{$fill_info['now_day']}</div>
|
||||
</div>
|
||||
<div style=\"margin-top:10px;\">狸车公司:</div>
|
||||
<div>
|
||||
<div style=\"text-indent:6.4vw;\">签署:{$fill_info['companys']['company']['title']}</div>
|
||||
<div style=\"text-indent:6.4vw;\">日期:{$fill_info['now_day']}</div>
|
||||
</div>
|
||||
<div style=\"margin-top:20px;text-align:right;\">编号【{$row['sid']}】</div>
|
||||
<div style=\"margin-top:10px;\"><b>附件一 订单信息</b></div>
|
||||
<div>车主姓名:{$fill_info['owner_name']}</div>
|
||||
<div>联系电话:{$fill_info['owner_mobile']}</div>
|
||||
<div>证件类型:{$fill_info['identify_type']}</div>
|
||||
<div>证件号码:{$fill_info['identify']}</div>
|
||||
<div>联系地址:{$fill_info['address']}</div>
|
||||
<div>车辆型号:{$fill_info['version']}</div>
|
||||
<div>车身颜色:{$fill_info['color']}</div>
|
||||
<div>内饰颜色:{$fill_info['incolor']}</div>
|
||||
<div style=\"margin-top:10px;\"><b>车辆价格</b></div>
|
||||
<div>售价(元):{$fill_info['price_car']}</div>
|
||||
<div>折扣(元):{$fill_info['price_discount']}</div>
|
||||
<div>实际支付(元):{$fill_info['recevable_price']}</div>
|
||||
<div><b>其中,</b></div>
|
||||
<div>1.定金(元):{$fill_info['price_book']}</div>
|
||||
<div>2.整车尾款(元):{$fill_info['last_price']}</div>
|
||||
</div>";
|
||||
$list[] = [
|
||||
'title' => '购车协议',
|
||||
'url' => '',
|
||||
'content' => $car_html
|
||||
];
|
||||
if($row['srv_ids']){
|
||||
$service_str = implode('<br>',$fill_info['services']);
|
||||
$agent_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>
|
||||
<div style=\"text-indent:6.4vw;\">本《委托服务协议》(“本协议”),由您(“狸车用户”)与下述签署本协议的狸车服务公司或其关联公司 (以下统称“狸车公司”),于本协议附件一所载明的协议签署日签署。</div>
|
||||
<div style=\"text-indent:6.4vw;\"><b>依据《中华人民共和国民法典》及有关法律的规定,您为节省时间和精力,就甲乙双方《汽车购买协议》标的的车辆,自愿委托狸车公司办理下列委托事项,并达成如下协议:</b></div>
|
||||
<div style=\"margin-top:10px;\"><b>价格支付</b></div>
|
||||
<div style=\"text-indent:6.4vw;\">您需在签署本协议后车辆交付前向狸车公司支付所委托事项应付的金额。其中,保险费用由您直接支付给保险公司。</div>
|
||||
<div style=\"margin-top:10px;\"><b>委托事项变更</b></div>
|
||||
<div style=\"text-indent:6.4vw;\">经双方协商一致且狸车公司书面同意后,您可以变更本协议附件中的相关内容,双方将按变更后的约定继续履行本协议。</div>
|
||||
<div style=\"margin-top:10px;\"><b>适用法律</b></div>
|
||||
<div style=\"text-indent:6.4vw;\">本协议应受中华人民共和国法律管辖并据其进行解释。因本协议引起的以及与本协议有关的一切争议,首先应由双方通过友好协商解决。如果双方未能通过协商解决该等争议,则任何一方有权向狸车公司所在地有管辖权的人民法院提起诉讼。如需仲裁,双方另行协商签订相关补充条款。</div>
|
||||
<div style=\"margin-top:10px;\"><b>协议生效</b></div>
|
||||
<div style=\"text-indent:6.4vw;\">本协议的所有附件构成本协议不可分割的一部分。本协议自您点击确认“我已阅读并同意”或双方签字、盖章且狸车公司收到您支付的定金后立即生效。</div>
|
||||
<div style=\"margin-top:10px;\">狸车用户:</div>
|
||||
<div>
|
||||
<div style=\"text-indent:6.4vw;\">签署:{$fill_info['name']}</div>
|
||||
<div style=\"text-indent:6.4vw;\">日期:{$fill_info['now_day']}</div>
|
||||
</div>
|
||||
<div style=\"margin-top:10px;\">狸车公司:</div>
|
||||
<div>
|
||||
<div style=\"text-indent:6.4vw;\">签署:{$fill_info['companys']['srv_company']['title']}</div>
|
||||
<div style=\"text-indent:6.4vw;\">日期:{$fill_info['now_day']}</div>
|
||||
</div>
|
||||
<div style=\"margin-top:20px;text-align:right;\">编号【{$row['sid']}】</div>
|
||||
<div style=\"margin-top:10px;\"><b>附件一 委托上牌约定</b></div>
|
||||
<div style=\"text-indent:6.4vw;\">车牌选号时,均由狸车公司电话通知您,因您未能及时选号等其它原因,狸车公司有权代理决定并不对最终选号结果负责;若为自选号牌,狸车公司可配合您上牌,但不对最终选号结果负责。</div>
|
||||
<div style=\"text-indent:6.4vw;\">您委托狸车公司代办车辆挂牌服务时,您应事先办妥机动车车辆保险,投保险种包括但不限于车辆损失险和第三者责任险。狸车公司在代办服务过程中造成车辆毁损、灭失的,您应当先向保险公司索赔,保险条款及费用以保险公司合同为准,赔付不足部分由狸车公司予以修复或赔偿。</div>
|
||||
|
||||
<div style=\"margin-top:20px;text-align:right;\">编号【{$row['sid']}】</div>
|
||||
<div style=\"margin-top:10px;\"><b>附件二 委托服务信息</b></div>
|
||||
<div>委托人姓名:{$fill_info['owner_name']}</div>
|
||||
<div>联系电话:{$fill_info['owner_mobile']}</div>
|
||||
<div>委托项目(元):</div>
|
||||
<div>{$service_str}</div>
|
||||
</div>";
|
||||
$list[] = [
|
||||
'title' => '服务协议',
|
||||
'url' => '',
|
||||
'content' => $agent_html
|
||||
];
|
||||
}
|
||||
$data = [
|
||||
'list' => $list
|
||||
];
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* 同意条款
|
||||
*/
|
||||
protected function post(){
|
||||
$oid = $this->input_param('oid');
|
||||
$row = $this->receiver_orders_v2_model->get(['id'=>$oid]);
|
||||
if(!$row ){
|
||||
throw new Exception('参数错误', API_CODE_INVILD_PARAM);
|
||||
}
|
||||
$res = $this->orders_v2_entity->create_pdf($row['id']);
|
||||
if($res['code']){
|
||||
throw new Exception('操作成功', API_CODE_SUCCESS);
|
||||
}else{
|
||||
throw new Exception($res['msg'], API_CODE_FAIL);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected function post_ckcar(){
|
||||
$oid = $this->input_param('oid');
|
||||
$row = $this->receiver_orders_v2_model->get(['id'=>$oid]);
|
||||
if(!$row ){
|
||||
throw new Exception('参数错误', API_CODE_INVILD_PARAM);
|
||||
}
|
||||
if($this->receiver_order_contracts_model->count(['o_id'=>$oid,'status'=>1,'type'=>3])){
|
||||
throw new Exception('操作成功', API_CODE_SUCCESS);
|
||||
}
|
||||
$fill_info = $this->orders_v2_entity->pdf_data($row,1);
|
||||
$fill_data = [
|
||||
'sid' => $row['sid'],
|
||||
'date' => $fill_info['now_day'],
|
||||
'company' => $fill_info['companys']['company']['title'],
|
||||
'name' => $fill_info['name'],
|
||||
'version' => $fill_info['version'],
|
||||
'color' => $fill_info['color'],
|
||||
'incolor' => $fill_info['incolor'],
|
||||
'vin' => $fill_info['vin'],
|
||||
'info' => $fill_info['delivery']['info'],
|
||||
'tool' => $fill_info['delivery']['tool'],
|
||||
];
|
||||
$pdf_path = 'pdf/ck_tpl.pdf';
|
||||
$save_path = "pdf/{$row['sid']}/ck.pdf";
|
||||
$req = $this->pdftk->esign_fill_pdf($pdf_path,$save_path,$fill_data);
|
||||
if(!$req['code']){
|
||||
throw new Exception($req['msg'], API_CODE_FAIL);
|
||||
}
|
||||
$add_data = [
|
||||
'o_id' => $row['id'],
|
||||
'cid' => 0,
|
||||
'file' => $req['data']['file_path'] ? $req['data']['file_path'] : '',
|
||||
'type' => 3,
|
||||
'status' => 1,
|
||||
'c_time' => time()
|
||||
];
|
||||
$res = $this->receiver_order_contracts_model->add($add_data);
|
||||
if($res){
|
||||
$this->orders_status_entity->set_status($row['id'],4,2);
|
||||
$this->orders_status_entity->set_status($row['id'],5,1);
|
||||
$this->receiver_orders_v2_model->update(['status'=>1],['id'=>$row['id']]);
|
||||
throw new Exception('操作成功', API_CODE_SUCCESS);
|
||||
}else{
|
||||
throw new Exception('保存失败', API_CODE_FAIL);
|
||||
}
|
||||
}
|
||||
private function ck_html($oid){
|
||||
$row = $this->receiver_orders_v2_model->get(['id'=>$oid]);
|
||||
if(!$row ){
|
||||
throw new Exception('参数错误', API_CODE_INVILD_PARAM);
|
||||
}
|
||||
$fill_info = $this->orders_v2_entity->pdf_data($row,1);
|
||||
$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>
|
||||
<div style=\"text-indent:6.4vw;\">本《汽车交付确认单》(“本确认单”),由您(“狸车用户”)与下述签署本协议的狸车销售公司或其关联公司 (以下统称“狸车公司”),于本协议附件一所载明的协议签署日签署。</div>
|
||||
<div style=\"text-indent:6.4vw;\">狸车公司已向您做了详细的车辆介绍,介绍的内容包含但不限于车辆外部、行李箱、发动机舱、座椅、驾驶位置及各类仪表及显示屏介绍。</div>
|
||||
<div style=\"text-indent:6.4vw;\">您经过验收,确认附件所述所有事项,所购车辆符合购车合同约定并已于交付日期收到该车辆。</div>
|
||||
<div style=\"margin-top:10px;\">狸车用户:</div>
|
||||
<div>
|
||||
<div style=\"text-indent:6.4vw;\">签署:{$fill_info['name']}</div>
|
||||
<div style=\"text-indent:6.4vw;\">日期:{$fill_info['now_day']}</div>
|
||||
</div>
|
||||
<div style=\"margin-top:10px;\">狸车公司:</div>
|
||||
<div>
|
||||
<div style=\"text-indent:6.4vw;\">签署:{$fill_info['companys']['company']['title']}</div>
|
||||
<div style=\"text-indent:6.4vw;\">日期:{$fill_info['now_day']}</div>
|
||||
</div>
|
||||
<div style=\"margin-top:20px;text-align:right;\">编号【{$row['sid']}】</div>
|
||||
<div style=\"margin-top:10px;\"><b>附件一 交付信息</b></div>
|
||||
<div>车辆型号:{$fill_info['version']}</div>
|
||||
<div>车身颜色:{$fill_info['color']}</div>
|
||||
<div>内饰颜色:{$fill_info['incolor']}</div>
|
||||
<div>车架号:{$fill_info['vim']}</div>
|
||||
<div>随车资料:{$fill_info['delivery']['info']}</div>
|
||||
<div>随车工具:{$fill_info['delivery']['tool']}</div>
|
||||
</div>";
|
||||
$list[] = [
|
||||
'title' => '购车协议',
|
||||
'url' => '',
|
||||
'content' => $car_html
|
||||
];
|
||||
$data = [
|
||||
'list' => $list
|
||||
];
|
||||
return $data;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -206,9 +206,24 @@ class User extends Wxapp{
|
||||
protected function get_my(){
|
||||
$this->load->library('liche/progressopt');
|
||||
$mobile = $this->session['mobile'];
|
||||
|
||||
$where = [
|
||||
|
||||
];
|
||||
$this->app_liche_orders_model->count($where);
|
||||
$where = [
|
||||
"(uid = {$this->session['uid']} or entrust_uid={$this->session['uid']})" => null,
|
||||
'pid' => 0,
|
||||
'status>=' => 0,
|
||||
'type <>' => 5
|
||||
];
|
||||
$un_pay = $this->app_liche_orders_model->count($where);
|
||||
$about = [
|
||||
['title'=>'购车订单','icon'=>'https://qs.haodian.cn/wechat_app/liche/mine/list-icon-5.png','url'=>'/pages/mine/carOrder/index'],
|
||||
[
|
||||
'title'=>'购车订单',
|
||||
'icon'=>'https://qs.haodian.cn/wechat_app/liche/mine/list-icon-5.png',
|
||||
'url'=>'/pages/mine/carOrder/index',
|
||||
'have_new' => $un_pay ? true : false
|
||||
],
|
||||
['title'=>'我的爱车','icon'=>'https://qs.haodian.cn/wechat_app/liche/mine/list-icon-1.png','url'=>'/pages/mine/myCar/index'],
|
||||
['title'=>'联系小狸','icon'=>'https://qs.haodian.cn/wechat_app/liche/mine/list-icon-3.png'],
|
||||
];
|
||||
|
||||
@@ -21,6 +21,8 @@ class Wxnotify_v3 extends CI_Controller{
|
||||
$this->load->model('app/liche/app_liche_orders_model');
|
||||
|
||||
$this->load->model('receiver/order/receiver_orders_model');
|
||||
$this->load->library('receiver/orders_v2_entity');
|
||||
$this->load->library('qyrobot');
|
||||
|
||||
$input = file_get_contents('php://input');
|
||||
debug_log("[info] ". __FUNCTION__ . "# input:" . $input, $this->log_file,$this->log_dir);
|
||||
@@ -110,26 +112,50 @@ class Wxnotify_v3 extends CI_Controller{
|
||||
debug_log("[error] ". __FUNCTION__ . ":支付失败,sid={$sid},app_id=", $this->log_file,$this->log_dir);
|
||||
}else{ //支付成功
|
||||
$this->load->service('apporder/payment_service', array('app_id' => $this->app_id));
|
||||
$result = $this->payment_service->after_pay_liche($sid,$result['data']['amount']['payer_total']/100);
|
||||
if($result['code']){
|
||||
if($order['o_id']>=Orders_v2_entity::V2_START_ID){
|
||||
$is_ts = false;
|
||||
if($order['type']==1){ //定金
|
||||
if(!$this->app_liche_orders_model->count(['status'=>1,'o_id'=>$order['o_id']])){
|
||||
$is_ts = true;
|
||||
}elseif($order['type']==4){ //意向金
|
||||
$receiver_order = $this->receiver_orders_model->get(['id'=>$order['o_id']]);
|
||||
if($receiver_order['deposit'] == $order['total_price']){
|
||||
$is_ts = true;
|
||||
}
|
||||
$this->load->model('app/liche/app_liche_users_model');
|
||||
$pay_user = $this->app_liche_users_model->get(['openid'=>$result['data']['payer']['sub_openid']]);
|
||||
$result = $this->payment_service->after_pay_liche_v2($sid,$result['data']['amount']['payer_total']/100,$pay_user['uid']);
|
||||
if($result['code']){
|
||||
$log = [
|
||||
'money' => $result_data['data']['amount']['payer_total'],
|
||||
'is_ts' => $is_ts
|
||||
];
|
||||
debug_log("[info] ". __FUNCTION__ . ": ".json_encode($log,JSON_UNESCAPED_UNICODE), $this->log_file,$this->log_dir);
|
||||
if($result_data['data']['amount']['payer_total']>=10000 && $is_ts){
|
||||
$robot_res = $this->qyrobot->deposit_notify_v2($order['o_id']);
|
||||
debug_log("[info] ". __FUNCTION__ . ":推送企业微信群 ".json_encode($robot_res,JSON_UNESCAPED_UNICODE), $this->log_file,$this->log_dir);
|
||||
}
|
||||
debug_log("[success] ". __FUNCTION__ . ":操作成功", $this->log_file,$this->log_dir);
|
||||
}else{
|
||||
debug_log("[error] ". __FUNCTION__ . ":".$result['msg'], $this->log_file,$this->log_dir);
|
||||
}
|
||||
if($is_ts && $result_data['data']['amount']['payer_total']>=10000){ //支付定金和意向金推送企业微信群
|
||||
$this->load->library('qyrobot');
|
||||
$robot_res = $this->qyrobot->deposit_notify($order['o_id']);
|
||||
debug_log("[info] ". __FUNCTION__ . ":推送企业微信群 ".json_encode($robot_res,JSON_UNESCAPED_UNICODE), $this->log_file,$this->log_dir);
|
||||
}else{
|
||||
$result = $this->payment_service->after_pay_liche($sid,$result['data']['amount']['payer_total']/100);
|
||||
if($result['code']){
|
||||
$is_ts = false;
|
||||
if($order['type']==1){ //定金
|
||||
$is_ts = true;
|
||||
}elseif($order['type']==4){ //意向金
|
||||
$receiver_order = $this->receiver_orders_model->get(['id'=>$order['o_id']]);
|
||||
if($receiver_order['deposit'] == $order['total_price']){
|
||||
$is_ts = true;
|
||||
}
|
||||
}
|
||||
if($is_ts && $result_data['data']['amount']['payer_total']>=10000){ //支付定金和意向金推送企业微信群
|
||||
$robot_res = $this->qyrobot->deposit_notify($order['o_id']);
|
||||
debug_log("[info] ". __FUNCTION__ . ":推送企业微信群 ".json_encode($robot_res,JSON_UNESCAPED_UNICODE), $this->log_file,$this->log_dir);
|
||||
}
|
||||
debug_log("[success] ". __FUNCTION__ . ":操作成功", $this->log_file,$this->log_dir);
|
||||
}else{
|
||||
debug_log("[error] ". __FUNCTION__ . ":".$result['msg'], $this->log_file,$this->log_dir);
|
||||
}
|
||||
debug_log("[success] ". __FUNCTION__ . ":操作成功", $this->log_file,$this->log_dir);
|
||||
}else{
|
||||
debug_log("[error] ". __FUNCTION__ . ":".$result['msg'], $this->log_file,$this->log_dir);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
debug_log("[finish] ". __FUNCTION__ . ": sid:".$sid, $this->log_file,$this->log_dir);
|
||||
}else{
|
||||
|
||||
@@ -44,6 +44,7 @@ class Cusorder extends Wxapp{
|
||||
$this->load->model('sys/sys_finance_model');
|
||||
|
||||
$this->load->library('receiver/orders_entity');
|
||||
$this->load->library('receiver/orders_v2_entity');
|
||||
$this->load->library('receiver/customers_entity');
|
||||
}
|
||||
|
||||
@@ -561,6 +562,7 @@ class Cusorder extends Wxapp{
|
||||
}
|
||||
//确认交付
|
||||
protected function put_ckcar(){
|
||||
$this->load->library('receiver/orders_status_entity');
|
||||
$id = $this->input_param('id');
|
||||
$remark = $this->input_param('remark');
|
||||
$info = $this->input_param('info');
|
||||
@@ -569,7 +571,34 @@ class Cusorder extends Wxapp{
|
||||
throw new Exception('参数错误', ERR_PARAMS_ERROR);
|
||||
}
|
||||
$row = $this->order_deliverys_model->get(['o_id'=>$id]);
|
||||
if($row['status']>1){
|
||||
if($id>=Orders_v2_entity::V2_START_ID){
|
||||
if(!$row){
|
||||
$row['id'] = $this->order_deliverys_model->add(['o_id'=>$id,'c_time'=>time()]);
|
||||
}
|
||||
$this->load->model('receiver/order/receiver_orders_v2_model');
|
||||
$this->load->model('receiver/order/receiver_order_datas_model');
|
||||
$order_row = $this->receiver_orders_v2_model->get(['id'=>$id]);
|
||||
if(!$order_row['payway'] && !$this->orders_status_entity->get_finish($id,1,2)){
|
||||
throw new Exception('按揭放款尚未确认', ERR_PARAMS_ERROR);
|
||||
}
|
||||
$order_data = $this->receiver_order_datas_model->get(['o_id'=>$id]);
|
||||
if($order_row['main_type']){ //公司
|
||||
if(!$order_data['business_licence']){
|
||||
throw new Exception('请先上传公司营业执照', ERR_PARAMS_ERROR);
|
||||
}
|
||||
}else{ //个人
|
||||
if(!$order_data['cardida'] || !$order_data['cardidb']){
|
||||
throw new Exception('请先上传身份证正反面', ERR_PARAMS_ERROR);
|
||||
}
|
||||
}
|
||||
if(!$order_data['car_img']){
|
||||
throw new Exception('请先上传行驶证', ERR_PARAMS_ERROR);
|
||||
}
|
||||
if(!$order_data['ins_img']){
|
||||
throw new Exception('请先上传保单', ERR_PARAMS_ERROR);
|
||||
}
|
||||
}
|
||||
if($row['status']>1 && $row['o_id']<Orders_v2_entity::V2_START_ID){
|
||||
throw new Exception('当前不可修改', ERR_PARAMS_ERROR);
|
||||
}
|
||||
$update = [
|
||||
@@ -580,6 +609,9 @@ class Cusorder extends Wxapp{
|
||||
];
|
||||
$result = $this->order_deliverys_model->update($update,['id'=>$row['id']]);
|
||||
if($result){
|
||||
if($id>=Orders_v2_entity::V2_START_ID){
|
||||
$this->orders_status_entity->set_status($id,4,1);
|
||||
}
|
||||
throw new Exception('修改成功', API_CODE_SUCCESS);
|
||||
}else{
|
||||
throw new Exception('修改失败', ERR_PARAMS_ERROR);
|
||||
|
||||
@@ -0,0 +1,775 @@
|
||||
<?php
|
||||
defined('WXAPP_APP') OR exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
* Created by Vim
|
||||
* User: lcc
|
||||
* Date: 2021/07/09
|
||||
* Time: 14:08
|
||||
*/
|
||||
require_once APPPATH.'controllers/wxapp/Wxapp.php';
|
||||
class CusorderV2 extends Wxapp{
|
||||
|
||||
private $biz_id = '';
|
||||
|
||||
function __construct($inputs, $app_key){
|
||||
parent::__construct($inputs, $app_key);
|
||||
|
||||
$this->login_white = array();//登录白名单
|
||||
$this->check_status = array();//用户状态校验
|
||||
$this->check_mobile = array();//需要手机号
|
||||
$this->check_headimg =array();//授权微信信息
|
||||
|
||||
$this->load->model('receiver/receiver_customers_model','customers_model');
|
||||
$this->load->model('receiver/order/receiver_orders_model');
|
||||
$this->load->model('receiver/order/receiver_orders_v2_model','orders_model');
|
||||
$this->load->model('receiver/order/receiver_order_datas_model');
|
||||
$this->load->model('receiver/order/receiver_order_status_model');
|
||||
$this->load->model('receiver/order/receiver_order_deliverys_model','order_deliverys_model');
|
||||
$this->load->model('receiver/order/receiver_order_loans_model', 'order_loans_model');
|
||||
|
||||
$this->load->model('auto/auto_series_model');
|
||||
$this->load->model('auto/auto_attr_model');
|
||||
$this->load->model('auto/auto_cars_model');
|
||||
$this->load->model('auto/auto_business_model');
|
||||
|
||||
$this->load->model("biz/biz_model");
|
||||
$this->load->model('sys/sys_finance_model');
|
||||
$this->load->model('sys/sys_city_model');
|
||||
|
||||
$this->load->model('app/liche/app_liche_users_model');
|
||||
$this->load->model('app/liche/app_liche_orders_model');
|
||||
|
||||
$this->load->library('receiver/orders_entity');
|
||||
$this->load->library('receiver/orders_v2_entity');
|
||||
$this->load->library('receiver/customers_entity');
|
||||
$this->load->library('receiver/order_datas_entity');
|
||||
$this->load->library('receiver/orders_status_entity');
|
||||
$this->biz_id = $this->get_biz_id();
|
||||
}
|
||||
|
||||
protected function get(){
|
||||
$id = $this->input_param('id');
|
||||
if($id){
|
||||
return $this->detail($id);
|
||||
}else{
|
||||
return $this->lists();
|
||||
}
|
||||
}
|
||||
|
||||
//创建订单
|
||||
protected function post(){
|
||||
$cus_id = $this->input_param('cus_id');
|
||||
$car_id = $this->input_param('car_id');
|
||||
$color_id = $this->input_param('color_id');
|
||||
$incolor_id = $this->input_param('incolor_id');
|
||||
$v_id = $this->input_param('v_id');
|
||||
$deposit = $this->input_param('deposit');
|
||||
$payway = $this->input_param('payway');
|
||||
$main_type = $this->input_param('main_type');
|
||||
$name = trim($this->input_param('name'));
|
||||
$mobile = trim($this->input_param('mobile'));
|
||||
$cardid = trim($this->input_param('cardid'));
|
||||
$owner_name = trim($this->input_param('owner_name'));
|
||||
$owner_mobile = trim($this->input_param('owner_mobile'));
|
||||
$owner_cardid = trim($this->input_param('owner_cardid'));
|
||||
$company = $this->input_param('company');
|
||||
$c_credit = $this->input_param('credit');
|
||||
$delry_time = $this->input_param('delry_time');
|
||||
$finance_id = $this->input_param('finance_id');
|
||||
$inten_money = floatval($this->input_param('inten_money'));//意向金
|
||||
$disc_money = floatval($this->input_param('disc_money'));//优惠金额
|
||||
$disc_fine_money = floatval($this->input_param('disc_fine_money'));//精品优惠金额
|
||||
$if_fine = $this->input_param('if_fine');
|
||||
$srv_arr = $this->input_param('srv_arr');
|
||||
$fines = $this->input_param('fines');
|
||||
$address = $this->input_param('address');
|
||||
$business_id = $this->input_param('business_id'); //商务政策id
|
||||
|
||||
$row = $this->customers_model->get(['id'=>$cus_id]);
|
||||
$series_row = $this->auto_series_model->get(['id'=>$car_id]);
|
||||
$business_row = $this->auto_business_model->get(['id'=>$business_id]);
|
||||
if(!$row || !$series_row ||!$delry_time || !$name || !$mobile || !$business_row || !$deposit){
|
||||
throw new Exception('参数错误', ERR_PARAMS_ERROR);
|
||||
}
|
||||
if($main_type){//公司
|
||||
if(!$company || !$c_credit){
|
||||
throw new Exception('请填写公司信息', ERR_PARAMS_ERROR);
|
||||
}
|
||||
}else{ //个人
|
||||
if(!$cardid || !$owner_name || !$owner_mobile || !$owner_cardid){
|
||||
throw new Exception('参数错误', ERR_PARAMS_ERROR);
|
||||
}
|
||||
}
|
||||
if($deposit<2000){
|
||||
throw new Exception('定金不得少于2000', ERR_PARAMS_ERROR);
|
||||
}
|
||||
if($inten_money > $deposit){
|
||||
throw new Exception('意向金不得高于定金', ERR_PARAMS_ERROR);
|
||||
}
|
||||
$biz = $this->biz_model->get(['id'=>$row['biz_id']],'city_id,type');
|
||||
|
||||
$car_row = $this->auto_cars_model->get(['brand_id'=>$series_row['brand_id'],'s_id'=>$series_row['id'],'v_id'=>$v_id],'',$biz['city_id']);
|
||||
if(!$car_row){
|
||||
throw new Exception('参数错误', API_CODE_FAIL);
|
||||
}
|
||||
$can_dis_money = $business_row['price_car'] - $business_row['price_floor']; //可优惠金额
|
||||
if($can_dis_money>0){
|
||||
if($disc_money && $business_row['price_floor'] > $business_row['price_car']-$disc_money){
|
||||
throw new Exception('车辆售价不得低于车辆底价,请重新填写优惠信息', API_CODE_FAIL);
|
||||
}
|
||||
}else{
|
||||
if($disc_money) throw new Exception('当前车型没有优惠额度', API_CODE_FAIL);
|
||||
}
|
||||
if(!$payway && $finance_id){ //分期
|
||||
$finance_row = $this->sys_finance_model->get(['id'=>$finance_id,'status'=>1]);
|
||||
if(!$finance_row){
|
||||
throw new Exception('参数错误', ERR_PARAMS_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
$data = [
|
||||
'clue_id' => $cus_id,
|
||||
'sid' => create_order_no(350200,$this->app_key),
|
||||
'customer_id' => $row['id'],
|
||||
'name' => $name ? $name : $row['name'],
|
||||
'mobile' => $mobile ? $mobile : $row['mobile'],
|
||||
'biz_id' => $this->biz_id,
|
||||
'brand_id' => $series_row['brand_id'],
|
||||
's_id' => $series_row['id'],
|
||||
'v_id' => $v_id,
|
||||
'cor_id' => $color_id,
|
||||
'incor_id' => $incolor_id,
|
||||
'sale_id' => $this->session['uid'],
|
||||
'c_time' => time()
|
||||
];
|
||||
$owner_name && $data['owner_name'] = $owner_name;
|
||||
$owner_mobile && $data['owner_mobile'] = $owner_mobile;
|
||||
$row['rid'] && $data['clue_id'] = $row['rid'];
|
||||
$payway && $data['payway'] = 1;
|
||||
$if_fine && $data['if_fine'] = 1;
|
||||
$main_type && $data['main_type'] = 1;
|
||||
$delry_time && $data['delry_time'] = $delry_time;
|
||||
$fines && $data['fines'] = json_encode($fines,JSON_UNESCAPED_UNICODE);
|
||||
$info_json = [];
|
||||
$address && $info_json['c_address'] = $address;
|
||||
$cardid && $info_json['c_cardid'] = $cardid;
|
||||
$owner_cardid && $info_json['c_owner_cardid'] = $owner_cardid;
|
||||
$c_credit && $info_json['c_credit'] = $c_credit;
|
||||
$company && $info_json['c_company'] = $company;
|
||||
$business_id && $info_json['business_id'] = $business_id;
|
||||
$info_json && $data['info_json'] = json_encode($info_json,JSON_UNESCAPED_UNICODE);
|
||||
$finance_row && $data['finance_id'] = $finance_row['id'];
|
||||
|
||||
//获取金额json数据
|
||||
$orders_entity = new orders_v2_entity();
|
||||
$color_arr = json_decode($business_row['colors'],true);
|
||||
$price_color = in_array($color_id,$color_arr) ? $business_row['price_color'] : 0;
|
||||
$price_coplus = $main_type ? $business_row['price_coplus'] : 0;
|
||||
|
||||
$money_json = [
|
||||
'price_car' => $business_row['price_car'],
|
||||
'price_book' => $deposit ? $deposit : 0,
|
||||
'price_insure' => $car_row['price_insure'],
|
||||
'price_fine' => $car_row['price_fine'],
|
||||
'price_discount' =>$disc_money ? $disc_money : 0,
|
||||
'price_intention' => $inten_money ? $inten_money : 0,
|
||||
'price_finance' => $series_row['brand_id'] == 4 ? $orders_entity::PRICE_FINANCE_NZ : $orders_entity::PRICE_FINANCE,
|
||||
'price_fine_discount' => $disc_fine_money ? $disc_fine_money : 0,
|
||||
'price_fine_select' => 0,
|
||||
'price_color' => $price_color,
|
||||
'price_coplus' => $price_coplus,
|
||||
];
|
||||
if($srv_arr){
|
||||
foreach ($srv_arr as $item) {
|
||||
$money_json[$item['key']] = $item['price'];
|
||||
$item['id'] == 1 && $data['if_insure'] = 1;
|
||||
$item['id'] == 2 && $data['if_num'] = 1;
|
||||
}
|
||||
}
|
||||
$data['srv_ids'] = $srv_arr ? json_encode($srv_arr,JSON_UNESCAPED_UNICODE) : "";
|
||||
if($fines){
|
||||
foreach ($fines as $item) {
|
||||
if($item['price']){
|
||||
$money_json['price_fine_select'] += $item['price'];
|
||||
}
|
||||
}
|
||||
}
|
||||
$data['car_json'] = $data['money_json'] = json_encode($money_json,JSON_UNESCAPED_UNICODE);
|
||||
$o_id = $this->orders_model->add($data);
|
||||
if($o_id){
|
||||
//意向金订单
|
||||
$userinfo = $this->app_liche_users_model->get(['mobile'=>$mobile],'id');
|
||||
if($inten_money){
|
||||
$this->orders_v2_entity->c_intention($o_id,$userinfo['id'],$inten_money);
|
||||
}
|
||||
$this->orders_v2_entity->add_book_order($o_id,$userinfo['id']);
|
||||
if($payway){ //全款服务费和尾款订单
|
||||
$this->orders_v2_entity->add_order($o_id,$userinfo['id']);
|
||||
}
|
||||
//更新客户下单时间
|
||||
$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'], "新增订单");
|
||||
|
||||
return ['id'=>$o_id,'admin_img' => $orders_entity::API_ADMIN_IMG,'pay_img'=>$orders_entity::API_CREATE_PAY_IMG];
|
||||
}else{
|
||||
throw new Exception('创建失败', ERR_PARAMS_ERROR);
|
||||
}
|
||||
}
|
||||
//创建意向金订单
|
||||
protected function post_inten(){
|
||||
$cus_id = $this->input_param('cus_id');
|
||||
$name = $this->input_param('name');
|
||||
$mobile = $this->input_param('mobile');
|
||||
$cardid = $this->input_param('cardid');
|
||||
$owner_name = $this->input_param('owner_name');
|
||||
$owner_mobile = $this->input_param('owner_mobile');
|
||||
$owner_cardid = $this->input_param('owner_cardid');
|
||||
$main_type = $this->input_param('main_type');
|
||||
$company = $this->input_param('company');
|
||||
$c_credit = $this->input_param('credit');
|
||||
|
||||
$inten_money = floatval($this->input_param('inten_money'));//意向金
|
||||
|
||||
if(!$name || !$mobile|| !$inten_money){
|
||||
throw new Exception('参数错误', ERR_PARAMS_ERROR);
|
||||
}
|
||||
if($main_type){
|
||||
if(!$company || !$c_credit){
|
||||
throw new Exception('请填写公司信息', ERR_PARAMS_ERROR);
|
||||
}
|
||||
}else{
|
||||
if( !$cardid || !$owner_name || !$owner_mobile || !$owner_cardid){
|
||||
throw new Exception('参数错误', ERR_PARAMS_ERROR);
|
||||
}
|
||||
}
|
||||
$row = $this->customers_model->get(['id'=>$cus_id]);
|
||||
if($inten_money > 2000){
|
||||
throw new Exception('意向金不得高于2000', ERR_PARAMS_ERROR);
|
||||
}
|
||||
$data = [
|
||||
'customer_id' => $cus_id,
|
||||
'sid' => create_order_no(350200,$this->app_key),
|
||||
'name' => $name ? $name : $row['name'],
|
||||
'mobile' => $mobile ? $mobile : $row['mobile'],
|
||||
'biz_id' => $this->biz_id,
|
||||
'sale_id' => $this->session['uid'],
|
||||
'c_time' => time()
|
||||
];
|
||||
$main_type && $data['main_type'] = 1;
|
||||
$owner_name && $data['owner_name'] = $owner_name;
|
||||
$owner_mobile && $data['owner_mobile'] = $owner_mobile;
|
||||
$info_json = [];
|
||||
$cardid && $info_json['c_cardid'] = $cardid;
|
||||
$owner_cardid && $info_json['c_owner_cardid'] = $owner_cardid;
|
||||
$company && $info_json['c_company'] = $company;
|
||||
$c_credit && $info_json['c_credit'] = $c_credit;
|
||||
$info_json && $data['info_json'] = json_encode($info_json,JSON_UNESCAPED_UNICODE);
|
||||
//获取挂牌价
|
||||
$biz = $this->biz_model->get(['id'=>$row['biz_id']],'city_id');
|
||||
|
||||
$city = $this->sys_city_model->get(['city_id'=>$biz['city_id']],'fee_carno');
|
||||
$money_json['fee_carno'] = $city['fee_carno'];
|
||||
$money_json['price_intention'] = $inten_money ? $inten_money : 0;
|
||||
$data['money_json'] = json_encode($money_json,JSON_UNESCAPED_UNICODE);
|
||||
|
||||
$row['rid'] && $data['clue_id'] = $row['rid'];
|
||||
$o_id = $this->orders_model->add($data);
|
||||
if(!$o_id){
|
||||
throw new Exception('创建失败', ERR_PARAMS_ERROR);
|
||||
}
|
||||
|
||||
//更新客户下单时间
|
||||
$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'], "新增订单");
|
||||
|
||||
//意向金订单
|
||||
$orders_entity = new orders_v2_entity();
|
||||
if($inten_money){
|
||||
$userinfo = $this->app_liche_users_model->get(['mobile'=>$data['mobile']],'id');
|
||||
$orders_entity->c_intention($o_id,$userinfo['id'],$inten_money);
|
||||
}
|
||||
return ['id'=>$o_id,'admin_img' => $orders_entity::API_ADMIN_IMG,'pay_img'=>$orders_entity::API_CREATE_PAY_IMG];
|
||||
}
|
||||
|
||||
//修改订单信息
|
||||
protected function put(){
|
||||
$id = $this->input_param('id');
|
||||
$car_id = $this->input_param('car_id');
|
||||
$color_id = $this->input_param('color_id');
|
||||
$incolor_id = $this->input_param('incolor_id');
|
||||
$v_id = $this->input_param('v_id');
|
||||
$payway = $this->input_param('payway');
|
||||
$main_type = $this->input_param('main_type');
|
||||
$delry_time = $this->input_param('delry_time');
|
||||
$finance_id = $this->input_param('finance_id');
|
||||
$deposit = $this->input_param('deposit');
|
||||
$disc_money = floatval($this->input_param('disc_money'));//优惠金额
|
||||
$disc_fine_money = floatval($this->input_param('disc_fine_money'));//精品优惠金额
|
||||
$if_fine = $this->input_param('if_fine');
|
||||
$srv_arr = $this->input_param('srv_arr');
|
||||
$fines = $this->input_param('fines');
|
||||
$business_id = $this->input_param('business_id'); //商务政策id
|
||||
|
||||
$row = $this->orders_model->get(['id'=>$id]);
|
||||
$series_row = $this->auto_series_model->get(['id'=>$car_id]);
|
||||
$biz = $this->biz_model->get(['id'=>$row['biz_id']],'type,city_id');
|
||||
$car_row = $this->auto_cars_model->get(['brand_id'=>$series_row['brand_id'],'s_id'=>$series_row['id'],'v_id'=>$v_id],'',$biz['city_id']);
|
||||
$business_row = $this->auto_business_model->get(['id'=>$business_id]);
|
||||
if(!$row || !$series_row || !$car_row || !$business_row){
|
||||
throw new Exception('参数错误', ERR_PARAMS_ERROR);
|
||||
}
|
||||
if($deposit<2000){
|
||||
throw new Exception('定金不得少于2000', ERR_PARAMS_ERROR);
|
||||
}
|
||||
$can_dis_money = $car_row['price_car'] - $car_row['price_floor']; //可优惠金额
|
||||
if($can_dis_money>0){
|
||||
if($disc_money && $car_row['price_floor'] > $car_row['price_car']-$disc_money){
|
||||
throw new Exception('车辆售价不得低于车辆底价,请重新填写优惠信息', API_CODE_FAIL);
|
||||
}
|
||||
}else{
|
||||
if($disc_money) throw new Exception('当前车型没有优惠额度', API_CODE_FAIL);
|
||||
}
|
||||
if(!$payway && $finance_id){ //分期
|
||||
$finance_row = $this->sys_finance_model->get(['id'=>$finance_id,'status'=>1]);
|
||||
if(!$finance_row){
|
||||
throw new Exception('参数错误', ERR_PARAMS_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
$data = [
|
||||
'brand_id' => $series_row['brand_id'],
|
||||
's_id' => $series_row['id'],
|
||||
'v_id' => $v_id,
|
||||
'cor_id' => $color_id,
|
||||
'incor_id' => $incolor_id,
|
||||
'payway' => $payway ? 1 : 0,
|
||||
'srv_ids' => json_encode($srv_arr,JSON_UNESCAPED_UNICODE),
|
||||
'if_insure' => 0,
|
||||
'if_num' => 0
|
||||
];
|
||||
$main_type && $data['main_type'] = 1;
|
||||
$delry_time && $data['delry_time'] = $delry_time;
|
||||
$finance_row && $data['finance_id'] = $finance_row['id'];
|
||||
$data['if_fine'] = $if_fine ? 1:0;
|
||||
$fines && $data['fines'] = json_encode($fines,JSON_UNESCAPED_UNICODE);
|
||||
|
||||
$color_arr = json_decode($business_row['colors'],true);
|
||||
//获取金额json数据
|
||||
$money_json = json_decode($row['money_json'],true);
|
||||
$data['car_json'] = json_encode($money_json,JSON_UNESCAPED_UNICODE);
|
||||
$money_json['price_car'] = $car_row['price_car'];
|
||||
$money_json['price_book'] = $deposit;
|
||||
$money_json['price_insure'] = $car_row['price_insure'];
|
||||
$money_json['price_fine'] = $car_row['price_fine'];
|
||||
$money_json['price_discount'] = $disc_money;
|
||||
$money_json['price_fine_discount'] = $disc_fine_money;
|
||||
$money_json['price_finance'] = $series_row['brand_id'] == 4 ? Orders_v2_entity::PRICE_FINANCE_NZ : Orders_v2_entity::PRICE_FINANCE;
|
||||
$money_json['price_color'] = in_array($color_id,$color_arr) ? $business_row['price_color'] : 0;
|
||||
$money_json['price_coplus'] = $main_type ? $business_row['price_coplus'] : 0;
|
||||
//获取挂牌价
|
||||
if($srv_arr){
|
||||
foreach ($srv_arr as $item) {
|
||||
$money_json[$item['key']] = $item['price'];
|
||||
$item['id'] == 1 && $data['if_insure'] = 1;
|
||||
$item['id'] == 2 && $data['if_num'] = 1;
|
||||
}
|
||||
}
|
||||
$data['srv_ids'] = $srv_arr ? json_encode($srv_arr,JSON_UNESCAPED_UNICODE) : "";
|
||||
if($fines){
|
||||
$money_json['price_fine_select'] = 0;
|
||||
foreach ($fines as $item) {
|
||||
if($item['price']){
|
||||
$money_json['price_fine_select'] += $item['price'];
|
||||
}
|
||||
}
|
||||
}
|
||||
$data['money_json'] = json_encode($money_json,JSON_UNESCAPED_UNICODE);
|
||||
$info_json = json_decode($row['info_json'],true);
|
||||
$info_json['business_id'] = $business_id;
|
||||
$data['info_json'] = json_encode($info_json,JSON_UNESCAPED_UNICODE);
|
||||
$result = $this->orders_model->update($data,['id'=>$row['id']]);
|
||||
if($result){
|
||||
$this->orders_v2_entity->edit_order($data,$row);
|
||||
throw new Exception('修改成功', API_CODE_SUCCESS);
|
||||
}else{
|
||||
throw new Exception('修改失败', ERR_PARAMS_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
private function detail($id){
|
||||
$row = $this->orders_model->get(['id'=>$id]);
|
||||
if(!$row){
|
||||
throw new Exception('订单不存在', ERR_PARAMS_ERROR);
|
||||
}
|
||||
$orders_entity = new Orders_v2_entity();
|
||||
|
||||
$money_json = json_decode($row['money_json'],true);
|
||||
$info_json = json_decode($row['info_json'],true);
|
||||
|
||||
$brand = $this->auto_brand_model->get(['id'=>$row['brand_id']],'name');
|
||||
$series = $this->auto_series_model->get(['id'=>$row['s_id']],'name');
|
||||
$color = $this->auto_attr_model->get(['id'=>$row['cor_id']],'title');
|
||||
$version = $this->auto_attr_model->get(['id'=>$row['v_id']],'title');
|
||||
$color = $color ? $color['title'] : '';
|
||||
$version = $version ? $version['title'] : '';
|
||||
|
||||
$car_data = [];
|
||||
if($row['brand_id'] && $row['s_id'] && $row['v_id']){
|
||||
$car_data['车辆名称'] = $brand['name'].$series['name'];
|
||||
$car_data['车辆名称'] = $brand['name'].$series['name'];
|
||||
$car_data['车辆级别'] = $version;
|
||||
$car_data['车身颜色'] = $color;
|
||||
$car_data['平台售价'] = $money_json['price_car'];
|
||||
$money_json['price_coplus'] && $car_data['公司加价'] = $money_json['price_coplus'];
|
||||
$money_json['price_color'] && $car_data['颜色加价'] = $money_json['price_color'];
|
||||
$car_data['定金'] = $money_json['price_book'];
|
||||
$car_price_list = [];
|
||||
$money_json['price_discount'] && $car_price_list['优惠'] = $money_json['price_discount'];
|
||||
$car_data['最终售价'] =[
|
||||
'list' => $car_price_list,
|
||||
'value' => $orders_entity->total_price($row['id'])
|
||||
];
|
||||
//服务费
|
||||
$srv_data = $orders_entity->order_srv_money($row['id'],1);
|
||||
if($srv_data['total']>0){
|
||||
$car_data['委托代办']['value'] = $srv_data['total'];
|
||||
foreach($srv_data['list'] as $val){
|
||||
$car_data['委托代办']['list'][$val['title']] = $val['money'];
|
||||
}
|
||||
if($row['fines']){
|
||||
$fines = json_decode($row['fines'],true);
|
||||
$fines_list = [];
|
||||
foreach ($fines as $item) {
|
||||
$fines_list['list'][$item['txt']] = $item['price'];
|
||||
}
|
||||
$fines_list['value'] = $money_json['price_fine_select'] ? $money_json['price_fine_select'] : 0.00;
|
||||
$car_data['委托代办']['list']['精品选装'] = $fines_list;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(!$row['payway'] && $row['brand_id']){
|
||||
$finance_row = $this->sys_finance_model->get(['id'=>$row['finance_id']],'title');
|
||||
$car_data['按揭信息'] = $finance_row['title'] ? $finance_row['title']: '';
|
||||
}
|
||||
//是否存在意向金订单
|
||||
$inten_row = $this->app_liche_orders_model->get(['o_id'=>$row['id'],'type'=>4,'status>='=>0]);
|
||||
$pay_status = 0;
|
||||
$inten_money = 0;
|
||||
if($inten_row && $inten_row['status']==0){
|
||||
$pay_status = 1;
|
||||
}
|
||||
if($inten_row['status']==1){//已支付意向金
|
||||
$inten_money = floatval($inten_row['total_price']);
|
||||
}
|
||||
|
||||
$data = [
|
||||
'id' => $id,
|
||||
'name' => $row['name'],
|
||||
'mobile' => mobile_asterisk($row['mobile']),
|
||||
'admin_img' => $orders_entity::API_ADMIN_IMG,
|
||||
'payway' => $row['brand_id'] ? $row['payway'] : '',
|
||||
'car_data' => $car_data,
|
||||
'pay_status' => $pay_status,
|
||||
'pay_img' => $orders_entity::API_PAY_IMG,
|
||||
'pack_id' => $row['pack_id'],
|
||||
'brand_id' => $row['brand_id'],
|
||||
'car_id' => $row['s_id'],
|
||||
'v_id' => $row['v_id'],
|
||||
'color_id' => $row['cor_id'],
|
||||
'incolor_id' => $row['incor_id'],
|
||||
'delry_time' => $row['delry_time']!='0000-00-00 00:00:00' ? date('Y-m-d',strtotime($row['delry_time'])):'',
|
||||
'finance_id' => !$row['payway'] ? $row['finance_id'] : '',
|
||||
'deposit' => $money_json['price_book'] ? $money_json['price_book'] : 0,
|
||||
'disc_money' => $money_json['price_discount'] ? $money_json['price_discount'] : '',
|
||||
'disc_fine_money' => $money_json['price_fine_discount'] ? $money_json['price_fine_discount'] : 0,
|
||||
'srv_arr' => $row['srv_ids'] ? json_decode($row['srv_ids'],true) : [],
|
||||
'cus_id' => $row['customer_id'],
|
||||
'status' => $row['status'],
|
||||
'my_img' => $orders_entity::API_CREATE_PAY_IMG,
|
||||
'if_fine' => $row['if_fine'] ? 1 : 0,
|
||||
'main_type' => intval($row['main_type']),
|
||||
'fines' => $row['fines'] ? json_decode($row['fines'],true) : [],
|
||||
'address' => $info_json['c_address'] ? $info_json['c_address'] : ''
|
||||
];
|
||||
if($row['main_type']){
|
||||
$info_json['c_credit'] && $data['credit'] = $info_json['c_credit'];
|
||||
$info_json['c_company'] && $data['company'] = $info_json['c_company'];
|
||||
}else{
|
||||
$data['owner_name'] = $row['owner_name'];
|
||||
$data['owner_mobile'] = $row['owner_mobile'];
|
||||
$data['owner_cardid'] = $info_json['c_owner_cardid'];
|
||||
}
|
||||
$data['cardid'] = $info_json['c_cardid'];
|
||||
$inten_money && $data['inten_money'] = $inten_money;
|
||||
//选择随车物品
|
||||
$ckcar_status = 0;
|
||||
if($this->receiver_order_status_model->count(['o_id'=>$row['id'],'pid_status'=>3,'status'=>1]) && !$this->receiver_order_status_model->count(['o_id'=>$row['id'],'pid_status'=>4,'status'=>1])){
|
||||
$ckcar_status = 1;
|
||||
}
|
||||
$delivery = $this->order_deliverys_model->get(['o_id'=>$row['id']],'status,info,tool,remark');
|
||||
$ckcar_data = [
|
||||
'info' => $delivery['info'] ? explode(',',$delivery['info']) : [],
|
||||
'tool' => $delivery['tool'] ? explode(',',$delivery['tool']) : [],
|
||||
'remark' => $delivery['remark'] ? $delivery['remark'] : ''
|
||||
];
|
||||
$data['ckcar_status'] = $ckcar_status;
|
||||
$data['ckcar_data'] = $ckcar_data;
|
||||
$price_book = $this->app_liche_orders_model->count(['o_id'=>$row['id'],'type'=>1,'status'=>1]); //定金是否支付
|
||||
$data['price_book_status'] = $price_book ? true : false;
|
||||
$price_srv = $this->app_liche_orders_model->count(['o_id'=>$row['id'],'type'=>2,'status'=>1]); //服务费是否支付
|
||||
$data['price_srv_status'] = $price_srv ? true : false;
|
||||
$price_last = $this->app_liche_orders_model->count(['o_id'=>$row['id'],'type'=>3,'status'=>1]); //尾款是否支付
|
||||
$data['price_last_status'] = $price_last ? true : false;
|
||||
$data['edit_status'] = $price_last ? 0 : 1;
|
||||
$data['loan_status'] = true;
|
||||
|
||||
$loan_row = $this->order_loans_model->get(['o_id'=>$row['id']]);
|
||||
$data['notify_file'] = [
|
||||
'src' => $loan_row['notify_file'] ? build_qiniu_image_url($loan_row['notify_file']) : '',
|
||||
'value' => $loan_row['notify_file'] ? $loan_row['notify_file'] : ''
|
||||
];
|
||||
$data['lend_file'] = [
|
||||
'src' => $loan_row['lend_file'] ? build_qiniu_image_url($loan_row['lend_file']) : '',
|
||||
'value' => $loan_row['lend_file'] ? $loan_row['lend_file'] : ''
|
||||
];
|
||||
$data['price_loan'] = $money_json['price_loan'] ? $money_json['price_loan'] : 0.00;
|
||||
return $data;
|
||||
}
|
||||
|
||||
private function lists(){
|
||||
$group_id = $this->session['group_id'];
|
||||
$uid = $this->session['uid'];
|
||||
$keyword = $this->input_param('keyword');
|
||||
$status = $this->input_param('status');
|
||||
$page = $this->input_param('page');
|
||||
$size = $this->input_param('size');
|
||||
|
||||
!$page && $page = 1;
|
||||
!$size && $size = 10;
|
||||
|
||||
$where = [
|
||||
'status>=' => 0,
|
||||
'biz_id' => $this->biz_id,
|
||||
];
|
||||
|
||||
$group_id == 1 && $where['sale_id'] = $uid;//销售
|
||||
if($group_id == 4 && $this->biz_id!=1){
|
||||
$where['brand_id!='] = 3; //渠道经理过滤
|
||||
}
|
||||
|
||||
if($keyword){
|
||||
$where["(name='{$keyword}' or mobile='{$keyword}')"] = null;
|
||||
}
|
||||
if($status == 11 ){ //进行中
|
||||
$where['status'] = 0;
|
||||
}elseif($status == 12 ){ //已完成
|
||||
$where['status'] = 1;
|
||||
}else{
|
||||
strlen($status) && $where['status'] = $status;
|
||||
}
|
||||
$fileds = 'id,name,mobile,brand_id,s_id,v_id,cor_id,incor_id,payway,status,c_time,money_json,if_num';
|
||||
$count = $this->orders_model->count($where);
|
||||
$lists = [];
|
||||
if($count){
|
||||
$rows = $this->orders_model->select($where,'id desc',$page,$size,$fileds);
|
||||
//品牌车型
|
||||
$brand_arr = array_unique(array_column($rows,'brand_id'));
|
||||
$brands = $this->auto_brand_model->get_map_by_ids($brand_arr,'id,name');
|
||||
//车系车型
|
||||
$series_arr = array_unique(array_column($rows,'s_id'));
|
||||
$series = $this->auto_series_model->get_map_by_ids($series_arr,'id,name');
|
||||
|
||||
//获取车辆属性
|
||||
$version_arr = array_unique(array_column($rows,'v_id'));
|
||||
$color_arr = array_unique(array_column($rows,'cor_id'));
|
||||
$attrs_arr = array_merge($version_arr,$color_arr);
|
||||
$attrs = $this->auto_attr_model->get_map_by_ids($attrs_arr,'id,title');
|
||||
//旧订单数据
|
||||
$old_rows = [];
|
||||
$old_ids = array_unique(array_column($rows,'id'));
|
||||
if($old_ids){
|
||||
$ids_str = implode(',',$old_ids);
|
||||
$where = [
|
||||
"id in ({$ids_str})" => null,
|
||||
];
|
||||
$old_rows = $this->receiver_orders_model->map('id','status',$where,'','','','id,status');
|
||||
}
|
||||
|
||||
//获取订单资料
|
||||
$order_datas = $this->receiver_order_datas_model->get_map_by_oids(array_column($rows,'id'),'id,o_id,cardida,business_licence,car_img,register_img,ins_img,other_img');
|
||||
$status_arr = $this->orders_model->get_status();
|
||||
$old_status_arr = $this->receiver_orders_model->get_status();
|
||||
foreach($rows as $key=>$val){
|
||||
if($val['id']>=Orders_v2_entity::V2_START_ID){
|
||||
$money_json = json_decode($val['money_json'],true);
|
||||
if($val['brand_id']){ //已选择车型
|
||||
$brand_name = isset($brands[$val['brand_id']]) ? $brands[$val['brand_id']][0]['name'] : '';
|
||||
$serie_name = isset($series[$val['s_id']]) ? $series[$val['s_id']][0]['name'] : '';
|
||||
$color = isset($attrs[$val['cor_id']]) ? $attrs[$val['cor_id']][0]['title'] : '';
|
||||
$version = isset($attrs[$val['v_id']]) ? $attrs[$val['v_id']][0]['title'] : '';
|
||||
$title = "{$brand_name}{$serie_name}-{$color}-{$version}";
|
||||
|
||||
$img_status = $this->order_datas_entity->data_status($order_datas[$val['id']][0]);
|
||||
$ck_user_status = $this->receiver_order_status_model->count(['o_id'=>$val['id'],'pid_status'=>4,'status'=>2]); //用户已确认
|
||||
$ck_admin_status = $this->receiver_order_status_model->count(['o_id'=>$val['id'],'pid_status'=>4,'status'=>1]); //顾问确认已确认
|
||||
$ck_status = [
|
||||
['value'=>'顾问确认','selected'=>$ck_admin_status?true:false],
|
||||
['value'=>'用户确认','selected'=>$ck_user_status?true:false]
|
||||
];
|
||||
|
||||
$other_data = [
|
||||
'品牌车型' => ['type'=> 'text','value'=>$title,'bg_color'=>''],
|
||||
'付款方式' => ['type'=> 'text','value'=>$val['payway']?'全款':'分期','bg_color'=>''],
|
||||
];
|
||||
$book_is_pay = $this->app_liche_orders_model->get(['o_id'=>$val['id'],'type'=>1]); //定金
|
||||
$p_row = $this->app_liche_orders_model->get(['o_id'=>$val['id'],'pid'=>0],'id'); //父订单
|
||||
$last_row = $this->app_liche_orders_model->get(['o_id'=>$val['id'],'pid'=>$p_row['id'],'type'=>3],'id'); //尾款订单
|
||||
//除去尾款已支付金额
|
||||
$total_pay = $this->app_liche_orders_model->sum('total_price',['pid'=>$p_row['id'],'o_id'=>$val['id'],'status'=>1,'id!='=>$last_row['id']]);
|
||||
//已支付尾款
|
||||
$last_pay = $this->app_liche_orders_model->sum('total_price',['pid'=>$last_row['id'],'status'=>1]);
|
||||
$is_pay_price = $total_pay['total_price'] + $last_pay['total_price'];
|
||||
$need_pay = $this->orders_v2_entity->recevable_price($val['id'],false); //需要支付车款
|
||||
$need_last_pay = $need_pay - $money_json['price_book'];
|
||||
if($book_is_pay){
|
||||
$book_is_pay_text = $book_is_pay['status'] ? '已支付':'未支付';
|
||||
$price_book_text = $money_json['price_book']."($book_is_pay_text)";
|
||||
$other_data['定金金额'] = ['type'=> 'text','value'=>$price_book_text,'bg_color'=>''];
|
||||
}
|
||||
$last_is_pay_text = $is_pay_price == $need_pay ? '已支付':'未支付';
|
||||
$last_text = $need_last_pay."($last_is_pay_text)";
|
||||
$other_data['尾款金额'] = ['type'=> 'text','value'=>$last_text,'bg_color'=>''];
|
||||
|
||||
if($book_is_pay['status'] || $this->app_liche_orders_model->count(['o_id'=>$val['id'],'type'=>6,'status'=>1])){
|
||||
if(!$val['payway']){
|
||||
$other_data['分期办理'] = ['type'=> 'text','value'=>$this->orders_status_entity->status_cn($val['id'],1),'bg_color'=>''];
|
||||
}
|
||||
$other_data['车辆分配'] = ['type'=> 'text','value'=>$this->orders_status_entity->status_cn($val['id'],2),'bg_color'=>''];
|
||||
$other_data['发票'] = ['type'=> 'text','value'=>$this->orders_status_entity->status_cn($val['id'],3),'bg_color'=>''];
|
||||
$other_data['身份证'] = ['type'=> 'text','value'=>$img_status['cardida']['text'],'bg_color'=>$img_status['cardida']['color']];
|
||||
$other_data['登记证'] = ['type'=> 'text','value'=>$img_status['register_img']['text'],'bg_color'=>$img_status['register_img']['color']];
|
||||
$other_data['行驶证'] = ['type'=> 'text','value'=>$img_status['car_img']['text'],'bg_color'=>$img_status['car_img']['color']];
|
||||
$other_data['保单'] = ['type'=> 'text','value'=>$img_status['ins_img']['text'],'bg_color'=>$img_status['ins_img']['color']];
|
||||
$other_data['交车合照'] = ['type'=> 'text','value'=>$img_status['other_img']['text'],'bg_color'=>$img_status['other_img']['color']];
|
||||
$other_data['交付'] = ['type'=> 'checkbox','value'=>'','lists' => $ck_status,'bg_color'=>''];
|
||||
}
|
||||
$other_data['订单日期'] = ['type'=> 'text','value'=>date('Y-m-d',$val['c_time']),'bg_color'=>''];
|
||||
}else{
|
||||
$price_intention = $money_json['price_intention'] ? $money_json['price_intention'] : '';
|
||||
$other_data = [
|
||||
'意向金' => ['type'=> 'text','value'=> $price_intention,'bg_color'=>''],
|
||||
'订单日期' => ['type'=> 'text','value'=>date('Y-m-d',$val['c_time']),'bg_color'=>''],
|
||||
];
|
||||
}
|
||||
$lists[] = [
|
||||
'id' => $val['id'],
|
||||
'name' => $val['name'],
|
||||
'mobile' => mobile_asterisk($val['mobile']),
|
||||
'status_name' => $status_arr[$val['status']],
|
||||
'other_data' => $other_data,
|
||||
];
|
||||
}else{//旧订单
|
||||
$status = $old_rows[$val['id']] ? $old_rows[$val['id']] : 0;
|
||||
$money_json = json_decode($val['money_json'],true);
|
||||
if($val['brand_id']){ //已选择车型
|
||||
$brand_name = isset($brands[$val['brand_id']]) ? $brands[$val['brand_id']][0]['name'] : '';
|
||||
$serie_name = isset($series[$val['s_id']]) ? $series[$val['s_id']][0]['name'] : '';
|
||||
$color = isset($attrs[$val['cor_id']]) ? $attrs[$val['cor_id']][0]['title'] : '';
|
||||
$version = isset($attrs[$val['v_id']]) ? $attrs[$val['v_id']][0]['title'] : '';
|
||||
//是否需要代办
|
||||
$srv_arr = explode(',',$val['srv_ids']);
|
||||
$db_title = in_array(2,$srv_arr) ? '需要' : '';
|
||||
|
||||
$other_data = [
|
||||
'品牌车型' => "{$brand_name}{$serie_name}-{$color}-{$version}",
|
||||
'付款方式' => $val['payway']?'全款':'分期',
|
||||
'代办车牌' => $db_title,
|
||||
'定金金额' => $money_json['price_book'],
|
||||
'订单日期' => date('Y-m-d',$val['c_time']),
|
||||
];
|
||||
}else{
|
||||
$other_data = [
|
||||
'意向金' => $money_json['price_intention'] ? $money_json['price_intention'] : '',
|
||||
'订单日期' => date('Y-m-d',$val['c_time']),
|
||||
];
|
||||
}
|
||||
$lists[] = [
|
||||
'id' => $val['id'],
|
||||
'name' => $val['name'],
|
||||
'mobile' => mobile_asterisk($val['mobile']),
|
||||
'status_name' => $old_status_arr[$status],
|
||||
'other_data' => $other_data,
|
||||
'remark' => $this->orders_entity->get_remark($status)
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
$data = [
|
||||
'list' => $lists,
|
||||
'total' => $count
|
||||
];
|
||||
return $data;
|
||||
}
|
||||
//订单列表头部
|
||||
protected function get_tabs(){
|
||||
$lists = [
|
||||
['key' =>11 ,'name' => '进行中'],
|
||||
['key' =>12 ,'name' => '已完成'],
|
||||
];
|
||||
return $lists;
|
||||
}
|
||||
|
||||
//修改用户基本信息
|
||||
protected function put_info(){
|
||||
$id = $this->input_param('id');
|
||||
$owner_name = trim($this->input_param('owner_name'));
|
||||
$owner_mobile = trim($this->input_param('owner_mobile'));
|
||||
$owner_cardid = trim($this->input_param('owner_cardid'));
|
||||
$company = $this->input_param('company');
|
||||
$c_credit = $this->input_param('credit');
|
||||
$address = $this->input_param('address');
|
||||
|
||||
$row = $this->orders_model->get(['id'=>$id]);
|
||||
if(!$row){
|
||||
throw new Exception('参数错误', ERR_PARAMS_ERROR);
|
||||
}
|
||||
$data = [];
|
||||
$owner_name && $data['owner_name'] = $owner_name;
|
||||
$owner_mobile && $data['owner_mobile'] = $owner_mobile;
|
||||
$info_json = json_decode($row['info_json'],true);
|
||||
$owner_cardid && $info_json['c_owner_cardid'] = $owner_cardid;
|
||||
$c_credit && $info_json['c_credit'] = $c_credit;
|
||||
$company && $info_json['c_company'] = $company;
|
||||
$address && $info_json['c_address'] = $address;
|
||||
$info_json && $data['info_json'] = json_encode($info_json,JSON_UNESCAPED_UNICODE);
|
||||
$result = $this->orders_model->update($data,['id'=>$row['id']]);
|
||||
if($result){
|
||||
if($this->receiver_order_contracts_model->count(['o_id'=>$row['id'],'type in (0,1)'=>null])){
|
||||
$this->receiver_order_contracts_model->delete(['o_id'=>$row['id'],'type in (0,1)'=>null]);
|
||||
}
|
||||
throw new Exception('修改成功', API_CODE_SUCCESS);
|
||||
}else{
|
||||
throw new Exception('修改失败', ERR_PARAMS_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
protected function put_status(){
|
||||
$id = $this->input_param('id');
|
||||
$row = $this->orders_model->get(['id'=>$id]);
|
||||
if(!$row){
|
||||
throw new Exception('订单不存在', ERR_PARAMS_ERROR);
|
||||
}
|
||||
$is_pay = $this->app_liche_orders_model->count(['o_id'=>$row['id'],'status'=>1]);
|
||||
if($is_pay){
|
||||
throw new Exception('修改失败', ERR_PARAMS_ERROR);
|
||||
}
|
||||
$result = $this->orders_model->update(['status'=>-1],['id'=>$row['id']]);
|
||||
if($result){
|
||||
$this->app_liche_orders_model->update(['status'=>-1],['o_id'=>$row['id']]);
|
||||
throw new Exception('修改成功', API_CODE_SUCCESS);
|
||||
}else{
|
||||
throw new Exception('修改失败', ERR_PARAMS_ERROR);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,192 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: lcc
|
||||
* Date: 2022/1/18
|
||||
* Time: 17:13
|
||||
*/
|
||||
require_once APPPATH.'controllers/wxapp/Wxapp.php';
|
||||
class Cusorderdata extends Wxapp{
|
||||
|
||||
function __construct($inputs, $app_key){
|
||||
parent::__construct($inputs, $app_key);
|
||||
|
||||
$this->login_white = array();//登录白名单
|
||||
$this->check_status = array();//用户状态校验
|
||||
$this->check_mobile = array();//需要手机号
|
||||
$this->check_headimg =array();//授权微信信息
|
||||
|
||||
$this->load->model('receiver/order/receiver_orders_v2_model','orders_model');
|
||||
$this->load->model('receiver/order/receiver_order_status_model');
|
||||
$this->load->model('receiver/order/receiver_order_datas_model');
|
||||
|
||||
$this->load->library('receiver/orders_status_entity');
|
||||
$this->load->library('TcOrc');
|
||||
}
|
||||
|
||||
protected function get(){
|
||||
$id = $this->input_param('id');
|
||||
$row = $this->receiver_order_status_model->get(['o_id'=>$id,'status'=>1,'pid_status'=>0]);
|
||||
$data = [];
|
||||
if($row){
|
||||
$data['img_status'] = 1;
|
||||
$row_data = $this->receiver_order_datas_model->get(['o_id'=>$id]);
|
||||
$cardidb = $cardida = $business_licence = $register_img = $car_img = [];
|
||||
if($row_data['car_img']){
|
||||
$car_img = [
|
||||
'value' => $row_data['car_img'],
|
||||
'img' => build_qiniu_image_url($row_data['car_img'])
|
||||
];
|
||||
}
|
||||
if($row_data['register_img']){
|
||||
$register_img = [
|
||||
'value' => $row_data['register_img'],
|
||||
'img' => build_qiniu_image_url($row_data['register_img'])
|
||||
];
|
||||
}
|
||||
$data['imgs'] = [
|
||||
'cardida' => [],
|
||||
'cardidb' => [],
|
||||
'business_licence' => [],
|
||||
'car_img' => $car_img,
|
||||
'register_img' => $register_img,
|
||||
'ins_img' => [],
|
||||
'other_img' => []
|
||||
];
|
||||
|
||||
if($row['main_type']){
|
||||
if($row_data['business_licence']){
|
||||
$business_licence = [
|
||||
'value' => $row_data['business_licence'],
|
||||
'img' => build_qiniu_image_url($row_data['business_licence'])
|
||||
];
|
||||
}
|
||||
$data['imgs']['business_licence'] = $business_licence;
|
||||
}else{
|
||||
if($row_data['cardida']){
|
||||
$cardida = [
|
||||
'value' => $row_data['cardida'],
|
||||
'img' => build_qiniu_image_url($row_data['cardida'])
|
||||
];
|
||||
}
|
||||
if($row_data['cardidb']){
|
||||
$cardidb = [
|
||||
'value' => $row_data['cardidb'],
|
||||
'img' => build_qiniu_image_url($row_data['cardidb'])
|
||||
];
|
||||
}
|
||||
$data['imgs']['cardida'] = $cardida;
|
||||
$data['imgs']['cardidb'] = $cardidb;
|
||||
}
|
||||
if($row_data['ins_img']){
|
||||
$ins_img = json_decode($row_data['ins_img'],true);
|
||||
$imgs = [];
|
||||
foreach ($ins_img as $item) {
|
||||
$imgs[] = [
|
||||
'value' => $item,
|
||||
'img' => build_qiniu_image_url($item)
|
||||
];
|
||||
}
|
||||
$data['imgs']['ins_img'] = $imgs;
|
||||
}
|
||||
if($row_data['other_img']){
|
||||
$other_img = json_decode($row_data['other_img'],true);
|
||||
$imgs = [];
|
||||
foreach ($other_img as $item) {
|
||||
$imgs[] = [
|
||||
'value' => $item,
|
||||
'img' => build_qiniu_image_url($item)
|
||||
];
|
||||
}
|
||||
$data['imgs']['other_img'] = $imgs;
|
||||
}
|
||||
if($row_data['bill_img']){ //开票
|
||||
$imgs = [];
|
||||
$data['imgs']['bill_img'] = $imgs;
|
||||
}
|
||||
}else{
|
||||
$data['img_status'] = 0;
|
||||
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
|
||||
protected function put(){
|
||||
$id = $this->input_param('id');
|
||||
$row = $this->orders_model->get(['id'=>$id]);
|
||||
if(!$row){
|
||||
throw new Exception('参数错误', ERR_PARAMS_ERROR);
|
||||
}
|
||||
if(!$this->receiver_order_datas_model->get(['o_id'=>$id])){
|
||||
$this->receiver_order_datas_model->add(['o_id'=>$id]);
|
||||
}
|
||||
$cardida = $this->input_param('cardida');
|
||||
$cardidb = $this->input_param('cardidb');
|
||||
$car_img = $this->input_param('car_img');
|
||||
$register_img = $this->input_param('register_img');
|
||||
$business_licence = $this->input_param('business_licence');
|
||||
$ins_imgs = $this->input_param('ins_imgs');
|
||||
$other_imgs = $this->input_param('other_imgs');
|
||||
$update = [];
|
||||
if($cardida){
|
||||
$full_cardida = build_qiniu_image_url($cardida);
|
||||
$result = $this->tcorc->IdentityCard($full_cardida);
|
||||
if(!$result['code']){
|
||||
$res_data['code'] = API_CODE_ORC_FAIL;
|
||||
$res_data['data'] = [
|
||||
['caridA' => false,'errmsg'=>$result['msg']],
|
||||
['caridB' => true,'errmsg'=>''],
|
||||
];
|
||||
return $res_data;
|
||||
}
|
||||
$userinfo = $result['data'];
|
||||
|
||||
//校验订单客户和身份证姓名
|
||||
if($userinfo['Name'] != $row['owner_name']){
|
||||
$res_data['code'] = API_CODE_ORC_FAIL;
|
||||
$res_data['data'] = [
|
||||
['caridA' => false,'errmsg'=>'身份证姓名与客户不一致'],
|
||||
['caridB' => true,'errmsg'=>''],
|
||||
];
|
||||
return $res_data;
|
||||
}
|
||||
$update['cardida'] = $cardida;
|
||||
}elseif ($business_licence){
|
||||
$full_business_licence = build_qiniu_image_url($business_licence);
|
||||
$result = $this->tcorc->BizLicense($full_business_licence);
|
||||
if(!$result['code']){
|
||||
$res_data['code'] = API_CODE_ORC_FAIL;
|
||||
$res_data['data'] = [
|
||||
['business_licence' => false,'errmsg'=>$result['msg']],
|
||||
];
|
||||
return $res_data;
|
||||
}
|
||||
$update['business_licence'] = $business_licence;
|
||||
}elseif($ins_imgs || $other_imgs){
|
||||
$file_name = $ins_imgs ? 'ins_img' : 'other_img';
|
||||
$imgs = $ins_imgs ? $ins_imgs : $other_imgs;
|
||||
$update[$file_name] = json_encode($imgs,JSON_UNESCAPED_UNICODE);
|
||||
}else{
|
||||
if($cardidb){
|
||||
$key = 'cardidb';
|
||||
$img = $cardidb;
|
||||
}
|
||||
if($car_img){
|
||||
$key = 'car_img';
|
||||
$img = $car_img;
|
||||
}
|
||||
if($register_img){
|
||||
$key = 'register_img';
|
||||
$img = $register_img;
|
||||
}
|
||||
$key && $update[$key] = $img;
|
||||
}
|
||||
$res = $this->receiver_order_datas_model->update($update,['o_id'=>$id]);
|
||||
if($res){
|
||||
$this->orders_status_entity->set_status($id,0,1);
|
||||
throw new Exception('修改成功', API_CODE_SUCCESS);
|
||||
}else{
|
||||
throw new Exception('修改失败', ERR_PARAMS_ERROR);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -17,89 +17,66 @@ class Loan extends Wxapp{
|
||||
$this->check_status = array();//用户状态校验
|
||||
$this->check_mobile = array();//需要手机号
|
||||
$this->check_headimg =array();//授权微信信息
|
||||
$this->load->model('receiver/order/receiver_order_loans_model','order_loans_model');
|
||||
$this->load->model('receiver/order/receiver_orders_model','orders_model');
|
||||
$this->load->model('auto/auto_cars_model');
|
||||
$this->load->model('app/liche/app_liche_users_model');
|
||||
$this->load->model('app/liche/app_liche_orders_model');
|
||||
|
||||
$this->load->model('receiver/order/receiver_orders_v2_model');
|
||||
$this->load->model('receiver/order/receiver_order_loans_model', 'order_loans_model');
|
||||
|
||||
$this->load->library('receiver/orders_v2_entity');
|
||||
$this->load->library('receiver/orders_status_entity');
|
||||
}
|
||||
|
||||
protected function get(){
|
||||
$oid = $this->input_param('oid');
|
||||
|
||||
$row = $this->orders_model->get(['id'=>$oid]);
|
||||
$where_car = array(
|
||||
's_id'=>$row['s_id'],
|
||||
'v_id' => $row['v_id'],
|
||||
);
|
||||
$car = $this->auto_cars_model->get($where_car,'first_pay');
|
||||
$money = $car['first_pay'] ? $car['first_pay'] * 36 : 0;
|
||||
$banks = [
|
||||
'易鑫金融'
|
||||
];
|
||||
$years = [
|
||||
36
|
||||
];
|
||||
$data = [
|
||||
'banks' => $banks,
|
||||
'years' => $years,
|
||||
'first_price' => $money
|
||||
];
|
||||
return $data;
|
||||
}
|
||||
|
||||
protected function post(){
|
||||
$oid = $this->input_param('oid');
|
||||
$bank = $this->input_param('bank');
|
||||
$year = $this->input_param('year');
|
||||
$money = $this->input_param('money');
|
||||
$loan = $this->order_loans_model->count(['o_id'=>$oid]);
|
||||
if($loan){
|
||||
throw new Exception('创建失败', ERR_PARAMS_ERROR);
|
||||
}
|
||||
$row = $this->orders_model->get(['id'=>$oid]);
|
||||
if(!$row || !$bank || !$year || !$money){
|
||||
throw new Exception('参数错误', ERR_PARAMS_ERROR);
|
||||
}
|
||||
$add_data = [
|
||||
'o_id' => $oid,
|
||||
'title' => $bank,
|
||||
'year' => $year,
|
||||
'first_price' => $money
|
||||
];
|
||||
$l_id = $this->order_loans_model->add($add_data);
|
||||
if($l_id){
|
||||
$data = [
|
||||
'id' => $l_id,
|
||||
'bank' => $bank,
|
||||
'year' => $year,
|
||||
'money' => $money
|
||||
];
|
||||
return $data;
|
||||
}else{
|
||||
throw new Exception('创建失败', ERR_PARAMS_ERROR);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected function put(){
|
||||
$id = $this->input_param('id');
|
||||
$bank = $this->input_param('bank');
|
||||
$year = $this->input_param('year');
|
||||
$money = $this->input_param('money');
|
||||
$oid = $this->input_param('o_id');
|
||||
$finance_id = $this->input_param('finance_id');
|
||||
$notify_file = $this->input_param('notify_file');
|
||||
$lend_file = $this->input_param('lend_file');
|
||||
$price_loan = $this->input_param('price_loan');
|
||||
|
||||
$row = $this->order_loans_model->get(['id'=>$id]);
|
||||
|
||||
$order_row = $this->receiver_orders_v2_model->get(['id' => $oid], 'id,mobile,money_json,payway');
|
||||
$row = $this->order_loans_model->get(['o_id' => $oid]);
|
||||
if(!$finance_id || !$notify_file || !$price_loan || !$order_row || $order_row['payway']){
|
||||
throw new Exception('参数错误', ERR_PARAMS_ERROR);
|
||||
}
|
||||
if(!$row){
|
||||
throw new Exception('数据不存在', ERR_PARAMS_ERROR);
|
||||
$row['id'] = $this->order_loans_model->add(['c_time'=>time(),'o_id'=>$oid]);
|
||||
}
|
||||
$update = [
|
||||
'title' => $bank,
|
||||
'year' => $year,
|
||||
'first_price' => $money
|
||||
];
|
||||
$price_last = $this->app_liche_orders_model->get(['o_id'=>$oid,'type'=>3,'status'=>1]); //尾款是否支付
|
||||
$last_pay = $this->app_liche_orders_model->count(['o_id'=>$oid,'pid'=>$price_last['id'],'status'=>1]); //存在已支付尾款
|
||||
|
||||
$result = $this->order_loans_model->update($update,['id'=>$id]);
|
||||
if($result){
|
||||
throw new Exception('修改成功', API_CODE_SUCCESS);
|
||||
}else{
|
||||
throw new Exception('修改失败', ERR_PARAMS_ERROR);
|
||||
if($last_pay){
|
||||
if($lend_file){
|
||||
$update['lend_file'] = $lend_file;
|
||||
$this->order_loans_model->update($update, ['id' => $row['id']]);
|
||||
throw new Exception('保存成功', API_CODE_SUCCESS);
|
||||
}else{
|
||||
throw new Exception('当前状态不可修改', API_CODE_FAIL);
|
||||
}
|
||||
}
|
||||
|
||||
$money_json = json_decode($order_row['money_json'], true);
|
||||
$money_json['price_loan'] = $price_loan;
|
||||
$this->receiver_orders_v2_model->update(['finance_id' => $finance_id, 'money_json' => json_encode($money_json, JSON_UNESCAPED_UNICODE)], ['id' => $order_row['id']]);
|
||||
//删除未支付订单
|
||||
$this->app_liche_orders_model->delete(['o_id'=>$row['o_id'],'status'=>0,'pid!='=>0,'type!='=>1]);
|
||||
//生成购车订单
|
||||
$userinfo = $this->app_liche_users_model->get(['mobile'=>$order_row['mobile']]);
|
||||
$this->orders_v2_entity->add_order($order_row['id'],$userinfo['id']);
|
||||
$this->orders_status_entity->set_status($oid,1,1);
|
||||
$update = [
|
||||
'notify_file' => $notify_file
|
||||
];
|
||||
$lend_file && $update['lend_file'] = $lend_file;
|
||||
$update && $result = $this->order_loans_model->update($update, ['id' => $row['id']]);
|
||||
throw new Exception('保存成功', API_CODE_SUCCESS);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ class Protocol extends CI_Controller{
|
||||
public function __construct(){
|
||||
parent::__construct();
|
||||
$this->load->model('receiver/order/receiver_orders_model','orders_model');
|
||||
$this->load->model('receiver/order/receiver_orders_v2_model');
|
||||
$this->load->model('receiver/order/receiver_order_contracts_model','contracts_model');
|
||||
$this->load->model('receiver/order/receiver_order_agents_model','agents_model');
|
||||
$this->load->model('receiver/order/receiver_order_loans_model','loans_model');
|
||||
@@ -33,6 +34,7 @@ class Protocol extends CI_Controller{
|
||||
$this->load->model("sys/sys_company_model");
|
||||
$this->load->model("items/items_model");
|
||||
$this->load->model('app/liche/app_liche_orders_model');
|
||||
$this->load->library('receiver/orders_v2_entity');
|
||||
|
||||
$wxapp = $this->input->get('wxapp');
|
||||
$this->folder = $wxapp ? 'protocol' : 'html2pdf';
|
||||
@@ -377,4 +379,70 @@ class Protocol extends CI_Controller{
|
||||
$row['cid'] = $contract['cid'];
|
||||
$this->load->view("wxapp/licheb/{$this->folder}/agent_sp",$row);
|
||||
}
|
||||
|
||||
public function pdf_img(){
|
||||
$this->load->library('receiver/sign_entity');
|
||||
$id = $this->input->get('id');
|
||||
$row = $this->contracts_model->get(['id'=>$id]);
|
||||
$order = $this->receiver_orders_v2_model->get(['id'=>$row['o_id']]);
|
||||
$show_imgs = [];
|
||||
if($row['file']){
|
||||
if(!$row['imgs']){
|
||||
$this->load->library('pdf');
|
||||
$pdf_url = http_host_com('api').'/'.$row['file'];
|
||||
$imgs = $this->pdf->pdf2img($pdf_url);
|
||||
if($imgs){
|
||||
if(!$row['flag']){
|
||||
$companys = $this->orders_v2_entity->get_biz_mchid($order['biz_id']);
|
||||
$img_seal = build_qiniu_image_url($companys['company']['img_seal']);
|
||||
$width = 325;
|
||||
if($row['type']==1){
|
||||
$sign_img = $imgs[1];
|
||||
$img_seal = build_qiniu_image_url($companys['srv_company']['img_seal']);
|
||||
$res = $this->sign_entity->merge_img($sign_img,$img_seal,$width,950);
|
||||
$imgs[1] = http_host_com('api').'/'.$res;
|
||||
}elseif($row['type']==3){
|
||||
$sign_img = $imgs[0];
|
||||
$res = $this->sign_entity->merge_img($sign_img,$img_seal,$width,1550);
|
||||
$imgs[0] = http_host_com('api').'/'.$res;
|
||||
} else{ //购车协议
|
||||
$sign_img = $imgs[2];
|
||||
$res = $this->sign_entity->merge_img($sign_img,$img_seal,$width,400);
|
||||
$imgs[2] = http_host_com('api').'/'.$res;
|
||||
}
|
||||
}
|
||||
$imgs = $this->up_qiniu($imgs,$res);
|
||||
$update['imgs'] = json_encode($imgs,JSON_UNESCAPED_UNICODE);
|
||||
foreach ($imgs as $item) {
|
||||
$show_imgs[] = build_qiniu_image_url($item);
|
||||
}
|
||||
$this->contracts_model->update($update,['id'=>$row['id']]);
|
||||
}
|
||||
}else{
|
||||
$imgs = json_decode($row['imgs'],true);
|
||||
foreach ($imgs as $item) {
|
||||
$show_imgs[] = build_qiniu_image_url($item);
|
||||
}
|
||||
}
|
||||
}
|
||||
$data['imgs'] = $show_imgs;
|
||||
$this->load->view("wxapp/licheb/pdf_img",$data);
|
||||
}
|
||||
|
||||
//图片上传七牛
|
||||
private function up_qiniu($imgs,$file){
|
||||
$this->load->library('qiniu');
|
||||
//上传七牛并保存
|
||||
foreach($imgs as $key=>$val){
|
||||
$file_name = md5($val).'.jpg';
|
||||
$result = $this->qiniu->fetch($val,$file_name);
|
||||
if($result){
|
||||
$imgs[$key] = $result['file'];
|
||||
if (strpos($val, $file) !== false) {
|
||||
@unlink(FCPATH.$file);
|
||||
}
|
||||
}
|
||||
}
|
||||
return $imgs;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,10 +64,22 @@ class Services extends Wxapp{
|
||||
$rows = $this->services_model->select($where,'','','','id,title,field_name');
|
||||
foreach($rows as $key=>$val){
|
||||
$field_arr = explode('.',$val['field_name']);
|
||||
$price = $price_arr[$field_arr[1]] && $field_arr[1]!='price_insure' ? $price_arr[$field_arr[1]] : 0;
|
||||
if($val['price_insure']=='fee_carno'){
|
||||
$price_list = [1000,1200,1600];
|
||||
}elseif ($val['price_insure']=='price_finance'){
|
||||
$price_list = [1000,1500,2000];
|
||||
}else{
|
||||
$price_list = $price>0 ? [$price,$price+200,$price+400] : [];
|
||||
}
|
||||
|
||||
$list[] = [
|
||||
'id' => $val['id'],
|
||||
'title' => $val['title'],
|
||||
'price' => $price_arr[$field_arr[1]] && $field_arr[1]!='price_insure' ? $price_arr[$field_arr[1]] : 0
|
||||
'key' => $field_arr[1],
|
||||
'text' => $field_arr[1] == 'price_insure' ? '由保险公司收取' : '',
|
||||
'price' => $price,
|
||||
'price_list' => $price_list
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>服务协议</title>
|
||||
<style>
|
||||
html,body{margin:0;padding:0;}
|
||||
img{display:block;margin:0;padding:0;width:100%;}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<?foreach ($imgs as $item){?>
|
||||
<img src="<?=$item?>" alt="#" />
|
||||
<?}?>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1138,3 +1138,17 @@ if (!function_exists('myTrim')) {
|
||||
return $str;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断是否正式环境
|
||||
*/
|
||||
if (!function_exists('is_product')) {
|
||||
function is_product()
|
||||
{
|
||||
if (false !== strpos($_SERVER['HTTP_HOST'], 'dev') || false !== strpos($_SERVER['HTTP_HOST'], 'test')) { //dev 测试
|
||||
return false;
|
||||
} else { // 正式
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,131 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by Vim
|
||||
* User: lcc
|
||||
* Date: 2021/07/12
|
||||
* Time: 16:49
|
||||
*/
|
||||
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
use mikehaertl\pdftk\Pdf;
|
||||
|
||||
class Pdftk {
|
||||
|
||||
private $is_dev = false;
|
||||
private $api_url = 'https://api.liche.cn/';
|
||||
public function __construct(){
|
||||
if (false !== strpos($_SERVER['HTTP_HOST'], 'dev')) {//dev
|
||||
$this->is_dev = true;
|
||||
$this->dev_api_url = 'https://liche-api-dev.xiaoyu.com/';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* pdf文件表单域填充
|
||||
* @param $pdf_path string pdf文件地址
|
||||
* @param $save_path string 填充后文件保存路径
|
||||
* @param $fill_data array 填充域对应内容['field'=>'text']
|
||||
* @return array
|
||||
*/
|
||||
public function fill_pdf($pdf_path,$save_path,$fill_data){
|
||||
$pdf_path = FCPATH.$pdf_path;
|
||||
$save_path = FCPATH.$save_path;
|
||||
if($this->is_dev){
|
||||
$ci = & get_instance();
|
||||
$ci->load->library('mycurl');
|
||||
$file_name = str_replace(FCPATH,"",$pdf_path);
|
||||
$p_data = [
|
||||
'file_url' => $this->dev_api_url.$file_name,
|
||||
'fill_data' => json_encode($fill_data)
|
||||
];
|
||||
$result = $ci->mycurl->httpPost($this->api_url.'pdfapi/fill_pdf',$p_data);
|
||||
$resdata = json_decode($result,true);
|
||||
$opt = false;
|
||||
$data = [];
|
||||
if($resdata['code'] && $resdata['data']['file_path']){
|
||||
$save_path_arr = explode('/',$save_path);
|
||||
array_pop($save_path_arr);
|
||||
$tmp_path = implode('/',$save_path_arr);
|
||||
if (!file_exists($tmp_path)) {
|
||||
$oldumask = umask(0);
|
||||
mkdir($tmp_path, 0777, true);
|
||||
umask($oldumask);
|
||||
}
|
||||
$arrContextOptions = [
|
||||
"ssl" => [
|
||||
"verify_peer"=>false,
|
||||
"verify_peer_name"=>false,
|
||||
],
|
||||
|
||||
];
|
||||
$file = file_get_contents($resdata['data']['file_path'],false,stream_context_create($arrContextOptions));
|
||||
file_put_contents($save_path, $file);
|
||||
if(file_exists($save_path)){
|
||||
$opt = true;
|
||||
$data['file_path'] = str_replace(FCPATH,'',$save_path);
|
||||
}
|
||||
}
|
||||
if($opt){
|
||||
return ['code'=>1,'msg'=>'保存成功','data' => $data];
|
||||
}else{
|
||||
return ['code'=>0,'msg'=>'保存失败'];
|
||||
}
|
||||
}else{
|
||||
$pdf = new Pdf($pdf_path);
|
||||
$result = $pdf->fillForm($fill_data)->needAppearances()->saveAs($save_path);
|
||||
if ($result === false) {
|
||||
return ['code'=>0,'msg'=>$pdf->getError()];
|
||||
}else{
|
||||
$data['file_path'] = $save_path;
|
||||
return ['code'=>1,'msg'=>'保存成功',$data];
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* e签宝填充pdf表单域
|
||||
* @param $pdf_path
|
||||
* @param $save_path
|
||||
* @param $fill_data
|
||||
* @return array
|
||||
*/
|
||||
public function esign_fill_pdf($pdf_path,$save_path,$fill_data){
|
||||
$pdf_path = FCPATH.$pdf_path;
|
||||
$save_path = FCPATH.$save_path;
|
||||
require_once COMMPATH."/third_party/esign/eSignOpenAPI.php";
|
||||
try {
|
||||
$sign = new \tech\core\eSign();
|
||||
$iRet = $sign->init();
|
||||
if (0 !== $iRet) {
|
||||
dir('初始化失败');
|
||||
return ['code' => 0 ,'msg' => '初始化失败'];
|
||||
}
|
||||
$tmpFile=array(
|
||||
'srcFileUrl' =>$pdf_path,
|
||||
'dstFileUrl' => ''
|
||||
);
|
||||
$ret = $sign->createFromTemplate($tmpFile,true,$fill_data,true);
|
||||
if($ret['errCode']!==0){
|
||||
return ['code' => 0 ,'msg' => $ret['msg']];
|
||||
}
|
||||
$save_path_arr = explode('/',$save_path);
|
||||
array_pop($save_path_arr);
|
||||
$tmp_path = implode('/',$save_path_arr);
|
||||
if (!file_exists($tmp_path)) {
|
||||
$oldumask = umask(0);
|
||||
mkdir($tmp_path, 0777, true);
|
||||
umask($oldumask);
|
||||
}
|
||||
file_put_contents($save_path, base64_decode($ret['stream']), true);
|
||||
if(file_exists($save_path)){
|
||||
$data['file_path'] = str_replace(FCPATH,'',$save_path);
|
||||
return ['code' => 1 ,'msg'=>'保存成功','data' => $data];
|
||||
}else{
|
||||
return ['code' => 0 ,'msg' => '保存失败'];
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
return ['code' => 0 ,'msg' => '初始化出错:'.$e->getMessage()];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -107,4 +107,90 @@ class Qyrobot{
|
||||
$result = json_decode($res,true);
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 支付后推送消息
|
||||
* @param $oid
|
||||
* @return mixed
|
||||
*/
|
||||
public function deposit_notify_v2($oid){
|
||||
$this->ci->load->model('receiver/order/receiver_orders_v2_model');
|
||||
$this->ci->load->model("biz/biz_model");
|
||||
$this->ci->load->model('area_model');
|
||||
$this->ci->load->model('auto/auto_brand_model');
|
||||
$this->ci->load->model('auto/auto_series_model');
|
||||
$this->ci->load->model('auto/auto_attr_model');
|
||||
|
||||
$this->ci->load->model('app/liche/app_liche_orders_model');
|
||||
$this->ci->load->model('app/liche/app_liche_orders_model');
|
||||
$this->ci->load->model('app/licheb/app_licheb_users_model');
|
||||
$this->ci->load->model('app/licheb/app_licheb_channel_biz_model');
|
||||
|
||||
$order_row = $this->ci->receiver_orders_v2_model->get(['id'=>$oid]);
|
||||
if(!$order_row){
|
||||
return false;
|
||||
}
|
||||
$biz_row = $this->ci->biz_model->get(['id'=>$order_row['biz_id']]);
|
||||
if($biz_row['type']==3){
|
||||
$channel_users = $this->ci->app_licheb_channel_biz_model->select(['biz_id'=>$biz_row['id']],'','','','uid');
|
||||
$user_ids = array_column($channel_users,'uid');
|
||||
$user_ids_str = implode(',',$user_ids);
|
||||
$user_info = '';
|
||||
if($user_ids_str && $user_ids){
|
||||
$where = [
|
||||
'group_id' => 4,
|
||||
'status' => 1,
|
||||
"id in ($user_ids_str)" => null
|
||||
];
|
||||
$users = $this->ci->app_licheb_users_model->select($where,'id desc',1,10,'uname,biz_id'); //渠道经理
|
||||
if($users){
|
||||
$user_info = implode(' ',array_column($users,'uname'));
|
||||
}else{ //获取城市
|
||||
$city_row = $this->ci->area_model->get(['city_id'=>$biz_row['city_id']]);
|
||||
$user_info = $city_row['city_name'];
|
||||
}
|
||||
}
|
||||
$biz_info = "{$user_info}渠道 {$biz_row['biz_name']}";
|
||||
}else{
|
||||
$user = $this->ci->app_licheb_users_model->get(['id'=>$order_row['admin_id']],'uname'); //获取销售员
|
||||
$biz_info = "{$biz_row['biz_name']} {$user['uname']}";
|
||||
}
|
||||
$brand_row = $this->ci->auto_brand_model->get(['id'=>$order_row['brand_id']],'name');
|
||||
$series_row = $this->ci->auto_series_model->get(['id'=>$order_row['s_id']],'name');
|
||||
$attr_arr = [$order_row['v_id'], $order_row['cor_id']];
|
||||
$attr = $this->ci->auto_attr_model->get_map_by_ids($attr_arr, 'id,title');
|
||||
$v_name = isset($attr[$order_row['v_id']]) ? $attr[$order_row['v_id']][0]['title'] : '';
|
||||
$cor_name = isset($attr[$order_row['cor_id']]) ? $attr[$order_row['cor_id']][0]['title'] : '';
|
||||
$car_info = "{$brand_row['name']} {$series_row['name']} {$v_name} {$cor_name}";
|
||||
|
||||
$min_price = 100;
|
||||
$today_s_time = date('Y-m-d 00:00:00');
|
||||
$sql = "select count(*) as total from (select min(pay_time) as pay_time,min(pay_price) as pay_price from lc_app_liche_orders
|
||||
where o_id>=10000 and status=1 and pid!=0 and pay_time!='0000-00-00 00:00:00' group by o_id order by o_id desc)a
|
||||
where pay_price>{$min_price} and pay_time>='{$today_s_time}'";
|
||||
$today_query = $this->ci->db->query($sql)->row_array();
|
||||
$month_s_time = date('Y-m-01 00:00:00');
|
||||
$sql = "select count(*) as total from (select min(pay_time) as pay_time,min(pay_price) as pay_price from lc_app_liche_orders
|
||||
where o_id>=10000 and status=1 and pid!=0 and pay_time!='0000-00-00 00:00:00' group by o_id order by o_id desc)a
|
||||
where pay_price>{$min_price} and pay_time>='{$month_s_time}'";
|
||||
$month_query = $this->ci->db->query($sql)->row_array();
|
||||
$today_count = $today_query['total'];
|
||||
$month_count = $month_query['total'];
|
||||
|
||||
$url = 'https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key='.$this->key;
|
||||
$this->ci->load->library('mycurl');
|
||||
$data = [
|
||||
'msgtype' => 'markdown',
|
||||
'markdown' => [
|
||||
'content' => "🎉🎉🎉 **喜讯** 🎉🎉🎉 \n
|
||||
恭喜 <font color=\"warning\">{$biz_info}</font> 成交 <font color=\"warning\">{$car_info}</font> 一台。\n
|
||||
>本日累计成交: <font color=\"warning\">{$today_count}</font> 单
|
||||
>本月累计成交: <font color=\"warning\">{$month_count}</font> 单\n
|
||||
### 狸车加油,冲冲冲!💪🏻💪🏻💪🏻"
|
||||
]
|
||||
];
|
||||
$res = $this->ci->mycurl->httpPost($url,$data,'is_json');
|
||||
$result = json_decode($res,true);
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,108 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: lcc
|
||||
* Date: 2022/1/10
|
||||
* Time: 16:11
|
||||
*/
|
||||
class Order_datas_entity{
|
||||
|
||||
private $ci;
|
||||
const COLOR_UN_UPLOAD = '#f9394d'; //未传
|
||||
const COLOR_IS_UPLOAD = '#fd9737'; //已传
|
||||
const COLOR_UN_CHECK = '#f9394d'; //未通过
|
||||
const COLOR_CHECK = '#36afa2'; //通过
|
||||
|
||||
|
||||
public function __construct(){
|
||||
$this->ci = & get_instance();
|
||||
$this->ci->load->model('receiver/order/receiver_order_datas_model');
|
||||
$this->ci->load->model('app/app_checkdata_model');
|
||||
}
|
||||
|
||||
public function data_status($o_data){
|
||||
$result = [
|
||||
'cardida' => ['text'=>'未传','type'=>1,'color'=>self::COLOR_UN_UPLOAD], //身份证
|
||||
'register_img' => ['text'=>'未传','type'=>2,'color'=>self::COLOR_UN_UPLOAD], //登记证
|
||||
'car_img' => ['text'=>'未传','type'=>3,'color'=>self::COLOR_UN_UPLOAD], //行驶证
|
||||
'ins_img' => ['text'=>'未传','type'=>4,'color'=>self::COLOR_UN_UPLOAD], //保单证
|
||||
'other_img' => ['text'=>'未传','type'=>5,'color'=>self::COLOR_UN_UPLOAD], //交车合照
|
||||
];
|
||||
// $where = ['cf_id'=>$o_data['id'],'app_id'=>2,'type in (1,2,3,4,5)'=>null,'datatype'=>'img'];
|
||||
// $check_data = $this->ci->app_checkdata_model->map('type','',$where,'','','','id,cf_id,type,ifcheck');
|
||||
foreach ($result as $key=>$item) {
|
||||
if($o_data[$key]){
|
||||
$result[$key]['text'] = '已传';
|
||||
$result[$key]['color'] = self::COLOR_IS_UPLOAD;
|
||||
// if($check_data[$item['type']][0]['ifcheck']==1){
|
||||
// $result[$key]['text'] = '已通过';
|
||||
// $result[$key]['color'] = self::COLOR_CHECK;
|
||||
// }
|
||||
// if($check_data[$item['type']][0]['ifcheck']==-1){
|
||||
// $result[$key]['text'] = '未通过';
|
||||
// $result[$key]['color'] = self::COLOR_UN_CHECK;
|
||||
// }
|
||||
}
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
//获取图片审核状态
|
||||
public function data_ckinfo($o_data,$main_type=0){
|
||||
if($main_type){
|
||||
$result = [
|
||||
'business_licence' => ['text'=>'营业执照','type'=>1,'up_status'=>0,'status'=>0,'status_cn'=>'未审核','imgs' => []], //身份证
|
||||
'register_img' => ['text'=>'登记证','type'=>2,'up_status'=>0,'status'=>0,'status_cn'=>'未审核','imgs' => []], //登记证
|
||||
'car_img' => ['text'=>'行驶证','type'=>3,'up_status'=>0,'status'=>0,'status_cn'=>'未审核','imgs'=>[]], //行驶证
|
||||
'ins_img' => ['text'=>'保单证','type'=>4,'up_status'=>0,'status'=>0,'status_cn'=>'未审核','imgs'=>[]], //保单证
|
||||
'other_img' => ['text'=>'交车合照','type'=>5,'up_status'=>0,'status'=>0,'status_cn'=>'未审核','imgs'=>[]], //交车合照
|
||||
];
|
||||
}else{
|
||||
$result = [
|
||||
'cardida' => ['text'=>'身份证正反面','type'=>1,'up_status'=>0,'status'=>0,'status_cn'=>'未审核','imgs' => []], //身份证
|
||||
'register_img' => ['text'=>'登记证','type'=>2,'up_status'=>0,'status'=>0,'status_cn'=>'未审核','imgs' => []], //登记证
|
||||
'car_img' => ['text'=>'行驶证','type'=>3,'up_status'=>0,'status'=>0,'status_cn'=>'未审核','imgs'=>[]], //行驶证
|
||||
'ins_img' => ['text'=>'保单证','type'=>4,'up_status'=>0,'status'=>0,'status_cn'=>'未审核','imgs'=>[]], //保单证
|
||||
'other_img' => ['text'=>'交车合照','type'=>5,'up_status'=>0,'status'=>0,'status_cn'=>'未审核','imgs'=>[]], //交车合照
|
||||
];
|
||||
}
|
||||
$where = [
|
||||
'cf_id'=>$o_data['id'],
|
||||
'app_id'=>2,
|
||||
'type in (1,2,3,4,5)'=>null,
|
||||
'datatype'=>'img'
|
||||
];
|
||||
$check_data = $this->ci->app_checkdata_model->map('type','',$where,'','','','id,cf_id,type,ifcheck');
|
||||
foreach ($result as $key=>$item) {
|
||||
if($o_data[$key]){
|
||||
$result[$key]['up_status'] = 1;
|
||||
$ifcheck = $check_data[$item['type']][0]['ifcheck'];
|
||||
$imgs = [];
|
||||
if($key=='ins_img'||$key=='other_img'){
|
||||
$img_data = json_decode($o_data[$key],true);
|
||||
foreach ($img_data as $v) {
|
||||
$imgs[] = build_qiniu_image_url($v);
|
||||
}
|
||||
}else{
|
||||
$imgs[] = build_qiniu_image_url($o_data[$key]);
|
||||
if($key=='cardida' && $o_data['cardidb']){
|
||||
$imgs[] = build_qiniu_image_url($o_data['cardidb']);
|
||||
}
|
||||
}
|
||||
$result[$key]['imgs'] = $imgs;
|
||||
if($ifcheck==1){
|
||||
$result[$key]['status_cn'] = '已通过';
|
||||
$result[$key]['status'] = 1;
|
||||
}elseif($ifcheck==-1){
|
||||
$result[$key]['status_cn'] = '未通过';
|
||||
$result[$key]['status'] = -1;
|
||||
}else{
|
||||
$result[$key]['status_cn'] = '未审核';
|
||||
$result[$key]['status'] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,105 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: lcc
|
||||
* Date: 2022/1/10
|
||||
* Time: 16:11
|
||||
*/
|
||||
class Orders_status_entity{
|
||||
|
||||
private $ci;
|
||||
|
||||
public function __construct(){
|
||||
$this->ci = & get_instance();
|
||||
$this->ci->load->model('receiver/order/receiver_order_status_model');
|
||||
}
|
||||
|
||||
/**
|
||||
* 完成状态
|
||||
* @param $oid
|
||||
* @param $pid_status
|
||||
* @param $status
|
||||
* @return bool
|
||||
*/
|
||||
public function set_status($oid,$pid_status,$status){
|
||||
$row = $this->ci->receiver_order_status_model->get(['o_id' => $oid,'pid_status'=>$pid_status,'status'=>$status]);
|
||||
if($row){
|
||||
return False;
|
||||
}
|
||||
$data = [
|
||||
'o_id' => $oid,
|
||||
'pid_status' => $pid_status,
|
||||
'status' => $status,
|
||||
'c_time' => time()
|
||||
];
|
||||
$res = $this->ci->receiver_order_status_model->add($data);
|
||||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取主状未完成
|
||||
* @param $o_id
|
||||
* @param $pid_status
|
||||
* @return string
|
||||
*/
|
||||
public function status_cn($o_id,$pid_status){
|
||||
$status_cn = '';
|
||||
$status_arr = $this->ci->receiver_order_status_model->get_status();
|
||||
$sub_status = $status_arr[$pid_status];
|
||||
if($sub_status){
|
||||
$key = count($sub_status);
|
||||
for ($key;$key>=0;$key--){
|
||||
if(!$key && !$this->ci->receiver_order_status_model->count(['o_id'=>$o_id,'pid_status'=>$pid_status,'status'=>$key])){ //0时
|
||||
$status_cn = $sub_status[$key];
|
||||
break;
|
||||
}else{
|
||||
if($this->ci->receiver_order_status_model->count(['o_id'=>$o_id,'pid_status'=>$pid_status,'status'=>$key])){
|
||||
$status_cn = $sub_status[$key];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return $status_cn;
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断否个状态是否全部完成
|
||||
* @param $o_id
|
||||
* @param $pid_status
|
||||
* @param $status
|
||||
* @return bool
|
||||
*/
|
||||
public function get_finish($o_id,$pid_status,$status){
|
||||
$count = $this->ci->receiver_order_status_model->count(['o_id'=>$o_id,'pid_status'=>$pid_status,'status'=>$status]);
|
||||
if($count){
|
||||
return true;
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取订单最新子状态
|
||||
* @param $oid 订单id
|
||||
* @param $pid_status 主状态id
|
||||
* @return string
|
||||
*/
|
||||
public function last_status_cn($oid,$pid_status){
|
||||
$where=[
|
||||
'o_id' => $oid,
|
||||
'pid_status' => $pid_status
|
||||
];
|
||||
$row = $this->ci->receiver_order_status_model->get($where,"id,max(status) as last_status");
|
||||
$status_arr = $this->ci->receiver_order_status_model->get_status();
|
||||
if($row['id']){
|
||||
if($status_arr[$pid_status][$row['last_status']]){
|
||||
return $status_arr[$pid_status][$row['last_status']];
|
||||
}else{
|
||||
return array_pop($status_arr[$pid_status]);
|
||||
}
|
||||
}else{
|
||||
return $status_arr[$pid_status][0];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,633 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: lcc
|
||||
* Date: 2022/1/10
|
||||
* Time: 16:11
|
||||
*/
|
||||
class Orders_v2_entity{
|
||||
const MCH_ID = '1612325641'; //厦门狸车销售
|
||||
const SRV_MCH_ID = '1612636924'; //收取服务费商户号 厦门狸车服务
|
||||
const PRICE_FINANCE = 1000; //金融服务费写死
|
||||
const PRICE_FINANCE_NZ = 2000; //哪吒金融服务费
|
||||
const API_ADMIN_IMG = 'https://img.liche.cn/liche/2021/08/7725fc9ab0dc0ba1/f3c84cf3b805bac4.png'; //api 客服二维码
|
||||
const API_PAY_IMG = 'https://img.liche.cn/liche/1634022931.png'; //api 意向金跳转支付二维码
|
||||
const API_CREATE_PAY_IMG = 'https://img.liche.cn/liche/2021/11/65b34b962f5f06b3/62e7d28d77bfe404.png'; //api 狸车我的页面
|
||||
const V2_START_ID = 10000; //升级后订单开始
|
||||
|
||||
private $ci;
|
||||
|
||||
public function __construct(){
|
||||
$this->ci = & get_instance();
|
||||
$this->ci->load->model('receiver/receiver_customers_model','customers_model');
|
||||
|
||||
$this->ci->load->model('receiver/order/receiver_orders_v2_model');
|
||||
$this->ci->load->model('receiver/order/receiver_order_signs_model','signs_model');
|
||||
$this->ci->load->model('receiver/order/receiver_order_deliverys_model','deliverys_model');
|
||||
$this->ci->load->model('receiver/order/receiver_order_contracts_model');
|
||||
|
||||
$this->ci->load->model('receiver/receiver_service_package_model','package_model');
|
||||
$this->ci->load->model('receiver/receiver_services_model','services_model');
|
||||
|
||||
$this->ci->load->model('sys/sys_city_model');
|
||||
$this->ci->load->model("sys/sys_company_model");
|
||||
|
||||
$this->ci->load->model('apporder/order_purchase_model');
|
||||
$this->ci->load->model('auto/auto_brand_model');
|
||||
$this->ci->load->model('auto/auto_series_model');
|
||||
$this->ci->load->model('auto/auto_attr_model');
|
||||
$this->ci->load->model("items/items_model");
|
||||
|
||||
$this->ci->load->model("biz/biz_model");
|
||||
$this->ci->load->model('app/liche/app_liche_orders_model');
|
||||
}
|
||||
|
||||
//创建意向金订单
|
||||
public function c_intention($oid,$uid,$money){
|
||||
$this->order_row = $this->ci->receiver_orders_v2_model->get(['id'=>$oid]);
|
||||
if(!$this->order_row){
|
||||
return false;
|
||||
}
|
||||
$p_row = $this->ci->app_liche_orders_model->get(['o_id'=>$this->order_row['id'],"(uid={$uid} or entrust_uid={$uid})"=>null,'pid'=>0,'status>='=>0]);
|
||||
$entrust_user = $this->entrust_user($oid);
|
||||
if(!$p_row){
|
||||
$sid = create_order_no(350200,'liche',1,0);
|
||||
$add_data = [
|
||||
'o_id' => $this->order_row['id'],
|
||||
'entrust_uid' => $entrust_user['id'] ? $entrust_user['id'] : 0,
|
||||
'sid' => $sid,
|
||||
'pid' => 0,
|
||||
'brand_id' => $this->order_row['brand_id'],
|
||||
's_id' => $this->order_row['s_id'],
|
||||
'v_id' => $this->order_row['v_id'],
|
||||
'cor_id' => $this->order_row['cor_id'],
|
||||
'incor_id' => $this->order_row['incor_id'],
|
||||
'c_time' => time()
|
||||
];
|
||||
$uid && $add_data['uid'] = $uid;
|
||||
$pid = $this->ci->app_liche_orders_model->add($add_data);
|
||||
}else{
|
||||
$pid = $p_row['id'];
|
||||
}
|
||||
$res = false;
|
||||
$sub_row = $this->ci->app_liche_orders_model->get(['o_id'=>$this->order_row['id'],"(uid={$uid} or entrust_uid={$uid})"=>null,'type'=>4,'status>='=>0]);
|
||||
if($pid && !$sub_row){
|
||||
//获取微信商户号
|
||||
$companys = $this->get_biz_mchid($this->order_row['biz_id']);
|
||||
$sid = create_order_no(350200,'liche',1,4);
|
||||
$sub_data = [
|
||||
'o_id' => $this->order_row['id'],
|
||||
'entrust_uid' => $entrust_user['id'] ? $entrust_user['id'] : 0,
|
||||
'sid' => $sid,
|
||||
'mch_id' => $companys['company']['wx_mchid'],
|
||||
'company_id' => $companys['company']['id'],
|
||||
'pid' => $pid,
|
||||
'type' => 4,
|
||||
'brand_id' => $this->order_row['brand_id'],
|
||||
's_id' => $this->order_row['s_id'],
|
||||
'v_id' => $this->order_row['v_id'],
|
||||
'cor_id' => $this->order_row['cor_id'],
|
||||
'incor_id' => $this->order_row['incor_id'],
|
||||
'total_price' => $money,
|
||||
'c_time' => time()
|
||||
];
|
||||
$uid && $sub_data['uid'] = $uid;
|
||||
$res = $this->ci->app_liche_orders_model->add($sub_data);
|
||||
}
|
||||
return $res;
|
||||
}
|
||||
/**
|
||||
* 获取商家微信商户号
|
||||
* @param $biz_id int 商家id
|
||||
* @return array ['company'=>[],'srv_company'=>[]]
|
||||
*/
|
||||
public function get_biz_mchid($biz_id){
|
||||
$biz = $this->ci->biz_model->get(['id'=>$biz_id],'type,city_id,company_id,srv_company_id,car_brand_id');
|
||||
$filed = 'id,wx_mchid,title,short,credit_code,wx_mchid,img_seal';
|
||||
if(in_array($biz['type'],[1])){ //品牌店
|
||||
$where = [
|
||||
"id in ({$biz['company_id']},{$biz['srv_company_id']})" => null
|
||||
];
|
||||
$companys = $this->ci->sys_company_model->map('wx_mchid','',$where,'','','',$filed);
|
||||
$company = $companys[$biz['company_id']][0];
|
||||
$srv_company = $companys[$biz['srv_company_id']][0];
|
||||
}else{ //其它店铺
|
||||
$brand_biz = $this->ci->biz_model->get(['city_id'=>$biz['city_id'],'type'=>1,'status'=>1,'car_brand_id'=>$biz['car_brand_id']],'type,city_id,company_id,srv_company_id');
|
||||
if($brand_biz){
|
||||
$where = [
|
||||
"id in ({$biz['company_id']},{$biz['srv_company_id']})" => null
|
||||
];
|
||||
$companys = $this->ci->sys_company_model->map('wx_mchid','',$where,'','','',$filed);
|
||||
$company = $companys[$biz['company_id']][0];
|
||||
$srv_company = $companys[$biz['srv_company_id']][0];
|
||||
}
|
||||
}
|
||||
if(!$company){ //获取城市销售公司
|
||||
$company = $this->ci->sys_company_model->get(['city_id'=>$biz['city_id'],'type'=>1],$filed);
|
||||
}
|
||||
if(!$srv_company){ //获取城市服务公司
|
||||
$srv_company = $this->ci->sys_company_model->get(['city_id'=>$biz['city_id'],'type'=>0],$filed);
|
||||
}
|
||||
$data = [
|
||||
'company' => $company,
|
||||
'srv_company' => $srv_company
|
||||
];
|
||||
return $data;
|
||||
}
|
||||
/**
|
||||
* 获取代办人用户信息
|
||||
* @param $oid int 订单id
|
||||
* @return array
|
||||
*/
|
||||
public function entrust_user($oid){
|
||||
$this->ci->load->model('app/liche/app_liche_users_model');
|
||||
|
||||
!$this->order_row && $this->order_row = $this->ci->receiver_orders_v2_model->get(['id'=>$oid]);
|
||||
if(!$this->order_row){
|
||||
return [];
|
||||
}
|
||||
$user = $this->ci->app_liche_users_model->get(['mobile'=>$this->order_row['owner_mobile']]);
|
||||
return $user;
|
||||
}
|
||||
/**
|
||||
* 获取订单服务费
|
||||
* @param $oid int 订单id
|
||||
* @param $res_type string 返回数据格式
|
||||
* @return int
|
||||
*/
|
||||
public function order_srv_money($oid,$res_type = ''){
|
||||
if(!$this->order_row){
|
||||
$this->order_row = $this->ci->receiver_orders_v2_model->get(['id'=>$oid]);
|
||||
}
|
||||
$money_json = json_decode($this->order_row['money_json'],true);
|
||||
$srv_price = 0;
|
||||
$list = []; //明细
|
||||
$services = json_decode($this->order_row['srv_ids'],true);
|
||||
|
||||
if($services){
|
||||
$srv_ids = array_column($services,'id');
|
||||
$ids = implode(',',$srv_ids);
|
||||
if($srv_ids){
|
||||
$where["id in ($ids)"] = null;
|
||||
$rows = $this->ci->services_model->map('id','title',$where,'','','','id,title');
|
||||
}
|
||||
foreach($services as $key=>$val){
|
||||
if($val['key']!='price_insure'){ //保险费不收
|
||||
$srv_price += $money_json[$val['key']];
|
||||
$list[] = [
|
||||
'title' => $rows[$val['id']],
|
||||
'money' => $money_json[$val['key']]
|
||||
];
|
||||
}
|
||||
if($val['key']=='price_insure' && $res_type==1){
|
||||
$list[] = [
|
||||
'title' => $rows[$val['id']],
|
||||
'money' => '由保险公司收取'
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
if($this->order_row['if_fine']){ //选择精品包
|
||||
$fine_price = $money_json['price_fine'];
|
||||
if($money_json['price_fine_discount']){ //优惠精品价格
|
||||
$fine_price = $fine_price - $money_json['price_fine_discount'];
|
||||
}
|
||||
$srv_price += $fine_price;
|
||||
$list[] = [
|
||||
'title' => '精品尊享包',
|
||||
'money' => $fine_price
|
||||
];
|
||||
}
|
||||
if($this->order_row['fines']){
|
||||
$price_fine_select = $money_json['price_fine_select'] ? $money_json['price_fine_select'] : 0;
|
||||
$list[] = [
|
||||
'title' => '精品选装',
|
||||
'money' => $price_fine_select,
|
||||
];
|
||||
$srv_price += $price_fine_select;
|
||||
}
|
||||
$result['total'] = $srv_price;
|
||||
$result['list'] = $list;
|
||||
return $res_type ? $result:$srv_price;
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成定金订单
|
||||
* @param $oid int 订单id
|
||||
* @param $uid int 小程序用户id
|
||||
* @return bool
|
||||
*/
|
||||
public function add_book_order($oid,$uid){
|
||||
$this->order_row = $this->ci->receiver_orders_v2_model->get(['id'=>$oid]);
|
||||
if(!$this->order_row){
|
||||
return false;
|
||||
}
|
||||
$pay_money = $this->ci->app_liche_orders_model->get(['o_id'=>$oid,'type'=>4,'status>='=>0]); //意向金订单
|
||||
|
||||
$money_json = json_decode($this->order_row['money_json'],true);
|
||||
$deposit_count = $this->ci->app_liche_orders_model->count(['o_id'=>$oid,'type'=>1,'status'=>1]); //定金已支付
|
||||
$need_pay_money = $money_json['price_book'] - $pay_money['total_price'];
|
||||
$res = false;
|
||||
if($need_pay_money > 0 && !$deposit_count){
|
||||
$entrust_user = $this->entrust_user($this->order_row['id']);
|
||||
$p_row = $this->ci->app_liche_orders_model->get(['o_id'=>$this->order_row['id'],'pid'=>0,'status>='=>0]);
|
||||
if(!$p_row){
|
||||
$sid = create_order_no(350200,'liche',1,0);
|
||||
$add_data = [
|
||||
'o_id' => $this->order_row['id'],
|
||||
'sid' => $sid,
|
||||
'pid' => 0,
|
||||
'brand_id' => $this->order_row['brand_id'],
|
||||
's_id' => $this->order_row['s_id'],
|
||||
'v_id' => $this->order_row['v_id'],
|
||||
'cor_id' => $this->order_row['cor_id'],
|
||||
'incor_id' => $this->order_row['incor_id'],
|
||||
'c_time' => time()
|
||||
];
|
||||
$uid && $add_data['uid'] = $uid;
|
||||
$entrust_user['id'] && $add_data['entrust_uid'] = $entrust_user['id'];
|
||||
$pid = $this->ci->app_liche_orders_model->add($add_data);
|
||||
}else{
|
||||
$pid = $p_row['id'];
|
||||
}
|
||||
$sub_row = $this->ci->app_liche_orders_model->get(['o_id'=>$this->order_row['id'],'type'=>1,'status>='=>0]);
|
||||
if($pid && !$sub_row){
|
||||
//获取微信商户号
|
||||
$companys = $this->get_biz_mchid($this->order_row['biz_id']);
|
||||
$sid = create_order_no(350200,'liche',1,1);
|
||||
$sub_data = [
|
||||
'o_id' => $this->order_row['id'],
|
||||
'sid' => $sid,
|
||||
'mch_id' => $companys['company']['wx_mchid'],
|
||||
'company_id' => $companys['company']['id'],
|
||||
'pid' => $pid,
|
||||
'type' => 1,
|
||||
'brand_id' => $this->order_row['brand_id'],
|
||||
's_id' => $this->order_row['s_id'],
|
||||
'v_id' => $this->order_row['v_id'],
|
||||
'cor_id' => $this->order_row['cor_id'],
|
||||
'incor_id' => $this->order_row['incor_id'],
|
||||
'total_price' => $need_pay_money,
|
||||
'c_time' => time()
|
||||
];
|
||||
$entrust_user['id'] && $sub_data['entrust_uid'] = $entrust_user['id'];
|
||||
$uid && $sub_data['uid'] = $uid;
|
||||
$res = $this->ci->app_liche_orders_model->add($sub_data);
|
||||
}
|
||||
}
|
||||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建服务费和尾款
|
||||
* @param $oid
|
||||
* @param $uid
|
||||
* @return bool
|
||||
*/
|
||||
public function add_order($oid,$uid){
|
||||
$this->ci->load->helper('order');
|
||||
$this->order_row = $this->ci->receiver_orders_v2_model->get(['id'=>$oid]);
|
||||
$p_row = $this->ci->app_liche_orders_model->get(['pid'=>0,'o_id'=>$oid,'status>='=>0],'id'); //父订单
|
||||
if(!$this->order_row || !$p_row){
|
||||
return false;
|
||||
}
|
||||
|
||||
//获取微信商户号
|
||||
$companys = $this->get_biz_mchid($this->order_row['biz_id']);
|
||||
|
||||
$srv_money = $this->order_srv_money($oid); //服务费
|
||||
$money_json = json_decode($this->order_row['money_json'],true);
|
||||
$total_price = $this->total_price($oid);
|
||||
if(!$this->order_row['payway'] && !$money_json['price_loan']){//贷款未填写首付
|
||||
return false;
|
||||
}
|
||||
$to_srv_price = $srv_money;
|
||||
if($this->order_row['payway']){ //全款
|
||||
$to_com_price = $total_price - $money_json['price_book'];
|
||||
}else{ //分期
|
||||
$to_com_price = $total_price-$money_json['price_loan'] - $money_json['price_book'];
|
||||
}
|
||||
$to_com_price = $to_com_price>0 ? $to_com_price : 0;
|
||||
$last_order = $this->ci->app_liche_orders_model->get(['status>='=>0,'type'=>3,'o_id'=>$oid]);
|
||||
if($last_order){ //存在尾款订单
|
||||
if($last_order['total_price']!=$to_com_price && $to_com_price>0){
|
||||
$this->ci->app_liche_orders_model->update(['total_price'=>$to_com_price,'status'=>0],['id'=>$last_order['id']]);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
$add_data = [];
|
||||
$entrust_user = $this->entrust_user($oid);
|
||||
if($to_srv_price>0 && !$this->ci->app_liche_orders_model->count(['o_id'=>$this->order_row['id'],'type'=>2,'status>='=>0])){
|
||||
$order_type = 2;
|
||||
$sid = create_order_no(350200,'liche',1,$order_type);
|
||||
$add_data[] = [
|
||||
'o_id' => $this->order_row['id'],
|
||||
'uid' => $uid ? $uid : 0,
|
||||
'entrust_uid' => $entrust_user['id'] ? $entrust_user['id'] : 0,
|
||||
'sid' => $sid,
|
||||
'mch_id' => $companys['srv_company']['wx_mchid'],
|
||||
'company_id' => $companys['srv_company']['id'],
|
||||
'pid' => $p_row['id'],
|
||||
'brand_id' => $this->order_row['brand_id'],
|
||||
's_id' => $this->order_row['s_id'],
|
||||
'v_id' => $this->order_row['v_id'],
|
||||
'cor_id' => $this->order_row['cor_id'],
|
||||
'incor_id' => $this->order_row['incor_id'],
|
||||
'total_price' => $to_srv_price,
|
||||
'type' => $order_type,
|
||||
'c_time' => time()
|
||||
];
|
||||
}
|
||||
if($to_com_price>0 && !$this->ci->app_liche_orders_model->count(['o_id'=>$this->order_row['id'],'type'=>3,'status>='=>0])){
|
||||
$order_type = 3;
|
||||
$sid = create_order_no(350200,'liche',1,$order_type);
|
||||
$add_data[] = [
|
||||
'o_id' => $this->order_row['id'],
|
||||
'uid' => $uid ? $uid : 0,
|
||||
'entrust_uid' => $entrust_user['id'] ? $entrust_user['id'] : 0,
|
||||
'sid' => $sid,
|
||||
'mch_id' => $companys['company']['wx_mchid'],
|
||||
'company_id' => $companys['company']['id'],
|
||||
'pid' => $p_row['id'],
|
||||
'brand_id' => $this->order_row['brand_id'],
|
||||
's_id' => $this->order_row['s_id'],
|
||||
'v_id' => $this->order_row['v_id'],
|
||||
'cor_id' => $this->order_row['cor_id'],
|
||||
'incor_id' => $this->order_row['incor_id'],
|
||||
'total_price' => $to_com_price,
|
||||
'type' => $order_type,
|
||||
'c_time' => time()
|
||||
];
|
||||
}
|
||||
$result = false;
|
||||
if($add_data){
|
||||
$result = $this->ci->app_liche_orders_model->add_batch($add_data);
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 计算订单应收金额
|
||||
* @param $oid int 订单id
|
||||
* @param $srv_price boolean 是否包含服务费
|
||||
* @return float
|
||||
*/
|
||||
public function recevable_price($oid,$srv_price=true){
|
||||
$this->order_row = $this->ci->receiver_orders_v2_model->get(['id'=>$oid]);
|
||||
if(!$this->order_row){
|
||||
return false;
|
||||
}
|
||||
$money_json = json_decode($this->order_row['money_json'],true);
|
||||
$total_price = $this->total_price($oid);
|
||||
if($srv_price){
|
||||
$srv_money = $this->order_srv_money($oid);
|
||||
$recevable_price = $total_price + $srv_money;
|
||||
}else{
|
||||
$recevable_price = $total_price;
|
||||
}
|
||||
|
||||
if(!$this->order_row['payway']){ //分期
|
||||
$recevable_price -= $money_json['price_loan'];
|
||||
}
|
||||
return $recevable_price;
|
||||
}
|
||||
|
||||
/**
|
||||
* 计算订单总售价
|
||||
* @param $oid int 订单id
|
||||
* @return float
|
||||
*/
|
||||
public function total_price($oid){
|
||||
$order_row = $this->ci->receiver_orders_v2_model->get(['id'=>$oid],'money_json');
|
||||
if(!$order_row){
|
||||
return false;
|
||||
}
|
||||
$money_json = json_decode($order_row['money_json'],true);
|
||||
$total_price = $money_json['price_car'];
|
||||
if($money_json['price_discount']){
|
||||
$total_price -= $money_json['price_discount'];
|
||||
}
|
||||
if($money_json['price_color']){
|
||||
$total_price += $money_json['price_color'];
|
||||
}
|
||||
if($money_json['price_coplus']){
|
||||
$total_price += $money_json['price_coplus'];
|
||||
}
|
||||
return $total_price ? $total_price : 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改完订单信息后操作
|
||||
* @param array() $new_data 修改后的数据
|
||||
* @param array() $row 修改前数据
|
||||
*/
|
||||
public function edit_order($new_data,$row){
|
||||
//更新购车订单车辆信息
|
||||
$up_data = [
|
||||
'brand_id' => $new_data['brand_id'],
|
||||
's_id' => $new_data['s_id'],
|
||||
'v_id' => $new_data['v_id'],
|
||||
'cor_id' => $new_data['cor_id'],
|
||||
'incor_id' => $new_data['incor_id'],
|
||||
];
|
||||
$this->ci->app_liche_orders_model->update($up_data,['o_id'=>$row['id']]);
|
||||
//删除未支付订单
|
||||
$this->ci->app_liche_orders_model->delete(['o_id'=>$row['id'],'status'=>0,'pid!='=>0]);
|
||||
$userinfo = $this->ci->app_liche_users_model->get(['mobile'=>$new_data['mobile']],'id');
|
||||
if(!$this->ci->app_liche_orders_model->count(['o_id'=>$row['id'],'type'=>1,'status'=>1])){ //不存在订单订单
|
||||
$this->add_book_order($row['id'],$userinfo['id']);
|
||||
}
|
||||
$this->add_order($row['id'],$userinfo['id']);
|
||||
//合同重新生成
|
||||
if($this->ci->receiver_order_contracts_model->count(['o_id'=>$row['id'],'type in (0,1)'=>null])){
|
||||
$this->ci->receiver_order_contracts_model->delete(['o_id'=>$row['id'],'type in (0,1)'=>null]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成pdf文件
|
||||
* @param $oid
|
||||
* @throws Exception
|
||||
*/
|
||||
public function create_pdf($oid){
|
||||
$this->order_row = $this->ci->receiver_orders_v2_model->get(['id'=>$oid]);
|
||||
if(!$this->order_row ){
|
||||
return ['code'=>0,'msg'=>'参数错误'];
|
||||
}
|
||||
if($this->ci->receiver_order_contracts_model->count(['o_id'=>$oid,'status'=>1])){
|
||||
return ['code'=>1,'msg'=>'操作成功'];
|
||||
}
|
||||
$fill_info = $this->pdf_data($this->order_row);
|
||||
$fill_data = [
|
||||
'sid' => $this->order_row['sid'],
|
||||
'give_time' => $fill_info['give_time'],
|
||||
'date' => $fill_info['now_day'],
|
||||
'company' => $fill_info['companys']['company']['title'],
|
||||
'name' => $fill_info['name'],
|
||||
'owner_name' => $fill_info['owner_name'],
|
||||
'owner_mobile' => $fill_info['owner_mobile'],
|
||||
'identify_type' => $fill_info['identify_type'],
|
||||
'identify' => $fill_info['identify'],
|
||||
'address' => $fill_info['address'],
|
||||
'version' => $fill_info['version'],
|
||||
'color' => $fill_info['color'],
|
||||
'incolor' => $fill_info['incolor'],
|
||||
'price_car' => $fill_info['price_car'],
|
||||
'price_discount' => $fill_info['price_discount'],
|
||||
'price_finance' => $fill_info['price_finance'],
|
||||
'recevable_price' => $fill_info['recevable_price'],
|
||||
'price_book' => $fill_info['price_book'],
|
||||
'last_price' => $fill_info['last_price'],
|
||||
];
|
||||
$pdf_path = 'pdf/car_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);
|
||||
if(!$req['code']){
|
||||
return ['code'=>0,'msg'=>$req['msg']];
|
||||
}
|
||||
$add_data[] = [
|
||||
'o_id' => $this->order_row['id'],
|
||||
'cid' => 0,
|
||||
'file' => $req['data']['file_path'] ? $req['data']['file_path'] : '',
|
||||
'type' => 0,
|
||||
'status' => 1,
|
||||
'c_time' => time()
|
||||
];
|
||||
if($this->order_row['srv_ids']){
|
||||
$fill_data = [
|
||||
'sid' => $this->order_row['sid'],
|
||||
'date' => $fill_info['now_day'],
|
||||
'company' => $fill_info['companys']['srv_company']['title'],
|
||||
'name' => $fill_info['name'],
|
||||
'mobile' => $this->order_row['owner_mobile'],
|
||||
'service_str' => implode('
|
||||
',$fill_info['services']),
|
||||
];
|
||||
$pdf_path = 'pdf/agent_tpl.pdf';
|
||||
$save_path = "pdf/{$this->order_row['sid']}/service.pdf";
|
||||
$res = $this->ci->pdftk->esign_fill_pdf($pdf_path,$save_path,$fill_data);
|
||||
if($res['code']){
|
||||
$add_data[] = [
|
||||
'o_id' => $this->order_row['id'],
|
||||
'cid' => 0,
|
||||
'file' => $res['data']['file_path'] ? $res['data']['file_path'] : '',
|
||||
'type' => 1,
|
||||
'status' => 1,
|
||||
'c_time' => time()
|
||||
];
|
||||
}
|
||||
}
|
||||
$res = $this->ci->receiver_order_contracts_model->add_batch($add_data);
|
||||
if($res){
|
||||
return ['code'=>1,'msg'=>'操作成功'];
|
||||
}else{
|
||||
return ['code'=>0,'msg'=>'操作失败'];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取填充内容
|
||||
* @param $row
|
||||
* @param $type
|
||||
* @return mixed
|
||||
*/
|
||||
public function pdf_data($row,$type=0){
|
||||
if(!$row){
|
||||
return false;
|
||||
}
|
||||
$this->ci->load->model('auto/auto_business_model');
|
||||
$info_json = json_decode($row['info_json'],true);
|
||||
$business_id = $info_json['business_id'] ? $info_json['business_id'] : 0;
|
||||
$data = [];
|
||||
|
||||
//车辆信息
|
||||
$money_json = json_decode($row['money_json'],true);
|
||||
$money_json['price_discount'] && $row['price'] = $row['price'] - $money_json['price_discount'];
|
||||
$brand = $this->ci->auto_brand_model->get(['id'=>$row['brand_id']],'name');
|
||||
$series = $this->ci->auto_series_model->get(['id'=>$row['s_id']],'name');
|
||||
$version = $this->ci->auto_attr_model->get(['id'=>$row['v_id']],'title');
|
||||
$color = $this->ci->auto_attr_model->get(['id'=>$row['cor_id']],'title');
|
||||
$incolor = $this->ci->auto_attr_model->get(['id'=>$row['incor_id']],'title');
|
||||
$_version = $version['title'] ? $version['title'] : '';
|
||||
$data['version'] = "{$brand['name']} {$series['name']} $_version";
|
||||
$data['color'] = $color['title'] ? $color['title'] : '';
|
||||
$data['incolor'] = $incolor['title'] ? $incolor['title'] : '';
|
||||
$business_row = $this->ci->auto_business_model->get(['id'=>$business_id]);
|
||||
if($business_row){
|
||||
$data['give_time'] = $business_row['delivery_day'];
|
||||
}else{
|
||||
if($row['s_id']==24) { //零跑T03
|
||||
$data['give_time'] = 60;
|
||||
}elseif($row['s_id']==25) { //零跑C11
|
||||
$data['give_time'] = 120;
|
||||
}else{ //其它车型
|
||||
$data['give_time'] = 45;
|
||||
}
|
||||
}
|
||||
$data['price_car'] = number_format($money_json['price_car']+$money_json['price_color']+$money_json['price_coplus'],2);
|
||||
$data['price_discount'] = number_format($money_json['price_discount'],2);
|
||||
$data['price_book'] = number_format($money_json['price_book'],2);
|
||||
$data['recevable_price'] = number_format($this->total_price($row['id']),2);
|
||||
$data['last_price'] = number_format($this->total_price($row['id']) - $money_json['price_book'],2);
|
||||
$data['address'] = $info_json['c_address'] ? $info_json['c_address'] : '';
|
||||
$data['name'] = $row['name'];
|
||||
if($row['main_type']){
|
||||
$data['identify_type'] = '营业执照' ;
|
||||
$data['identify'] = $info_json['c_credit'];
|
||||
$data['owner_name'] = $info_json['c_company'];
|
||||
$data['owner_mobile'] = $row['mobile'];
|
||||
}else{
|
||||
$data['identify_type'] = '身份证';
|
||||
$data['identify'] = $info_json['c_owner_cardid'];
|
||||
$data['owner_name'] = $row['owner_name'];
|
||||
$data['owner_mobile'] = $row['owner_mobile'];
|
||||
}
|
||||
|
||||
$data['now_day'] = date('Y-m-d');
|
||||
$data['companys'] = $this->get_biz_mchid($row['biz_id']);
|
||||
if($type==1){
|
||||
$items = $this->ci->items_model->get(['id'=>$row['item_id']],'vin');
|
||||
$delivery = $this->ci->deliverys_model->get(['o_id'=>$row['id']],'info,tool,remark');
|
||||
$data['vin'] = $items['vin'];
|
||||
$data['delivery'] = $delivery;
|
||||
}
|
||||
if(!$type){
|
||||
$services = [];
|
||||
$srv_arr = json_decode($row['srv_ids'],true);
|
||||
$srv_ids = array_column($srv_arr,'id');
|
||||
$srv_ids_str = implode(',',$srv_ids);
|
||||
if($row['srv_ids'] && $srv_ids_str){
|
||||
$service_rows = $this->ci->services_model->select(["id in ({$srv_ids_str})"=>null],'','','','id,title,field_name');
|
||||
foreach($service_rows as $key=>$val){
|
||||
$field_arr = explode('.',$val['field_name']);
|
||||
if(isset($money_json[$field_arr[1]])){ //保险费不收
|
||||
$money = $field_arr[1]=='price_insure' ? '由保险公司收取' : $money_json[$field_arr[1]];
|
||||
is_numeric($money) && $money = number_format($money,2);
|
||||
$services[] = $val['title'].': '.$money;
|
||||
}
|
||||
}
|
||||
}
|
||||
if($row['if_fine']){ //选择精品包
|
||||
$fine_price = $money_json['price_fine_discount'] ? $money_json['price_fine'] - $money_json['price_fine_discount'] : $money_json['price_fine'];
|
||||
$services[] = '精品尊享包: '.number_format($fine_price,2);
|
||||
}
|
||||
if($row['fines']){
|
||||
$fines = json_decode($row['fines'],true);
|
||||
$split = $fine_title_price = $fine_title = '';
|
||||
foreach($fines as $key=>$val){
|
||||
$fine_title = $fine_title.$split.$val['txt'].$split;
|
||||
$price = number_format($val['price'],2);
|
||||
$fine_title_price = $fine_title_price.$split."{$val['txt']}:{$price}";
|
||||
$split = ' ';
|
||||
}
|
||||
$services[] = '精品选装: '.number_format($money_json['price_fine_select'],2)."($fine_title_price)";
|
||||
}
|
||||
$srv_price = $this->order_srv_money($row['id']);
|
||||
$services[] = '实际支付(元): '.number_format($srv_price,2);
|
||||
$data['services'] = $services;
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
@@ -62,6 +62,46 @@ class Sign_entity{
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 合并图片
|
||||
* @param $origin_url string 原始图片
|
||||
* @param $user_file string 需要合并图片
|
||||
* @param $width int x坐标
|
||||
* @param $height int y坐标
|
||||
* @param string $s_path string 图片保存地址
|
||||
* @return bool|mixed string 返回合成后图片地址
|
||||
* @throws Exception
|
||||
*/
|
||||
public function merge_img($origin_url,$user_file,$width,$height,$s_path='' ){
|
||||
$arrContextOptions=array(
|
||||
"ssl"=>array(
|
||||
"verify_peer"=>false,
|
||||
"verify_peer_name"=>false,
|
||||
),
|
||||
);
|
||||
//临时保存签名图片
|
||||
if (!file_exists(FCPATH.'/temp')){
|
||||
$oldumask = umask(0);
|
||||
mkdir(FCPATH.'/temp', 0777, true);
|
||||
umask($oldumask);
|
||||
}
|
||||
$file_name = time().rand(1,9999999);
|
||||
!$s_path && $s_path = FCPATH.'temp/'.md5('sign'.$file_name).'.jpg';
|
||||
|
||||
$yhdata = file_get_contents($user_file,false,stream_context_create($arrContextOptions));
|
||||
$yh_image = Image::fromData($yhdata)->cropResize(200,200)->rotate(90);
|
||||
|
||||
|
||||
//原始签名文件
|
||||
$data = file_get_contents($origin_url,false,stream_context_create($arrContextOptions));
|
||||
$imgobj = Image::fromData($data);
|
||||
$imgobj->merge($yh_image,$width,$height)->save($s_path);
|
||||
if(file_exists($s_path)){
|
||||
return str_replace(FCPATH,'',$s_path);
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: lcc
|
||||
* Date: 2022/1/20
|
||||
* Time: 15:07
|
||||
*/
|
||||
class App_checkdata_model extends HD_Model
|
||||
{
|
||||
private $table_name = 'lc_app_checkdata';
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct($this->table_name, 'default');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -9,7 +9,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
class App_liche_orders_model extends HD_Model{
|
||||
private $table_name = 'lc_app_liche_orders';
|
||||
|
||||
private $type_arr = [ 1 => '定金', 2 => '委托服务费' , 3 => '尾款' ,4 => '意向金' ,5 => '后台添加'];
|
||||
private $type_arr = [ 1 => '定金', 2 => '委托服务费' , 3 => '尾款' ,4 => '意向金' ,5 => '后台添加',6 => '车款'];
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
* Created by Vim.
|
||||
* User: lcc
|
||||
* Date: 2021/06/23
|
||||
* Time: 16:24
|
||||
*/
|
||||
class Auto_business_model extends HD_Model
|
||||
{
|
||||
private $table_name = 'lc_auto_car_business';
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct($this->table_name, 'default');
|
||||
}
|
||||
|
||||
public function year(){
|
||||
return [2022,2023,2024,2025,2026];
|
||||
}
|
||||
public function month(){
|
||||
return [1,2,3,4,5,6,7,8,9,10,11,12];
|
||||
}
|
||||
}
|
||||
@@ -93,8 +93,8 @@ class Auto_cars_model extends HD_Model{
|
||||
$this->db->order_by($order);
|
||||
}
|
||||
if ($page) {
|
||||
$offset = ($page - 1) * $page_size;
|
||||
$limit = $page_size;
|
||||
$offset = ($page - 1) * $size;
|
||||
$limit = $size;
|
||||
} else {
|
||||
$offset = null;
|
||||
$limit = null;
|
||||
|
||||
@@ -55,8 +55,8 @@ class Auto_series_model extends HD_Model{
|
||||
$this->db->order_by($order);
|
||||
}
|
||||
if ($page) {
|
||||
$offset = ($page - 1) * $page_size;
|
||||
$limit = $page_size;
|
||||
$offset = ($page - 1) * $size;
|
||||
$limit = $size;
|
||||
} else {
|
||||
$offset = null;
|
||||
$limit = null;
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
class Biz_info_model extends HD_Model
|
||||
{
|
||||
private $table_name = 'lc_biz_info';
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct($this->table_name, 'default');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
class Biz_settle_model extends HD_Model
|
||||
{
|
||||
private $table_name = 'lc_biz_settle';
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct($this->table_name, 'default');
|
||||
}
|
||||
|
||||
public function selectOrders($where = array(), $order = '', $page = 0, $page_size = 20, $count = 0,$fileds="lc_biz_settle.*")
|
||||
{
|
||||
$this->db->distinct()->select($fileds);
|
||||
$this->db->from('lc_biz_settle');
|
||||
$this->db->join('lc_receiver_orders_v2', 'lc_receiver_orders_v2.id = lc_biz_settle.o_id','left');
|
||||
if ($where) {
|
||||
$this->db->where($where);
|
||||
}
|
||||
if ($count) {
|
||||
$res = $this->db->count_all_results();
|
||||
return $res ? $res : 0;
|
||||
}
|
||||
if ($order) {
|
||||
$this->db->order_by($order);
|
||||
}
|
||||
if ($page) {
|
||||
$offset = ($page - 1) * $page_size;
|
||||
$limit = $page_size;
|
||||
} else {
|
||||
$offset = null;
|
||||
$limit = null;
|
||||
}
|
||||
$this->db->limit($limit, $offset);
|
||||
return $this->db->get()->result_array();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
class Biz_settle_static_model extends HD_Model
|
||||
{
|
||||
private $table_name = 'lc_biz_settle_static';
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct($this->table_name, 'default');
|
||||
}
|
||||
|
||||
//其它费用类型
|
||||
public function other_price_type(){
|
||||
$array = [
|
||||
0 => '共同承担',
|
||||
1 => '狸车承担',
|
||||
2 => '合伙人承担'
|
||||
];
|
||||
return $array;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
class Biz_trucking_model extends HD_Model
|
||||
{
|
||||
private $table_name = 'lc_biz_trucking';
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct($this->table_name, 'default');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -14,12 +14,14 @@ class Receiver_order_contracts_model extends HD_Model
|
||||
|
||||
private $type_arr = [ 0 => '整车合同',1 => '代理协议',2 => '车辆信息确定',3 => '交接信息', 4 => '合同补充协议', 5 => '委托服务补充协议'];
|
||||
|
||||
private $type_arr_new = [ 0 => '购车协议',1 => '服务协议',3=>'车辆确认'];
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct($this->table_name, 'default');
|
||||
}
|
||||
|
||||
public function get_types(){
|
||||
return $this->type_arr;
|
||||
public function get_types($new = 0){
|
||||
return $new ? $this->type_arr_new : $this->type_arr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by Vim
|
||||
* User: lcc
|
||||
* Date: 2021/07/09
|
||||
* Time: 13:47
|
||||
*/
|
||||
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
class Receiver_order_datas_model extends HD_Model
|
||||
{
|
||||
private $table_name = 'lc_receiver_order_datas';
|
||||
|
||||
private $ifcheck = [0 => '未上传', 1 => '已上传', 2 => '已审核', -1 => '审核不通过'];
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct($this->table_name, 'default');
|
||||
}
|
||||
|
||||
public function get_ifcheck_cn()
|
||||
{
|
||||
return $this->ifcheck;
|
||||
}
|
||||
|
||||
/**
|
||||
* Notes:根据id获取数据
|
||||
* Created on: 2021/7/15 17:27
|
||||
* @param $ids
|
||||
* @param string $fileds
|
||||
* @return array
|
||||
*/
|
||||
public function get_map_by_oids($oids, $fileds = '')
|
||||
{
|
||||
$rows = [];
|
||||
$oids = array_filter($oids);
|
||||
if ($oids) {
|
||||
$cf_ids = implode(',', $oids);
|
||||
$where = [
|
||||
"o_id in ($cf_ids)" => null
|
||||
];
|
||||
$rows = $this->map('o_id', '', $where, '', '', '', $fileds);
|
||||
}
|
||||
return $rows;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by Vim
|
||||
* User: lcc
|
||||
* Date: 2021/07/09
|
||||
* Time: 13:47
|
||||
*/
|
||||
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
class Receiver_order_status_model extends HD_Model
|
||||
{
|
||||
private $table_name = 'lc_receiver_order_status';
|
||||
|
||||
private $status_arr = [
|
||||
0 => [0 => '待付款', 1 => '已付款'], //付款
|
||||
1 => [0 => '分期办理中', 1 => '等待放款',2 => '完成按揭'], //分期
|
||||
2 => [0 => '待分配', 1 => '已配车' ], //配车
|
||||
3 => [0 => '待开票', 1 => '已开票'], //开票
|
||||
4 => [0 => '待销售确认', 1 => '销售已确认',2 => '用户已确认'],//车辆交付
|
||||
5 => [1 => '已完成'], //完成
|
||||
// 6 => [0 => '资料未上传', 1 => '国补审核', 2 => '已审核']
|
||||
];
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct($this->table_name, 'default');
|
||||
}
|
||||
|
||||
/**
|
||||
* Notes:订单状态
|
||||
* Created on: 2021/9/15 10:25
|
||||
* Created by: dengbw
|
||||
* @param $status
|
||||
* @return array
|
||||
*/
|
||||
public function statusAry($status = '')
|
||||
{
|
||||
$status_ary[0] = array('name' => '付款', 'show' => true, 'list' => array(0 => '未付款', 1 => '已付款'),
|
||||
'menu_list' => array(0 => '未付款', 1 => '已付款'), 'menu_default' => 0,'pid_status'=>0);
|
||||
$status_ary[1] = array('name' => '分期办理', 'show' => true, 'list' => array(0 => '分期办理中', 1 => '等待放款' , 2 => '完成按揭'),
|
||||
'menu_list' => array(0 => '分期办理中', 1 => '等待放款' , 2 => '完成按揭'), 'menu_default' => 0,'pid_status'=>1);
|
||||
$status_ary[2] = array('name' => '车辆分配', 'show' => true, 'list' => array(0 => '车辆分配中', 1 => '已配车'),
|
||||
'menu_list' => array(0 => '待分配', 1 => '已配车'), 'menu_default' => 0,'pid_status'=>2);
|
||||
$status_ary[3] = array('name' => '开票相关', 'show' => true, 'list' => array(0 => '待开票', 1 => '已开票'),
|
||||
'menu_list' => array(0 => '待开票' , 1 => '已开票'), 'menu_default' => 0,'pid_status'=>3);
|
||||
$status_ary[4] = array('name' => '交付车辆', 'show' => true, 'list' => array(0 => '待销售确认', 1 => '销售已确认', 2 => '用户已确认'),
|
||||
'menu_list' => array(0 => '待销售确认', 1 => '销售已确认', 2 => '用户已确认'), 'menu_default' => 0,'pid_status'=>4);
|
||||
$status_ary[5] = array('name' => '交易完成', 'show' => true, 'list' => array(), 'menu_list' => array(),'pid_status'=>5);
|
||||
// $status_ary[6] = array('name' => '资料审核', 'show' => true, 'list' => array(0 => '资料未上传', 1 => '国补审核中', 2 => '已审核'),
|
||||
// 'menu_list' => array(0 => '资料未上传', 1 => '国补审核中', 2 => '已审核'), 'menu_default' => 0);
|
||||
if (strlen($status)) {
|
||||
$return_status = $status_ary[$status];
|
||||
} else {
|
||||
$return_status = $status_ary;
|
||||
}
|
||||
return $return_status;
|
||||
}
|
||||
|
||||
public function get_status()
|
||||
{
|
||||
return $this->status_arr;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by Vim
|
||||
* User: lcc
|
||||
* Date: 2021/07/09
|
||||
* Time: 13:47
|
||||
*/
|
||||
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
class Receiver_orders_v2_model extends HD_Model
|
||||
{
|
||||
private $table_name = 'lc_receiver_orders_v2';
|
||||
|
||||
private $status_arr = [0 => '进行中', 1 => '已完成'];
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct($this->table_name, 'default');
|
||||
}
|
||||
|
||||
public function get_status()
|
||||
{
|
||||
return $this->status_arr;
|
||||
}
|
||||
|
||||
public function selectOrders($where = array(), $order = '', $page = 0, $page_size = 20, $count = 0,$fileds="lc_receiver_orders_v2.*")
|
||||
{
|
||||
$this->db->select($fileds.",count(lc_receiver_order_status.status) as total");
|
||||
$this->db->from('lc_receiver_orders_v2');
|
||||
$this->db->join('lc_receiver_order_status', 'lc_receiver_order_status.o_id = lc_receiver_orders_v2.id','left');
|
||||
if ($where) {
|
||||
$this->db->where($where);
|
||||
}
|
||||
$this->db->group_by('lc_receiver_order_status.o_id');
|
||||
$this->db->having('total = 1');
|
||||
if ($count) {
|
||||
$res = $this->db->count_all_results();
|
||||
return $res ? $res : 0;
|
||||
}
|
||||
if ($order) {
|
||||
$this->db->order_by($order);
|
||||
}
|
||||
if ($page) {
|
||||
$offset = ($page - 1) * $page_size;
|
||||
$limit = $page_size;
|
||||
} else {
|
||||
$offset = null;
|
||||
$limit = null;
|
||||
}
|
||||
$this->db->limit($limit, $offset);
|
||||
return $this->db->get()->result_array();
|
||||
}
|
||||
}
|
||||
@@ -25,4 +25,13 @@ class Sys_company_model extends HD_Model
|
||||
|
||||
return $statusAry;
|
||||
}
|
||||
/**
|
||||
* 类型
|
||||
* @return array
|
||||
*/
|
||||
function type_ary(){
|
||||
$typeAry = array(/*'-1' => '删除',*/ '0' => '服务公司', '1' => '销售公司');
|
||||
|
||||
return $typeAry;
|
||||
}
|
||||
}
|
||||
@@ -24,6 +24,7 @@ class Payment_service extends HD_Service{
|
||||
$this->load->model('receiver/order/receiver_order_bills_model','bills_model');
|
||||
$this->load->model('receiver/order/receiver_order_ckcars_model','ckcars_model');
|
||||
$this->load->model('receiver/order/receiver_order_agents_model', 'order_agents_model');
|
||||
$this->load->model('receiver/order/receiver_orders_v2_model');
|
||||
}
|
||||
|
||||
|
||||
@@ -134,120 +135,174 @@ class Payment_service extends HD_Service{
|
||||
* @param date $pay_time 支付时间
|
||||
*/
|
||||
public function after_pay_liche($sid,$pay_price = '',$descrip='',$pay_time=''){
|
||||
if($sid){
|
||||
debug_log("[start] ". __FUNCTION__ . ": sid:".$sid, $this->log_file);
|
||||
$order = $this->app_liche_orders_model->get(array('sid'=>$sid));
|
||||
if(!$order){
|
||||
debug_log("[error] ". __FUNCTION__ . ":{$sid}_订单不存在", $this->log_file);
|
||||
return array('code'=>0,'msg'=>'订单不存在');
|
||||
}
|
||||
if($order['status']>0){
|
||||
debug_log("[error] ". __FUNCTION__ . ":{$sid}_订单已支付", $this->log_file);
|
||||
return array('code'=>0,'msg'=>'订单已支付');
|
||||
}
|
||||
debug_log("[start] ". __FUNCTION__ . ": sid:".$sid, $this->log_file);
|
||||
$order = $this->app_liche_orders_model->get(array('sid'=>$sid));
|
||||
if(!$order){
|
||||
debug_log("[error] ". __FUNCTION__ . ":{$sid}_订单不存在", $this->log_file);
|
||||
return array('code'=>0,'msg'=>'订单不存在');
|
||||
}
|
||||
if($order['status']>0){
|
||||
debug_log("[error] ". __FUNCTION__ . ":{$sid}_订单已支付", $this->log_file);
|
||||
return array('code'=>0,'msg'=>'订单已支付');
|
||||
}
|
||||
switch ($order['type']){
|
||||
case 1: //定金
|
||||
$upd = array('status'=>1,'pay_time'=>date('Y-m-d H:i:s'));
|
||||
$pay_price && $upd['pay_price'] = $pay_price;
|
||||
$descrip && $upd['descrip'] = $descrip;
|
||||
$pay_time && $upd['pay_time'] = $pay_time;
|
||||
$res = $this->app_liche_orders_model->update($upd,array('id'=>$order['id']));
|
||||
if($res) {
|
||||
//更新订单状态
|
||||
$row = $this->orders_model->get(['id' => $order['o_id']]);
|
||||
if ($row) {
|
||||
if(!$this->bills_model->count(['o_id'=>$row['id']])){
|
||||
$this->bills_model->add(['o_id'=>$row['id'],'c_time'=>time]);
|
||||
}
|
||||
if(!$this->order_agents_model->count(['o_id'=>$row['id']])){
|
||||
$this->order_agents_model->add(['o_id'=>$row['id'],'status'=>-1,'c_time'=>time]);
|
||||
}
|
||||
$this->order_signs_model->update(['status' => 2], ['o_id' => $row['id']]);
|
||||
if ($row['payway']) {//全款
|
||||
$status = 2;
|
||||
$this->load->model('receiver/order/receiver_order_ckcars_model', 'next_model');
|
||||
} else {
|
||||
$status = 1;
|
||||
$this->load->model('receiver/order/receiver_order_loans_model', 'next_model');
|
||||
}
|
||||
$next_row = $this->next_model->get(['o_id'=>$row['id']]);
|
||||
$order_update = [
|
||||
'status' => $status,
|
||||
];
|
||||
$row['order_time'] == '0000-00-00 00:00:00' && $order_update['order_time'] = date('Y-m-d H:i:s');
|
||||
$this->orders_model->update($order_update, ['id' => $row['id']]);
|
||||
if(!$next_row){
|
||||
$add_data = [
|
||||
'o_id' => $row['id'],
|
||||
'c_time' => time()
|
||||
];
|
||||
$this->next_model->add($add_data);
|
||||
}
|
||||
}
|
||||
return array('code'=>1,'msg'=>'操作成功');
|
||||
}else{
|
||||
return array('code'=>0,'msg'=>'更新失败');
|
||||
}
|
||||
break;
|
||||
case 2: //服务费
|
||||
case 3: //尾款
|
||||
$upd = array('status'=>1,'pay_time'=>date('Y-m-d H:i:s'));
|
||||
$pay_price && $upd['pay_price'] = $pay_price;
|
||||
$descrip && $upd['descrip'] = $descrip;
|
||||
$pay_time && $upd['pay_time'] = $pay_time;
|
||||
$res = $this->app_liche_orders_model->update($upd,array('id'=>$order['id']));
|
||||
if($res){
|
||||
$p_row = $this->app_liche_orders_model->get(['o_id'=>$order['o_id'],'pid'=>0,'status>='=>0]);
|
||||
$last_p_row = $this->app_liche_orders_model->get(['o_id'=>$order['o_id'],'type'=>3,'pid'=>$p_row['id'],'status>='=>0]); //尾款父订单
|
||||
$where = [
|
||||
'status'=>1,
|
||||
'o_id'=>$order['o_id'],
|
||||
'pid>'=>0
|
||||
];
|
||||
$last_p_row && $where['id <>'] = $last_p_row['id'];
|
||||
$is_pay = $this->app_liche_orders_model->sum('total_price',$where); //已支付金额
|
||||
$this->load->library('receiver/orders_entity');
|
||||
$need_pay_money = $this->orders_entity->recevable_price($order['o_id']);
|
||||
if($is_pay['total_price']>=$need_pay_money){ //完成支付
|
||||
$ckcar_row = $this->ckcars_model->get(['o_id'=>$order['o_id']],'status');
|
||||
$row = $this->orders_model->get(['id'=>$order['o_id']],'id,status');
|
||||
if($row['status']==2 && $ckcar_row['status']==2){
|
||||
$this->ckcars_model->update(['status'=>3],['o_id'=>$row['id']]);
|
||||
$this->orders_model->update(['status'=>3],['id'=>$row['id']]);
|
||||
if(!$this->bills_model->count(['o_id'=>$row['id']])){
|
||||
$this->bills_model->add(['o_id'=>$row['id'],'status'=>1,'c_time'=>time()]);
|
||||
}else{
|
||||
$this->bills_model->update(['status'=>1],['o_id'=>$row['id']]);
|
||||
}
|
||||
}
|
||||
}
|
||||
$last_is_pay = $this->app_liche_orders_model->sum('total_price',['status'=>1,'pid'=>$last_p_row['id']]); //已支付尾款
|
||||
if($last_is_pay['total_price']>=$last_p_row['total_price']){
|
||||
$this->app_liche_orders_model->update(['status'=>1,'pay_time'=>date('Y-m-d H:i:s')],['id'=>$last_p_row['id']]);
|
||||
}
|
||||
return array('code'=>1,'msg'=>'操作成功');
|
||||
}else{
|
||||
return array('code'=>0,'msg'=>'更新失败');
|
||||
}
|
||||
break;
|
||||
case 4: //意向金
|
||||
$upd = array('status'=>1,'pay_time'=>date('Y-m-d H:i:s'));
|
||||
$pay_price && $upd['pay_price'] = $pay_price;
|
||||
$descrip && $upd['descrip'] = $descrip;
|
||||
$pay_time && $upd['pay_time'] = $pay_time;
|
||||
$res = $this->app_liche_orders_model->update($upd,array('id'=>$order['id']));
|
||||
if($res) {
|
||||
//更新订单下定时间
|
||||
$this->orders_model->update(['order_time' => date('Y-m-d H:i:s')], ['id' => $order['o_id']]);
|
||||
return array('code'=>1,'msg'=>'操作成功');
|
||||
}else{
|
||||
return array('code'=>0,'msg'=>'更新失败');
|
||||
}
|
||||
break;
|
||||
default:
|
||||
debug_log("[error] ". __FUNCTION__ . ":{$order['type']}_未知商品类型", $this->log_file);
|
||||
return array('code'=>0,'msg'=>'未知商品类型');
|
||||
}
|
||||
}
|
||||
|
||||
public function after_pay_liche_v2($sid,$pay_price = '',$pay_uid=''){
|
||||
debug_log("[start] ". __FUNCTION__ . ": sid:".$sid, $this->log_file);
|
||||
$order = $this->app_liche_orders_model->get(array('sid'=>$sid));
|
||||
if(!$order){
|
||||
debug_log("[error] ". __FUNCTION__ . ":{$sid}_订单不存在", $this->log_file);
|
||||
return array('code'=>0,'msg'=>'订单不存在');
|
||||
}
|
||||
if($order['status']>0){
|
||||
debug_log("[error] ". __FUNCTION__ . ":{$sid}_订单已支付", $this->log_file);
|
||||
return array('code'=>0,'msg'=>'订单已支付');
|
||||
}
|
||||
$upd = array('status'=>1,'pay_time'=>date('Y-m-d H:i:s'));
|
||||
$pay_price && $upd['pay_price'] = $pay_price;
|
||||
$pay_uid && $upd['pay_uid'] = $pay_uid;
|
||||
$res = $this->app_liche_orders_model->update($upd,array('id'=>$order['id']));
|
||||
if($res) {
|
||||
$p_row = $this->app_liche_orders_model->get(['o_id'=>$order['o_id'],'pid'=>0,'status>='=>0]);
|
||||
$last_p_row = $this->app_liche_orders_model->get(['o_id'=>$order['o_id'],'type'=>3,'pid'=>$p_row['id'],'status>='=>0]); //尾款父订单
|
||||
switch ($order['type']){
|
||||
case 1: //定金
|
||||
$upd = array('status'=>1,'pay_time'=>date('Y-m-d H:i:s'));
|
||||
$pay_price && $upd['pay_price'] = $pay_price;
|
||||
$descrip && $upd['descrip'] = $descrip;
|
||||
$pay_time && $upd['pay_time'] = $pay_time;
|
||||
$res = $this->app_liche_orders_model->update($upd,array('id'=>$order['id']));
|
||||
if($res) {
|
||||
//更新订单状态
|
||||
$row = $this->orders_model->get(['id' => $order['o_id']]);
|
||||
if ($row) {
|
||||
if(!$this->bills_model->count(['o_id'=>$row['id']])){
|
||||
$this->bills_model->add(['o_id'=>$row['id'],'c_time'=>time]);
|
||||
}
|
||||
if(!$this->order_agents_model->count(['o_id'=>$row['id']])){
|
||||
$this->order_agents_model->add(['o_id'=>$row['id'],'status'=>-1,'c_time'=>time]);
|
||||
}
|
||||
$this->order_signs_model->update(['status' => 2], ['o_id' => $row['id']]);
|
||||
if ($row['payway']) {//全款
|
||||
$status = 2;
|
||||
$this->load->model('receiver/order/receiver_order_ckcars_model', 'next_model');
|
||||
} else {
|
||||
$status = 1;
|
||||
$this->load->model('receiver/order/receiver_order_loans_model', 'next_model');
|
||||
}
|
||||
$next_row = $this->next_model->get(['o_id'=>$row['id']]);
|
||||
$order_update = [
|
||||
'status' => $status,
|
||||
];
|
||||
$row['order_time'] == '0000-00-00 00:00:00' && $order_update['order_time'] = date('Y-m-d H:i:s');
|
||||
$this->orders_model->update($order_update, ['id' => $row['id']]);
|
||||
if(!$next_row){
|
||||
$add_data = [
|
||||
'o_id' => $row['id'],
|
||||
'c_time' => time()
|
||||
];
|
||||
$this->next_model->add($add_data);
|
||||
}
|
||||
}
|
||||
return array('code'=>1,'msg'=>'操作成功');
|
||||
}else{
|
||||
return array('code'=>0,'msg'=>'更新失败');
|
||||
$row = $this->receiver_orders_v2_model->get(['id' => $order['o_id']]);
|
||||
if($row['order_time'] == '0000-00-00 00:00:00'){
|
||||
$this->receiver_orders_v2_model->update(['order_time' => date('Y-m-d H:i:s')], ['id' => $row['id']]);
|
||||
}
|
||||
break;
|
||||
case 2: //服务费
|
||||
case 3: //尾款
|
||||
$upd = array('status'=>1,'pay_time'=>date('Y-m-d H:i:s'));
|
||||
$pay_price && $upd['pay_price'] = $pay_price;
|
||||
$descrip && $upd['descrip'] = $descrip;
|
||||
$pay_time && $upd['pay_time'] = $pay_time;
|
||||
$res = $this->app_liche_orders_model->update($upd,array('id'=>$order['id']));
|
||||
if($res){
|
||||
$p_row = $this->app_liche_orders_model->get(['o_id'=>$order['o_id'],'pid'=>0,'status>='=>0]);
|
||||
$last_p_row = $this->app_liche_orders_model->get(['o_id'=>$order['o_id'],'type'=>3,'pid'=>$p_row['id'],'status>='=>0]); //尾款父订单
|
||||
$where = [
|
||||
'status'=>1,
|
||||
'o_id'=>$order['o_id'],
|
||||
'pid>'=>0
|
||||
];
|
||||
$last_p_row && $where['id <>'] = $last_p_row['id'];
|
||||
$is_pay = $this->app_liche_orders_model->sum('total_price',$where); //已支付金额
|
||||
$this->load->library('receiver/orders_entity');
|
||||
$need_pay_money = $this->orders_entity->recevable_price($order['o_id']);
|
||||
if($is_pay['total_price']>=$need_pay_money){ //完成支付
|
||||
$ckcar_row = $this->ckcars_model->get(['o_id'=>$order['o_id']],'status');
|
||||
$row = $this->orders_model->get(['id'=>$order['o_id']],'id,status');
|
||||
if($row['status']==2 && $ckcar_row['status']==2){
|
||||
$this->ckcars_model->update(['status'=>3],['o_id'=>$row['id']]);
|
||||
$this->orders_model->update(['status'=>3],['id'=>$row['id']]);
|
||||
if(!$this->bills_model->count(['o_id'=>$row['id']])){
|
||||
$this->bills_model->add(['o_id'=>$row['id'],'status'=>1,'c_time'=>time()]);
|
||||
}else{
|
||||
$this->bills_model->update(['status'=>1],['o_id'=>$row['id']]);
|
||||
}
|
||||
}
|
||||
}
|
||||
$last_is_pay = $this->app_liche_orders_model->sum('total_price',['status'=>1,'pid'=>$last_p_row['id']]); //已支付尾款
|
||||
if($last_is_pay['total_price']>=$last_p_row['total_price']){
|
||||
$this->app_liche_orders_model->update(['status'=>1,'pay_time'=>date('Y-m-d H:i:s')],['id'=>$last_p_row['id']]);
|
||||
}
|
||||
return array('code'=>1,'msg'=>'操作成功');
|
||||
}else{
|
||||
return array('code'=>0,'msg'=>'更新失败');
|
||||
case 3:
|
||||
$last_is_pay = $this->app_liche_orders_model->sum('total_price',['status'=>1,'pid'=>$last_p_row['id']]); //已支付尾款
|
||||
if($last_is_pay['total_price']>=$last_p_row['total_price']){
|
||||
$this->app_liche_orders_model->update(['status'=>1,'pay_time'=>date('Y-m-d H:i:s')],['id'=>$last_p_row['id']]);
|
||||
}
|
||||
break;
|
||||
case 4: //意向金
|
||||
$upd = array('status'=>1,'pay_time'=>date('Y-m-d H:i:s'));
|
||||
$pay_price && $upd['pay_price'] = $pay_price;
|
||||
$descrip && $upd['descrip'] = $descrip;
|
||||
$pay_time && $upd['pay_time'] = $pay_time;
|
||||
$res = $this->app_liche_orders_model->update($upd,array('id'=>$order['id']));
|
||||
if($res) {
|
||||
//更新订单下定时间
|
||||
$this->orders_model->update(['order_time' => date('Y-m-d H:i:s')], ['id' => $order['o_id']]);
|
||||
return array('code'=>1,'msg'=>'操作成功');
|
||||
}else{
|
||||
return array('code'=>0,'msg'=>'更新失败');
|
||||
}
|
||||
case 4:
|
||||
//更新订单下定时间
|
||||
$this->receiver_orders_v2_model->update(['order_time' => date('Y-m-d H:i:s')], ['id' => $order['o_id']]);
|
||||
break;
|
||||
default:
|
||||
debug_log("[error] ". __FUNCTION__ . ":{$order['type']}_未知商品类型", $this->log_file);
|
||||
return array('code'=>0,'msg'=>'未知商品类型');
|
||||
}
|
||||
$where = [
|
||||
'status'=>1,
|
||||
'o_id'=>$order['o_id'],
|
||||
'pid>'=>0
|
||||
];
|
||||
$last_p_row && $where['id <>'] = $last_p_row['id'];
|
||||
$is_pay = $this->app_liche_orders_model->sum('total_price',$where); //已支付金额
|
||||
$this->load->library('receiver/orders_v2_entity');
|
||||
$need_pay_money = $this->orders_v2_entity->recevable_price($order['o_id']);
|
||||
if($need_pay_money && $is_pay['total_price']>=$need_pay_money){ //完成支付
|
||||
$this->load->library('receiver/orders_status_entity');
|
||||
$this->orders_status_entity->set_status($order['o_id'],0,1);
|
||||
}
|
||||
return array('code'=>1,'msg'=>'操作成功');
|
||||
}else{
|
||||
return array('code'=>0,'msg'=>'更新失败');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+3
-3
@@ -50,9 +50,9 @@ return array(
|
||||
'retry' => 3,
|
||||
|
||||
/* 本地java服务 */
|
||||
// 'java_server' => 'http://192.168.0.16:8080'//28
|
||||
// 'java_server' => 'http://117.25.145.143:8080',
|
||||
'java_server' => '116.62.153.124:9999',//ali
|
||||
'java_server' => 'http://127.0.0.1:8080'
|
||||
// 'java_server' => 'http://39.103.130.218:8080',
|
||||
// 'java_server' => '116.62.153.124:9999',//ali
|
||||
);
|
||||
|
||||
|
||||
|
||||
@@ -135,3 +135,23 @@ create table lc_app_deal_apply (
|
||||
u_time timestamp not null default current_timestamp on update current_timestamp comment '更新时间',
|
||||
primary key (id)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='分销-申请表';
|
||||
|
||||
-- ----------------------------
|
||||
-- Title:审核数据
|
||||
-- Author:lcc
|
||||
-- Table:lc_app_checkdata
|
||||
-- ---------------------------
|
||||
create table lc_app_checkdata (
|
||||
id int(10) unsigned not null auto_increment comment '自增id',
|
||||
cf_id int(10) unsigned not null default '0' comment '来源id,详见haodian项目app.sql',
|
||||
app_id int(10) unsigned not null default '0' comment '应用id',
|
||||
type int(10) unsigned not null default '0' comment '审核类型,详见haodian项目app.sql',
|
||||
datatype char(10) not null default '0' comment '数据类型 img video',
|
||||
dataurl char(200) not null default '' comment '资源地址',
|
||||
ifcheck tinyint(1) not null default '0' comment '审核状态,-1审核未通过,0未审核,1审核通过',
|
||||
descrip text not null comment '描述',
|
||||
jsondata text not null comment '附加字段',
|
||||
c_time int(10) unsigned not null default '0' comment '创建时间',
|
||||
u_time timestamp not null default current_timestamp on update current_timestamp,
|
||||
primary key (id)
|
||||
) engine=innodb default charset=utf8mb4 collate=utf8mb4_0900_ai_ci comment='审核数据'
|
||||
|
||||
+28
-21
@@ -67,30 +67,37 @@ create table lc_app_liche_udata (
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='狸车用户数据表';
|
||||
alter table lc_app_liche_udata add app_uid int(10) unsigned not null default 0 comment '用户id' after cf_id;
|
||||
|
||||
|
||||
-- ----------------------------
|
||||
-- Title:用户购车订单
|
||||
-- Author:lcc
|
||||
-- Table:lc_app_liche_orders
|
||||
-- ---------------------------
|
||||
drop table if exists lc_app_liche_orders;
|
||||
create table lc_app_liche_orders (
|
||||
id int(10) unsigned not null auto_increment comment '自增id',
|
||||
o_id int(10) unsigned not null default '0' comment '订单表id',
|
||||
uid int(10) unsigned not null default '0' comment '用户id',
|
||||
sid varchar(32) not null default '' comment '订单号',
|
||||
mch_id varchar(30) not null default '' comment '支付商户号',
|
||||
pid int(10) unsigned not null default '0' comment '父订单id',
|
||||
brand_id int(10) not null default '0' comment '品牌id',
|
||||
s_id int(10) unsigned not null default '0' comment '车系id',
|
||||
v_id int(10) unsigned not null default '0' comment '车型号',
|
||||
cor_id int(10) not null default '0' comment '车身颜色id',
|
||||
incor_id int(10) unsigned not null default '0' comment '内饰颜色id',
|
||||
total_price decimal(12,2) not null default '0.00' comment '订单价格',
|
||||
pay_price decimal(12,2) not null default '0.00' comment '实付金额',
|
||||
type tinyint(2) unsigned not null default '0' comment '订单类型 1定金 2服务费 3尾款 4意向金 5后台添加',
|
||||
status tinyint(1) not null default '0' comment '支付状态 0未支付 1已支付',
|
||||
pay_time timestamp not null default '0000-00-00 00:00:00' comment '付款时间',
|
||||
c_time int(10) unsigned not null default '0' comment '创建时间',
|
||||
u_time timestamp null default current_timestamp on update current_timestamp,
|
||||
primary key (id)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='用户购车订单';
|
||||
alter table lc_app_liche_orders add descrip varchar(255) not null default '' comment '备注/描述' after pay_price;
|
||||
id int(10) unsigned not null auto_increment comment '自增id',
|
||||
o_id int(10) unsigned not null default '0' comment '订单表id',
|
||||
uid int(10) unsigned not null default '0' comment '用户id',
|
||||
entrust_uid int(10) not null default '0' comment '委托人用户id',
|
||||
pay_uid int(10) not null default '0' comment '付款人用户id',
|
||||
sid varchar(32) not null default '' comment '订单号',
|
||||
mch_id varchar(30) not null default '' comment '支付商户号',
|
||||
pid int(10) unsigned not null default '0' comment '父订单id',
|
||||
brand_id int(10) not null default '0' comment '品牌id',
|
||||
s_id int(10) unsigned not null default '0' comment '车系id',
|
||||
v_id int(10) unsigned not null default '0' comment '车型号',
|
||||
cor_id int(10) not null default '0' comment '车身颜色id',
|
||||
incor_id int(10) unsigned not null default '0' comment '内饰颜色id',
|
||||
company_id int(11) not null default '0' comment '公司id',
|
||||
total_price decimal(12,2) not null default '0.00' comment '订单价格',
|
||||
pay_price decimal(12,2) not null default '0.00' comment '实付金额',
|
||||
descrip varchar(255) not null default '' comment '备注/描述',
|
||||
type tinyint(2) unsigned not null default '0' comment '订单类型 1定金 2服务费 3尾款 4意向金 5后台添加',
|
||||
status tinyint(1) not null default '0' comment '支付状态 0未支付 1已支付',
|
||||
pay_time timestamp not null default '0000-00-00 00:00:00' comment '付款时间',
|
||||
c_time int(10) unsigned not null default '0' comment '创建时间',
|
||||
u_time timestamp null default current_timestamp on update current_timestamp,
|
||||
primary key (id)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='用户购车订单'
|
||||
alter table lc_app_liche_orders add img varchar(100) not null default '' comment '支付截图' after descrip;
|
||||
alter table lc_app_liche_orders add admin_id int(10) not null default 0 comment '管理员id' after uid;
|
||||
|
||||
+2
-1
@@ -30,7 +30,8 @@ create table lc_biz (
|
||||
alter table lc_biz add column type tinyint(1) not null default 0 comment '类型:1-合伙店,2-加盟店,3-代理店' after floor;
|
||||
alter table lc_biz add column company_id int not null default 0 comment '公司ID' after type;
|
||||
alter table lc_biz add column jsondata json null comment '其他数据' after company_id;
|
||||
alter table lc_biz add srv_company_id int(11) not null default 0 comment '收服务费公司ID' after company_id;
|
||||
alter table lc_biz add srv_company_id int(10) not null default 0 comment '收服务费公司ID' after company_id;
|
||||
alter table lc_biz add car_brand_id int(10) not null default 0 comment '车辆品牌' after type;
|
||||
|
||||
-- ----------------------------
|
||||
-- Title:品牌表
|
||||
|
||||
@@ -161,7 +161,7 @@ create table lc_receiver_order_signs (
|
||||
-- Table:lc_receiver_orders
|
||||
--- jsondata if_fine 是否选择精品尊享包
|
||||
-- info_json entrust_name 代办人姓名 entrust_idcard 代办人身份证 name 姓名 sex 性别 nation 民族 birth 出生日期 address 家庭地址 cardid 身份证 c_address 创建时输入的地址 c_cardid 创建时输入的身份证
|
||||
-- money_json price_car 裸车价 price_book 定金 price_insure 保险价格 price_fine 精品报价 price_finance 金融报价 price_loan贷款金额 price_discount优惠金额 price_intention意向金 price_fine_discount精品优惠金额
|
||||
-- money_json price_car 裸车价 price_book 定金 price_insure 保险价格 price_fine 精品报价 price_finance 金融报价 price_loan贷款金额 price_discount优惠金额 price_intention意向金 price_fine_discount精品优惠金额 price_fine_select精品选装总金额
|
||||
-- ---------------------------
|
||||
drop table if exists lc_receiver_orders;
|
||||
create table lc_receiver_orders (
|
||||
|
||||
@@ -206,6 +206,8 @@ create table lc_sys_company (
|
||||
alter table lc_sys_company add column credit_code varchar(18) not null default '' comment '统一社会信用代码' after short;
|
||||
alter table lc_sys_company add column wx_mchid varchar(10) not null default '' comment '微信商户号' after credit_code;
|
||||
alter table lc_sys_company add column img_seal varchar(128) not null default '' comment '公章' after wx_mchid;
|
||||
alter table lc_sys_company add column city_id int(10) unsigned not null default '0' comment '城市id' after wx_mchid;
|
||||
alter table lc_sys_company add column type tinyint(1) not null default 0 comment '公司类型(0服务公司 1销售公司)' after status;
|
||||
|
||||
|
||||
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user