liche update for admin goods show sold lists
This commit is contained in:
@@ -165,4 +165,38 @@ class Member extends HD_Controller{
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
function json_lists(){
|
||||
$biz_id = $this->input->post('biz_id');
|
||||
$status = $this->input->post('status');
|
||||
$page = $this->input->post('page');
|
||||
$size = $this->input->post('size');
|
||||
|
||||
$where = array();
|
||||
if(strlen($status) > 0){
|
||||
$where['status'] = $status;
|
||||
} else {
|
||||
$whre['status > -1'] = null;
|
||||
}
|
||||
$biz_id && $where['biz_id'] = $biz_id;
|
||||
|
||||
$total = $this->userM->count($where);
|
||||
|
||||
$lists = array();
|
||||
if($total){
|
||||
$orderby = 'id desc';
|
||||
$select = 'id,uname';
|
||||
$rows = $this->userM->select($where, $orderby, $page, $size, $select);
|
||||
|
||||
foreach($rows as $v){
|
||||
$lists[] = array(
|
||||
'id' => $v['id'],
|
||||
'title' => $v['uname'],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
$this->data = array('total' => $total, 'list' => $lists);
|
||||
return $this->show_json(SYS_CODE_SUCCESS);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,33 +31,44 @@ class Goods extends HD_Controller
|
||||
$params = $this->input->get();
|
||||
$page = $params['page'] = $params['page'] ? intval($params['page']) : 1;
|
||||
$size = $params['size'] = $params['size'] ? intval($params['size']) : 20;
|
||||
$where = $where_fine = $autoList = array();
|
||||
$search_type = 0;
|
||||
$where = $where_1 = $where_2 = $where_3 = $autoList = array();
|
||||
$search_type = 0;//0不连表,1联表筛选精品,2联表筛选销售,3联表筛选精品和销售
|
||||
if ($params['brand_id']) {
|
||||
$where['brand_id'] = $params['brand_id'];
|
||||
$where_fine['brand_id'] = $params['brand_id'];
|
||||
$where_1['brand_id'] = $params['brand_id'];
|
||||
$where_2['m.brand_id'] = $params['brand_id'];
|
||||
$where_3['m.brand_id'] = $params['brand_id'];
|
||||
$autoList[2] = $this->mdAutoSeries->select(array('status' => 1, 'brand_id' => $params['brand_id']), 'id desc', 0, 0, 'id,name');
|
||||
}
|
||||
if ($params['s_id']) {
|
||||
$where['s_id'] = $params['s_id'];
|
||||
$where_fine['s_id'] = $params['s_id'];
|
||||
$where_1['s_id'] = $params['s_id'];
|
||||
$where_2['m.s_id'] = $params['s_id'];
|
||||
$where_3['m.s_id'] = $params['s_id'];
|
||||
$autoList[3] = $this->mdAutoAttr->select(array('type' => 1, 's_id' => $params['s_id']), 'id desc', 0, 0, 'id,title as name');
|
||||
}
|
||||
if ($params['v_id']) {
|
||||
$where['v_id'] = $params['v_id'];
|
||||
$where_fine['v_id'] = $params['v_id'];
|
||||
$where_1['v_id'] = $params['v_id'];
|
||||
$where_2['m.v_id'] = $params['v_id'];
|
||||
$where_3['m.v_id'] = $params['v_id'];
|
||||
}
|
||||
//车身颜色
|
||||
if ($params['cor_id']) {
|
||||
$where['cor_id'] = $params['cor_id'];
|
||||
$where_fine['cor_id'] = $params['cor_id'];
|
||||
$where_1['cor_id'] = $params['cor_id'];
|
||||
$where_2['m.cor_id'] = $params['cor_id'];
|
||||
$where_3['m.cor_id'] = $params['cor_id'];
|
||||
} else {
|
||||
$params['cor_id'] = '';
|
||||
}
|
||||
|
||||
//地址筛选
|
||||
if($params['addr_id']){
|
||||
$where['addr_id'] = $params['addr_id'];
|
||||
$where_fine['addr_id'] = $params['addr_id'];
|
||||
$where_1['addr_id'] = $params['addr_id'];
|
||||
$where_2['m.addr_id'] = $params['addr_id'];
|
||||
$where_3['m.addr_id'] = $params['addr_id'];
|
||||
} else if($params['city_id']){
|
||||
$where_addr = array('status>0' => null, 'city_id' => $params['city_id']);
|
||||
if($params['county_id']){
|
||||
@@ -69,41 +80,89 @@ class Goods extends HD_Controller
|
||||
if($rows_addr){
|
||||
$str_ids = implode(',', array_column($rows_addr, 'id'));
|
||||
$where["addr_id in ({$str_ids})"] = null;
|
||||
$where_fine["addr_id in ({$str_ids})"] = null;
|
||||
$where_1["addr_id in ({$str_ids})"] = null;
|
||||
$where_2["m.addr_id in ({$str_ids})"] = null;
|
||||
$where_3["m.addr_id in ({$str_ids})"] = null;
|
||||
} else {
|
||||
$where['addr_id'] = -1;
|
||||
$where_fine['addr_id'] = -1;
|
||||
$where_1['addr_id'] = -1;
|
||||
$where_2['m.addr_id'] = -1;
|
||||
$where_3['m.addr_id'] = -1;
|
||||
}
|
||||
} else {
|
||||
$params['city_id'] = '';
|
||||
$params['county_id'] = '';
|
||||
$params['addr_id'] = '';
|
||||
}
|
||||
if(strlen($params['status'])>0){
|
||||
|
||||
if(2 == $params['status']){//已售
|
||||
$where['status'] = $params['status'];
|
||||
$where_fine['m.status'] = $params['status'];
|
||||
$where_1['m.status'] = $params['status'];
|
||||
$where_2['m.status'] = $params['status'];
|
||||
$where_3['m.status'] = $params['status'];
|
||||
$view = '/items/goods/lists_sold';
|
||||
$_title = '已售车辆';
|
||||
} else {
|
||||
$params['status'] = '';
|
||||
$where['status'] = 1;
|
||||
$where_1['m.status'] = 1;
|
||||
$where_2['m.status'] = 1;
|
||||
$where_3['m.status'] = 1;
|
||||
$view = '/items/goods/lists';
|
||||
$_title = '未售车辆';
|
||||
}
|
||||
|
||||
if($params['vin']){
|
||||
$where["vin like '%{$params['vin']}%'"] = null;
|
||||
$where_fine["vin like '%{$params['vin']}%'"] = null;
|
||||
$where_1["vin like '%{$params['vin']}%'"] = null;
|
||||
$where_2["m.vin like '%{$params['vin']}%'"] = null;
|
||||
$where_3["m.vin like '%{$params['vin']}%'"] = null;
|
||||
}
|
||||
//精品筛选
|
||||
if($params['fine_ids']){
|
||||
$fine_num = substr_count($params['fine_ids'], ',') + 1;
|
||||
$where_fine["type_id in ({$params['fine_ids']})"] = null;
|
||||
$where_fine["having"] = "fine_num={$fine_num}";
|
||||
$search_type = 1;
|
||||
$where_1["type_id in ({$params['fine_ids']})"] = null;
|
||||
$where_1["having"] = "fine_num={$fine_num}";
|
||||
$where_2["j2.type_id in ({$params['fine_ids']})"] = null;
|
||||
$where_2["having"] = "fine_num={$fine_num}";
|
||||
$search_type = 0 == $search_type || 1 == $search_type ? 1: 3;
|
||||
} else {
|
||||
$params['fine_ids'] = '';
|
||||
}
|
||||
//是否选入精品
|
||||
if(strlen($params['is_fine']) > 0){
|
||||
if(1 == $params['is_fine']){
|
||||
$where_1["j.type_id>0"] = null;
|
||||
$where_1["having"] = "fine_num>0";
|
||||
$where_3["j2.type_id>0"] = null;
|
||||
$where_3["having"] = "fine_num>0";
|
||||
} else {
|
||||
$where_1["j.type_id is null"] = null;
|
||||
$where_3["j2.type_id is null"] = null;
|
||||
}
|
||||
$search_type = 0 == $search_type || 1 == $search_type ? 1: 3;
|
||||
} else {
|
||||
$params['is_fine'] = '';
|
||||
}
|
||||
|
||||
//销售员筛选
|
||||
if($params['admin_id']){
|
||||
$search_type = 0 == $search_type || 2 == $search_type ? 2 : 3;
|
||||
$where_2['j.admin_id'] = $params['admin_id'];
|
||||
$where_3['j.admin_id'] = $params['admin_id'];
|
||||
} else {
|
||||
$params['city_id_admin'] = '';
|
||||
$params['county_id_admin'] = '';
|
||||
$params['biz_id_admin'] = '';
|
||||
$params['admin_id'] = '';
|
||||
}
|
||||
|
||||
$order = 'id';
|
||||
if('fine_num' == $params['order']){
|
||||
if('fine_num' == $params['order']){//精品标签数排序
|
||||
$order = $params['order'];
|
||||
$search_type = 1;
|
||||
$search_type = 0 == $search_type || 1 == $search_type ? 1: 3;
|
||||
} else if('admin_id' == $params['order']){//销售员ID排序
|
||||
$order = $params['order'];
|
||||
$search_type = 0 == $search_type || 2 == $search_type ? 2 : 3;
|
||||
} else if($params['order']){
|
||||
$order = $params['order'];
|
||||
} else {
|
||||
@@ -117,75 +176,184 @@ class Goods extends HD_Controller
|
||||
}
|
||||
|
||||
$autoList[1] = $this->mdAutoBrand->select(array('status' => 1), 'id desc', 0, 0, 'id,name');
|
||||
if(1 == $search_type){
|
||||
//精品筛选
|
||||
$count = $this->mdItems->count_fine($where_fine);
|
||||
} else {
|
||||
$count = $this->mdItems->count($where);
|
||||
switch($search_type){
|
||||
case 1://精品筛选
|
||||
$count = $this->mdItems->count_fine($where_1);
|
||||
break;
|
||||
case 2://订单筛选
|
||||
$count = $this->mdItems->count_order($where_2);
|
||||
break;
|
||||
case 3://精品+订单筛选
|
||||
$count = $this->mdItems->count_order_fine($where_3);
|
||||
break;
|
||||
default:
|
||||
$count = $this->mdItems->count($where);
|
||||
}
|
||||
$lists = array();
|
||||
$fine_ids = array();
|
||||
if ($count) {
|
||||
if(1 == $search_type){
|
||||
//精品筛选
|
||||
$fileds = 'id,brand_id,s_id,vin,v_id,cor_id,incor_id,in_time,addr_id,count(type_id) as fine_num';
|
||||
$orderby = "{$order} {$sort}";
|
||||
$rows = $this->mdItems->select_fine($where_fine, $orderby, $page, $size, $fileds);
|
||||
} else {
|
||||
$fileds = 'id,brand_id,s_id,vin,v_id,cor_id,incor_id,in_time,addr_id';
|
||||
$orderby = "{$order} {$sort}";
|
||||
$rows = $this->mdItems->select($where, $orderby, $page, $size, $fileds);
|
||||
switch($search_type){
|
||||
case 1://精品筛选
|
||||
$fileds = 'id,brand_id,s_id,vin,v_id,cor_id,incor_id,in_time,addr_id,count(type_id) as fine_num';
|
||||
$orderby = "{$order} {$sort}";
|
||||
$rows = $this->mdItems->select_fine($where_1, $orderby, $page, $size, $fileds);
|
||||
break;
|
||||
case 2://订单筛选
|
||||
$fileds = 'm.id, m.brand_id, m.s_id, m.vin, m.v_id, m.cor_id, m.incor_id, m.in_time, m.addr_id';
|
||||
$orderby = "{$order} {$sort}";
|
||||
$rows = $this->mdItems->select_order($where_2, $orderby, $page, $size, $fileds);
|
||||
break;
|
||||
case 3://精品+订单筛选
|
||||
$fileds = 'm.id, m.brand_id, m.s_id, m.vin, m.v_id, m.cor_id, m.incor_id, m.in_time, m.addr_id, count(j2.type_id) as fine_num';
|
||||
if(in_array($order, array('admin_id'))){
|
||||
$orderby = "{$order} {$sort}";
|
||||
} else {
|
||||
$orderby = "m.{$order} {$sort}";
|
||||
}
|
||||
$rows = $this->mdItems->select_order_fine($where_3, $orderby, $page, $size, $fileds);
|
||||
break;
|
||||
default:
|
||||
$fileds = 'id,brand_id,s_id,vin,v_id,cor_id,incor_id,in_time,addr_id';
|
||||
$orderby = "{$order} {$sort}";
|
||||
$rows = $this->mdItems->select($where, $orderby, $page, $size, $fileds);
|
||||
}
|
||||
|
||||
$brand_id_arr = array();
|
||||
$addr_ids = array();
|
||||
$brand_ids = $s_ids = $attr_vids = $attr_corids = $attr_incorids = $addr_ids = array();
|
||||
$ids = array();
|
||||
foreach($rows as $v){
|
||||
$ids[] = $v['id'];
|
||||
!in_array($v['brand_id'], $brand_id_arr) && $brand_id_arr[] = $v['brand_id'];
|
||||
$v['brand_id'] && !in_array($v['brand_id'], $brand_ids) && $brand_ids[] = $v['brand_id'];
|
||||
$v['addr_id'] && !in_array($v['addr_id'], $addr_ids) && $addr_ids[] = $v['addr_id'];
|
||||
$v['s_id'] && !in_array($v['s_id'], $s_ids) && $s_ids[] = $v['s_id'];
|
||||
$v['v_id'] && !in_array($v['v_id'], $attr_vids) && $attr_vids[] = $v['v_id'];
|
||||
$v['cor_id'] && !in_array($v['cor_id'], $attr_corids) && $attr_corids[] = $v['cor_id'];
|
||||
$v['incor_id'] && !in_array($v['incor_id'], $attr_incorids) && $attr_incorids[] = $v['incor_id'];
|
||||
}
|
||||
$map_brand = $map_sery = $map_vid = $map_corid = $map_incorid = $map_addr = array();
|
||||
if($brand_ids){
|
||||
$str_ids = implode(',', $brand_ids);
|
||||
$where = array("id in ({$str_ids})" => null);
|
||||
$map_brand = $this->mdAutoBrand->map('id', 'name', $where);
|
||||
}
|
||||
if($s_ids){
|
||||
$str_ids = implode(',', $s_ids);
|
||||
$where = array("id in ({$str_ids})" => null);
|
||||
$map_sery = $this->mdAutoSeries->map('id', 'name', $where);
|
||||
}
|
||||
if($attr_vids){
|
||||
$str_ids = implode(',', $attr_vids);
|
||||
$where = array("id in ({$str_ids})" => null);
|
||||
$map_vid = $this->mdAutoAttr->map('id', 'title', $where);
|
||||
}
|
||||
if($attr_corids){
|
||||
$str_ids = implode(',', $attr_corids);
|
||||
$where = array("id in ({$str_ids})" => null);
|
||||
$map_corid = $this->mdAutoAttr->map('id', 'title', $where);
|
||||
}
|
||||
if($attr_incorids){
|
||||
$str_ids = implode(',', $attr_incorids);
|
||||
$where = array("id in ({$str_ids})" => null);
|
||||
$map_incorid = $this->mdAutoAttr->map('id', 'title', $where);
|
||||
}
|
||||
$brands_rows = $this->mdAutoBrand->get_map_by_ids($brand_id_arr, 'id,name');
|
||||
$series_id_arr = array_unique(array_column($rows, 's_id'));
|
||||
$series_rows = $this->mdAutoSeries->get_map_by_ids($series_id_arr, 'id,name');
|
||||
$attr_vid_arr = array_unique(array_column($rows, 'v_id'));
|
||||
$attr_vid_rows = $this->mdAutoAttr->get_map_by_ids($attr_vid_arr, 'id,title');
|
||||
$attr_corid_arr = array_unique(array_column($rows, 'cor_id'));
|
||||
$attr_corid_rows = $this->mdAutoAttr->get_map_by_ids($attr_corid_arr, 'id,title');
|
||||
$attr_incorid_arr = array_unique(array_column($rows, 'incor_id'));
|
||||
$attr_incorid_rows = $this->mdAutoAttr->get_map_by_ids($attr_incorid_arr, 'id,title');
|
||||
//获取存放地址
|
||||
$map_addr = array();
|
||||
if($addr_ids){
|
||||
$str_ids = implode(',', $addr_ids);
|
||||
$where = array("id in ({$str_ids})" => null);
|
||||
$orderby = 'id desc';
|
||||
$select = 'id, title';
|
||||
$map_addr = $this->addr_model->map('id', 'title', $where, $orderby, 0, 0, $select);
|
||||
}
|
||||
//获取精品加装
|
||||
$str_ids = implode(',', $ids);
|
||||
$where = array("item_id in ({$str_ids})" => null, 'type' => 1, 'status' => 1);
|
||||
$rows_fine = $this->items_relate_model->select($where, '', 0, 0, 'item_id, type_id');
|
||||
$map_fine = array();
|
||||
foreach($rows_fine as $v){
|
||||
!in_array($v['type_id'], $fine_ids) && $fine_ids[] = $v['type_id'];
|
||||
$map_fine[$v['item_id']][] = $v['type_id'];
|
||||
$select = 'id, title, city_name, county_name';
|
||||
$map_addr = $this->addr_model->map('id', '*', $where, $orderby, 0, 0, $select);
|
||||
}
|
||||
|
||||
foreach ($rows as $key => $val) {
|
||||
$setVal = array();
|
||||
$setVal['id'] = $val['id'];
|
||||
$setVal['brand_name'] = isset($brands_rows[$val['brand_id']]) ? $brands_rows[$val['brand_id']][0]['name'] : '';
|
||||
$setVal['s_name'] = isset($series_rows[$val['s_id']]) ? $series_rows[$val['s_id']][0]['name'] : '';
|
||||
$setVal['v_name'] = isset($attr_vid_rows[$val['v_id']]) ? $attr_vid_rows[$val['v_id']][0]['title'] : '';
|
||||
$setVal['cor_name'] = isset($attr_corid_rows[$val['cor_id']]) ? $attr_corid_rows[$val['cor_id']][0]['title'] : '';
|
||||
$setVal['incor_name'] = isset($attr_incorid_rows[$val['incor_id']]) ? $attr_incorid_rows[$val['incor_id']][0]['title'] : '';
|
||||
$setVal['vin'] = $val['vin'];
|
||||
$setVal['address'] = $val['addr_id'] ? $map_addr[$val['addr_id']] : '';
|
||||
$setVal['in_time'] = '0000-00-00 00:00:00' == $val['in_time'] ? '' : $val['in_time'];
|
||||
$setVal['fine_ids'] = $map_fine[$val['id']] ? $map_fine[$val['id']] : array();
|
||||
$lists[] = $setVal;
|
||||
$map_fine = array();
|
||||
$map_item_admin = array();
|
||||
if($ids){
|
||||
if(1 == $params['status']){
|
||||
//获取精品加装
|
||||
$str_ids = implode(',', $ids);
|
||||
$where = array("item_id in ({$str_ids})" => null, 'type' => 1, 'status' => 1);
|
||||
$rows_fine = $this->items_relate_model->select($where, '', 0, 0, 'item_id, type_id');
|
||||
$map_item_fine = array();//按item_id分组所属精品ID
|
||||
foreach($rows_fine as $v){
|
||||
!in_array($v['type_id'], $fine_ids) && $fine_ids[] = $v['type_id'];
|
||||
$map_item_fine[$v['item_id']][] = $v['type_id'];
|
||||
}
|
||||
//获取精品ID和名称映射
|
||||
if($fine_ids){
|
||||
$this->load->model('auto/auto_fine_model');
|
||||
$str_ids = implode(',', $fine_ids);
|
||||
$where= array("id in ({$str_ids})" => null);
|
||||
$map_fine = $this->auto_fine_model->map('id', 'title', $where);
|
||||
}
|
||||
}
|
||||
|
||||
//获取销售员信息
|
||||
if(2 == $params['status']){
|
||||
//订单列表
|
||||
$this->load->model('receiver/order/receiver_orders_model','orders_model');
|
||||
$str_ids = implode(',', $ids);
|
||||
$where = array("item_id in ({$str_ids})" => null);
|
||||
$rows_order = $this->orders_model->select($where, 'id desc', 0, 0, 'item_id, admin_id');
|
||||
$admin_ids = array();
|
||||
foreach($rows_order as $v){
|
||||
$map_item_admin[$v['item_id']] = array('admin_id' => $v['admin_id']);
|
||||
$v['admin_id'] && !in_array($v['admin_id'], $admin_ids) && $admin_ids[] = $v['admin_id'];
|
||||
}
|
||||
if($admin_ids){
|
||||
//销售员列表
|
||||
$this->load->model('app/licheb/app_licheb_users_model', 'licheb_users_model');
|
||||
$str_ids = implode(',', $admin_ids);
|
||||
$where = array("id in({$str_ids})" => null);
|
||||
$select = 'id, uname, biz_id';
|
||||
$rows_admin = $this->licheb_users_model->select($where, 'id desc', 0, 0, $select);
|
||||
if($rows_admin){
|
||||
$biz_ids = array();
|
||||
$map_admin = array();
|
||||
$map_biz_name = array();
|
||||
foreach($rows_admin as $v){
|
||||
$map_admin[$v['id']] = $v;
|
||||
!in_array($v['biz_id'], $biz_ids) && $biz_ids[] = $v['biz_id'];
|
||||
}
|
||||
if($biz_ids){//店铺列表
|
||||
$this->load->model("biz/biz_model");
|
||||
$str_ids = implode(',', $biz_ids);
|
||||
$where = array("id in({$str_ids})" => null);
|
||||
$map_biz_name = $this->biz_model->map('id', 'biz_name', $where);
|
||||
}
|
||||
|
||||
foreach($map_item_admin as $k => $v){
|
||||
$admin_id = $v['admin_id'];
|
||||
$admin = $map_admin[$admin_id];
|
||||
if(!$admin){
|
||||
continue;
|
||||
}
|
||||
$biz_name = $map_biz_name[$admin['biz_id']];
|
||||
$admin_name = "{$biz_name} {$admin['uname']}";
|
||||
$map_item_admin[$k] = array(
|
||||
'admin_id' => $admin_id,
|
||||
'biz_id' => $admin['biz_id'],
|
||||
'admin_name' => $admin_name
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
foreach ($rows as $k => $v) {
|
||||
$admin = $map_item_admin[$v['id']];
|
||||
$lists[] = array(
|
||||
'id' => $v['id'],
|
||||
'brand_name' => $map_brand[$v['brand_id']],
|
||||
's_name' => $map_sery[$v['s_id']],
|
||||
'v_name' => $map_vid[$v['v_id']],
|
||||
'cor_name' => $map_corid[$v['cor_id']],
|
||||
'incor_name' => $map_incorid[$v['incor_id']],
|
||||
'vin' => $v['vin'],
|
||||
'address' => $v['addr_id'] ? $map_addr[$v['addr_id']] : '',
|
||||
'in_time' => '0000-00-00 00:00:00' == $v['in_time'] ? '' : $v['in_time'],
|
||||
'fine_ids' => $map_fine[$v['id']] ? $map_fine[$v['id']] : array(),
|
||||
'admin_name' => $admin ? $admin['admin_name'] : '',
|
||||
);
|
||||
}
|
||||
}
|
||||
$this->data['lists'] = $lists;
|
||||
@@ -194,8 +362,8 @@ class Goods extends HD_Controller
|
||||
$this->data['params'] = $params;
|
||||
$this->data['autoList'] = $autoList;
|
||||
$this->data['statusAry'] = $this->statusAry;
|
||||
$this->data['_title'] = '商品管理';
|
||||
return $this->show_view('/items/goods/lists', true);
|
||||
$this->data['_title'] = $_title;
|
||||
return $this->show_view($view, true);
|
||||
}
|
||||
|
||||
public function get()
|
||||
|
||||
@@ -142,7 +142,7 @@
|
||||
if(that.params.biz_id>0){
|
||||
var biz_id = '';
|
||||
for(var i in that.bizAry){
|
||||
if(that.params.biz_id == thayt.bizAry[i].id){
|
||||
if(that.params.biz_id == that.bizAry[i].id){
|
||||
biz_id = that.params.biz_id;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -92,6 +92,7 @@
|
||||
action="/items/goods/goods">
|
||||
<input title="排序字段" type="hidden" name="order" id="order" v-model="params.order"/>
|
||||
<input title="排序方向" type="hidden" name="sort" id="sort" v-model="params.sort"/>
|
||||
<input title="状态" type="hidden" name="status" v-model="params.status">
|
||||
<div class="am-form am-form-horizontal">
|
||||
<div class="am-form-group fl">
|
||||
<label class="am-para-label w100">车型:</label>
|
||||
@@ -170,15 +171,15 @@
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group fl">
|
||||
<label class="am-para-label w100">状态:</label>
|
||||
<div class="am-para-inline w120">
|
||||
<select title="状态" 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 w100">状态:</label>-->
|
||||
<!-- <div class="am-para-inline w120">-->
|
||||
<!-- <select title="状态" 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">
|
||||
<label class="am-para-label w100">车架号:</label>
|
||||
<div class="am-para-inline w120">
|
||||
|
||||
@@ -0,0 +1,888 @@
|
||||
<link rel="stylesheet" type="text/css" href="/static/css/appitem/font-awesome.min.css">
|
||||
<link rel="stylesheet" type="text/css" href="/static/css/appitem/AdminLTE.min.css">
|
||||
<style>
|
||||
.label-group-wrap {
|
||||
margin-top: 10px;
|
||||
font-size: 0;
|
||||
}
|
||||
.label-group {
|
||||
display: inline-block;
|
||||
margin-right: 4px;
|
||||
margin-bottom: 16px;
|
||||
font-size: 0;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.label-group-wrap .label, .label-group>.label {
|
||||
font-size: 10px;
|
||||
font-weight: normal;
|
||||
margin-right: 1px;
|
||||
white-space: normal;
|
||||
line-height: 1.4;
|
||||
}
|
||||
.label {
|
||||
font-weight: normal;
|
||||
}
|
||||
.label-group>span+a.label {
|
||||
border-top-left-radius: 0;
|
||||
border-bottom-left-radius: 0;
|
||||
border-left: 1px solid #fff;
|
||||
margin-left: -3px;
|
||||
}
|
||||
.label-group-wrap .label, .label-group>.label {
|
||||
font-size: 10px;
|
||||
font-weight: normal;
|
||||
margin-right: 1px;
|
||||
white-space: normal;
|
||||
line-height: 1.4;
|
||||
}
|
||||
.order-on {
|
||||
border-bottom: 2px solid #e61773;
|
||||
height: 40px;
|
||||
}
|
||||
|
||||
.order-none{
|
||||
height: 38px;
|
||||
}
|
||||
|
||||
.order {
|
||||
width: 150px;
|
||||
display: table-cell;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.order a{
|
||||
display: block;
|
||||
overflow: hidden;
|
||||
width: 100%;
|
||||
height: 30px;
|
||||
line-height: 30px;
|
||||
text-align: center;
|
||||
color: #5e5e5e;
|
||||
}
|
||||
|
||||
.angle_top {
|
||||
content: '';
|
||||
width: 0;
|
||||
height: 0;
|
||||
display: block;
|
||||
border-style: solid;
|
||||
border-width: 0 6px 6px;
|
||||
border-color: transparent transparent #5e5e5e;
|
||||
position: absolute;
|
||||
transform: rotate(180deg);
|
||||
bottom: 14px;
|
||||
right: 17px;
|
||||
}
|
||||
|
||||
.angle_bottom {
|
||||
content: '';
|
||||
width: 0;
|
||||
height: 0;
|
||||
display: block;
|
||||
border-style: solid;
|
||||
border-width: 0 6px 6px;
|
||||
border-color: transparent transparent #5e5e5e;
|
||||
position: absolute;
|
||||
top: 10px;
|
||||
right: 17px;
|
||||
}
|
||||
</style>
|
||||
<div class="coms-table-wrap mt10">
|
||||
<form class=" form-search coms-table-hd clearfix no-border" onsubmit="return false"
|
||||
action="/items/goods/goods">
|
||||
<input title="排序字段" type="hidden" name="order" id="order" v-model="params.order"/>
|
||||
<input title="排序方向" type="hidden" name="sort" id="sort" v-model="params.sort"/>
|
||||
<input title="状态" type="hidden" name="status" v-model="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 w120">
|
||||
<select id="bd-auto1-id" name="brand_id" data-toggle="next-select"
|
||||
data-refurl="/common/auto?pid={value}&type=2"
|
||||
data-next="#bd-auto2-id">
|
||||
<option value="0">选择品牌</option>
|
||||
<? if ($autoList[1]) {
|
||||
foreach ($autoList[1] as $v) { ?>
|
||||
<option value="<?= $v['id'] ?>" <?= $v['id'] == $params['brand_id'] ? 'selected' : '' ?>
|
||||
><?= $v['name'] ?></option>
|
||||
<? }
|
||||
} ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group fl">
|
||||
<div class="am-para-inline w120">
|
||||
<select id="bd-auto2-id" name="s_id" data-toggle="next-select"
|
||||
data-refurl="/common/auto?pid={value}&type=3"
|
||||
data-next="#bd-auto3-id" @change="set_sery">
|
||||
<option value="0">选择车系</option>
|
||||
<?php if ($autoList[2]) {
|
||||
foreach ($autoList[2] as $v) { ?>
|
||||
<option value="<?= $v['id'] ?>" <?= $v['id'] == $params['s_id'] ? 'selected' : '' ?>
|
||||
><?= $v['name'] ?></option>
|
||||
<?php }
|
||||
} ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group fl">
|
||||
<div class="am-para-inline w120">
|
||||
<select id="bd-auto3-id" name="v_id">
|
||||
<option value="0">选择车型</option>
|
||||
<?php if ($autoList[3]) {
|
||||
foreach ($autoList[3] as $v) { ?>
|
||||
<option value="<?= $v['id'] ?>" <?= $v['id'] == $params['v_id'] ? 'selected' : '' ?>
|
||||
><?= $v['name'] ?></option>
|
||||
<?php }
|
||||
} ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group">
|
||||
<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 attrs_cor">{{v.title}}</option>
|
||||
</select>
|
||||
</div>
|
||||
</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" v-model="params.city_id">
|
||||
<option value="">选择城市</option>
|
||||
<option :value="v.id" v-for="(v,i) in cityAry">{{v.name}}</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="am-para-inline w120">
|
||||
<select title="行政区" name="county_id" v-model="params.county_id">
|
||||
<option value="">选择行政区</option>
|
||||
<option :value="v.id" v-for="(v,i) in countyAry">{{v.name}}</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="am-para-inline w120">
|
||||
<select title="地址" name="addr_id" v-model="params.addr_id">
|
||||
<option value="">选择地址</option>
|
||||
<option :value="v.id" v-for="(v,i) in addrAry">{{v.title}}</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group">
|
||||
<label class="am-para-label w100">车架号:</label>
|
||||
<div class="am-para-inline w120">
|
||||
<input type="text" name="vin" placeholder="车架号关键字" v-model="params.vin" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group">
|
||||
<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 w120">
|
||||
<select title="状态" 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">
|
||||
<label class="am-para-label w100">是否精品:</label>
|
||||
<div class="am-para-inline w120">
|
||||
<select name="is_fine" v-model="params.is_fine">
|
||||
<option value="">全部</option>
|
||||
<option value="0">否</option>
|
||||
<option value="1">是</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group fl ml100">
|
||||
<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 ml20">
|
||||
<button type="button" data-open="/items/goods/goods/get"
|
||||
class="am-btn am-btn-success am-btn-sm w100">新增
|
||||
</button>
|
||||
</div>
|
||||
<div class="am-form-group fl ml10">
|
||||
<button type="button" id="import" class="am-btn am-btn-success am-btn-sm w100">导入</button>
|
||||
<button type="button" id="export" class="am-btn am-btn-success am-btn-sm w100">导出</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<div class="coms-table-bd">
|
||||
<div class="fr">共有<?= $pager['totle'] ?>条数据</div>
|
||||
<table class="am-table am-table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<th width="5%">
|
||||
<span :class="'order'+('id'==params.order?' order-on':' order-none')">
|
||||
<a href="javascript:void(0)" @click="set_order('id')">
|
||||
<span class="mr10">ID</span>
|
||||
<i class="angle_top" v-if="'desc'==params.sort||'id'!=params.order"></i>
|
||||
<i class="angle_bottom" v-if="'asc'==params.sort||'id'!=params.order"></i>
|
||||
</a>
|
||||
</span>
|
||||
</th>
|
||||
<th width="25%">
|
||||
<span :class="'order'+('brand_id'==params.order?' order-on':' order-none')">
|
||||
<a href="javascript:void(0)" @click="set_order('brand_id')">
|
||||
<span class="mr10">车辆</span>
|
||||
<i class="angle_top" v-if="'desc'==params.sort||'brand_id'!=params.order"></i>
|
||||
<i class="angle_bottom" v-if="'asc'==params.sort||'brand_id'!=params.order"></i>
|
||||
</a>
|
||||
</span>
|
||||
</th>
|
||||
<th width="15%">
|
||||
<span :class="'order'+('vin'==params.order?' order-on':' order-none')">
|
||||
<a href="javascript:void(0)" @click="set_order('vin')">
|
||||
<span>车架号</span>
|
||||
<i class="angle_top" v-if="'desc'==params.sort||'vin'!=params.order"></i>
|
||||
<i class="angle_bottom" v-if="'asc'==params.sort||'vin'!=params.order"></i>
|
||||
</a>
|
||||
</span>
|
||||
</th>
|
||||
<th width="15%">
|
||||
<span :class="'order'+('admin_id'==params.order?' order-on':' order-none')">
|
||||
<a href="javascript:void(0)" @click="set_order('admin_id')">
|
||||
<span>销售员</span>
|
||||
<i class="angle_top" v-if="'desc'==params.sort||'admin_id'!=params.order"></i>
|
||||
<i class="angle_bottom" v-if="'asc'==params.sort||'admin_id'!=params.order"></i>
|
||||
</a>
|
||||
</span></th>
|
||||
<th width="15%">
|
||||
<span :class="'order'+('out_time'==params.order?' order-on':' order-none')">
|
||||
<a href="javascript:void(0)" @click="set_order('out_time')">
|
||||
<span>销售日期</span>
|
||||
<i class="angle_top" v-if="'desc'==params.sort||'out_time'!=params.order"></i>
|
||||
<i class="angle_bottom" v-if="'asc'==params.sort||'out_time'!=params.order"></i>
|
||||
</a>
|
||||
</span>
|
||||
</th>
|
||||
<th width=""><span>操作</span></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr v-for="(v,i) in lists">
|
||||
<td>{{v.id}}</td>
|
||||
<td>{{v.brand_name}}-{{v.s_name}}-{{v.v_name}}-{{v.cor_name}}</td>
|
||||
<td>{{v.vin}}</td>
|
||||
<td>{{v.admin_name}}</td>
|
||||
<td>{{v.out_time}}</td>
|
||||
<td>
|
||||
<a href="javascript:void(0);"
|
||||
:data-modal="'/items/goods/goods/get_info?id='+v.id"
|
||||
class="am-btn am-btn-primary am-btn-xs"
|
||||
data-title="详情">查看</a>
|
||||
<a href="javascript:void(0);"
|
||||
:data-open="'/items/goods/goods/get?id='+v.id"
|
||||
class="am-btn am-btn-primary am-btn-xs">编辑</a>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="coms-table-ft clearfix">
|
||||
<div class="coms-pagination fr mr20">
|
||||
<?php page_view($pager) ?>
|
||||
</div>
|
||||
</div>
|
||||
<div id="goods-modal" style="display: none;padding: 10px">
|
||||
<div class="modal-body">
|
||||
<div class="text-center">
|
||||
<h2><i class="fa fa-info-circle"></i> 请上传Excel文件</h2>
|
||||
<p>Excel文件格式必须与模板保持一致,否则无法导入</p>
|
||||
<div class="form-group-action">
|
||||
<a href="/temp/goods.xlsx?0819" target="_blank" class="btn btn-default">查看模板</a>
|
||||
<label href="javascript:" class="btn btn-primary" style="margin-left: 10px;">
|
||||
<form id="import-form">
|
||||
<input type="file" id="goods-file" name="file" accept=".xls,.xlsx"
|
||||
style="left:-9999px;position:absolute;" onchange="load_goods()">
|
||||
</form>
|
||||
<span>上传Excel文件</span>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="fine-modal" style="display: none;">
|
||||
<div class="modal-body">
|
||||
<table width="100%">
|
||||
<tr>
|
||||
<td width="20%">ID</td>
|
||||
<td width="35%" style="font-weight: bold;padding-left: 8px;">精品</td>
|
||||
<td width="40%" style="padding-right: 8px;"><label class="sr-only" for="search">搜精品</label>
|
||||
<div class="input-group input-group-sm">
|
||||
<input type="text" class="form-control" style="font-size: 1.2rem;font-weight: bold;"
|
||||
v-model='modal_fine.title' placeholder="精品关键字">
|
||||
<div class="input-group-btn">
|
||||
<button type="button" @click='get_fines(0);' class="btn btn-default">搜</button>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<div style="border-bottom: 1px solid #ddd;height: 1px;margin-top: 8px;"></div>
|
||||
<table class="table table-middle">
|
||||
<colgroup>
|
||||
<col width="15%"/>
|
||||
<col width="45%"/>
|
||||
<col width="20%"/>
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<tr v-for="(v,i) in modal_fine.lists">
|
||||
<td>{{v.id}}</td>
|
||||
<td>{{v.title}}</td>
|
||||
<td class="text-right">
|
||||
<a v-if="v.checked==0 || !v.checked" href="javascript:void(0);" @click="set_fine(i,1)"
|
||||
class="btn btn-primary btn-sm">选择</a>
|
||||
<a v-else-if="v.checked==1" href="javascript:void(0);" @click="set_fine(i,0)"
|
||||
class="btn btn-default btn-sm">移除</a>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="clearfix">
|
||||
<span class="pull-left text-muted">第{{modal_fine.page}}页(每页{{modal_fine.size}}条,共{{modal_fine.total}}条)</span>
|
||||
<nav class="pull-right" aria-label="Page navigation">
|
||||
<ul class="pagination pagination-sm">
|
||||
<li v-if="modal_fine.page>1">
|
||||
<a href="javascript:void(0);" @click="get_fines(-1);" aria-label="上一页">
|
||||
<span class="glyphicon glyphicon-menu-left"></span>
|
||||
</a>
|
||||
</li>
|
||||
<li v-if="modal_fine.next>0">
|
||||
<a href="javascript:void(0);" @click="get_fines(1);" aria-label="下一页">
|
||||
<span class="glyphicon glyphicon-menu-right"></span>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
function load_goods() {
|
||||
var file = $("#goods-file");
|
||||
if (file.val() == '') {
|
||||
layer.msg('文件是空的');
|
||||
return 0;
|
||||
}
|
||||
var loading = layer.load(1, {
|
||||
shade: [0.1, '#fff'] //0.1透明度的白色背景
|
||||
});
|
||||
|
||||
var options = {
|
||||
url: "/items/goods/goods/add_excel",
|
||||
type: "post",
|
||||
dataType: "json",
|
||||
data: {},
|
||||
success: function (res) {
|
||||
if (res['code']) {
|
||||
layer.msg(res.msg, {
|
||||
icon: 1,
|
||||
time: 2000
|
||||
}, function () {
|
||||
location.reload();
|
||||
});
|
||||
} else {
|
||||
layer.msg(res.msg, {icon: 2});
|
||||
}
|
||||
},
|
||||
complete: function () {
|
||||
file.val('');
|
||||
layer.closeAll('loading');
|
||||
}
|
||||
};
|
||||
$("#import-form").ajaxSubmit(options);
|
||||
}
|
||||
|
||||
$(function () {
|
||||
vue_obj = new Vue({
|
||||
el: '.coms-table-wrap',
|
||||
data: {
|
||||
params:[],
|
||||
statusAry:[],//状态
|
||||
cityAry:[],//城市
|
||||
countyAry:[],//行政区
|
||||
addrAry:[],//地址
|
||||
admins: {cityAry: [], countyAry: [], bizAry: [], list: []},
|
||||
fines:[],//搜索条件精品列表
|
||||
fine_ids:[],//列表所有选中的精品列表
|
||||
lists:[],
|
||||
attrs_cor:[],//车身颜色选项
|
||||
modal_fine:{title:'', lists:[], selected:[], page:1, size:10, total:0}
|
||||
},
|
||||
mounted:function() {
|
||||
var vm = this;
|
||||
vm.lists = <?=json_encode($lists)?>;
|
||||
vm.params = <?=json_encode($params)?>;
|
||||
vm.statusAry = <?=json_encode($statusAry)?>;
|
||||
vm.fine_ids = <?=json_encode($fine_ids)?>;
|
||||
vm.init_citys();
|
||||
vm.init_fines();
|
||||
vm.init_fines_lists();
|
||||
vm.set_sery();
|
||||
},
|
||||
methods:{
|
||||
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));
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
init_fines:function(){
|
||||
var vm = this;
|
||||
if(vm.params.fine_ids.length > 0){
|
||||
$.ajax({
|
||||
type: 'post',
|
||||
url: '/auto/fine/json_lists',
|
||||
dataType: 'json',
|
||||
data: {
|
||||
id: vm.params.fine_ids,
|
||||
status:1
|
||||
},
|
||||
success:function(response){
|
||||
if (response.code == 1) {
|
||||
vm.fines = response.data.list;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
init_fines_lists:function(){
|
||||
var vm = this;
|
||||
if(vm.fine_ids.length > 0){
|
||||
$.ajax({
|
||||
type: 'post',
|
||||
url: '/auto/fine/json_lists',
|
||||
dataType: 'json',
|
||||
data: {
|
||||
id: vm.fine_ids.join(','),
|
||||
status:1
|
||||
},
|
||||
success:function(response){
|
||||
if (response.code == 1) {
|
||||
var fines = response.data.list;
|
||||
var map_fine = {};
|
||||
for(var i in fines){
|
||||
var fine = fines[i];
|
||||
map_fine[fine.id] = fine;
|
||||
}
|
||||
for(i in vm.lists){
|
||||
var goods = vm.lists[i];
|
||||
var auto_fine = '';
|
||||
for(var j in goods.fine_ids){
|
||||
var fine_id = goods.fine_ids[j];
|
||||
fine = map_fine[fine_id];
|
||||
auto_fine += fine.title + " ";
|
||||
}
|
||||
goods.auto_fine = auto_fine;
|
||||
}
|
||||
vm.$forceUpdate();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
fine_modal:function(){
|
||||
//选择门店
|
||||
var vm = this;
|
||||
var selects = JSON.parse(JSON.stringify(vm.fines));
|
||||
vm.modal_fine = {title:'', lists:[], selected:selects, page:1, size:10, total:0, next:0};
|
||||
vm.get_fines();
|
||||
layer.open({
|
||||
type: 1,
|
||||
area: ['50%', '80%'], //宽高
|
||||
content: $('#fine-modal'),
|
||||
title: '选取精品',
|
||||
shade: false,
|
||||
btn: ['选好了'],
|
||||
yes: function (index) {
|
||||
layer.close(index);
|
||||
vm.fines = JSON.parse(JSON.stringify(vm.modal_fine.selected));
|
||||
var fine_ids = '';
|
||||
for(var i in vm.fines){
|
||||
var fine = vm.fines[i];
|
||||
if('' == fine_ids){
|
||||
fine_ids = fine.id;
|
||||
} else{
|
||||
fine_ids += ','+ fine.id
|
||||
}
|
||||
}
|
||||
vm.params.fine_ids = fine_ids;
|
||||
}
|
||||
});
|
||||
},
|
||||
get_fines:function(page){
|
||||
var vm = this;
|
||||
if(0 == page){
|
||||
vm.modal_fine.page = 1;
|
||||
vm.modal_fine.total = 0;
|
||||
vm.modal_fine.next = 0;
|
||||
} else if(1 == page){
|
||||
vm.modal_fine.page+=1;
|
||||
} else if(-1 == page) {
|
||||
vm.modal_fine.page-=1;
|
||||
}
|
||||
$.ajax({
|
||||
type: 'post',
|
||||
url: '/auto/fine/json_lists',
|
||||
dataType: 'json',
|
||||
data: {
|
||||
page: vm.modal_fine.page,
|
||||
size: vm.modal_fine.size,
|
||||
status:1,
|
||||
title:vm.modal_fine.title
|
||||
},
|
||||
success:function(response){
|
||||
if (response.code == 1) {
|
||||
vm.modal_fine.lists = response.data.list;
|
||||
vm.modal_fine.total = response.data.total;
|
||||
if(vm.modal_fine.page * vm.modal_fine.size < vm.modal_fine.total){
|
||||
vm.modal_fine.next=1;
|
||||
} else {
|
||||
vm.modal_fine.next=0;
|
||||
}
|
||||
for(var i in vm.modal_fine.lists){
|
||||
var fine = vm.modal_fine.lists[i];
|
||||
fine.checked = 0;
|
||||
for(var j in vm.modal_fine.selected){
|
||||
var selected = vm.modal_fine.selected[j];
|
||||
if(fine.id == selected.id){
|
||||
fine.checked = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
set_fine:function(index, checked){
|
||||
var vm = this;
|
||||
var fine = vm.modal_fine.lists[index];
|
||||
fine.checked = checked;
|
||||
if(checked == 1){
|
||||
var selected = {id:fine.id, title:fine.title};
|
||||
vm.modal_fine.selected.push(selected);
|
||||
} else {
|
||||
for(var i in vm.modal_fine.selected){
|
||||
selected = vm.modal_fine.selected[i];
|
||||
if(fine.id == selected.id){
|
||||
vm.modal_fine.selected.splice(i, 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
vm.$forceUpdate();
|
||||
},
|
||||
rm_fine:function(index){
|
||||
var vm = this;
|
||||
vm.fines.splice(index, 1);
|
||||
var fine_ids = '';
|
||||
for(var i in vm.fines){
|
||||
var fine = vm.fines[i];
|
||||
if('' == fine_ids){
|
||||
fine_ids = fine.id;
|
||||
} else{
|
||||
fine_ids += ','+ fine.id
|
||||
}
|
||||
}
|
||||
vm.params.fine_ids = fine_ids;
|
||||
},
|
||||
set_sery:function(){
|
||||
var vm = this;
|
||||
var s_id = $('#bd-auto2-id').val();
|
||||
if(s_id > 0){
|
||||
$.ajax({
|
||||
type: 'post',
|
||||
url: '/auto/attr/json_lists',
|
||||
dataType: 'json',
|
||||
data: {
|
||||
s_id: s_id,
|
||||
status:1,
|
||||
type:0
|
||||
},
|
||||
success:function(response){
|
||||
if (response.code == 1) {
|
||||
vm.attrs_cor = response.data.list;
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
vm.attrs_cor = [];
|
||||
vm.params.cor_id = '';
|
||||
}
|
||||
},
|
||||
set_order:function(order){
|
||||
var vm = this;
|
||||
var sort = vm.params.sort;
|
||||
if(vm.params.order == order){
|
||||
if(vm.params.sort == 'desc'){
|
||||
sort = 'asc';
|
||||
} else {
|
||||
sort = 'desc';
|
||||
}
|
||||
} else {
|
||||
vm.params.order = order;
|
||||
sort = 'desc';
|
||||
}
|
||||
|
||||
vm.params.order = order;
|
||||
vm.params.sort = sort;
|
||||
$('#sort').val(sort);
|
||||
$('#order').val(order);
|
||||
$('.form-search').submit();
|
||||
},
|
||||
reset:function(){
|
||||
var that = this;
|
||||
that.params.cor_id = '';
|
||||
that.params.city_id = '';
|
||||
that.params.status = '';
|
||||
that.params.vin = '';
|
||||
that.params.fine_ids = '';
|
||||
that.fines = [];
|
||||
$('#bd-auto1-id').val(0);
|
||||
$('#bd-auto2-id').val(0);
|
||||
$('#bd-auto3-id').val(0);
|
||||
}
|
||||
},
|
||||
watch:{
|
||||
'params.city_id':function(nv, ov){
|
||||
var that = this;
|
||||
if(nv == ''){
|
||||
that.countyAry = [];
|
||||
that.params.county_id = '';
|
||||
} else {
|
||||
if(nv.substring(0,4) != that.params.county_id.substring(0, 4)){
|
||||
that.params.county_id = '';
|
||||
}
|
||||
$.ajax({
|
||||
type: 'get',
|
||||
url: '/common/area',
|
||||
dataType: 'json',
|
||||
data: {
|
||||
id: nv,
|
||||
key:'county',
|
||||
type:1
|
||||
},
|
||||
success:function(response){
|
||||
if (response.code == 1) {
|
||||
that.countyAry = response.data;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
'params.county_id':function(nv, ov){
|
||||
var that = this;
|
||||
if(nv == ''){
|
||||
that.addrAry = [];
|
||||
that.params.addr_id = '';
|
||||
} else {
|
||||
$.ajax({
|
||||
type: 'get',
|
||||
url: '/sys/addr/json_lists',
|
||||
dataType: 'json',
|
||||
data: {
|
||||
county_id: nv,
|
||||
status:1
|
||||
},
|
||||
success:function(response){
|
||||
if (response.code == 1) {
|
||||
that.addrAry = response.data.lists;
|
||||
if(that.params.addr_id>0){
|
||||
var addr_id = '';
|
||||
for(var i in that.addrAry){
|
||||
if(that.params.addr_id == that.addrAry[i].id){
|
||||
addr_id = that.params.addr_id;
|
||||
break;
|
||||
}
|
||||
}
|
||||
that.params.addr_id = addr_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) ?>
|
||||
|
||||
$("#import").click(function () {
|
||||
$("#goods-file").val('');
|
||||
layer.open({
|
||||
type: 1,
|
||||
area: ['40%'], //宽高
|
||||
content: $('#goods-modal'),
|
||||
title: '导入线索',
|
||||
shade: false,
|
||||
btn: ['完成'],
|
||||
yes: function (index) {
|
||||
layer.close(index);
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
$('#export').click(function () {
|
||||
var count = <?=$pager['totle']?>;
|
||||
if (count > 10000) {
|
||||
layer.msg('单次导出数据不能超过10000');
|
||||
return false;
|
||||
}
|
||||
var href = $.menu.parseUri(window.location.href);
|
||||
var arr = href.split('?');
|
||||
href = '/items/goods/goods/export?' + arr[1];
|
||||
window.location.href = href;
|
||||
});
|
||||
|
||||
$('#bd-auto1-id').change(function () {
|
||||
$('#bd-auto2-id').empty();
|
||||
$('#bd-auto3-id').empty();
|
||||
$("#bd-auto3-id").prepend("<option value='0'>选择车型</option>");
|
||||
});
|
||||
$('#bd-auto2-id').change(function () {
|
||||
$('#bd-auto3-id').empty();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@@ -42,6 +42,55 @@ class Items_model extends HD_Model
|
||||
return $this->db->count_all_results();
|
||||
}
|
||||
|
||||
/**
|
||||
* 联表订单
|
||||
* @param array $where
|
||||
* @return mixed
|
||||
*/
|
||||
function count_order($where = array()){
|
||||
$join_on = "j.item_id=m.id";
|
||||
$this->db->from("lc_items as m");
|
||||
$this->db->join("lc_receiver_orders as j", $join_on, 'left');
|
||||
|
||||
if($where)
|
||||
{
|
||||
$this->db->where($where);
|
||||
}
|
||||
|
||||
$this->db->select('id', false);
|
||||
|
||||
return $this->db->count_all_results();
|
||||
}
|
||||
|
||||
/**
|
||||
* 条件筛选订单和精品
|
||||
* @param array $where
|
||||
* @return mixed
|
||||
*/
|
||||
function count_order_fine($where = array()){
|
||||
$join_on = "j.item_id=m.id";
|
||||
$join_on2 = "j2.item_id=m.id and j2.type=1 and j2.status=1";
|
||||
$this->db->from("lc_items as m");
|
||||
$this->db->join("lc_receiver_orders as j", $join_on, 'left');
|
||||
$this->db->join("lc_items_relate as j2", $join_on2, 'left');
|
||||
|
||||
$this->db->group_by('m.id');
|
||||
|
||||
if($where['having']){
|
||||
$this->db->having($where['having']);
|
||||
unset($where['having']);
|
||||
}
|
||||
|
||||
if($where)
|
||||
{
|
||||
$this->db->where($where);
|
||||
}
|
||||
|
||||
$this->db->select('m.id, count(j2.type_id) as fine_num', false);
|
||||
|
||||
return $this->db->count_all_results();
|
||||
}
|
||||
|
||||
/**
|
||||
* 精品筛选数据列表
|
||||
* @param array $where
|
||||
@@ -91,4 +140,99 @@ class Items_model extends HD_Model
|
||||
|
||||
return $this->db->get(null, $limit, $offset)->result_array();
|
||||
}
|
||||
|
||||
/**
|
||||
* 订单筛选
|
||||
* @param array $where
|
||||
* @param string $order
|
||||
* @param int $page
|
||||
* @param int $page_size
|
||||
* @param string $select
|
||||
* @return mixed
|
||||
*/
|
||||
function select_order($where = array(), $order = '', $page = 0, $page_size = 20, $select = ''){
|
||||
$join_on = "j.item_id=m.id";
|
||||
$this->db->from("lc_items as m");
|
||||
$this->db->join("lc_receiver_orders as j", $join_on, 'left');
|
||||
|
||||
if($select)
|
||||
{
|
||||
$this->db->select($select, false);
|
||||
}
|
||||
|
||||
if($where)
|
||||
{
|
||||
$this->db->where($where);
|
||||
}
|
||||
|
||||
if($order)
|
||||
{
|
||||
$this->db->order_by($order);
|
||||
}
|
||||
|
||||
if($page)
|
||||
{
|
||||
$offset = ($page - 1) * $page_size;
|
||||
$limit = $page_size;
|
||||
}
|
||||
else
|
||||
{
|
||||
$offset = null;
|
||||
$limit = null;
|
||||
}
|
||||
|
||||
return $this->db->get(null, $limit, $offset)->result_array();
|
||||
}
|
||||
|
||||
/**
|
||||
* 关联订单和精品
|
||||
* @param array $where
|
||||
* @param string $order
|
||||
* @param int $page
|
||||
* @param int $page_size
|
||||
* @param string $select
|
||||
* @return mixed
|
||||
*/
|
||||
function select_order_fine($where = array(), $order = '', $page = 0, $page_size = 20, $select = ''){
|
||||
$join_on = "j.item_id=m.id";
|
||||
$join_on2 = "j2.item_id=m.id and j2.type=1 and j2.status=1";
|
||||
$this->db->from("lc_items as m");
|
||||
$this->db->join("lc_receiver_orders as j", $join_on, 'left');
|
||||
$this->db->join("lc_items_relate as j2", $join_on2, 'left');
|
||||
|
||||
$this->db->group_by('m.id');
|
||||
|
||||
if($where['having']){
|
||||
$this->db->having($where['having']);
|
||||
unset($where['having']);
|
||||
}
|
||||
|
||||
if($select)
|
||||
{
|
||||
$this->db->select($select, false);
|
||||
}
|
||||
|
||||
if($where)
|
||||
{
|
||||
$this->db->where($where);
|
||||
}
|
||||
|
||||
if($order)
|
||||
{
|
||||
$this->db->order_by($order);
|
||||
}
|
||||
|
||||
if($page)
|
||||
{
|
||||
$offset = ($page - 1) * $page_size;
|
||||
$limit = $page_size;
|
||||
}
|
||||
else
|
||||
{
|
||||
$offset = null;
|
||||
$limit = null;
|
||||
}
|
||||
|
||||
return $this->db->get(null, $limit, $offset)->result_array();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user