PageSourceSearch

https://sale.med66.com/newweb/resources/js/2020CourseCenter/shoppingCart.js?v=20260514

js med66.com collected 2026-10-02 04:01:23 UTC 36,971 bytes, 990 lines download raw bytes

1$(function () {
2
3    //校验登录
4    inspectLogin();
5
6    //领取优惠券
7    $(".shoppingCart-mod .coupon-wrap").hover(function () {
8        $(this).find(".coupon-pop").fadeIn();
9    },function () {
10        $(this).find(".coupon-pop").hide();
11    })
12
13    courseChoice();
14    
15    browserRedirect();
16    getNeedMoney();
17
18    $(".lianbaoCourse-pop .close-btn").click(function () {
19        $(".lianbaoCourse-pop").hide()
20        $(".mask").hide()
21        // $("#lianbaoCourse").html("");
22    })
23
24    //赠品展开
25    $("body").on("click",".shoppingCart-mod .course-con .con .send-con .fdjian",function () {
26        if($(this).parents(".send-con").hasClass("auto")){
27            $(this).parents(".send-con").removeClass("auto");
28        }else {
29            $(this).parents(".send-con").addClass("auto");
30        }
31    })
32
33    setProCookie("buy_book_list",null);
34    setProCookie("select_course_list",null);
35
36    //模拟用户点击两次,加载猜你喜欢信息,计算购物车价格不用应该调用
37     var firstSelected = $(".shoppingCart-ico.on");
38         firstSelected.trigger("click", true);
39         firstSelected.trigger("click", true);
40    var flag = getLocalCookie("guessYouLike_flag");
41    if(1 == flag){
42        //刷新页面的时候重新加载用户之前勾选的商品(猜你喜欢)
43        reloadHisChoose();
44    }
45
46    //猜你喜欢展开
47    $("body").on("click",".shoppingCart-mod .course-con .con .plusBuy-tit-btn",function () {
48        if($(this).hasClass("on")){
49            $(this).removeClass("on").find("em").text("展开");
50            $(this).parent().siblings(".plusBuy-con").hide();
51        }else {
52            $(this).addClass("on").find("em").text("收起");
53            $(this).parent().siblings(".plusBuy-con").show();
54        }
55    })
56
57    //导航浮动
58    snavFix();
59})
60
61
62function browserRedirect(){
63    //获取当前页面路径地址
64    var br_url = document.location.toString(),br_arrUrl = br_url.split("//"),br_startUrl = br_arrUrl[1].indexOf("/"),br_relUrl = br_arrUrl[1].substring(br_startUrl),br_hostname = br_arrUrl[1].substring(0,br_startUrl);
65    var param = br_url.split("?")[1];
66    //当前域名不为m.med66.com 且 q=www 不存在时执行跳转
67    if(br_hostname!== "m.med66.com" && br_relUrl.indexOf('q=sale') < 0){
68        var sUserAgent = navigator.userAgent.toLowerCase();
69        var bIsIpad = sUserAgent.match(/ipad/i) == "ipad";
70        var bIsIphoneOs = sUserAgent.match(/iphone/i) == "iphone";
71        var bIsMidp = sUserAgent.match(/midp/i) == "midp";
72        var bIsUc7 = sUserAgent.match(/rv:1.2.3.4/i) == "rv:1.2.3.4";
73        var bIsUc = sUserAgent.match(/ucweb/i) == "ucweb";
74        var bIsAndroid = sUserAgent.match(/android/i) == "android";
75        var bIsCE = sUserAgent.match(/windows ce/i) == "windows ce";
76        var bIsWM = sUserAgent.match(/windows mobile/i) == "windows mobile";
77        var bIsBBOS = sUserAgent.match(/blackberry/i) == "blackberry";
78        //
79        if(( bIsIphoneOs || bIsMidp || bIsUc7 || bIsUc || bIsAndroid || bIsCE || bIsWM || bIsBBOS || bIsIpad)){
80            if(br_arrUrl[1].indexOf('lan') > 0){
81                window.location.href="//lan.m.med66.com"+br_relUrl;
82            }else{
83                window.location.href="//sale.med66.com/newweb/mobile/cart/initCart.shtm?"+param;
84            }
85        };
86    };
87}
88
89
90
91//购课协议弹出框
92var buyCourseTipsPop = function () {
93    $(".buyCourseTips-pop").css('margin-top',-($(".buyCourseTips-pop").height()/2))
94    $(".buyCourseTips-pop,.mask").show();
95    //关闭弹出框
96    $(".buyCourseTips-pop .foot-close").on("click",function () {
97        $(".buyCourseTips-pop,.mask").hide()
98    });
99}
100
101var liaobaoCoursePop = function (showId) {
102    $("#lianbaoCourse").html($("#"+showId));
103
104    var _this = $(".lianbaoCourse-pop");
105    var _thisHeight = _this.height()/2;
106    var mask = $(".mask");
107    _this.show().css("marginTop",-_thisHeight)
108    mask.show()
109
110    //去选课按钮弹出框
111    $(".choiceCourse-con p").on("click",function () {
112        var $this = $(this),
113            $input = $(this).find("input");
114        if($input.is(':checked')){
115            $this.removeClass("on");
116            $input.prop("checked", false);
117        }else {
118            $this.addClass("on");
119            $input.prop("checked", true);
120        }
121    });
122
123}
124
125//选中的商品id
126var allCheckProductList = [];
127//当前选中的商品id
128var newCheckProductList = [];
129//之前选中的商品id
130var oldCheckProductList = [];
131
132//选课-勾选
133var courseChoice = function () {
134
135    //全部课程全选按钮
136    $(".shoppingCart-tit li.all-chk i,.settlement-mod .all-chk i").on("click",function () {
137        var $this = $(this);
138        var _thisOn = $this.hasClass("on");
139        var allChk = $(".shoppingCart-mod .course-con .tit h3 i,.shoppingCart-mod .course-con .con .course-chk i");
140        var $otherChk = $(".all-chkTags");
141        //如果是已经全部选中,取消全部选中状态
142        if(_thisOn){
143            $otherChk.removeClass("on")
144            allChk.removeClass("on").siblings("input").prop("checked", false)
145            $(".shoppingCart-mod .course-con .tit,.shoppingCart-mod .course-con .con li").removeClass("on")
146            $(".shoppingCart-mod .course-con .con li .guessLikeProductId").html("");
147            cleanGuessLikeList();
148        }else {
149            //获取之前选中的商品id集合
150            $('input[name="checkProduct"]').each(function(){//遍历每一个名字为checkProduct的复选框
151                var productId = $(this).val().split(":")[0];
152                if($(this).is(':checked')) {
153                    oldCheckProductList.push(productId);
154                }
155            });
156
157            $otherChk.addClass("on")
158            allChk.addClass("on").siblings("input").prop("checked","checked")
159            $(".shoppingCart-mod .course-con .tit,.shoppingCart-mod .course-con .con li").addClass("on")
160            //获取选中的商品id集合
161            $('input[name="checkProduct"]').each(function(){//遍历每一个名字为checkProduct的复选框
162                var productId = $(this).val().split(":")[0];
163                if($(this).is(':checked')) {
164                    allCheckProductList.push(productId);
165                }
166            });
167            //获取当前选中的商品id集合
168            for (var a = 0; a < allCheckProductList.length; a++) {
169                if (oldCheckProductList.indexOf(allCheckProductList[a]) < 0) {
170                    newCheckProductList .push(allCheckProductList[a])
171                }
172            }
173            guessYouLike(newCheckProductList,oldCheckProductList);
174        }
175        getNeedMoney();
176    })
177
178    //辅导全选按钮
179    $(".shoppingCart-mod .course-con .tit h3 i").on("click",function (event, flash) {
180        var $this = $(this);
181        var _thisOn = $this.hasClass("on");
182        var allChk = $this.parents(".shoppingCart-mod").find(".course-chk i");
183        if(_thisOn){
184            $this.parents(".tit").removeClass("on").siblings(".con").find("li").removeClass("on");
185            $this.parents(".tit").siblings(".con").find("li").find(".guessLikeProductId").html("");
186            $this.parents(".course-con").find(".con .course-chk i").removeClass("on").siblings("input").prop("checked", false)
187            $this.removeClass("on")
188            cleanGuessLikeList();
189        }else {
190            //获取之前选中的商品id集合
191            $('input[name="checkProduct"]').each(function(){//遍历每一个名字为checkProduct的复选框
192                var productId = $(this).val().split(":")[0];
193                if($(this).is(':checked')) {
194                    oldCheckProductList.push(productId);
195                }
196            });
197            $this.parents(".tit").addClass("on").siblings(".con").find("li").addClass("on");
198            $this.parents(".course-con").find(".con .course-chk i").addClass("on").siblings("input").prop("checked","checked")
199            $this.addClass("on")
200            //获取选中的商品id集合
201            $('input[name="checkProduct"]').each(function(){//遍历每一个名字为checkProduct的复选框
202                var productId = $(this).val().split(":")[0];
203                if($(this).is(':checked')) {
204                    allCheckProductList.push(productId);
205                }
206            });
207            //获取当前选中的商品id集合
208            for (var b = 0; b < allCheckProductList.length; b++) {
209                if (oldCheckProductList.indexOf(allCheckProductList[b]) < 0) {
210                    newCheckProductList .push(allCheckProductList[b])
211                }
212            }
213            guessYouLike(newCheckProductList,oldCheckProductList);
214        }
215
216        //全选按钮状态
217        for(var j = 0; j < allChk.length; j++){
218            if(!allChk.eq(j).hasClass("on")){
219                $(".all-chkTags").removeClass("on")
220                if (!flash) {
221                    getNeedMoney();
222                }
223                return false
224            }else {
225                $(".all-chkTags").addClass("on")
226            }
227        }
228        getNeedMoney();
229    })
230
231    //单选按钮 flash 用来区分是否是初始加载的时候触发的点击事件
232    $(".shoppingCart-mod .course-con .con .course-chk i").on("click",function (event, flash) {
233        var $this = $(this);
234        var _thisOn = $this.hasClass("on");
235        var otherChk = $this.parents(".con").find("li");
236        var allChkLen = $(".shoppingCart-mod .con li");
237        var nums = 0;
238        var flag = true;
239        if(_thisOn){
240            $this.removeClass("on").siblings("input").prop("checked", false)
241            $this.parents("li").removeClass("on")
242            $this.parents("li").find(".guessLikeProductId").html("");
243            cleanGuessLikeList();
244        }else {
245            //获取之前选中的商品id集合
246            $('input[name="checkProduct"]').each(function(){//遍历每一个名字为checkProduct的复选框
247                var productId = $(this).val().split(":")[0];
248                if($(this).is(':checked')){
249                    oldCheckProductList.push(productId);
250                }
251
252            });
253            $this.addClass("on").siblings("input").prop("checked","checked")
254            $this.parents("li").addClass("on")
255            //选中+1
256            for(var i = 0; i< otherChk.length;i++){
257                if(otherChk.eq(i).find(".course-chk i").hasClass("on")){
258                    nums++
259                }
260            }
261            //获取选中的商品id集合
262            $('input[name="checkProduct"]').each(function(){//遍历每一个名字为checkProduct的复选框
263                var productId = $(this).val().split(":")[0];
264                if($(this).is(':checked')){
265                    allCheckProductList.push(productId);
266                }
267            });
268            //获取当前选中的商品id集合
269            for (var c = 0; c < allCheckProductList.length; c++) {
270                if (oldCheckProductList.indexOf(allCheckProductList[c]) < 0) {
271                    newCheckProductList.push(allCheckProductList[c])
272                }
273            }
274            guessYouLike(newCheckProductList,oldCheckProductList);
275        }
276
277        //单科辅导全选状态
278        if(otherChk.length == nums ){
279            $this.parents(".course-con").find(".tit i").addClass("on")
280            $this.parents(".course-con").find(".tit").addClass("on")
281        }else {
282            $this.parents(".course-con").find(".tit i").removeClass("on")
283            $(".all-chkTags").removeClass("on")
284            $this.parents(".course-con").find(".tit").removeClass("on")
285        }
286
287
288        //全选按钮状态
289        for(var j = 0; j< allChkLen.length;j++){
290            if(!allChkLen.eq(j).find("i").hasClass("on")){
291                flag = false
292                if (!flash) {
293                    getNeedMoney();
294                }
295                return false;
296            }
297        }
298        if(flag){
299            $(".all-chkTags").addClass("on")
300        }
301        getNeedMoney();
302    })
303
304
305
306}
307
308//导航浮动
309var snavFix = function () {
310    var navModTop = $('.shoppingCart-tit').offset().top;
311    var listNavHeight = $('.shoppingCart-tit').outerHeight(true);
312    var scrollEvent = function(){
313        var winTop = $(window).scrollTop();
314
315        if(winTop > navModTop){
316            $(".shoppingCart-tit").addClass("fix");
317            $(".shoppingCart-tit-fix").css("height",listNavHeight).show();
318        }else{
319            $(".shoppingCart-tit").removeClass("fix");
320            $(".shoppingCart-tit-fix").hide();
321        }
322    };
323
324    var botNavModTop = $('.settlement-mod').offset().top-10;
325    var botListNavHeight = $('.settlement-mod').outerHeight(true);
326    var botScrollEvent = function(){
327        var winTop = $(window).scrollTop()+$(window).height();
328
329        if(winTop > (botNavModTop + botListNavHeight)){
330            $(".settlement-mod").removeClass("fix");
331            $(".settlement-mod-fix").hide();
332        }else{
333            $(".settlement-mod").addClass("fix");
334            $(".settlement-mod-fix").css("height",botListNavHeight).show();
335        }
336    };
337    $(window).bind('load scroll',botScrollEvent);
338    $(window).bind('load scroll',scrollEvent);
339}
340
341
342// 删除购物车
343var deleteCart = function(productId){
344    saveCheckProdctCookie();
345    var param = "?productIds=" + productId;
346    $.ajax({
347        type : "POST",
348        url : "/newweb/cart/delCart.shtm"+param,
349        dataType : "html",
350        contentType : "application/json",
351        success : function (data) {
352            var path = "/newweb/cart/initCart.shtm";
353            var isClient = getUrlParam("isClient");
354            if(isClient == 1){
355                path = "/newweb/cart/initCart.shtm?isClient=1";
356            }
357            window.location = path;
358        },
359    })
360}
361
362// 删除选中的项
363var deleteCartChecked = function () {
364    saveCheckProdctCookie();
365    var product_list = "";
366    $('input[name="checkProduct"]:checked').each(function(){
367        var productId = $(this).val().split(':')[0];
368        if(product_list ==  ""){
369            product_list = productId;
370        }else{
371            product_list = product_list + "," +  productId;
372        }
373    })
374    var param = "?productIds="+product_list
375    $.ajax({
376        type : "POST",
377        url : "/newweb/cart/delCart.shtm"+param,
378        dataType : "html",
379        contentType : "application/json",
380        success : function (data) {
381            var path = "/newweb/cart/initCart.shtm";
382            var isClient = getUrlParam("isClient");
383            if(isClient == 1){
384                path = "/newweb/cart/initCart.shtm?isClient=1";
385            }
386            window.location = path;
387        }
388    })
389}
390
391// 计算金额
392var getNeedMoney = function(){
393    var cartParam = "";
394    $('input[name="checkProduct"]:checked').each(function(){//遍历每一个名字为interest的复选框,其中选中的执行函数
395        if(cartParam ==  ""){
396            cartParam = $(this).val();
397        }else{
398            cartParam = cartParam + "," +  $(this).val();
399        }
400    });
401    if(cartParam == ""){
402        $("#discountP").hide();
403        $("#cartNum").text(0);
404        $("#needMoney").text("Â¥0.00");
405        $("#allneedMoney").text("Â¥0.00");
406        $("#discountMoney").text("Â¥0.00");
407        $("#couponMoney").text("Â¥0.00");
408    }else{
409        var param = "?cartParam=" + cartParam + "&version=8.6.15";
410        $.ajax({
411            type : "POST",
412            url : "/newweb/cart/computeCart.shtm"+param,
413            dataType : "html",
414            contentType : "application/json",
415            success : function (data) {
416                var result = $.parseJSON(data);
417                if(result.discountMoney > 0){
418                    $("#discountP").show();
419                }else{
420                    $("#discountP").hide();
421                }
422                $("#cartNum").text(result.cartNum);
423                $("#needMoney").text("Â¥" +  result.needMoney.toFixed(2));
424                $("#allneedMoney").text("Â¥" +  result.allneedMoney.toFixed(2));
425                $("#discountMoney").text("Â¥" +  result.discountMoney.toFixed(2));
426                $("#couponMoney").text("Â¥" +  result.couponMoney);
427
428                var products = result.products;
429                for(var i = 0; i < products.length; i++){
430                    var product = products[i];
431                    var htmlStr = "";
432                    if(product.discountTitle != ""){
433                        htmlStr = product.discountTitle+":¥"+product.money;
434                    }else{
435                        htmlStr = "Â¥" + product.money;
436                    }
437                    if(product.productType == 1){
438                        if(product.money < product.price){
439                            var delPrice = product.price;
440                            htmlStr = htmlStr + '<del id="pricedel_'+product.productId+'">Â¥'+delPrice+'</del>';
441                        }
442                    }else{
443                        if(product.money < product.initPrice){
444                            var delPrice = product.initPrice;
445                            htmlStr = htmlStr + '<del id="pricedel_'+product.productId+'">Â¥'+delPrice+'</del>';
446                        }
447                       /* $("#exceptDiscount_"+product.productId).val(product.exceptDiscountStr);*/
448                    }
449                    $('#priceShow_'+product.productId).html(htmlStr);
450
451                    $('#ruleName_'+product.productId).html("");
452                    for(var j = 0; j < product.ruleNames.length; j++){
453                        var ruleName = product.ruleNames[j];
454                        var htmlStr2 = '<em>惠</em><span>'+ruleName+'</span>';
455                        $('#ruleName_'+product.productId).append(htmlStr2);
456                    }
457                    if(product.ruleNames.length>0){
458                        $('#ruleName_'+product.productId).show();
459                    }else{
460                        $('#ruleName_'+product.productId).hide();
461                    }
462
463                }
464                var thatinput = $('input[name="checkProduct"]');
465                thatinput.each(function(){
466                    var thisinput  = $(this);
467                    var productId = thisinput.attr('productid');
468                    if(thisinput.is(':checked')){
469                    }else {
470                        var productType = $("#productType_"+productId).val();
471                        var htmlStr = $("#promotionMoney_"+productId).val();
472                        var delStr = $("#pricedel_"+productId).html();
473                        if(null != delStr && productType == 1){
474                            if(htmlStr < $("#productType_"+productId).attr('price')){
475                                htmlStr = htmlStr + '<del id="pricedel_'+productId+'">'+delStr+'</del>';
476                            }
477                        }else if(null != delStr && productType != 1){
478                            if(htmlStr < $("#productType_"+productId).attr('initPrice')){
479                                htmlStr = htmlStr + '<del id="pricedel_'+productId+'">'+delStr+'</del>';
480                            }
481                        }
482                        $('#priceShow_'+productId).html("Â¥" + htmlStr);
483                        var htmlStr2 = $("#ruleName2_"+productId).html();
484                        $('#ruleName_'+productId).html(htmlStr2);
485                        if(typeof(htmlStr2)== "undefined"){
486                            $('#ruleName_'+productId).hide();
487                        }
488                    }
489
490                });
491
492
493
494                $("#discountMoney").text("Â¥" +  result.promotionMoney);
495                $("#couponMoney").text("Â¥" +  result.couponMoney);
496                if(result.canReceiveCouponIds.length > 0){
497                    var canReceiveCouponIdstr = "";
498                    for(var i = 0; i < result.canReceiveCouponIds.length; i++){
499                        canReceiveCouponIdstr = canReceiveCouponIdstr +","+result.canReceiveCouponIds[i];
500                    }
501                    $("#canReceiveCouponIds").val(canReceiveCouponIdstr);
502                    $("#discountP").show();
503                    $("#needMoney").text("Â¥" +  result.needMoney);
504                    $("#allneedMoney").text("Â¥" +  result.allneedMoney);
505                    $(".but-btn").html("领券结算");
506                }else{
507                    $(".but-btn").html("去结算");
508                    $("#canReceiveCouponIds").val("");
509                }
510
511            },
512        })
513    }
514}
515
516// 减实物商品数量
517var minus = function(productId){
518    var num = parseInt($("#productNum_"+productId).val());
519    if(num > 1){
520        num = num - 1;
521    }
522    $("#productNum_"+productId).val(num);
523    var cartParam = productId + ":" + num;
524    $("#product_"+productId).val(cartParam);
525    var param = "?cartParam=" + cartParam;
526    $.ajax({
527        type : "POST",
528        url : "/newweb/cart/updateCart.shtm"+param,
529        dataType : "html",
530        contentType : "application/json",
531        success : function (data) {
532
533        },
534    })
535    if($("#product_"+productId).is(":checked")){
536        getNeedMoney();
537    }
538}
539
540//加实物商品数量
541var add = function(productId){
542    var num = parseInt($("#productNum_"+productId).val());
543    if(num < 100){
544        num = num + 1;
545    }
546    $("#productNum_"+productId).val(num);
547    var cartParam = productId + ":" + num;
548    $("#product_"+productId).val(cartParam);
549    var param = "?cartParam=" + cartParam;
550    $.ajax({
551        type : "POST",
552        url : "/newweb/cart/updateCart.shtm"+param,
553        dataType : "html",
554        contentType : "application/json",
555        success : function (data) {
556
557        },
558    })
559    if($("#product_"+productId).is(":checked")){
560        getNeedMoney();
561    }
562}
563
564//修改实物商品数量
565var changeNum = function(productId){
566    var num = parseInt($("#productNum_"+productId).val());
567    if(num < 1){
568        alert("商品数量最小为1")
569        num = 1;
570        $("#productNum_"+productId).val(num);
571    }
572    if(num > 99){
573        alert("商品数量最大为99")
574        num = 99;
575        $("#productNum_"+productId).val(num);
576    }
577    var cartParam = productId + ":" + num;
578    $("#product_"+productId).val(cartParam);
579    var param = "?cartParam=" + cartParam;
580    $.ajax({
581        type : "POST",
582        url : "/newweb/cart/updateCart.shtm"+param,
583        dataType : "html",
584        contentType : "application/json",
585        success : function (data) {
586
587        },
588    })
589    if($("#product_"+productId).is(":checked")){
590        getNeedMoney();
591    }
592}
593
594
595var lianbaoCourseSubmit = function () {
596    var productInfo = $("#cartPorductInfo").val();
597    var data = {};
598    data.cartParam = productInfo;
599    $.ajax({
600        type : "POST",
601        url : "/newweb/cart/lianbaoCourseSubmit.shtm",
602        data : JSON.stringify(data),
603        dataType : "json",
604        contentType:'application/json;charset=utf-8',
605        success : function (data) {
606            window.location.reload();
607        }
608    })
609}
610
611var openAgreement = function (url) {
612    window.open(url, "_blank");
613}
614
615//加实物商品数量
616var addCart = function(productId){
617    var param = "?cartParam=" + productId;
618    $.ajax({
619        type : "POST",
620        url : "/newweb/cart/addCartParam.shtm"+param,
621        dataType : "html",
622        contentType : "application/json",
623        success : function (data) {
624            window.location.reload();
625        },
626    })
627}
628
629//赠送优惠券
630var getCoupon = function (discountId) {
631    if(!checkLogin()){
632        // var logReg = new headUcLoginRegister();
633        // logReg.dialogShow(headUcLogRegObj.url.LOGIN_URL, 450, 500);
634        loginRegister(1);
635        return;
636    }
637    var param = "?discountId=" + discountId;
638    $.ajax({
639        type : "POST",
640        url : "/newweb/cart/getCoupon.shtm"+param,
641        dataType : "html",
642        contentType : "application/json",
643        success : function (data) {
644            var result = $.parseJSON(data);
645            if(result.code == 1){
646                $(".couponShow_"+discountId).addClass("no")
647                $(".couponShow_"+discountId).text("已领取")
648                alert(result.msg);
649            }
650        }
651    })
652}
653
654//提交购物车
655var submitCart = function(){
656    if(!checkLogin()){
657        // var logReg = new headUcLoginRegister();
658        // logReg.dialogShow(headUcLogRegObj.url.LOGIN_URL, 450, 500);
659        //loginRegister(1);
660        var logReg = new dialogUcLoginRegister();
661        logReg.dialogShow("iframe://sale.med66.com/OtherItem/loginRegister/login.shtml", 450, 500);
662        return;
663    }
664
665    var order_course_list = "";
666    var order_book_list = "";
667    $('input[name="checkProduct"]:checked').each(function(){//遍历每一个名字为interest的复选框,其中选中的执行函数
668        var productId = $(this).val().split(':')[0];
669        var productType = $("#productType_"+productId).val();
670        if(1 == productType){
671            if(order_course_list ==  ""){
672                order_course_list = productId;
673            }else{
674                order_course_list = order_course_list + "," +  productId;
675            }
676        }else{
677            if(order_book_list ==  ""){
678                order_book_list = $(this).val() + ":1";
679            }else{
680                order_book_list = order_book_list + "," +  $(this).val() + ":1";
681            }
682
683        }
684    });
685    setProCookie("order_course_list",null);
686    setProCookie("order_course_list",order_course_list);
687    setProCookie("order_book_list",null);
688    setProCookie("order_book_list",order_book_list);
689    var path = "//sale.med66.com/web/sale/order/order.shtml";
690    if(order_course_list ==  "" && order_book_list == ""){
691        alert("请选择结算商品!");
692    }else{
693        //领券
694        var canReceiveCouponIds = $("#canReceiveCouponIds").val();
695        if(canReceiveCouponIds == ""){
696            window.location = path;
697        }else{
698            try {
699                var time = new Date().getTime();
700                var uid = CDEL.getCookie("cdeluid");
701                var setting = {
702                    "uid":CDEL.getCookie("cdeluid"),
703                    "source":1,
704                    "voucherIds":canReceiveCouponIds,
705                    "ltime":time,
706                    "time":time
707                }
708                postAesData({
709                    data:{
710                        "params":setting,
711                        "domain": "med66",
712                        "resourcePath": "+/c-sel/w-sale/coupon/receiveCoupons",
713                        "af": "1",
714                        "sid": CDEL.getCookie("sid"),
715                        "fs": "201",
716                        "platform": "0",
717                        "lt": time+"",
718                        "ap": "b3316459-ceeb-47f8-a469-12751ff3075e"
719
720                    },
721                    //ajax成功回调
722                    success: function(data){
723                        window.location = path;
724                    },
725                    //ajax失败回调
726                    error: function(xhr){
727                    }
728                });
729            } catch (e) {
730            }
731        }
732    }
733
734}
735
736var cancelAll = function () {
737    
738}
739
740var xuanGou = function () {
741    var xuanGou_course_list = "";
742    $('input[name="xuanGouChecked"]:checked').each(function(){//遍历每一个名字为xuanGouChecked的复选框,其中选中的执行函数
743        var productId = $(this).val().split(':')[0];
744        if(xuanGou_course_list ==  ""){
745            xuanGou_course_list = productId+":1";
746        }else{
747            xuanGou_course_list = xuanGou_course_list + "," +  productId+":1";
748        }
749    });
750    addCart(xuanGou_course_list)
751}
752
753var isLogin = false;
754var inspectLogin = function(){
755	var UC_TOKEN = getLocalCookie('client_ucToken');
756	$.ajax({
757		type : "POST",
758		url : "//member.med66.com/ucenter/loginRegister/checkUserLoginStatus/" + UC_TOKEN,
759		dataType : "jsonp",
760		jsonp : "jsonpCallback",
761		jsonpCallback : "jsonp33"+Date.parse(new Date()),
762		success : function(json){
763			//登录状态
764			var showMemberInfo = json.result;
765			if(showMemberInfo.loginFlag){
766				isLogin = true;
767			}else{
768				oldCheckLogin();
769			}
770		}
771	});
772}
773var oldCheckLogin = function(){
774	$.ajax({
775		 type : "GET",
776         url : "//member.med66.com/member/verifyLogin.shtm",
777         dataType : "jsonp",
778         jsonp : "jsonpCallback",
779         jsonpCallback : "success_jsonpCallback",
780         success:function(json){
781            var flag = $.trim(json.flag);
782            if(flag == "true"){
783            	isLogin = true;
784            }
785        }
786    });
787}
788
789function getUrlParam(name) {
790    var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); //构造一个含有目标参数的正则表达式对象
791    var r = window.location.search.substr(1).match(reg);  //匹配目标参数
792    if (r != null) return unescape(r[2]); return null; //返回参数值
793}
794
795var guessYouLike = function (newCheckProductList,oldCheckProductList){
796
797    //已经勾选过的商品对应的推荐商品集合
798    var likeAllProductIdList = [];
799    var guessLikeList = [];
800    var uid = $.cookie("cdeluid");
801    var bdpuid = $.cookie("bdp_uuid");
802
803    for(var m = 0;m<oldCheckProductList.length;m++){
804        var likeProductStr = $('#likeProductStr_' + oldCheckProductList[m]).val();
805        if(null != likeProductStr && "undefined" != likeProductStr && "" != likeProductStr){
806            var likeProductList = likeProductStr.substring(0, likeProductStr.length - 1).split(",");
807            likeAllProductIdList = likeAllProductIdList.concat(likeProductList);
808        }
809    }
810    postAesData({
811        data : {
812            "appVersion":navigator.appVersion,
813            "af":"1",
814            "appType":"",
815            "domain":"med66",
816            "resourcePath":"+/xuanke/product/getCartRecommendProducts",
817            "platform":navigator.platform,
818            "params":{
819                "ltime":new Date().getTime(),
820                "time":new Date().getTime(),
821                "platformSource":"1",
822                "productIdList":newCheckProductList,
823                "likeProductIdList":likeAllProductIdList,
824                "siteId":5,
825                "bdpuid":bdpuid,
826                "uid":uid
827            }
828        },
829        success : function (data) {
830            if(data.success){
831                cleanGuessLikeList();
832                guessLikeList = data.result;
833                //特殊处理标签和课程详情url
834                for(i= 0;i<guessLikeList.length;i++){
835                    var productList = guessLikeList[i].productList
836                    if(null != productList && productList.length > 0){
837                        for(j= 0;j<productList.length;j++){
838                            if(null != productList[j].discountTag && "" != productList[j].discountTag){
839                                productList[j].discountTag = '<i class="icon">'+productList[j].discountTag+'</i>'
840                            }else{
841                                productList[j].discountTag = "";
842                            }
843
844                            if(null == productList[j].pcDetailUrl || "" == productList[j].pcDetailUrl){
845                                productList[j].pcDetailUrl = "javascript:void(0)";
846                            }
847                        }
848                    }
849                }
850
851                addGuessYouLike();
852            }
853        },
854        error : function (xhr) {
855            cleanGuessLikeList();
856        }
857    });
858
859    //拼接猜你喜欢
860    function addGuessYouLike(){
861
862        for(i= 0;i<guessLikeList.length;i++){
863            var productList = guessLikeList[i].productList;
864            var productId = guessLikeList[i].productId;
865            if(null != productList && productList.length > 0){
866
867                var likeProductStr = '';
868                var guessAllHtml = '';
869                guessAllHtml += '<div class="plusBuy">';
870                guessAllHtml += '<div class="plusBuy-tit"><span class="plusBuy-tit-btn on"><em>收起</em><i></i></span></div>';
871                guessAllHtml += '<div class="plusBuy-con">';
872                guessAllHtml += '<div class="pcTit">';
873                guessAllHtml += '<div class="pcTit-left">猜你喜欢</div>';
874                guessAllHtml += '</div>';
875                guessAllHtml += '<div class="pcBox clearfix content">';
876
877                for(j= 0;j<productList.length;j++){
878                    likeProductStr += productList[j].productId+','
879                    var guessHtml = "";
880                    guessHtml += '<div class="pcBox-list">';
881                    guessHtml += '<a href="'+productList[j].pcDetailUrl+'" target="_blank" class="lpic">'+productList[j].discountTag+'<img src="'+productList[j].picPath+'"></a>';
882                    guessHtml += '<div class="lBot">';
883                    guessHtml += '<a href="'+productList[j].pcDetailUrl+'" target="_blank" class="lBot-txt">'+productList[j].productName+'</a>';
884                    guessHtml += '<div class="lBot-buy">';
885                    guessHtml += '<div class="lBot-buy-price">ï¿¥'+productList[j].price+'</div>';
886                    guessHtml += '<a href="javascript:void(0)" onclick="toast('+productList[j].productId+')" class="lBot-buy-btn"></a>';
887                    guessHtml += "</div>";
888                    guessHtml += "</div>";
889                    guessHtml += "</div>";
890                    guessAllHtml += guessHtml;
891                }
892                guessAllHtml += '</div>';
893                guessAllHtml += '</div>';
894                guessAllHtml += '</div>';
895                guessAllHtml += '<input id="oldProductStr_'+productId+'" name="oldProductStr" type="hidden" value="'+productId+'"/>';
896                guessAllHtml += '<input id="likeProductStr_'+productId+'" name="likeProductStr" type="hidden" value="'+likeProductStr+'"/>';
897                $('#guessLike_' + productId).html(guessAllHtml);
898            }
899        }
900
901    }
902}
903
904var cleanGuessLikeList = function(){
905    allCheckProductList = [];
906    oldCheckProductList = [];
907    newCheckProductList = [];
908}
909
910//提示
911var toast = function (productId) {
912    $(".toast").fadeIn().find("p").html("已加入购物车");
913    setTimeout(function () {
914        $(".toast").fadeOut().find("p").html("");
915    },2000);
916    saveCheckProdctCookie();
917    $.cookie("guessYouLike_flag",1,{ path: '/newweb/' , domain: '.med66.com'});
918    window.location = "//sale.med66.com/newweb/cart/initCart.shtm?cartParam="+productId+":1";
919}
920
921var reloadHisChoose = function () {
922    //取得本地存储的
923    var checkedListStr =  getLocalCookie('guessYouLike_checkedList');
924    if (typeof checkedListStr != "undefined" && checkedListStr != null && checkedListStr != "") {
925        var checkedList = checkedListStr.substring(0, checkedListStr.length - 1).split(",");
926        for(var i=0;i< checkedList.length;i++){
927            var productId = checkedList[i];
928            $('#product_'+productId).prop("checked", true);
929            $("#product_"+productId).val(productId+":1");
930            $('#product_'+productId).parents("li").addClass("on");
931            $('#product_'+productId).prev().addClass("on");
932            // 重新计算价钱
933            getNeedMoney();
934        }
935    }
936
937    $(".shoppingCart-mod .course-con").each(function(){
938        var $this = $(this);
939        var otherChk = $this.find(".con li");
940        var nums = 0;
941        //选中+1
942        for(var i = 0; i< otherChk.length;i++){
943            if(otherChk.eq(i).find(".course-chk i").hasClass("on")){
944                nums++;
945            }
946        }
947        //单科辅导全选状态
948        if(otherChk.length == nums ){
949            $this.find(".tit i").addClass("on")
950            $this.find(".tit").addClass("on")
951        }
952    });
953
954    var allChkLen = $(".shoppingCart-mod .con li");
955    //全选按钮状态
956    for(var j = 0; j< allChkLen.length;j++){
957        if(!allChkLen.eq(j).find("i").hasClass("on")){
958            flag = false
959            break;
960        }
961    }
962    if(flag){
963        $(".all-chkTags").addClass("on")
964    }
965
966    //调用接口拼接猜你喜欢
967    var chooseProductList = [];
968    var emptyList = [];
969    $('input[name="checkProduct"]').each(function(){//遍历每一个名字为checkProduct的复选框
970        var productId = $(this).val().split(":")[0];
971        if($(this).is(':checked')){
972            chooseProductList.push(productId);
973        }
974    });
975    if(chooseProductList.length > 0){
976        guessYouLike(chooseProductList,emptyList);
977    }
978}
979
980var saveCheckProdctCookie = function (){
981    var checkedListStr = '';
982    $('input[name="checkProduct"]').each(function(){//遍历每一个名字为checkProduct的复选框
983        var productId = $(this).val().split(":")[0];
984        if($(this).is(':checked')) {
985            checkedListStr += productId+',';
986        }
987    });
988
989    $.cookie("guessYouLike_checkedList",checkedListStr,{ path: '/' , domain: '.med66.com'});
990}

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.