This commit is contained in:
lcc
2024-06-05 15:56:06 +08:00
parent de087abc16
commit f01cf05ceb
5 changed files with 3350 additions and 7 deletions
File diff suppressed because it is too large Load Diff
+592
View File
@@ -0,0 +1,592 @@
<?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;
}
}
?>
+531
View File
@@ -0,0 +1,531 @@
<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']) ? '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']) && $params['status'] == $v['id']) { ?>active<? } ?>">
<a href="javascript:void (0);"
data-open="/receiver/orders?status=<?= $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">
<input name="status_pid" type='hidden' value="<?= $params['status_pid'] ?>">
<input name="status" type='hidden' value="<?= $params['status'] ?>">
<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" style="margin-bottom: 0px;">
<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="order_time" type="text" value="<?= $params['order_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"
data-btn="create">今天</a>
<a class="mr10 id-day-btn" href="javascript:void (0);" data-date="yesterday" data-btn="create">昨日</a>
<a class="mr10 id-day-btn" href="javascript:void (0);" data-date="weeks"
data-btn="create">本周</a>
<a class="mr10 id-day-btn" href="javascript:void (0);" data-date="month"
data-btn="create">本月</a>
</div>
</div>
</div>
<div class="am-form-group" style="margin-bottom: 0px;"></div>
<div class="am-form-group fl" style="margin-bottom: 0px;">
<label class="am-para-label w100">客户来源:</label>
<div class="am-form-group am-para-inline w120">
<select name="of_id" v-model="params.of_id">
<option value="">请选择</option>
<option :value="i" v-for="(v,i) in show_info.offlineSourcesAry">{{v.name}}</option>
</select>
</div>
<div class="am-form-group am-para-inline w120">
<select name="of2_id" v-model="params.of2_id">
<option value="">请选择</option>
<option :value="i" v-for="(v,i) in of2Ary">{{v}}</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="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 fl">
<label class="am-para-label w100">是否开票:</label>
<div class="am-para-inline w100">
<select name="is_bill" v-model="params.is_bill">
<option value="">请选择</option>
<option value="0">否</option>
<option value="1">是</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" 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 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" 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>
</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>
<? foreach ($fieldAry as $v) { ?>
<th width="<?= $v['width'] ?>"><span><?= $v['title'] ?></span></th>
<? } ?>
</tr>
</thead>
<tbody>
<? foreach ($lists as $v) { ?>
<tr>
<? foreach ($fieldAry as $key => $val) { ?>
<td><?= $v[$key] ?></td>
<? } ?>
</tr>
<? } ?>
</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: '~'
});
laydate.render({
elem: '#order-time', range: '~'
});
laydate.render({
elem: '#id-bill-time', range: '~'
});
laydate.render({
elem: '#id-ck-time', range: '~'
});
$('.id-day-btn').click(function () {
var type = $(this).data('date'), date = '', nowDate = new Date();
var beginDate = '', endDate = '';
switch (type) {
case 'today':
endDate = beginDate = nowDate.Format('yyyy-MM-dd');
break;
case 'yesterday':
endDate = beginDate = (new Date(nowDate.getTime() - 86400000)).Format('yyyy-MM-dd');
break;
case 'weeks':
nowDate.setDate(nowDate.getDate() - nowDate.getDay() + 1);
beginDate = nowDate.getFullYear() + "-" + (nowDate.getMonth() + 1) + "-" + nowDate.getDate();
nowDate.setDate(nowDate.getDate() + 6);
endDate = nowDate.getFullYear() + "-" + (nowDate.getMonth() + 1) + "-" + nowDate.getDate();
break;
case 'month':
beginDate = nowDate.getFullYear() + "-" + (nowDate.getMonth() + 1) + "-01";
var day = new Date(nowDate.getFullYear(), nowDate.getMonth() + 1, 0);
endDate = nowDate.getFullYear() + "-" + (nowDate.getMonth() + 1) + "-" + day.getDate();
break;
}
date = beginDate + ' ~ ' + endDate;
// $('#id-create-time').val(date);
switch ($(this).data('btn')) {
case 'create':
$('#id-create-time').val(date);
break;
case 'bill':
$('#id-bill-time').val(date);
break;
case 'ck':
$('#id-ck-time').val(date);
break;
}
});
});
$(function () {
vue_obj = new Vue({
el: '.coms-table-wrap',
data: {
params: [],
searchTpAry: [],
brandAry: [],
seryAry: [],
attrvAry: [],
attrcorAry: [],//车身颜色选项
admins: {cityAry: [], countyAry: [], bizAry: [], list: []},
lists: [],
of2Ary: [],
},
mounted: function () {
var vm = this;
vm.lists = <?=json_encode($lists)?>;
vm.params = <?=json_encode($params)?>;
vm.show_info = <?=json_encode($show_info)?>;
vm.init_brands();
vm.init_citys();
},
methods: {
export_out: function (type) {
var count = <?=$pager['totle'] ? $pager['totle'] : 0?>;
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'}, // 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.params.of_id = '';
that.params.of2_id = '';
that.params.payway = '';
that.params.brand_id = '';
that.params.city_id_admin = '';
that.params.qdjl_id = '';
}
},
watch: {
'params.of_id': function (nv, ov) {
var that = this;
if (nv == '') {
that.params.of2_id = '';
that.of2Ary = [];
} else {
that.of2Ary = that.show_info.offlineSourcesAry[nv]['list'];
}
},
'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>
+3 -1
View File
@@ -61,6 +61,7 @@ class Sign extends Wxapp
'qcode' => base64_encode($result['file']),
'qrcode_count_time' => $time_out,
'item' => $item,
'key' => $key
];
return $data;
}
@@ -70,8 +71,9 @@ class Sign extends Wxapp
{
$cache_key = $this->input_param('key');
$biz_info = $this->app_redis->get($cache_key);
$data = ['key' => $cache_key, 'biz_info' => $biz_info];
if (!$biz_info || !$biz_info['biz_uid'] || !$biz_info['biz_id']) {
return ['type' => 'fail', 'msg' => '二维码过期,请重新扫码签到'];
return ['type' => 'fail', 'msg' => '二维码过期,请重新扫码签到', 'data' => $data];
}
$biz_uid = $biz_info['biz_uid'];
$biz_id = $biz_info['biz_id'];
@@ -86,15 +86,31 @@ class Receiver_customers_model extends HD_Model
public function offlineSources($id = 0)
{
$arr[1] = ['name' => '空间站', 'list' => [20 => '汽车之家', 21 => '平安创展', 22 => '天天拍']];
$arr[2] = ['name' => '营销中心', 'list' => [30 => '抖音本地通', 31 => '抖音拦截', 32 => '抖音直播', 33 => '微信视频号', 34 => '车卖场小程序']];
$arr[3] = ['name' => '卫星门店', 'list' => [40 => '自然到店', 41 => '转介绍', 42 => '自媒体', 43 => '外展外拓', 44 => '汽车之家垂媒', 45 => '懂车帝垂媒', 46 => '易车垂媒']];
$this->load->model('receiver/receiver_clues_cfrom_model', 'clues_cfrom_model');
$arr = [];
if ($id) {
return $arr[$id];
$row = $this->clues_cfrom_model->get(['id' => $id], 'itle');
$lists = [];
if ($row) {
$rows = $this->clues_cfrom_model->select(['pid' => $id], '', 0, 0, 'id,title');
foreach ($rows as $item) {
$lists[$item['id']] = $item['title'];
}
}
$arr['name'] = $rows['title'];
$arr['list'] = $lists;
} else {
return $arr;
$rows = $this->clues_cfrom_model->select(['status' => 1], 'pid asc', 0, 0, 'id,pid,title');
foreach ($rows as $key => $val) {
if (!$val['pid']) { //父级
$arr[$val['id']]['name'] = $val['title'];
} else {
$arr[$val['pid']] && $arr[$val['pid']]['list'][$val['id']] = $val['title'];
}
}
}
return $arr;
}
/**