add-admin-inten
This commit is contained in:
@@ -48,7 +48,11 @@ class Ordersv2List
|
||||
//渠道经理
|
||||
$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);
|
||||
if($params['status_pid']==12){ //意向金订单
|
||||
$result = $this->inten_orders($params);
|
||||
}else{
|
||||
$result = $this->orders($params);
|
||||
}
|
||||
$result['show_info'] = $show_info;
|
||||
$result['fieldAry'] = $fieldAry;
|
||||
return $result;
|
||||
@@ -68,7 +72,9 @@ class Ordersv2List
|
||||
$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];
|
||||
$where = [
|
||||
"{$this->t1}.status>=" => 0,
|
||||
];
|
||||
$_title = '全部订单';
|
||||
$view = 'receiver/orderv2/lists';
|
||||
$params['status_pid'] == 1 && $where["{$this->t1}.payway"] = 0;
|
||||
@@ -333,6 +339,142 @@ class Ordersv2List
|
||||
, '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["{$this->t1}.payway"] = 0;
|
||||
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['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["{$this->t1}.customer_id in (select id from lc_receiver_customers where " . $where_c . ')'] = null;
|
||||
}
|
||||
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['admin_id']) {
|
||||
$where["{$this->t1}.sale_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'] = '';
|
||||
}
|
||||
$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,
|
||||
{$this->t1}.order_time,{$this->t1}.bill_time,{$this->t1}.item_id,{$this->t1}.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) {
|
||||
$money_json = json_decode($val['money_json'], true);
|
||||
$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=';
|
||||
$fields['name'] = $size > 1000 ? $name
|
||||
: '<a href="javascript:;" data-open="' . $open_url . $val['id'] . '">' . $name . '<br>' . $mobile . '</a>';
|
||||
$fields['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_id = $customers[$val['customer_id']]['of_id'];
|
||||
if ($of_id) {
|
||||
$of_ary = $offlineSources[$of_id];
|
||||
$of_title = $of_ary['name'];
|
||||
$of2_id = $customers[$val['customer_id']]['of2_id'];
|
||||
$of2_id && $of_title .= '-' . $of_ary['list'][$of2_id];
|
||||
}
|
||||
$fields['of_title'] = $of_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
|
||||
|
||||
@@ -22,6 +22,7 @@ require_once APPPATH.'controllers/wxapp/Wxapp.php';
|
||||
$this->load->model('auto/auto_brand_model');
|
||||
$this->load->model('auto/auto_attr_model');
|
||||
$this->load->model("items/items_model");
|
||||
$this->load->model('app/liche/app_liche_orders_model');
|
||||
|
||||
$this->load->library('receiver/orders_v2_entity');
|
||||
$this->load->library('receiver/orders_status_entity');
|
||||
@@ -182,6 +183,13 @@ require_once APPPATH.'controllers/wxapp/Wxapp.php';
|
||||
$res = $this->orders_v2_entity->create_pdf($row['id']);
|
||||
if($res['code']){
|
||||
$deal_res = $this->deal_entity->deal_log($row['id']);
|
||||
if($row['order_time']!='0000-00-00 00:00:00'){
|
||||
$int_row = $this->app_liche_orders_model->get(['o_id'=>$row['id'],'type'=>4,'status'=>1]);
|
||||
$dep_row = $this->app_liche_orders_model->get(['o_id'=>$row['id'],'type'=>1,'status'=>1]);
|
||||
if($int_row['pay_price']==$dep_row['pay_price']){ //意向金等于定金更新下单时间
|
||||
$this->receiver_orders_v2_model->update(['order_time'=>date('Y-m-d H:i:s')],['id'=>$row['id']]);
|
||||
}
|
||||
}
|
||||
throw new Exception('操作成功', API_CODE_SUCCESS);
|
||||
}else{
|
||||
throw new Exception($res['msg'], API_CODE_FAIL);
|
||||
|
||||
@@ -115,7 +115,7 @@ class Wxnotify_v3 extends CI_Controller{
|
||||
$this->load->service('apporder/payment_service', array('app_id' => $this->app_id));
|
||||
if($order['o_id']>=Orders_v2_entity::V2_START_ID){
|
||||
$is_ts = false;
|
||||
if(!$this->app_liche_orders_model->count(['status'=>1,'o_id'=>$order['o_id']])){
|
||||
if(!$this->app_liche_orders_model->count(['status'=>1,'o_id'=>$order['o_id'],'type!='=>1])){
|
||||
$is_ts = true;
|
||||
}
|
||||
$this->load->model('app/liche/app_liche_users_model');
|
||||
|
||||
@@ -184,11 +184,11 @@ class Qyrobot{
|
||||
$month_e_time = date('Y-m-t H:i:s');
|
||||
}
|
||||
$sql = "select count(*) as total from (select min(pay_time) as pay_time from lc_app_liche_orders
|
||||
where o_id>=10000 and status=1 and pid!=0 and pay_price>0 and pay_time!='0000-00-00 00:00:00' and pay_price>{$min_price} group by o_id order by o_id desc)a
|
||||
where o_id>=10000 and status=1 and pid!=0 and pay_price>0 and pay_time!='0000-00-00 00:00:00' and type <> 4 and pay_price>{$min_price} group by o_id order by o_id desc)a
|
||||
where pay_time>='{$today_s_time}' and pay_time<='{$today_e_time}'";
|
||||
$today_query = $this->ci->db->query($sql)->row_array();
|
||||
$sql = "select count(*) as total from (select min(pay_time) as pay_time from lc_app_liche_orders
|
||||
where o_id>=10000 and status=1 and pid!=0 and pay_price>0 and pay_time!='0000-00-00 00:00:00' and pay_price>{$min_price} group by o_id order by o_id desc)a
|
||||
where o_id>=10000 and status=1 and pid!=0 and pay_price>0 and pay_time!='0000-00-00 00:00:00' and type <> 4 and pay_price>{$min_price} group by o_id order by o_id desc)a
|
||||
where pay_time>='{$month_s_time}' and pay_time<='{$month_e_time}'";
|
||||
$month_query = $this->ci->db->query($sql)->row_array();
|
||||
$today_count = $today_query['total'];
|
||||
|
||||
@@ -36,7 +36,9 @@ class Receiver_order_status_model extends HD_Model
|
||||
*/
|
||||
public function statusAry($status = '')
|
||||
{
|
||||
$status_ary[0] = array('name' => '付款', 'show' => true, 'list' => array(0 => '未付款' ,1 => '已下定', 2 => '已付款'),
|
||||
$status_ary[12] = array('name' => '意向金', 'show' => true, 'list' => array(), 'menu_list' => array(),'pid_status'=>'');
|
||||
|
||||
$status_ary[0] = array('name' => '付款', 'show' => true, 'list' => array(0 => '未付款', 1 => '已下定', 2 => '已付款'),
|
||||
'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);
|
||||
|
||||
@@ -271,9 +271,6 @@ class Payment_service extends HD_Service{
|
||||
switch ($order['type']){
|
||||
case 1: //定金
|
||||
$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 3:
|
||||
$last_is_pay = $this->app_liche_orders_model->sum('total_price',['status'=>1,'pid'=>$last_p_row['id']]); //已支付尾款
|
||||
|
||||
Reference in New Issue
Block a user