Files
spacestation/admin/libraries/OrdersList.php
T
2024-06-05 15:56:22 +08:00

593 lines
29 KiB
PHP

<?php
/**
* 订单管理列表
*/
class OrdersList
{
private $ci;
private $searchTpAry = array('name' => '客户姓名', 'mobile' => '客户手机号', 'sid' => '订单号');
private $paywayAry = array(0 => '按揭', 1 => '全款');
private $overAry = array(0 => '7天内', 1 => '14天内', 2 => '30天内', 3 => '大于30天');
public function __construct()
{
$this->ci = &get_instance();
$this->ci->load->model('receiver/order/receiver_orders_model', 'mdOrders');
$this->ci->load->model('app/licheb/app_licheb_users_model', 'mdLichebUsers');
$this->ci->load->model('app/licheb/app_licheb_channel_biz_model');
$this->ci->load->model('receiver/receiver_customers_model', 'mdCustomers');
$this->ci->load->model('receiver/receiver_clues_cfrom_model', 'mdCluesCfrom');
$this->ci->load->model('auto/auto_series_model');
$this->ci->load->model('auto/auto_brand_model');
$this->ci->load->model('auto/auto_cars_model');
$this->ci->load->model('area_model');
$this->ci->load->model("biz/biz_model");
}
public function lists($status_pid, $params = array())
{
!$params['qdjl_id'] && $params['qdjl_id'] = '';
!$params['of_id'] && $params['of_id'] = '';
!$params['of2_id'] && $params['of2_id'] = '';
!strlen($params['payway']) && $params['payway'] = '';
!$params['biz_type'] && $params['biz_type'] = '';
!strlen($params['over_id']) && $params['over_id'] = '';
!strlen($params['is_bill']) && $params['is_bill'] = '';
$fieldAry = $this->get_fields($status_pid, 0, $params['status']);
$show_info['offlineSourcesAry'] = $this->ci->mdCustomers->offlineSources_search();
$show_info['paywayAry'] = $this->paywayAry;//付款方式
//渠道经理
$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;
$order_status_cn = $this->ci->mdOrders->get_status();
$view_type = 'orders';
$where = [
"status>=" => 0,
];
$_title = '全部订单';
$view = 'receiver/orderv2/lists';
$params['status_pid'] == 1 && $where["payway"] = 0;
if (is_product()) {
$where["biz_id<>"] = 1;
}
if ($_SESSION['admin_info']['biz_id']) {
$biz_ids = implode(',', $_SESSION['admin_info']['biz_id']);
$where["biz_id in ($biz_ids)"] = null;
}
if ($params['biz_type']) {
$where["biz_id in (select id from lc_biz where type = " . $params['biz_type'] . ')'] = null;
}
if ($params['of_id'] || $params['of2_id']) {
$where_c = 'status>=0';
$params['of_id'] && $where_c .= ' and of_id = ' . $params['of_id'];
$params['of2_id'] && $where_c .= ' and of2_id = ' . $params['of2_id'];
$where["customer_id in (select id from lc_receiver_customers where " . $where_c . ')'] = null;
}
if (strlen($params['payway'])) {
$where["payway"] = $params['payway'];
}
if ($params['qdjl_id']) {//渠道经理
$where["biz_id in(select biz_id from lc_app_licheb_channel_biz where uid={$params['qdjl_id']})"] = null;
}
if ($params['title']) {
$where["{$params['search_tp']} like '%{$params['title']}%'"] = null;
}
//创建时间
if ($params['c_time']) {
$c_time = explode(' ~ ', $params['c_time']);
if ($c_time[0]) {
$where["c_time >="] = strtotime($c_time[0] . ' 00:00:00');
}
if ($c_time[1]) {
$where["c_time <="] = strtotime($c_time[1] . ' 23:59:59');
}
}
//下定时间
if ($params['order_time']) {
$order_time = explode(' ~ ', $params['order_time']);
if ($order_time[0]) {
$where["order_time >="] = $order_time[0] . ' 00:00:00';
}
if ($order_time[1]) {
$where["order_time <="] = $order_time[1] . ' 23:59:59';
}
}
//开票时间
if ($params['bill_time']) {
$bill_time = explode(' ~ ', $params['bill_time']);
if ($bill_time[0]) {
$where["bill_time >="] = $bill_time[0] . ' 00:00:00';
}
if ($bill_time[1]) {
$where["bill_time <="] = $bill_time[1] . ' 23:59:59';
}
}
//交付时间
if ($params['ck_time']) {
$ck_time = explode(' ~ ', $params['ck_time']);
if ($ck_time[0]) {
$where["ck_time >="] = $ck_time[0] . ' 00:00:00';
}
if ($ck_time[1]) {
$where["ck_time <="] = $ck_time[1] . ' 23:59:59';
}
}
if (strlen($params['is_bill'])) {
if ($params['is_bill']) {
$where["bill_time <> '0000-00-00 00:00:00'"] = null;
} else {
$where["bill_time"] = '0000-00-00 00:00:00';
}
}
//交付时长
if (strlen($params['over_id'])) {
if ($params['over_id'] == 3) {
$where["over_time>"] = date('Y-m-d', time() + 30 * 24 * 60 * 60);
} else {
if ($params['over_id'] == 1) {
$e_day = 14;
} elseif ($params['over_id'] == 2) {
$e_day = 30;
} else {
$e_day = 7;
}
$where["over_time<="] = date('Y-m-d', time() + $e_day * 24 * 60 * 60);
}
}
if ($params['brand_id']) {//品牌
$where["brand_id"] = $params['brand_id'];
} else {
$params['brand_id'] = '';
}
if ($params['series_id']) {//车系
$where["series_id"] = $params['series_id'];
} else {
$params['series_id'] = '';
}
if ($params['v_id']) {//车型
$where["v_id"] = $params['v_id'];
} else {
$params['v_id'] = '';
}
if ($params['cor_id']) {//车身颜色
$where["cor_id"] = $params['cor_id'];
} else {
$params['cor_id'] = '';
}
//销售员筛选
if ($params['admin_id']) {
$where["sale_id"] = $params['admin_id'];
} else {
if ($params['biz_id_admin']) {//指定店铺所有销售员
$where["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["biz_id in({$str_ids})"] = null;
} else {
$where["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 (strlen($params['status_pid'])) {
$where["brand_id>"] = 0;
}
if (strlen($params['status_pid']) && $params['status_pid'] != 21) { //付款-已下定
$where["status <> 2"] = null;
}
if ($params['status_pid'] == 4) { //交付需要开票后才显示
$where["id in (select o_id from lc_receiver_order_status where pid_status=3 and status=1)"] = null;
}
if (strlen($params['status_pid']) && !$params['status_pid']) { //付款列表 下定时间排序
$orderby = "order_time desc";
} elseif ($params['status_pid'] == 3) { // 开票列表 开票时间排序
$orderby = "bill_time desc";
} elseif ($params['status_pid'] == 21) { //退款时间排序
$orderby = "refund_time desc";
} elseif ($params['status_pid'] == 5 || ($params['status'] == 2 && $params['status_pid'] == 4)) { //交付时间排序
$orderby = "ck_time desc,c_time desc";
} else {
$orderby = "c_time desc";
}
$count = $this->ci->mdOrders->count($where);
$rows = $this->ci->mdOrders->select($where, $orderby, $page, $size);
$lists = [];
if ($count) {
//客户来源
$str_rids = implode(',', array_unique(array_column($rows, 'customer_id')));
!$str_rids && $str_rids = 0;
$customers = $this->ci->mdCustomers->map('id', 'of_id,of2_id', array("id in({$str_rids})" => null));
$offlineSources = $this->ci->mdCustomers->offlineSources();
//门店
$str_biz_ids = implode(',', array_unique(array_column($rows, 'biz_id')));
!$str_biz_ids && $str_biz_ids = 0;
$bizs_rows = $this->ci->biz_model->select(array("id in({$str_biz_ids})" => null), '', '', '', 'id,biz_name,city_id,county_id,type');
$bizs = [];
if ($bizs_rows) { //获取城市
$ids = array_unique(array_column($bizs_rows, 'county_id'));
$city_rows = $this->ci->area_model->get_map_by_county_ids($ids, 'id,city_name,city_id', 'city_id');
foreach ($bizs_rows as $val) {
$val['city_name'] = $city_rows[$val['city_id']] ? $city_rows[$val['city_id']][0]['city_name'] : '';
$bizs[$val['id']] = $val;
}
}
//品牌车型
$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, 'series_id'));
$series = $this->ci->auto_series_model->get_map_by_ids($series_arr, 'id,name');
//车系车型
$car_arr = array_unique(array_column($rows, 'car_id'));
$cars = $this->ci->auto_cars_model->get_map_by_ids($car_arr, 'id,name');
$admin_ids = array_unique(array_column($rows, 'admin_id'));
$admin_ids_str = implode(',', $admin_ids);
$admins = [];
if ($admin_ids_str) {
$where = ["id in ($admin_ids_str)" => null];
$admins = $this->ci->mdLichebUsers->map('id', 'uname', $where, 'id desc', 0, 0, 'id,uname'); //顾问
}
foreach ($rows as $key => $val) {
$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['series_id']]) ? $series[$val['series_id']][0]['name'] : '';
$car_name = isset($cars[$val['car_id']]) ? $cars[$val['car_id']][0]['name'] : '';
$money_json = json_decode($val['money_json'], true);
$fields['o_id'] = $val['id'];
$name = $val['name'];
$mobile = $val['mobile'];
$open_url = '/receiver/orderv2/orders/get?id=';
$id_card_append = $info_json['c_owner_cardid'] ? '<br>' . $info_json['c_owner_cardid'] : '';
$id_card = $info_json['c_owner_cardid'] ? '="' . $info_json['c_owner_cardid'] . '"' : '';
$fields['name'] = $size > 1000 ? $name
: '<a href="javascript:;" data-open="' . $open_url . $val['id'] . '">' . $name . '<br>' . $mobile . $id_card_append . '</a>';
$fields['id_card'] = $id_card;
$fields['mobile'] = $size > 1000 ? '="' . $mobile . '"' : $mobile;
$fields['car_name'] = "{$brand_name}-{$series_name}-{$car_name}";
$fields['price_car'] = 0;
$fields['payway_name'] = $this->paywayAry[$val['payway']];
$fields['price'] = $fields['payway_name'] . "<br>" . $fields['price_car'];
$fields['brand_name'] = $brand_name;
$fields['series_name'] = $series_name;
$status_name = $order_status_cn[$val['status']];
$fields['status_name'] = $status_name;
$fields['biz_name'] = $bizs[$val['biz_id']] ? $bizs[$val['biz_id']]['biz_name'] . '<br>' . $admins[$val['admin_id']] : '';
$size > 1000 && $fields['biz_name'] = $bizs[$val['biz_id']] ? $bizs[$val['biz_id']]['biz_name'] : '';
$fields['c_time'] = date('Y-m-d H:i:s', $val['c_time']);
$of_title = '-';
$of_title_1 = $of_title_2 = '';
$of_id = $customers[$val['customer_id']]['of_id'];
if ($of_id) {
$of_ary = $offlineSources[$of_id];
$of_title = $of_ary['name'];
$of_ary['name'] && $of_title_1 = $of_ary['name'];
$of2_id = $customers[$val['customer_id']]['of2_id'];
$of2_id && $of_title .= '-' . $of_ary['list'][$of2_id];
$of2_id && $of_ary['list'][$of2_id] && $of_title_2 = $of_ary['list'][$of2_id];
}
$fields['of_title'] = $of_title;
$fields['of_title_1'] = $of_title_1;
$fields['of_title_2'] = $of_title_2;
$fields['order_time'] = $val['order_time'] != '0000-00-00 00:00:00' ? $val['order_time'] : '';
$fields['bill_time'] = $val['bill_time'] != '0000-00-00 00:00:00' ? $val['bill_time'] : '';
$fields['over_time'] = $val['over_time'] != '0000-00-00 00:00:00' ? date('Y-m-d', strtotime($val['over_time'])) : '';
$fields['refund_time'] = $val['refund_time'] != '0000-00-00 00:00:00' ? date('Y-m-d', strtotime($val['refund_time'])) : '';
$fields['ck_time'] = $val['ck_time'];
if ($size > 1000) {
$user_info = '';
if ($bizs[$val['biz_id']]['type'] == 3) { //代理店显示渠道经理的姓名
$channel_users = $this->ci->app_licheb_channel_biz_model->select(['biz_id' => $val['biz_id']], '', '', '', 'uid');
$user_ids = array_column($channel_users, 'uid');
$user_ids_str = implode(',', $user_ids);
if ($user_ids_str && $user_ids) {
$where = [
'group_id' => 4,
'status' => 1,
"id in ($user_ids_str)" => null
];
$users = $this->ci->mdLichebUsers->select($where, 'id desc', 1, 10, 'uname,biz_id'); //渠道经理
$users && $user_info = implode(' ', array_column($users, 'uname'));
}
$fields['admin_name'] = $user_info;
}
if (!$user_info) {
$sale = $this->ci->mdLichebUsers->get(['id' => $val['sale_id']], 'uname');
$fields['admin_name'] = $sale['uname'];
}
$fields['address'] = $info_json['c_address'];
}
if (!$val['payway']) { //按揭
$fields['pro_loan'] = '';
$fields['price_loan'] = $money_json['price_loan'];
$fields['is_sure'] = '';
$fields['is_tiexi'] = '是';
// 首付按揭
$fields['pro_loan0'] = '222';
$fields['price_loan0'] = 10;
$fields['is_sure0'] = '是';
$fields['is_tiexi'] = '是';
}
$srv_info = [];
$fields['srv_info_total'] = $srv_info['total'] > 0 ? $srv_info['total'] : '';
$fields['srv_info_fee_carno'] = $srv_info['fee_carno'] ? $srv_info['fee_carno'] : '';
$fields['srv_info_price_finance'] = $srv_info['price_finance'] ? $srv_info['price_finance'] : '';
$fields['srv_info_price_fine_select'] = $srv_info['price_fine_select'] ? $srv_info['price_fine_select'] : '';
$fields['srv_info_price_fine_select_detail'] = $srv_info['price_fine_select_detail'] ? $srv_info['price_fine_select_detail'] : '';
$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:意向金订单
* @param array $params
* @return array
*/
private function inten_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();
$view_type = 'orders';
$where = [
"status" => 0,
"id>=" => 10000,
"brand_id" => 0
];
$_title = '全部订单';
$view = 'receiver/orderv2/lists';
$params['status_pid'] == 1 && $where["payway"] = 0;
if (is_product()) {
$where["biz_id<>"] = 1;
}
if ($_SESSION['admin_info']['biz_id']) {
$biz_ids = implode(',', $_SESSION['admin_info']['biz_id']);
$where["biz_id in ($biz_ids)"] = null;
}
if ($params['of_id'] || $params['of2_id']) {
$where_c = 'status>=0';
$params['of_id'] && $where_c .= ' and of_id = ' . $params['of_id'];
$params['of2_id'] && $where_c .= ' and of2_id = ' . $params['of2_id'];
$where["customer_id in (select id from lc_receiver_customers where " . $where_c . ')'] = null;
}
if ($params['qdjl_id']) {//渠道经理
$where["biz_id in(select biz_id from lc_app_licheb_channel_biz where uid={$params['qdjl_id']})"] = null;
}
if ($params['title']) {
$where["{$params['search_tp']} like '%{$params['title']}%'"] = null;
}
//创建时间
if ($params['c_time']) {
$c_time = explode(' ~ ', $params['c_time']);
if ($c_time[0]) {
$where["c_time >="] = strtotime($c_time[0] . ' 00:00:00');
}
if ($c_time[1]) {
$where["c_time <="] = strtotime($c_time[1] . ' 23:59:59');
}
}
//销售员筛选
if ($params['admin_id']) {
$where["sale_id"] = $params['admin_id'];
} else {
if ($params['biz_id_admin']) {//指定店铺所有销售员
$where["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["biz_id in({$str_ids})"] = null;
} else {
$where["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'] = '';
}
$where["id in(select o_id from lc_app_liche_orders where type=4 and status=1 and o_id>=10000)"] = null;
$fileds = "id,name,mobile,brand_id,series_id,v_id,
cor_id,incor_id,money_json,payway,status,c_time,
biz_id,bill_time,customer_id,owner_name,owner_mobile,main_type,info_json,
order_time,bill_time,item_id,over_time";
$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', 'of_id,of2_id', array("id in({$str_rids})" => null));
$offlineSources = $this->ci->mdCustomers->offlineSources();
//门店
$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));
foreach ($rows as $key => $val) {
$info_json = json_decode($val['info_json'], true);
$fields = array();
$fields['o_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=';
$id_card_append = $info_json['c_owner_cardid'] ? '<br>' . $info_json['c_owner_cardid'] : '';
$fields['name'] = $size > 1000 ? $name
: '<a href="javascript:;" data-open="' . $open_url . $val['id'] . '">' . $name . '<br>' . $mobile . $id_card_append . '</a>';
$fields['id_card'] = $info_json['c_owner_cardid'] ? '="' . $info_json['c_owner_cardid'] . '"' : '';
$fields['mobile'] = $size > 1000 ? '="' . $mobile . '"' : $mobile;
$fields['biz_name'] = $bizs[$val['biz_id']];
$fields['c_time'] = date('Y-m-d H:i:s', $val['c_time']);
$of_title = '-';
$of_title_1 = $of_title_2 = '';
$of_id = $customers[$val['customer_id']]['of_id'];
if ($of_id) {
$of_ary = $offlineSources[$of_id];
$of_title = $of_ary['name'];
$of_ary['name'] && $of_title_1 = $of_ary['name'];
$of2_id = $customers[$val['customer_id']]['of2_id'];
$of2_id && $of_title .= '-' . $of_ary['list'][$of2_id];
$of2_id && $of_ary['list'][$of2_id] && $of_title_2 = $of_ary['list'][$of2_id];
}
$fields['of_title'] = $of_title;
$fields['of_title_1'] = $of_title_1;
$fields['of_title_2'] = $of_title_2;
$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, $status)
{
$fields1 = $fields2 = [];
if ($export) {
$fields1['name'] = ['title' => '客户姓名'];
$fields1['mobile'] = ['title' => '客户电话'];
$fields1['id_card'] = ['title' => '证件号码'];
$fields1['brand_name'] = ['title' => '品牌'];
$fields1['series_name'] = ['title' => '车系'];
$fields1['v_name'] = ['title' => '车型'];
$fields1['cor_name'] = ['title' => '车身颜色'];
$fields1['city_name'] = ['title' => '城市'];
$fields1['biz_type'] = ['title' => '门店类型'];
$fields1['biz_name'] = ['title' => '门店'];
$fields1['admin_name'] = ['title' => '销售人员'];
$fields1['of_title_1'] = ['title' => '来源1'];
$fields1['of_title_2'] = ['title' => '来源2'];
} else {
$fields1['name'] = ['title' => '客户', 'width' => '14%'];
}
if (!strlen($status_pid)) {
$fields2 = [
'car_name' => ['title' => '车辆', 'width' => '27%'], 'biz_name' => ['title' => '门店', 'width' => '12%'],
'price' => ['title' => '最终售价', 'width' => '9%'],
'of_title' => ['title' => '客户来源', 'width' => '10%'], 'status_name' => ['title' => '状态', 'width' => '9%'],
'c_time' => ['title' => '订单时间', 'width' => '9%'
]
];
} elseif ($status_pid == 3) {
$fields2 = [
'car_name' => ['title' => '车辆', 'width' => '27%'], 'biz_name' => ['title' => '门店', 'width' => '12%'],
'price' => ['title' => '最终售价', 'width' => '9%'],
// 'payway_name' => ['title' => '付款方式', 'width' => '8%'],
'of_title' => ['title' => '客户来源', 'width' => '10%'], 'status_name' => ['title' => '状态', 'width' => '9%'],
'bill_time' => ['title' => '开票时间', 'width' => '9%']
];
} else {
$fields2 = [
'car_name' => ['title' => '车辆', 'width' => '27%'], 'biz_name' => ['title' => '门店', 'width' => '12%'],
'price' => ['title' => '最终售价', 'width' => '9%'],
'of_title' => ['title' => '客户来源', 'width' => '10%'], 'status_name' => ['title' => '状态', 'width' => '9%'],
'order_time' => ['title' => '下定时间', 'width' => '9%'], 'over_time' => ['title' => '交付截止', 'width' => '9%']
];
if ($status_pid == 21) {
unset($fields2['over_time']);
$fields2['refund_time'] = ['title' => '退款时间', 'width' => '9%'];
}
if ($status_pid == 5 || ($status_pid == 4 && $status == 2)) {
unset($fields2['over_time']);
$fields2['ck_time'] = ['title' => '交付时间', 'width' => '9%'];
}
}
$fields = array_merge($fields1, $fields2);
if ($export) {
unset($fields['price'], $fields['c_time'], $fields['car_name'], $fields['of_title']);
$fields['payway_name'] = ['title' => '付款方式'];
$fields['pro_loan0'] = ['title' => '首付按揭-金融机构'];
$fields['price_loan0'] = ['title' => '首付按揭-金额'];
$fields['is_sure0'] = ['title' => '首付按揭-确认到款(是/否)'];
$fields['pro_loan'] = ['title' => '金融机构'];
$fields['is_tiexi'] = ['title' => '贴息'];
$fields['price_loan'] = ['title' => '按揭金额'];
$fields['is_sure'] = ['title' => '确认到款(是/否)'];
$fields['price_car'] = ['title' => '最终售价'];
$fields['srv_info_total'] = ['title' => '手续费'];
$fields['srv_info_fee_carno'] = ['title' => '手续费-上牌'];
$fields['srv_info_price_finance'] = ['title' => '手续费-按揭'];
$fields['srv_info_price_fine_select'] = ['title' => '手续费-精品选装'];
$fields['srv_info_price_fine_select_detail'] = ['title' => '精品选装内容'];
!$fields['c_time'] && $fields['c_time'] = ['title' => '订单时间'];
!$fields['over_time'] && $fields['over_time'] = ['title' => '止交付时间'];
!$fields['order_time'] && $fields['order_time'] = ['title' => '下定时间'];
!$fields['bill_time'] && $fields['bill_time'] = ['title' => '开票时间'];
$fields['address'] = ['title' => '联系人地址'];
}
return $fields;
}
}
?>