7e47ce238b
添加了管理后台所需的图片资源、Excel文件、安装程序以及设计相关的图片文件
1172 lines
46 KiB
PHP
1172 lines
46 KiB
PHP
<?php
|
|
//-------------------------------单款订货
|
|
/*
|
|
店铺和区经角色
|
|
*/
|
|
header("Content-type: text/html; charset=utf-8");
|
|
$json_data="{";
|
|
if(THIS_IN!="edt_ipad")
|
|
exit("错误的访问!");
|
|
|
|
$uid=check_cookie_jxs();
|
|
//系统变量
|
|
$sys_close=get_set("sys_close");
|
|
$sys_close_image=get_set("sys_close_image");
|
|
$is_session=get_set("is_session");
|
|
$zb_type=get_set("zb_type");
|
|
$is_spk=get_set("is_spk");
|
|
$zbxf=get_set("zbxf");
|
|
$zbxf_type=get_set("zbxf_type");
|
|
$sys_ms=get_set("sys_ms");
|
|
$is_msg=get_set("is_msg");
|
|
$is_ewm=get_set("is_ewm");
|
|
$is_window="y";
|
|
$zk_type=get_set("zk_type");
|
|
$is_hd_log=get_set("is_hd_log");
|
|
$xh_ms=get_set("xh_ms");
|
|
$order_session=get_set("order_session");
|
|
$pm_ms=get_set("pm_ms");
|
|
$sys_size_num=get_max_size_num();
|
|
$theme_path=get_theme_path();
|
|
|
|
$is_sy=get_set("is_sy");
|
|
|
|
$bs_kh_dj=get_set("bs_kh_dj");
|
|
$json_data.="\"bs_kh_dj\":\"".$bs_kh_dj."\",";
|
|
|
|
$sys_ck_input=get_set("sys_ck_input");
|
|
|
|
$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=300;
|
|
$tmpl_m2_dp_pic_height=400;
|
|
$json_data.="\"sys_ver_hy\":\"".$sys_ver_hy."\",";
|
|
|
|
//$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.="\"jpty\":\"".$msg_login["jpty"]."\",";
|
|
$json_data.="\"username\":\"".$msg_login["username"]."\",";
|
|
$json_data.="\"is_sy\":\"".$is_sy."\",";
|
|
$is_brand=is_brand();
|
|
$json_data.="\"is_brand\":\"".$is_brand."\",";
|
|
|
|
$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");
|
|
|
|
|
|
$json_data.="\"show_jd\":\"".$show_jd."\",";
|
|
$json_data.="\"pm_ms\":\"".$pm_ms."\",";
|
|
$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<count($arr_s_brand);$i++){
|
|
$con_brand.="brand='".$arr_s_brand[$i]."' or ";
|
|
$title_brand.=get_cate_title_no("brand",$arr_s_brand[$i]).",";
|
|
}
|
|
if($title_brand)
|
|
$title_brand=substr($title_brand,0,-1);
|
|
if($con_brand)
|
|
$con_brand=" and (".substr($con_brand,0,-3).")";
|
|
}
|
|
//取得选项
|
|
$arr_select_no=array();
|
|
$arr_select_title=array();
|
|
$q="select no,title from ".$table_pre."keyword where cate='arr_select' and flag_ka='y' and flag_bd='n' and no<>'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":"";
|
|
//------------------------------------包含定制模块,店铺界面,顶部已订数和完成率的显示
|
|
//include_once $path_dz."/dp/wcl.php";
|
|
//
|
|
//--------------交单按钮
|
|
$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="";
|
|
|
|
|
|
switch($_a){
|
|
case "update_jpty":
|
|
$q="update ".$table_pre."client set jpty='".$jpty."' where id='".$uid."'";
|
|
$db->query($q);
|
|
$json_data.="\"code\":101,";
|
|
break;
|
|
case "single":
|
|
$msg_err="";
|
|
$have_md="n";
|
|
$s_title=trim($s_title);
|
|
if($s_title){
|
|
$msg_dp=get_db_msg("select * from ".$table_pre."kh_dp where title like '%".$s_title."%' order by zsh,ord limit 0,1");
|
|
$m1=get_db_msg("select count(distinct zsh) 'num' from ".$table_pre."kh_dp where title like '%".$s_title."%'");
|
|
$q1="select * from ".$table_pre."kh_dp where title like '%".$s_title."%' group by zsh order by zsh";
|
|
//
|
|
$tmp=get_db_msg("select min(zsh) 'zsh' from ".$table_pre."kh_dp where title like '%".$s_title."%'");
|
|
$zsh=$tmp["zsh"];
|
|
}else{
|
|
if($zsh){
|
|
$msg_dp=get_db_msg("select * from ".$table_pre."kh_dp where zsh='".$zsh."' order by ord");
|
|
}else{
|
|
$tmp=get_db_msg("select min(zsh) 'zsh' from ".$table_pre."kh_dp");
|
|
$zsh=$tmp["zsh"];
|
|
$msg_dp=get_db_msg("select * from ".$table_pre."kh_dp where zsh='".$zsh."' order by ord");
|
|
}
|
|
$m1=get_db_msg("select count(distinct zsh) 'num' from ".$table_pre."kh_dp where zsh='".$zsh."'");
|
|
$q1="select * from ".$table_pre."kh_dp where zsh='".$zsh."' group by zsh order by zsh";
|
|
}
|
|
//if(!$msg_dp["id"])
|
|
//echo_wrong("记录不存在!");
|
|
$str_title="";
|
|
if($m1["num"]>1){
|
|
$r2=$db->query($q1);
|
|
|
|
while($m2=$db->fetch_array($r2)){
|
|
//$str_title.="<a href=\"?_m=dp_single&zsh=".$m2["zsh"]."&rurl=".urlencode($back_url)."\">".$m2["zsh"]."#".$m2["title"]."</a> ";
|
|
$msg_err.=$m2["zsh"]."#".$m2["title"]."|";
|
|
$str_title.="{\"zsh\":\"".$m2["zsh"]."\",\"title\":\"".$m2["zsh"]."#".$m2["title"]."\"},";
|
|
}
|
|
if($msg_err){
|
|
$str_title=deel_end($str_title);
|
|
$msg_err="存在以下符合条件的多个款:".$msg_err;
|
|
}
|
|
//echo_wrong("<div width=\"100%\" align=\"left\" style=\"line-height:25px;\">找到以下符合条件的多项,请选择:<br>".$str_title."<div>");
|
|
}
|
|
if(!$msg_dp["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,";
|
|
//判断代理
|
|
$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")
|
|
$is_checked_dl="y";
|
|
}
|
|
//搭配订货规则
|
|
$msg_gz="";
|
|
if($msg_dp["gz"]=="1"){
|
|
$msg_gz.="注:该组要求每款都有订货数量!";
|
|
}else if($msg_dp["gz"]=="2"){
|
|
$msg_gz.="注:该组要求每款订货数量相同! ";
|
|
}
|
|
//不于下单款
|
|
$client_dj=trim($msg_login["dj"]);
|
|
$con_dj=$client_dj?" and (dj='".$client_dj."' or dj='')":" and dj=''";
|
|
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_login["is_checked"]=="y" || $msg_login["is_jd"]=="y" || $is_checked_dl=="y" || $msg_brand["is_jd"]=="y" || $msg_brand["is_checked"]=="y" || $is_jd_dl=="y"){
|
|
$disable_color1=" disabled";
|
|
$disable_save=" disabled";
|
|
if($order_close=="y")
|
|
$msg_gz.="订单功能已经关闭! ";
|
|
if($msg_login["is_checked"]=="y")
|
|
$msg_gz.="您的订单已经确认! ";
|
|
if($msg_login["is_jd"]=="y")
|
|
$msg_gz.="您的订单已经提交! ";
|
|
if($is_jd_dl=="y")
|
|
$msg_gz.="您的上级代理订单已经提交! ";
|
|
if($is_checked_dl=="y")
|
|
$msg_gz.="您的上级代理订单已经确认! ";
|
|
}else{
|
|
$disable_color1="";
|
|
$disable_save="";
|
|
}
|
|
$json_data.="\"sys_ck_input\":\"".$sys_ck_input."\",";
|
|
$json_data.="\"zsh\":\"".$zsh."\",";
|
|
$json_data.="\"disable_color1\":\"".$disable_color1."\",";
|
|
$json_data.="\"disable_save\":\"".$disable_save."\",";
|
|
$json_data.="\"num_lie\":\"".$$num_size_total."\",";
|
|
|
|
//-------------------处理尺码表头
|
|
//取得合并尺码
|
|
$arr_size_merged=array();
|
|
$q="select b.size 'size' from ".$table_pre."kh_dp a,".$table_pre."kh b where a.zsh='".$zsh."' and b.no=a.kh group by a.kh";
|
|
//echo $q."<br>";
|
|
$r=$db->query($q);
|
|
while($m=$db->fetch_array($r)){
|
|
$arr_tmp=explode(",",$m["size"]);
|
|
for($i=0;$i<count($arr_tmp);$i++){
|
|
if($arr_tmp[$i])
|
|
if(!in_array($arr_tmp[$i],$arr_size_merged))
|
|
$arr_size_merged[]=$arr_tmp[$i];
|
|
}
|
|
}
|
|
//判断是否有童装
|
|
$m1=get_db_msg("select kh.id,kh.no from ".$table_pre."kh kh,".$table_pre."kh_dp dp,".$table_pre."keyword kw where kh.no=dp.kh and kw.id=kh.size_group and kw.cate='size' and kw.title='".$child_sizegroup_title."' group by kh.no");
|
|
if($m1["id"]>0){
|
|
//
|
|
foreach($arr_child_bx as $bx1 => $arr_bx_size1){
|
|
for($i1=0;$i1<count($arr_bx_size1);$i1++){
|
|
$tmp1=get_db_msg("select no from ".$table_pre."size where title='".$arr_bx_size1[$i1]."' and iid='".$child_sizegroup_id."'");
|
|
if($tmp1["no"])
|
|
if(!in_array($tmp1["no"],$arr_size_merged))
|
|
$arr_size_merged[]=$tmp1["no"];
|
|
}
|
|
}
|
|
}
|
|
sort($arr_size_merged);
|
|
//print_r($arr_size_merged);
|
|
$num_size_total=count($arr_size_merged);
|
|
//取得尺码合计sql
|
|
$sql_sum_num="";
|
|
for($k=0;$k<$num_size_total;$k++){
|
|
$sql_sum_num.="sum(num_".$arr_size_merged[$k].") 'num_".$arr_size_merged[$k]."',";
|
|
}
|
|
//取得尺码表头内容
|
|
$num_size_group=0;
|
|
$size_tr=array();
|
|
$r1=$db->query("select * from ".$table_pre."keyword where cate='size' order by ord");
|
|
while($m1=$db->fetch_array($r1)){
|
|
$size_tr[$num_size_group]="";
|
|
for($i=0;$i<$num_size_total;$i++){
|
|
$tmp=get_db_msg("select title from ".$table_pre."size where iid='".$m1["id"]."' and no='".$arr_size_merged[$i]."'");
|
|
$size_tr[$num_size_group].="<td bgcolor=\"#f0f0f0\" align=\"center\" width=\"40\">".deel_td($tmp["title"])."</td>";
|
|
}
|
|
$arr_size_merged[]=$m1["no"];
|
|
$num_size_group++;
|
|
}
|
|
//-------------------/处理尺码表头结束
|
|
//判断搭配款色中有没有规格
|
|
$have_ggk="n";
|
|
$query="select kh,color from ".$table_pre."kh_dp where zsh='".$zsh."'";
|
|
$res=$db->query($query);
|
|
while($msg=$db->fetch_array($res)){
|
|
$m_kh=get_db_msg("select id from ".$table_pre."kh where no='".$msg["kh"]."' limit 0,1");
|
|
$is_gg_ks=is_gg_ks($m_kh["id"],$msg["color"]);
|
|
if($is_gg_ks!="n"){
|
|
$have_ggk=$is_gg_ks;
|
|
break;
|
|
}
|
|
}
|
|
$json_data.="\"have_ggk\":\"".$have_ggk."\",";
|
|
//
|
|
$tmp_race="";
|
|
$query="select * from ".$table_pre."kh_dp where zsh='".$zsh."' order by ord";
|
|
$res=$db->query($query);
|
|
$pic_kh=array();
|
|
$js_check_str="";
|
|
$input_width=get_input_width($num_size_total);
|
|
$j=$num_hang=$total=0;
|
|
$ks_bx_num="";
|
|
$num_var="[\"".$input_width."\"]";
|
|
$json_data.="\"input_width\":\"".$input_width."\",";
|
|
$num_arr="";
|
|
|
|
$arr_kh_pic="";
|
|
$kh_color="";
|
|
while($msg=$db->fetch_array($res)){
|
|
$disable_color="";
|
|
$strarr="";
|
|
$m_kh=get_db_msg("select * from ".$table_pre."kh where no='".$msg["kh"]."' limit 0,1");
|
|
|
|
if($pm_ms=="m2"){
|
|
//默认匹配规则
|
|
$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='".$m_kh["id"]."' or khid='0')";
|
|
if($m_kh["pm_dj"]){
|
|
$con1.=" and pm_dj='".$m_kh["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++;
|
|
}
|
|
$pm_op=substr($pm_op,0,-1);
|
|
}
|
|
//取得杯型
|
|
$arrBx=array();
|
|
if($m_kh["size_group"]==$bx_sizegroup_id){
|
|
//文胸
|
|
$r1=$db->query("select * from ".$table_pre."size_bx where no='".$m_kh["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($m_kh["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='".$m_kh["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;$i2<count($arr_tmp);$i2++){
|
|
if(!in_array($arr_tmp[$i2],$arr_size_tmp)){
|
|
$arr_size_tmp[]=$arr_tmp[$i2];
|
|
}
|
|
}
|
|
$str_bx_title.=$bx1.",";
|
|
$str_bx.=$i1.",";
|
|
$arrBx[$j1][0]=$i1;
|
|
$arrBx[$j1][1]=$check_tmp["size"];
|
|
$j1++;
|
|
}
|
|
$i1++;
|
|
}
|
|
sort($arr_size_tmp);
|
|
//取得尺码
|
|
$arr_size=$arr_size_tmp;
|
|
$str_size=arr_to_str($arr_size);
|
|
}else{
|
|
if($is_ggk!="n"){
|
|
//$str_bx.=",";
|
|
$r1=$db->query("select gg from ".$table_pre."kh_gg where iid='".$m_kh["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]=$m_kh["size"];
|
|
$arr_size=explode(",",$m_kh["size"]);
|
|
}
|
|
/*$r1=$db->query("select * from ".$table_pre."size_bx where no='".$msg["kh"]."' order by bx");
|
|
$i1=0;
|
|
while($m1=$db->fetch_array($r1)){
|
|
$arrBx[$i1][]=$m1["bx"];
|
|
$arrBx[$i1][]=$m1["size"];
|
|
$i1++;
|
|
}
|
|
if(count($arrBx)==0){
|
|
$arrBx[0][0]="";
|
|
$arrBx[0][1]=$m_kh["size"];
|
|
}*/
|
|
//
|
|
$tmp=get_db_msg("select * from ".$table_pre."gz where cate='byxdk' and kh='".$m_kh["no"]."'".$con_dj);
|
|
$byxdk=$tmp["id"]>0?"y":"n";
|
|
//判断颜色是否存在款号资料中
|
|
$arr_color=explode(",",$m_kh["color"]);
|
|
if(in_array($msg["color"],$arr_color,TRUE)){
|
|
$kh_color.=$m_kh["id"]."_".$msg["color"].",";
|
|
$m_pj=get_db_msg("select * from ".$table_pre."client_pj where cid='".$uid."' and khid='".$m_kh["id"]."' limit 0,1");
|
|
$rc=$m_pj["race"]>0?$m_pj["race"]:0;
|
|
$pj_remark=deel_js_var($m_pj["remark"]);
|
|
$tmp_race.="kh_".$m_kh["id"].":".$rc.",";
|
|
$tmp_dis=$rc>0?"":"none";
|
|
//取得评价
|
|
$td_pj="\"6|".$rc."|".$tmp_dis."\",";
|
|
$arr_color_ka=explode(",",$m_kh["color_ka"]);
|
|
//
|
|
|
|
//品牌控制
|
|
$msg_brand="";
|
|
if($is_brand=="y" && $m_kh["brand"]){
|
|
$msg_brand=get_db_msg("select * from ".$table_pre."client_brand where cid='".$uid."' and brand='".$m_kh["brand"]."'");
|
|
$brand_is_jd=$msg_brand["is_jd"];
|
|
$brand_is_checked=$msg_brand["is_checked"];
|
|
$brand_id=$msg_brand["id"];
|
|
}else{
|
|
$brand_is_jd=$brand_is_checked=$brand_id="";
|
|
}
|
|
if($brand_is_jd=="y" || $brand_is_checked=="y" || ($is_brand=="y" && !$brand_id)){
|
|
$disable_color=" disabled";
|
|
}
|
|
$colorka="n";
|
|
if(in_array($msg["color"],$arr_color_ka,true)){
|
|
$disable_color=" disabled";
|
|
$colorka="y";
|
|
}
|
|
$tmp_pic=get_kh_color_picture($m_kh["no"],$msg["color"],$flag_pad_offline);
|
|
$tmppic=out_good_pic_set_arr($tmp_pic,100,100);
|
|
$arr_kh_pic.="{\"pic\":\"".$tmp_pic."\",\"pic_w\":".$tmppic[0].",\"pic_h\":".$tmppic[1].",\"title\":\"".$m_kh["id"]."_".$msg["color"]."\"},";
|
|
//
|
|
$is_ggk=is_ggk($m_kh["id"]);
|
|
if($is_ggk!="n"){
|
|
//有规格
|
|
$tmp1=get_db_msg("select count(*) 'num' from ".$table_pre."kh_gg where iid='".$m_kh["id"]."' and color='".$msg["color"]."'");
|
|
$ks_bx_num.=$tmp1["num"].",";
|
|
|
|
//$num_arr.="[\"".$tmp1["num"]."\",".$m_kh["id"].",\"".$msg["color"]."\",\"1|".$m_kh["no"]."<br>".get_cate_title_no("category",$m_kh["category"])."<br>".get_price_dp($uid,$m_kh["id"])."元".$price_zk."\",\"2|".deel_js_var("<span style=\"".$sty1."\">".$msg["color"]."-<br>".get_cate_title_no("color",$msg["color"])."</span>")."\",";
|
|
|
|
$num_arr.="{\"khid\":\"".$m_kh["id"]."\",\"kh_dj\":\"".get_cate_title_no("kh_dj",$m_kh["kh_dj"])."\",\"color\":\"".$msg["color"]."\",\"ka\":\"".$colorka."\",\"ggs\":".$tmp1["num"].",\"sty1\":\"".$sty1."\",\"pic\":\"".$tmp_pic."\",\"pic_w\":".$tmppic[0].",\"pic_h\":".$tmppic[1].",\"xj\":\"".$rc."\",\"pj_remark\":\"".$pj_remark."\",";
|
|
if($pm_ms=="m2"){
|
|
$num_arr.="\"default_pm\":\"".$default_pm."\",";
|
|
$num_arr.="\"default_pm_id\":\"".$default_pm_id."\",";
|
|
$num_arr.="\"pms\":[".$pm_op."],";
|
|
}
|
|
$strarr.="{\"no\":\"1\",\"value\":\"".$m_kh["no"]."<br>".get_cate_title_no("category",$m_kh["category"])."<br>".get_price_dp($uid,$m_kh["id"])."元".$price_zk."\"},";
|
|
$strarr.="{\"no\":\"2\",\"value\":\"".$msg["color"]."-<br>".get_cate_title_no("color",$msg["color"])."\"},";
|
|
|
|
$q1="select * from ".$table_pre."kh_gg where iid='".$m_kh["id"]."' and color='".$msg["color"]."'";
|
|
$r1=$db->query($q1);
|
|
$i1=0;
|
|
$arr_kh_size=explode(",",$m_kh["size"]);
|
|
while($m1=$db->fetch_array($r1)){
|
|
$strarr1="";
|
|
if($i1>0){
|
|
//$num_arr.="[\"1\",".$m_kh["id"].",\"".$msg["color"]."\",";
|
|
$num_arr.="{\"khid\":\"".$m_kh["id"]."\",\"kh_dj\":\"".get_cate_title_no("kh_dj",$m_kh["kh_dj"])."\",\"color\":\"".$msg["color"]."\",\"ggs\":1,\"sty1\":\"".$sty1."\",\"pic\":\"".$tmp_pic."\",\"pic_w\":".$tmppic[0].",\"pic_h\":".$tmppic[1].",\"xj\":\"".$rc."\",\"pj_remark\":\"".$pj_remark."\",";
|
|
}
|
|
$num_arr.="\"bx\":\"".$m1["gg"]."\",";
|
|
$strarr1.="{\"no\":\"1\",\"value\":\"".get_gg_title($m1["gg"])."\",\"title\":\"".get_gg_title($m1["gg"])."\"},";
|
|
$td_size1="";
|
|
|
|
$strarr1.="{\"no\":\"7\",\"value\":\"".$m1["gg"]."\",\"title\":\"".get_gg_title($m1["gg"])."\"},";
|
|
if($is_ggk=="y"){
|
|
//$num_arr.="\"9|".$m1["price"]."\",";
|
|
$strarr1.="{\"no\":\"9\",\"value\":\"".$m1["price"]."\"},";
|
|
}
|
|
$xj=0;
|
|
for($k=0;$k<$num_size_total;$k++){
|
|
if(check_size_not($m_kh["no"],$msg["color"],$m1["gg"],$arr_size_merged[$k])=="y"){
|
|
$disable_color2=" disabled";
|
|
$bg_input_num="#cccccc";
|
|
}else{
|
|
$disable_color2=$disable_color;
|
|
$bg_input_num="#ffffff";
|
|
}
|
|
if(check_md($m_kh["no"],$msg["color"],$m1["gg"],$arr_size_merged[$k],$msg_login["dj"])=="n"){
|
|
$bg_input_num1=$bg_input_num;
|
|
}else{
|
|
$bg_input_num1="#00ff00";
|
|
$have_md="y";
|
|
}
|
|
if(in_array($arr_size_merged[$k],$arr_kh_size)){
|
|
if($msg_login["face"]=="4"){
|
|
$num1=get_order_num($m_kh["id"],$msg["color"],$m1["gg"],$arr_size_merged[$k]);
|
|
}
|
|
if($msg_login["face"]=="2"){
|
|
$tmp=get_db_msg("select sum(num_".strtolower($arr_size_merged[$k]).") 'num' from ".$table_pre."order where ka<>'y' and _key='".$_key."' and iid='".$msg["id"]."' ".get_qj_ucon_all_dpid($msg_login["charge_uid"],"")." and color='".$msg["color"]."' and bx='".$m1["gg"]."'");
|
|
$num1=deel_0(deel_num($tmp["num"]));
|
|
}
|
|
$js_check_str.=$num1.",";
|
|
$xj+=$num1;
|
|
//合计尺码数量
|
|
$var_xj_size="xj_size_".$arr_size_merged[$k];
|
|
$$var_xj_size+=$num1;
|
|
$tmp1=get_db_msg("select title from ".$table_pre."size where iid='".$m_kh["size_group"]."' and no='".strtolower($arr_size_merged[$k])."'");
|
|
$td_size1.="\"3|".$tmp1["title"]."|".strtolower($arr_size_merged[$k])."|".$bg_input_num1."|".$num1."|".$disable_color2."\",";
|
|
$strarr1.="{\"no\":\"3\",\"id\":\"num".$j."_".strtolower($arr_size_merged[$k])."\",\"size\":\"".$tmp1["title"]."\",\"bg\":\"".$bg_input_num1."\",\"disable\":\"".$disable_color2."\",\"value\":\"".$num1."\"},";
|
|
}else{
|
|
$td_size1.="\"9| \",";
|
|
$strarr1.="{\"no\":\"9\",\"value\":\" \"},";
|
|
}
|
|
}
|
|
//$num_arr.="\"7|".$m1["gg"]."|".get_gg_title($m1["gg"])."\",";
|
|
|
|
//$num_arr.=$td_size1."\"5|".$xj."\",";
|
|
$strarr1.="{\"no\":\"5\",\"value\":\"".$xj."\"},";
|
|
if($i1>0){
|
|
//$num_arr.="],";
|
|
}else{
|
|
//$num_arr.=$td_pj."],";
|
|
//$strarr.="{\"no\":\"6\",\"value\":\"".$rc."|".$tmp_dis."\"},";
|
|
}
|
|
$num_hang++;
|
|
$total+=$xj;
|
|
$i1++;
|
|
//$strarr1=substr($strarr1,0,-1);
|
|
$num_arr.="\"dd\":[".deel_end($strarr.$strarr1)."]},";
|
|
$j++;
|
|
}
|
|
}else{
|
|
if($m_kh["size_group"]==$child_sizegroup_id){
|
|
//童装,不能输入
|
|
$disable_color=" disabled";
|
|
}
|
|
//echo $m_kh["no"]."|".$msg["color"]."|".$m_kh["size_group"]."|".$child_sizegroup_id."|".$disable_color."<br>";
|
|
//无规格
|
|
$ks_bx_num.=count($arrBx).",";
|
|
//$num_arr.="[\"".count($arrBx)."\",".$m_kh["id"].",\"".$msg["color"]."\",\"1|".$m_kh["no"]."<br>".get_cate_title_no("category",$m_kh["category"])."<br>".get_price_dp($uid,$m_kh["id"])."元".$price_zk."\",\"2|".deel_js_var("<span style=\"".$sty1."\">".$msg["color"]."-<br>".get_cate_title_no("color",$msg["color"])."</span>")."\",";
|
|
$num_arr.="{\"ggs\":\"".count($arrBx)."\",\"ka\":\"".$colorka."\",\"khid\":\"".$m_kh["id"]."\",\"kh_dj\":\"".get_cate_title_no("kh_dj",$m_kh["kh_dj"])."\",\"color\":\"".$msg["color"]."\",\"sty1\":\"".$sty1."\",\"pic\":\"".$tmp_pic."\",\"pic_w\":".$tmppic[0].",\"pic_h\":".$tmppic[1].",\"xj\":\"".$rc."\",\"pj_remark\":\"".$pj_remark."\",\"bx\":\"\",";
|
|
if($pm_ms=="m2"){
|
|
$num_arr.="\"default_pm\":\"".$default_pm."\",";
|
|
$num_arr.="\"default_pm_id\":\"".$default_pm_id."\",";
|
|
$num_arr.="\"pms\":[".$pm_op."],";
|
|
}
|
|
$strarr.="{\"no\":\"1\",\"value\":\"".$m_kh["no"]."<br>".get_cate_title_no("category",$m_kh["category"])."<br>".get_price_dp($uid,$m_kh["id"])."元".$price_zk."\"},";
|
|
$strarr.="{\"no\":\"2\",\"value\":\"".$msg["color"]."-<br>".get_cate_title_no("color",$msg["color"])."\"},";
|
|
//print_r($arrBx);
|
|
for($i1=0;$i1<count($arrBx);$i1++){
|
|
$arr_kh_size=explode(",",$arrBx[$i1][1]);
|
|
$tmp_bx=$arrBx[$i1][0];
|
|
//print_r($tmp_bx."-");
|
|
$tmp_size=$arrBx[$i1][1];
|
|
if($m_kh["size_group"]==$child_sizegroup_id){
|
|
$bx_title=get_child_bx_title($tmp_bx);
|
|
}else if($m_kh["size_group"]==$bx_sizegroup_id){
|
|
$bx_title=$tmp_bx;
|
|
}else{
|
|
$tmp_bx=deel_0($tmp_bx);
|
|
$bx_title=$tmp_bx;
|
|
}
|
|
$strarr1="";
|
|
if($i1>0){
|
|
//$num_arr.="[\"1\",".$m_kh["id"].",\"".$msg["color"]."\",";
|
|
$num_arr.="{\"ggs\":\"".count($arrBx)."\",\"khid\":\"".$m_kh["id"]."\",\"kh_dj\":\"".get_cate_title_no("kh_dj",$m_kh["kh_dj"])."\",\"color\":\"".$msg["color"]."\",\"sty1\":\"".$sty1."\",\"pic\":\"".$tmp_pic."\",\"pic_w\":".$tmppic[0].",\"pic_h\":".$tmppic[1].",\"xj\":\"".$rc."\",\"pj_remark\":\"".$pj_remark."\",";
|
|
}
|
|
if($m_kh["size_group"]==$bx_sizegroup_id)
|
|
$strarr1.="{\"no\":\"1\",\"id\":\"color_td_".$tmp_bx."\",\"value\":\"".$tmp_bx."\"},";
|
|
else if($m_kh["size_group"]==$child_sizegroup_id)
|
|
$strarr1.="{\"no\":\"1\",\"id\":\"color_td_".$bx_title."\",\"value\":\"".$bx_title."\"},";
|
|
//
|
|
$td_size1="";
|
|
if($have_ggk!="n"){
|
|
//$num_arr.="\"7||\",";
|
|
$strarr1.="{\"no\":\"7\",\"value\":\"\",\"title\":\"\"},";
|
|
}
|
|
if($have_ggk=="y"){
|
|
//$num_arr.="\"9| \",";
|
|
$strarr1.="{\"no\":\"9\",\"value\":\" \"},";
|
|
}
|
|
if($bx_sizegroup_id>0 || $child_sizegroup_id>0){
|
|
//$num_arr.="\"4|".$arrBx[$i1][0]."\",";
|
|
$strarr1.="{\"no\":\"4\",\"value\":\"".$bx_title."\"},";
|
|
}
|
|
$xj=0;
|
|
for($k=0;$k<$num_size_total;$k++){
|
|
if(check_size_not($m_kh["no"],$msg["color"],$bx_title,$arr_size_merged[$k])=="y"){
|
|
$disable_color2=" disabled";
|
|
$bg_input_num="#cccccc";
|
|
}else{
|
|
$disable_color2=$disable_color;
|
|
$bg_input_num="#ffffff";
|
|
}
|
|
if(check_md($m_kh["no"],$msg["color"],$bx_title,$arr_size_merged[$k],$msg_login["dj"])=="n"){
|
|
$bg_input_num1=$bg_input_num;
|
|
}else{
|
|
$bg_input_num1="#00ff00";
|
|
$have_md="y";
|
|
}
|
|
if(in_array($arr_size_merged[$k],$arr_kh_size)){
|
|
if($msg_login["face"]=="4"){
|
|
$num1=get_order_num($m_kh["id"],$msg["color"],$bx_title,$arr_size_merged[$k]);
|
|
}
|
|
if($msg_login["face"]=="2"){
|
|
$tmp=get_db_msg("select sum(num_".strtolower($arr_size_merged[$k]).") 'num' from ".$table_pre."order where ka<>'y' and _key='".$_key."' and iid='".$m_kh["id"]."' ".get_qj_ucon_all_dpid($msg_login["charge_uid"],"")." and color='".$msg["color"]."' and bx='".$bx_title."'");
|
|
$num1=deel_num($tmp["num"]);
|
|
}
|
|
$js_check_str.=$num1.",";
|
|
$xj+=$num1;
|
|
//合计尺码数量
|
|
$var_xj_size="xj_size_".$arr_size_merged[$k];
|
|
$$var_xj_size+=$num1;
|
|
$tmp1=get_db_msg("select title from ".$table_pre."size where iid='".$m_kh["size_group"]."' and no='".strtolower($arr_size_merged[$k])."'");
|
|
$td_size1.="\"3|".$tmp1["title"]."|".strtolower($arr_size_merged[$k])."|".$bg_input_num1."|".$num1."|".$disable_color2."\",";
|
|
//$strarr.="{\"no\":\"3\",\"value\":\"".$tmp1["title"]."|".strtolower($arr_size_merged[$k])."|".$bg_input_num1."|".$num1."|".$disable_color2."\"},";
|
|
$strarr1.="{\"no\":\"3\",\"id\":\"num".$j."_".strtolower($arr_size_merged[$k])."\",\"size\":\"".$tmp1["title"]."\",\"bg\":\"".$bg_input_num1."\",\"disable\":\"".$disable_color2."\",\"value\":\"".$num1."\"},";
|
|
}else{
|
|
$td_size1.="\"9| \",";
|
|
$strarr1.="{\"no\":\"9\",\"value\":\" \"},";
|
|
}
|
|
}
|
|
|
|
//$num_arr.=$td_size1."\"5|".$xj."\",";
|
|
$strarr1.="{\"no\":\"5\",\"value\":\"".$xj."\"},";
|
|
if($i1>0){
|
|
//$num_arr.="],";
|
|
}else{
|
|
//$num_arr.=$td_pj."],";
|
|
//$strarr.="{\"no\":\"6\",\"value\":\"".$rc."|".$tmp_dis."\"},";
|
|
}
|
|
$num_hang++;
|
|
$total+=$xj;
|
|
$num_arr.="\"dd\":[".deel_end($strarr.$strarr1)."]},";
|
|
$j++;
|
|
}
|
|
//$strarr=substr($strarr,0,-1);
|
|
|
|
}
|
|
|
|
|
|
}
|
|
}
|
|
|
|
$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."],";
|
|
|
|
$json_data.="\"length\":\"".$j."\",";
|
|
$json_data.="\"total\":\"".$total."\",";
|
|
if($kh_color)
|
|
$kh_color=substr($kh_color,0,-1);
|
|
$json_data.="\"kh_color\":\"".$kh_color."\",";
|
|
$num_arr=substr($num_arr,0,-1);
|
|
$json_data.="\"dks\":[".$num_arr."],";
|
|
|
|
$arr_kh_pic=substr($arr_kh_pic,0,-1);
|
|
$json_data.="\"pics\":[".$arr_kh_pic."],";
|
|
if($have_md=="y")
|
|
$msg_gz.="亮色标识为买断尺码!";
|
|
$json_data.="\"msg_tip\":\"".$msg_tip."\",";
|
|
if($ks_bx_num)
|
|
$ks_bx_num=substr($ks_bx_num,0,-1);
|
|
$json_data.="\"ks_bx_num\":\"".$ks_bx_num."\",";
|
|
if($js_check_str)
|
|
$js_check_str=substr($js_check_str,0,-1);
|
|
$json_data.="\"js_check_str\":\"".$js_check_str."\",";
|
|
$hj_arr=$hj_size="";
|
|
for($k=0;$k<$num_size_total;$k++){
|
|
$var_xj_size="xj_size_".$arr_size_merged[$k];
|
|
//$hj_arr.=add_0($$var_xj_size).",";
|
|
//$hj_size.=$arr_size_merged[$k].",";
|
|
$hj_arr.="{\"hj_size\":\"".$arr_size_merged[$k]."\",\"hj_arr\":\"".add_0($$var_xj_size)."\"},";
|
|
}
|
|
$hj_arr=substr($hj_arr,0,-1);
|
|
$json_data.="\"hj_arr\":[".$hj_arr."],";
|
|
//$hj_arr.="";
|
|
//$hj_size.="";
|
|
$hj_colspan=($bx_sizegroup_id>0 || $child_sizegroup_id>0)?3:2;
|
|
if($have_ggk=="y"){
|
|
$hj_colspan+=2;
|
|
}else if($have_ggk=="b"){
|
|
$hj_colspan+=1;
|
|
}
|
|
$json_data.="\"hj_colspan\":\"".$hj_colspan."\",";
|
|
if($tmp_race)
|
|
$this_race.="{".substr($tmp_race,0,-1)."}";
|
|
$json_data.="\"tmp_race\":\"".substr($tmp_race,0,-1)."\",";
|
|
$content_kh.="</table>";
|
|
//上一组、下一组
|
|
$button_sxk="";
|
|
$pre_xh=get_db_msg("select zsh from ".$table_pre."kh_dp where zsh<'".$zsh."' order by zsh desc limit 0,1");
|
|
$next_xh=get_db_msg("select zsh from ".$table_pre."kh_dp where zsh>'".$zsh."' order by zsh limit 0,1");
|
|
$str_sxk="[\"".$pre_xh["zsh"]."\",\"".$next_xh["zsh"]."\"]";
|
|
$json_data.="\"prev\":\"".$pre_xh["zsh"]."\",";
|
|
$json_data.="\"next\":\"".$next_xh["zsh"]."\",";
|
|
$dp_remark=trim($msg_dp["remark"]);
|
|
$json_data.="\"dp_remark\":\"".$dp_remark."\",";
|
|
//
|
|
$str_zd="";
|
|
for($i=0;$i<5;$i++){
|
|
if(trim($msg_dp["zd".($i+1)]))
|
|
$str_zd.=",".$msg_dp["zd".($i+1)];
|
|
}
|
|
$dp_title=trim($msg_dp["title"].$str_zd);
|
|
$json_data.="\"dp_title\":\"".$dp_title."\",";
|
|
|
|
//$pic_dp=get_kh_dp_big($msg_dp["pic"],$flag_pad_offline)."|".out_good_pic_set(get_kh_dp_big($msg_dp["pic"],$flag_pad_offline),$tmpl_m2_dp_pic_width,$tmpl_m2_dp_pic_height);
|
|
$tmppic=out_good_pic_set_arr(get_kh_dp_big($msg_dp["pic"],$flag_pad_offline),$tmpl_m2_dp_pic_width,$tmpl_m2_dp_pic_height);
|
|
$str_pic_dp="{\"pic\":\"".get_kh_dp_big($msg_dp["pic"],$flag_pad_offline)."\",\"pic_w\":".$tmppic[0].",\"pic_h\":".$tmppic[1]."}";
|
|
$json_data.="\"pic_big\":\"".get_kh_dp_big($msg_dp["pic"],$flag_pad_offline)."\",";
|
|
$json_data.="\"pic_big_w\":".$tmppic[0].",";
|
|
$json_data.="\"pic_big_h\":".$tmppic[1].",";
|
|
$json_data.="\"pic_dp\":[".$str_pic_dp."],";
|
|
|
|
$json_data.="\"translate_gg\":\"".d_translate("gg")."\",";
|
|
$tmp=arr2str($sys_gg_zd,"v");
|
|
$tmp_a=explode(",",$tmp);
|
|
$json_data.="\"translate_gg1\":\"".$tmp_a[0]."\",";
|
|
$json_data.="\"translate_dhbs\":\"".d_translate("dhbs")."\",";
|
|
//if($i==0)
|
|
//echo_wrong("该搭配记录不存在");
|
|
//$js_onload=" onload=\"dhlight_kh('0')\"";
|
|
//$json_data.="\"js_onload\":\"".$js_onload."\",";
|
|
}
|
|
break;
|
|
case "save":
|
|
if($go_url){
|
|
$url=$go_url;
|
|
}else{
|
|
$url=$_SERVER[PHP_SELF]."?_m=".$_m."&zsh=".$zsh."&rurl=".urlencode($rurl)."&rurl0=".urlencode($rurl0);
|
|
|
|
}
|
|
$msg_err="";
|
|
if($order_close=="y"){
|
|
//alert_and_back("订单保存失败,原因是系统订单已经关闭!");
|
|
$msg_err="订单保存失败,原因是系统订单已经关闭!";
|
|
}
|
|
if($msg_login["is_checked"]=="y" && !$msg_err){
|
|
//alert_and_back("订单保存失败,原因是本用户订单已经确认!");
|
|
$msg_err="订单保存失败,原因是本用户订单已经确认!";
|
|
}
|
|
if($msg_login["is_jd"]=="y" && !$msg_err){
|
|
//alert_and_back("订单保存失败,原因是本用户订单已经提交!");
|
|
$msg_err="订单保存失败,原因是本用户订单已经提交!";
|
|
}
|
|
//判断代理
|
|
$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($msg_dl["is_jd"]=="y" && !$msg_err){
|
|
//alert_and_back("订单保存失败,原因是您的代理已经提交!");
|
|
$msg_err="订单保存失败,原因是您的代理已经提交!";
|
|
}
|
|
if($msg_dl["is_checked"]=="y" && !$msg_err){
|
|
//alert_and_back("订单保存失败,原因是您的代理订单已经确认!");
|
|
$msg_err="订单保存失败,原因是您的代理订单已经确认!";
|
|
}
|
|
}
|
|
$arr_ks_bx_num=explode(",",$ks_bx_num);
|
|
//print_r($ks_bx_num);
|
|
//---------------判断搭配规则
|
|
$m1=get_db_msg("select id,gz from ".$table_pre."kh_dp where zsh='".$zsh."'");
|
|
$id=$m1["id"];
|
|
$arr_tmp=array();
|
|
$k=0;
|
|
$str_kh_num="";
|
|
for($i=0;$i<count($arr_ks_bx_num);$i++){
|
|
$v_khid="khid_".$i;
|
|
$v_color="color_".$i;
|
|
$msg_tmp=get_db_msg("select no from ".$table_pre."kh where id='".$$v_khid."'");
|
|
$msg_tmp1=get_db_msg("select sum(num) 'num' from ".$table_pre."order where uid='".$uid."' and iid='".$$v_khid."' and color='".$$v_color."' and _key='".$_key."'");
|
|
$v_khid_num="num_".$msg_tmp["no"];
|
|
$arr_tmp[$i]=0;
|
|
for($j=0;$j<$arr_ks_bx_num[$i];$j++){
|
|
for($s1=1;$s1<=$sys_size_num;$s1++){
|
|
$var1="num".$k."_".$s1;
|
|
if($$var1>$order_large_num && !$msg_err){
|
|
//alert_and_back("对不起,您输入的订量(".$$var1.")超过了单尺码最大订量限制(".$order_large_num."),无法保存,请检查!");
|
|
$msg_err="对不起,您输入的订量(".$$var1.")超过了单尺码最大订量限制(".$order_large_num."),无法保存,请检查!";
|
|
}
|
|
$arr_tmp[$i]+=$$var1;
|
|
$$v_khid_num+=$$var1;
|
|
}
|
|
$k++;
|
|
}
|
|
$alter_num=$$v_khid_num-$msg_tmp1["num"];
|
|
$str_kh_num.=$msg_tmp["no"]."|".$alter_num.",";
|
|
}
|
|
if($str_kh_num)
|
|
$str_kh_num=substr($str_kh_num,0,-1);
|
|
if($m1["gz"]=="1"){
|
|
//必定搭配规则
|
|
if(check_arr_not_zero($arr_tmp)==false && !$msg_err){
|
|
//alert_and_back("该组款号要求每款都有订货量,请检查!");
|
|
$msg_err="该组款号要求每款都有订货量,请检查!";
|
|
}
|
|
}else if($m1["gz"]=="2"){
|
|
//1:1搭配规则
|
|
if(check_arr_equal($arr_tmp)==false && !$msg_err){
|
|
//alert_and_back("该组款号要求每款订货量相同,请检查!");
|
|
$msg_err="该组款号要求每款订货量相同,请检查!";
|
|
}
|
|
}
|
|
|
|
//---------------判断订货规则
|
|
$k=0;
|
|
$errm="";
|
|
for($i=0;$i<count($arr_ks_bx_num);$i++){
|
|
$v_khid="khid_".$i;
|
|
$v_color="color_".$i;
|
|
$msg=get_db_msg("select * from ".$table_pre."kh where id='".$$v_khid."'");
|
|
$num1=0;
|
|
for($j=0;$j<$arr_ks_bx_num[$i];$j++){
|
|
for($s1=1;$s1<=$sys_size_num;$s1++){
|
|
$var1="num".$k."_".$s1;
|
|
$num1+=$$var1;
|
|
}
|
|
$k++;
|
|
}
|
|
$errm.=check_dhgz_bdks($msg,$$v_color,$num1);
|
|
$errm.=check_dhgz_qdl($msg,$$v_color,$num1);
|
|
//检查款号规则
|
|
$tmp=get_db_msg("select sum(num) 'num' from ".$table_pre."order where uid='".$uid."' and iid='".$$v_khid."' and color<>'".$$v_color."' and _key='".$_key."'");
|
|
$tmp_kh_num=$tmp["num"]+$num1;
|
|
$errm.=check_dhgz_bdk($msg,$tmp_kh_num);
|
|
$errm.=check_dhgz_qdl($msg,"",$tmp_kh_num);
|
|
$errm.=check_dhgz_glk($msg["no"],$tmp_kh_num,$str_kh_num);
|
|
}
|
|
if(!$msg_err){
|
|
$msg_err=$errm;
|
|
}
|
|
|
|
if($msg_err){
|
|
$json_data.="\"code\":0,\"msg\":\"".$msg_err."\",";
|
|
}else{
|
|
//$json_data.="\"code\":\"".$zsh."\",";
|
|
$num_hang=0;
|
|
//取得选项
|
|
$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"];
|
|
}
|
|
$ks_list=0;
|
|
for($i=0;$i<count($arr_ks_bx_num);$i++){
|
|
//保存订单
|
|
if($i>0)
|
|
$ks_list+=$arr_ks_bx_num[$i-1];
|
|
$v_khid="khid_".$ks_list;
|
|
$v_color="color_".$ks_list;
|
|
$msg=get_db_msg("select * from ".$table_pre."kh where id='".$$v_khid."'");
|
|
if($msg["size_group"]==$child_sizegroup_id){
|
|
for($j=0;$j<$arr_ks_bx_num[$i];$j++){
|
|
$num_hang++;
|
|
}
|
|
//童装不保存
|
|
}else{
|
|
//非童装
|
|
$arr_color=explode(",",$msg["color"]);
|
|
$arr_color_ka=explode(",",$msg["color_ka"]);
|
|
$arr_size=explode(",",$msg["size"]);
|
|
$tmp_old=get_db_msg("select sum(".get_size_sql("sum").") 'num' from ".$table_pre."order where uid='".$uid."' and iid='".$$v_khid."' and color='".$$v_color."' and _key='".$_key."'");
|
|
$log_hd_old_num=$tmp_old["num"];
|
|
$tmp_old=get_db_msg("select sum(".get_size_sql("sum").") 'num' from ".$table_pre."order where uid='".$uid."' and iid='".$$v_khid."' and _key='".$_key."'");
|
|
$log_hd_old_num_kh=$tmp_old["num"];
|
|
$tmp_total_num=0;
|
|
for($j=0;$j<$arr_ks_bx_num[$i];$j++){
|
|
$c=0;
|
|
$sql_size1=$sql_size2="";
|
|
for($s1=1;$s1<=$sys_size_num;$s1++){
|
|
$var1="num".$num_hang."_".$s1;
|
|
$c+=$$var1;
|
|
$sql_size1.="num_".$s1."='".deel_num($$var1)."',";
|
|
$sql_size2.=",'".deel_num($$var1)."'";
|
|
}
|
|
$c1=0;
|
|
$cypm="";
|
|
for($s1=1;$s1<=count($arr_size);$s1++){
|
|
$var1="num".$num_hang."_".$s1;
|
|
$c1+=$$var1;
|
|
$cypm.=deel_num($$var1).":";
|
|
}
|
|
if($c1>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);
|
|
}
|
|
$varBx="bx_".$num_hang;
|
|
$check=get_db_msg("select id from ".$table_pre."order where _key='".$_key."' and uid='".$uid."' and iid='".$$v_khid."' and color='".$$v_color."' and bx='".$$varBx."'");
|
|
//echo $msg["no"]."|".$$v_color."|".$$varBx."|".$c."--<br>";
|
|
$tmp_total_num+=$c;
|
|
if($check["id"]){
|
|
if($c>0){
|
|
$q="update ".$table_pre."order set ".$sql_size1."add_date='".time()."' where id='".$check["id"]."'";
|
|
$db->query($q);
|
|
update_order_log($uid,"update ".$table_pre."order set ".$sql_size1."add_date='".time()."' where _key='".$_key."' and uid='".$uid."' and iid='".$$v_khid."' and color='".$$v_color."' and bx='".$$varBx."' and _key='".$_key."'");
|
|
cache_order($uid,$$v_khid,$$v_color,$$varBx);
|
|
}else{
|
|
$q="delete from ".$table_pre."order where id='".$check["id"]."'";
|
|
update_order_log($uid,"delete from ".$table_pre."order where _key='".$_key."' and uid='".$uid."' and iid='".$$v_khid."' and color='".$$v_color."' and bx='".$$varBx."'");
|
|
$db->query($q);
|
|
}
|
|
}else{
|
|
if($c>0){
|
|
//取得选项
|
|
$sql1=$sql2="";
|
|
for($i1=0;$i1<count($arr_select_no);$i1++){
|
|
$sql1.=$arr_select_no[$i1].",";
|
|
$sql2.="'".$msg[$arr_select_no[$i1]]."',";
|
|
}
|
|
$q="insert into ".$table_pre."order (uid,upath,iid,no,".$sql1."jgd,color,bx,is_sp,size_group_id,".get_size_sql("insert1").",_key,sx,add_date) values ('".$uid."','".$upath."','".$$v_khid."','".$msg["no"]."',".$sql2."'".get_jgd($msg["price"])."','".$$v_color."','".$$varBx."','".$msg["is_sp"]."','".$msg["size_group"]."'".$sql_size2.",'".$_key."','".get_sx($$v_color)."','".time()."')";
|
|
$db->query($q);
|
|
update_order_log($uid,"insert into ".$table_pre."order (uid,upath,iid,no,".$sql1."jgd,color,bx,is_sp,size_group_id,".get_size_sql("insert1").",_key,sx,add_date) values ('".$uid."','".$upath."','".$$v_khid."','".$msg["no"]."',".$sql2."'".get_jgd($msg["price"])."','".$$v_color."','".$$varBx."','".$msg["is_sp"]."','".$msg["size_group"]."'".$sql_size2.",'".$_key."','".get_sx($$v_color)."','".time()."')");
|
|
cache_order($uid,$$v_khid,$$v_color,$$varBx);
|
|
}
|
|
}
|
|
$num_hang++;
|
|
}
|
|
count_ph($uid,$$v_khid,$$v_color);
|
|
$khid=$$v_khid;
|
|
$log_hd_num=$tmp_total_num-$log_hd_old_num;
|
|
//
|
|
update_log_hd();
|
|
}
|
|
}
|
|
//$json_data.="\"q\":\"".$q."\",";
|
|
set_order_total($uid);
|
|
$json_data.="\"code\":101,";
|
|
}
|
|
break;
|
|
default:
|
|
//----------------------------------------------搭配模式
|
|
if($sys_zydp=="y"){
|
|
$s_type=$s_type?$s_type:"1";
|
|
}
|
|
|
|
$num_dp_zd=0;
|
|
if(is_array($sys_dp_zd)){
|
|
$num=count($sys_dp_zd);
|
|
$num_dp_zd=($num<5)?$num:5;
|
|
}
|
|
//
|
|
$json_data.="\"sys_zydp\":\"".$sys_zydp."\",";
|
|
//require THIS_FILE_ROOT."/include/page_js.class.php";
|
|
$w2=$tmpl_m1_pic_width;
|
|
$h2=$tmpl_m1_pic_height;
|
|
$page_size=$tmpl_m1_page_size;
|
|
|
|
$json_data.="\"w2\":\"".$w2."\",";
|
|
$json_data.="\"h2\":\"".$h2."\",";
|
|
$json_data.="\"page_size\":\"".$page_size."\",";
|
|
|
|
$page=$page>0?$page:1;
|
|
$limit=$limit>0?$limit:10;
|
|
$start=($page-1)*$limit;
|
|
$end=$limit;
|
|
|
|
//
|
|
|
|
$sql_con=" where zsh>0 and ";
|
|
if($s_type){
|
|
$sql_con.=get_sql_client_type($s_type);
|
|
}
|
|
/*if($s_no){
|
|
$sql_con.="kh like '%".$s_no."%' and ";
|
|
$s_zsh="";
|
|
$s_title="";
|
|
}*/
|
|
$kl=strlen($s_keyword);
|
|
if($kl<=3 && $s_keyword && is_numeric($s_keyword)){
|
|
if($xh_ms=="2"){
|
|
$tmp=get_db_msg("select kh as no from web_kh_xh where xh='".$s_keyword."'");
|
|
}else{
|
|
$tmp=get_db_msg("select no from web_kh where xh='".$s_keyword."'");
|
|
}
|
|
$sql_con.="kh='".$tmp["no"]."' and";
|
|
for($i=0;$i<$num_dp_zd;$i++){
|
|
$v1="s_zd".($i+1);
|
|
$$v="";
|
|
}
|
|
$s_zsh="";
|
|
$s_title="";
|
|
}
|
|
if($kl>=3){
|
|
if(is_numeric($s_keyword)){
|
|
if($xh_ms=="2"){
|
|
$tmp=get_db_msg("select kh as no from web_kh_xh where xh='".$s_keyword."'");
|
|
}else{
|
|
$tmp=get_db_msg("select no from web_kh where xh='".$s_keyword."'");
|
|
}
|
|
$sql_con.=" (kh='".$tmp["no"]."' or kh like '%".$s_keyword."%') and";
|
|
}else{
|
|
$sql_con.=" (kh like '%".$s_keyword."%') and";
|
|
}
|
|
for($i=0;$i<$num_dp_zd;$i++){
|
|
$v1="s_zd".($i+1);
|
|
$$v="";
|
|
}
|
|
$s_zsh="";
|
|
$s_title="";
|
|
}
|
|
if($s_title){
|
|
$sql_con.="title like '%".$s_title."%' and ";
|
|
$s_keyword="";
|
|
$s_zsh="";
|
|
}
|
|
for($i=0;$i<$num_dp_zd;$i++){
|
|
$v1="s_zd".($i+1);
|
|
if($$v1)
|
|
$sql_con.="zd".($i+1)."='".$$v1."' and ";
|
|
}
|
|
if($sql_con)
|
|
$sql_con=substr($sql_con,0,-4);
|
|
//$sql_order=str_replace("!"," desc",$order);
|
|
|
|
$json_data.="\"s_keyword\":\"".$s_keyword."\",";
|
|
$json_data.="\"s_zsh\":\"".$s_zsh."\",";
|
|
$json_data.="\"s_title\":\"".$s_title."\",";
|
|
|
|
$query="select count(distinct zsh) 'total' from ".$table_pre."kh_dp ".$sql_con;
|
|
$res=$db->query($query);
|
|
$msg=$db->fetch_array($res);
|
|
$total=$msg["total"];
|
|
//page class
|
|
|
|
|
|
//定制条件
|
|
$query="select * from ".$table_pre."kh_dp ".$sql_con." group by zsh order by zsh limit ".$start.",".$end;
|
|
//echo $query."<br>";
|
|
$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.",\"content_list\":[";
|
|
$data_str="";
|
|
|
|
$content_list="[";
|
|
for($count=0;$count<$end;$count++){
|
|
$msg=$db->fetch_array($res);
|
|
if($msg["id"]>0){
|
|
//图片获取规则
|
|
$pic=get_kh_dp_mini($msg["pic"],$flag_pad_offline);
|
|
if(($msg_login["path"]."-".$msg_login["id"])==$msg["upath"])
|
|
$is_my_dp="y";
|
|
else
|
|
$is_my_dp="n";
|
|
$content_list.=$msg["zsh"].",\"".$pic."\",\"".str_replace("\"","'",out_good_pic_set($pic,$w2,$h2))."\",\"".$msg["title"]."\",\"".$is_my_dp."\",";
|
|
$ck=out_good_pic_set_arr($pic,$w2,$h2);
|
|
$data_str.="{\"zsh\":".$msg["zsh"].",\"title\":\"".$msg["title"]."\",\"is_my_dp\":\"".$is_my_dp."\",\"pic\":\"".$pic."\",\"pic_w\":".$ck[0].",\"pic_h\":".$ck[1]."},";
|
|
//
|
|
$rnum++;
|
|
}
|
|
}
|
|
$json_data.=substr($data_str,0,-1)."],";
|
|
$content_list.="]";
|
|
|
|
//自定义筛选条件
|
|
$str_arr_zy="";
|
|
$select_dz="";
|
|
if($sys_zycl=="y"){
|
|
$tmp1=explode(",",$sys_zydp_client_type);
|
|
foreach($tmp1 as $k1 => $v1){
|
|
$tmp2=explode("|",$v1);
|
|
$str_arr_zy.="{\"no\":\"".$tmp2[0]."\",\"title\":\"".$tmp2[1]."\"},";
|
|
/*foreach($tmp2 as $k2 => $v2){
|
|
$str_arr_zy.="{\"no\":\"".$k2."\",\"title\":\"".$v2."\"},";
|
|
}*/
|
|
}
|
|
$str_arr_zy=deel_end($str_arr_zy);
|
|
$select_dz.="{\"no\":\"s_type\",\"title\":\"搭配类型\",\"value\":\"".$s_type."\",\"op\":[".$str_arr_zy."]},";
|
|
}
|
|
|
|
$str_arr_select="";
|
|
for($i=0;$i<$num_dp_zd;$i++){
|
|
$v1="s_zd".($i+1);
|
|
$str_arr_select.="\"".$v1."\",\"".$sys_dp_zd[$i]."\",\"".$$v1."\",";
|
|
$r=$db->query("select zd".($i+1)." from ".$table_pre."kh_dp group by zd".($i+1)." order by zd".($i+1));
|
|
$op="[";
|
|
$tmp="";
|
|
while($m=$db->fetch_array($r)){
|
|
$op.="\"".$m["zd".($i+1)]."|".$m["zd".($i+1)]."\",";
|
|
$tmp.="{\"no\":\"".$m["zd".($i+1)]."\",\"title\":\"".$m["zd".($i+1)]."\"},";
|
|
}
|
|
$tmp=deel_end($tmp);
|
|
$select_dz.="{\"no\":\"".$v1."\",\"title\":\"".$sys_dp_zd[$i]."\",\"value\":\"".$$v1."\",\"op\":[".$tmp."]},";
|
|
$op.="],";
|
|
$str_arr_select.=$op;
|
|
}
|
|
$select_dz=deel_end($select_dz);
|
|
$json_data.="\"select_dz\":[".$select_dz."],";
|
|
|
|
$total_page=ceil($total/$limit);
|
|
$json_data.="\"total_page\":".$total_page.",";
|
|
$json_data.="\"page\":".$page.",";
|
|
break;
|
|
}
|
|
}
|
|
|
|
$json_data=substr($json_data,0,-1)."}";
|
|
echo $json_data;
|
|
?>
|