Explorar el Código

首次购买 半选状态

wangkaiyue hace 5 años
padre
commit
8bd307499b

+ 8 - 2
src/web/staticres/vipsubscribe/css/choose_area.css

@@ -494,16 +494,22 @@
 
 #choose_area .select-area-box .tab .province .checkbox:checked {
   border: 0;
-  background: url(../image/xuanzhong.png) no-repeat center center;
+  background: url(/vipsubscribe/image/xuanzhong.png) no-repeat center center;
   background-size: 100% 100%;
 }
 
 #choose_area .select-area-box .tab .province .checkbox[disabled] {
   border: 0;
-  background: url(../image/active_disabled.png) no-repeat center center;
+  background: url(/vipsubscribe/image/active_disabled.png) no-repeat center center;
   background-size: 100% 100%;
 }
 
+#choose_area .select-area-box .tab .province .checkbox.half:checked {
+  border: 0 !important;
+  background: url(/vipsubscribe/image/banxuan.png) no-repeat center center !important;
+  background-size: cover !important;
+}
+
 #choose_area .select-area-box label::after {
   font-size: 14px;
   float: right;

+ 1 - 1
src/web/staticres/vipsubscribe/js/editArea.js

@@ -103,7 +103,7 @@ function getResult() {
     $('count').html($('.checkbox:not(.other):checked').length);
     $('.result_name').append(data.substring(0, data.length - 1));
     //校验是否修改
-    if (theSameAs(obj)) {
+    if (theSameAs(obj) || $.isEmptyObject(obj)) {
         $('#enter').attr("disabled", "disabled");
     } else {
         $('#enter').removeAttr("disabled");

+ 24 - 9
src/web/templates/weixin/vipsubscribe/choose_area.html

@@ -443,7 +443,9 @@
         selectProvince: function (province, canClick) { //设置选中省份 province 省份
             $($('.tab .province')).each(function (index, dom) {
                 if (province == $.trim($(dom).text())) {
-                    if (province != "全国") $(".checkbox.other").attr("checked", false); //取消全国选中
+                    if (province != "全国") {
+                        $(".checkbox.other").attr("checked", false); //取消全国选中
+                    }
                     $(dom).children('.checkbox').attr({"checked": true, "disabled": !canClick});//选中此省份
                     $(dom).parents().siblings('.tab_content').find(".city").addClass("active").attr({"disabled": !canClick});
                 }
@@ -457,15 +459,16 @@
                         $(dom).addClass('active').attr('disabled', !canClick).parents().siblings('.tab')
                             .addClass('selected').children('.province').children('.checkbox').attr({
                             "checked": true
-                        })
+                        }).addClass('half');
                     }
                 })
             })
         },
-        getResult: function (changeCity,isFirst) {   /* 选中结果 */
+        getResult: function (changeCity, isFirst) {   /* 选中结果 */
             //如果选中所有,则转为全国
             if ($(".city").length == $(".city.active").length) {
                 $(".checkbox.other").trigger("click");
+                $(".checkbox").removeClass("half");
                 return
             }
             var tmpSelect = {};
@@ -566,7 +569,7 @@
                 if (selectCityMax > 2) {
                     $('.tips_btn .tips_d_text').text("已选择" + selectCityMax + "个市,建议购买“全省”").slideDown();
                 } else {
-                    if (selectProvince > 9&&!isFirst) {
+                    if (selectProvince > 9 && !isFirst) {
                         $('.tips_btn .tips_d_text').text("已选择" + selectProvince + "个省,建议购买“全国”").slideDown()
                     } else {
                         $(".tips_d_text").slideUp();
@@ -673,12 +676,19 @@
                     $(".province input").prop('checked', false);
                     $(".city").removeClass('active');
                     $(this).prop('checked', true);
+                    $(".checkbox").removeClass("half");
                 } else {
                     $(".checkbox.other").prop('checked', false);
-                    if ($(this).is(':checked') == false) {
-                        $(this).parent().parent().siblings('.tab_content').children('.city').removeClass('active');
-                        if ($(".province .checkbox:checked").length == 0) {//若没有省份被选中 则选中全国
-                            $(".checkbox.other").prop('checked', true);
+                    if (!$(this).is(':checked')) {
+                        if ($(this).hasClass("half")) {//判断当前是否是半选
+                            $(this).prop("checked", true).removeClass("half");
+                            $(this).parent().parent().siblings('.tab_content').children('.city').addClass('active');
+                        } else {
+                            $(this).parent().parent().siblings('.tab_content').children('.city').removeClass('active');
+                            if ($(".province .checkbox:checked").length == 0) {//若没有省份被选中 则选中全国
+                                $(".checkbox.other").prop('checked', true);
+                                $(".checkbox").removeClass("half");
+                            }
                         }
                     } else {
                         $(this).parent().parent().siblings('.tab_content').children('.city').addClass('active');
@@ -696,6 +706,11 @@
                     var input = $(this).parents('li').find('input.checkbox')
                     window.input = input
                     input.prop('checked', true)
+                    if (isActive != $(this).parent().find('.city').length) {//是否全选
+                        $(this).parent('div').siblings('.tab').find('.province .checkbox').addClass('half');
+                    } else {
+                        $(this).parent('div').siblings('.tab').find('.province .checkbox').removeClass('half');
+                    }
                 } else {
                     $(this).parent('div').siblings('.tab').children().children('.checkbox').prop(
                         'checked', false)
@@ -758,7 +773,7 @@
         AreaChoose.showSelected(true);//回显已选择
         /* 判断已购买的城市 在不在 全部城市里面,在,将按钮置灰,不可点击 */
 
-        AreaChoose.getResult("",true);
+        AreaChoose.getResult("", true);
         AreaChoose.inintClick();
     })
 </script>

+ 1 - 1
src/web/templates/weixin/vipsubscribe/edit_subscribe.html

@@ -94,7 +94,7 @@
 
             //行业展示                 
             if (this.reqData.buyset.buyerclasscount === -1) {
-                $(".edit_item.industry .item_bottom").text("已购买全");
+                $(".edit_item.industry .item_bottom").text("已购买全部行业");
             } else {
                 $(".edit_item.industry .item_bottom").text("已购买" + this.reqData.buyset.buyerclasscount + "个行业");
             }