ysarea.php 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. <?
  2. include("../config/conn.php");
  3. include("../config/function.php");
  4. sesCheck();
  5. $bh=$_GET[bh];
  6. $userid=returnuserid($_SESSION["SHOPUSER"]);
  7. while0("*","yjcode_pro where bh='".$bh."' and userid=".$userid);if(!$row=mysql_fetch_array($res)){exit;}
  8. if($_GET[control]=="add"){
  9. $area="|".sqlzhuru($_POST[area1]).",".sqlzhuru($_POST[add2]).",".sqlzhuru($_POST[add3])."|";
  10. if(strstr($row[ysarea],$area)==""){$areav=$row[ysarea].$area;updatetable("yjcode_pro","ysarea='".$areav."' where id=".$row[id]." and userid=".$userid);}
  11. php_toheader("ysarea.php?bh=".$bh);
  12. }elseif($_GET[control]=="del"){
  13. $a=preg_split("/xcf/",$_GET[aid]);
  14. $str=$row[ysarea];
  15. for($i=0;$i<=count($a);$i++){
  16. if($a[$i]!=""){
  17. $ss="|".$a[$i]."|";
  18. $str=str_replace($ss,"",$str);
  19. }
  20. }
  21. updatetable("yjcode_pro","ysarea='".$str."' where id=".$row[id]." and userid=".$userid);
  22. php_toheader("ysarea.php?bh=".$bh);
  23. }
  24. ?>
  25. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  26. <html xmlns="http://www.w3.org/1999/xhtml">
  27. <head>
  28. <meta http-equiv="x-ua-compatible" content="ie=7" />
  29. <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
  30. <title>销售区域设置</title>
  31. <style type="text/css">
  32. body{margin:0;font-size:12px;text-align:center;color:#333;word-wrap:break-word;font-family:"Microsoft YaHei",微软雅黑,"MicrosoftJhengHei",华文细黑,STHeiti,MingLiu;}
  33. *{margin:0 auto;padding:0;}
  34. ul{list-style-type:none;margin:0;padding:0;}
  35. .uk{float:left;margin:10px 0 0 0;width:600px;font-size:14px;border-bottom:#e1e1e2 solid 1px;}
  36. .uk li{float:left;}
  37. .uk .l1{width:530px;height:45px;padding:0 0 0 10px;}
  38. .uk .l1 .fd{float:left;margin:2px 3px 0 0;}
  39. .uk .l1 .inp{float:left;border:#CCCCCC solid 1px;height:31px;margin-right:2px;font-family:"Microsoft YaHei",微软雅黑,"MicrosoftJhengHei",华文细黑,STHeiti,MingLiu;}
  40. .uk .l2{width:60px;height:45px;}
  41. .uk .l2 input{float:left;color:#fff;font-size:14px;width:50px;height:31px;border:0;background-color:#ff6600;cursor:pointer;}
  42. .u1{float:left;width:290px;height:30px;text-align:left;border-bottom:#e1e1e2 solid 1px;border-right:#e1e1e2 solid 1px;font-size:14px;}
  43. .u1 li{float:left;}
  44. .u1 .l1{width:20px;padding:6px 0 0 10px;}
  45. .u1 .l2{width:260px;padding:5px 0 0 0;height:22px;overflow:hidden;}
  46. .control{float:left;width:600px;height:35px;border-bottom:#e1e1e2 solid 1px;background-color:#F5F6FA;}
  47. .control a{float:left;margin:5px 0 0 10px;padding:4px 10px 0 10px;height:21px;background-color:#1E9FFF;color:#fff;text-decoration:none;}
  48. .list{float:left;width:600px;height:364px;overflow-y:scroll;}
  49. </style>
  50. <script language="javascript" src="../js/jquery.min.js"></script>
  51. <script language="javascript" src="../js/layer.js"></script>
  52. <script language="javascript">
  53. function area1cha(){
  54. farea2.location="../tem/area2.php?area1id="+document.getElementById("area1").value;
  55. }
  56. function tj(){
  57. layer.msg('正在提交', {icon: 16 ,time: 0,shade :0.25});
  58. f1.action="ysarea.php?control=add&bh=<?=$bh?>";
  59. }
  60. function areadel(){
  61. var c=document.getElementsByName("C1");
  62. str="";
  63. for(i=0;i<c.length;i++){
  64. if(c[i].checked){
  65. if(str==""){str=c[i].value;}else{str=str+"xcf"+c[i].value;}
  66. }
  67. }
  68. if(str==""){alert("请至少选择一条数据");return false;}
  69. location.href="ysarea.php?control=del&bh=<?=$bh?>&aid="+str;
  70. }
  71. var selon=0;
  72. function selonc(){
  73. c=document.getElementsByName("C1");
  74. if(selon==0){
  75. for(i=0;i<c.length;i++){c[i].checked="checked";}
  76. selon=1;
  77. }else{
  78. for(i=0;i<c.length;i++){c[i].checked=false;}
  79. selon=0;
  80. }
  81. }
  82. </script>
  83. </head>
  84. <body>
  85. <form name="f1" method="post" onsubmit="return tj()">
  86. <input type="hidden" value="area" name="yjcode" />
  87. <ul class="uk">
  88. <li class="l1"><? include("../tem/area.php");?></li>
  89. <li class="l2"><input type="submit" value="添加" /></li>
  90. </ul>
  91. </form>
  92. <div class="control">
  93. <a href="javascript:void(0);" onclick="selonc()" class="a1">全选/反选</a>
  94. <a href="javascript:void(0);" onclick="areadel()" class="a2">删除</a>
  95. </div>
  96. <div class="list">
  97. <?
  98. $a=preg_split("/\|/",$row[ysarea]);
  99. for($i=1;$i<=count($a);$i++){
  100. if($a[$i]!=""){
  101. $areav="";
  102. if(strstr($a[$i],"0,0,0")!=""){$areav="全国";}
  103. $b=preg_split("/,/",$a[$i]);
  104. for($j=0;$j<3;$j++){
  105. $areav=$areav." ".returnarea($b[$j]);
  106. }
  107. ?>
  108. <label>
  109. <ul class="u1">
  110. <li class="l1"><input name="C1" type="checkbox" value="<?=$a[$i]?>" /></li>
  111. <li class="l2"><?=$areav?></li>
  112. </ul>
  113. </label>
  114. <? }}?>
  115. </div>
  116. </body>
  117. </html>