var module='<?php echo "__MODULE__";?>';
html{_overflow-y:scroll}
车源ID优车库ID拥有者上牌时间行驶里程(无排序)归属地价格(无排序)发布时间是否已售认证等级是否上架上架时间人气推荐出厂日期是否停止出售保存"is_stop字段值"操作
<?php foreach ($list as $key => $value) { ?>
<?php echo $value['id'];?><?php echo $value['yck_id'];?><?php if(isset($value['owner_id']) && !isset($value['organ_id'])){echo "个人:".$value['owner_id'];}elseif(!isset($value['owner_id']) && isset($value['organ_id'])){echo "车商:".$value['organ_id'];}?><?php echo $value['license_reg_date'];?><?php echo $value['kilometre'];?><?php echo $value['owenership_place'];?><?php echo $value['price'];?><?php echo $value['published_time'];?><?php echo $value['is_sold'];?><?php echo $value['level'];?><?php if($value['shift_status'] == "已上架"){;?><?php echo $value['shift_time_status'] ;?><?php echo $value['is_pop_recommend'];?><?php echo $value['production_date'];?><?php echo $value['is_stop'];?> 详细page:
for($i=1;$i<=$pagecount;$i++){
if($i==1){
if($nowpage==$i){
echo "".$i."";
}else{
echo "".$i."";
}
}elseif(($nowpage-$i)>=3){
echo "...";
$i=$nowpage-3;
}elseif(($nowpage-$i)<3&&$nowpage>$i){
echo "".$i."";
}elseif($nowpage==$i){
echo "".$i."";
}elseif(($i-$nowpage)<3&&$nowpage
echo "".$i."";
}elseif(($i-$nowpage)>=3){
echo "...,";
echo "".$pagecount."";
break;
}
if($i!=$pagecount)echo ",";
}
?>
$(function(){
$('.shift').click(function(e){
var cid = $(this).attr('name');
var shift_info = $(this).html();
var con_info;
//获取出售状态
var _sold = $("#sold_"+cid).html();
//获取停止状态
var _stop = $("#stop_"+cid).html();
//获取描述停止出售状态的对象
var _stop_status = $("#stop_status_"+cid);
if(shift_info == "已上架" && _stop == "1"){
con_info = confirm("请确认是否下架!");
}else if(shift_info == "已上架" && _stop == "0"){
alert("用户没有要求停止出售,不能下架;如必须下架,请到详情操作里面更改停止出售状态!");
return false;
}else if(shift_info == "已下架" && _stop == "0"){
con_info = confirm("请确认是否上架!");
}else if(shift_info == "已下架" && _stop == "1"){
alert("用户已要求停止出售,不能上架;如有问题请联系客户,客户确认后,请到详情操作里面更改停止出售状态!");
return false;
}else if(shift_info == "未上架" && _stop == "0"){
con_info = confirm("请确认是否上架!");
}else if(shift_info == "未上架" && _stop == "1"){
alert("用户已要求停止出售,不能上架;如有问题请联系客户,客户确认后,请到详情操作里面更改停止出售状态!");
return false;
}
var _shift = $(this);
var _color = _shift.parent();
var _abc = _color.parent().next();
var data = {
cid:cid,
shift_info:shift_info,
};
if(con_info == true){
$.post(module+'/CarManagement/is_shift',data,function(msg){
var arr = eval("("+msg+")");
if(arr[0] == 1){
_color.attr("color","green");
_shift.html('已上架');
_abc.html(arr[1]);
if(_sold == "已售"){
_stop_status.html("此车已出售");
}else if(_sold == "未售" && _stop == "0"){
_stop_status.html("正在出售中");
}else if(_sold == "未售" && _stop == "1"){
_stop_status.html("预停止出售");
}
}else if(arr[0] == 0){
_color.attr("color","blue");
_shift.html('已下架');
_abc.empty();
if(_sold == "已售"){
_stop_status.html("此车已出售");
}else if(_sold == "未售" && _stop == "1"){
_stop_status.html("已停止出售");
}
}else{
alert(arr[0]);
}
},'text');
}
});
});
var get_arr = new Array();
$(function(){
var get_str = window.location.href.split("?");
if(get_str.length>1)get_arr = get_str[1].split("&");
if(get_arr.length>1){
var the_get=new Array();
for(var i=0;i
the_get=get_arr[i].split("=");
if(the_get[0]=="brand"){
$('#brandlist option[value="'+decodeURI(the_get[1])+'"]').attr('selected',true);
}
if(the_get[0]=="series"){
$('#serieslist option[value="'+decodeURI(the_get[1])+'"]').attr('selected',true);
}
if(the_get[0]=="type_name"){
$('#type_namelist option[value="'+decodeURI(the_get[1])+'"]').attr('selected',true);
}
if(the_get[0]=="year"){
$('#yearlist option[value="'+decodeURI(the_get[1])+'"]').attr('selected',true);
}
if(the_get[0]=="emission"){
$('#emissionlist option[value="'+decodeURI(the_get[1])+'"]').attr('selected',true);
}
if(the_get[0]=="engine"){
$('#enginelist option[value="'+decodeURI(the_get[1])+'"]').attr('selected',true);
}
if(the_get[0]=="gear_box"){
$('#gear_boxlist option[value="'+decodeURI(the_get[1])+'"]').attr('selected',true);
}
if(the_get[0]=="owenership_place"){
$('#owenership_placelist option[value="'+decodeURI(the_get[1])+'"]').attr('selected',true);
}
if(the_get[0]=="level"){
$('#levellist option[value="'+decodeURI(the_get[1])+'"]').attr('selected',true);
}
if(the_get[0]=="order"){
var order_arr=the_get[1].split("-");
if(order_arr[1]=="StoB")$("#"+order_arr[0]+"_status").text("(由小到大)");
if(order_arr[1]=="BtoS")$("#"+order_arr[0]+"_status").text("(由大到小)");
if(order_arr[1]=="NO")$("#"+order_arr[0]+"_status").text("(无排序)");
}
}
}
})
function href_url(type,value){
var gogogo=0;
if(type=="brand"||type=="series"||type=="type_name"||type=="year"||type=="emission"||type=="engine"||type=="gear_box"||type=="owenership_place"||type=="level"){
//alert($("#brandlist option:selected").text());
//alert($("#brandlist").val());
value=$("#"+type+"list").val();
if(value == "未认证"){
value = 99;
}else if(value == "A++"){
value = 17;
}else if(value == "A+"){
value = 18;
}else if(value == "A"){
value = 19;
}else if(value == "B++"){
value = 27;
}else if(value == "B++"){
value = 28;
}else if(value == "B+"){
value = 29;
}else if(value == "C++" ){
value = 37;
}else if(value == "C++"){
value = 38;
}else if(value == "C"){
value = 39;
}else if(value == "D++"){
value = 47;
}else if(value == 'D+'){
value = 48;
}else if(value == 'D'){
value = 49 ;
}else if(value == 'Z'){
value = 59;
}else if(value == 'F'){
value = 69 ;
}
update_url();
type="page";
value=1;
gogogo=1;
}
if(type=="order_year"||type=="order_emission"||type=="order_kilometre"||type=="order_price"){
if($("#"+type+"_status").text()=="(无排序)"){
value=type+"-StoB";
}else if($("#"+type+"_status").text()=="(由小到大)"){
value=type+"-BtoS";
}else{
value=type+"-NO";
}
type="order";
update_url();
type="page";
value=1;
gogogo=1;
}
if(type=="page"){
update_url();
gogogo=1;
}
function update_url(){
var ik=0;
var the_get=new Array();
for(var ii=0;ii
the_get = get_arr[ii].split("=");
if(the_get[0]==type){
if(value!="0"){
get_arr[ii]=type+"="+value;
}else{
get_arr.splice(ii,1);
}
ik=1;
break;
}
}
if(ik==0&&value!="0")get_arr.push(type+"="+value);
}
if(gogogo==1){
var url_get=get_arr.join("&");
//alert(url_get);return;
window.location.href="__MODULE__/CarManagement/index?"+url_get;
}
}
后台程序处理
public function index() {
//设计每页显示行数,获取当前页码
$line = 20;//每页显示多少行
$nowpage = isset($_GET['page'])?$_GET['page']:1;
//获取当前车源的品牌id
$first_typeid_list = D('CarManagement')->get_typeid();
//根据get参数生成车型条件
if(count($first_typeid_list)>0){
$condition=array("id"=>array('in',$first_typeid_list));
}else{
$condition=array("id"=>array('in','0'));
}
if(isset($_GET['brand']))$condition=$condition+array("brand"=>$_GET['brand']);
if(isset($_GET['series']))$condition=$condition+array("series"=>$_GET['series']);
if(isset($_GET['type_name']))$condition=$condition+array("type_name"=>$_GET['type_name']);
if(isset($_GET['year']))$condition=$condition+array("year"=>$_GET['year']);
if(isset($_GET['emission']))$condition=$condition+array("emission"=>$_GET['emission']);
if(isset($_GET['engine']))$condition=$condition+array("engine"=>$_GET['engine']);
if(isset($_GET['gear_box']))$condition=$condition+array("gear_box"=>$_GET['gear_box']);
//根据条件生成对应的车型条件列表
$brandlist = D('CarManagement')->limitlist("brand",$condition,"type");
$serieslist = D('CarManagement')->limitlist("series",$condition,"type");
$type_namelist = D('CarManagement')->limitlist("type_name",$condition,"type");
$yearlist = D('CarManagement')->limitlist("year",$condition,"type");
$emissionlist = D('CarManagement')->limitlist("emission",$condition,"type");
$enginelist = D('CarManagement')->limitlist("engine",$condition,"type");
$gear_boxlist = D('CarManagement')->limitlist("gear_box",$condition,"type");
//根据车型条件生成car_typeid条件
$car_typeidlist = D('CarManagement')->get_typeid_from_CBC($condition);
$condition=array();
if(count($car_typeidlist)>0){
$condition=array("config_id"=>array('in',$car_typeidlist));
}
//根据get参数生成车源基本信息条件
if(isset($_GET['owenership_place']))$condition=$condition+array("owenership_place"=>$_GET['owenership_place']);
if(isset($_GET['level']))$condition=$condition+array("level"=>$_GET['level']);
//根据条件生成对应的条件车源基本信息列表
$owenership_placelist = D('CarManagement')->limitlist("owenership_place",$condition);
$levellist = D('CarManagement')->limitlist("level",$condition);
//根据$_GET['order']生成order条件
$order="";
if(isset($_GET['order'])){
$order_arr=explode("-",$_GET['order']);
$order_name=explode("_",$order_arr[0]);
if($order_arr[1]=="StoB")$order=$order_name[1];
if($order_arr[1]=="BtoS")$order=$order_name[1]." desc";
}
//获取数据数量
$count = D('CarManagement')->list_count($condition);
if($count==0)$count=1;
//$count=1000;
if(ceil($count/20)
$list = D('CarManagement')->get($line,$nowpage,$condition,$order);
//获取当前url的get参数字段
$url_arr=explode("?",$_SERVER["REQUEST_URI"]);
dump($url_arr);
$url_get_str="?".$url_arr[1];
$this->assign("brandlist", $brandlist);
$this->assign("serieslist", $serieslist);
$this->assign("type_namelist", $type_namelist);
$this->assign("yearlist", $yearlist);
$this->assign("emissionlist", $emissionlist);
$this->assign("enginelist", $enginelist);
$this->assign("gear_boxlist", $gear_boxlist);
$this->assign("owenership_placelist", $owenership_placelist);
$this->assign("levellist", $levellist);
$this->assign("pagecount", ceil($count/20));
$this->assign("nowpage", $nowpage);
$this->assign("list", $list);
$this->assign("url_get_str", $url_get_str);
$this->display();
}