$t){ $strzd.="{\"title\":\"".$t."\"},"; } $json_data.="\"arr_gg_zd\":[".deel_end($strzd)."],"; $sys_ck_input=get_set("sys_ck_input"); $bs_kh_dj=get_set("bs_kh_dj"); $json_data.="\"bs_kh_dj\":\"".$bs_kh_dj."\","; $sys_flag_count=count($arr_sys_order_flag); $tmpl_m1_page_size=12; $tmpl_m1_lie=4; $tmpl_m1_pic_width=188; $tmpl_m1_pic_height=250; $tmpl_m1_search_con_num=5; $tmpl_m2_dp_pic_width=400; $tmpl_m2_dp_pic_height=400; $tmpl_order_single_w=300; $tmpl_order_single_h=400; $json_data.="\"sys_ver_hy\":\"".$sys_ver_hy."\","; $json_data.="\"slider_max\":90,"; //$db=_mysql_connect(); $msg_login=get_db_msg("select * from ".$table_pre."client where id='".$uid."'"); if($msg_login["available"]!="y"){ $json_data.="\"error\":\"用户已被禁用\",\"code\":0,\"msg\":\"用户已被禁用\",\"count\":0,\"data\":[],"; }else{ $json_data.="\"face\":\"".$msg_login["face"]."\","; $json_data.="\"uid\":\"".$msg_login["id"]."\","; $json_data.="\"username\":\"".$msg_login["username"]."\","; $json_data.="\"is_sy\":\"".$is_sy."\","; $json_data.="\"jpty\":\"".$msg_login["jpty"]."\","; $s_key=$s_key?$s_key:$_key; $rurl=$rurl?$rurl:get_this_url(); $check_md=get_db_msg("select count(*) 'num' from ".$table_pre."kh_md"); $zb_client_show=get_set("zb_client_show"); if($zb_client_show=="y") $arr_zb_type=explode(",",$zb_type); else $arr_zb_type=array(); $is_brand=is_brand(); $show_jd=get_set("show_jd"); $is_dkds=get_set("is_dkds"); $is_multi_price=get_set("is_multi_price"); $order_close=get_set("order_close"); $search_type=get_set("search_type"); $list_by_color="n"; //是否展示到色 $json_data.="\"is_gg\":\"".$is_gg."\","; $json_data.="\"show_jd\":\"".$show_jd."\","; $json_data.="\"is_dkds\":\"".$is_dkds."\","; $json_data.="\"is_brand\":\"".$is_brand."\","; $json_data.="\"is_multi_price\":\"".$is_multi_price."\","; if($is_brand=="y") $link_var_brand="&s_brand=".$s_brand; else $link_var_brand=""; $title_brand=$con_brand=""; if($s_brand){ $arr_s_brand=explode(",",$s_brand); for($i=0;$i'sx' and no<>'zd1' and no<>'zd2' and no<>'zd3' order by ord"; $r=$db->query($q); while($m=$db->fetch_array($r)){ $arr_select_no[]=$m["no"]; $arr_select_title[]=$m["title"]; } //文胸 if($bx_sizegroup_title){ $tmp=get_db_msg("select id from ".$table_pre."keyword where cate='size' and title='".$bx_sizegroup_title."' limit 0,1"); $bx_sizegroup_id=$tmp["id"]; }else{ $bx_sizegroup_id=0; } //童装 if($child_sizegroup_title){ $tmp=get_db_msg("select id from ".$table_pre."keyword where cate='size' and title='".$child_sizegroup_title."' limit 0,1"); $child_sizegroup_id=$tmp["id"]; }else{ $child_sizegroup_id=0; } $json_data.="\"bx_sizegroup_id\":\"".$bx_sizegroup_id."\","; $json_data.="\"child_sizegroup_id\":\"".$child_sizegroup_id."\","; $con_spk=($is_spk=="y")?" and is_sp<>'y'":""; $flag_spk=($is_spk=="y")?"1":""; //------------------------------------包含定制模块,店铺界面,顶部已订数和完成率的显示 // //--------------交单按钮 $jd_password=get_set("jd_password"); if($is_brand<>"y"){ $tmp=$msg_login; $is_jd=$msg_login["is_jd"]; $is_checked=$msg_login["is_checked"]; }else{ $tmp=get_db_msg("select is_jd from ".$table_pre."client_brand where cid='".$uid."'".$con_brand." order by is_jd limit 0,1"); $is_jd=$tmp["is_jd"]; $tmp=get_db_msg("select is_checked from ".$table_pre."client_brand where cid='".$uid."'".$con_brand." order by is_checked limit 0,1"); $is_checked=$tmp["is_checked"]; } if($show_jd=="y"){ if($is_jd=="y") $jd_button="已交单|"; if($is_checked=="y") $jd_button="已确认|"; if($is_brand=="y"){ $jd_button="交单|go_url('".$_SERVER[PHP_SELF]."?_m=".$_m."&_a=o&s_tab=wcl')"; }else{ if($is_jd!="y" && $is_checked!="y") $jd_button="交单|do_jd('".$jd_password."','".$_SERVER[PHP_SELF]."?_m=".$_m."&_a=jd".$link_var_brand."')"; } }else{ $jd_button="|"; } //计算订货规则按钮 $tmp=get_db_msg("select count(*) 'num' from ".$table_pre."gz where dj='' or dj='".$msg_login["dj"]."'"); if($tmp["num"]>0) $menu_dhgz="订货规则"; else $menu_dhgz=""; if($msg_login["face"]=="4"){ //include_once $path_dz."/dp/wcl.php"; // switch($_a){ case "del_sszq": $q="delete from ".$table_pre."kh_sp where uid='".$uid."' and iid='".$iid."'"; $db->query($q); $json_data.="\"code\":101,"; break; case "save_sszq": $tmpkh=get_db_msg("select * from ".$table_pre."kh where id='".$iid."'"); $tmpzq=get_db_msg("select * from ".$table_pre."client_shsj where uid='".$uid."' and add_date='".$date."'"); //echo "select * from ".$table_pre."client_shsj where uid='".$uid."' and add_date='".$date."'"; //exit; $jssj=strtotime($tmpzq["add_date"])+24*60*60*$yjxs; $q="select * from ".$table_pre."client_shsj where uid='".$uid."' and ord>=".$tmpzq["ord"]." order by ord"; $r=$db->query($q); $strall=""; while($m=$db->fetch_array($r)){ if($jssj>strtotime($m["add_date"])){ $strall.=$m["id"].","; } } $strall=deel_end($strall); $check=get_db_msg("select * from ".$table_pre."kh_sp where uid='".$uid."' and iid='".$iid."'"); if($check["id"]>0){ $q="update ".$table_pre."kh_sp set sszq='".$tmpzq["id"]."',cxsj='".$yjxs."',allzq='".$strall."' where id='".$check["id"]."'"; }else{ $q="insert into ".$table_pre."kh_sp (uid,iid,kh,sszq,cxsj,allzq) values ('".$uid."','".$iid."','".$tmpkh["no"]."','".$tmpzq["id"]."','".$yjxs."','".$strall."')"; } $db->query($q); $json_data.="\"code\":101,"; break; case "get_wcl": //获取完成率和已订件数,传递参数khid //完成率 //已订金额和件数 $tmp=get_db_msg("select sum(je) 'je',sum(jsje) 'jsje',sum(num) 'num' from ".$table_pre."order where ka<>'y'".$con_spk." and uid='".$uid."' and _key='".$_key."'"); $ydje=$tmp["je"]; $ydjsje=$tmp["jsje"]; $ydjs=$tmp["num"]; if($is_brand=="y"){ $tmp=get_db_msg("select sum(zb) 'zb',sum(zb_js) 'zb_js' from ".$table_pre."client_brand where cid='".$uid."'"); $zb1=$tmp["zb"]*10000; $zb=deel_num($tmp["zb"]); $zb_js=$tmp["zb_js"]; }else{ $zb1=$msg_login["zb"]*10000; $zb=deel_num($msg_login["zb"]); $zb_js=$msg_login["zb_js"]; } $wcl=deel_bfb1($ydjsje,$zb1,1); $wcl_js=deel_bfb1($ydjs,$zb_js,1); if($khid){ $tmp=get_db_msg("select sum(num) 'num' from ".$table_pre."order where uid='".$uid."' and iid='".$khid."' and ka<>'y' and _key='".$_key."'"); $k_ydjs=$tmp["num"]; //取得上次订货会数量 $str_sys=""; if($sys_flag_count>1){ $tmp_sys=get_db_msg("select sum(".get_size_sql("sum").") 'num' from ".$table_pre."order where _key<>'".$_key."' and iid='".$khid."' and uid='".$uid."'"); $tmp_kh=get_db_msg("select * from ".$table_pre."kh where id='".$khid."'"); if($tmp_sys["num"]){ $str_sys="\"scjs\":".$tmp_sys["num"].",\"hjjs\":".($tmp_sys["num"]+$n1).","; } $str_sys.="\"lssj\":\"y\",\"unit_title\":\"".$tmp_kh["unit_title"]."\","; } }else{ $k_ydjs=0; } //该款已订件数 $zb_client_show=get_set("zb_client_show"); $json_data.="\"ydjs\":\"".$k_ydjs."\",".$str_sys; $json_data.="\"zb_client_show\":\"".$zb_client_show."\","; //订货信息 $json_data.="\"order_num\":\"".$ydjs."\",\"order_je\":\"".$ydje."\",\"order_jsje\":\"".$ydjsje."\","; //指标信息 $json_data.="\"zb_je\":\"".$zb."\",\"wcl_je\":\"".$wcl."\",\"zb_js\":\"".$zb_js."\",\"wcl_js\":\"".$wcl_js."\","; $str_color_num=""; if($index_by_color=="y"){ $tmp_kh22=get_db_msg("select * from ".$table_pre."kh where id='".$khid."'"); $arr_col=explode(",",$tmp_kh22["color"]); if(is_array($arr_col)){ foreach($arr_col as $key1=>$val1){ $tmp_oo=get_db_msg("select sum(num) 'num' from ".$table_pre."order where uid='".$uid."' and color='".$val1."' and iid='".$khid."' and ka<>'y' and _key='".$_key."'"); $color_sl=$tmp_oo["num"]>0?$tmp_oo["num"]:0; $str_color_num.="\"".$val1."\":\"".$color_sl."\","; } $str_color_num=substr($str_color_num,0,-1); } $json_data.="\"list_color\":{".$str_color_num."},"; } break; case "jd": if($is_brand=="y"){ $msg=check_dhgz_client($uid); if($msg!="y"){ $json_data.="\"code\":0,\"msg\":\"".$msg."\","; }else{ $con_brand=""; if($s_brand){ $arr_s_brand=explode(",",$s_brand); for($i=0;$iquery($q); $url=$_SERVER["PHP_SELF"]."?_m=".$_m."&_a=o&s_tab=wcl"; //记录订单操作日志 update_order_state($uid,$uid,"交单",""); $json_data.="\"code\":101,"; } /*if($jd2=="y"){ $con_brand=""; if($s_brand){ $arr_s_brand=explode(",",$s_brand); for($i=0;$iquery($q); $url=$_SERVER["PHP_SELF"]."?_m=".$_m."&_a=o&s_tab=wcl"; //记录订单操作日志 update_order_state($uid,$uid,"交单",""); $json_data.="\"code\":101,"; //alert_and_redirect("订单提交成功,请等待客户经理确认!",$url); }else{ //多品牌交单 //$url=$_SERVER["PHP_SELF"]."?_m=".$_m."&_a=o&s_tab=wcl"; //url_redirect($url); }*/ }else{ //检查订货规则 $msg=check_dhgz_client($uid); if($msg!="y"){ $json_data.="\"code\":0,\"msg\":\"".$msg."\","; }else{ $q="update ".$table_pre."client set is_jd='y' where id='".$uid."'"; $db->query($q); $url=$_SERVER[PHP_SELF]."?_m=".$_m.$link_var_brand; //记录订单操作日志 update_order_state($uid,$uid,"交单",""); $json_data.="\"code\":101,"; } //alert_and_redirect("订单提交成功,请等待客户经理确认!",$url); } break; case "update_jpty": $q="update ".$table_pre."client set jpty='".$jpty."' where id='".$uid."'"; $db->query($q); $json_data.="\"code\":101,"; break; case "single": $is_brand=is_brand(); $id=$khid; $json_data.="\"sys_ck_input\":\"".$sys_ck_input."\","; $json_data.="\"s_title\":\"".$s_title."\","; $have_md="n"; $s_xh=deel_num($s_xh); $msg_err=""; $kl=strlen($s_title); if($xh_ms=="2"){ $tmp_xh=get_db_msg("select kh as no from web_kh_xh where xh='".$s_title."'"); }else{ $tmp_xh=get_db_msg("select no from web_kh where xh='".$s_title."'"); } if($kl<=3 && $s_title && is_numeric($s_title)){ //$sql_con="where xh='".$s_title."'"; if($xh_ms=="2") $sql_con="where no=(select kh from ".$table_pre."kh_xh where xh='".$s_title."')"; else $sql_con="where xh='".$s_title."'"; } $xhsql_s=$xhsql_e=""; if($kl>3){ $xhsql_s=",case when no='".$tmp_xh["no"]."' then 100 else 1 end as ppd "; $xhsql_e=" order by ppd desc"; if(is_numeric($s_title)){ //$sql_con="where xh='".$s_title."' or no like '%".$s_title."%'"; if($xh_ms=="2") $sql_con="where (select kh from ".$table_pre."kh_xh where xh='".$s_title."') or no like '%".$s_title."%'"; else $sql_con="where xh='".$s_title."' or no like '%".$s_title."%'"; }else{ $sql_con="where no like '%".$s_title."%'"; } } if($s_title){ $msg=get_db_msg("select * from ".$table_pre."kh ".$sql_con); $m1=get_db_msg("select count(*) 'num' from ".$table_pre."kh ".$sql_con); }else{ $msg=get_db_msg("select * from ".$table_pre."kh where id='".$id."'"); } /*if($search_type=="xh"){ if($s_xh){ if($xh_ms=="2"){ //序号到色 $msg_kh_xh=get_db_msg("select * from ".$table_pre."kh_xh where xh='".$s_xh."' limit 0,1"); $q1="select count(*) 'num' from ".$table_pre."kh_xh where xh='".$s_xh."'"; $q2="select a.xh 'xh',b.no 'no',b.id 'id' from ".$table_pre."kh_xh a,".$table_pre."kh b where a.kh=b.no and a.xh='".$s_xh."'"; $msg=get_db_msg("select * from ".$table_pre."kh where no='".$msg_kh_xh["kh"]."' limit 0,1"); }else{ //序号查询定制 $msg=get_db_msg("select * from ".$table_pre."kh where xh='".$s_xh."' limit 0,1"); $q1="select count(*) 'num' from ".$table_pre."kh where xh='".$s_xh."'"; $q2="select xh,no,id from ".$table_pre."kh where xh='".$s_xh."'"; } $_xh=$s_xh; $m1=get_db_msg($q1); }else{ $msg=get_db_msg("select * from ".$table_pre."kh where id='".$id."'"); $_xh=get_kh_xh($msg); } }else{ $s_no=trim($s_no); if($s_no){ $msg=get_db_msg("select * from ".$table_pre."kh where no like '%".$s_no."%' limit 0,1"); $m1=get_db_msg("select count(*) 'num' from ".$table_pre."kh where no like '%".$s_no."%'"); if($xh_ms=="2") $q2="select a.xh 'xh',b.no 'no',b.id 'id' from ".$table_pre."kh_xh a,".$table_pre."kh b where a.kh=b.no and b.no like '%".$s_no."%'"; else $q2="select xh,no,id from ".$table_pre."kh where no like '%".$s_no."%'"; }else{ $msg=get_db_msg("select * from ".$table_pre."kh where id='".$id."'"); } $_xh=get_kh_xh($msg); }*/ $id=$msg["id"]; $str_title=""; if($m1["num"]>1){ $q2="select *".$xhsql_s." from ".$table_pre."kh ".$sql_con.$xhsql_e; $r2=$db->query($q2); while($m2=$db->fetch_array($r2)){ $str_title.="{\"khid\":\"".$m2["id"]."\",\"title\":\"".$m2["xh"]."#".$m2["no"]."\"},"; } if($str_title){ $str_title=deel_end($str_title); $msg_err="存在以下符合条件的多个款:".$msg_err; } //echo_wrong("
找到以下符合条件的多个款,请选择:
".$str_title."
"); } // if(!$id){ $msg_err="记录不存在"; } if($msg_err){ if($str_title){ $json_data.="\"code\":101,"; $json_data.="\"msg\":[".$str_title."],"; }else{ $json_data.="\"code\":102,"; $json_data.="\"msg\":\"".$msg_err."\","; } }else{ $json_data.="\"code\":100,"; $_xh=get_kh_xh($msg); //判断是否存在规格 $is_ggk=is_ggk($msg["id"]); $json_data.="\"is_ggk\":\"".$is_ggk."\","; $json_data.="\"size_group_id\":\"".$msg["size_group"]."\","; //判断代理 $dl_uid=get_dl_id($msg_login["path"]); $is_jd_dl=$is_checked_dl="n"; if($dl_uid>0){ $msg_dl=get_db_msg("select * from ".$table_pre."client where id='".$dl_uid."'"); if($is_brand=="y"){ $msg_brand_dl=get_db_msg("select * from ".$table_pre."client_brand where cid='".$dl_uid."' and brand='".$msg["brand"]."'"); } if($msg_dl["is_jd"]=="y" || $msg_brand_dl["is_jd"]=="y") $is_jd_dl="y"; if($msg_dl["is_checked"]=="y" || $msg_brand_dl["is_checked"]=="y" || $msg_brand_dl["is_dd_checked"]=="y") $is_checked_dl="y"; } //检查是否是不予下单款 //取得客户等级 $client_dj=trim($msg_login["dj"]); $con_dj=$client_dj?" and (dj='".$client_dj."' or dj='')":" and dj=''"; $tmp=get_db_msg("select * from ".$table_pre."gz where cate='byxdk' and kh='".$msg["no"]."'".$con_dj); $byxdk=$tmp["id"]>0?"y":"n"; //品牌控制 if($is_brand=="y"){ $msg_brand=get_db_msg("select * from ".$table_pre."client_brand where cid='".$uid."' and brand='".$msg["brand"]."'"); } //-------------------设置禁止提交表单 if($order_close=="y" || $msg["ka"]=="y" || $msg_login["is_jd"]=="y" || $msg_login["is_checked"]=="y" || $msg_brand["is_jd"]=="y" || $msg_brand["is_checked"]=="y" || $is_checked_dl=="y" || $is_jd_dl=="y" || $byxdk=="y"){ $json_data.="\"state\":\"n\","; $disable=" disabled"; }else{ $json_data.="\"state\":\"y\","; $disable=""; } if($is_brand=="y" && !$msg_brand["id"]){ $json_data.="\"state\":\"n\","; $disable=" disabled"; } //-------------------设置提示信息 //必定款 $tmp=get_db_msg("select * from ".$table_pre."gz where cate='bdk' and kh='".$msg["no"]."'".$con_dj); if($tmp["id"]>0) $msg_tip="必定款:".$tmp["num"]."件|"; //起订量 $client_dj=trim($msg_login["dj"]); $con_dj=$client_dj?" and (dj='".$client_dj."' or dj='')":" and dj=''"; $tmp=get_db_msg("select * from ".$table_pre."gz where cate='qdl' and kh='".$msg["no"]."'".$con_dj); if($tmp["id"]>0){ $tip1=""; $q1="select * from ".$table_pre."gz where cate='qdl' and kh='".$msg["no"]."'".$con_dj; $r1=$db->query($q1); while($m1=$db->fetch_array($r1)){ if($m1["color"]) $tip1.=$m1["color"]."-".get_cate_title_no("color",$m1["color"]).",".$m1["num"]."件;"; else $tip1.="整款:".$m1["num"]."件;"; } $msg_tip="起订量:".$tip1."|"; } //必定款色 $tmp=get_db_msg("select * from ".$table_pre."gz where cate='bdks' and kh='".$msg["no"]."'".$con_dj); if($tmp["id"]>0){ $tip1=""; $q1="select * from ".$table_pre."gz where cate='bdks' and kh='".$msg["no"]."'".$con_dj; $r1=$db->query($q1); while($m1=$db->fetch_array($r1)){ $tip1.=$m1["color"]."-".get_cate_title_no("color",$m1["color"]).",".$m1["num"]."件;"; } $msg_tip.="必定款色:".$tip1."|"; } //必定规格 $tmp=get_db_msg("select * from ".$table_pre."gz where cate='bdgg' and kh='".$msg["no"]."'".$con_dj); if($tmp["id"]>0){ $tip1=""; $q1="select * from ".$table_pre."gz where cate='bdgg' and kh='".$msg["no"]."'".$con_dj; $r1=$db->query($q1); while($m1=$db->fetch_array($r1)){ $tip1.=$m1["color"]."-".get_cate_title_no("color",$m1["color"])."|".get_gg_title($m1["bc"]).",".$m1["num"]."件;"; } $msg_tip.="必定".d_translate("gg").":".$tip1."|"; } //订货倍数 $show_gg_zxs="n"; $tmp=get_db_msg("select * from ".$table_pre."gz where cate='dhbs' and kh='".$msg["no"]."'"); if($tmp["id"]>0){ $arr_dhbs=array(); $tip1=""; $q1="select * from ".$table_pre."gz where cate='dhbs' and kh='".$msg["no"]."'"; $r1=$db->query($q1); while($m1=$db->fetch_array($r1)){ if($m1["bc"]) $tip1.=get_gg_title($m1["bc"]).","; $tip1.=$m1["num"]."件;"; $arr_dhbs[$m1["bc"]]=$m1["num"]; } if($tip1 && $is_ggk=="y") $show_gg_zxs="y"; if($is_ggk=="n") $msg_tip.=d_translate("dhbs").":".$tip1."|"; } //最高订量 $tmp=get_db_msg("select * from ".$table_pre."gz where cate='zgdl' and kh='".$msg["no"]."'"); if($tmp["id"]>0){ $tip1=""; $q1="select * from ".$table_pre."gz where cate='zgdl' and kh='".$msg["no"]."'"; $r1=$db->query($q1); while($m1=$db->fetch_array($r1)){ if($m1["color"]) $tip1.=$m1["color"]."-".get_cate_title_no("color",$m1["color"]).","; $tip1.=$m1["num"]."件;"; } $msg_tip.="最高订量:".$tip1."|"; } //关联款 $tmp=get_db_msg("select * from ".$table_pre."gz where cate='glk' and (kh='".$msg["no"]."' or color='".$msg["no"]."')".$con_dj); if($tmp["id"]>0){ $msg_tip.="关联款:"; $kh_gl=($msg["no"]==$tmp["kh"])?$tmp["color"]:$tmp["kh"]; if($tmp["num"]==3){ $tip1=($msg["no"]==$tmp["kh"])?"该款要求订量大于等于":"该款要求订量小于等于"; $tip2=""; }else if($tmp["num"]==1){ $tip1="该款要求与"; $tip2=",只能选择一款来订货。"; } //取得关联款订单 $tmp_num=get_db_msg("select sum(num) 'num' from ".$table_pre."order where uid='".$msg_login["id"]."' and no='".$kh_gl."' and _key='".$_key."'"); $msg_tip.=$tip1." ".$kh_gl."(".deel_num($tmp_num["num"])."件)".$tip2."|"; } $msg_tip=deel_end($msg_tip); // if($msg["ka"]=="y") $msg_tip="该款为删除款!"; if($byxdk=="y") $msg_tip="不予下单款!"; if($msg_login["is_jd"]=="y" || $msg_brand["is_jd"]=="y") $msg_tip="对不起,您的订单已经提交!"; if($msg_login["is_checked"]=="y" || $msg_brand["is_checked"]=="y") $msg_tip="对不起,您的订单已经确认!"; if($is_jd_dl=="y") $msg_tip="对不起,您的上级代理订单已经提交!"; if($is_checked_dl=="y") $msg_tip="对不起,您的上级代理订单已经确认!"; if($is_brand=="y" && !$msg_brand["id"]){ $msg_tip.="对不起,您没有该品牌的订货权限!"; } if($order_close=="y") $msg_tip="对不起,暂时关闭订单功能!"; $json_data.="\"gz\":\"".$msg_tip."\","; $json_data.="\"show_gg_zxs\":\"".$show_gg_zxs."\","; $json_data.="\"pm_ms\":\"".$pm_ms."\","; //取得评级 $msg_pj=get_db_msg("select * from ".$table_pre."client_pj where khid='".$id."' and cid='".$uid."'"); if($msg_pj["id"]>0){ $pj_remark=dhtmlchars($msg_pj["remark"]); $race=$msg_pj["race"]; $pj_icon=get_pj_icon($race,$id,'big'); }else{ $pj_remark=""; $race=0; $pj_icon=get_pj_icon($race,$id,'big'); } $json_data.="\"is_spdh\":\"".$is_sp."\","; if($is_sp=="y"){ $q="select * from ".$table_pre."client_shsj where uid='".$uid."' order by ord"; $r=$db->query($q); $i=1; $zds=""; while($m=$db->fetch_array($r)){ $zds.="{\"id\":\"".$m["id"]."\",\"text\":\"".$m["add_date"]."\"},"; $i++; } $zds=deel_end($zds); $json_data.="\"spdh\":{\"dates\":[".$zds."],"; $tmpsp=get_db_msg("select * from ".$table_pre."kh_sp where uid='".$uid."' and iid='".$msg["id"]."'"); $tmpzq=get_db_msg("select * from ".$table_pre."client_shsj where id='".$tmpsp["sszq"]."'"); $json_data.="\"date\":{\"id\":\"".$tmpzq["id"]."\",\"text\":\"".$tmpzq["add_date"]."\"},"; $json_data.="\"yjxs\":\"".$tmpsp["cxsj"]."\"},"; } //取得视频地址 $tmpvd=get_db_msg("select * from ".$table_pre."video where khid='".$msg["id"]."' limit 0,1"); if($tmpvd["id"]){ if($tmpvd["is_local"]=="n"){ require_once '../admin/include/video.php'; $videoObj = new AliyunVideo(); //实例化阿里云对象 $iofo=$videoObj ->get_play_info($tmpvd["vid_net"]); $iofo=json_decode( json_encode( $iofo),true); $vurl=$iofo["PlayInfoList"]["PlayInfo"][0]["PlayURL"]; }else{ $vurl="../video/".$tmpvd["local_path"]; } $json_data.="\"vurl\":\"".$vurl."\","; } $json_data.="\"khid\":\"".$msg["id"]."\","; $json_data.="\"kh\":\"".$msg["no"]."\","; $json_data.="\"ka\":\"".$msg["ka"]."\","; $json_data.="\"xh\":\"".get_kh_xh($msg)."\","; $q="insert into ".$table_pre."kh_read_log (iid,uid,add_date) values ('".$id."','".$uid."','".time()."')"; $db->query($q); //判断是否为库存//*********************************************************************** $is_kc='n'; $tmp_info=get_db_msg("select id from ".$table_pre."kh_kc where iid='".$id."'");//******* if($tmp_info['id']>0){//*********************************************************************** $is_kc='y';//*********************************************************************** } $json_data.="\"is_kc\":\"".$is_kc."\","; if($msg["size_group"]==$child_sizegroup_id){ //童装尺码异价 foreach($arr_child_bx as $bx1 => $size1){ $m1=get_db_msg("select id,price from ".$table_pre."size_bx where no='".$msg["no"]."' and bx='".$bx1."'"); if($m1["id"]>0){ $price_zk=get_price_zk($uid,$msg["id"],'',$bx1); $str_price.=$bx1.": ".$m1["price"]."元"; if($price_zk!=$m1["price"]) $str_price.=" / 结算价:".$price_zk."元"; $str_price.="
"; } } }else{ $dp_price=get_price_dp($uid,$msg["id"]); $str_price=deel_num($dp_price)."元"; //买断价 $tmp=get_db_msg("select id,price from ".$table_pre."kh_md where (dj='".$msg_login["dj"]."' or dj='') and kh='".$msg["no"]."' limit 0,1"); if($tmp["id"]>0){ $price_md=$tmp["price"]>0?$tmp["price"]:$price_zk; $str_price.=" / ".d_translate("md")."价:".deel_num($price_md)."元"; }else{ $price_zk=get_price_zk($uid,$msg["id"]); if($price_zk!=$dp_price){ $str_price.=" / 结算价:".deel_num($price_zk)."元"; } } } $json_data.="\"price\":\"".$str_price."\","; $json_data.="\"this_disable\":\"".$disable."\","; if(is_array($sys_color_zd) && count($sys_color_zd)>0){ //取得款色表的定制字段 $str_ds_h=$str_ds_b=""; $str_ds_h="{\"v\":\"颜色\"},"; //$other_info.=""; foreach($sys_color_zd as $k1 => $v1){ //$other_info.=""; $str_ds_h.="{\"v\":\"".$v1."\"},"; } $json_data.="\"ds_header\":[".deel_end($str_ds_h)."],"; //$other_info.=""; $q="select * from ".$table_pre."kh_color where iid='".$msg["id"]."' order by color"; $r=$db->query($q); while($m=$db->fetch_array($r)){ $str_ds_b.="{\"color\":\"".$m["color"]."\","; $tmpds=""; $tmpds.="{\"v\":\"".$m["color"]."-".get_cate_title_no("color",$m["color"])."\"},"; //$other_info.=""; foreach($sys_color_zd as $k1 => $v1){ //$other_info.=""; $tmpds.="{\"v\":\"".$m[$k1]."\"},"; } //$other_info.=""; $str_ds_b.="\"v\":[".deel_end($tmpds)."]},"; } $json_data.="\"ds_body\":[".deel_end($str_ds_b)."],"; //$other_info.="
颜色".$v1."
".$m["color"]."-".get_cate_title_no("color",$m["color"])."".$m[$k1]."
"; } $q="select * from ".$table_pre."keyword where cate='arr_select' and flag_ka='y' and flag_bd='n' and no<>'jgd' and no<>'sx' and no<>'color' order by ord"; $r=$db->query($q); $i=0; $zds=""; while($m=$db->fetch_array($r)){ $str_select_dz.="\"".$m["title"]."|"; if($m["no"]=="zd1" || $m["no"]=="zd2" || $m["no"]=="zd3"){ //$str_select_dz.=$msg[$m["no"]]."\","; //$zds.="{\"no\":\"".$m1["no"]."\",\"title\":\"".$m1["title"]."\"},"; $zds.="{\"no\":\"".$i."\",\"title\":\"".get_cate_title_no("arr_select",$m["no"])."\",\"value\":\"".$msg[$m["no"]]."\"},"; }else{ //$str_select_dz.=deel_js_var(get_cate_title_no($m["no"],$msg[$m["no"]]))."\","; $zds.="{\"no\":\"".$i."\",\"title\":\"".get_cate_title_no("arr_select",$m["no"])."\",\"value\":\"".get_cate_title_no($m["no"],$msg[$m["no"]])."\"},"; } $i++; } $zds=deel_end($zds); $json_data.="\"zds\":[".$zds."],"; $json_data.="\"dkremark\":\"".htmlspecialchars($msg["remark"])."\","; $json_data.="\"xj\":\"".$race."\","; $json_data.="\"ksm\":\"".$msg["title"]."\","; $json_data.="\"pjwz\":\"".$pj_remark."\","; $arrBx=array(); $str_bx=""; $is_bx="n"; if($msg["size_group"]==$bx_sizegroup_id){ $is_bx="y"; //文胸 $r1=$db->query("select * from ".$table_pre."size_bx where no='".$msg["no"]."' order by bx"); $i1=0; while($m1=$db->fetch_array($r1)){ $arrBx[$i1][]=$m1["bx"]; $str_bx.=$m1["bx"]; $arrBx[$i1][]=$m1["size"]; $i1++; } //取得尺码 $str_size=""; $r1=$db->query("select * from ".$table_pre."size where iid='".$bx_sizegroup_id."' order by no"); while($m1=$db->fetch_array($r1)){ $str_size.=$m1["no"].","; } $str_size=substr($str_size,0,-1); $arr_size=explode(",",$str_size); }else if($msg["size_group"]==$child_sizegroup_id){ //童装 $str_size=$str_bx=$str_bx_title=$str_size_tz=""; $arr_size_tmp=array();//童装所有尺码临时记录 $i1=$j1=0; foreach($arr_child_bx as $bx1 => $arr_bx_size1){ $check_tmp=get_db_msg("select id,size,price from ".$table_pre."size_bx where no='".$msg["no"]."' and bx='".$bx1."'"); if($check_tmp["id"]>0){ $str_size_tz.=$i1."|".$check_tmp["size"].":"; $arr_tmp=explode(",",$check_tmp["size"]); for($i2=0;$i2query("select gg from ".$table_pre."kh_gg where iid='".$msg["id"]."' group by gg order by gg"); $i1=0; while($m1=$db->fetch_array($r1)){ $str_bx.=$m1["gg"].","; $i1++; } } $arrBx[0][0]=""; $arrBx[0][1]=$msg["size"]; $arr_size=explode(",",$msg["size"]); } if($str_bx) $str_bx=substr($str_bx,0,-1); if($str_bx_title) $str_bx_title=substr($str_bx_title,0,-1); if($str_size_tz) $str_size_tz=substr($str_size_tz,0,-1); $arr_color=explode(",",$msg["color"]); //------预测订货量 $str_ycdhl=""; for($i=0;$i''"); $colorka="n"; if(in_array($arr_color[$i],$arr_color_ka,true)){ $disable_color=" disabled"; $sty1="font-weight:bold;color:#ff0000;"; $link_ds=""; $colorka="y"; }else if($check["zsh"]>0){ $disable_color=" disabled"; $sty1=""; //$link_ds=" 进入搭配订货"; $link_ds=$check["zsh"]; }else{ $sty1=""; $disable_color=$disable; $link_ds=""; } $tr_bg=($color==$arr_color[$i])?"#d3d2d1":"#ffffff"; $strarr=""; if($is_ggk!="n"){ //有规格 $r1=$db->query("select * from ".$table_pre."kh_gg where iid='".$msg["id"]."' and color='".$arr_color[$i]."' order by ord"); $i1=0; $arr_gg=array(); while($m1=$db->fetch_array($r1)){ $arr_gg[$i1]["title"]=$m1["gg"]; if($is_ggk=="y"){ foreach($sys_gg_zd as $k1 => $v1){ $arr_gg[$i1][$k1]=$m1[$k1]; } } $i1++; } //$num_arr.="[\"".$tr_bg."\",\"".count($arr_gg)."\",\"".$link_ds."\",\"".$sty1."\",\"1|".$arr_color[$i]."-".get_cate_title_no("color",$arr_color[$i])."\","; $num_arr.="{\"tr_bg\":\"".$tr_bg."\",\"ggs\":\"".count($arr_gg)."\",\"ka\":\"".$colorka."\",\"link_ds\":\"".$link_ds."\",\"sty1\":\"".$sty1."\",\"disable_color\":\"".$disable_color."\","; $strarr.="{\"no\":\"1\",\"id\":\"color_td_".$arr_color[$i]."\",\"value\":\"".$arr_color[$i]."-".get_cate_title_no("color",$arr_color[$i])."\"},"; if($i1==0){ $arr_gg[0]["title"]=""; if($is_ggk=="y"){ foreach($sys_gg_zd as $k1 => $v1){ $arr_gg[0][$k1]=""; } } } for($j1=0;$j10) $num_arr.="{\"tr_bg\":\"".$tr_bg."\",\"ggs\":\"1\",\"link_ds\":\"\",\"sty1\":\"".$sty1."\",\"disable_color\":\"".$disable_color."\","; //$num_arr.="\"1|".get_gg_title($arr_gg[$j1]["title"])."\","; $strarr1.="{\"no\":\"1\",\"id\":\"color_td_".get_gg_title($arr_gg[$j1]["title"])."\",\"value\":\"".get_gg_title($arr_gg[$j1]["title"])."\"},"; if($is_ggk=="y"){ foreach($sys_gg_zd as $k1 => $v1){ //$num_arr.="\"1|".$arr_gg[$j1][$k1]."\","; $strarr1.="{\"no\":\"1\",\"id\":\"color_td_".$arr_gg[$j1][$k1]."\",\"value\":\"".$arr_gg[$j1][$k1]."\"},"; } } if($show_gg_zxs=="y") $strarr1.="{\"no\":\"1\",\"id\":\"color_td_".get_main_value1($arr_dhbs,$arr_gg[$j1]["title"])."\",\"value\":\"".get_main_value1($arr_dhbs,$arr_gg[$j1]["title"])."\"},"; if($pm_ms!="n") $strarr1.="{\"no\":\"2\",\"id\":\"pm_".$arr_color[$i]."_".$arr_gg[$j1]["title"]."\",\"value\":\"pm_".$arr_color[$i]."_".$arr_gg[$j1]["title"]."\"},"; $j=0; for($k=0;$k $tmp_size){ for($j1=0;$j10) $num_arr.="{\"tr_bg\":\"".$tr_bg."\",\"ggs\":\"1\",\"link_ds\":\"\",\"sty1\":\"".$sty1."\",\"disable_color\":\"".$disable_color."\","; if($msg["size_group"]==$bx_sizegroup_id){ $strarr1.="{\"no\":\"1\",\"id\":\"color_td_".$tmp_bx."\",\"value\":\"".$tmp_bx."\"},"; }else if($msg["size_group"]==$child_sizegroup_id){ $bxp=get_price_zk($uid,$msg["id"],$arr_color[$i],$bx_title); $strarr1.="{\"no\":\"1\",\"id\":\"color_td_".$bx_title."\",\"value\":\"".$bx_title."\",\"price\":\"".$bxp."\"},"; } if($pm_ms!="n") $strarr1.="{\"no\":\"2\",\"id\":\"pm_".$arr_color[$i]."_".$tmp_bx."\",\"value\":\"pm_".$arr_color[$i]."_".$tmp_bx."\"},"; $j=0; for($k=0;$k0) $arr_size_check=explode(",",$tmp["size"]); else $arr_size_check=array(); }else{ $arr_size_check=$arr_size; } if($is_bx=="n" || ($is_bx=="y" && in_array($arr_size[$k],$arr_size_check))){ $num1=get_order_num($id,$arr_color[$i],$bx_title,$arr_size[$k]); if($is_kc=='y'){//************************ $num_kc=get_kc_num_withoutme($id,$arr_color[$i],$arr_size[$k]);//不包含自己的,库存数量//******************** } if(check_md($msg["no"],$arr_color[$i],$bx_title,$arr_size[$k],$msg_login["dj"])=="n"){ $bg_input_num="#ffffff"; }else{ $bg_input_num="#00ff00"; $have_md="y"; } if(check_size_not($msg["no"],$arr_color[$i],$bx_title,$arr_size[$k])=="y"){ $disable_color1=" disabled"; $bg_input_num1="#cccccc"; }else{ $disable_color1=$disable_color; $bg_input_num1=$bg_input_num; } } if(in_array($arr_size[$k],$arr_size_check)){ if($is_kc=='y'){ $strarr1.="{\"no\":\"3\",\"id\":\"num_".$arr_color[$i]."_".$tmp_bx."_".$arr_size[$k]."\",\"value\":\"".$num1."\",\"value_kc\":\"".$num_kc."\",\"bg\":\"".$bg_input_num1."\",\"disable\":\"".$disable_color1."\"},"; }else{ $strarr1.="{\"no\":\"3\",\"id\":\"num_".$arr_color[$i]."_".$tmp_bx."_".$arr_size[$k]."\",\"value\":\"".$num1."\",\"bg\":\"".$bg_input_num1."\",\"disable\":\"".$disable_color1."\"},"; } $js_check_str.=$num1.","; }else{ $strarr1.="{\"no\":\"1\",\"id\":\"\",\"value\":\" \"},"; } //合计尺码数量 $var_xj_size="xj_size_".$arr_size[$k]; //if($disable_color1==""){ $s_xj+=$num1; $$var_xj_size+=$num1; //} $j++; } $total+=$s_xj; $strarr1.="{\"no\":\"4\",\"id\":\"xj_".$arr_color[$i]."_".$tmp_bx."\",\"value\":\"".$s_xj."\"},"; //$strarr=substr($strarr,0,-1); $num_arr.="\"dt\":[".deel_end($strarr.$strarr1)."]},"; //$j1++; }// } /*if($j1==0) $num_arr.=",";*/ } }else{ //取得装箱数 $q1="select num from ".$table_pre."gz where cate='zxs' and (dj='".$msg_login["dj"]."' or dj='') and kh='".$msg["no"]."' order by num"; //echo $q1; $r1=$db->query($q1); $sql_pm=""; $str_zxs=""; while($m1=$db->fetch_array($r1)){ $sql_pm.="num='".$m1["num"]."' or "; //$str_zxs.="{\"zxs\":\"".$m1["num"]."\"},"; $str_zxs.=$m1["num"].","; } if($str_zxs){ $str_zxs=deel_end($str_zxs); } $json_data.="\"zxs\":\"".$str_zxs."\","; $total_xs=$total_num=0; if($is_ggk!="n"){ //有规格数据 $q1="select * from ".$table_pre."kh_gg where iid='".$msg["id"]."' order by color,gg"; $r1=$db->query($q1); while($m1=$db->fetch_array($r1)){ //判断是否为有规则搭配 $check=get_db_msg("select zsh from ".$table_pre."kh_dp where kh='".$msg["no"]."' and color='".$m1["color"]."' and gz<>''"); if(in_array($m1["color"],$arr_color_ka)){ $is_ka="y"; }else{ $is_ka="n"; } $is_selected=($color==$m1["color"])?"y":"n"; //取得该颜色的配码信息 $q2="select * from ".$table_pre."order_pm where _key='".$sys_this_order_flag."' and uid='".$uid."' and iid='".$msg["id"]."' and color='".$m1["color"]."' and bx='".$m1["gg"]."' order by id"; $r2=$db->query($q2); $j1=0; $strpm=""; while($m2=$db->fetch_array($r2)){ $tmp=get_db_msg("select title,gz from ".$table_pre."size_pm where id='".$m2["pmid"]."'"); $tmp_num=$m2["xs"]*count_pm_num($tmp["gz"]); //$num_arr.="[\"".$m1["color"]."|".get_cate_title_no("color",$m1["color"])."|".$m1["gg"]."|".get_gg_title($m1["gg"])."\",".$j1.",\"".$tmp["title"]."|".$tmp["gz"]."\",".$m2["xs"].",\"".$is_ka."\",\"".$is_selected."\"],"; $strpm.="{\"xh\":\"".$j1."\",\"pmt\":\"".$tmp["title"]."\",\"pm\":\"".$tmp["gz"]."\",\"xs\":".$m2["xs"].",\"num\":".$tmp_num."},"; $total_xs+=$m2["xs"]; $total_num+=$tmp_num; $j1++; } if($j1==0){ $str_color_hang.=($j1+1).","; $j1++; //$num_arr.="[\"".$m1["color"]."|".get_cate_title_no("color",$m1["color"])."|".$m1["gg"]."|".get_gg_title($m1["gg"])."\",0,\"|\",0,\"".$is_ka."\",\"".$is_selected."\"],"; }else{ $str_color_hang.=($j1).","; } $num_arr.="{\"color\":\"".$m1["color"]."\",\"colort\":\"".get_cate_title_no("color",$m1["color"])."\",\"gg\":\"".$m1["gg"]."\",\"ggt\":\"".get_gg_title($m1["gg"])."\",\"is_ka\":\"".$is_ka."\",\"is_selected\":\"".$is_selected."\",\"count\":\"".$j1."\",\"arr_pm\":[".deel_end($strpm)."]},"; $str_color.=$m1["color"]."_".$m1["gg"].","; } $colspan1=4+count($arr_size); }else{ for($i=0;$i''"); if(in_array($arr_color[$i],$arr_color_ka)){ $is_ka="y"; }else{ $is_ka="n"; } $is_selected=($color==$arr_color[$i])?"y":"n"; //取得该颜色的配码信息 $q1="select * from ".$table_pre."order_pm where _key='".$sys_this_order_flag."' and uid='".$uid."' and iid='".$msg["id"]."' and color='".$arr_color[$i]."' order by id"; $r1=$db->query($q1); $j1=0; $strpm=""; while($m1=$db->fetch_array($r1)){ $tmp=get_db_msg("select title,gz from ".$table_pre."size_pm where id='".$m1["pmid"]."'"); $tmp_num=$m1["xs"]*count_pm_num($tmp["gz"]); //$num_arr.="[\"".$arr_color[$i]."|".get_cate_title_no("color",$arr_color[$i])."||\",".$j1.",\"".$tmp["title"]."|".$tmp["gz"]."\",".$m1["xs"].",\"".$is_ka."\",\"".$is_selected."\"],"; $strpm.="{\"xh\":\"".$j1."\",\"pmt\":\"".$tmp["title"]."\",\"pm\":\"".$tmp["gz"]."\",\"xs\":".$m1["xs"].",\"num\":".$tmp_num."},"; $total_xs+=$m1["xs"]; $total_num+=$m1["xs"]*count_pm_num($tmp["gz"]); $j1++; } if($j1==0){ $str_color_hang.=($j1+1).","; $j1++; //$num_arr.="[\"".$arr_color[$i]."|".get_cate_title_no("color",$arr_color[$i])."||\",0,\"|\",0,\"".$is_ka."\",\"".$is_selected."\"],"; }else{ $str_color_hang.=($j1).","; } $num_arr.="{\"color\":\"".$arr_color[$i]."\",\"colort\":\"".get_cate_title_no("color",$arr_color[$i])."\",\"gg\":\"\",\"ggt\":\"\",\"is_ka\":\"".$is_ka."\",\"is_selected\":\"".$is_selected."\",\"count\":\"".$j1."\",\"arr_pm\":[".deel_end($strpm)."]},"; $str_color.=$arr_color[$i]."_,"; } $colspan1=3+count($arr_size); } $json_data.="\"total_xs\":".$total_xs.","; $json_data.="\"total_num\":".$total_num.","; /*$str_size_title=""; $arr_size_title=array(); for($i=0;$iquery($q1); while($m1=$db->fetch_array($r1)){ $f=$s_pathdir_mini."/".$m1["pic"]; $f1=$s_pathdir_big."/".$m1["pic"]; $tmpdel=out_good_pic_set_arr($pathdir."/".$m1["pic"],120,120); $arr_detail.="{\"title\":\"".$m1["kh"]."\",\"no\":\"".$m1["kh"]."\",\"pic\":\"".$f."\",\"pic_big\":\"".$f1."\",\"pic_w\":\"".$tmpdel[0]."\",\"pic_h\":\"".$tmpdel[1]."\"},"; $i++; } } $arr_detail=substr($arr_detail,0,-1); $json_data.="\"xjs\":[".$arr_detail."],"; //--搭配款 $arr_dpk=""; $no_str=trim($msg["dpk"]); if($no_str){ $arr1=explode(",",$no_str); for($i=0;$i0){ $con_xh=$s_xh?"&s_xh=".$m1["xh"]:""; $pic=get_kh_picture($m1["no"],$m1["main_pic"],$m1["color"],$flag_pad_offline); $t=get_kh_xh($m1)."#".$m1["no"]; $tmpdpk=out_good_pic_set_arr($pic,90,120); $arr_dpk.="{\"id\":\"".$m1["id"]."\",\"pic\":\"".$pic."\",\"pic_w\":\"".$tmpdpk[0]."\",\"pic_h\":\"".$tmpdpk[1]."\",\"title\":\"".$t."\"},"; $j++; } } } } $arr_dpk=substr($arr_dpk,0,-1); $json_data.="\"dpks\":[".$arr_dpk."],"; //--取得相关搭配 $arr_dp=""; $q1="select zsh,title,pic from ".$table_pre."kh_dp where kh='".$msg["no"]."' group by zsh order by zsh"; $r1=$db->query($q1); $i=0; while($m1=$db->fetch_array($r1)){ $pic=get_kh_dp_mini($m1["pic"],$flag_pad_offline); $tmpdp=out_good_pic_set_arr($pic,90,120); $arr_dp.="{\"zsh\":\"".$m1["zsh"]."\",\"pic\":\"".$pic."\",\"pic_w\":\"".$tmpdp[0]."\",\"pic_h\":\"".$tmpdp[1]."\",\"title\":\"".$m1["title"]."\"},"; $i++; } $arr_dp=substr($arr_dp,0,-1); $json_data.="\"dps\":[".$arr_dp."],"; //--取得相关陈列 $q="select * from ".$table_pre."kh_cl where kh='".$msg["no"]."' group by zsh"; $r=$db->query($q); $arr_cl=""; while($m=$db->fetch_array($r)){ $p_big=get_kh_cl_big($m["pic"],$flag_pad_offline); $href1="?_m=cl_single&s_zsh=".$m["zsh"]."&rurl_cl_list=".urlencode($this_url); $pic=get_kh_cl_mini($m["pic"],$flag_pad_offline); $tmpcl=out_good_pic_set_arr($pic,150,112); $arr_cl.="{\"zsh\":\"".$m["zsh"]."\",\"pic\":\"".$pic."\",\"pic_w\":\"".$tmpcl[0]."\",\"pic_h\":\"".$tmpcl[1]."\",\"title\":\"".$m["title"]." 第".$m["ord"]."件\"},"; } $arr_cl=substr($arr_cl,0,-1); $json_data.="\"cls\":[".$arr_cl."],"; //--取得相关橱窗 $q="select * from ".$table_pre."kh_cc where kh='".$msg["no"]."' group by zsh"; $r=$db->query($q); $arr_cc=""; while($m=$db->fetch_array($r)){ $p_big=get_kh_cc_big($m["pic"],$flag_pad_offline); $href1="?_m=cc_single&zsh=".$m["zsh"]."&rurl=".urlencode($this_url); $pic=get_kh_cc_mini($m["pic"],$flag_pad_offline); $tmpcc=out_good_pic_set_arr($pic,150,112); $arr_cc.="{\"zsh\":\"".$m["zsh"]."\",\"pic\":\"".$pic."\",\"pic_w\":\"".$tmpcc[0]."\",\"pic_h\":\"".$tmpcc[1]."\",\"title\":\"".$m["title"]."\"},"; } $arr_cc=substr($arr_cc,0,-1); $json_data.="\"ccs\":[".$arr_cc."],"; // if($first_act) $js_onload=" onload=\"".$first_act."\""; //$json_data.="\"js_onload\":\"".$js_onload."\","; //上一款、下一款 if($xh_ms=="2"){ $pre_xh=get_db_msg("select b.id 'id' from ".$table_pre."kh_xh a,".$table_pre."kh b where b.ka<>'y' and a.kh=b.no and a.xh<'".$_xh."' and a.kh<>'".$msg["no"]."' order by a.xh desc limit 0,1"); $next_xh=get_db_msg("select b.id 'id' from ".$table_pre."kh_xh a,".$table_pre."kh b where b.ka<>'y' and a.kh=b.no and a.xh>'".$_xh."' and a.kh<>'".$msg["no"]."' order by a.xh limit 0,1"); }else{ $pre_xh=get_db_msg("select id from ".$table_pre."kh where ka<>'y' and xh<'".$_xh."' and no<>'".$msg["no"]."' order by xh desc limit 0,1"); $next_xh=get_db_msg("select id from ".$table_pre."kh where ka<>'y' and xh>'".$_xh."' and no<>'".$msg["no"]."' order by xh limit 0,1"); } $str_sxk="[\"".$pre_xh["id"]."\",\"".$next_xh["id"]."\"]"; $json_data.="\"prev\":\"".$pre_xh["id"]."\","; $json_data.="\"next\":\"".$next_xh["id"]."\","; $str_color=$msg["color"]; $json_data.="\"str_color\":\"".$str_color."\","; //取得尺码组名称 $tmp=get_db_msg("select title from ".$table_pre."keyword where id='".$msg["size_group"]."'"); $size_group_title=$tmp["title"]; $json_data.="\"size_group_title\":\"".$size_group_title."\","; if($is_xd_clothes=="y"){ //取得配码信息 $arr_bx_title=explode(",",$str_bx_title); if($pm_ms!="n"){ $qy_uid=get_qy_id($msg_login["path"]); $dl_uid=get_dl_id($msg_login["path"]); if($msg["size_group"]==$child_sizegroup_id){ //童装配码规则,如果启用后台配码,并且有配码,只能配码输入。 $default_pm_id=0; $default_pm=""; //取得所有适合我的配码 $pm_op=""; $i=0; foreach($arr_child_bx as $bx1 => $arr_bx_size1){ if(in_array($bx1,$arr_bx_title)){ $con1="bx='".$bx1."' and ((uid='0' and dlid=0 and qyid=0) or (uid='".$uid."')) and (khid='".$msg["id"]."' or khid='0')"; if($msg["pm_dj"]){ $con1.=" and pm_dj='".$msg["pm_dj"]."'"; } $str_pm1=""; $m=get_db_msg("select id,title,gz from ".$table_pre."size_pm where ".$con1." order by uid desc,dlid desc,qyid desc,size_group_id desc limit 0,1"); if($m["id"]>0) $pm_op.="{\"xh\":\"".$i."\",\"bx\":\"".$bx1."\",\"gz\":\"".$m["gz"]."\",\"title\":\"".$m["title"]."\",\"id\":\"".$m["id"]."\"},"; else $pm_op.="{\"xh\":\"".$i."\",\"bx\":\"".$bx1."\",\"gz\":\"\",\"title\":\"\",\"id\":\"\"},"; } $i++; } $pm_op=substr($pm_op,0,-1); }else{ //默认匹配规则 $default_pm_id=0; $default_pm=""; //取得所有适合我的配码 $pm_op=""; $pm_op_value=$default_pm_id; $con1="((uid='0' and dlid=0 and qyid=0) or (uid='".$uid."')) and (khid='".$msg["id"]."' or khid='0')"; if($msg["pm_dj"]){ $con1.=" and pm_dj='".$msg["pm_dj"]."'"; } $q="select id,title,gz from ".$table_pre."size_pm where ".$con1." order by uid desc,dlid desc,qyid desc,size_group_id desc,id desc"; $r=$db->query($q); $i=0; while($m=$db->fetch_array($r)){ $pm_op.="{\"gz\":\"".$m["gz"]."\",\"title\":\"".$m["title"]."\",\"id\":\"".$m["id"]."\"},"; if($i==0){ $default_pm_id=$m["id"]; $default_pm=$m["gz"]; } $i++; } /*if($i==0) $pm_op.="\"|-暂无配码规则-|\",";*/ $pm_op=substr($pm_op,0,-1); $str_pm_num=$str_pm_gz=""; if($default_pm){ $str_pm_gz=$default_pm; $num_pm=0; $arr1=explode(":",$default_pm); for($i=0;$i0) $str_pm_num="=".$num_pm; } $pg_gz_w=count($arr_size)*13; $content_pm=""; } } $q1="select * from ".$table_pre."pm_count where uid='".$uid."' order by num desc limit 0,3"; $r1=$db->query($q1); $str_cypm=""; while($m1=$db->fetch_array($r1)){ $str_cypm.="{\"gz\":\"".$m1["gz"]."\"},"; } $str_cypm=deel_end($str_cypm); $json_data.="\"cypm\":[".$str_cypm."],"; } if($sys_ver_hy=="xz" && $is_xd_clothes!="y"){ $q1="select num from ".$table_pre."gz where cate='zxs' and (dj='".$msg_login["dj"]."' or dj='') and kh='".$msg["no"]."' order by num"; //echo $q1; $r1=$db->query($q1); $sql_pm=""; $str_zxs=""; while($m1=$db->fetch_array($r1)){ $sql_pm.="num='".$m1["num"]."' or "; //$str_zxs.="{\"zxs\":\"".$m1["num"]."\"},"; $str_zxs.=$m1["num"].","; } if($str_zxs){ $str_zxs=deel_end($str_zxs); } //$json_data.="\"zxs\":\"".$str_zxs."\","; if($sql_pm) $sql_pm=" and (".substr($sql_pm,0,-4).")"; //读取配码信息 //配码等级一样,店铺id一样或者店铺id为空(适合所有店铺的配码) $q="select * from ".$table_pre."size_pm where (uid='".$uid."' or uid='') and pm_dj='".$msg["pm_dj"]."' ".$sql_pm." order by id"; //echo $q; $r=$db->query($q); $content_pm=""; $i=0; $size_ws_kh=count(explode(",",$msg["size"])); $str_pm=""; while($m=$db->fetch_array($r)){ $size_ws=count(explode(":",$m["gz"])); //echo $size_ws."|".$size_ws_kh."-
"; if($size_ws==$size_ws_kh){ $is_edit=($m["uid"]==$uid)?"y":"n"; $str_pm.="{\"is_edit\":\"".$is_edit."\",\"id\":\"".$m["id"]."\",\"title\":\"".$m["title"]."\",\"gz\":\"".$m["gz"]."\",\"num\":\"".$m["num"]."\"},"; $i++; } } if($str_pm){ $str_pm=deel_end($str_pm); } if($i==1){ //$json_data.="\"mrpm\":[".$str_pm."],"; } } $json_data.="\"total\":\"".$total."\","; $json_data.="\"translate_xh\":\"".d_translate("xh")."\","; $json_data.="\"translate_gg\":\"".d_translate("gg")."\","; $json_data.="\"translate_dhbs\":\"".d_translate("dhbs")."\","; $json_data.="\"translate_dpk\":\"".d_translate("dpk")."\","; $json_data.="\"translate_xgdp\":\"".d_translate("xgdp")."\","; $json_data.="\"this_pm\":\"".$default_pm."\","; $json_data.="\"default_pm\":\"".$default_pm."\","; $json_data.="\"pmkg\":\"".$pm_ms."\","; $json_data.="\"pg_gz_w\":\"".$pg_gz_w."\","; $json_data.="\"str_pm_gz\":\"".$str_pm_gz."\","; $json_data.="\"str_pm_num\":\"".$str_pm_num."\","; $json_data.="\"pms\":[".$pm_op."],"; //include_once $path_dz."/dp/order_single.php"; update_log_hd(); } break; case "save": $errmsg=""; //判断是否存在规格 $id=$khid; $is_ggk=is_ggk($id); $is_kc='n'; $tmp_info=get_db_msg("select id from ".$table_pre."kh_kc where iid='".$id."'");//******* if($tmp_info['id']>0){//*********************************************************************** $is_kc='y';//*********************************************************************** } //保存订单 $msg=get_db_msg("select * from ".$table_pre."kh where id='".$id."'"); if($is_brand=="y"){ $msg_brand=get_db_msg("select * from ".$table_pre."client_brand where cid='".$uid."' and brand='".$msg["brand"]."'"); } if($order_close=="y"){ //alert_and_back("订单保存失败,原因是系统订单已经关闭!"); $errmsg="订单保存失败,原因是系统订单已经关闭!"; } if(($msg_login["is_jd"]=="y" || $msg_brand["is_jd"]=="y") && !$errmsg){ //alert_and_back("订单保存失败,原因是本用户订单已经提交!"); $errmsg="订单保存失败,原因是本用户订单已经提交!"; } if(($msg_login["is_checked"]=="y" || $msg_brand["is_checked"]=="y") && !$errmsg){ //alert_and_back("订单保存失败,原因是本用户订单已经确认!"); $errmsg="订单保存失败,原因是本用户订单已经确认!"; } //判断代理 $dl_uid=get_dl_id($msg_login["path"]); if($dl_uid>0){ $msg_dl=get_db_msg("select * from ".$table_pre."client where id='".$dl_uid."'"); if($is_brand=="y"){ $msg_brand_dl=get_db_msg("select * from ".$table_pre."client_brand where cid='".$dl_uid."' and brand='".$msg["brand"]."'"); } if(($msg_dl["is_jd"]=="y" || $msg_brand_dl["is_jd"]=="y") && !$errmsg){ //alert_and_back("订单保存失败,原因是您的代理已经提交!"); $errmsg="订单保存失败,原因是您的代理已经提交!"; } if(($msg_dl["is_checked"]=="y" || $msg_brand_dl["is_checked"]=="y") && !$errmsg){ //alert_and_back("订单保存失败,原因是您的代理订单已经确认!"); $errmsg="订单保存失败,原因是您的代理订单已经确认!"; } } //判断是否采用服装版本下单 $is_xd_clothes="y"; if($sys_ver_hy=="xz"){ $msg_size_group=get_db_msg("select title from ".$table_pre."keyword where cate='size' and id='".$msg["size_group"]."'"); if(in_array($msg_size_group["title"],$sys_size_group_xz)) $is_xd_clothes="n"; } $json_data.="\"is_xd_clothes\":\"".$is_xd_clothes."\","; if($sys_ver_hy!="xz"){ if($msg["size_group"]==$bx_sizegroup_id){ //文胸 $arrBx=array(); $r1=$db->query("select * from ".$table_pre."size_bx where no='".$msg["no"]."' order by bx"); $i1=0; while($m1=$db->fetch_array($r1)){ $arrBx[$i1][]=$m1["bx"]; $arrBx[$i1][]=$m1["size"]; $i1++; } //取得尺码 $str_size=""; $r1=$db->query("select * from ".$table_pre."size where iid='".$bx_sizegroup_id."' order by no"); while($m1=$db->fetch_array($r1)){ $str_size.=$m1["no"].","; } $str_size=substr($str_size,0,-1); $arr_size=explode(",",$str_size); }else if($msg["size_group"]==$child_sizegroup_id){ //童装 $str_size=$str_bx=""; $i1=$j1=0; foreach($arr_child_bx as $bx1 => $arr_bx_size1){ $check_tmp=get_db_msg("select id,size,price from ".$table_pre."size_bx where no='".$msg["no"]."' and bx='".$bx1."'"); if($check_tmp["id"]>0){ $str_bx.=$i1.","; $arrBx[$j1][0]=$i1; $arrBx[$j1][1]=$check_tmp["size"]; $j1++; } $i1++; } //取得尺码 $str_size=""; $r1=$db->query("select * from ".$table_pre."size where iid='".$child_sizegroup_id."' order by no"); while($m1=$db->fetch_array($r1)){ $str_size.=$m1["no"].","; } $str_size=substr($str_size,0,-1); $arr_size=explode(",",$str_size); }else{ if($is_ggk!="n"){ $arrBx[0][0]=""; $r1=$db->query("select gg from ".$table_pre."kh_gg where iid='".$msg["id"]."' order by color,ord"); $i1=1; while($m1=$db->fetch_array($r1)){ $arrBx[$i1][0]=$m1["gg"]; $i1++; } }else{ $arrBx[0][0]=""; } $arrBx[0][1]=$msg["size"]; $arr_size=explode(",",$msg["size"]); } // //print_R($arrBx); $arr_color=explode(",",$msg["color"]); $arr_color_ka=explode(",",$msg["color_ka"]); $tmp_total_num=0; $tmp_old=get_db_msg("select sum(".get_size_sql("sum").") 'num' from ".$table_pre."order where uid='".$uid."' and iid='".$id."' and _key='".$_key."'"); //取得总量 for($i=0;$i $tmp_size){ for($j=0;$j$order_large_num && !$errmsg){ //alert_and_back("对不起,您输入的订量(".$$v.")超过了单尺码最大订量限制(".$order_large_num."),无法保存,请检查!"); $errmsg="对不起,您输入的订量(".$$v.")超过了单尺码最大订量限制(".$order_large_num."),无法保存,请检查!"; } //echo $v."|".$$v."
"; } //$j++; } } //检查订货规则 $errm=""; for($i=0;$i $tmp_size){ for($j=0;$j"; $num=count_pm_num($arr_tmp[1]); $check_pm=$arr_tmp[0].$arr_tmp[1]; if(in_array($check_pm,$arr_check_pm)){ //alert_and_back($arr_tmp[0]."存在相同配码"); $errmsg=$arr_tmp[0]."存在相同配码"; }else{ $arr_check_pm[$i1]=$check_pm; } if($num>0){ //取得配码id $m_pm=get_db_msg("select id from ".$table_pre."size_pm where uid='".$uid."' and khid='".$msg["id"]."' and gz='".$arr_tmp[1]."'"); if($m_pm["id"]>0){ $pmid1=$m_pm["id"]; }else{ // $tmp=get_db_msg("select title from ".$table_pre."size_pm where gz='".$arr_tmp[1]."' and (uid='".$uid."' or uid='')"); if($tmp["title"]) $pm_title=$tmp["title"]; else $pm_title="临时".get_rand_num(4); $q="insert into ".$table_pre."size_pm (qyid,uid,size_group_id,pm_dj,khid,title,gz,num) values ('".$qy_uid."','".$uid."','".$msg["size_group"]."','临时配码','".$msg["id"]."','".$pm_title."','".$arr_tmp[1]."','".$num."')"; //echo $q."
"; $db->query($q); $pmid1=$db->insert_id(); } $arr_pm_id[$i1]=$pmid1; }else{ //alert_and_back("请输入尺码!"); $errmsg="请输入尺码!"; } } //保存订单 if($is_ggk!="n"){ $arrBx[0][0]=""; $r1=$db->query("select gg from ".$table_pre."kh_gg where iid='".$msg["id"]."' group by gg order by gg"); $i1=1; while($m1=$db->fetch_array($r1)){ $arrBx[$i1][0]=$m1["gg"]; $i1++; } }else{ $arrBx[0][0]=""; } $arrBx[0][1]=$msg["size"]; // $arr_size=explode(",",$msg["size"]); $arr_color=explode(",",$msg["color"]); $arr_size=explode(",",$msg["size"]); $arr_color_ka=explode(",",$msg["color_ka"]); $tmp_total_num=0; $errm=""; $tmp_old=get_db_msg("select sum(".get_size_sql("sum").") 'num' from ".$table_pre."order where _key='".$sys_this_order_flag."' and uid='".$uid."' and iid='".$id."'"); //取得到色的尺码数量 for($i1=0;$i1"; } $tmp_num=count_pm_num($arr_tmp[1])*$arr_tmp[2]; //到颜色的数量 $v1="color_num_".$arr_tmp1[0]; $$v1+=$tmp_num; //到颜色版型的数量 $v2="color_bx_num_".$arr_tmp1[0]."_".$arr_tmp1[1]; $$v2+=$tmp_num; $tmp_total_num+=$tmp_num; } //检查订货规则 for($i=0;$i'jgd' and no<>'sx' and no<>'zd1' and no<>'zd2' and no<>'zd3' order by ord"; $r1=$db->query($q1); while($m1=$db->fetch_array($r1)){ $arr_select_no[]=$m1["no"]; } if($is_xd_clothes=="y"){ for($i=0;$i $tmp_size){ for($j=0;$j"; $bx_title=($msg["size_group"]==$child_sizegroup_id)?get_child_bx_title($tmp_bx):$tmp_bx; $sql_size1=$sql_size2=$sql_size3=""; $c=0; $cypm=""; for($k=0;$k"; $c+=$$v; $sql_size1.="num_".$arr_size[$k]."='".deel_num($$v)."',"; $sql_size2.=",'".deel_num($$v)."'"; $sql_size3.=",num_".$arr_size[$k]; $cypm.=deel_num($$v).":"; } if($c>0){ $cypm=substr($cypm,0,-1); $tmpcypm=get_db_msg("select * from ".$table_pre."pm_count where uid='".$uid."' and gz='".$cypm."'"); $cyomnum=0; if($tmpcypm["id"]){ $cyomnum=$tmpcypm["num"]+1; $q="update ".$table_pre."pm_count set num=".$cyomnum.",add_date='".time()."' where id='".$tmpcypm["id"]."'"; }else{ $cyomnum++; $q="insert into ".$table_pre."pm_count (uid,gz,num,add_date) values ('".$uid."','".$cypm."',".$cyomnum.",'".time()."')"; } $db->query($q); } $check=get_db_msg("select id from ".$table_pre."order where _key='".$_key."' and uid='".$uid."' and iid='".$id."' and color='".$arr_color[$i]."' and bx='".$bx_title."'"); if($check["id"]){ if($c>0){ $q="update ".$table_pre."order set size_group_id='".$msg["size_group"]."',".$sql_size1."add_date='".time()."' where id='".$check["id"]."'"; //记录订单表sql日志 update_order_log($uid,"update ".$table_pre."order set size_group_id='".$msg["size_group"]."',".$sql_size1."add_date='".time()."' where _key='".$_key."' and uid='".$uid."' and iid='".$id."' and color='".$arr_color[$i]."' and bx='".$bx_title."' and _key='".$_key."'"); $db->query($q); cache_order($uid,$id,$arr_color[$i],$bx_title); }else{ $q="delete from ".$table_pre."order where id='".$check["id"]."'"; $db->query($q); update_order_log($uid,"delete from ".$table_pre."order where _key='".$_key."' and uid='".$uid."' and iid='".$id."' and color='".$arr_color[$i]."' and bx='".$bx_title."' and _key='".$_key."'"); } }else{ if($c>0){ $sql1=$sql2=""; for($i1=0;$i1query($q); update_order_log($uid,"insert into ".$table_pre."order (uid,upath,iid,no,".$sql1."jgd,color,bx,is_sp,size_group_id".$sql_size3.",_key,sx,add_date) values ('".$uid."','".$upath."','".$id."','".$msg["no"]."',".$sql2."'".get_jgd($msg["price"])."','".$arr_color[$i]."','".$bx_title."','".$msg["is_sp"]."','".$msg["size_group"]."'".$sql_size2.",'".$_key."','".get_sx($arr_color[$i])."','".time()."')"); cache_order($uid,$id,$arr_color[$i],$bx_title); } } //$j++; } count_ph($uid,$id,$arr_color[$i]); } } }else{ //echo "aaa"; //exit; for($i=0;$i0){ $q="update ".$table_pre."order set size_group_id='".$msg["size_group"]."',".$sql_size1."add_date='".time()."' where id='".$check["id"]."'"; $strq.= $q.";"; $db->query($q); cache_order($uid,$id,$arr_color[$i],$arrBx[$j][0]); }else{ $q="delete from ".$table_pre."order where id='".$check["id"]."'"; $db->query($q); } }else{ if($c>0){ $sql1=$sql2=""; for($i1=0;$i1query($q); cache_order($uid,$id,$arr_color[$i],$arrBx[$j][0]); } } } count_ph($uid,$id,$arr_color[$i]); } } $json_data.="\"strq\":\"".$strq."\","; //清空配码信息 $db->query("delete from ".$table_pre."order_pm where _key='".$sys_this_order_flag."' and uid='".$uid."' and iid='".$id."'"); //保存配码信息 for($i1=0;$i1query($q); } } //计算数量变化 $log_hd_old_num=$tmp_old["num"]; $log_hd_num=$tmp_total_num-$tmp_old["num"]; // update_log_hd(); set_order_total($uid); if($go_url){ $url=$go_url; }else{ if($auto_back=="y") $url=$rurl; else $url=$_SERVER[PHP_SELF]."?_m=order_single&rurl=".urlencode($rurl)."&id=".$id; } $json_data.="\"code\":101,"; } //echo $url."
"; //url_redirect($url); break; case "save_pm": $errmsg=check_pm_gz($pm_gz); if($errmsg){ $json_data.="\"code\":0,\"msg\":\"".$errmsg."\","; }else{ $title=trim($pm_title); $gz=deel_pm_gz($pm_gz); $qy_uid=get_qy_id($msg_login["path"]); $num=count_pm_num($gz); if($khid){ $check=get_db_msg("select * from ".$table_pre."size_pm where uid='".$uid."' and khid='".$khid."' and size_group_id='".$size_group_id."' and title='".$title."'"); }else{ $check=get_db_msg("select * from ".$table_pre."size_pm where uid='".$uid."' and size_group_id='".$size_group_id."' and title='".$title."'"); } if($check["id"]>0){ if($khid){ $q="update ".$table_pre."size_pm set gz='".$gz."' and khid='".$khid."' where id='".$check["id"]."'"; }else{ $q="update ".$table_pre."size_pm set gz='".$gz."' where id='".$check["id"]."'"; } }else{ if($khid){ $q="insert into ".$table_pre."size_pm (qyid,uid,khid,size_group_id,title,gz,num) values ('".$qy_uid."','".$uid."','".$khid."','".$size_group_id."','".$title."','".$gz."','".$num."')"; }else{ $q="insert into ".$table_pre."size_pm (qyid,uid,size_group_id,title,gz) values ('".$qy_uid."','".$uid."','".$size_group_id."','".$title."','".$gz."')"; } } $db->query($q); $json_data.="\"code\":101,"; } //echo "success"; //exit; break; case "del_pm": $title=trim($pm_title); if($khid){ $q="delete from ".$table_pre."size_pm where uid='".$uid."' and khid='".$khid."' and size_group_id='".$size_group_id."' and title='".$title."'"; }else{ $q="delete from ".$table_pre."size_pm where uid='".$uid."' and size_group_id='".$size_group_id."' and title='".$title."'"; } $db->query($q); $json_data.="\"code\":101,"; //echo $q; //echo "success"; //exit; break; case "del": $errmsg=""; $id=$khid; $m_kh=get_db_msg("select * from ".$table_pre."kh where id='".$id."'"); if($is_brand=="y"){ $msg_brand=get_db_msg("select * from ".$table_pre."client_brand where cid='".$uid."' and brand='".$m_kh["brand"]."'"); } //删除订单 if($order_close=="y"){ //alert_and_back("删除订单失败,原因是系统订单已经关闭!"); $errmsg="删除订单失败,原因是系统订单已经关闭!"; } if($msg_login["is_jd"]=="y" || $msg_brand["is_jd"]=="y"){ $errmsg="删除订单失败,原因是本用户订单已经提交!"; } if($msg_login["is_checked"]=="y" || $msg_brand["is_checked"]=="y" && !$errmsg){ //alert_and_back("删除订单失败,原因是本用户订单已经确认!"); $errmsg="删除订单失败,原因是本用户订单已经确认!"; } //判断代理 $dl_uid=get_dl_id($msg_login["path"]); if($dl_uid>0){ $msg_dl=get_db_msg("select * from ".$table_pre."client where id='".$dl_uid."'"); if($is_brand=="y"){ $msg_brand_dl=get_db_msg("select * from ".$table_pre."client_brand where cid='".$dl_uid."' and brand='".$m_kh["brand"]."'"); } if(($msg_dl["is_jd"]=="y" || $msg_brand_dl["is_jd"]=="y") && !$errmsg){ //alert_and_back("删除订单失败,原因是您的代理已经提交!"); $errmsg="删除订单失败,原因是您的代理已经提交!"; } if(($msg_dl["is_checked"]=="y" || $msg_brand_dl["is_checked"]=="y") && !$errmsg){ //alert_and_back("删除订单失败,原因是您的代理订单已经确认!"); $errmsg="删除订单失败,原因是您的代理订单已经确认!"; } } if($errmsg){ $json_data.="\"code\":0,\"msg\":\"".$errmsg."\","; }else{ $tmp_old=get_db_msg("select sum(".get_size_sql("sum").") 'num' from ".$table_pre."order where uid='".$uid."' and iid='".$id."' and ka<>'y' and _key='".$_key."'"); $log_hd_num=$tmp_old["num"]; $q="delete from ".$table_pre."order where iid='".$id."' and uid='".$uid."' and _key='".$_key."' and ka<>'y'"; $db->query($q); update_order_log($uid,"delete from ".$table_pre."order where iid='".$id."' and uid='".$uid."' and _key='".$_key."' and ka<>'y'"); $is_xd_clothes="y"; if($sys_ver_hy=="xz"){ $msg_size_group=get_db_msg("select title from ".$table_pre."keyword where cate='size' and id='".$m_kh["size_group"]."'"); if(in_array($msg_size_group["title"],$sys_size_group_xz)) $is_xd_clothes="n"; } $json_data.="\"is_xd_clothes\":\"".$is_xd_clothes."\","; if($is_xd_clothes!="y"){ //删除订单配码表 $q="delete from ".$table_pre."order_pm where _key='".$_key."' and iid='".$id."' and uid='".$uid."'"; $db->query($q); } //删除搭配款号订单 $m_kh=get_db_msg("select * from ".$table_pre."kh where id='".$id."'"); $q1="select zsh from ".$table_pre."kh_dp where kh='".$m_kh["no"]."' and gz<>'' group by zsh"; $r1=$db->query($q1); while($m1=$db->fetch_array($r1)){ $q2="select * from ".$table_pre."kh_dp where kh<>'".$m_kh["no"]."' and zsh='".$m1["zsh"]."'"; $r2=$db->query($q2); while($m2=$db->fetch_array($r2)){ $q3="delete from ".$table_pre."order where no='".$m2["kh"]."' and uid='".$uid."' and color='".$m2["color"]."' and ka<>'y' and _key='".$_key."'"; $tmp_old=get_db_msg("select sum(".get_size_sql("sum").") 'num' from ".$table_pre."order where no='".$m2["kh"]."' and uid='".$uid."' and color='".$m2["color"]."' and ka<>'y' and _key='".$_key."'"); $log_hd_num+=$tmp_old["num"]; $db->query($q3); update_order_log($uid,"delete from ".$table_pre."order where no='".$m2["kh"]."' and uid='".$uid."' and color='".$m2["color"]."' and ka<>'y' and _key='".$_key."'"); } } // update_log_hd(); set_order_total($uid); count_ph_uid_kh($uid,$id); $json_data.="\"code\":101,"; } /*if($is_window=="n"){ if($go_url){ url_redirect($go_url); }else{ echo ""; } }else{ if($go_url){ $url=$go_url; }else{ if($s_xh>0){ $url=$_SERVER[PHP_SELF]."?_m=order_single&rurl=".urlencode($rurl)."&s_xh=".$s_xh; }else{ $url=$rurl?$rurl:$_SERVER[PHP_SELF]; } } url_redirect($url); }*/ //echo ""; break; default: //------------------------列表 //---------------搜索条件 $w2=$tmpl_m1_pic_width; $h2=$tmpl_m1_pic_height; $page=$page>0?$page:1; $limit=$limit>0?$limit:12; $start=($page-1)*$limit; $end=$limit; $sql_con=""; $sql_con1=""; if($s_color){ $s_color_a=explode(",",$s_color); $s1=$s2=$s3=""; //$sql_con_color1=""; for($i1=0;$i1 $v1){ $v="s_color_".$k1; if($$v){ $s1=$s2=""; $tmp_a=explode(",",$$v); for($i1=0;$i1=3){ $xhsql_s=",case when no='".$tmp_xh["no"]."' then 100 else 1 end as ppd "; $xhsql_e="ppd desc,"; $xhsql_s1=",case when a.no='".$tmp_xh["no"]."' then 100 else 1 end as ppd "; $xhsql_e1="ppd desc,"; if(is_numeric($s_keyword)){ $sql_con=" where (no='".$tmp_xh["no"]."' or no like '%".$s_keyword."%')"; $sql_con1=" and (a.no='".$tmp_xh["no"]."' or a.no like '%".$s_keyword."%')"; }else{ $sql_con=" where no like '%".$s_keyword."%'"; $sql_con1=" and a.no like '%".$s_keyword."%'"; } for($i=0;$i0 ".$con_pjxj.$sql_con1; //echo $query."
"; }else{ $query="select count(distinct kc.iid,kc.color) 'total' from ".$table_pre."kh_color kc left join ".$table_pre."kh a on a.id=kc.iid left join left join (select iid,color,num from ".$table_pre."order where uid='".$uid."' and _key='".$_key."') as o on kc.iid=o.iid and kc.color=o.color where o.num>0 ".$sql_con1; } }else if($s_is_ordered=="n"){ if($s_xj){ $query="select count(distinct kc.iid,kc.color) 'total' from ".$table_pre."kh_color kc left join ".$table_pre."kh a on a.id=kc.iid left join left join (select iid,color,num from ".$table_pre."order where uid='".$uid."' and _key='".$_key."') as o on kc.iid=o.iid and kc.color=o.color left join ".$table_pre."client_pj c on o.iid=c.khid and c.cid='".$uid."' where o.num is NULL ".$con_pjxj.$sql_con1; }else{ $query="select count(distinct kc.iid,kc.color) 'total' from ".$table_pre."kh_color kc left join ".$table_pre."kh a on a.id=kc.iid left join (select iid,color,num from ".$table_pre."order where uid='".$uid."' and _key='".$_key."') as o on kc.iid=o.iid and kc.color=o.color where o.num is NULL ".$sql_con1; } }else{ if($s_xj){ $query="select count(distinct kc.iid,kc.color) 'total' from ".$table_pre."kh_color kc left join ".$table_pre."kh a on a.id=kc.iid left join ".$table_pre."client_pj c on kc.iid=c.khid and c.cid='".$uid."' where kc.id>0 ".$con_pjxj.$sql_con1; }else{ $query="select count(distinct kc.iid,kc.color) 'total' from ".$table_pre."kh_color kc left join ".$table_pre."kh a on a.id=kc.iid where kc.id>0".$sql_con1; } } }else{ //展示到款 if($s_is_ordered=="y"){ if($s_xj){ $query="select count(distinct c.khid) 'total' from ".$table_pre."order a left join ".$table_pre."client_pj c on a.iid=c.khid and c.cid='".$uid."' and a._key='".$_key."' where a.uid='".$uid."' ".$con_pjxj.$sql_con1; }else{ $query="select count(distinct a.iid) 'total' from ".$table_pre."order a where a.uid='".$uid."' and a._key='".$_key."' ".$sql_con1; } }else if($s_is_ordered=="n"){ if($s_xj){ $query="select count(*) 'total' from ".$table_pre."kh a left join (select iid,color,num from ".$table_pre."order where uid='".$uid."' and _key='".$_key."') as b on a.id=b.iid left join ".$table_pre."client_pj c on a.id=c.khid and c.cid='".$uid."' where b.num is NULL ".$con_pjxj.$sql_con1; }else{ $query="select count(*) 'total' from ".$table_pre."kh a left join (select iid,color,num from ".$table_pre."order where uid='".$uid."' and _key='".$_key."') as b on a.id=b.iid where b.num is NULL ".$sql_con1; } }else{ if($s_xj){ $query="select count(*) 'total' from ".$table_pre."kh a left join ".$table_pre."client_pj c on a.id=c.khid and c.cid='".$uid."' where a.id>0 ".$con_pjxj.$sql_con1; }else{ $query="select count(*) 'total' from ".$table_pre."kh ".$sql_con; } } } //echo $query."
"; //$json_data.="\"query\":\"".$query."\","; $res=$db->query($query); $msg=$db->fetch_array($res); $total_num=$msg["total"]; if($list_by_color=="y"){ //------------------展示到色 //定制条件 if($s_is_ordered=="y"){ if($s_xj){ $query="select a.*,c.race,b.num,kc.color 'color'".$xhsql_s1." from ".$table_pre."kh_color kc left join ".$table_pre."kh a on kc.iid=a.id left join (select iid,color,num from ".$table_pre."order where uid='".$uid."' and _key='".$_key."') as b on kc.iid=b.iid left join ".$table_pre."client_pj c on kc.iid=c.khid and c.cid='".$uid."' where b.num>0 ".$con_pjxj.$sql_con1." group by kc.id,kc.color order by ".$xhsql_e1."a.xh,a.no,bpd desc limit ".$start.",".$end; }else{ $query="select a.*,b.num,kc.color 'color'".$xhsql_s1." from ".$table_pre."kh_color kc left join ".$table_pre."kh a on kc.iid=a.id left join (select iid,color,num from ".$table_pre."order where uid='".$uid."' and _key='".$_key."') as b on kc.iid=b.iid and kc.color=b.color where b.num>0 ".$sql_con1." group by kc.id,kc.color order by ".$xhsql_e1."a.xh,a.no limit ".$start.",".$end; } //echo $query."
"; }else if($s_is_ordered=="n"){ if($s_xj){ $query="select a.*,c.race,b.num,kc.color 'color'".$xhsql_s1." from ".$table_pre."kh_color kc left join ".$table_pre."kh a on kc.iid=a.id left join (select iid,color,num from ".$table_pre."order where uid='".$uid."' and _key='".$_key."') as b on kc.iid=b.iid and b.color=kc.color left join ".$table_pre."client_pj c on kc.iid=c.khid and c.cid='".$uid."' where b.num is NULL ".$con_pjxj.$sql_con1." group by kc.id,kc.color order by ".$xhsql_e1."a.xh,a.no limit ".$start.",".$end; }else{ $query="select a.*,b.num,kc.color 'color'".$xhsql_s1." from ".$table_pre."kh_color kc left join ".$table_pre."kh a on kc.iid=a.id left join (select iid,color,num from ".$table_pre."order where uid='".$uid."' and _key='".$_key."') as b on kc.iid=b.iid and b.color=kc.color where b.num is NULL ".$sql_con1." group by kc.id,kc.color order by ".$xhsql_e1."a.xh,a.no limit ".$start.",".$end; } }else{ if($s_xj){ $query="select a.*,c.race,kc.color 'color'".$xhsql_s1." from ".$table_pre."kh_color kc left join ".$table_pre."kh a on kc.iid=a.id left join ".$table_pre."client_pj c on kc.iid=c.khid and c.cid='".$uid."' where kc.id>0 ".$con_pjxj.$sql_con1." group by kc.id,kc.color order by ".$xhsql_e1."a.xh,a.no limit ".$start.",".$end; }else{ $query="select a.*,kc.color 'color'".$xhsql_s1." from ".$table_pre."kh_color kc left join ".$table_pre."kh a on kc.iid=a.id where kc.id>0".$sql_con1." group by kc.id,kc.color order by ".$xhsql_e1."a.xh,a.no limit ".$start.",".$end; } } if($s_is_read=="n"){ $query="select a.*,kc.color 'color',v.add_date from ".$table_pre."kh_color kc left join ".$table_pre."kh a on kc.iid=a.id LEFT JOIN (select uid,iid,add_date from ".$table_pre."kh_read_log where uid='".$uid."' group by uid,iid) as v ON v.iid <> a.id where kc.id>0 and v.add_date is NULL group by kc.id,kc.color order by a.xh,a.no limit ".$start.",".$end; } if($xh_ms=="2"){ //-------定制序号查询 if($s_con=="xh" && $s_value_xh!=""){ $query="select a.*,b.xh 'xh' from ".$table_pre."kh a,".$table_pre."kh_xh b where a.no=b.kh and b.xh='".$s_value_xh."'"; } } //echo $query."
"; $json_data.="\"query\":\"".$query."\","; $res=$db->query($query); $count=0; $rnum=0; $style_title_color=get_set("style_title_color"); $ka_color=get_set("ka_color"); $pic_background=get_set("pic_background"); $pic_background=$pic_background?$pic_background:"#ffffff"; $content_set="[\"".$pic_background."\"]"; $json_data.="\"style_title_color\":\"".$style_title_color."\","; $json_data.="\"s_keyword\":\"".$s_keyword."\","; $json_data.="\"ka_color\":\"".$ka_color."\","; $json_data.="\"content_set\":\"".$pic_background."\","; $json_data.="\"list_by_color\":\"".$list_by_color."\","; $json_data.="\"count\":\"".$total_num."\",\"data\":["; $data_str=""; $content_list="["; $arr_id=array(); for($count=0;$count<$end;$count++){ $msg=$db->fetch_array($res); $arr_id[$count]=$msg["id"]; if($msg["ka"]=="y"){ $c=get_set("ka_color"); }else{ $c=get_set_value_dote($style_title_color,$msg["kh_dj"]); } if($msg["id"]>0){ //图片获取规则 $pic=get_kh_color_picture($msg["no"],$msg["color"],$flag_pad_offline); //取得已订件数 $n1=deel_num(get_order_num_kh_color($msg["id"],$msg["color"])); //取得颜色数量 $str_c_num=",".$msg["color"]."-".get_cate_title_no("color",$msg["color"]); //取得上次订货会数量 $str_sys=""; if($sys_flag_count>1){ $tmp_sys=get_db_msg("select sum(".get_size_sql("sum").") 'num' from ".$table_pre."order where _key<>'".$_key."' and iid='".$msg["id"]."' and color='".$msg["color"]."' and uid='".$uid."'"); if($tmp_sys["num"]){ $str_sys="\"scjs\":".$tmp_sys["num"].",\"hjjs\":".($tmp_sys["num"]+$n1).","; } $str_sys.="\"lssj\":\"y\","; } $tmp_is_read=get_db_msg("select count(*) 'num' from ".$table_pre."kh_read_log where iid='".$msg["id"]."' and uid='".$uid."'"); if($tmp_is_read["num"]){ $is_read="y"; }else{ $is_read="n"; } //取得评价信息 $tmp=get_db_msg("select id,race,remark from ".$table_pre."client_pj where khid='".$msg["id"]."' and cid='".$uid."'"); $pj_race=$tmp["race"]>0?$tmp["race"]:0; $pj_id=$tmp["id"]>0?$tmp["id"]:0; $pj_remark=deel_js_var($tmp["remark"]); $msg_pj=$pj_id."|".$pj_race."|".deel_js_var($tmp["remark"]); //取得滑动展示信息 $text_main=""; $q="select * from ".$table_pre."keyword where cate='arr_select' and flag_ka='y' and no<>'jgd' and no<>'sx' and no<>'color' order by ord"; $r=$db->query($q); $tmpzd=""; while($m=$db->fetch_array($r)){ if($m["no"]=="zd1" || $m["no"]=="zd2" || $m["no"]=="zd3"){ $tmpzd.=",\"".$m["no"]."\":\"".$msg[$m["no"]]."\""; $text_main.=$msg[$m["no"]].","; }else{ $tmpzd.=",\"".$m["no"]."\":\"".deel_js_var(get_cate_title_no($m["no"],$msg[$m["no"]]))."\""; $text_main.=deel_js_var(get_cate_title_no($m["no"],$msg[$m["no"]])).","; } } if($text_main) $text_main=substr($text_main,0,-2); if($msg["remark"]!="") $text_main.="
".deel_js_var(htmlspecialchars($msg["remark"])); if($msg["size_group"]==$child_sizegroup_id){ //童装不显示价格 $this_price=0; }else{ $this_price=deel_num(get_price_dp($uid,$msg["id"])); } //$content_list.="".$msg["id"].",\"".get_kh_xh($msg,$msg["color"])."\",\"".$msg["no"].$str_c_num."\",".$this_price.",\"".$pic."\",\"".str_replace("\"","'",out_good_pic_set($pic,$w2,$h2))."\",".$n1.",\"".$c."\",\"".$msg_pj."\",\"".$text_main."\","; // $rnum++; $ck=out_good_pic_set_arr($pic,$w2,$h2); $data_str.="{\"id\":".$msg["id"].",\"xh\":\"".get_kh_xh($msg,$msg["color"])."\",\"kh\":\"".$msg["no"]."\",\"ksm\":\"".$msg["title"]."\",\"is_read\":\"".$is_read."\",\"color\":\"".$msg["color"]."\",\"color_title\":\"".get_cate_title_no("color",$msg["color"])."\",\"pic\":\"".$pic."\",\"pic_w\":\"".$ck[0]."\",\"pic_h\":\"".$ck[1]."\",\"ydjs\":".$n1.",\"unit_title\":\"".$msg["unit_title"]."\",".$str_sys."\"price\":".$this_price.",\"xj\":\"".$pj_race."\",\"pj_remark\":\"".$pj_remark."\"".$tmpzd."},"; } } $content_list.="]"; }else{ //------------------展示到款 //定制条件 if($s_is_ordered=="y"){ if($s_xj){ $query="select a.*,c.race,b.num".$xhsql_s1." from ".$table_pre."kh a left join ".$table_pre."order b on a.id=b.iid and b.uid='".$uid."' and b._key='".$_key."' left join ".$table_pre."client_pj c on a.id=c.khid and c.cid='".$uid."' where b.num>0 ".$con_pjxj.$sql_con1." group by a.id order by ".$xhsql_e1."a.xh,a.no limit ".$start.",".$end; }else{ $query="select a.*,b.num".$xhsql_s1." from ".$table_pre."kh a left join ".$table_pre."order b on a.id=b.iid and b.uid='".$uid."' and b._key='".$_key."' where b.num>0 ".$sql_con1." group by a.id order by ".$xhsql_e1."a.xh,a.no limit ".$start.",".$end; } //echo $query."
"; }else if($s_is_ordered=="n"){ if($s_xj){ $query="select a.*,c.race,b.num".$xhsql_s1." from ".$table_pre."kh a left join ".$table_pre."order b on a.id=b.iid and b.uid='".$uid."' and b._key='".$_key."' left join ".$table_pre."client_pj c on a.id=c.khid and c.cid='".$uid."' where b.num is NULL ".$con_pjxj.$sql_con1." order by ".$xhsql_e1."a.xh,a.no limit ".$start.",".$end; }else{ $query="select a.*,b.num".$xhsql_s1." from ".$table_pre."kh a left join ".$table_pre."order b on a.id=b.iid and b.uid='".$uid."' and b._key='".$_key."' where (b.num is NULL) ".$sql_con1." order by ".$xhsql_e1."a.xh,a.no limit ".$start.",".$end; } }else{ if($s_xj){ $query="select a.*,c.race".$xhsql_s1." from ".$table_pre."kh a left join ".$table_pre."client_pj c on a.id=c.khid and c.cid='".$uid."' where a.id>0 ".$con_pjxj.$sql_con1." order by ".$xhsql_e1."a.xh,a.no limit ".$start.",".$end; }else{ $query="select *".$xhsql_s." from ".$table_pre."kh ".$sql_con." order by ".$xhsql_e."xh,no limit ".$start.",".$end; } } if($s_is_read=="n"){ $query="select a.*,v.add_date from ".$table_pre."kh a LEFT JOIN (select uid,iid,add_date from ".$table_pre."kh_read_log where uid='".$uid."' group by uid,iid) AS v ON v.iid = a.id WHERE v.add_date is null order by a.xh,a.no limit ".$start.",".$end; } if($xh_ms=="2"){ //-------定制序号查询 if($s_con=="xh" && $s_value_xh!=""){ $query="select a.*,b.xh 'xh' from ".$table_pre."kh a,".$table_pre."kh_xh b where a.no=b.kh and b.xh='".$s_value_xh."'"; } } //echo $query."
"; $json_data.="\"query\":\"".$query."\","; $res=$db->query($query); $count=0; $rnum=0; $style_title_color=get_set("style_title_color"); $ka_color=get_set("ka_color"); $pic_background=get_set("pic_background"); $pic_background=$pic_background?$pic_background:"#ffffff"; $content_set="[\"".$pic_background."\"]"; $json_data.="\"style_title_color\":\"".$style_title_color."\","; $json_data.="\"ka_color\":\"".$ka_color."\","; $json_data.="\"content_set\":\"".$pic_background."\","; $json_data.="\"list_by_color\":\"".$list_by_color."\","; $json_data.="\"count\":\"".$total_num."\",\"data\":["; $data_str=""; $content_list="["; $arr_id=array(); for($count=0;$count<$end;$count++){ $msg=$db->fetch_array($res); $arr_id[$count]=$msg["id"]; if($msg["ka"]=="y"){ $c=get_set("ka_color"); }else{ $c=get_set_value_dote($style_title_color,$msg["kh_dj"]); } if($msg["id"]>0){ //图片获取规则 $pic=get_kh_picture($msg["no"],$msg["main_pic"],$msg["color"],$flag_pad_offline); //取得已订件数 $n1=deel_num(get_order_num_kh($msg["id"])); //取得颜色数量 $c_num=count(explode(",",$msg["color"])); $str_c_num=""; if($is_dkds!="y"){ $str_c_num=" (".$c_num."色)"; } //取得上次订货会数量 $str_sys=""; if($sys_flag_count>1){ $tmp_sys=get_db_msg("select sum(".get_size_sql("sum").") 'num' from ".$table_pre."order where _key<>'".$_key."' and iid='".$msg["id"]."' and uid='".$uid."'"); if($tmp_sys["num"]){ $str_sys="\"scjs\":".$tmp_sys["num"].",\"hjjs\":".($tmp_sys["num"]+$n1).","; } $str_sys.="\"lssj\":\"y\","; } $tmp_is_read=get_db_msg("select count(*) 'num' from ".$table_pre."kh_read_log where iid='".$msg["id"]."' and uid='".$uid."'"); if($tmp_is_read["num"]){ $is_read="y"; }else{ $is_read="n"; } //取得评价信息 $tmp=get_db_msg("select id,race,remark from ".$table_pre."client_pj where khid='".$msg["id"]."' and cid='".$uid."'"); $pj_race=$tmp["race"]>0?$tmp["race"]:0; $pj_id=$tmp["id"]>0?$tmp["id"]:0; $pj_remark=deel_js_var($tmp["remark"]); $msg_pj=$pj_id."|".$pj_race."|".deel_js_var($tmp["remark"]); //取得滑动展示信息 $text_main=""; $q="select * from ".$table_pre."keyword where cate='arr_select' and flag_ka='y' and no<>'jgd' and no<>'sx' and no<>'color' order by ord"; $r=$db->query($q); $tmpzd=""; while($m=$db->fetch_array($r)){ if($m["no"]=="zd1" || $m["no"]=="zd2" || $m["no"]=="zd3"){ $tmpzd.=",\"".$m["no"]."\":\"".$msg[$m["no"]]."\""; $text_main.=$msg[$m["no"]].","; }else{ $tmpzd.=",\"".$m["no"]."\":\"".deel_js_var(get_cate_title_no($m["no"],$msg[$m["no"]]))."\""; $text_main.=deel_js_var(get_cate_title_no($m["no"],$msg[$m["no"]])).","; } } if($text_main) $text_main=substr($text_main,0,-2); if($msg["remark"]!="") $text_main.="
".deel_js_var(htmlspecialchars($msg["remark"])); //$content_list.="".$msg["id"].",\"".get_kh_xh($msg)."\",\"".$msg["no"].$str_c_num."\",".deel_num(get_price_dp($uid,$msg["id"])).",\"".$pic."\",\"".str_replace("\"","'",out_good_pic_set($pic,$w2,$h2))."\",".$n1.",\"".$c."\",\"".$msg_pj."\",\"".$text_main."\","; // $rnum++; $ck=out_good_pic_set_arr($pic,$w2,$h2); $data_str.="{\"id\":".$msg["id"].",\"xh\":\"".get_kh_xh($msg)."\",\"kh\":\"".$msg["no"]."\",\"ksm\":\"".$msg["title"]."\",\"is_read\":\"".$is_read."\",\"pic\":\"".$pic."\",\"color\":\"nocolor\",\"color_title\":\"\",\"pic_w\":\"".$ck[0]."\",\"pic_h\":\"".$ck[1]."\",\"ydjs\":".$n1.",\"unit_title\":\"".$msg["unit_title"]."\",".$str_sys."\"ka_color\":\"".$c."\",\"price\":".deel_num(get_price_dp($uid,$msg["id"])).",\"xj\":\"".$pj_race."\",\"pj_remark\":\"".$pj_remark."\"".$tmpzd."},"; } } $content_list.="]"; } $json_data.=substr($data_str,0,-1)."],"; //---------------款号数据 //传递参数:s_brand|选项,s_xj|星级,s_is_order|已订,s_is_ka|删除款 //每次加载条数 $page_size=12; //总计条数 $json_data.="\"total_num\":".$total_num.","; //已经加载条数 //$json_data.="\"show_num\":12,"; $total_page=ceil($total_num/$limit); $json_data.="\"total_page\":".$total_page.","; $json_data.="\"page\":".$page.","; //已经加载条数 //$json_data.="\"show_num\":12,"; //单独下拉字段 $select_dz=""; $arrdd=array(); for($i=0;$iquery("select no,title from ".$table_pre."keyword where cate='".$sys_dk_search_cate_single[$i]."' order by no"); while($m1=$db->fetch_array($r1)){ $tmp.="{\"no\":\"".$m1["no"]."\",\"title\":\"".$m1["title"]."\"},"; } $tmp=deel_end($tmp); $var="s_".$sys_dk_search_cate_single[$i]; $arrdd[]=$var; $select_dz.="{\"no\":\"".$sys_dk_search_cate_single[$i]."\",\"title\":\"".get_cate_title_no("arr_select",$sys_dk_search_cate_single[$i])."\",\"value\":\"".$$var."\",\"op\":[".$tmp."]},"; } $select_dz=deel_end($select_dz); $json_data.="\"select_single\":[".$select_dz."],"; //更多条件下拉字段 $select_dz=""; for($i=0;$iquery("select no,title from ".$table_pre."keyword where cate='".$sys_dk_search_cate[$i]."' order by no"); while($m1=$db->fetch_array($r1)){ $tmp.="{\"no\":\"".$m1["no"]."\",\"title\":\"".$m1["title"]."\"},"; } $tmp=deel_end($tmp); $select_dz.="{\"no\":\"".$sys_dk_search_cate[$i]."\",\"title\":\"颜色\",\"value\":\"".$$var."\",\"op\":[".$tmp."]},"; }elseif(substr($sys_dk_search_cate[$i],0,6)=="color_"){ $tmp_key=str_replace("color_","",$sys_dk_search_cate[$i]); $tmp=""; $r1=$db->query("select no,title from ".$table_pre."keyword where cate='".$tmp_key."' order by no"); while($m1=$db->fetch_array($r1)){ $tmp.="{\"no\":\"".$m1["no"]."\",\"title\":\"".$m1["title"]."\"},"; } $tmp=deel_end($tmp); $select_dz.="{\"no\":\"".$sys_dk_search_cate[$i]."\",\"title\":\"".get_main_value($sys_color_zd,$tmp_key)."\",\"value\":\"".$$var."\",\"op\":[".$tmp."]},"; }else{ $tmp=""; $r1=$db->query("select no,title from ".$table_pre."keyword where cate='".$sys_dk_search_cate[$i]."' order by no"); while($m1=$db->fetch_array($r1)){ $tmp.="{\"no\":\"".$m1["no"]."\",\"title\":\"".$m1["title"]."\"},"; } $tmp=deel_end($tmp); $select_dz.="{\"no\":\"".$sys_dk_search_cate[$i]."\",\"title\":\"".get_cate_title_no("arr_select",$sys_dk_search_cate[$i])."\",\"value\":\"".$$var."\",\"op\":[".$tmp."]},"; } } } //$json_data.="\"select_more\":["; // //$json_data.="{\"no\":\"category\",\"title\":\"大类\",\"value\":\"1,2\",\"op\":[{\"no\":\"1\",\"title\":\"上装\"},{\"no\":\"2\",\"title\":\"下装\"},{\"no\":\"3\",\"title\":\"饰品\"}]},"; //$json_data.="{\"no\":\"bc\",\"title\":\"波段\",\"value\":\"11\",\"op\":[{\"no\":\"11\",\"title\":\"第一波\"},{\"no\":\"12\",\"title\":\"第二波\"}]},"; //星级筛选 $select_dz.="{\"no\":\"xj\",\"title\":\"星级\",\"value\":\"".$s_xj."\",\"op\":[{\"no\":\"1\",\"title\":\"1星\"},{\"no\":\"2\",\"title\":\"2星\"},{\"no\":\"3\",\"title\":\"3星\"},{\"no\":\"4\",\"title\":\"4星\"},{\"no\":\"5\",\"title\":\"5星\"},{\"no\":\"y\",\"title\":\"已评\"},{\"no\":\"n\",\"title\":\"未评\"}]},"; //已订,未订 $select_dz.="{\"no\":\"is_ordered\",\"title\":\"已订未订\",\"value\":\"".$s_is_ordered."\",\"op\":[{\"no\":\"y\",\"title\":\"已订\"},{\"no\":\"n\",\"title\":\"未订\"}]},"; //已订,未订 $select_dz.="{\"no\":\"is_read\",\"title\":\"已看未看\",\"value\":\"".$s_is_read."\",\"op\":[{\"no\":\"n\",\"title\":\"未看\"}]},"; //是否删除款 $select_dz.="{\"no\":\"ka\",\"title\":\"是否删除款\",\"value\":\"".$s_ka."\",\"op\":[{\"no\":\"n\",\"title\":\"非删除款\"},{\"no\":\"y\",\"title\":\"仅删除款\"}]},"; // $select_dz=deel_end($select_dz); $json_data.="\"select_more\":[".$select_dz."],"; $json_data.="\"s_keyword\":\"".$s_keyword."\","; $json_data.="\"last_path\":\"".$last_path."\","; break; } }else if($msg_login["face"]=="2"){ $key_bhdp="备货"; $partten="/".$key_bhdp."/i"; $arr_upath=explode(",",$msg_login["charge_path"]); switch($_a){ case "get_wcl": //获取完成率和已订件数,传递参数khid //完成率 //已订金额和件数 /*$tmp=get_db_msg("select sum(je) 'je',sum(jsje) 'jsje',sum(num) 'num' from ".$table_pre."order where ka<>'y'".$con_spk." and uid='".$uid."' and _key='".$_key."' "); $ydje=$tmp["je"]; $ydjsje=$tmp["jsje"]; $ydjs=$tmp["num"]; if($is_brand=="y"){ $tmp=get_db_msg("select sum(zb) 'zb',sum(zb_js) 'zb_js' from ".$table_pre."client_brand where cid='".$uid."'"); $zb1=$tmp["zb"]*10000; $zb=deel_num($tmp["zb"]); $zb_js=$tmp["zb_js"]; }else{ $zb1=$msg_login["zb"]*10000; $zb=deel_num($msg_login["zb"]); $zb_js=$msg_login["zb_js"]; } $wcl=deel_bfb1($ydje,$zb1,1); $wcl_js=deel_bfb1($ydjs,$zb_js,1);*/ if($khid){ //$tmp=get_db_msg("select sum(num) 'num' from ".$table_pre."order where uid='".$uid."' and iid='".$khid."' and ka<>'y' and _key='".$_key."'"); $tmp=get_db_msg("select sum(num) 'num' from ".$table_pre."order where ka<>'y' and _key='".$_key."' and iid='".$khid."' ".get_qj_ucon_all_dpid($msg_login["charge_uid"],"").""); $k_ydjs=$tmp["num"]; //取得上次订货会数量 $str_sys=""; if($sys_flag_count>1){ $tmp_sys=get_db_msg("select sum(".get_size_sql("sum").") 'num' from ".$table_pre."order where _key<>'".$_key."' and iid='".$khid."' ".get_qj_ucon_all_dpid($msg_login["charge_uid"],"").""); $tmp_kh=get_db_msg("select * from ".$table_pre."kh where id='".$khid."'"); if($tmp_sys["num"]){ $str_sys="\"scjs\":".$tmp_sys["num"].",\"hjjs\":".($tmp_sys["num"]+$n1).","; } $str_sys.="\"lssj\":\"y\",\"unit_title\":\"".$tmp_kh["unit_title"]."\","; } }else{ $k_ydjs=0; } //该款已订件数 //$zb_client_show=get_set("zb_client_show"); $json_data.="\"ydjs\":\"".$k_ydjs."\",".$str_sys; //$json_data.="\"zb_client_show\":\"".$zb_client_show."\","; //订货信息 //$json_data.="\"order_num\":\"".$ydjs."\",\"order_je\":\"".$ydje."\",\"order_jsje\":\"".$ydjsje."\","; //指标信息 //$json_data.="\"zb_je\":\"".$zb."\",\"wcl_je\":\"".$wcl."\",\"zb_js\":\"".$zb_js."\",\"wcl_js\":\"".$wcl_js."\","; break; case "update_jpty": $q="update ".$table_pre."client set jpty='".$jpty."' where id='".$uid."'"; $db->query($q); $json_data.="\"code\":101,"; break; case "save": $errmsg=""; $id=$khid; $is_ggk=is_ggk($id); //保存订单 $msg=get_db_msg("select * from ".$table_pre."kh where id='".$id."'"); $is_xd_clothes="y"; if($sys_ver_hy=="xz"){ $msg_size_group=get_db_msg("select title from ".$table_pre."keyword where cate='size' and id='".$msg["size_group"]."'"); if(in_array($msg_size_group["title"],$sys_size_group_xz)) $is_xd_clothes="n"; } $arr_color=explode(",",$msg["color"]); $arr_color_ka=explode(",",$msg["color_ka"]); if($order_close=="y"){ //alert_and_back("订单保存失败,原因是系统订单已经关闭!"); $errmsg="订单保存失败,原因是系统订单已经关闭!"; } if($errmsg){ $json_data.="\"code\":0,\"msg\":\"".$errmsg."\","; }else{ $msg_client=""; if($msg["size_group"]==$bx_sizegroup_id){ $tmp=get_db_msg("select * from ".$table_pre."size_bx where no='".$msg["no"]."' and bx='".$bx."'"); $arr_size=explode(",",$tmp["size"]); }else{ $arr_size=explode(",",$msg["size"]); } //取得选项 $arr_select_no=array(); $q1="select no from ".$table_pre."keyword where cate='arr_select' and flag_ka='y' and no<>'jgd' and no<>'sx' and no<>'zd1' and no<>'zd2' and no<>'zd3' order by ord"; $r1=$db->query($q1); while($m1=$db->fetch_array($r1)){ $arr_select_no[]=$m1["no"]; } if($sys_ver_hy!="xz"){ //取得店铺等级 $arr_dpdj=array(); $arr_dpdj_dp=array(); $arr_all_dp=array(); $tmpdpdj="{\"dj\":\"_ALL_\",\"title\":\"所有店铺\"},"; $j=0; for($i=0;$i $arr_dp1){ if($s_dpdj=="_ALL_"){ $arr_dp=$arr_all_dp; }else{ if($dj1==$s_dpdj){ $arr_dp=$arr_dp1; } } } for($i=0;$i"; $m=get_db_msg($q); if($m["face"]=="4"){ // $is_save="y"; if($msg_login["qyjl_order"]=="b" && !preg_match($partten,$m["title"])) $is_save="n"; if($is_brand=="y"){ //启用多品牌 $check1=get_db_msg("select id,is_jd,is_checked from ".$table_pre."client_brand where cid='".$m["id"]."' and brand='".$msg["brand"]."'"); if($check1["is_jd"]=="y"){ $is_save="n"; } if($check1["is_checked"]=="y"){ $is_save="n"; } if($check1["id"]>0){ //有权限 }else{ $is_save="n"; } }else{ if($m["is_jd"]=="y"){ $is_save="n"; } if($m["is_checked"]=="y"){ $is_save="n"; } } if($is_save=="y"){ // $sql_size1=$sql_size2=$sql_size3=""; $c=0; $flag="n"; $cypm=""; $errm=""; for($k=0;$k$order_large_num && !$errmsg){ $flag="y"; $msg_client.=$m["title"]."的订量(".$$v.")超过了单尺码最大订量限制(".$order_large_num."),无法保存,请检查!|"; } $tmp1=get_db_msg("select * from ".$table_pre."size where iid='".$msg["size_group"]."' and no='".$arr_size[$k]."'"); $errm.=check_dhgz_dhbs($msg["no"],$bx,$tmp1["title"],$$v); $cypm.=deel_num($$v).":"; } if($is_ggk!="n") $errm.=check_dhgz_bdgg_qj($msg["no"],$color,$bx,$c,$m); $tmpexp_bx=get_db_msg("select sum(num) num from ".$table_pre."order where uid='".$tmp_uid."' and iid='".$msg["id"]."' and color='".$color."' and bx<>'".$bx."' and _key='".$_key."'"); $numex_bx=$tmpexp_bx["num"]+$c; //到色 if($numex_bx){ $errm.=check_dhgz_bdks_qj($msg,$color,$numex_bx,$m); $errm.=check_dhgz_qdl_qj($msg,$color,$numex_bx,$m); } $tmpexp_color=get_db_msg("select sum(num) num from ".$table_pre."order where uid='".$tmp_uid."' and iid='".$msg["id"]."' and color<>'".$color."' and bx<>'".$bx."' and _key='".$_key."'"); $numex_color=$tmpexp_color["num"]+$c; //到款 if($numex_color){ $errm.=check_dhgz_bdk_qj($msg,$numex_color,$m); $errm.=check_dhgz_qdl_qj($msg,"",$numex_color,$m); $errm.=check_dhgz_glk_qj($msg["no"],$numex_color,$m); } if($errm){ $flag="y"; $msg_client.=$m["title"].":".$errm."|"; } if($c>0 ){ $cypm=substr($cypm,0,-1); $tmpcypm=get_db_msg("select * from ".$table_pre."pm_count where uid='".$uid."' and gz='".$cypm."'"); $cyomnum=0; if($tmpcypm["id"]){ $cyomnum=$tmpcypm["num"]+1; $q="update ".$table_pre."pm_count set num=".$cyomnum.",add_date='".time()."' where id='".$tmpcypm["id"]."'"; }else{ $cyomnum++; $q="insert into ".$table_pre."pm_count (uid,gz,num,add_date) values ('".$uid."','".$cypm."',".$cyomnum.",'".time()."')"; } $db->query($q); } $client_dj=trim($m["dj"]); $con_dj=$client_dj?" and (dj='".$client_dj."' or dj='')":" and dj=''"; $qdl=get_db_msg("select num from ".$table_pre."gz where cate='qdl' and kh='".$msg["no"]."' and color='".$color."'".$con_dj); if($c<$qdl["num"] && $c) { //alert_and_back($m["title"]."单店订量必须大于起订量:".$qdl["num"]."件!"); $msg_client.=$m["title"]."单店订量必须大于起订量:".$qdl["num"]."件!|"; $flag="y"; } if($flag=="n"){ $check=get_db_msg("select * from ".$table_pre."order where uid='".$tmp_uid."' and iid='".$msg["id"]."' and color='".$color."' and bx='".$bx."' and _key='".$_key."'"); if($check["id"]){ if($c>0){ $q="update ".$table_pre."order set size_group_id='".$msg["size_group"]."',".$sql_size1."add_date='".time()."' where id='".$check["id"]."'"; $json_data.="\"q\":\"".$q."\","; $db->query($q); update_order_log($tmp_uid,"update ".$table_pre."order set size_group_id='".$msg["size_group"]."',".$sql_size1."add_date='".time()."' where uid='".$tmp_uid."' and iid='".$msg["id"]."' and color='".$color."' and bx='".$bx."' and _key='".$_key."'"); cache_order($m["id"],$msg["id"],$color,$bx); }else{ $q="delete from ".$table_pre."order where id='".$check["id"]."'"; $json_data.="\"q\":\"".$q."\","; $db->query($q); update_order_log($tmp_uid,"delete from ".$table_pre."order where uid='".$tmp_uid."' and iid='".$msg["id"]."' and color='".$color."' and bx='".$bx."' and _key='".$_key."'"); } }else{ if($c>0){ //取得选项 $sql1=$sql2=""; for($i1=0;$i1query($q); update_order_log($m["id"],"insert into ".$table_pre."order (uid,upath,iid,no,".$sql1."jgd,color,bx,is_sp,size_group_id".$sql_size3.",_key,sx,add_date) values ('".$m["id"]."','".($m["path"]."-".$m["id"])."','".$msg["id"]."','".$msg["no"]."',".$sql2."'".get_jgd($msg["price"])."','".$color."','".$bx."','".$msg["is_sp"]."','".$msg["size_group"]."'".$sql_size2.",'".$_key."','".get_sx($color)."','".time()."')"); cache_order($m["id"],$msg["id"],$color,$bx); } } set_order_total($m["id"]); count_ph($m["id"],$msg["id"],$color); } } } } }else{ if(substr($str_sub,strlen($str_sub)-1,1)==",") $str_sub=substr($str_sub,0,-1); $arr_str_sub=explode(",",$str_sub); $msg=get_db_msg("select * from ".$table_pre."kh where id='".$id."'"); $arr_color=explode(",",$msg["color"]); $arr_size=explode(",",$msg["size"]); $arr_color_ka=explode(",",$msg["color_ka"]); $flag=array(); $client_errmsg=array(); $arr_cl=array(); //检测配码 $arr_pm_id=array(); for($i1=0;$i1"; } $tmp_num=count_pm_num($arr_tmp[1])*$arr_tmp[2]; //到颜色的数量 $v1="color_num_".$arr_tmp1[0]; $$v1+=$tmp_num; //到颜色版型的数量 $v2="color_bx_num_".$arr_tmp1[0]."_".$arr_tmp1[1]; $$v2+=$tmp_num; $tmp_total_num+=$tmp_num; } foreach($arr_cl as $t => $n){ if(!in_array($color,$arr_color_ka)){ $c=0; for($k=0;$k'".$bx."' and _key='".$_key."'"); $numex_bx=$tmpexp_bx["num"]+$c; //到色 if($numex_bx){ $client_errmsg[$n].=check_dhgz_bdks_qj($msg,$color,$numex_bx,$tmp_client); $client_errmsg[$n].=check_dhgz_qdl_qj($msg,$color,$numex_bx,$tmp_client); } $tmpexp_color=get_db_msg("select sum(num) num from ".$table_pre."order where uid='".$n."' and iid='".$msg["id"]."' and color<>'".$color."' and bx<>'".$bx."' and _key='".$_key."'"); $numex_color=$tmpexp_color["num"]+$c; //到款 if($tmpexp_color){ $client_errmsg[$n].=check_dhgz_bdk_qj($msg,$numex_color,$tmp_client); $client_errmsg[$n].=check_dhgz_qdl_qj($msg,"",$numex_color,$tmp_client); $client_errmsg[$n].=check_dhgz_glk_qj($msg["no"],$numex_color,$tmp_client); } if($client_errmsg[$n]){ $flag[$n]="y"; } } } //print_r($arr_cl); //print_r($client_errmsg); $h=1; $arr_uid=array(); //print_r($arr_str_sub); for($i1=0;$i10){ //有权限 }else{ $is_save="n"; } }else{ if($tmp_client["is_jd"]=="y"){ $is_save="n"; } if($tmp_client["is_checked"]=="y"){ $is_save="n"; } } //echo $tmp_client["title"]."-".$is_save."|"; if($is_save=="y"){ $tmp_uid=$arr_tmp[0]; $qy_uid=get_qy_id($tmp_client["path"]); $arr_gz=explode(":",$arr_tmp[1]); $num=count_pm_num($arr_tmp[1]); if($flag[$arr_tmp[0]]!="y"){ if($num>0){ //取得配码id $m_pm=get_db_msg("select id from ".$table_pre."size_pm where uid='".$tmp_client["id"]."' and khid='".$msg["id"]."' and gz='".$arr_tmp[1]."'"); //echo "select id from ".$table_pre."size_pm where uid='".$tmp_client["id"]."' and khid='".$msg["id"]."' and gz='".$arr_tmp[1]."';"; if($m_pm["id"]>0){ $pmid1=$m_pm["id"]; }else{ $tmp=get_db_msg("select title from ".$table_pre."size_pm where gz='".$arr_tmp[1]."' and (uid='".$uid."' or uid='')"); if($tmp["title"]) $pm_title=$tmp["title"]; else $pm_title="临时".get_rand_num(4); $q="insert into ".$table_pre."size_pm (qyid,uid,size_group_id,pm_dj,khid,title,gz,num) values ('".$qy_uid."','".$tmp_client["id"]."','".$msg["size_group"]."','临时配码','".$msg["id"]."','".$pm_title."','".$arr_tmp[1]."','".$num."')"; $db->query($q); $pmid1=$db->insert_id(); } $arr_pm_id[$i1]=$pmid1; }else{ //$msg_client.=$tmp_client["title"]."请输入尺码!|"; $arr_pm_id[$i1]="无"; //alert_and_back("请输入尺码!"); } $tmp_upath=$arr_tmp["path"]."-".$arr_tmp["id"]; if(!in_array($color,$arr_color_ka)){ $sql_size1=$sql_size2=$sql_size3=""; $c=0; for($k=0;$k0){ $q="update ".$table_pre."order set size_group_id='".$msg["size_group"]."',".$sql_size1."add_date='".time()."' where id='".$check["id"]."'"; $db->query($q); cache_order($tmp_uid,$id,$color,$bx); }else{ $q="delete from ".$table_pre."order where id='".$check["id"]."'"; $db->query($q); } }else{ if($c>0){ $sql1=$sql2=""; for($i11=0;$i11query($q); cache_order($tmp_uid,$id,$color,$bx); } } count_ph($tmp_uid,$id,$color); set_order_total($tmp_uid); } }else{ $msg_client.=$tmp_client["title"].":".$client_errmsg[$arr_tmp[0]]."|"; } //$db->query("delete from ".$table_pre."order_pm where uid='".$tmp_uid."' and iid='".$id."' and color='".$color."' and bx='".$bx."'"); } } $h++; } } //$json_data.="\"strq\":\"".$strq."\","; if($sys_ver_hy=="xz"){ foreach($arr_uid as $k => $v){ $db->query("delete from ".$table_pre."order_pm where uid='".$v."' and iid='".$id."' and color='".$color."' and bx='".$bx."'"); } //保存配码信息 for($i1=0;$i1query($q); } } } } $json_data.="\"code\":101,"; if($msg_client){ $msg_client=substr($msg_client,0,-1); $json_data.="\"msg\":\"".$msg_client."\","; }else{ //$json_data.="\"errmsg\":\"\","; } } /*if($is_window=="n"){ if($go_url){ url_redirect($go_url); }else{ echo ""; } }else{ if($go_url){ $url=$go_url; }else{ $url=$rurl?$rurl:$_SERVER["PHP_SELF"]; } url_redirect($url); }*/ break; case "save_pm": $errmsg=check_pm_gz($pm_gz); if($errmsg){ $json_data.="\"code\":0,\"msg\":\"".$errmsg."\","; }else{ $title=trim($pm_title); //$check=get_db_msg("select * from ".$table_pre."size_pm where uid='".$uid."' and size_group_id='".$size_group_id."'"); if($khid){ $check=get_db_msg("select * from ".$table_pre."size_pm where uid='".$uid."' and khid='".$khid."' and size_group_id='".$size_group_id."' and title='".$title."'"); }else{ $check=get_db_msg("select * from ".$table_pre."size_pm where uid='".$uid."' and size_group_id='".$size_group_id."' and title='".$title."'"); } $gz=deel_pm_gz($pm_gz); $qy_uid=get_qy_id($msg_login["path"]); $num=count_pm_num($gz); if($check["id"]>0){ if($khid){ $q="update ".$table_pre."size_pm set title='".$title."',gz='".$gz."' where id='".$check["id"]."' and khid='".$khid."'"; }else{ $q="update ".$table_pre."size_pm set title='".$title."',gz='".$gz."' where id='".$check["id"]."'"; } }else{ if($khid){ $q="insert into ".$table_pre."size_pm (qyid,uid,khid,size_group_id,title,gz,num) values ('".$qy_uid."','".$uid."','".$khid."','".$size_group_id."','".$title."','".$gz."','".$num."')"; }else{ $q="insert into ".$table_pre."size_pm (qyid,uid,size_group_id,title,gz) values ('".$qy_uid."','".$uid."','".$size_group_id."','".$title."','".$gz."')"; } } $db->query($q); $json_data.="\"code\":101,"; } //echo "success"; //exit; break; case "del_pm": $title=trim($pm_title); if($khid){ $q="delete from ".$table_pre."size_pm where uid='".$uid."' and khid='".$khid."' and size_group_id='".$size_group_id." and title='".$title."''"; }else{ $q="delete from ".$table_pre."size_pm where uid='".$uid."' and size_group_id='".$size_group_id."' and title='".$title."'"; } $db->query($q); $json_data.="\"code\":101,"; //echo "success"; //exit; break; case "del": $errmsg=""; $id=$khid; //删除订单 if($order_close=="y"){ //alert_and_back("删除订单失败,原因是系统订单已经关闭!"); $errmsg="删除订单失败,原因是系统订单已经关闭!"; } $msg=get_db_msg("select * from ".$table_pre."kh where id='".$id."'"); $is_xd_clothes="y"; if($sys_ver_hy=="xz"){ $msg_size_group=get_db_msg("select title from ".$table_pre."keyword where cate='size' and id='".$msg["size_group"]."'"); if(in_array($msg_size_group["title"],$sys_size_group_xz)) $is_xd_clothes="n"; } //取得店铺等级 $arr_dpdj=array(); $arr_dpdj_dp=array(); $arr_all_dp=array(); $tmpdpdj="{\"dj\":\"_ALL_\",\"title\":\"所有店铺\"},"; $j=0; for($i=0;$i $arr_dp1){ if($s_dpdj=="_ALL_"){ $arr_dp=$arr_all_dp; }else{ if($dj1==$s_dpdj){ $arr_dp=$arr_dp1; } } } for($i=0;$i"; $m=get_db_msg($q); if($m["face"]=="4"){ $is_save="y"; if($msg_login["qyjl_order"]=="b" && !preg_match($partten,$m["title"])) $is_save="n"; if($is_brand=="y"){ //启用多品牌 $check1=get_db_msg("select id,is_jd,is_checked from ".$table_pre."client_brand where cid='".$m["id"]."' and brand='".$msg["brand"]."'"); if($check1["is_jd"]=="y"){ $is_save="n"; } if($check1["is_checked"]=="y"){ $is_save="n"; } if($check1["id"]>0){ //有权限 }else{ $is_save="n"; } }else{ if($m["is_jd"]=="y"){ $is_save="n"; } if($m["is_checked"]=="y"){ $is_save="n"; } } if($is_save=="y"){ $q="delete from ".$table_pre."order where uid='".$m["id"]."' and iid='".$id."' and color='".$color."' and bx='".$bx."' and _key='".$_key."'"; $db->query($q); //删除订单配码表 //判断是否采用服装版本下单 if($is_xd_clothes=="n"){ $db->query("delete from ".$table_pre."order_pm where _key='".$_key."' and uid='".$m["id"]."' and iid='".$id."' and color='".$color."' and bx='".$bx."'"); } update_order_log($m["id"],"delete from ".$table_pre."order where uid='".$m["id"]."' and iid='".$id."' and color='".$color."' and bx='".$bx."' and _key='".$_key."'"); set_order_total($m["id"]); } } } $json_data.="\"code\":101,"; // /*if($is_window=="n"){ if($go_url){ url_redirect($go_url); }else{ echo ""; } }else{ if($go_url){ $url=$go_url; }else{ $url=$rurl?$rurl:$_SERVER[PHP_SELF]; } url_redirect($url); }*/ //echo ""; break; case "single": $json_data.="\"sys_ck_input\":\"".$sys_ck_input."\","; $is_pm=get_set("is_pm"); $json_data.="\"is_pm\":\"".$is_pm."\","; $json_data.="\"khid\":\"".$khid."\","; $json_data.="\"color\":\"".$color."\","; $json_data.="\"colort\":\"".get_cate_title_no("color",$color)."\","; $tmpggt=get_db_msg("select title from ".$table_pre."kh_gg_title where id='".$bx."'"); $json_data.="\"bx\":\"".$bx."\","; $json_data.="\"qjqx\":\"".$msg_login["qyjl_order"]."\","; $id=$khid; // $msg=get_db_msg("select * from ".$table_pre."kh where id='".$id."'"); if($bx_sizegroup_id>0 && $bx_sizegroup_id==$msg["size_group"]){ $json_data.="\"bxt\":\"".$bx."\","; }else{ $json_data.="\"bxt\":\"".$tmpggt["title"]."\","; } //判断是否采用服装版本下单 $is_xd_clothes="y"; if($sys_ver_hy=="xz"){ $msg_size_group=get_db_msg("select title from ".$table_pre."keyword where cate='size' and id='".$msg["size_group"]."'"); if(in_array($msg_size_group["title"],$sys_size_group_xz)) $is_xd_clothes="n"; } $json_data.="\"is_xd_clothes\":\"".$is_xd_clothes."\","; // if($xh_ms=="2"){ //序号到色 $msg_kh_xh=get_db_msg("select xh from ".$table_pre."kh_xh where kh='".$msg["no"]."' and color='".$color."' limit 0,1"); $_xh=$msg_kh_xh["xh"]; }else{ //序号查询定制 $_xh=$msg["xh"]; } $err_msg=""; // if(!$msg["id"]) $err_msg="记录不存在"; if($err_msg){ $json_data.="\"error\":\"".$err_msg."\","; }else{ $json_data.="\"code\":100,"; if($order_close=="y") $msg_tip="对不起,暂时关闭订单功能!"; $is_ggk=is_ggk($msg["id"]); $json_data.="\"is_ggk\":\"".$is_ggk."\","; //是否为删除色 $arr_color=explode(",",$msg["color"]); $arr_color_ka=explode(",",$msg["color_ka"]); $is_ka="n"; for($i=0;$i $size1){ $m1=get_db_msg("select id,price from ".$table_pre."size_bx where no='".$msg["no"]."' and bx='".$bx1."'"); if($m1["id"]>0){ $price_zk=get_price_zk($uid,$msg["id"],'',$bx1); $str_price.=$bx1.": ".$m1["price"]."元"; if($price_zk!=$m1["price"]) $str_price.=" / 结算价:".$price_zk."元"; $str_price.="
"; } } }else{ $dp_price=get_price_dp($uid,$msg["id"]); $str_price=deel_num($dp_price)."元"; $price_zk=get_price_zk($uid,$msg["id"]); if($price_zk!=$dp_price){ $str_price.=" / 结算价:".deel_num($price_zk)."元"; } //买断价 $tmp=get_db_msg("select id,price from ".$table_pre."kh_md where (dj='".$msg_login["dj"]."' or dj='') and kh='".$msg["no"]."' limit 0,1"); if($tmp["id"]>0){ $price_md=$tmp["price"]>0?$tmp["price"]:$price_zk; $str_price.=" / ".d_translate("md")."价:".deel_num($price_md)."元"; } } $json_data.="\"price\":\"".$str_price."\","; //$json_data.="\"price\":\"".$msg["price"]."\","; $json_data.="\"is_ka\":\"".$is_ka."\","; //-------------------设置禁止提交表单 if($order_close=="y" || $is_ka=="y"){ $disable=" disabled"; }else{ $disable=""; } $json_data.="\"disable\":\"".$disable."\","; //取得评级 $msg_pj=get_db_msg("select * from ".$table_pre."client_pj where khid='".$id."' and cid='".$uid."'"); if($msg_pj["id"]>0){ $pj_remark=dhtmlchars($msg_pj["remark"]); $race=$msg_pj["race"]; }else{ $pj_remark=""; $race=0; } $q="select * from ".$table_pre."keyword where cate='arr_select' and flag_ka='y' and flag_bd='n' and no<>'jgd' and no<>'sx' and no<>'color' order by ord"; $r=$db->query($q); $i=0; $zds=""; while($m=$db->fetch_array($r)){ $str_select_dz.="\"".$m["title"]."|"; if($m["no"]=="zd1" || $m["no"]=="zd2" || $m["no"]=="zd3"){ //$str_select_dz.=$msg[$m["no"]]."\","; //$zds.="{\"no\":\"".$m1["no"]."\",\"title\":\"".$m1["title"]."\"},"; }else{ //$str_select_dz.=deel_js_var(get_cate_title_no($m["no"],$msg[$m["no"]]))."\","; $zds.="{\"no\":\"".$i."\",\"title\":\"".get_cate_title_no("arr_select",$m["no"])."\",\"value\":\"".get_cate_title_no($m["no"],$msg[$m["no"]])."\"},"; } $i++; } $zds=deel_end($zds); $json_data.="\"zds\":[".$zds."],"; $json_data.="\"xj\":\"".$race."\","; $json_data.="\"dkremark\":\"".htmlspecialchars($msg["remark"])."\","; $json_data.="\"ksm\":\"".$msg["title"]."\","; $json_data.="\"pjwz\":\"".$pj_remark."\","; $json_data.="\"size_group_id\":\"".$msg["size_group"]."\","; $pj_icon=get_pj_icon($race,$id,'big'); //-------------------设置提示信息 if($msg["size_group"]==$bx_sizegroup_id){ $arrBx=array(); $tmp=get_db_msg("select * from ".$table_pre."size_bx where no='".$msg["no"]."' and bx='".$bx."'"); $arr_size=explode(",",$tmp["size"]); }else{ $arr_size=explode(",",$msg["size"]); } $total=0; $js_check_str=""; $str_color=""; //取得数量 $input_width=get_input_width(count($arr_size)); $json_data.="\"input_width\":\"".$input_width."\","; $arr_tr=array(); $ind=11; $xxhj=0; $arr_ct=$arr_ct1=""; //取得店铺等级 $arr_dpdj=array(); $arr_dpdj_dp=array(); $arr_all_dp=array(); $tmpdpdj="{\"dj\":\"_ALL_\",\"title\":\"所有店铺\"},"; $j=0; for($i=0;$i $arr_dp1){ if($s_dpdj=="_ALL_"){ $arr_dp=$arr_all_dp; }else{ if($dj1==$s_dpdj){ $arr_dp=$arr_dp1; } } } for($i=0;$i"; $m=get_db_msg($q); if($m["face"]=="4"){ $bh="n"; //如果是备货账号,把备货店铺放到第一行 if($msg_login["qyjl_order"]=="b" && preg_match($partten,$m["title"])){ $ind2=1; $bh="y"; }else{ if($msg_login["qyjl_order"]=="b") $disable_color=" disabled"; $ind2=0; $ind++; } $ind1=($ind2>0)?$ind2:$ind; //判断是否有订货权限,是否交单 $msg_tip=""; if($is_brand=="y"){ //启用多品牌 $check1=get_db_msg("select id,is_jd,is_checked from ".$table_pre."client_brand where cid='".$m["id"]."' and brand='".$msg["brand"]."'"); if($check1["is_jd"]=="y"){ $disable_color=" disabled"; $msg_tip="已交单"; } if($check1["is_checked"]=="y"){ $disable_color=" disabled"; $msg_tip="已确认"; } if($check1["id"]>0){ //有权限 }else{ //无权订货 $disable_color=" disabled"; $sty1=""; $link_ds="无订货权限"; } }else{ if($m["is_jd"]=="y"){ $disable_color=" disabled"; $msg_tip="已交单"; } if($m["is_checked"]=="y"){ $disable_color=" disabled"; $msg_tip="已确认"; } } if($is_xd_clothes=="y"){ $str_color.=$m["id"].","; //起订量 $client_dj=trim($m["dj"]); $con_dj=$client_dj?" and (dj='".$client_dj."' or dj='')":" and dj=''"; $qdl=get_db_msg("select num from ".$table_pre."gz where cate='qdl' and kh='".$msg["no"]."' and color='".$color."'".$con_dj); if($qdl["num"]>0) $str_qdl="起订量".$qdl["num"]."件"; else $str_qdl=""; $arr_tr[$ind1]="
"; if($is_pm=="y") $arr_tr[$ind1].=""; $m1=get_db_msg("select * from ".$table_pre."order where uid='".$tmp_uid."' and iid='".$msg["id"]."' and color='".$color."' and bx='".$bx."' and _key='".$_key."'"); $s_xj=0; if($bh=="y"){ $arr_ct1.="{\"id\":\"".$m["id"]."\",\"kh\":\"".$msg["no"]."\",\"color\":\"".$color."\",\"bx\":\"".$bx."\",\"title\":\"".$m["title"]."\",\"username\":\"".$m["username"]."\",\"uid\":\"".$tmp_uid."\",\"msg_tip\":\"".$msg_tip."\",\"str_qdl\":\"".$str_qdl."\",\"link_ds\":\"".$link_ds."\",\"sty1\":\"".$sty1."\",\"disable_color\":\"".$disable_color."\","; }else{ $arr_ct.="{\"id\":\"".$m["id"]."\",\"kh\":\"".$msg["no"]."\",\"color\":\"".$color."\",\"bx\":\"".$bx."\",\"title\":\"".$m["title"]."\",\"username\":\"".$m["username"]."\",\"uid\":\"".$tmp_uid."\",\"msg_tip\":\"".$msg_tip."\",\"str_qdl\":\"".$str_qdl."\",\"link_ds\":\"".$link_ds."\",\"sty1\":\"".$sty1."\",\"disable_color\":\"".$disable_color."\","; } $arr_sz=""; for($k=0;$k"; $arr_sz.="{\"id\":\"num_".$m["id"]."_".$bx."_".$arr_size[$k]."\",\"value\":\"".deel_0($num1)."\",\"disable_color1\":\"".$disable_color1."\",\"bg_input_num\":\"".$bg_input_num."\",\"size\":\"".$arr_size[$k]."\"},"; //合计尺码数量 $var_xj_size="xj_size_".$arr_size[$k]; $$var_xj_size+=$num1; $j++; } }else{ //取得装箱数 $q1="select num from ".$table_pre."gz where cate='zxs' and (dj='".$msg_login["dj"]."' or dj='') and kh='".$msg["no"]."' order by num"; //echo $q1; $r1=$db->query($q1); $sql_pm=""; $str_zxs=""; while($m1=$db->fetch_array($r1)){ $sql_pm.="num='".$m1["num"]."' or "; //$str_zxs.="{\"zxs\":\"".$m1["num"]."\"},"; $str_zxs.=$m1["num"].","; } if($str_zxs){ $str_zxs=deel_end($str_zxs); } $json_data.="\"zxs\":\"".$str_zxs."\","; $tmp1=get_db_msg("select count(*) 'num' from ".$table_pre."order_pm where _key='".$sys_this_order_flag."' and uid='".$tmp_uid."' and iid='".$msg["id"]."' and color='".$color."'"); if($tmp1["num"]>0) $colspan1=$tmp1["num"]+1; else $colspan1=1; //取得该颜色的配码信息 $q1="select * from ".$table_pre."order_pm where _key='".$sys_this_order_flag."' and uid='".$tmp_uid."' and iid='".$msg["id"]."' and color='".$color."' order by id"; $r1=$db->query($q1); $j1=0; $arr_sz=""; while($m1=$db->fetch_array($r1)){ $tmp=get_db_msg("select title,gz from ".$table_pre."size_pm where id='".$m1["pmid"]."'"); $tmp_num=$m1["xs"]*count_pm_num($tmp["gz"]); //$num_arr.="[\"".$tmp_uid."|".$m_dp["title"]."\",".$j1.",\"".$tmp["title"]."|".$tmp["gz"]."\",".$m1["xs"].",\"".$is_ka."\",\"".$is_selected."\"],"; $arr_sz.="{\"xh\":\"".$j1."\",\"pmt\":\"".$tmp["title"]."\",\"pm\":\"".$tmp["gz"]."\",\"xs\":".$m1["xs"].",\"num\":".$tmp_num."},"; $total_xs+=$m1["xs"]; $total_num+=$tmp_num; $j1++; } if($j1==0){ $str_color_hang.=($j1+1).","; $j1++; //$num_arr.="[\"".$tmp_uid."|".$m_dp["title"]."\",0,\"|\",0,\"".$is_ka."\",\"".$is_selected."\"],"; }else{ $str_color_hang.=$j1.","; } if($bh=="y"){ $arr_ct1.="{\"id\":\"".$m["id"]."\",\"kh\":\"".$msg["no"]."\",\"color\":\"".$color."\",\"bx\":\"".$bx."\",\"title\":\"".$m["title"]."\",\"username\":\"".$m["username"]."\",\"uid\":\"".$tmp_uid."\",\"msg_tip\":\"".$msg_tip."\",\"str_qdl\":\"".$str_qdl."\",\"link_ds\":\"".$link_ds."\",\"sty1\":\"".$sty1."\",\"disable_color\":\"".$disable_color."\",\"count\":".$j1.","; }else{ $arr_ct.="{\"id\":\"".$m["id"]."\",\"kh\":\"".$msg["no"]."\",\"color\":\"".$color."\",\"bx\":\"".$bx."\",\"title\":\"".$m["title"]."\",\"username\":\"".$m["username"]."\",\"uid\":\"".$tmp_uid."\",\"msg_tip\":\"".$msg_tip."\",\"str_qdl\":\"".$str_qdl."\",\"link_ds\":\"".$link_ds."\",\"sty1\":\"".$sty1."\",\"disable_color\":\"".$disable_color."\",\"count\":".$j1.","; } } $arr_sz=substr($arr_sz,0,-1); if($bh=="y"){ $arr_ct1.="\"arr_size\":[".$arr_sz."],"; $arr_ct1.="\"size_count\":\"".count($arr_size)."\"},"; }else{ $arr_ct.="\"arr_size\":[".$arr_sz."],"; $arr_ct.="\"size_count\":\"".count($arr_size)."\"},"; } $total+=$s_xj; $arr_tr[$ind1].=""; } } $arr_ct=substr($arr_ct,0,-1); $json_data.="\"dds\":[".$arr_ct."],"; $arr_ct1=substr($arr_ct1,0,-1); $json_data.="\"bhs\":[".$arr_ct1."],"; if($str_color) $str_color=substr($str_color,0,-1); $json_data.="\"str_color\":\"".$str_color."\","; if($msg_login["qyjl_order"]=="b"){ //如果是备货账号,增加一行下线合计 $colspan=($is_pm=="y")?2:1; $arr_tr[2]=""; $str_hj=""; for($k=0;$k"; $str_hj.="{\"hj_num\":\"".$$var1."\"},"; } $str_hj=substr($str_hj,0,-1); $arr_tr[2].=""; $json_data.="\"size_xxhj\":[".$str_hj."],"; $json_data.="\"colspan\":\"".$colspan."\","; $json_data.="\"xxhj\":\"".$xxhj."\","; } $json_data.="\"qyjl_order\":\"".$msg_login["qyjl_order"]."\","; $json_data.="\"is_pm\":\"".$is_pm."\","; ksort($arr_tr); $str_num=""; foreach($arr_tr as $k => $str){ $str_num.=$str; } //----------------数量表 //表头 $str_size_title=$cmz=""; for($i=0;$i"; if($is_pm=="y") $content_num.=""; $str_size_t=""; for($i=0;$i".$tmp["title"].""; $str_size_t.="{\"title\":\"".$tmp["title"]."\",\"no\":\"".$arr_size[$i]."\"},"; } $str_size_t=substr($str_size_t,0,-1); $json_data.="\"arr_size\":[".$str_size_t."],"; $content_num.=""; //内容 $content_num.=$str_num; //合计 $colspan1=1; if($is_pm=="y") $colspan1++; $content_num.=""; $str_hj=""; for($i=0;$i
".$$var_xj_size."
"; $str_hj.="{\"hj_num\":\"".$$var_xj_size."\"},"; } $str_hj=substr($str_hj,0,-1); $json_data.="\"size_hj\":[".$str_hj."],"; $json_data.="\"colspan1\":\"".$colspan1."\","; $json_data.="\"total\":\"".$total."\","; $content_num.="
".$m["title"]."(".$m["username"].")".$msg_tip.$str_qdl.$link_ds."
".$s_xj."
下线合计".$xxhj."
客户配码小计
合计
".$total."
"; if($js_check_str) $js_check_str=substr($js_check_str,0,-1); $json_data.="\"js_check_str\":\"".$js_check_str."\","; //定义图片目录 $pathdir="../attachments/design/mini"; $json_data.="\"pathdir\":\"".$pathdir."\","; if($flag_pad=="_pad"){ $s_pathdir_mini="content://com.muchuang.edt/attachments/design/mini"; $s_pathdir_big="content://com.muchuang.edt/attachments/design/big"; }else{ $s_pathdir_mini="../attachments/design/mini"; $s_pathdir_big="../attachments/design/big"; } $json_data.="\"s_pathdir_mini\":\"".$s_pathdir_mini."\","; $json_data.="\"s_pathdir_big\":\"".$s_pathdir_big."\","; //--取得单款图片数组 $arr_pic=""; if($sys_close_image=="y"){ $pic_m1="images/no_pic.png"; $pic_b1="images/no_pic_big.png"; $arr_pic.="{\"color\":\"\",\"pic_m1\":\"".$pic_m1."\",\"m1_w\":\"\",\"m1_h\":\"\",\"pic_b1\":\"".$pic_b1.",\"b1_w\":\"\",\"b1_h\":\"\"},"; }else{ $pic_m1=get_kh_color_picture($msg["no"],$color,''); $pic_b1=get_kh_color_picture_big($msg["no"],$color,''); $tmpm=out_good_pic_set_arr($pic_m1,40,40); $tmpb=out_good_pic_set_arr($pic_b1,$tmpl_order_single_w,$tmpl_order_single_h); //$arr_pic.="\"".$color."|".$pic_m1."|".str_replace("\"",",",out_good_pic_set($pic_m1,40,40))."|".$pic_b1."|".str_replace("\"",",",out_good_pic_set($pic_b1,$tmpl_order_single_w,$tmpl_order_single_h))."\","; $arr_pic.="{\"color\":\"".$color."\",\"pic\":\"".$pic_m1."\",\"pic_w\":\"".$tmpm[0]."\",\"pic_h\":\"".$tmpm[1]."\",\"pic_big\":\"".$pic_b1."\",\"pic_big_w\":\"".$tmpb[0]."\",\"pic_big_h\":\"".$tmpb[1]."\"},"; } $arr_pic=substr($arr_pic,0,-1); $json_data.="\"pics\":[".$arr_pic."],"; //--取得产品细节图 $arr_detail=""; if(check_table_exist($table_pre."pic_detail")=="y"){ $q1="select * from ".$table_pre."pic_detail where kh='".$msg["no"]."' order by pic"; $r1=$db->query($q1); while($m1=$db->fetch_array($r1)){ $f=$s_pathdir_mini."/".$m1["pic"]; $f1=$s_pathdir_big."/".$m1["pic"]; $tmpwh=out_good_pic_set_arr($pathdir."/".$m1["pic"],120,120); $arr_detail.="{\"title\":\"".$m1["kh"]."\",\"no\":\"".$m1["kh"]."\",\"pic\":\"".$f."\",\"pic_big\":\"".$f1."\",\"pic_w\":\"".$tmpwh[0]."\",\"pic_h\":\"".$tmpwh[1]."\"},"; $i++; } } $arr_detail=substr($arr_detail,0,-1); $json_data.="\"xjs\":[".$arr_detail."],"; //--搭配款 $arr_cc="[]"; $arr_dp="[]"; $arr_cl="[]"; $arr_dpk="[]"; if($first_act) $js_onload=" onload=\"".$first_act."\""; $json_data.="\"js_onload\":\"".$js_onload."\","; //上一款、下一款 if($xh_ms=="2"){ $pre_xh=get_db_msg("select b.id 'id' from ".$table_pre."kh_xh a,".$table_pre."kh b where a.kh=b.no and a.xh<'".$_xh."' and a.kh<>'".$msg["no"]."' order by a.xh desc limit 0,1"); $next_xh=get_db_msg("select b.id 'id' from ".$table_pre."kh_xh a,".$table_pre."kh b where a.kh=b.no and a.xh>'".$_xh."' and a.kh<>'".$msg["no"]."' order by a.xh limit 0,1"); }else{ $pre_xh=get_db_msg("select id from ".$table_pre."kh where xh<'".$_xh."' and no<>'".$msg["no"]."' order by xh desc limit 0,1"); $next_xh=get_db_msg("select id from ".$table_pre."kh where xh>'".$_xh."' and no<>'".$msg["no"]."' order by xh limit 0,1"); } $str_sxk="[\"".$pre_xh["id"]."\",\"".$next_xh["id"]."\"]"; $json_data.="\"prev\":\"".$pre_xh["id"]."\","; $json_data.="\"next\":\"".$next_xh["id"]."\","; //取得定制选项 $select_dz=array(); $q="select * from ".$table_pre."keyword where cate='arr_select' and flag_ka='y' and flag_bd='n' and no<>'jgd' and no<>'sx' and no<>'color' order by ord"; $r=$db->query($q); $i=0; $str_select_dz=""; while($m=$db->fetch_array($r)){ $select_dz[$i][0]=$m["title"].":"; $str_select_dz.="{\"title\":\"".$m["title"]."\","; if($m["no"]=="zd1" || $m["no"]=="zd2" || $m["no"]=="zd3"){ $select_dz[$i][1]=$msg[$m["no"]]; $str_select_dz.="\"value\":\"".$msg[$m["no"]]."\"},"; }else{ $select_dz[$i][1]=get_cate_title_no($m["no"],$msg[$m["no"]]); $str_select_dz.="\"value\":\"".get_cate_title_no($m["no"],$msg[$m["no"]])."\"},"; } $i++; } $str_select_dz=substr($str_select_dz,0,-1); $json_data.="\"select_dz\":[".$str_select_dz."],"; //取得配码信息 $json_data.="\"pm_ms\":\"".$pm_ms."\","; $json_data.="\"pmkg\":\"".$pm_ms."\","; if($pm_ms!="n"){ if($msg["size_group"]==$child_sizegroup_id){ //童装配码规则,如果启用后台配码,并且有配码,只能配码输入。 $default_pm_id=0; $default_pm=""; //取得所有适合我的配码 $pm_op=""; $i=0; foreach($arr_child_bx as $bx1 => $arr_bx_size1){ $con1="bx='".$bx1."' and ((uid='0' and dlid=0 and qyid=0) or (uid='".$uid."')) and (khid='".$msg["id"]."' or khid='0')"; if($msg["pm_dj"]){ $con1.=" and pm_dj='".$msg["pm_dj"]."'"; } $str_pm1=""; $m=get_db_msg("select id,title,gz from ".$table_pre."size_pm where ".$con1." order by uid desc,size_group_id desc limit 0,1"); if($m["id"]>0) $pm_op.="{\"xh\":\"".$i."\",\"bx\":\"".$bx1."\",\"gz\":\"".$m["gz"]."\",\"title\":\"".$m["title"]."\",\"id\":\"".$m["id"]."\"},"; else $pm_op.="{\"xh\":\"".$i."\",\"bx\":\"".$bx1."\",\"gz\":\"\",\"title\":\"\",\"id\":\"\"},"; $i++; } $pm_op.=""; }else{ //默认匹配规则 $default_pm_id=0; $default_pm=""; //取得所有适合我的配码 $pm_op=""; $pm_op_value=$default_pm_id; $con1="((uid='0' and dlid=0 and qyid=0) or (uid='".$uid."')) and (khid='".$msg["id"]."' or khid='0')"; if($msg["pm_dj"]){ $con1.=" and pm_dj='".$msg["pm_dj"]."'"; } $q="select id,title,gz from ".$table_pre."size_pm where ".$con1." order by uid desc,size_group_id desc,id desc"; $r=$db->query($q); $i=0; while($m=$db->fetch_array($r)){ $pm_op.="{\"gz\":\"".$m["gz"]."\",\"title\":\"".$m["title"]."\",\"id\":\"".$m["id"]."\"},"; if($i==0){ $default_pm_id=$m["id"]; $default_pm=$m["gz"]; } $i++; } if($i==0) $pm_op.="{},"; $pm_op.=""; $str_pm_num=$str_pm_gz=""; if($default_pm){ $str_pm_gz=$default_pm; $num_pm=0; $arr1=explode(":",$default_pm); for($i=0;$i0) $str_pm_num="=".$num_pm; } $pg_gz_w=count($arr_size)*13; $content_pm=""; //取得尺码组名称 $tmp=get_db_msg("select title from ".$table_pre."keyword where id='".$msg["size_group"]."'"); $size_group_title=$tmp["title"]; $json_data.="\"size_group_title\":\"".$size_group_title."\","; $json_data.="\"pg_gz_w\":\"".$pg_gz_w."\","; $json_data.="\"str_pm_gz\":\"".$str_pm_gz."\","; $json_data.="\"str_pm_num\":\"".$str_pm_num."\","; $json_data.="\"default_pm_id\":\"".$default_pm_id."\","; $json_data.="\"default_pm\":\"".$default_pm."\","; } } $q1="select * from ".$table_pre."pm_count where uid='".$uid."' order by num desc limit 0,3"; $r1=$db->query($q1); $str_cypm=""; while($m1=$db->fetch_array($r1)){ $str_cypm.="{\"gz\":\"".$m1["gz"]."\"},"; } $str_cypm=deel_end($str_cypm); $json_data.="\"cypm\":[".$str_cypm."],"; if($sys_ver_hy=="xz" && $is_xd_clothes!="y"){ $q1="select num from ".$table_pre."gz where cate='zxs' and (dj='".$msg_login["dj"]."' or dj='') and kh='".$msg["no"]."' order by num"; //echo $q1; $r1=$db->query($q1); $sql_pm=""; $str_zxs=""; while($m1=$db->fetch_array($r1)){ $sql_pm.="num='".$m1["num"]."' or "; //$str_zxs.="{\"zxs\":\"".$m1["num"]."\"},"; $str_zxs.=$m1["num"].","; } if($str_zxs){ $str_zxs=deel_end($str_zxs); } //$json_data.="\"zxs\":\"".$str_zxs."\","; if($sql_pm) $sql_pm=" and (".substr($sql_pm,0,-4).")"; //读取配码信息 //配码等级一样,店铺id一样或者店铺id为空(适合所有店铺的配码) $q="select * from ".$table_pre."size_pm where (uid='".$uid."' or uid='') and pm_dj='".$msg["pm_dj"]."' ".$sql_pm." order by id"; //echo $q; $r=$db->query($q); $content_pm=""; $i=0; $size_ws_kh=count(explode(",",$msg["size"])); $str_pm=""; while($m=$db->fetch_array($r)){ $size_ws=count(explode(":",$m["gz"])); //echo $size_ws."|".$size_ws_kh."-
"; if($size_ws==$size_ws_kh){ $is_edit=($m["uid"]==$uid)?"y":"n"; $str_pm.="{\"is_edit\":\"".$is_edit."\",\"id\":\"".$m["id"]."\",\"title\":\"".$m["title"]."\",\"gz\":\"".$m["gz"]."\",\"num\":\"".$m["num"]."\"},"; $i++; } } if($str_pm){ $str_pm=deel_end($str_pm); } if($i==1){ //$json_data.="\"mrpm\":[".$str_pm."],"; } } $pm_op=substr($pm_op,0,-1); $json_data.="\"pms\":[".$pm_op."],"; $json_data.="\"translate_xh\":\"".d_translate("xh")."\","; $json_data.="\"translate_gg\":\"".d_translate("gg")."\","; $json_data.="\"translate_dhbs\":\"".d_translate("dhbs")."\","; $json_data.="\"translate_dpk\":\"".d_translate("dpk")."\","; $json_data.="\"translate_xgdp\":\"".d_translate("xgdp")."\","; //include_once $path_dz."/dp/order_single.php"; //显示颜色,杯型 $str_other_info=""; $other_info="
"; $other_info.="
颜色:".get_cate_title_no("color",$color)."
"; $str_other_info.="{\"color\":\"".$color."\","; if($msg["size_group"]==$bx_sizegroup_id){ $other_info.="杯型:".$bx."
"; $str_other_info.="\"bx\":\"".$bx."\","; }else{ $str_other_info.="\"bx\":\"\","; } $str_other_info.="\"is_gg\":\"".$is_gg."\","; if($is_gg=="y"){ $str_other_info.="\"gg_head\":\"".d_translate("gg")."\","; $other_info.=d_translate("gg").":".get_gg_title($bx)."
"; $tmp=get_db_msg("select * from ".$table_pre."kh_gg where iid='".$msg["id"]."' and color='".$color."' and gg='".$bx."'"); $strgg=""; foreach($sys_gg_zd as $k1 => $v1){ $other_info.=$v1.":".$tmp[$k1]."
"; $strgg.="{\"title\":\"".$v1."\",\"value\":\"".$tmp[$k1]."\"},"; } $strgg=substr($strgg,0,-1); $str_other_info.="\"gg\":\"".get_gg_title($bx)."\","; $str_other_info.="\"gg_arr\":[".$strgg."],"; }else if($is_gg=="b"){ $str_other_info.="\"gg_head\":\"".d_translate("gg")."\","; $other_info.=d_translate("gg").":".get_gg_title($bx)."
"; $str_other_info.="\"gg\":\"".get_gg_title($bx)."\","; } $str_other_info=substr($str_other_info,0,-1); $str_other_info.="}"; $json_data.="\"other_info\":[".$str_other_info."],"; $other_info.="
"; } //include template("order_single_qj"); break; case "single_qj": $is_brand=is_brand(); $id=$khid; $have_md="n"; $msg_err=""; $kl=strlen($s_title); if($xh_ms=="2"){ $tmp_xh=get_db_msg("select kh as no from web_kh_xh where xh='".$s_title."'"); }else{ $tmp_xh=get_db_msg("select no from web_kh where xh='".$s_title."'"); } if($kl<=3 && $s_title && is_numeric($s_title)){ $sql_con="where xh='".$s_title."'"; } $xhsql_s=$xhsql_e=""; if($kl>3){ $xhsql_s=",case when no='".$tmp_xh["no"]."' then 100 else 1 end as ppd "; $xhsql_e=" order by ppd desc"; if(is_numeric($s_title)){ $sql_con="where xh='".$s_title."' or no like '%".$s_title."%'"; }else{ $sql_con="where no like '%".$s_title."%'"; } } if($s_title){ $msg=get_db_msg("select * from ".$table_pre."kh ".$sql_con); $m1=get_db_msg("select count(*) 'num' from ".$table_pre."kh ".$sql_con); }else{ $msg=get_db_msg("select * from ".$table_pre."kh where id='".$id."'"); } /*if($search_type=="xh"){ if($s_xh){ if($xh_ms=="2"){ //序号到色 $msg_kh_xh=get_db_msg("select * from ".$table_pre."kh_xh where xh='".$s_xh."' limit 0,1"); $q1="select count(*) 'num' from ".$table_pre."kh_xh where xh='".$s_xh."'"; $q2="select a.xh 'xh',b.no 'no',b.id 'id' from ".$table_pre."kh_xh a,".$table_pre."kh b where a.kh=b.no and a.xh='".$s_xh."'"; $msg=get_db_msg("select * from ".$table_pre."kh where no='".$msg_kh_xh["kh"]."' limit 0,1"); }else{ //序号查询定制 $msg=get_db_msg("select * from ".$table_pre."kh where xh='".$s_xh."' limit 0,1"); $q1="select count(*) 'num' from ".$table_pre."kh where xh='".$s_xh."'"; $q2="select xh,no,id from ".$table_pre."kh where xh='".$s_xh."'"; } $_xh=$s_xh; $m1=get_db_msg($q1); }else{ $msg=get_db_msg("select * from ".$table_pre."kh where id='".$id."'"); $_xh=get_kh_xh($msg); } }else{ $s_no=trim($s_no); if($s_no){ $msg=get_db_msg("select * from ".$table_pre."kh where no like '%".$s_no."%' limit 0,1"); $m1=get_db_msg("select count(*) 'num' from ".$table_pre."kh where no like '%".$s_no."%'"); if($xh_ms=="2") $q2="select a.xh 'xh',b.no 'no',b.id 'id' from ".$table_pre."kh_xh a,".$table_pre."kh b where a.kh=b.no and b.no like '%".$s_no."%'"; else $q2="select xh,no,id from ".$table_pre."kh where no like '%".$s_no."%'"; }else{ $msg=get_db_msg("select * from ".$table_pre."kh where id='".$id."'"); } $_xh=get_kh_xh($msg); }*/ $id=$msg["id"]; $str_title=""; if($m1["num"]>1){ $q2="select *".$xhsql_s." from ".$table_pre."kh ".$sql_con.$xhsql_e; $r2=$db->query($q2); while($m2=$db->fetch_array($r2)){ $str_title.="{\"khid\":\"".$m2["id"]."\",\"title\":\"".$m2["xh"]."#".$m2["no"]."\"},"; } if($msg_err){ $str_title=deel_end($str_title); $msg_err="存在以下符合条件的多个款:".$msg_err; } } // if(!$id){ $msg_err="记录不存在"; } if($msg_err){ if($str_title){ $json_data.="\"code\":101,"; $json_data.="\"msg\":[".$str_title."],"; }else{ $json_data.="\"code\":102,"; $json_data.="\"msg\":\"".$msg_err."\","; } }else{ $json_data.="\"code\":100,"; $_xh=get_kh_xh($msg); //-------------------设置禁止提交表单 if($order_close=="y" || $msg["ka"]=="y"){ $disable=" disabled"; }else{ $disable=""; } $json_data.="\"disable\":\"".$disable."\","; //取得评级 $msg_pj=get_db_msg("select * from ".$table_pre."client_pj where khid='".$id."' and cid='".$uid."'"); if($msg_pj["id"]>0){ $pj_remark=dhtmlchars($msg_pj["remark"]); $race=$msg_pj["race"]; }else{ $pj_remark=""; $race=0; } $q="select * from ".$table_pre."keyword where cate='arr_select' and flag_ka='y' and flag_bd='n' and no<>'jgd' and no<>'sx' and no<>'color' order by ord"; $r=$db->query($q); $i=0; $zds=""; while($m=$db->fetch_array($r)){ $str_select_dz.="\"".$m["title"]."|"; if($m["no"]=="zd1" || $m["no"]=="zd2" || $m["no"]=="zd3"){ //$str_select_dz.=$msg[$m["no"]]."\","; //$zds.="{\"no\":\"".$m1["no"]."\",\"title\":\"".$m1["title"]."\"},"; }else{ //$str_select_dz.=deel_js_var(get_cate_title_no($m["no"],$msg[$m["no"]]))."\","; $zds.="{\"no\":\"".$i."\",\"title\":\"".get_cate_title_no("arr_select",$m["no"])."\",\"value\":\"".get_cate_title_no($m["no"],$msg[$m["no"]])."\"},"; } $i++; } $zds=deel_end($zds); $json_data.="\"zds\":[".$zds."],"; $json_data.="\"khid\":\"".$msg["id"]."\","; $json_data.="\"kh\":\"".$msg["no"]."\","; $json_data.="\"ka\":\"".$msg["ka"]."\","; $json_data.="\"xh\":\"".get_kh_xh($msg)."\","; if($msg["size_group"]==$child_sizegroup_id){ //童装尺码异价 foreach($arr_child_bx as $bx1 => $size1){ $m1=get_db_msg("select id,price from ".$table_pre."size_bx where no='".$msg["no"]."' and bx='".$bx1."'"); if($m1["id"]>0){ $price_zk=get_price_zk($uid,$msg["id"],'',$bx1); $str_price.=$bx1.": ".$m1["price"]."元"; if($price_zk!=$m1["price"]) $str_price.=" / 结算价:".$price_zk."元"; $str_price.="
"; } } }else{ $dp_price=get_price_dp($uid,$msg["id"]); $str_price=deel_num($dp_price)."元"; $price_zk=get_price_zk($uid,$msg["id"]); if($price_zk!=$dp_price){ $str_price.=" / 结算价:".deel_num($price_zk)."元"; } //买断价 $tmp=get_db_msg("select id,price from ".$table_pre."kh_md where (dj='".$msg_login["dj"]."' or dj='') and kh='".$msg["no"]."' limit 0,1"); if($tmp["id"]>0){ $price_md=$tmp["price"]>0?$tmp["price"]:$price_zk; $str_price.=" / ".d_translate("md")."价:".deel_num($price_md)."元"; } } $json_data.="\"price\":\"".$str_price."\","; //$json_data.="\"price\":\"".$msg["price"]."\","; $json_data.="\"xj\":\"".$race."\","; $json_data.="\"ksm\":\"".$msg["title"]."\","; $json_data.="\"dkremark\":\"".htmlspecialchars($msg["remark"])."\","; $json_data.="\"pjwz\":\"".$pj_remark."\","; $pj_icon=get_pj_icon($race,$id,'big'); $is_ggk=is_ggk($msg["id"]); $json_data.="\"is_ggk\":\"".$is_ggk."\","; $json_data.="\"size_group_id\":\"".$msg["size_group"]."\","; if(is_array($sys_color_zd) && count($sys_color_zd)>0){ //取得款色表的定制字段 $str_ds_h=$str_ds_b=""; $str_ds_h="{\"v\":\"颜色\"},"; //$other_info.=""; foreach($sys_color_zd as $k1 => $v1){ //$other_info.=""; $str_ds_h.="{\"v\":\"".$v1."\"},"; } $json_data.="\"ds_header\":[".deel_end($str_ds_h)."],"; //$other_info.=""; $q="select * from ".$table_pre."kh_color where iid='".$msg["id"]."' order by color"; $r=$db->query($q); while($m=$db->fetch_array($r)){ $str_ds_b.="{\"color\":\"".$m["color"]."\","; $tmpds=""; $tmpds.="{\"v\":\"".$m["color"]."-".get_cate_title_no("color",$m["color"])."\"},"; //$other_info.=""; foreach($sys_color_zd as $k1 => $v1){ //$other_info.=""; $tmpds.="{\"v\":\"".$m[$k1]."\"},"; } //$other_info.=""; $str_ds_b.="\"v\":[".deel_end($tmpds)."]},"; } $json_data.="\"ds_body\":[".deel_end($str_ds_b)."],"; //$other_info.="
颜色".$v1."
".$m["color"]."-".get_cate_title_no("color",$m["color"])."".$m[$k1]."
"; } $arrBx=array(); $str_bx=""; if($msg["size_group"]==$bx_sizegroup_id){ //取得杯型 $r1=$db->query("select * from ".$table_pre."size_bx where no='".$msg["no"]."' order by bx"); $i1=0; while($m1=$db->fetch_array($r1)){ $arrBx[$i1][]=$m1["bx"]; $str_bx.=$m1["bx"]; $arrBx[$i1][]=$m1["size"]; $i1++; } //取得尺码 $str_size=""; $r1=$db->query("select * from ".$table_pre."size where iid='".$bx_sizegroup_id."' order by no"); while($m1=$db->fetch_array($r1)){ $str_size.=$m1["no"].","; } $str_size=substr($str_size,0,-1); $arr_size=explode(",",$str_size); }else if($msg["size_group"]==$child_sizegroup_id){ //童装 $str_size=$str_bx=$str_bx_title=$str_size_tz=""; $i1=0; foreach($arr_child_bx as $bx1 => $arr_bx_size1){ $check_tmp=get_db_msg("select id,size,price from ".$table_pre."size_bx where no='".$msg["no"]."' and bx='".$bx1."'"); if($check_tmp["id"]>0){ $str_size_tz.=$i1."|".$check_tmp["size"].":"; $str_bx_title.=$bx1.","; $str_bx.=$i1.","; $arrBx[$i1][0]=$i1; $arrBx[$i1][1]=$check_tmp["size"]; $i1++; } } //取得尺码 $str_size=""; $r1=$db->query("select * from ".$table_pre."size where iid='".$child_sizegroup_id."' order by no"); while($m1=$db->fetch_array($r1)){ $str_size.=$m1["no"].","; } $str_size=substr($str_size,0,-1); $arr_size=explode(",",$str_size); }else{ if($is_ggk!="n"){ $str_bx.=","; $r1=$db->query("select gg from ".$table_pre."kh_gg where iid='".$msg["id"]."' group by gg order by gg"); $i1=0; while($m1=$db->fetch_array($r1)){ $str_bx.=$m1["gg"].","; $i1++; } } $arrBx[0][0]=""; $arrBx[0][1]=$msg["size"]; $arr_size=explode(",",$msg["size"]); } if($str_bx) $str_bx=substr($str_bx,0,-1); if($str_bx_title) $str_bx_title=substr($str_bx_title,0,-1); if($str_size_tz) $str_size_tz=substr($str_size_tz,0,-1); $arr_color=explode(",",$msg["color"]); $arr_color_ka=explode(",",$msg["color_ka"]); $total=0; $js_check_str=""; //取得客户查询条件 $con_uid=""; for($i=0;$i''"); $colorka="n"; if(in_array($arr_color[$i],$arr_color_ka,true)){ $disable_color=" disabled"; $sty1="font-weight:bold;color:#ff0000;"; $link_ds=""; $colorka="y"; }else if($check["zsh"]>0){ $disable_color=" disabled"; $sty1=""; //$link_ds=" 进入搭配订货"; $link_ds=$check["zsh"]; }else{ $sty1=""; $disable_color=$disable; $link_ds=""; } $tr_bg=($color==$arr_color[$i])?"#d3d2d1":"#ffffff"; if($is_ggk!="n"){ //有规格 $r1=$db->query("select * from ".$table_pre."kh_gg where iid='".$msg["id"]."' and color='".$arr_color[$i]."' order by ord"); $i1=0; $arr_gg=array(); while($m1=$db->fetch_array($r1)){ $arr_gg[$i1]["title"]=$m1["gg"]; if($is_ggk=="y"){ foreach($sys_gg_zd as $k1 => $v1){ $arr_gg[$i1][$k1]=$m1[$k1]; } } $i1++; } $num_arr.="{\"tr_bg\":\"".$tr_bg."\",\"ggs\":\"".count($arr_gg)."\",\"ka\":\"".$colorka."\",\"link_ds\":\"".$link_ds."\",\"sty1\":\"".$sty1."\",\"disable_color\":\"".$disable_color."\","; $strarr.="{\"no\":\"1\",\"value\":\"".$arr_color[$i]."-".get_cate_title_no("color",$arr_color[$i])."\"},"; $str_num.="".$arr_color[$i]."-".get_cate_title_no("color",$arr_color[$i]).""; if($i1==0){ $arr_gg[0]["title"]=""; if($is_ggk=="y"){ foreach($sys_gg_zd as $k1 => $v1){ $arr_gg[0][$k1]=""; } } } for($j1=0;$j10) $num_arr.="{\"tr_bg\":\"".$tr_bg."\",\"ggs\":\"1\",\"link_ds\":\"\",\"sty1\":\"".$sty1."\",\"disable_color\":\"".$disable_color."\","; //$str_num.=""; $strarr1.="{\"no\":\"1\",\"value\":\"".get_gg_title($arr_gg[$j1]["title"])."\"},"; //$str_num.="".get_gg_title($arr_gg[$j1]["title"]).""; if($is_ggk=="y"){ foreach($sys_gg_zd as $k1 => $v1){ //$str_num.="".$arr_gg[$j1][$k1].""; $strarr1.="{\"no\":\"1\",\"value\":\"".$arr_gg[$j1][$k1]."\"},"; } } if($show_gg_zxs=="y") $strarr1.="{\"no\":\"1\",\"value\":\"".get_main_value1($arr_dhbs,$arr_gg[$j1]["title"])."\"},"; $j=0; $tmp_msg=get_db_msg("select ".get_size_sql("sum1")." from ".$table_pre."order where ".$con_uid." iid='".$msg["id"]."' and color='".$arr_color[$i]."' and bx='".$arr_gg[$j1]["title"]."' and _key='".$_key."'"); for($k=0;$k".$num1.""; $strarr1.="{\"no\":\"3\",\"id\":\"num_".$arr_color[$i]."_".$arr_gg[$j1]["title"]."_".$arr_size[$k]."\",\"value\":".deel_num($num1).",\"bg\":\"".$bg_input_num1."\",\"disable\":\"".$disable_color1."\"},"; }else{ $str_num.=" "; $strarr1.="{\"no\":\"1\",\"value\":\" \"},"; } //合计尺码数量 $var_xj_size="xj_size_".$arr_size[$k]; //if($disable_color1==""){ $s_xj+=$num1; $$var_xj_size+=$num1; //} $j++; } $total+=$s_xj; $strarr1.="{\"no\":\"4\",\"id\":\"xj_".$arr_color[$i]."_".$arr_gg[$j1]["title"]."\",\"value\":\"".$s_xj."\"},"; $strarr1.="{\"no\":\"100\",\"khid\":\"".$msg["id"]."\",\"color\":\"".$arr_color[$i]."\",\"bx\":\"".$arr_gg[$j1]["title"]."\"},"; //$strarr=substr($strarr,0,-1); $num_arr.="\"dt\":[".deel_end($strarr.$strarr1)."]},"; } }else{ //无规格 //$str_num.="".$arr_color[$i]."-".get_cate_title_no("color",$arr_color[$i]).""; $num_arr.="{\"tr_bg\":\"".$tr_bg."\",\"ggs\":\"".count($arrBx)."\",\"ka\":\"".$colorka."\",\"link_ds\":\"".$link_ds."\",\"sty1\":\"".$sty1."\","; $strarr.="{\"no\":\"1\",\"value\":\"".$arr_color[$i]."-".get_cate_title_no("color",$arr_color[$i])."\"},"; for($j1=0;$j10) $num_arr.="{\"tr_bg\":\"".$tr_bg."\",\"ggs\":\"1\",\"link_ds\":\"\",\"sty1\":\"".$sty1."\","; if($msg["size_group"]==$bx_sizegroup_id) $strarr1.="{\"no\":\"1\",\"value\":\"".$arrBx[$j1][0]."\"},"; else if($msg["size_group"]==$child_sizegroup_id) $strarr1.="{\"no\":\"1\",\"value\":\"".$bx_title."\"},"; $j=0; $tmp_msg=get_db_msg("select ".get_size_sql("sum1")." from ".$table_pre."order where ".$con_uid." iid='".$msg["id"]."' and color='".$arr_color[$i]."' and bx='".$arrBx[$j1][0]."' and _key='".$_key."'"); $stra="select ".get_size_sql("sum1")." from ".$table_pre."order where ".$con_uid." iid='".$msg["id"]."' and color='".$arr_color[$i]."' and bx='".$arrBx[$j1][0]."' and _key='".$_key."'"; for($k=0;$k".$num1.""; $strarr1.="{\"no\":\"3\",\"id\":\"num_".$arr_color[$i]."_".$tmp_bx."_".$arr_size[$k]."\",\"value\":".deel_num($num1).",\"bg\":\"".$bg_input_num1."\",\"disable\":\"".$disable_color1."\"},"; }else{ //$str_num.=" "; $strarr1.="{\"no\":\"1\",\"value\":\" \"},"; } //合计尺码数量 $var_xj_size="xj_size_".$arr_size[$k]; //if($disable_color1==""){ $s_xj+=$num1; $$var_xj_size+=$num1; //} $j++; } $total+=$s_xj; $strarr1.="{\"no\":\"4\",\"id\":\"xj_".$arr_color[$i]."_".$tmp_bx."\",\"value\":\"".$s_xj."\"},"; $strarr1.="{\"no\":\"100\",\"khid\":\"".$msg["id"]."\",\"color\":\"".$arr_color[$i]."\",\"bx\":\"".$arrBx[$j1][0]."\"},"; //$strarr=substr($strarr,0,-1); $num_arr.="\"dt\":[".deel_end($strarr.$strarr1)."]},"; } } //if($j1==0) //$num_arr.="},"; } $json_data.="\"stra\":\"".$stra."\","; $num_arr=substr($num_arr,0,-1); $json_data.="\"dds\":[".$num_arr."],"; //----------------数量表 //表头 $str_size_title=$cmz=""; for($i=0;$i颜色"; if($msg["size_group"]==$bx_sizegroup_id) $content_num.="杯型"; else if($msg["size_group"]==$child_sizegroup_id) $content_num.="款型"; $json_data.="\"gg_t\":\"".d_translate("gg")."\","; if($is_ggk=="y"){ $content_num.="".d_translate("gg").""; $str_gg_bt=""; foreach($sys_gg_zd as $k1 => $v1){ $content_num.="".$v1.""; $str_gg_bt.="{\"gg_zd\":\"".$v1."\"},"; } $str_gg_bt=substr($str_gg_bt,0,-1); $json_data.="\"arr_gg_bt\":[".$str_gg_bt."],"; }else if($is_ggk=="b"){ $content_num.="".d_translate("gg").""; } // $str_size_t=""; for($i=0;$i".$tmp["title"].""; $str_size_t.="{\"title\":\"".$tmp["title"]."\",\"no\":\"".$arr_size[$i]."\"},"; } $str_size_t=substr($str_size_t,0,-1); $json_data.="\"arr_size\":[".$str_size_t."],"; $content_num.="小计 "; //内容 $content_num.=$str_num; //合计 $content_num.="合计"; $str_hj=""; for($i=0;$i
".$$var_xj_size."
"; $str_hj.="{\"hj_num\":\"".$$var_xj_size."\"},"; } $str_hj=substr($str_hj,0,-1); $json_data.="\"size_hj\":[".$str_hj."],"; $json_data.="\"total\":\"".$total."\","; $content_num.="
".$total."
 "; if($js_check_str) $js_check_str=substr($js_check_str,0,-1); $json_data.="\"js_check_str\":\"".$js_check_str."\","; //定义图片目录 $pathdir="../attachments/design/mini"; if($flag_pad=="_pad"){ $s_pathdir_mini="content://com.muchuang.edt/attachments/design/mini"; $s_pathdir_big="content://com.muchuang.edt/attachments/design/big"; }else{ $s_pathdir_mini="../attachments/design/mini"; $s_pathdir_big="../attachments/design/big"; } $json_data.="\"s_pathdir_mini\":\"".$s_pathdir_mini."\","; $json_data.="\"s_pathdir_big\":\"".$s_pathdir_big."\","; //--取得单款图片数组 $arr_pic=""; if($sys_close_image=="y"){ $pic_m1="images/no_pic.png"; $pic_b1="images/no_pic_big.png"; //$arr_pic.="\"|".$pic_m1."||".$pic_b1."|\","; $arr_pic.="{\"color\":\"\",\"pic\":\"".$pic_m1."\",\"pic_w\":0,\"pic_h\":0,\"pic_big\":\"".$pic_b1."\",\"pic_big_w\":0,\"pic_big_h\":0},"; }else{ if(is_file($pathdir."/".$msg["no"].".jpg")){ $pic_m1=$s_pathdir_mini."/".$msg["no"].".jpg"; $pic_b1=$s_pathdir_big."/".$msg["no"].".jpg"; //$arr_pic.="\"|".$pic_m1."|".str_replace("\"",",",out_good_pic_set($pic_m1,30,30))."|".$pic_b1."|".str_replace("\"",",",out_good_pic_set($pic_b1,$tmpl_order_single_w,$tmpl_order_single_h))."\","; $tmpm=out_good_pic_set_arr($pic_m1,30,30); $tmpb=out_good_pic_set_arr($pic_b1,$tmpl_order_single_w,$tmpl_order_single_h); $arr_pic.="{\"color\":\"".$arr_color[$i]."\",\"pic\":\"".$pic_m1."\",\"pic_w\":\"".$tmpm[0]."\",\"pic_h\":\"".$tmpm[1]."\",\"pic_big\":\"".$pic_b1."\",\"pic_big_w\":\"".$tmpb[0]."\",\"pic_big_h\":\"".$tmpb[1]."\"},"; } for($i=0;$iquery($q1); while($m1=$db->fetch_array($r1)){ $f=$s_pathdir_mini."/".$m1["pic"]; $f1=$s_pathdir_big."/".$m1["pic"]; $tmpwh=out_good_pic_set_arr($pathdir."/".$m1["pic"],120,120); $arr_detail.="{\"title\":\"".$m1["kh"]."\",\"no\":\"".$m1["kh"]."\",\"pic\":\"".$f."\",\"pic_big\":\"".$f1."\",\"pic_w\":\"".$tmpwh[0]."\",\"pic_h\":\"".$tmpwh[1]."\"},"; $i++; } } $arr_detail=substr($arr_detail,0,-1); $json_data.="\"xjs\":[".$arr_detail."],"; //--搭配款 $arr_dpk=""; $no_str=trim($msg["dpk"]); if($no_str){ $arr1=explode(",",$no_str); for($i=0;$i0){ $con_xh=$s_xh?"&s_xh=".$m1["xh"]:""; $pic=get_kh_picture($m1["no"],$m1["main_pic"],$m1["color"],$flag_pad_offline); $t=get_kh_xh($m1)."#".$m1["no"]; $tmpwh=out_good_pic_set_arr($pic,90,120); $arr_dpk.="{\"khid\":\"".$m1["id"]."\",\"pic\":\"".$pic."\",\"pic_w\":\"".$tmpwh[0]."\",\"pic_h\":\"".$tmpwh[1]."\",\"title\":\"".$t."\"},"; $j++; } } } } $arr_dpk=substr($arr_dpk,0,-1); $json_data.="\"dpks\":[".$arr_dpk."],"; //--取得相关搭配 $arr_dp=""; $q1="select zsh,title,pic from ".$table_pre."kh_dp where kh='".$msg["no"]."' group by zsh order by zsh"; $r1=$db->query($q1); $i=0; while($m1=$db->fetch_array($r1)){ $pic=get_kh_dp_mini($m1["pic"],$flag_pad_offline); $url="?_m=dp_single_qj&zsh=".$m1["zsh"]."&rurl=".urlencode($this_url); $tmpwh=out_good_pic_set_arr($pic,90,120); $arr_dp.="{\"zsh\":\"".$m1["zsh"]."\",\"pic\":\"".$pic."\",\"pic_w\":\"".$tmpwh[0]."\",\"pic_h\":\"".$tmpwh[1]."\",\"title\":\"".$m1["title"]."\"},"; $i++; } $arr_dp=substr($arr_dp,0,-1); $json_data.="\"dps\":[".$arr_dp."],"; //--取得相关陈列 $q="select * from ".$table_pre."kh_cl where kh='".$msg["no"]."' group by zsh"; $r=$db->query($q); $arr_cl=""; while($m=$db->fetch_array($r)){ $p_big=get_kh_cl_big($m["pic"],$flag_pad_offline); $url="?_m=cl_single_qj&s_zsh=".$m["zsh"]."&rurl_cl_list=".urlencode($this_url).""; $pic=get_kh_cl_mini($m["pic"],$flag_pad_offline); $tmpwh=out_good_pic_set_arr($pic,150,112); $arr_cl.="{\"zsh\":\"".$m["zsh"]."\",\"pic\":\"".$pic."\",\"pic_w\":\"".$tmpwh[0]."\",\"pic_h\":\"".$tmpwh[1]."\",\"title\":\"".$m["title"]." 第".$m["ord"]."件\"},"; } $arr_cl=substr($arr_cl,0,-1); $json_data.="\"cls\":[".$arr_cl."],"; //--取得相关橱窗 $q="select * from ".$table_pre."kh_cc where kh='".$msg["no"]."' group by zsh"; $r=$db->query($q); $arr_cc=""; while($m=$db->fetch_array($r)){ $p_big=get_kh_cc_big($m["pic"],$flag_pad_offline); $url="?_m=show_pic&pic=".$p_big.""; $pic=get_kh_cc_mini($m["pic"],$flag_pad_offline); $tmpwh=out_good_pic_set_arr($pic,150,112); $arr_cl.="{\"zsh\":\"".$m["zsh"]."\",\"pic\":\"".$pic."\",\"pic_w\":\"".$tmpwh[0]."\",\"pic_h\":\"".$tmpwh[1]."\",\"title\":\"".$m["title"]."\"},"; } $arr_cc=substr($arr_cc,0,-1); $json_data.="\"ccs\":[".$arr_cc."],"; if($first_act) $js_onload=" onload=\"".$first_act."\""; $json_data.="\"js_onload\":\"".$js_onload."\","; //上一款、下一款 if($xh_ms=="2"){ $pre_xh=get_db_msg("select b.id 'id' from ".$table_pre."kh_xh a,".$table_pre."kh b where a.kh=b.no and a.xh<'".$_xh."' and a.kh<>'".$msg["no"]."' order by a.xh desc limit 0,1"); $next_xh=get_db_msg("select b.id 'id' from ".$table_pre."kh_xh a,".$table_pre."kh b where a.kh=b.no and a.xh>'".$_xh."' and a.kh<>'".$msg["no"]."' order by a.xh limit 0,1"); }else{ $pre_xh=get_db_msg("select id from ".$table_pre."kh where xh<'".$_xh."' and no<>'".$msg["no"]."' order by xh desc limit 0,1"); $next_xh=get_db_msg("select id from ".$table_pre."kh where xh>'".$_xh."' and no<>'".$msg["no"]."' order by xh limit 0,1"); } $str_sxk="[\"".$pre_xh["id"]."\",\"".$next_xh["id"]."\"]"; $json_data.="\"prev\":\"".$pre_xh["id"]."\","; $json_data.="\"next\":\"".$next_xh["id"]."\","; $str_color=$msg["color"]; $json_data.="\"str_color\":\"".$str_color."\","; //取得定制选项 $select_dz=array(); $q="select * from ".$table_pre."keyword where cate='arr_select' and flag_ka='y' and no<>'jgd' and no<>'sx' and no<>'color' order by ord"; $r=$db->query($q); $i=0; $str_select_dz=""; while($m=$db->fetch_array($r)){ $select_dz[$i][0]=$m["title"].":"; $str_select_dz.="{\"title\":\"".$m["title"]."\","; if($m["no"]=="zd1" || $m["no"]=="zd2" || $m["no"]=="zd3"){ $select_dz[$i][1]=$msg[$m["no"]]; $str_select_dz.="\"value\":\"".$msg[$m["no"]]."\"},"; }else{ $select_dz[$i][1]=get_cate_title_no($m["no"],$msg[$m["no"]]); $str_select_dz.="\"value\":\"".get_cate_title_no($m["no"],$msg[$m["no"]])."\"},"; } $i++; } $str_select_dz=substr($str_select_dz,0,-1); $json_data.="\"select_dz\":[".$str_select_dz."],"; $json_data.="\"translate_xh\":\"".d_translate("xh")."\","; $json_data.="\"translate_gg\":\"".d_translate("gg")."\","; $json_data.="\"translate_dhbs\":\"".d_translate("dhbs")."\","; $json_data.="\"translate_dpk\":\"".d_translate("dpk")."\","; $json_data.="\"translate_xgdp\":\"".d_translate("xgdp")."\","; } //include_once $path_dz."/dp/order_single.php"; //include template("order_single_qj"); break; default: //------------------------列表 //---------------搜索条件 $w2=$tmpl_m1_pic_width; $h2=$tmpl_m1_pic_height; $page=$page>0?$page:1; $limit=$limit>0?$limit:12; $start=($page-1)*$limit; $end=$limit; $sql_con=""; $sql_con1=""; if($s_color){ $s_color_a=explode(",",$s_color); $s1=$s2=$s3=""; //$sql_con_color1=""; for($i1=0;$i1 $v1){ $v="s_color_".$k1; if($$v){ $s1=$s2=""; $tmp_a=explode(",",$$v); for($i1=0;$i1=3){ if(is_numeric($s_keyword)){ $sql_con=" where xh='".$s_keyword."' or no like '%".$s_keyword."%'"; $sql_con1=" and (a.xh='".$s_keyword."' or a.no like '%".$s_keyword."%')"; }else{ $sql_con=" where no like '%".$s_keyword."%'"; $sql_con1=" and a.no like '%".$s_keyword."%'"; } for($i=0;$i=3){ $xhsql_s=",case when no='".$tmp_xh["no"]."' then 100 else 1 end as ppd "; $xhsql_e="ppd desc,"; $xhsql_s1=",case when a.no='".$tmp_xh["no"]."' then 100 else 1 end as ppd "; $xhsql_e1="ppd desc,"; if(is_numeric($s_keyword)){ $sql_con=" where (no='".$tmp_xh["no"]."' or no like '%".$s_keyword."%')"; $sql_con1=" and (a.no='".$tmp_xh["no"]."' or a.no like '%".$s_keyword."%')"; }else{ $sql_con=" where no like '%".$s_keyword."%'"; $sql_con1=" and a.no like '%".$s_keyword."%'"; } for($i=0;$i0 ".$con_pjxj.$sql_con1; //echo $query."
"; }else{ $query="select count(distinct kc.iid,kc.color) 'total' from ".$table_pre."kh_color kc left join ".$table_pre."kh a on a.id=kc.iid left join ".$table_pre."order o on kc.iid=o.iid and kc.color=o.color ".get_qj_ucon_all_dpid($msg_login["charge_uid"],"o.")." and o._key='".$_key."' where o.num>0 ".$sql_con1; } }else if($s_is_ordered=="n"){ if($s_xj){ $query="select count(distinct kc.iid,kc.color) 'total' from ".$table_pre."kh_color kc left join ".$table_pre."kh a on a.id=kc.iid left join ".$table_pre."order o on kc.iid=o.iid and kc.color=o.color and ".get_qj_ucon_all_dpid($msg_login["charge_uid"],"o.")." and o._key='".$_key."' left join ".$table_pre."client_pj c on o.iid=c.khid and c.cid='".$uid."' where o.num is NULL ".$con_pjxj.$sql_con1; }else{ $query="select count(distinct kc.iid,kc.color) 'total' from ".$table_pre."kh_color kc left join ".$table_pre."kh a on a.id=kc.iid left join ".$table_pre."order o on kc.iid=o.iid and kc.color=o.color and o._key='".$_key."' ".get_qj_ucon_all_dpid($msg_login["charge_uid"],"o.")." where o.num is NULL ".$sql_con1; } }else{ if($s_xj){ $query="select count(distinct kc.iid,kc.color) 'total' from ".$table_pre."kh_color kc left join ".$table_pre."kh a on a.id=kc.iid left join ".$table_pre."client_pj c on kc.iid=c.khid and c.cid='".$uid."' where kc.id>0 ".$con_pjxj.$sql_con1; }else{ $query="select count(distinct kc.iid,kc.color) 'total' from ".$table_pre."kh_color kc left join ".$table_pre."kh a on a.id=kc.iid where kc.id>0 ".$sql_con1; } } }else{ //展示到款 if($s_is_ordered=="y"){ if($s_xj){ $query="select count(distinct c.khid) 'total' from ".$table_pre."order a left join ".$table_pre."client_pj c on a.iid=c.khid and c.cid='".$uid."' and a._key='".$_key."' where a.id>0 ".get_qj_ucon_all_dpid($msg_login["charge_uid"],"a.")." ".$con_pjxj.$sql_con1; }else{ $query="select count(distinct a.iid) 'total' from ".$table_pre."order a where a.id>0 and a._key='".$_key."' ".get_qj_ucon_all_dpid($msg_login["charge_uid"],"a.")." ".$sql_con1; } }else if($s_is_ordered=="n"){ if($s_xj){ $query="select count(*) 'total' from ".$table_pre."kh a left join ".$table_pre."order b on a.id=b.iid and b._key='".$_key."' ".get_qj_ucon_all_dpid($msg_login["charge_uid"],"b.")." left join ".$table_pre."client_pj c on a.id=c.khid and c.cid='".$uid."' where b.num is NULL ".$con_pjxj.$sql_con1; }else{ $query="select count(*) 'total' from ".$table_pre."kh a left join ".$table_pre."order b on a.id=b.iid and b._key='".$_key."' ".get_qj_ucon_all_dpid($msg_login["charge_uid"],"b.")." where b.num is NULL ".$sql_con1; } }else{ if($s_xj){ $query="select count(*) 'total' from ".$table_pre."kh a left join ".$table_pre."client_pj c on a.id=c.khid and c.cid='".$uid."' where a.id>0 ".$con_pjxj.$sql_con1; }else{ $query="select count(*) 'total' from ".$table_pre."kh ".$sql_con; } } } //echo $query."
"; //$json_data.="\"query\":\"".$query."\","; $res=$db->query($query); $msg=$db->fetch_array($res); $total_num=$msg["total"]; $json_data.="\"list_by_color\":\"".$list_by_color."\","; if($list_by_color=="y"){ //------------------展示到色 //定制条件 if($s_is_ordered=="y"){ if($s_xj){ $query="select a.*,c.race,b.num,kc.color 'color'".$xhsql_s1." from ".$table_pre."kh_color kc left join ".$table_pre."kh a on kc.iid=a.id left join ".$table_pre."order b on kc.iid=b.iid ".get_qj_ucon_all_dpid($msg_login["charge_uid"],"b.")." and b._key='".$_key."' left join ".$table_pre."client_pj c on kc.iid=c.khid and c.cid='".$uid."' where b.num>0 ".$con_pjxj.$sql_con1." group by kc.id,kc.color order by ".$xhsql_e1."a.xh,a.no limit ".$start.",".$end; }else{ $query="select a.*,b.num,kc.color 'color'".$xhsql_s1." from ".$table_pre."kh_color kc left join ".$table_pre."kh a on kc.iid=a.id left join ".$table_pre."order b on kc.iid=b.iid and kc.color=b.color ".get_qj_ucon_all_dpid($msg_login["charge_uid"],"b.")." and b._key='".$_key."' where b.num>0 ".$sql_con1." group by kc.id,kc.color order by ".$xhsql_e1."a.xh,a.no limit ".$start.",".$end; } //echo $query."
"; }else if($s_is_ordered=="n"){ if($s_xj){ $query="select a.*,c.race,b.num,kc.color 'color'".$xhsql_s1." from ".$table_pre."kh_color kc left join ".$table_pre."kh a on kc.iid=a.id left join ".$table_pre."order b on kc.iid=b.iid and b.color=kc.color and b._key='".$_key."' ".get_qj_ucon_all_dpid($msg_login["charge_uid"],"b.")." left join ".$table_pre."client_pj c on kc.iid=c.khid and c.cid='".$uid."' where b.num is NULL ".$con_pjxj.$sql_con1." group by kc.id,kc.color order by ".$xhsql_e1."a.xh,a.no limit ".$start.",".$end; }else{ $query="select a.*,b.num,kc.color 'color'".$xhsql_s1." from ".$table_pre."kh_color kc left join ".$table_pre."kh a on kc.iid=a.id left join ".$table_pre."order b on kc.iid=b.iid and b.color=kc.color and b._key='".$_key."' ".get_qj_ucon_all_dpid($msg_login["charge_uid"],"b.")." where b.num is NULL ".$sql_con1." group by kc.id,kc.color order by ".$xhsql_e1."a.xh,a.no limit ".$start.",".$end; } }else{ if($s_xj){ $query="select a.*,c.race,kc.color 'color'".$xhsql_s1." from ".$table_pre."kh_color kc left join ".$table_pre."kh a on kc.iid=a.id left join ".$table_pre."client_pj c on kc.iid=c.khid and c.cid='".$uid."' where kc.id>0 ".$con_pjxj.$sql_con1." group by kc.id,kc.color order by ".$xhsql_e1."a.xh,a.no limit ".$start.",".$end; }else{ $query="select a.*,kc.color 'color'".$xhsql_s1." from ".$table_pre."kh_color kc left join ".$table_pre."kh a on kc.iid=a.id where kc.id>0".$sql_con1." group by kc.id,kc.color order by ".$xhsql_e1."a.xh,a.no limit ".$start.",".$end; } } if($xh_ms=="2"){ //-------定制序号查询 if($s_con=="xh" && $s_value_xh!=""){ $query="select a.*,b.xh 'xh' from ".$table_pre."kh a,".$table_pre."kh_xh b where a.no=b.kh and b.xh='".$s_value_xh."'"; } } //echo $query."
"; //$json_data.="\"query\":\"".$query."\","; $res=$db->query($query); $count=0; $rnum=0; $style_title_color=get_set("style_title_color"); $ka_color=get_set("ka_color"); $pic_background=get_set("pic_background"); $pic_background=$pic_background?$pic_background:"#ffffff"; $content_set="[\"".$pic_background."\"]"; $json_data.="\"style_title_color\":\"".$style_title_color."\","; $json_data.="\"s_keyword\":\"".$s_keyword."\","; $json_data.="\"ka_color\":\"".$ka_color."\","; $json_data.="\"content_set\":\"".$pic_background."\","; $json_data.="\"count\":\"".$total_num."\",\"data\":["; $data_str=""; $content_list="["; $arr_id=array(); for($count=0;$count<$end;$count++){ $msg=$db->fetch_array($res); $arr_id[$count]=$msg["id"]; if($msg["ka"]=="y"){ $c=get_set("ka_color"); }else{ $c=get_set_value_dote($style_title_color,$msg["kh_dj"]); } if($msg["id"]>0){ //图片获取规则 $pic=get_kh_color_picture($msg["no"],$msg["color"],$flag_pad_offline); //取得已订件数 //$n1=deel_num(get_order_num_kh_color($msg["id"],$msg["color"])); $tmp=get_db_msg("select sum(num) 'num' from ".$table_pre."order where ka<>'y' and _key='".$_key."' and iid='".$msg["id"]."' and color='".$msg["color"]."' ".get_qj_ucon_all_dpid($msg_login["charge_uid"],"").""); $n1=deel_num($tmp["num"]); //取得颜色数量 $str_c_num=",".$msg["color"]."-".get_cate_title_no("color",$msg["color"]); //取得上次订货会数量 $str_sys=""; if($sys_flag_count>1){ $tmp_sys=get_db_msg("select sum(".get_size_sql("sum").") 'num' from ".$table_pre."order where _key<>'".$_key."' and iid='".$msg["id"]."' and color='".$msg["color"]."' ".get_qj_ucon_all_dpid($msg_login["charge_uid"],"").""); if($tmp_sys["num"]){ $str_sys="\"scjs\":".$tmp_sys["num"].",\"hjjs\":".($tmp_sys["num"]+$n1).","; } $str_sys.="\"lssj\":\"y\","; } //取得评价信息 $tmp=get_db_msg("select id,race,remark from ".$table_pre."client_pj where khid='".$msg["id"]."' and cid='".$uid."'"); $pj_race=$tmp["race"]>0?$tmp["race"]:0; $pj_id=$tmp["id"]>0?$tmp["id"]:0; $pj_remark=deel_js_var($tmp["remark"]); $msg_pj=$pj_id."|".$pj_race."|".deel_js_var($tmp["remark"]); //取得滑动展示信息 $text_main=""; $q="select * from ".$table_pre."keyword where cate='arr_select' and flag_ka='y' and no<>'jgd' and no<>'sx' and no<>'color' order by ord"; $r=$db->query($q); $tmpzd=""; while($m=$db->fetch_array($r)){ if($m["no"]=="zd1" || $m["no"]=="zd2" || $m["no"]=="zd3"){ $tmpzd.=",\"".$m["no"]."\":\"".$msg[$m["no"]]."\""; $text_main.=$msg[$m["no"]].","; }else{ $tmpzd.=",\"".$m["no"]."\":\"".deel_js_var(get_cate_title_no($m["no"],$msg[$m["no"]]))."\""; $text_main.=deel_js_var(get_cate_title_no($m["no"],$msg[$m["no"]])).","; } } if($text_main) $text_main=substr($text_main,0,-2); if($msg["remark"]!="") $text_main.="
".deel_js_var(htmlspecialchars($msg["remark"])); if($msg["size_group"]==$child_sizegroup_id){ //童装不显示价格 $this_price=0; }else{ $this_price=deel_num(get_price_dp($uid,$msg["id"])); } //$content_list.="".$msg["id"].",\"".get_kh_xh($msg,$msg["color"])."\",\"".$msg["no"].$str_c_num."\",".$this_price.",\"".$pic."\",\"".str_replace("\"","'",out_good_pic_set($pic,$w2,$h2))."\",".$n1.",\"".$c."\",\"".$msg_pj."\",\"".$text_main."\","; // $rnum++; $ck=out_good_pic_set_arr($pic,$w2,$h2); $data_str.="{\"id\":".$msg["id"].",\"xh\":\"".get_kh_xh($msg,$msg["color"])."\",\"kh\":\"".$msg["no"]."\",\"color\":\"".$msg["color"]."\",\"color_title\":\"".get_cate_title_no("color",$msg["color"])."\",\"pic\":\"".$pic."\",\"pic_w\":\"".$ck[0]."\",\"pic_h\":\"".$ck[1]."\",\"ydjs\":".$n1.",\"unit_title\":\"".$msg["unit_title"]."\",".$str_sys."\"price\":".$this_price.",\"xj\":\"".$pj_race."\",\"pj_remark\":\"".$pj_remark."\"".$tmpzd."},"; } } $content_list.="]"; }else{ //------------------展示到款 //定制条件 if($s_is_ordered=="y"){ if($s_xj){ $query="select a.*,c.race,b.num".$xhsql_s1." from ".$table_pre."kh a left join ".$table_pre."order b on a.id=b.iid ".get_qj_ucon_all_dpid($msg_login["charge_uid"],"b.")." and b._key='".$_key."' left join ".$table_pre."client_pj c on a.id=c.khid and c.cid='".$uid."' where b.num>0 ".$con_pjxj.$sql_con1." group by a.id order by ".$xhsql_e1."a.xh,a.no limit ".$start.",".$end; }else{ $query="select a.*,b.num".$xhsql_s1." from ".$table_pre."kh a left join ".$table_pre."order b on a.id=b.iid ".get_qj_ucon_all_dpid($msg_login["charge_uid"],"b.")." and b._key='".$_key."' where b.num>0 ".$sql_con1." group by a.id order by ".$xhsql_e1."a.xh,a.no limit ".$start.",".$end; } //echo $query."
"; }else if($s_is_ordered=="n"){ if($s_xj){ $query="select a.*,c.race,b.num".$xhsql_s1." from ".$table_pre."kh a left join ".$table_pre."order b on a.id=b.iid ".get_qj_ucon_all_dpid($msg_login["charge_uid"],"b.")." and b._key='".$_key."' left join ".$table_pre."client_pj c on a.id=c.khid and c.cid='".$uid."' where b.num is NULL ".$con_pjxj.$sql_con1." order by ".$xhsql_e1."a.xh,a.no limit ".$start.",".$end; }else{ $query="select a.*,b.num".$xhsql_s1." from ".$table_pre."kh a left join ".$table_pre."order b on a.id=b.iid ".get_qj_ucon_all_dpid($msg_login["charge_uid"],"b.")." and b._key='".$_key."' where (b.num is NULL) ".$sql_con1." order by ".$xhsql_e1."a.xh,a.no limit ".$start.",".$end; } }else{ if($s_xj){ $query="select a.*,c.race".$xhsql_s1." from ".$table_pre."kh a left join ".$table_pre."client_pj c on a.id=c.khid and c.cid='".$uid."' where a.id>0 ".$con_pjxj.$sql_con1." order by ".$xhsql_e1."a.xh,a.no limit ".$start.",".$end; }else{ $query="select *".$xhsql_s." from ".$table_pre."kh ".$sql_con."order by ".$xhsql_e."xh,no limit ".$start.",".$end; } } if($xh_ms=="2"){ //-------定制序号查询 if($s_con=="xh" && $s_value_xh!=""){ $query="select a.*,b.xh 'xh' from ".$table_pre."kh a,".$table_pre."kh_xh b where a.no=b.kh and b.xh='".$s_value_xh."'"; } } //echo $query."
"; //$json_data.="\"query\":\"".$query."\","; $res=$db->query($query); $count=0; $rnum=0; $style_title_color=get_set("style_title_color"); $ka_color=get_set("ka_color"); $pic_background=get_set("pic_background"); $pic_background=$pic_background?$pic_background:"#ffffff"; $content_set="[\"".$pic_background."\"]"; $json_data.="\"style_title_color\":\"".$style_title_color."\","; $json_data.="\"ka_color\":\"".$ka_color."\","; $json_data.="\"content_set\":\"".$pic_background."\","; $json_data.="\"count\":\"".$total_num."\",\"data\":["; $data_str=""; $content_list="["; $arr_id=array(); for($count=0;$count<$end;$count++){ $msg=$db->fetch_array($res); $arr_id[$count]=$msg["id"]; if($msg["ka"]=="y"){ $c=get_set("ka_color"); }else{ $c=get_set_value_dote($style_title_color,$msg["kh_dj"]); } if($msg["id"]>0){ //图片获取规则 $pic=get_kh_picture($msg["no"],$msg["main_pic"],$msg["color"],$flag_pad_offline); //取得已订件数 //$n1=deel_num(get_order_num_kh($msg["id"])); $tmp=get_db_msg("select sum(num) 'num' from ".$table_pre."order where ka<>'y' and _key='".$_key."' and iid='".$msg["id"]."' ".get_qj_ucon_all_dpid($msg_login["charge_uid"],"").""); $n1=deel_num($tmp["num"]); //取得颜色数量 $c_num=count(explode(",",$msg["color"])); $str_c_num=""; if($is_dkds!="y"){ $str_c_num=" (".$c_num."色)"; } //取得上次订货会数量 $str_sys=""; if($sys_flag_count>1){ $tmp_sys=get_db_msg("select sum(".get_size_sql("sum").") 'num' from ".$table_pre."order where _key<>'".$_key."' and iid='".$msg["id"]."' ".get_qj_ucon_all_dpid($msg_login["charge_uid"],"").""); if($tmp_sys["num"]){ $str_sys="\"scjs\":".$tmp_sys["num"].",\"hjjs\":".($tmp_sys["num"]+$n1).","; } $str_sys.="\"lssj\":\"y\","; } //取得评价信息 $tmp=get_db_msg("select id,race,remark from ".$table_pre."client_pj where khid='".$msg["id"]."' and cid='".$uid."'"); $pj_race=$tmp["race"]>0?$tmp["race"]:0; $pj_id=$tmp["id"]>0?$tmp["id"]:0; $pj_remark=deel_js_var($tmp["remark"]); $msg_pj=$pj_id."|".$pj_race."|".deel_js_var($tmp["remark"]); //取得滑动展示信息 $text_main=""; $q="select * from ".$table_pre."keyword where cate='arr_select' and flag_ka='y' and no<>'jgd' and no<>'sx' and no<>'color' order by ord"; $r=$db->query($q); $tmpzd=""; while($m=$db->fetch_array($r)){ if($m["no"]=="zd1" || $m["no"]=="zd2" || $m["no"]=="zd3"){ $tmpzd.=",\"".$m["no"]."\":\"".$msg[$m["no"]]."\""; $text_main.=$msg[$m["no"]].","; }else{ $tmpzd.=",\"".$m["no"]."\":\"".deel_js_var(get_cate_title_no($m["no"],$msg[$m["no"]]))."\""; $text_main.=deel_js_var(get_cate_title_no($m["no"],$msg[$m["no"]])).","; } } if($text_main) $text_main=substr($text_main,0,-2); if($msg["remark"]!="") $text_main.="
".deel_js_var(htmlspecialchars($msg["remark"])); //$content_list.="".$msg["id"].",\"".get_kh_xh($msg)."\",\"".$msg["no"].$str_c_num."\",".deel_num(get_price_dp($uid,$msg["id"])).",\"".$pic."\",\"".str_replace("\"","'",out_good_pic_set($pic,$w2,$h2))."\",".$n1.",\"".$c."\",\"".$msg_pj."\",\"".$text_main."\","; // $rnum++; $ck=out_good_pic_set_arr($pic,$w2,$h2); $data_str.="{\"id\":".$msg["id"].",\"xh\":\"".get_kh_xh($msg)."\",\"kh\":\"".$msg["no"]."\",\"color\":\"nocolor\",\"color_title\":\"\",\"pic\":\"".$pic."\",\"pic_w\":\"".$ck[0]."\",\"pic_h\":\"".$ck[1]."\",\"ydjs\":".$n1.",\"unit_title\":\"".$msg["unit_title"]."\",".$str_sys."\"ka_color\":\"".$c."\",\"price\":".deel_num(get_price_dp($uid,$msg["id"])).",\"xj\":\"".$pj_race."\",\"pj_remark\":\"".$pj_remark."\"".$tmpzd."},"; } } $content_list.="]"; } $json_data.=substr($data_str,0,-1)."],"; //---------------款号数据 //传递参数:s_brand|选项,s_xj|星级,s_is_order|已订,s_is_ka|删除款 //每次加载条数 $page_size=12; //图片标准188*250 /*$json_data.="\"data\":["; $json_data.="{\"id\":1,\"xh\":\"1\",\"kh\":\"12W1102\",\"pic\":\"../attachments/design/mini/12W1102.jpg\",\"pic_w\":188,\"pic_h\":250,\"ydjs\":4,\"price\":587,\"xj\":4,\"khdj\":\"必订\"},"; $json_data.="{\"id\":2,\"xh\":\"2\",\"kh\":\"12W010251\",\"pic\":\"../attachments/design/mini/12W0102_51.jpg\",\"pic_w\":188,\"pic_h\":250,\"ydjs\":0,\"price\":897,\"xj\":5,\"khdj\":\"常规\"},"; $json_data.="{\"id\":3,\"xh\":\"3\",\"kh\":\"12W1123\",\"pic\":\"../attachments/design/mini/12W1123_91.jpg\",\"pic_w\":188,\"pic_h\":250,\"ydjs\":2,\"price\":865,\"xj\":0,\"khdj\":\"常规\"},"; $json_data.="{\"id\":4,\"xh\":\"4\",\"kh\":\"12W3110\",\"pic\":\"../attachments/design/mini/12W3110_91.jpg\",\"pic_w\":188,\"pic_h\":250,\"ydjs\":110,\"price\":759,\"xj\":2,\"khdj\":\"推荐\"},"; $json_data.="{\"id\":5,\"xh\":\"5\",\"kh\":\"12W3128\",\"pic\":\"../attachments/design/mini/12W3128_41.jpg\",\"pic_w\":188,\"pic_h\":250,\"ydjs\":0,\"price\":1200,\"xj\":1,\"khdj\":\"常规\"},"; $json_data.="{\"id\":6,\"xh\":\"6\",\"kh\":\"12W3127\",\"pic\":\"../attachments/design/mini/12W3127_91.jpg\",\"pic_w\":188,\"pic_h\":250,\"ydjs\":0,\"price\":600,\"xj\":5,\"khdj\":\"常规\"},"; $json_data.="{\"id\":7,\"xh\":\"7\",\"kh\":\"12W3105\",\"pic\":\"../attachments/design/mini/12W3105_91.jpg\",\"pic_w\":188,\"pic_h\":250,\"ydjs\":0,\"price\":800,\"xj\":0,\"khdj\":\"\"},"; $json_data.="{\"id\":8,\"xh\":\"8\",\"kh\":\"12W2112\",\"pic\":\"../attachments/design/mini/12W2112_41.jpg\",\"pic_w\":188,\"pic_h\":250,\"ydjs\":0,\"price\":800,\"xj\":0,\"khdj\":\"\"},"; $json_data.="{\"id\":9,\"xh\":\"9\",\"kh\":\"12W2123\",\"pic\":\"../attachments/design/mini/12W2123_82.jpg\",\"pic_w\":188,\"pic_h\":250,\"ydjs\":0,\"price\":800,\"xj\":0,\"khdj\":\"\"},"; $json_data.="{\"id\":10,\"xh\":\"10\",\"kh\":\"12W3106\",\"pic\":\"../attachments/design/mini/12W3106_52.jpg\",\"pic_w\":188,\"pic_h\":250,\"ydjs\":0,\"price\":800,\"xj\":0,\"khdj\":\"\"},"; $json_data.="{\"id\":11,\"xh\":\"11\",\"kh\":\"12W5104\",\"pic\":\"../attachments/design/mini/12W5104_11.jpg\",\"pic_w\":188,\"pic_h\":250,\"ydjs\":0,\"price\":800,\"xj\":0,\"khdj\":\"\"},"; $json_data.="{\"id\":12,\"xh\":\"12\",\"kh\":\"12W5117\",\"pic\":\"../attachments/design/mini/12W5117_11.jpg\",\"pic_w\":188,\"pic_h\":250,\"ydjs\":0,\"price\":800,\"xj\":0,\"khdj\":\"\"}"; $json_data.="],";*/ //总计条数 $json_data.="\"total_num\":".$total_num.","; //已经加载条数 //$json_data.="\"show_num\":12,"; $total_page=ceil($total_num/$limit); $json_data.="\"total_page\":".$total_page.","; $json_data.="\"page\":".$page.","; //已经加载条数 //$json_data.="\"show_num\":12,"; //单独下拉字段 $select_dz=""; $arrdd=array(); for($i=0;$iquery("select no,title from ".$table_pre."keyword where cate='".$sys_dk_search_cate_single[$i]."' order by no"); while($m1=$db->fetch_array($r1)){ $tmp.="{\"no\":\"".$m1["no"]."\",\"title\":\"".$m1["title"]."\"},"; } $tmp=deel_end($tmp); $var="s_".$sys_dk_search_cate_single[$i]; $arrdd[]=$var; $select_dz.="{\"no\":\"".$sys_dk_search_cate_single[$i]."\",\"title\":\"".get_cate_title_no("arr_select",$sys_dk_search_cate_single[$i])."\",\"value\":\"".$$var."\",\"op\":[".$tmp."]},"; } $select_dz=deel_end($select_dz); $json_data.="\"select_single\":[".$select_dz."],"; //更多条件下拉字段 $select_dz=""; for($i=0;$iquery("select no,title from ".$table_pre."keyword where cate='".$sys_dk_search_cate[$i]."' order by no"); while($m1=$db->fetch_array($r1)){ $tmp.="{\"no\":\"".$m1["no"]."\",\"title\":\"".$m1["title"]."\"},"; } $tmp=deel_end($tmp); $select_dz.="{\"no\":\"".$sys_dk_search_cate[$i]."\",\"title\":\"颜色\",\"value\":\"".$$var."\",\"op\":[".$tmp."]},"; }elseif(substr($sys_dk_search_cate[$i],0,6)=="color_"){ $tmp_key=str_replace("color_","",$sys_dk_search_cate[$i]); $tmp=""; $r1=$db->query("select no,title from ".$table_pre."keyword where cate='".$tmp_key."' order by no"); while($m1=$db->fetch_array($r1)){ $tmp.="{\"no\":\"".$m1["no"]."\",\"title\":\"".$m1["title"]."\"},"; } $tmp=deel_end($tmp); $select_dz.="{\"no\":\"".$sys_dk_search_cate[$i]."\",\"title\":\"".get_main_value($sys_color_zd,$tmp_key)."\",\"value\":\"".$$var."\",\"op\":[".$tmp."]},"; }else{ $tmp=""; $r1=$db->query("select no,title from ".$table_pre."keyword where cate='".$sys_dk_search_cate[$i]."' order by no"); while($m1=$db->fetch_array($r1)){ $tmp.="{\"no\":\"".$m1["no"]."\",\"title\":\"".$m1["title"]."\"},"; } $tmp=deel_end($tmp); $select_dz.="{\"no\":\"".$sys_dk_search_cate[$i]."\",\"title\":\"".get_cate_title_no("arr_select",$sys_dk_search_cate[$i])."\",\"value\":\"".$$var."\",\"op\":[".$tmp."]},"; } } } //$json_data.="\"select_more\":["; // //$json_data.="{\"no\":\"category\",\"title\":\"大类\",\"value\":\"1,2\",\"op\":[{\"no\":\"1\",\"title\":\"上装\"},{\"no\":\"2\",\"title\":\"下装\"},{\"no\":\"3\",\"title\":\"饰品\"}]},"; //$json_data.="{\"no\":\"bc\",\"title\":\"波段\",\"value\":\"11\",\"op\":[{\"no\":\"11\",\"title\":\"第一波\"},{\"no\":\"12\",\"title\":\"第二波\"}]},"; //星级筛选 $select_dz.="{\"no\":\"xj\",\"title\":\"星级\",\"value\":\"".$s_xj."\",\"op\":[{\"no\":\"1\",\"title\":\"1星\"},{\"no\":\"2\",\"title\":\"2星\"},{\"no\":\"3\",\"title\":\"3星\"},{\"no\":\"4\",\"title\":\"4星\"},{\"no\":\"5\",\"title\":\"5星\"},{\"no\":\"y\",\"title\":\"已评\"},{\"no\":\"n\",\"title\":\"未评\"}]},"; //已订,未订 $select_dz.="{\"no\":\"is_ordered\",\"title\":\"已订未订\",\"value\":\"".$s_is_ordered."\",\"op\":[{\"no\":\"y\",\"title\":\"已订\"},{\"no\":\"n\",\"title\":\"未订\"}]},"; //是否删除款 $select_dz.="{\"no\":\"ka\",\"title\":\"是否删除款\",\"value\":\"".$s_ka."\",\"op\":[{\"no\":\"n\",\"title\":\"非删除款\"},{\"no\":\"y\",\"title\":\"仅删除款\"}]},"; // $select_dz=deel_end($select_dz); $json_data.="\"select_more\":[".$select_dz."],"; $json_data.="\"s_keyword\":\"".$s_keyword."\","; break; } } } $json_data=substr($json_data,0,-1)."}"; echo $json_data; ?>