123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305 |
- $(function() {
- $(".filterSearch").change(function() {
- var cururl = window.location.href;
- var fliter = $(this).attr("name").toString();
- var fliterval = $(this).val();
- var separator = cururl.indexOf('?') !== -1 ? "&": "?";
- var re = new RegExp("([?&])");
- var urlarr;
- var newurl = "";
- if (cururl.indexOf(fliter) > 0) {
- urlarr = cururl.split(re);
- for (i = 0; i < urlarr.length; i++) {
- urlarr[i] = urlarr[i].indexOf(fliter) ? urlarr[i] : fliter + "=" + fliterval;
- urlarr[i] = urlarr[i].indexOf("Page") ? urlarr[i] : "Page=1";
- newurl = newurl + urlarr[i];
- }
- } else {
- newurl = cururl + separator + fliter + "=" + fliterval;
- }
- window.location.href = newurl;
- })
- $(".subnav").click(function() {
- $(this).find(".list-wraper").slideToggle();
- })
- $(".slidepanel").click(function() {
- if ($(this).hasClass("open")) {
- $(this).removeClass("open");
- } else {
- $(this).addClass("open");
- }
- $(this).parent().next(".notepanel").slideToggle();
- })
- $(".tag").click(function(event) {
- var t = $(this).text();
- $("<span>" + t + "</span>").appendTo(".taglist");
- });
- $("#tapinput").keydown(function(event) {
- var t = $(this).val();
- if (event.keyCode == 13) {
- if (t == "") {
- alert("标签内容不能为空");
- } else {
- $("<span>" + t + "</span>").appendTo(".taglist");
- $("#tapinput").val("");
- }
- }
- });
- $("#fliterCountry").on("change",function(){
- $(".selectProduct").show();
- })
-
-
- $("#fliterproduct").on("change",function(){
- var product = $(this).val();
- var country=$("#fliterCountry").val();
- $.ajax({
- type: "GET",
- url: "quantitySearch.php",
- dataType: "html",
- contentType: "application/json;charset=utf-8",
- data: {
- "productId": product,
- "country":country
- },
- success: function(e) {
- $("#pricecontrol").html(e);
- }
- })
- })
- $(".taglist span").live('click',
- function() {
- $(this).remove();
- })
- $(".mytag span").click(function() {
- var $thistag = $(this);
- var cid = $(this).parent().data("id");
- var eid = $(this).parent().data("em");
- var tagvalue = $thistag.text();
- $.ajax({
- url: "bindTag.php",
- beforeSend: function() {
- if ($thistag.hasClass("active")) {
- $thistag.removeClass("active");
- } else {
- $thistag.addClass("active");
- }
- },
- data: {
- cid: cid,
- tagvalue: escape(tagvalue),
- eid: eid
- },
- success: function() {}
- });
- })
- $(".taghead").click(function() {
- $(this).attr("contenteditable", "true");
- });
- $(".taghead").focusout(function() {
- $this = $(this);
- $this.attr("contenteditable", "false");
- var originaltag = $this.data("originaltag");
- var newtag = $this.text();
- $.ajax({
- url: "editTag.php",
- beforeSend: function() {
- r = confirm("是否编辑标签");
- if (newtag == "") {
- alert("标签不能为空");
- return false;
- }
- if (r == false) {
- $this.text(originaltag);
- return false;
- }
- },
- data: {
- originaltag: escape(originaltag),
- newtag: escape(newtag)
- },
- success: function() {
- window.location.href = "/tag.php?tagName=" + newtag;
- }
- });
- })
- $(".colormark").click(function() {
- $(this).find(".colorlist").slideDown(300);
- })
- $(".colorlist li").click(function() {
- var $this = $(this);
- var colorid = $this.val();
- var cid = $this.parent().data("id");
- $(this).closest(".tline").removeClass().addClass("tline color" + colorid);
- $.ajax({
- url: "colorTag.php",
- data: {
- colorid: colorid,
- cid: cid
- },
- success: function() {
- $this.parent().slideUp(300);
- }
- });
- event.stopPropagation();
- })
- $(".claim").click(function() {
- var $this = $(this);
- var cid = $this.data("id");
- $.ajax({
- url: "claimCustomer.php",
- data: {
- cid: cid
- },
- success: function(data) {
- if (data == 1) {
- alert("认领成功");
- window.location.reload();
- } else {
- alert("每天只能认领5个客户");
- }
- }
- });
- })
- $(".syncphone").click(function() {
- var var1 = $("#cs_whatsapp").val();
- $("#cs_tel").val(var1);
- })
- })
- function chkboxall(t0, t1) {
- ischk = t0.checked;
- for (var i = 0; i < $("input[type=checkbox][name=" + t1 + "]").size(); i++) {
- $("input[type=checkbox][name=" + t1 + "]").eq(i).attr("checked", ischk);
- }
- }
- function postchk(t) {
- var $form = document.getElementById('form1'),
- chkact = parseInt(document.getElementById("chkact").value),
- ischk = false;
- for (var i = 0; i < $form.elements.length; i++) {
- if ($form.elements[i].name == "chkbox" && $form.elements[i].checked == true) {
- ischk = true;
- }
- }
- if (!ischk) {
- alert('请至少选择一条数据');
- return false;
- }
- switch (t) {
- case 1:
- switch (chkact) {
- case 2:
- if (confirm('更改客户状态为【无响应】吗?')) $form.submit();
- break;
- case 1:
- if (confirm('更改客户状态为【已成交】吗?')) $form.submit();
- break;
- case 0:
- if (confirm('更改客户状态为【未成交】吗?')) $form.submit();
- break;
- default:
- if (confirm('确认要修改吗?')) $form.submit();
- }
- break;
- case 2:
- switch (chkact) {
- case 1:
- if (confirm('确认要设置所选状态为【正常】吗?')) $form.submit();
- break;
- case 0:
- if (confirm('确认要设置所选状态为【隐藏】吗?')) $form.submit();
- break;
- default:
- if (confirm('确认要删除吗?\n删除后不可恢复')) $form.submit();
- }
- break;
- case 3:
- switch (chkact) {
- case 1:
- if (confirm('确认要设置所选状态为【已读】吗?')) $form.submit();
- break;
- case 0:
- if (confirm('确认要设置所选状态为【未读】吗?')) $form.submit();
- break;
- default:
- if (confirm('确认修改吗?')) $form.submit();
- }
- break;
- default:
- return false;
- }
- return false;
- }
- function subform() {
- $("#form1").submit();
- }
- function checkInput() {
- var clientCode = $("#cs_code").val();
- var clientCompany = $("#cs_company").val();
- var clientPhone = $("#cs_tel").val();
- var clientWechat = $("#cs_wechat").val();
- var clientWhatsapp = $("#cs_whatsapp").val();
- var clientEmail = $("#cs_email").val();
- var clientFrom = $("#cs_from").val();
- var clientCountry = $("#cs_country").val();
- var clientLindedin = $("#cs_linkedin").val();
- var clientFacebook = $("#cs_facebook").val();
- var clientAlibaba = $("#cs_alibaba").val();
- var clientDeal = $("#cs_deal").val();
- var arr = [];
- var $taglist = $(".taglist span");
- if (clientCode == "" || clientCode == null) {
- alert("客户代码不能为空!");
- $("#cs_code").focus();
- return false;
- }
- if (clientCountry == 0) {
- alert("这是哪个国家的客户?");
- return false;
- }
- if (clientFrom == "0") {
- alert("请填写客户来源!");
- return false;
- }
- if (clientPhone.length == 0 && clientWechat.length == 0 && clientWhatsapp.length == 0 && clientEmail.length == 0 && clientLindedin.length == 0 && clientFacebook.length == 0 && clientAlibaba.length == 0) {
- alert("联系方式不能全部为空!");
- return false;
- }
- $("input#mytag").val($(".taglist").html());
- alert('提交成功');
- }
- function checkpwd() {
- var pwdo = $("#em_password").val();
- var pwd = $("#pwd").val();
- var pwdre = $("#pwdre").val();
- if (pwd !== pwdre) {
- alert("密码输入不一致");
- return false;
- }
- }
|