admin_goods_1028

This commit is contained in:
dengbw
2021-10-28 15:53:40 +08:00
parent 07df6b5031
commit ba07dc0672
7 changed files with 652 additions and 384 deletions
+246 -184
View File
@@ -8,7 +8,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
*/
class Goods extends HD_Controller
{
private $statusAry = array( 1 => '未售', 2 => '已售', 0 => '下架');
private $statusAry = array(1 => '未售', 2 => '已售', 0 => '下架');
public function __construct()
{
@@ -18,7 +18,9 @@ class Goods extends HD_Controller
$this->load->model('auto/auto_brand_model', 'mdAutoBrand');
$this->load->model('auto/auto_series_model', 'mdAutoSeries');
$this->load->model('auto/auto_attr_model', 'mdAutoAttr');
$this->load->model("biz/biz_model", 'mdBiz');
$this->load->model("sys/sys_addr_model", 'addr_model');
$this->load->model('area_model', 'mdArea');
}
public function index()
@@ -31,7 +33,7 @@ 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 = array('id<>1' => null,'status>'=>0);
$where = array('id<>1' => null, 'status>' => 0);
$where_1 = $where_2 = $where_3 = array('m.id<>1' => null);
$autoList = array();
$search_type = 0;//0不连表,1联表筛选精品,2联表筛选销售,3联表筛选精品和销售
@@ -66,38 +68,41 @@ class Goods extends HD_Controller
}
//地址筛选
if($params['addr_id']){
if ($params['biz_id']) {
$where['biz_id'] = $params['biz_id'];
$where_1['biz_id'] = $params['biz_id'];
$where_2['m.biz_id'] = $params['biz_id'];
$where_3['m.biz_id'] = $params['biz_id'];
}
if ($params['biz_id'] == -1 && $params['addr_id']) {
$where['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']){
$where_addr['county_id'] = $params['county_id'];
}
$orderby = 'id desc';
$select = 'id';
$rows_addr = $this->addr_model->select($where_addr, $orderby, 0, 0, $select);
if($rows_addr){
$str_ids = implode(',', array_column($rows_addr, 'id'));
$where["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 if ($params['city_id']) {
$where_biz['status'] = 1;
$params['city_id'] && $where_biz['city_id'] = $params['city_id'];
$params['county_id'] && $where_biz['county_id'] = $params['county_id'];
$res_biz = $this->mdBiz->select($where_biz, 'id desc', 0, 0, 'id');
if ($res_biz) {
$str_ids = implode(',', array_column($res_biz, 'id'));
$where["biz_id in ({$str_ids})"] = null;
$where_1["biz_id in ({$str_ids})"] = null;
$where_2["m.biz_id in ({$str_ids})"] = null;
$where_3["m.biz_id in ({$str_ids})"] = null;
} else {
$where['addr_id'] = -1;
$where_1['addr_id'] = -1;
$where_2['m.addr_id'] = -1;
$where_3['m.addr_id'] = -1;
$where['biz_id'] = -2;
$where_1['biz_id'] = -2;
$where_2['m.biz_id'] = -2;
$where_3['m.biz_id'] = -2;
}
} else {
$params['city_id'] = '';
$params['county_id'] = '';
$params['addr_id'] = '';
$params['biz_id'] = '';
}
if(strlen($params['status'])>0){
if (strlen($params['status']) > 0) {
$where['status'] = $params['status'];
$where_1['m.status'] = $params['status'];
$where_2['m.status'] = $params['status'];
@@ -106,7 +111,7 @@ class Goods extends HD_Controller
$params['status'] = '';
}
if(1 == $params['sold']){//已售
if (1 == $params['sold']) {//已售
$where["bill_time<>'0000-00-00 00:00:00'"] = null;
$where_1["m.bill_time<>'0000-00-00 00:00:00'"] = null;
$where_2["m.bill_time<>'0000-00-00 00:00:00'"] = null;
@@ -122,26 +127,26 @@ class Goods extends HD_Controller
$_title = '库存车辆';
}
if($params['vin']){
if ($params['vin']) {
$where["vin like '%{$params['vin']}%'"] = null;
$where_1["m.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']){
if ($params['fine_ids']) {
$fine_num = substr_count($params['fine_ids'], ',') + 1;
$where_1["j.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;
$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']){
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;
@@ -150,13 +155,13 @@ class Goods extends HD_Controller
$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;
$search_type = 0 == $search_type || 1 == $search_type ? 1 : 3;
} else {
$params['is_fine'] = '';
}
//销售员筛选
if($params['admin_id']){
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'];
@@ -168,28 +173,28 @@ class Goods extends HD_Controller
}
$order = 'id';
if('fine_num' == $params['order']){//精品标签数排序
if ('fine_num' == $params['order']) {//精品标签数排序
$order = $params['order'];
$search_type = 0 == $search_type || 1 == $search_type ? 1: 3;
} else if(in_array($params['order'], array('admin_id', 'mobile', 'uname'))){//销售员ID、订单用户电话、订单用户名称
$search_type = 0 == $search_type || 1 == $search_type ? 1 : 3;
} else if (in_array($params['order'], array('admin_id', 'mobile', 'uname'))) {//销售员ID、订单用户电话、订单用户名称
$order = $params['order'];
$search_type = 0 == $search_type || 2 == $search_type ? 2 : 3;
}else if('sold_time' == $params['order']){//售卖时间排序
} else if ('sold_time' == $params['order']) {//售卖时间排序
$order = 'bill_time';
} else if($params['order']){
} else if ($params['order']) {
$order = $params['order'];
} else {
$params['order'] = $order;
}
$sort = 'desc';
if($params['sort']){
if ($params['sort']) {
$sort = $params['sort'];
} else {
$params['sort'] = $sort;
}
$autoList[1] = $this->mdAutoBrand->select(array('status' => 1), 'id desc', 0, 0, 'id,name');
switch($search_type){
switch ($search_type) {
case 1://精品筛选
$count = $this->mdItems->count_fine($where_1);
break;
@@ -206,17 +211,17 @@ class Goods extends HD_Controller
$lists = array();
$fine_ids = array();
if ($count) {
switch($search_type){
switch ($search_type) {
case 1://精品筛选
$fileds = 'id,brand_id,s_id,vin,v_id,cor_id,incor_id,in_time,bill_time,addr_id,count(type_id) as fine_num';
$fileds = 'id,brand_id,s_id,vin,v_id,cor_id,incor_id,in_time,bill_time,biz_id,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.bill_time, m.addr_id';
if(in_array($order, array('admin_id', 'mobile'))){
$fileds = 'm.id, m.brand_id, m.s_id, m.vin, m.v_id, m.cor_id, m.incor_id, m.in_time, m.bill_time, m.biz_id, m.addr_id';
if (in_array($order, array('admin_id', 'mobile'))) {
$orderby = "j.{$order} {$sort}";
} else if('uname' == $order){
} else if ('uname' == $order) {
$orderby = "j.name {$sort}";
} else {
$orderby = "{$order} {$sort}";
@@ -224,10 +229,10 @@ class Goods extends HD_Controller
$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.bill_time, m.addr_id, count(j2.type_id) as fine_num';
if(in_array($order, array('admin_id', 'mobile'))){
$fileds = 'm.id, m.brand_id, m.s_id, m.vin, m.v_id, m.cor_id, m.incor_id, m.in_time, m.bill_time, m.biz_id,m.addr_id, count(j2.type_id) as fine_num';
if (in_array($order, array('admin_id', 'mobile'))) {
$orderby = "j.{$order} {$sort}";
} else if('uname' == $order){
} else if ('uname' == $order) {
$orderby = "j.name {$sort}";
} else {
$orderby = "m.{$order} {$sort}";
@@ -235,108 +240,113 @@ class Goods extends HD_Controller
$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,bill_time,addr_id';
$fileds = 'id,brand_id,s_id,vin,v_id,cor_id,incor_id,in_time,bill_time,biz_id,addr_id';
$orderby = "{$order} {$sort}";
$rows = $this->mdItems->select($where, $orderby, $page, $size, $fileds);
}
$brand_ids = $s_ids = $attr_vids = $attr_corids = $attr_incorids = $addr_ids = array();
$brand_ids = $s_ids = $attr_vids = $attr_corids = $attr_incorids = $biz_ids = $addr_ids = array();
$ids = array();
foreach($rows as $v){
foreach ($rows as $v) {
$ids[] = $v['id'];
$v['brand_id'] && !in_array($v['brand_id'], $brand_ids) && $brand_ids[] = $v['brand_id'];
$v['biz_id'] && !in_array($v['biz_id'], $biz_ids) && $biz_ids[] = $v['biz_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){
$map_brand = $map_sery = $map_vid = $map_corid = $map_incorid = $map_biz = $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){
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){
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){
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){
if ($attr_incorids) {
$str_ids = implode(',', $attr_incorids);
$where = array("id in ({$str_ids})" => null);
$map_incorid = $this->mdAutoAttr->map('id', 'title', $where);
}
if($addr_ids){
if ($biz_ids) {
$str_ids = implode(',', $biz_ids);
$where = array("id in ({$str_ids})" => null);
$map_biz = $this->mdBiz->map('id', 'biz_name', $where);
}
if ($addr_ids) {
$str_ids = implode(',', $addr_ids);
$where = array("id in ({$str_ids})" => null);
$orderby = 'id desc';
$select = 'id, title, city_name, county_name';
$rows_addr = $this->addr_model->select($where, $orderby, 0, 0, $select);
foreach($rows_addr as $v){
$map_addr[$v['id']] = "{$v['city_name']} {$v['county_name']} {$v['title']}";
foreach ($rows_addr as $v) {
$map_addr[$v['id']] = "{$v['city_name']} {$v['county_name']} 其它 {$v['title']}";
}
}
$map_item_fine = array();
$map_order = array();
if($ids){
if ($ids) {
//获取精品加装
$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){
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'];
}
//已售商品订单信息
$this->load->model('receiver/order/receiver_orders_model','orders_model');
$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, name, mobile');
$admin_ids = array();
foreach($rows_order as $v){
foreach ($rows_order as $v) {
$map_order[$v['item_id']] = array('admin_id' => $v['admin_id'], 'uname' => $v['name'], 'mobile' => $v['mobile']);
$v['admin_id'] && !in_array($v['admin_id'], $admin_ids) && $admin_ids[] = $v['admin_id'];
}
if($admin_ids){
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){
if ($rows_admin) {
$biz_ids = array();
$map_admin = array();
$map_biz_name = array();
foreach($rows_admin as $v){
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");
if ($biz_ids) {//店铺列表
$str_ids = implode(',', $biz_ids);
$where = array("id in({$str_ids})" => null);
$map_biz_name = $this->biz_model->map('id', 'biz_name', $where);
$map_biz_name = $this->mdBiz->map('id', 'biz_name', $where);
}
foreach($map_order as $k => $v){
foreach ($map_order as $k => $v) {
$admin_id = $v['admin_id'];
$admin = $map_admin[$admin_id];
if(!$admin){
if (!$admin) {
continue;
}
$biz_name = $map_biz_name[$admin['biz_id']];
@@ -355,6 +365,20 @@ class Goods extends HD_Controller
foreach ($rows as $k => $v) {
$order = $map_order[$v['id']];
$address = '';
if ($v['biz_id'] > 0) {
$address = $map_biz[$v['biz_id']];
$re_biz = $this->mdBiz->get(array('id' => $v['biz_id']));
if ($re_biz['county_id']) {
$re_area = $this->mdArea->get(array('county_id' => $re_biz['county_id']));
$re_area && $address = "{$re_area['city_name']} {$re_area['county_name']} {$address}";
} else if ($re_biz['city_id']) {
$re_area = $this->mdArea->get(array('city_id' => $re_biz['city_id']));
$re_area && $address = "{$re_area['city_name']} {$address}";
}
} else if ($v['biz_id'] == -1 && $v['addr_id']) {
$address = $map_addr[$v['addr_id']];
}
$lists[] = array(
'id' => $v['id'],
'brand_name' => $map_brand[$v['brand_id']],
@@ -363,7 +387,7 @@ class Goods extends HD_Controller
'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']] : '',
'address' => $address,
'in_time' => '0000-00-00 00:00:00' == $v['in_time'] ? '' : substr($v['in_time'], 0, 10),
'sold_time' => '0000-00-00 00:00:00' == $v['bill_time'] ? '' : substr($v['bill_time'], 0, 10),
'fine_ids' => $map_item_fine[$v['id']] ? $map_item_fine[$v['id']] : array(),
@@ -390,7 +414,7 @@ class Goods extends HD_Controller
$autoList = array();
$id = intval($this->input->get('id'));
$info['brand_id'] = $info['s_id'] = $info['v_id'] = $info['cor_id'] = $info['incor_id'] = 0;
$info['if_pack'] = '';
$info['if_pack'] = $info['city_id'] = $info['county_id'] = $info['biz_id'] = $info['addr_id'] = '';
$info['status'] = 1;
$autoList[2] = $autoList[3] = $autoList[4] = $autoList[5] = array();
if ($id > 0) {
@@ -411,17 +435,20 @@ class Goods extends HD_Controller
$autoList[4] = $this->mdAutoAttr->select(array('type' => 0, 's_id' => $re['s_id']), 'id desc', 0, 0, 'id,title as name');
$autoList[5] = $this->mdAutoAttr->select(array('type' => 2, 's_id' => $re['s_id']), 'id desc', 0, 0, 'id,title as name');
}
if($info['addr_id']){
$row_addr = $this->addr_model->get(array('id' => $info['addr_id']));
$info['city_id'] = $row_addr['city_id'];
$info['county_id'] = $row_addr['county_id'];
} else {
$info['city_id'] = '';
$info['county_id'] = '';
$info['addr_id'] = '';
$info['city_id'] = '';
$info['county_id'] = '';
$info['biz_id'] = $info['biz_id'] ? $info['biz_id'] : '';
if ($info['biz_id']) {
if ($info['biz_id'] > 0) {
$row_biz = $this->mdBiz->get(array('id' => $info['biz_id']));
$info['city_id'] = $row_biz['city_id'];
$info['county_id'] = $row_biz['county_id'];
} else if ($info['addr_id']) {
$row_addr = $this->addr_model->get(array('id' => $info['addr_id']));
$info['city_id'] = $row_addr['city_id'];
$info['county_id'] = $row_addr['county_id'];
}
}
//获取精品加装
$where = array('item_id' => $id, 'type' => 1, 'status' => 1);
$rows_fine = $this->items_relate_model->select($where, '', 0, 0, 'type_id');
@@ -431,9 +458,6 @@ class Goods extends HD_Controller
$_title = '编辑商品';
$edit_url = '/items/goods/goods/edit';
} else {
$info['city_id'] = '';
$info['county_id'] = '';
$info['addr_id'] = '';
$info['fine_ids'] = array();
$info['in_time'] = date('Y-m-d H:i:s');
$_title = '新增商品';
@@ -481,9 +505,9 @@ class Goods extends HD_Controller
$info['in_time'] = $re['in_time'] != '0000-00-00 00:00:00' ? $re['in_time'] : '';
$info['out_time'] = $re['out_time'] != '0000-00-00 00:00:00' ? $re['out_time'] : '';
$info['bill_time'] = $re['bill_time'] != '0000-00-00 00:00:00' ? $re['bill_time'] : '';
if($info['addr_id']){
if ($info['addr_id']) {
$row_addr = $this->addr_model->get(array('id' => $info['addr_id']));
$info['address'] = $row_addr['city_name'].$row_addr['county_name'].$row_addr['title'];
$info['address'] = $row_addr['city_name'] . $row_addr['county_name'] . $row_addr['title'];
} else {
$info['address'] = '';
}
@@ -508,15 +532,15 @@ class Goods extends HD_Controller
$msg = '请选择品牌';
} else if (!$info['s_id']) {
$msg = '请选择车系';
} else if(!$info['v_id']){
} else if (!$info['v_id']) {
$msg = '请选择车型';
} else if(!$info['cor_id']){
} else if (!$info['cor_id']) {
$msg = '请选择车身颜色';
} else if(!$info['incor_id']){
} else if (!$info['incor_id']) {
$msg = '请选择内饰颜色';
} else if(!$info['addr_id']){
$msg = '请选择地址';
} else if(!$info['in_time']){
} else if (!$info['biz_id'] && !$info['addr_id']) {
$msg = '请选择门店或地址';
} else if (!$info['in_time']) {
$msg = '请选择入库时间';
} else {
$code = SYS_CODE_SUCCESS;
@@ -533,11 +557,11 @@ class Goods extends HD_Controller
return $this->show_json($checkInfo['code'], $checkInfo['msg']);
}
if($info['vin']){
if ($info['vin']) {
//车架号不重复
$where = array('vin' => $info['vin']);
$count = $this->mdItems->count($where);
if($count>0){
if ($count > 0) {
return $this->show_json(SYS_CODE_FAIL, 'vin码已存在');
}
}
@@ -567,16 +591,21 @@ class Goods extends HD_Controller
$addData['bill_time'] = $info['bill_time'] ? $info['bill_time'] : '0000-00-00 00:00:00';
$addData['c_time'] = time();
//存货地址
$addData['addr_id'] = $info['addr_id'] ? $info['addr_id'] : 0;
$biz_id = $addr_id = 0;
if ($info['biz_id']) {
$biz_id = $info['biz_id'];
$addr_id = $info['biz_id'] == -1 ? $info['addr_id'] : 0;
}
$addData['biz_id'] = $biz_id;
$addData['addr_id'] = $addr_id;
$id = $this->mdItems->add($addData);
if (!$id) {
return $this->show_json(SYS_CODE_FAIL, '添加失败!');
}
//保存精品
if($info['fine_ids']){
if ($info['fine_ids']) {
$adds = array();
foreach($info['fine_ids'] as $fine_id){
foreach ($info['fine_ids'] as $fine_id) {
$adds[] = array(
'item_id' => $id,
'type' => 1,
@@ -586,7 +615,6 @@ class Goods extends HD_Controller
}
$ret = $this->items_relate_model->add_batch($adds);
}
$this->data['status'] = 1;
$url = $info['bill_time'] ? '/items/goods/goods?sold=1' : "/items/goods/goods";
return $this->show_json(SYS_CODE_SUCCESS, '添加成功!', $url);
@@ -669,11 +697,11 @@ class Goods extends HD_Controller
return $this->show_json($checkInfo['code'], $checkInfo['msg']);
}
if($info['vin']){
if ($info['vin']) {
//车架号不重复
$where = array('vin' => $info['vin'], "id<>{$info['id']}" => null);
$count = $this->mdItems->count($where);
if($count>0){
if ($count > 0) {
return $this->show_json(SYS_CODE_FAIL, 'vin码已存在');
}
}
@@ -702,7 +730,13 @@ class Goods extends HD_Controller
$editData['out_time'] = $info['out_time'];
$editData['bill_time'] = $info['bill_time'];
//存货地址
$editData['addr_id'] = $info['addr_id'] ? $info['addr_id'] : 0;
$biz_id = $addr_id = 0;
if ($info['biz_id']) {
$biz_id = $info['biz_id'];
$addr_id = $info['biz_id'] == -1 ? $info['addr_id'] : 0;
}
$editData['biz_id'] = $biz_id;
$editData['addr_id'] = $addr_id;
$ret = $this->mdItems->update($editData, array('id' => $info['id']));
if (!$ret) {
return $this->show_json(SYS_CODE_FAIL, '修改失败!');
@@ -713,10 +747,10 @@ class Goods extends HD_Controller
//删除旧数据
$this->items_relate_model->update(array('status' => -1), $where);
$map_relate = $this->items_relate_model->map('type_id', 'status', $where);
if($info['fine_ids']){
if ($info['fine_ids']) {
$adds = array();
foreach($info['fine_ids'] as $fine_id){
if(!$map_relate[$fine_id]){
foreach ($info['fine_ids'] as $fine_id) {
if (!$map_relate[$fine_id]) {
//新增
$adds[] = array(
'item_id' => $info['id'],
@@ -787,38 +821,43 @@ class Goods extends HD_Controller
}
//地址筛选
if($params['addr_id']){
//地址筛选
if ($params['biz_id']) {
$where['biz_id'] = $params['biz_id'];
$where_1['biz_id'] = $params['biz_id'];
$where_2['m.biz_id'] = $params['biz_id'];
$where_3['m.biz_id'] = $params['biz_id'];
}
if ($params['biz_id'] == -1 && $params['addr_id']) {
$where['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']){
$where_addr['county_id'] = $params['county_id'];
}
$orderby = 'id desc';
$select = 'id';
$rows_addr = $this->addr_model->select($where_addr, $orderby, 0, 0, $select);
if($rows_addr){
$str_ids = implode(',', array_column($rows_addr, 'id'));
$where["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 if ($params['city_id']) {
$where_biz['status'] = 1;
$params['city_id'] && $where_biz['city_id'] = $params['city_id'];
$params['county_id'] && $where_biz['county_id'] = $params['county_id'];
$res_biz = $this->mdBiz->select($where_biz, 'id desc', 0, 0, 'id');
if ($res_biz) {
$str_ids = implode(',', array_column($res_biz, 'id'));
$where["biz_id in ({$str_ids})"] = null;
$where_1["biz_id in ({$str_ids})"] = null;
$where_2["m.biz_id in ({$str_ids})"] = null;
$where_3["m.biz_id in ({$str_ids})"] = null;
} else {
$where['addr_id'] = -1;
$where_1['addr_id'] = -1;
$where_2['m.addr_id'] = -1;
$where_3['m.addr_id'] = -1;
$where['biz_id'] = -2;
$where_1['biz_id'] = -2;
$where_2['m.biz_id'] = -2;
$where_3['m.biz_id'] = -2;
}
} else {
$params['city_id'] = '';
$params['county_id'] = '';
$params['addr_id'] = '';
$params['biz_id'] = '';
}
if(strlen($params['status'])>0){
if (strlen($params['status']) > 0) {
$where['status'] = $params['status'];
$where_1['m.status'] = $params['status'];
$where_2['m.status'] = $params['status'];
@@ -831,7 +870,7 @@ class Goods extends HD_Controller
$where_3['m.status >'] = 0;
}
if(1 == $params['sold']){//已售
if (1 == $params['sold']) {//已售
$where["bill_time<>'0000-00-00 00:00:00'"] = null;
$where_1["m.bill_time<>'0000-00-00 00:00:00'"] = null;
$where_2["m.bill_time<>'0000-00-00 00:00:00'"] = null;
@@ -843,26 +882,26 @@ class Goods extends HD_Controller
$where_3["m.bill_time"] = '0000-00-00 00:00:00';
}
if($params['vin']){
if ($params['vin']) {
$where["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']){
if ($params['fine_ids']) {
$fine_num = substr_count($params['fine_ids'], ',') + 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;
$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']){
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;
@@ -871,13 +910,13 @@ class Goods extends HD_Controller
$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;
$search_type = 0 == $search_type || 1 == $search_type ? 1 : 3;
} else {
$params['is_fine'] = '';
}
//销售员筛选
if($params['admin_id']){
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'];
@@ -889,28 +928,28 @@ class Goods extends HD_Controller
}
$order = 'id';
if('fine_num' == $params['order']){//精品标签数排序
if ('fine_num' == $params['order']) {//精品标签数排序
$order = $params['order'];
$search_type = 0 == $search_type || 1 == $search_type ? 1: 3;
} else if('admin_id' == $params['order']){//销售员ID排序
$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('sold_time' == $params['order']){//售卖时间排序
} else if ('sold_time' == $params['order']) {//售卖时间排序
$order = 'bill_time';
} else if($params['order']){
} else if ($params['order']) {
$order = $params['order'];
} else {
$params['order'] = $order;
}
$sort = 'desc';
if($params['sort']){
if ($params['sort']) {
$sort = $params['sort'];
} else {
$params['sort'] = $sort;
}
$autoList[1] = $this->mdAutoBrand->select(array('status' => 1), 'id desc', 0, 0, 'id,name');
switch($search_type){
switch ($search_type) {
case 1://精品筛选
$count = $this->mdItems->count_fine($where_1);
break;
@@ -924,44 +963,44 @@ class Goods extends HD_Controller
$count = $this->mdItems->count($where);
}
if($count > 10000){
if ($count > 10000) {
return $this->show_json(SYS_CODE_FAIL, '数据量超过1w导出太为难我了');
} else if(0 == $count) {
} else if (0 == $count) {
return $this->show_json(SYS_CODE_SUCCESS, '当前没有数据');
}
$fileName = "车辆明细";
$indexs = array(
'id' => 'ID',
'brand_name' =>'品牌',
's_name' =>'车系',
'v_name' =>'车型',
'cor_name' =>'车身颜色',
'incor_name' =>'内饰颜色',
'ori_price' =>'指导价',
'sale_price' =>'售价',
'bill_price' =>'开票金额',
'buy_price' =>'采购成本',
'dis_price' =>'折扣价',
'discount' =>'折扣百分比',
'brand_name' => '品牌',
's_name' => '车系',
'v_name' => '车型',
'cor_name' => '车身颜色',
'incor_name' => '内饰颜色',
'ori_price' => '指导价',
'sale_price' => '售价',
'bill_price' => '开票金额',
'buy_price' => '采购成本',
'dis_price' => '折扣价',
'discount' => '折扣百分比',
'city_name' => '城市名',
'county_name' => '行政区',
'address' =>'存放地址',
'vin' =>'车架号',
'engine_num' =>'发动机号',
'stdard_num' =>'合格证号',
'bill_num' =>'开票号',
'auto_fine' =>'精品加装',
'status' =>'状态',
'in_time' =>'入库时间',
'out_time' =>'出库时间',
'bill_time' =>'开票时间',
'address' => '存放地址',
'vin' => '车架号',
'engine_num' => '发动机号',
'stdard_num' => '合格证号',
'bill_num' => '开票号',
'auto_fine' => '精品加装',
'status' => '状态',
'in_time' => '入库时间',
'out_time' => '出库时间',
'bill_time' => '开票时间',
);
$lists = array();
$fine_ids = array();
if ($count) {
switch($search_type){
switch ($search_type) {
case 1://精品筛选
$fileds = 'm.*,count(type_id) as fine_num';
$orderby = "{$order} {$sort}";
@@ -974,7 +1013,7 @@ class Goods extends HD_Controller
break;
case 3://精品+订单筛选
$fileds = 'm.*, count(j2.type_id) as fine_num';
if(in_array($order, array('admin_id'))){
if (in_array($order, array('admin_id'))) {
$orderby = "{$order} {$sort}";
} else {
$orderby = "m.{$order} {$sort}";
@@ -988,11 +1027,12 @@ class Goods extends HD_Controller
}
$lists[] = $indexs;
$brand_ids = $s_ids = $attr_vids = $attr_corids = $attr_incorids = $addr_ids = array();
$brand_ids = $s_ids = $attr_vids = $attr_corids = $attr_incorids = $biz_ids = $addr_ids = array();
$ids = array();
foreach($rows as $v){
foreach ($rows as $v) {
$ids[] = $v['id'];
$v['brand_id'] && !in_array($v['brand_id'], $brand_ids) && $brand_ids[] = $v['brand_id'];
$v['biz_id'] && !in_array($v['biz_id'], $biz_ids) && $biz_ids[] = $v['biz_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'];
@@ -1000,33 +1040,38 @@ class Goods extends HD_Controller
$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){
$map_brand = $map_sery = $map_vid = $map_corid = $map_incorid = $map_biz = $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){
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){
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){
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){
if ($attr_incorids) {
$str_ids = implode(',', $attr_incorids);
$where = array("id in ({$str_ids})" => null);
$map_incorid = $this->mdAutoAttr->map('id', 'title', $where);
}
if($addr_ids){
if ($biz_ids) {
$str_ids = implode(',', $biz_ids);
$where = array("id in ({$str_ids})" => null);
$map_biz = $this->mdBiz->map('id', 'biz_name', $where);
}
if ($addr_ids) {
$str_ids = implode(',', $addr_ids);
$where = array("id in ({$str_ids})" => null);
$orderby = 'id desc';
@@ -1039,29 +1084,46 @@ class Goods extends HD_Controller
$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){
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和名称映射
$map_fine = array();
if($fine_ids){
if ($fine_ids) {
$this->load->model('auto/auto_fine_model');
$str_ids = implode(',', $fine_ids);
$where= array("id in ({$str_ids})" => null);
$where = array("id in ({$str_ids})" => null);
$map_fine = $this->auto_fine_model->map('id', 'title', $where);
}
foreach($rows as $v){
$addr = $map_addr[$v['addr_id']];
foreach ($rows as $v) {
//获取并组装精品信息
$fine_ids = $map_item_fine[$v['id']];
$auto_fine = '';
if($fine_ids){
foreach($fine_ids as $fine_id){
if ($fine_ids) {
foreach ($fine_ids as $fine_id) {
$auto_fine = $auto_fine ? "{$auto_fine} {$map_fine[$fine_id]}" : $map_fine[$fine_id];
}
}
$addr = array();
if ($v['biz_id'] > 0) {
$re_biz = $this->mdBiz->get(array('id' => $v['biz_id']));
if ($re_biz['county_id']) {
$re_area = $this->mdArea->get(array('county_id' => $re_biz['county_id']));
if ($re_area) {
$addr = array('city_name' => $re_area['city_name'], 'county_name' => $re_area['county_name']
, 'title' => $map_biz[$v['biz_id']]);
}
} else if ($re_biz['city_id']) {
$re_area = $this->mdArea->get(array('city_id' => $re_biz['city_id']));
if ($re_area) {
$addr = array('city_name' => $re_area['city_name'], 'title' => $map_biz[$v['biz_id']]);
}
}
} else if ($v['biz_id'] == -1 && $v['addr_id']) {
$addr = $map_addr[$v['addr_id']];
}
$lists[] = array(
'id' => $v['id'],
'brand_name' => $map_brand[$v['brand_id']],
@@ -1069,7 +1131,7 @@ class Goods extends HD_Controller
'v_name' => $map_vid[$v['v_id']],
'cor_name' => $map_corid[$v['cor_id']],
'incor_name' => $map_incorid[$v['incor_id']],
'ori_price' =>$v['ori_price'],
'ori_price' => $v['ori_price'],
'sale_price' => $v['sale_price'],
'bill_price' => $v['bill_price'],
'buy_price' => $v['buy_price'],
@@ -1080,7 +1142,7 @@ class Goods extends HD_Controller
'address' => $addr ? $addr['title'] : '',
'vin' => $v['vin'],
'engine_num' => $v['engine_num'],
'stdard_num' =>$v['stdard_num'],
'stdard_num' => $v['stdard_num'],
'bill_num' => $v['bill_num'],
'auto_fine' => $auto_fine,
'status' => $this->statusAry[$v['status']],
+7 -1
View File
@@ -41,6 +41,7 @@ class Customer extends HD_Controller
!$params['cf_title'] && $params['cf_title'] = '';
!$params['qdjl_id'] && $params['qdjl_id'] = '';
!$params['level'] && $params['level'] = '';
!$params['cf_clues'] && $params['cf_clues'] = '';
$page = $params['page'] = $params['page'] ? intval($params['page']) : 1;
$size = $params['size'] = $params['size'] ? intval($params['size']) : 20;
@@ -58,6 +59,9 @@ class Customer extends HD_Controller
if ($params['level']) {
$where['level'] = $params['level'];
}
if ($params['cf_clues']) {
$where['cf_clues'] = $params['cf_clues'];
}
!$params['search_tp'] && $params['search_tp'] = 'mobile';
strlen($params['status']) && $where["status"] = $params['status'];
$params['cf_title'] && $where['cf_title'] = $params['cf_title'];
@@ -164,7 +168,7 @@ class Customer extends HD_Controller
$count = $this->customers_model->count($where);
$lists = [];
if ($count) {
$fileds = 'id,name,mobile,cf_title,cont_time,admin_id,status,biz_id,cf_id,level';
$fileds = 'id,name,mobile,cf_title,cf_clues,cont_time,admin_id,status,biz_id,cf_id,level';
$rows = $this->customers_model->select($where, 'id desc', $page, $size, $fileds);
//获取来源
$cf_id_arr = array_unique(array_column($rows, 'cf_id'));
@@ -188,6 +192,7 @@ class Customer extends HD_Controller
'mobile_sub' => $mobile_sub,
'level' => $val['level'],
'cf_title' => $val['cf_title'],
'cf_clues' => $val['cf_clues'],
'cf_name' => isset($cf_rows[$val['cf_id']]) ? $cf_rows[$val['cf_id']][0]['title'] : '',
'status_name' => $status_arr[$val['status']],
'admin_name' => isset($admin_rows[$val['admin_id']]) ? $admin_rows[$val['admin_id']][0]['uname'] : '',
@@ -199,6 +204,7 @@ class Customer extends HD_Controller
//渠道经理
$qdjl_lists = $this->app_licheb_users_model->select(array('group_id' => 4, 'status' => 1, 'biz_id<>' => '0'), 'id desc', 0, 0, 'id,uname as name');
$show_info['levelAry'] = $this->customers_model->get_sdata('level');
$show_info['cfCluesAry'] = $this->customers_model->get_sdata('cfrom_clues');
$this->data['show_info'] = $show_info;
$this->data['lists'] = $lists;
$this->data['pager'] = array('count' => ceil($count / $size), 'curr' => $page, 'totle' => $count);
+126 -65
View File
@@ -5,6 +5,7 @@
margin-top: 10px;
font-size: 0;
}
.label-group {
display: inline-block;
margin-right: 4px;
@@ -12,23 +13,27 @@
font-size: 0;
white-space: nowrap;
}
.label-group-wrap .label, .label-group>.label {
.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 {
.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 {
.label-group-wrap .label, .label-group > .label {
font-size: 10px;
font-weight: normal;
margin-right: 1px;
@@ -109,10 +114,12 @@
<td class="table-td" colspan="2">
<div class="input-group">
<div class="input-group-addon">精品加装</div>
<button type="button" class="am-btn am-btn-default am-btn-sm" @click="fine_modal">+</button>
<button type="button" class="am-btn am-btn-default am-btn-sm" @click="fine_modal">+
</button>
<div class="label-group-wrap label-group-sortable ml10" style="display: inline">
<div class="label-group" v-for="(v,i) in fines" style="margin-bottom:0px;">
<span class="label label-default sort-shop-list" :data-id="v.id" :data-name="v.title"
<span class="label label-default sort-shop-list" :data-id="v.id"
:data-name="v.title"
:data-sort="i">{{v.title}}</span>
<a href="javascript:void(0);" @click="rm_fine(i)" class="label label-default"><i
class="fa fa-remove"></i></a>
@@ -136,15 +143,24 @@
<td class="table-td" colspan="2">
<div class="input-group">
<div class="input-group-addon">存放地址</div>
<select title="城市" style="display: inline;width: 20%" name="" v-model="info.city_id">
<select title="城市" style="display: inline;width: 15%" name="" v-model="info.city_id">
<option value="">选择城市</option>
<option :value="v.id" v-for="(v,i) in cityAry">{{v.name}}</option>
</select>
<select title="行政区" name="county_id" style="display: inline;width: 20%;margin-left: 5px;" v-model="info.county_id">
<select title="行政区" name="county_id"
style="display: inline;width: 15%;margin-left: 5px;" v-model="info.county_id"
@change="set_county">
<option value="">选择行政区</option>
<option :value="v.id" v-for="(v,i) in countyAry">{{v.name}}</option>
</select>
<select title="地址" name="addr_id" style="display: inline;width: 50%;margin-left: 5px;" v-model="info.addr_id">
<select name="biz_id" style="display: inline;width: 25%;margin-left: 5px;"
v-model="info.biz_id">
<option value="">选择门店</option>
<option :value="v.id" v-for="(v,i) in bizAry">{{v.title}}</option>
</select>
<select v-if="info.biz_id==-1" title="地址" name="addr_id"
style="display: inline;width: 42%;margin-left: 5px;"
v-model="info.addr_id">
<option value="">选择地址</option>
<option :value="v.id" v-for="(v,i) in addrAry">{{v.title}}</option>
</select>
@@ -190,7 +206,8 @@
<td class="table-td">
<div class="input-group">
<div class="input-group-addon">入库日期</div>
<input id="in_time_id" type="text" value="<?= $info['in_time'] ?>" placeholder="请输入或选择入库日期">
<input id="in_time_id" type="text" value="<?= $info['in_time'] ?>"
placeholder="请输入或选择入库日期">
</div>
</td>
<!--<td class="table-td">
@@ -325,11 +342,12 @@
data: {
info: {},
showInfo: {'autoList': []},
cityAry:[],
countyAry:[],
addrAry:[],
fines:[],
modal_fine:{title:'', lists:[], selected:[], page:1, size:10, total:0}
cityAry: [],
countyAry: [],
addrAry: [],
bizAry: [],
fines: [],
modal_fine: {title: '', lists: [], selected: [], page: 1, size: 10, total: 0}
},
mounted: function () {
var that = this;
@@ -415,7 +433,7 @@
//获取精品
var fine_ids = [];
for(var i in vm.fines){
for (var i in vm.fines) {
fine_ids.push(vm.fines[i]['id']);
}
vm.info.fine_ids = fine_ids;
@@ -455,13 +473,13 @@
},
});
},
set_attr:function(){
set_attr: function () {
var vm = this;
if(parseFloat(vm.info.ori_price) > 0){
if (parseFloat(vm.info.ori_price) > 0) {
//价格为空才联动获取裸车价
return;
}
if(vm.info.v_id > 0 && vm.info.cor_id>0 && vm.info.incor_id>0){
if (vm.info.v_id > 0 && vm.info.cor_id > 0 && vm.info.incor_id > 0) {
$.ajax({
url: '/auto/cars/json_get',
type: 'post',
@@ -470,8 +488,8 @@
brand_id: vm.info.brand_id,
s_id: vm.info.s_id,
v_id: vm.info.v_id,
cor_id:vm.info.cor_id,
incor_id:vm.info.incor_id
cor_id: vm.info.cor_id,
incor_id: vm.info.incor_id
},
success: function (res) {
if (res.data) {
@@ -482,7 +500,7 @@
});
}
},
init_citys:function() {
init_citys: function () {
var vm = this;
$.ajax({
type: 'get',
@@ -500,18 +518,23 @@
}
});
},
init_fines:function(){
set_county: function () {
var that = this;
that.bizAry = that.addrAry = [];
that.info.biz_id = that.info.addr_id = '';
}
init_fines: function () {
var vm = this;
if(vm.info.fine_ids.length > 0){
if (vm.info.fine_ids.length > 0) {
$.ajax({
type: 'post',
url: '/auto/fine/json_lists',
dataType: 'json',
data: {
id: vm.info.fine_ids.join(','),
status:1
status: 1
},
success:function(response){
success: function (response) {
if (response.code == 1) {
vm.fines = response.data.list;
}
@@ -519,11 +542,11 @@
});
}
},
fine_modal:function(){
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.modal_fine = {title: '', lists: [], selected: selects, page: 1, size: 10, total: 0, next: 0};
vm.get_fines();
layer.open({
type: 1,
@@ -538,16 +561,16 @@
}
});
},
get_fines:function(page){
get_fines: function (page) {
var vm = this;
if(0 == page){
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;
} else if (1 == page) {
vm.modal_fine.page += 1;
} else if (-1 == page) {
vm.modal_fine.page -= 1;
}
$.ajax({
type: 'post',
@@ -556,24 +579,24 @@
data: {
page: vm.modal_fine.page,
size: vm.modal_fine.size,
status:1,
title:vm.modal_fine.title
status: 1,
title: vm.modal_fine.title
},
success:function(response){
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;
if (vm.modal_fine.page * vm.modal_fine.size < vm.modal_fine.total) {
vm.modal_fine.next = 1;
} else {
vm.modal_fine.next=0;
vm.modal_fine.next = 0;
}
for(var i in vm.modal_fine.lists){
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){
for (var j in vm.modal_fine.selected) {
var selected = vm.modal_fine.selected[j];
if(fine.id == selected.id){
if (fine.id == selected.id) {
fine.checked = 1;
}
}
@@ -582,17 +605,17 @@
}
});
},
set_fine:function(index, checked){
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};
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){
for (var i in vm.modal_fine.selected) {
selected = vm.modal_fine.selected[i];
if(fine.id == selected.id){
if (fine.id == selected.id) {
vm.modal_fine.selected.splice(i, 1);
break;
}
@@ -600,19 +623,19 @@
}
vm.$forceUpdate();
},
rm_fine:function(index){
rm_fine: function (index) {
var vm = this;
vm.fines.splice(index, 1);
}
},
watch:{
'info.city_id':function(nv, ov){
watch: {
'info.city_id': function (nv, ov) {
var that = this;
if(nv == ''){
if (nv == '') {
that.countyAry = [];
that.info.county_id = '';
} else {
if(nv.substring(0,4) != that.info.county_id.substring(0, 4)){
if (nv.substring(0, 4) != that.info.county_id.substring(0, 4)) {
that.info.county_id = '';
}
$.ajax({
@@ -621,10 +644,10 @@
dataType: 'json',
data: {
id: nv,
key:'county',
type:1
key: 'county',
type: 1
},
success:function(response){
success: function (response) {
if (response.code == 1) {
that.countyAry = response.data;
}
@@ -632,9 +655,47 @@
});
}
},
'info.county_id':function(nv, ov){
'info.county_id': function (nv, ov) {
var that = this;
if(nv == ''){
if (nv == '') {
that.bizAry = that.addrAry = [];
that.info.biz_id = that.info.addr_id = '';
} else {
$.ajax({
type: 'post',
url: '/biz/store/store/json_lists',
dataType: 'json',
data: {
city_id: that.info.city_id,
county_id: that.info.county_id,
status: 1
},
success: function (response) {
if (response.code == 1) {
that.bizAry = response.data.list;
that.bizAry.push({id: -1, title: '其它'});
var biz_id = '';
if (that.info.biz_id > 0 || that.info.biz_id == -1) {
for (var i in that.bizAry) {
if (that.info.biz_id == that.bizAry[i].id) {
biz_id = that.info.biz_id;
break;
}
}
}
that.info.biz_id = biz_id;
}
}
});
}
},
'info.biz_id': function (nv, ov) {
var that = this;
if (that.info.biz_id != -1) {
return;
}
nv = that.info.county_id;
if (nv == '') {
that.addrAry = [];
that.info.addr_id = '';
} else {
@@ -644,26 +705,26 @@
dataType: 'json',
data: {
county_id: nv,
status:1
status: 1
},
success:function(response){
success: function (response) {
if (response.code == 1) {
var addr_id = '';
that.addrAry = response.data.lists;
if(that.info.addr_id>0){
var addr_id = '';
for(var i in that.addrAry){
if(that.info.addr_id == that.addrAry[i].id){
if (that.info.addr_id > 0) {
for (var i in that.addrAry) {
if (that.info.addr_id == that.addrAry[i].id) {
addr_id = that.info.addr_id;
break;
}
}
that.info.addr_id = addr_id;
}
that.info.addr_id = addr_id;
}
}
});
}
}
},
}
});
});
+170 -106
View File
@@ -5,6 +5,7 @@
margin-top: 10px;
font-size: 0;
}
.label-group {
display: inline-block;
margin-right: 4px;
@@ -12,35 +13,40 @@
font-size: 0;
white-space: nowrap;
}
.label-group-wrap .label, .label-group>.label {
.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 {
.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 {
.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{
.order-none {
height: 38px;
}
@@ -50,7 +56,7 @@
position: relative;
}
.order a{
.order a {
display: block;
overflow: hidden;
width: 100%;
@@ -157,7 +163,7 @@
</div>
<div class="am-form-group fl">
<div class="am-para-inline w120">
<select title="行政区" name="county_id" v-model="params.county_id">
<select title="行政区" name="county_id" v-model="params.county_id" @change="set_county">
<option value="">选择行政区</option>
<option :value="v.id" v-for="(v,i) in countyAry">{{v.name}}</option>
</select>
@@ -165,6 +171,14 @@
</div>
<div class="am-form-group fl">
<div class="am-para-inline w120">
<select title="门店" name="biz_id" v-model="params.biz_id" @change="set_biz">
<option value="">选择门店</option>
<option :value="v.id" v-for="(v,i) in bizAry">{{v.title}}</option>
</select>
</div>
</div>
<div class="am-form-group fl" v-if="params.biz_id==-1">
<div class="am-para-inline w160">
<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>
@@ -174,7 +188,7 @@
<div class="am-form-group">
<label class="am-para-label w100">车架号:</label>
<div class="am-para-inline w200">
<input type="text" name="vin" placeholder="车架号关键字" v-model="params.vin" />
<input type="text" name="vin" placeholder="车架号关键字" v-model="params.vin"/>
</div>
</div>
<div class="am-form-group fl">
@@ -191,13 +205,14 @@
<div class="am-para-inline">
<div class="label-group-wrap label-group-sortable" style="display: inline">
<div class="label-group" v-for="(v,i) in fines">
<span class="label label-default sort-shop-list" :data-id="v.id" :data-name="v.title"
<span class="label label-default sort-shop-list" :data-id="v.id"
:data-name="v.title"
:data-sort="i">{{v.title}}</span>
<a href="javascript:void(0);" @click="rm_fine(i)" class="label label-default"><i
class="fa fa-remove"></i></a>
</div>
</div>
<input type="hidden" name="fine_ids" v-model="params.fine_ids" />
<input type="hidden" name="fine_ids" v-model="params.fine_ids"/>
<button type="button" class="am-btn am-btn-default am-btn-sm" @click="fine_modal">+</button>
</div>
</div>
@@ -252,7 +267,7 @@
</a>
</span>
</th>
<th width="18%">
<th width="21%">
<span :class="'order'+('addr_id'==params.order?' order-on':' order-none')">
<a href="javascript:void(0)" @click="set_order('addr_id')">
<span>存放地</span>
@@ -270,7 +285,7 @@
</a>
</span>
</th>
<th width="18%">
<th width="16%">
<span :class="'order'+('fine_num'==params.order?' order-on':' order-none')">
<a href="javascript:void(0)" @click="set_order('fine_num')">
<span>精品加装</span>
@@ -283,21 +298,21 @@
</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>
<a href="javascript:void(0);" :data-modal="'/items/goods/goods/get_info?id='+v.id" data-title="详情">{{v.vin}}</a>
</td>
<td>{{v.address}}</td>
<td>{{v.in_time}}</td>
<td>{{v.auto_fine}}</td>
<td>
<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>
<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>
<a href="javascript:void(0);" :data-modal="'/items/goods/goods/get_info?id='+v.id" data-title="详情">{{v.vin}}</a>
</td>
<td>{{v.address}}</td>
<td>{{v.in_time}}</td>
<td>{{v.auto_fine}}</td>
<td>
<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>
@@ -421,18 +436,19 @@
vue_obj = new Vue({
el: '.coms-table-wrap',
data: {
params:[],
statusAry:[],//状态
cityAry:[],//城市
countyAry:[],//行政区
addrAry:[],//地址
fines:[],//搜索条件精品列表
fine_ids:[],//列表所有选中的精品列表
lists:[],
attrs_cor:[],//车身颜色选项
modal_fine:{title:'', lists:[], selected:[], page:1, size:10, total:0}
params: [],
statusAry: [],//状态
cityAry: [],//城市
countyAry: [],//行政区
bizAry: [],//门店
addrAry: [],//地址
fines: [],//搜索条件精品列表
fine_ids: [],//列表所有选中的精品列表
lists: [],
attrs_cor: [],//车身颜色选项
modal_fine: {title: '', lists: [], selected: [], page: 1, size: 10, total: 0}
},
mounted:function() {
mounted: function () {
var vm = this;
vm.lists = <?=json_encode($lists)?>;
vm.params = <?=json_encode($params)?>;
@@ -443,8 +459,8 @@
vm.init_fines_lists();
vm.set_sery();
},
methods:{
init_citys:function() {
methods: {
init_citys: function () {
var vm = this;
$.ajax({
type: 'get',
@@ -462,18 +478,28 @@
}
});
},
init_fines:function(){
set_county: function () {
var that = this;
that.bizAry = that.addrAry = [];
that.params.biz_id = that.params.addr_id = '';
},
set_biz: function () {
var that = this;
that.addrAry = [];
that.params.addr_id = '';
},
init_fines: function () {
var vm = this;
if(vm.params.fine_ids.length > 0){
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
status: 1
},
success:function(response){
success: function (response) {
if (response.code == 1) {
vm.fines = response.data.list;
}
@@ -481,32 +507,32 @@
});
}
},
init_fines_lists:function(){//初始化列表中精品
init_fines_lists: function () {//初始化列表中精品
var vm = this;
if(vm.fine_ids.length > 0){
if (vm.fine_ids.length > 0) {
$.ajax({
type: 'post',
url: '/auto/fine/json_lists',
dataType: 'json',
data: {
id: vm.fine_ids.join(','),
status:1
status: 1
},
success:function(response){
success: function (response) {
if (response.code == 1) {
var fines = response.data.list;
var map_fine = {};
for(var i in fines){
for (var i in fines) {
var fine = fines[i];
map_fine[fine.id] = fine;
}
for(i in vm.lists){
for (i in vm.lists) {
var goods = vm.lists[i];
var auto_fine = '';
for(var j in goods.fine_ids){
for (var j in goods.fine_ids) {
var fine_id = goods.fine_ids[j];
fine = map_fine[fine_id];
if(undefined != fine){
if (undefined != fine) {
auto_fine += fine.title + " ";
}
}
@@ -518,11 +544,11 @@
});
}
},
fine_modal:function(){
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.modal_fine = {title: '', lists: [], selected: selects, page: 1, size: 10, total: 0, next: 0};
vm.get_fines();
layer.open({
type: 1,
@@ -535,28 +561,28 @@
layer.close(index);
vm.fines = JSON.parse(JSON.stringify(vm.modal_fine.selected));
var fine_ids = '';
for(var i in vm.fines){
for (var i in vm.fines) {
var fine = vm.fines[i];
if('' == fine_ids){
if ('' == fine_ids) {
fine_ids = fine.id;
} else{
fine_ids += ','+ fine.id
} else {
fine_ids += ',' + fine.id
}
}
vm.params.fine_ids = fine_ids;
}
});
},
get_fines:function(page){
get_fines: function (page) {
var vm = this;
if(0 == page){
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;
} else if (1 == page) {
vm.modal_fine.page += 1;
} else if (-1 == page) {
vm.modal_fine.page -= 1;
}
$.ajax({
type: 'post',
@@ -565,24 +591,24 @@
data: {
page: vm.modal_fine.page,
size: vm.modal_fine.size,
status:1,
title:vm.modal_fine.title
status: 1,
title: vm.modal_fine.title
},
success:function(response){
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;
if (vm.modal_fine.page * vm.modal_fine.size < vm.modal_fine.total) {
vm.modal_fine.next = 1;
} else {
vm.modal_fine.next=0;
vm.modal_fine.next = 0;
}
for(var i in vm.modal_fine.lists){
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){
for (var j in vm.modal_fine.selected) {
var selected = vm.modal_fine.selected[j];
if(fine.id == selected.id){
if (fine.id == selected.id) {
fine.checked = 1;
}
}
@@ -591,17 +617,17 @@
}
});
},
set_fine:function(index, checked){
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};
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){
for (var i in vm.modal_fine.selected) {
selected = vm.modal_fine.selected[i];
if(fine.id == selected.id){
if (fine.id == selected.id) {
vm.modal_fine.selected.splice(i, 1);
break;
}
@@ -609,34 +635,34 @@
}
vm.$forceUpdate();
},
rm_fine:function(index){
rm_fine: function (index) {
var vm = this;
vm.fines.splice(index, 1);
var fine_ids = '';
for(var i in vm.fines){
for (var i in vm.fines) {
var fine = vm.fines[i];
if('' == fine_ids){
if ('' == fine_ids) {
fine_ids = fine.id;
} else{
fine_ids += ','+ fine.id
} else {
fine_ids += ',' + fine.id
}
}
vm.params.fine_ids = fine_ids;
},
set_sery:function(){
set_sery: function () {
var vm = this;
var s_id = $('#bd-auto2-id').val();
if(s_id > 0){
if (s_id > 0) {
$.ajax({
type: 'post',
url: '/auto/attr/json_lists',
dataType: 'json',
data: {
s_id: s_id,
status:1,
type:0
status: 1,
type: 0
},
success:function(response){
success: function (response) {
if (response.code == 1) {
vm.attrs_cor = response.data.list;
}
@@ -647,11 +673,11 @@
vm.params.cor_id = '';
}
},
set_order:function(order){
set_order: function (order) {
var vm = this;
var sort = vm.params.sort;
if(vm.params.order == order){
if(vm.params.sort == 'desc'){
var sort = vm.params.sort;
if (vm.params.order == order) {
if (vm.params.sort == 'desc') {
sort = 'asc';
} else {
sort = 'desc';
@@ -667,7 +693,7 @@
$('#order').val(order);
$('.form-search').submit();
},
reset:function(){
reset: function () {
var that = this;
that.params.cor_id = '';
that.params.city_id = '';
@@ -680,14 +706,14 @@
$('#bd-auto3-id').val(0);
}
},
watch:{
'params.city_id':function(nv, ov){
watch: {
'params.city_id': function (nv, ov) {
var that = this;
if(nv == ''){
if (nv == '') {
that.countyAry = [];
that.params.county_id = '';
} else {
if(nv.substring(0,4) != that.params.county_id.substring(0, 4)){
if (nv.substring(0, 4) != that.params.county_id.substring(0, 4)) {
that.params.county_id = '';
}
$.ajax({
@@ -696,10 +722,10 @@
dataType: 'json',
data: {
id: nv,
key:'county',
type:1
key: 'county',
type: 1
},
success:function(response){
success: function (response) {
if (response.code == 1) {
that.countyAry = response.data;
}
@@ -707,9 +733,47 @@
});
}
},
'params.county_id':function(nv, ov){
'params.county_id': function (nv, ov) {
var that = this;
if(nv == ''){
if (nv == '') {
that.bizAry = that.addrAry = [];
that.params.biz_id = that.params.addr_id = '';
} else {
$.ajax({
type: 'post',
url: '/biz/store/store/json_lists',
dataType: 'json',
data: {
city_id: that.params.city_id,
county_id: that.params.county_id,
status: 1
},
success: function (response) {
if (response.code == 1) {
that.bizAry = response.data.list;
that.bizAry.push({id: -1, title: '其它'});
var biz_id = '';
if (that.params.biz_id > 0 || that.params.biz_id == -1) {
for (var i in that.bizAry) {
if (that.params.biz_id == that.bizAry[i].id) {
biz_id = that.params.biz_id;
break;
}
}
}
that.params.biz_id = biz_id;
}
}
});
}
},
'params.biz_id': function (nv, ov) {
var that = this;
if (that.params.biz_id != -1) {
return;
}
nv = that.params.county_id;
if (nv == '') {
that.addrAry = [];
that.params.addr_id = '';
} else {
@@ -719,15 +783,15 @@
dataType: 'json',
data: {
county_id: nv,
status:1
status: 1
},
success:function(response){
success: function (response) {
if (response.code == 1) {
that.addrAry = response.data.lists;
if(that.params.addr_id>0){
if (that.params.addr_id > 0) {
var addr_id = '';
for(var i in that.addrAry){
if(that.params.addr_id == that.addrAry[i].id){
for (var i in that.addrAry) {
if (that.params.addr_id == that.addrAry[i].id) {
addr_id = that.params.addr_id;
break;
}
+84 -23
View File
@@ -154,17 +154,29 @@
<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 class="am-form-group fl">
<div class="am-para-inline w120">
<select title="行政区" name="county_id" v-model="params.county_id" @change="set_county">
<option value="">选择行政区</option>
<option :value="v.id" v-for="(v,i) in countyAry">{{v.name}}</option>
</select>
</div>
</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 class="am-form-group fl">
<div class="am-para-inline w120">
<select title="门店" name="biz_id" v-model="params.biz_id" @change="set_biz">
<option value="">选择门店</option>
<option :value="v.id" v-for="(v,i) in bizAry">{{v.title}}</option>
</select>
</div>
</div>
<div class="am-form-group fl" v-if="params.biz_id==-1">
<div class="am-para-inline w160">
<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>
<div class="am-form-group">
@@ -456,6 +468,7 @@
statusAry:[],//状态
cityAry:[],//城市
countyAry:[],//行政区
bizAry: [],//门店
addrAry:[],//地址
admins: {cityAry: [], countyAry: [], bizAry: [], list: []},
fines:[],//搜索条件精品列表
@@ -495,6 +508,16 @@
}
});
},
set_county: function () {
var that = this;
that.bizAry = that.addrAry = [];
that.params.biz_id = that.params.addr_id = '';
},
set_biz: function () {
var that = this;
that.addrAry = [];
that.params.addr_id = '';
},
init_fines:function(){
var vm = this;
if(vm.params.fine_ids.length > 0){
@@ -714,13 +737,13 @@
}
},
watch:{
'params.city_id':function(nv, ov){
'params.city_id': function (nv, ov) {
var that = this;
if(nv == ''){
if (nv == '') {
that.countyAry = [];
that.params.county_id = '';
} else {
if(nv.substring(0,4) != that.params.county_id.substring(0, 4)){
if (nv.substring(0, 4) != that.params.county_id.substring(0, 4)) {
that.params.county_id = '';
}
$.ajax({
@@ -729,10 +752,10 @@
dataType: 'json',
data: {
id: nv,
key:'county',
type:1
key: 'county',
type: 1
},
success:function(response){
success: function (response) {
if (response.code == 1) {
that.countyAry = response.data;
}
@@ -740,9 +763,47 @@
});
}
},
'params.county_id':function(nv, ov){
'params.county_id': function (nv, ov) {
var that = this;
if(nv == ''){
if (nv == '') {
that.bizAry = that.addrAry = [];
that.params.biz_id = that.params.addr_id = '';
} else {
$.ajax({
type: 'post',
url: '/biz/store/store/json_lists',
dataType: 'json',
data: {
city_id: that.params.city_id,
county_id: that.params.county_id,
status: 1
},
success: function (response) {
if (response.code == 1) {
that.bizAry = response.data.list;
that.bizAry.push({id: -1, title: '其它'});
var biz_id = '';
if (that.params.biz_id > 0 || that.params.biz_id == -1) {
for (var i in that.bizAry) {
if (that.params.biz_id == that.bizAry[i].id) {
biz_id = that.params.biz_id;
break;
}
}
}
that.params.biz_id = biz_id;
}
}
});
}
},
'params.biz_id': function (nv, ov) {
var that = this;
if (that.params.biz_id != -1) {
return;
}
nv = that.params.county_id;
if (nv == '') {
that.addrAry = [];
that.params.addr_id = '';
} else {
@@ -752,15 +813,15 @@
dataType: 'json',
data: {
county_id: nv,
status:1
status: 1
},
success:function(response){
success: function (response) {
if (response.code == 1) {
that.addrAry = response.data.lists;
if(that.params.addr_id>0){
if (that.params.addr_id > 0) {
var addr_id = '';
for(var i in that.addrAry){
if(that.params.addr_id == that.addrAry[i].id){
for (var i in that.addrAry) {
if (that.params.addr_id == that.addrAry[i].id) {
addr_id = that.params.addr_id;
break;
}
+15 -5
View File
@@ -45,9 +45,17 @@
</select>
</div>
</div>
<div class="am-form-group fl">
<label class="am-para-label w100">客户来源:</label>
<label class="am-para-label w120">线上来源:</label>
<div class="am-form-group am-para-inline w150">
<select name="cf_clues" v-model="params.cf_clues">
<option value="">请选择</option>
<option :value="i" v-for="(v,i) in show_info.cfCluesAry">{{v}}</option>
</select>
</div>
</div>
<div class="am-form-group fl">
<label class="am-para-label w120">线下来源:</label>
<div class="am-form-group am-para-inline w150">
<select name="cfrom_id" v-model="cfrom_id">
<option value=0>请选择</option>
@@ -161,7 +169,8 @@
<th width="5%"><span>客户电话</span></th>
<th width="5%"><span>客户等级</span></th>
<th width="6%"><span>来源类型</span></th>
<th width="8%"><span>客户来源</span></th>
<th width="8%"><span>线上来源</span></th>
<th width="8%"><span>线下来源</span></th>
<th width="8%"><span>所属门店</span></th>
<th width="5%"><span>状态</span></th>
<th width="5%"><span>销售员</span></th>
@@ -176,6 +185,7 @@
<td>{{v.mobile_sub}}</td>
<td>{{v.level}}</td>
<td>{{v.cf_title}}</td>
<td>{{v.cf_clues}}</td>
<td>{{v.cf_name}}</td>
<td>{{v.biz_name}}</td>
<td>{{v.status_name}}</td>
@@ -183,7 +193,7 @@
<td>{{v.cont_time}}</td>
</tr>
<tr>
<td colspan="10">
<td colspan="11">
<div class="row">
<div class="col-md-4 align-l">
</div>
@@ -268,7 +278,7 @@
cfroms: [],
cfroms2: [],
admins: {cityAry: [], countyAry: [], bizAry: [], list: []},
show_info: {levelAry: []},
show_info: {levelAry: [], cfCluesAry: []},
},
mounted: function () {
var vm = this;
@@ -15,6 +15,7 @@ class Receiver_customers_model extends HD_Model
private $status_arr = [-1 => '删除', 0 => '未见客户', 1 => '到店客户', 2 => '订单客户', 3 => '战败客户'];
private $level = ['H', 'A', 'B', 'C', 'D'];
private $cfrom_arr = ['自有资源', '平台分配', '素材推广'];
private $cfrom_clues_arr = ['自然进店', '外展', 'DM', '转介绍', '其它'];
private $buy_time = [3, 7, 15, 30];
public function __construct()
@@ -53,6 +54,9 @@ class Receiver_customers_model extends HD_Model
case 'cfrom':
$result = $this->cfrom_arr;
break;
case 'cfrom_clues':
$result = $this->cfrom_clues_arr;
break;
case 'btime':
$result = $this->buy_time;
break;