js.js 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305
  1. $(function() {
  2. $(".filterSearch").change(function() {
  3. var cururl = window.location.href;
  4. var fliter = $(this).attr("name").toString();
  5. var fliterval = $(this).val();
  6. var separator = cururl.indexOf('?') !== -1 ? "&": "?";
  7. var re = new RegExp("([?&])");
  8. var urlarr;
  9. var newurl = "";
  10. if (cururl.indexOf(fliter) > 0) {
  11. urlarr = cururl.split(re);
  12. for (i = 0; i < urlarr.length; i++) {
  13. urlarr[i] = urlarr[i].indexOf(fliter) ? urlarr[i] : fliter + "=" + fliterval;
  14. urlarr[i] = urlarr[i].indexOf("Page") ? urlarr[i] : "Page=1";
  15. newurl = newurl + urlarr[i];
  16. }
  17. } else {
  18. newurl = cururl + separator + fliter + "=" + fliterval;
  19. }
  20. window.location.href = newurl;
  21. })
  22. $(".subnav").click(function() {
  23. $(this).find(".list-wraper").slideToggle();
  24. })
  25. $(".slidepanel").click(function() {
  26. if ($(this).hasClass("open")) {
  27. $(this).removeClass("open");
  28. } else {
  29. $(this).addClass("open");
  30. }
  31. $(this).parent().next(".notepanel").slideToggle();
  32. })
  33. $(".tag").click(function(event) {
  34. var t = $(this).text();
  35. $("<span>" + t + "</span>").appendTo(".taglist");
  36. });
  37. $("#tapinput").keydown(function(event) {
  38. var t = $(this).val();
  39. if (event.keyCode == 13) {
  40. if (t == "") {
  41. alert("标签内容不能为空");
  42. } else {
  43. $("<span>" + t + "</span>").appendTo(".taglist");
  44. $("#tapinput").val("");
  45. }
  46. }
  47. });
  48. $("#fliterCountry").on("change",function(){
  49. $(".selectProduct").show();
  50. })
  51. $("#fliterproduct").on("change",function(){
  52. var product = $(this).val();
  53. var country=$("#fliterCountry").val();
  54. $.ajax({
  55. type: "GET",
  56. url: "quantitySearch.asp",
  57. dataType: "html",
  58. contentType: "application/json;charset=utf-8",
  59. data: {
  60. "productId": product,
  61. "country":country
  62. },
  63. success: function(e) {
  64. $("#pricecontrol").html(e);
  65. }
  66. })
  67. })
  68. $(".taglist span").live('click',
  69. function() {
  70. $(this).remove();
  71. })
  72. $(".mytag span").click(function() {
  73. var $thistag = $(this);
  74. var cid = $(this).parent().data("id");
  75. var eid = $(this).parent().data("em");
  76. var tagvalue = $thistag.text();
  77. $.ajax({
  78. url: "bindTag.asp",
  79. beforeSend: function() {
  80. if ($thistag.hasClass("active")) {
  81. $thistag.removeClass("active");
  82. } else {
  83. $thistag.addClass("active");
  84. }
  85. },
  86. data: {
  87. cid: cid,
  88. tagvalue: escape(tagvalue),
  89. eid: eid
  90. },
  91. success: function() {}
  92. });
  93. })
  94. $(".taghead").click(function() {
  95. $(this).attr("contenteditable", "true");
  96. });
  97. $(".taghead").focusout(function() {
  98. $this = $(this);
  99. $this.attr("contenteditable", "false");
  100. var originaltag = $this.data("originaltag");
  101. var newtag = $this.text();
  102. $.ajax({
  103. url: "editTag.asp",
  104. beforeSend: function() {
  105. r = confirm("是否编辑标签");
  106. if (newtag == "") {
  107. alert("标签不能为空");
  108. return false;
  109. }
  110. if (r == false) {
  111. $this.text(originaltag);
  112. return false;
  113. }
  114. },
  115. data: {
  116. originaltag: escape(originaltag),
  117. newtag: escape(newtag)
  118. },
  119. success: function() {
  120. window.location.href = "/tag.asp?tagName=" + newtag;
  121. }
  122. });
  123. })
  124. $(".colormark").click(function() {
  125. $(this).find(".colorlist").slideDown(300);
  126. })
  127. $(".colorlist li").click(function() {
  128. var $this = $(this);
  129. var colorid = $this.val();
  130. var cid = $this.parent().data("id");
  131. $(this).closest(".tline").removeClass().addClass("tline color" + colorid);
  132. $.ajax({
  133. url: "colorTag.asp",
  134. data: {
  135. colorid: colorid,
  136. cid: cid
  137. },
  138. success: function() {
  139. $this.parent().slideUp(300);
  140. }
  141. });
  142. event.stopPropagation();
  143. })
  144. $(".claim").click(function() {
  145. var $this = $(this);
  146. var cid = $this.data("id");
  147. $.ajax({
  148. url: "claimCustomer.asp",
  149. data: {
  150. cid: cid
  151. },
  152. success: function(data) {
  153. if (data == 1) {
  154. alert("认领成功");
  155. window.location.reload();
  156. } else {
  157. alert("每天只能认领5个客户");
  158. }
  159. }
  160. });
  161. })
  162. $(".syncphone").click(function() {
  163. var var1 = $("#cs_whatsapp").val();
  164. $("#cs_tel").val(var1);
  165. })
  166. })
  167. function chkboxall(t0, t1) {
  168. ischk = t0.checked;
  169. for (var i = 0; i < $("input[type=checkbox][name=" + t1 + "]").size(); i++) {
  170. $("input[type=checkbox][name=" + t1 + "]").eq(i).attr("checked", ischk);
  171. }
  172. }
  173. function postchk(t) {
  174. var $form = document.getElementById('form1'),
  175. chkact = parseInt(document.getElementById("chkact").value),
  176. ischk = false;
  177. for (var i = 0; i < $form.elements.length; i++) {
  178. if ($form.elements[i].name == "chkbox" && $form.elements[i].checked == true) {
  179. ischk = true;
  180. }
  181. }
  182. if (!ischk) {
  183. alert('请至少选择一条数据');
  184. return false;
  185. }
  186. switch (t) {
  187. case 1:
  188. switch (chkact) {
  189. case 2:
  190. if (confirm('更改客户状态为【无响应】吗?')) $form.submit();
  191. break;
  192. case 1:
  193. if (confirm('更改客户状态为【已成交】吗?')) $form.submit();
  194. break;
  195. case 0:
  196. if (confirm('更改客户状态为【未成交】吗?')) $form.submit();
  197. break;
  198. default:
  199. if (confirm('确认要修改吗?')) $form.submit();
  200. }
  201. break;
  202. case 2:
  203. switch (chkact) {
  204. case 1:
  205. if (confirm('确认要设置所选状态为【正常】吗?')) $form.submit();
  206. break;
  207. case 0:
  208. if (confirm('确认要设置所选状态为【隐藏】吗?')) $form.submit();
  209. break;
  210. default:
  211. if (confirm('确认要删除吗?\n删除后不可恢复')) $form.submit();
  212. }
  213. break;
  214. case 3:
  215. switch (chkact) {
  216. case 1:
  217. if (confirm('确认要设置所选状态为【已读】吗?')) $form.submit();
  218. break;
  219. case 0:
  220. if (confirm('确认要设置所选状态为【未读】吗?')) $form.submit();
  221. break;
  222. default:
  223. if (confirm('确认修改吗?')) $form.submit();
  224. }
  225. break;
  226. default:
  227. return false;
  228. }
  229. return false;
  230. }
  231. function subform() {
  232. $("#form1").submit();
  233. }
  234. function checkInput() {
  235. var clientCode = $("#cs_code").val();
  236. var clientCompany = $("#cs_company").val();
  237. var clientPhone = $("#cs_tel").val();
  238. var clientWechat = $("#cs_wechat").val();
  239. var clientWhatsapp = $("#cs_whatsapp").val();
  240. var clientEmail = $("#cs_email").val();
  241. var clientFrom = $("#cs_from").val();
  242. var clientCountry = $("#cs_country").val();
  243. var clientLindedin = $("#cs_linkedin").val();
  244. var clientFacebook = $("#cs_facebook").val();
  245. var clientAlibaba = $("#cs_alibaba").val();
  246. var clientDeal = $("#cs_deal").val();
  247. var arr = [];
  248. var $taglist = $(".taglist span");
  249. if (clientCode == "" || clientCode == null) {
  250. alert("客户代码不能为空!");
  251. $("#cs_code").focus();
  252. return false;
  253. }
  254. if (clientCountry == 0) {
  255. alert("这是哪个国家的客户?");
  256. return false;
  257. }
  258. if (clientFrom == "0") {
  259. alert("请填写客户来源!");
  260. return false;
  261. }
  262. if (clientPhone.length == 0 && clientWechat.length == 0 && clientWhatsapp.length == 0 && clientEmail.length == 0 && clientLindedin.length == 0 && clientFacebook.length == 0 && clientAlibaba.length == 0) {
  263. alert("联系方式不能全部为空!");
  264. return false;
  265. }
  266. $("input#mytag").val($(".taglist").html());
  267. alert('提交成功');
  268. }
  269. function checkpwd() {
  270. var pwdo = $("#em_password").val();
  271. var pwd = $("#pwd").val();
  272. var pwdre = $("#pwdre").val();
  273. if (pwd !== pwdre) {
  274. alert("密码输入不一致");
  275. return false;
  276. }
  277. }