wangkaiyue 5 лет назад
Родитель
Сommit
593a57cf62

+ 10 - 2
src/jfw/modules/app/src/web/staticres/jyapp/vipsubscribe/css/vip_purchase.css

@@ -392,9 +392,9 @@
   padding: 0;
 }
 
-.radio-form .weui-cell__hd {
+/* .radio-form .weui-cell__hd {
   transform: scale(0.8);
-}
+} */
 
 .radio-form .read {
   font-size: .26rem;
@@ -781,3 +781,11 @@
   color: #fff;
   background-color: #2cb7ca;
 }
+
+.choose_item .show_time{
+  display:block;
+  width: 5rem;
+  text-align: right;
+  padding-right: .2rem;
+  color: #000;
+}

+ 207 - 147
src/jfw/modules/app/src/web/staticres/jyapp/vipsubscribe/js/common.js

@@ -1,19 +1,19 @@
 //请求同意调用
-function $DoPost(url,param={},callback,async=true){
+function $DoPost(url, param = {}, callback, async = true) {
 	$.ajax({
-		url: url+"?t="+new Date().getTime(),
+		url: url + "?t=" + new Date().getTime(),
 		type: "POST",
 		data: param,
 		async: async,
 		dataType: "json",
-		success: function(r){
+		success: function (r) {
 			callback(r)
-			if(r.error||r.errMsg){
-				var errTip = r.error||r.errMsg;
-				weui.toast(errTip,{
-		          duration: 2000,
-		          className: 'custom-toast',
-		        });
+			if (r.error || r.errMsg) {
+				var errTip = r.error || r.errMsg;
+				weui.toast(errTip, {
+					duration: 2000,
+					className: 'custom-toast',
+				});
 			}
 		}
 	})
@@ -21,61 +21,90 @@ function $DoPost(url,param={},callback,async=true){
 
 //获取url参数
 function getParam(name) {
-  var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
-  var r = window.location.search.substr(1).match(reg); //获取url中"?"符后的字符串并正则匹配
-  var context = "";
-  if (r != null)
-      context = r[2];
-  reg = null;
-  r = null;
-  return context == null || context == "" || context == "undefined" ? "" : context;
+	var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
+	var r = window.location.search.substr(1).match(reg); //获取url中"?"符后的字符串并正则匹配
+	var context = "";
+	if (r != null)
+		context = r[2];
+	reg = null;
+	r = null;
+	return context == null || context == "" || context == "undefined" ? "" : context;
 }
 
 //省份 城市 分类
-function getAreaClassArr_index(area){
-	let cityArr=[];//城市
-    let provinceArr=[];//省份
-    for(var i in area) {
-      let citys=area[i]
-      if(citys.length>0){
-        cityArr = cityArr.concat(citys);
-        provinceArr.push(i+"("+cityArr.join("、")+")")
-      }else{
-    	if(i=="全国"){
-			continue
+function getAreaClassArr_index(area) {
+	let cityArr = [];//城市
+	let provinceArr = [];//省份
+	for (var i in area) {
+		let citys = area[i]
+		if (citys.length > 0) {
+			cityArr = cityArr.concat(citys);
+			provinceArr.push(i + "(" + cityArr.join("、") + ")")
+		} else {
+			if (i == "全国") {
+				continue
+			}
+			provinceArr.push(i)
 		}
-        provinceArr.push(i)
-      }
-    }
-    return SortArr(provinceArr)
+	}
+	return SortArr(provinceArr)
 }
 
 //省份 城市 分类
-function getAreaClassArr(area){
-	let cityArr=[];//城市
-    let provinceArr=[];//省份
-    for(var i in area) {
-      let citys=area[i]
-      if(citys.length>0){
-        cityArr = cityArr.concat(citys);
-      }else{
-    	if(i=="全国"){
-			continue
+function getAreaClassArr(area) {
+	let cityArr = [];//城市
+	let provinceArr = [];//省份
+	for (var i in area) {
+		let citys = area[i]
+		if (citys.length > 0) {
+			cityArr = cityArr.concat(citys);
+		} else {
+			if (i == "全国") {
+				continue
+			}
+			provinceArr.push(i)
 		}
-        provinceArr.push(i)
-      }
-    }
-    return [SortArr(provinceArr),SortArr(cityArr)]
+	}
+	return [SortArr(provinceArr), SortArr(cityArr)]
 }
 
 //对数组进行排序(拼音)
-function SortArr(arr){
+function SortArr(arr) {
 	arr = arr.sort(function compareFunction(item1, item2) {
-	    return item1.localeCompare(item2);
+		return item1.localeCompare(item2);
 	});
 	return arr
 }
 
+//购买设置
+function getBuySet(area, industry) {
+	if (industry[0] === "全部行业") industry = [];
+	if (area["全国"]) area = {};
+	//计算地区数量
+	var buyset = {
+		"areacount": -1,  //省份数量
+		"buyerclasscount": -1,
+		"citys": {  //购买省份中城市数量
+		}
+	};
+	//行业
+	if (industry.length != 0) {
+		buyset.buyerclasscount = industry.length
+	}
+	//地区
+	if (!$.isEmptyObject(area)) {
+		buyset.areacount = 0;
+		for (var i in area) {
+			let citys = area[i];
+			if (citys.length === 0) {
+				buyset.areacount++
+			} else {
+				buyset.citys[i] = citys.length
+			}
+		}
+	}
+	return buyset
+}
 
 /* vip订阅价格
 	area:地区 {}
@@ -84,116 +113,147 @@ function SortArr(arr){
 	price 价格表
    return 价格(单位:分)
 */
-var priceData
-function getsubVipOrderPrice(area,industry,t,price){
-	if(!price){
-		if(priceData){
-			price=priceData
-		}else{
-			$DoPost("/subscribepay/vipsubscribe/getPrice",{},function(r){
-	          if(r){
-	            price=r;
-	            priceData=price;
-	          }else{
-	        	weui.toast("加载价格异常",{
-		          duration: 2000,
-		          className: 'custom-toast',
-		        });
-	          }
-	        },false)
+function getsubVipOrderPrice(area, industry, t, price) {
+	return getsubVipOrderPriceBybuyset(getBuySet(area, industry), t, price)
+}
+
+var priceData;
+
+//根据购买设置 获取支付金额
+function getsubVipOrderPriceBybuyset(buyset, t, price) {
+	if (!price) {
+		if (priceData) {
+			price = priceData
+		} else {
+			$DoPost("/subscribepay/vipsubscribe/getPrice", {}, function (r) {
+				if (r) {
+					price = r;
+					priceData = price;
+				} else {
+					weui.toast("加载价格异常", {
+						duration: 2000,
+						className: 'custom-toast',
+					});
+				}
+			}, false)
 		}
-	}	
-	if(industry[0] == "全部行业")industry= []
-	if(area["全国"]) area={}
-	//当行业数量大于最大值price.BuyerClassMaxCount 按照全行业计算
-	var industryNum = industry.length
-	if (industryNum > price.buyerClassMaxCount) {
-		industryNum = 0
 	}
-	//计算地区数量
-	var pCount = -1         //省份数量
-	var citysCountMap = {} //购买省份中城市数量
-	
-	if(!$.isEmptyObject(area)){
-		pCount=0
-		for(var i in area) {
-			let citys=area[i]
-			if(citys.length==0){
-				pCount++
-			}else{
-				if(citys.length > price.cityMaxCount){
-					pCount++
-				}else{
-					citysCountMap[i]= citys.length 
-				}
+	var vipbuyset = JSON.parse(JSON.stringify(buyset));
+
+	if (!$.isEmptyObject(vipbuyset.citys)) {
+		for (var i in vipbuyset.citys) {
+			if(vipbuyset.citys[i]>price.cityMaxCount){
+				vipbuyset.areacount++
+				delete vipbuyset.citys[i]
 			}
-	    }
+		}
 	}
-	
+
 	//当省份数量大于price.ProvinceMaxCount 按照全国计算
-	if (pCount > price.provinceMaxCount) {
-		pCount = -1
+	if (vipbuyset.areacount > price.provinceMaxCount) {
+		vipbuyset.areacount = -1
 	}
-	
-	if(t[0]>price.monthMaxCount&&t[1]==2) t[0]=10 //月份十个月以上价格一样
-	
-	if(pCount == -1){//计算全国套餐价格
-		if(industryNum==1) return getSetMealPrice(0,1,t[1],price)*t[0]/100 //全国1行业套餐
-		if(industryNum==0) return getSetMealPrice(0,0,t[1],price)*t[0]/100 //全国全行业套餐
-		return	getSetMealPrice(0,industryNum,t[1],price) * t[0] / 100 //全国多行业套餐
+	//当行业数量大于price.buyerClassMaxCount按照全行业
+	if (vipbuyset.buyerclasscount > price.buyerClassMaxCount) {
+		vipbuyset.buyerclasscount = -1
 	}
-	
-	var final_price	= pCount*getSetMealPrice(1,industryNum,t[1],price)*t[0];//计算省份价格
-	
-	for(var i in citysCountMap) {
-		var thisPrice = 0;	
-		var citys = area[i]
-		if(citysCountMap[i]==1){//单城市
-			thisPrice = getSetMealPrice(2,industryNum,t[1],price)*t[0];
-		}else{//多城市
-			if(industryNum==0||industryNum==1){//多城市 单行业
-				thisPrice = citysCountMap[i] * getSetMealPrice(2,industryNum,t[1],price) * t[0];	
-			}else{//多城市 多行业
-				var industry_Price= price.buyerClassPrice  * industryNum;
-				var city_Price = price.cityPrice *citysCountMap[i];
-				thisPrice = (industry_Price + city_Price) * t[0];
-				// if(t[1]==1) thisPrice *= 10 //年的价格是月价格的10倍
+	if (t[0] > price.monthMaxCount && t[1] === 2) t[0] = 10;//月份十个月以上价格一样
+
+	if (vipbuyset.areacount === -1) {//计算全国套餐价格
+		if (vipbuyset.buyerclasscount === 1) return getSetMealPrice(0, 1, t[1], price) * t[0] / 100; //全国1行业套餐
+		if (vipbuyset.buyerclasscount === 0) return getSetMealPrice(0, 0, t[1], price) * t[0] / 100; //全国全行业套餐
+		return getSetMealPrice(0, vipbuyset.buyerclasscount, t[1], price) * t[0] / 100 //全国多行业套餐
+	}
+
+	//var final_price = vipbuyset.areacount * getSetMealPrice(1, vipbuyset.buyerclasscount, t[1], price) * t[0];//计算省份价格
+	var final_price = 0;//计算省份价格
+
+	for (var i in vipbuyset.citys) {
+		var thisPrice = 0;
+		if (vipbuyset.citys[i] === 1) {//单城市
+			thisPrice = getSetMealPrice(2, vipbuyset.buyerclasscount, t[1], price) * t[0];
+		} else {//多城市
+			if (vipbuyset.buyerclasscount === 0 || vipbuyset.buyerclasscount === 1) {//多城市 单行业
+				if (vipbuyset.citys[i] > price.cityMaxCount) {
+					vipbuyset.areacount++;
+				} else {
+					thisPrice = vipbuyset.citys[i] * getSetMealPrice(2, vipbuyset.buyerclasscount, t[1], price) * t[0];
+				}
+			} else {//多城市 多行业
+				//var industry_Price = price.buyerClassPrice * vipbuyset.buyerclasscount;
+				//var city_Price = price.cityPrice * vipbuyset.citys[i];
+				//thisPrice = (industry_Price + city_Price) * t[0];
+				if (vipbuyset.citys[i] > price.cityMaxCount) {
+					vipbuyset.areacount++;
+				} else {
+					thisPrice = getSetMealPrice(2, vipbuyset.buyerclasscount, t[1], price) * vipbuyset.citys[i] * t[0];
+					// if (t[1] === 1) thisPrice *= 10 //年的价格是月价格的10倍
+				}
 			}
 		}
-    	final_price += thisPrice;
-    }
-    return final_price/100
+		final_price += thisPrice;
+	}
+	final_price += vipbuyset.areacount * getSetMealPrice(1, vipbuyset.buyerclasscount, t[1], price) * t[0]
+	return final_price / 100
 }
+
 //获取套餐价格
-//c(city) 全国:0 省:1 市:2 
-//iCount(industry) 全行业:0 行业:1 其他:多个行业
+//c(city) 全国:0 省:1 市:2
+//iCount(industry) 全行业:-1 其他:多个行业
 //u(unit) 年:1 月:2
-function getSetMealPrice(c,iCount,u,price){
-	var t = u==2 //是否是月单位
-	switch(c){
-	case 0:
-		if(iCount==0){
-			if(t)return price.month.allProvince_allBuyerClass  //1月全国全行业
-			return price.year.allProvince_allBuyerClass //1年全国全行业
-		}else{
-			if(t)return price.month.allProvince_oneBuyerClass * iCount //1月全国icount个行业
-			return price.year.allProvince_oneBuyerClass * iCount	//1年全国icount个行业
-		}
-	case 1:
-		if(iCount==0){
-			if(t)return price.month.oneProvince_allBuyerClass  //1月1省全行业
-			return price.year.oneProvince_allBuyerClass	//1年1省全行业
-		}else{
-			if(t)return price.month.oneProvince_oneBuyerClass * iCount //1月1省icount个行业
-			return price.year.oneProvince_oneBuyerClass * iCount	//1年1省icount个行业
-		}
-	default:
-		if(iCount==0){
-			if(t)return price.month.oneCity_allBuyerClass  //1月1市全行业
-			return price.year.oneCity_allBuyerClass	//1年1市全行业
-		}else{
-			if(t)return price.month.oneCity_oneBuyerClass * iCount //1月1市icount个行业
-			return price.year.oneCity_oneBuyerClass * iCount	//1年1市icount个行业
-		}
+function getSetMealPrice(c, iCount, u, price) {
+	var t = u === 2; //是否是月单位
+	switch (c) {
+		case 0:
+			if (iCount === -1) {
+				if (t) return price.month.allProvince_allBuyerClass;  //1月全国全行业
+				return price.year.allProvince_allBuyerClass; //1年全国全行业
+			} else {
+				if (t) return price.month.allProvince_oneBuyerClass * iCount; //1月全国icount个行业
+				return price.year.allProvince_oneBuyerClass * iCount;	//1年全国icount个行业
+			}
+		case 1:
+			if (iCount === -1) {
+				if (t) return price.month.oneProvince_allBuyerClass;  //1月1省全行业
+				return price.year.oneProvince_allBuyerClass	//1年1省全行业
+			} else {
+				if (t) return price.month.oneProvince_oneBuyerClass * iCount; //1月1省icount个行业
+				return price.year.oneProvince_oneBuyerClass * iCount	//1年1省icount个行业
+			}
+		default:
+			if (iCount === -1) {
+				if (t) return price.month.oneCity_allBuyerClass;  //1月1市全行业
+				return price.year.oneCity_allBuyerClass	//1年1市全行业
+			} else {
+				if (t) return price.month.oneCity_oneBuyerClass * iCount; //1月1市icount个行业
+				return price.year.oneCity_oneBuyerClass * iCount	//1年1市icount个行业
+			}
 	}
+}
+
+//查看用户是否有未执行的订单
+function checkOrder(wz) {
+	var flag = false;
+	$.ajax({
+		type: 'post',
+		url: '/subscribepay/afterPay/checkOrder?t=' + new Date().getTime(),
+		data: {},
+		async: false,
+		dataType: 'json',
+		success: function (r) {
+			flag = r.flag;
+			if (r.flag) {
+				if (wz != 1) {
+					weui.toast('订单尚未到期', {
+						duration: 3000,
+						className: 'custom-toast',
+						callback: function () {
+							console.log('close')
+						}
+					});
+				}
+			}
+		}
+	});
+	return flag
 }

+ 58 - 30
src/jfw/modules/app/src/web/staticres/jyapp/vipsubscribe/js/editArea.js

@@ -1,6 +1,7 @@
 // 后端数据结构
 var areaData = {
     "data": {
+        "isTrial": true,
         "area": {
             // "北京": [],
             // "河南": [
@@ -169,6 +170,22 @@ function initResult() {
     let isAll = areaData.data.buyset.areacount;
     let p = areaData.data.area;
     let count = areaData.data.buyset.citys;
+    // 添加可选择城市文字 和自定义属性值
+    if (areaData.data.buyset.areacount != -1) {
+        for (const c in count) {
+            $('.province').each(function () {
+                let t = $(this).text().trim();
+                if (c == t) {
+                    $(this).attr("data-count", count[c]);
+                    $(this).after(`<em class="optional">可选择 ${count[c]} 个市</em>`)
+                    let that = $(this).parent('.tab:not(.municipality)');
+                    that.bind('click', function () {
+                        slideFun($(this));
+                    })
+                }
+            })
+        }
+    }
     // 渲染已选择结果
     for (const k in p) {
         console.log(p[k], k)
@@ -187,11 +204,12 @@ function initResult() {
                 }
             })
         } else {
-            console.log(k, p[k].length)
+            console.log(k, p[k].length,$('.city.active').length)
             $('.city').each(function () {
+                let activeLength = $(this).parents('li').find('.active').length;
                 let t = $(this).text().trim();
                 p[k].forEach(v => {
-                    // console.log(v,t)
+                    //console.log(v,t,"vvv")
                     if (v == t) {
                         let that = $(this).parents('li').find('.tab:not(.municipality)');
                         console.log("v==t")
@@ -200,37 +218,29 @@ function initResult() {
                             slideFun($(this));
                         })
                         $(this).addClass('active').removeAttr('disabled').parent().siblings('.tab').find('input').addClass('half');
-                        return;
+                        // 判断购买的地市数与选择的地市是否相等,相等则把其他地市禁用
+                        $('.province').each(function(item,index){
+                            let dataCount = $(this).attr('data-count');
+                            let activeLength = $(this).parent().siblings().find('.active').length;
+                            // console.log(dataCount)
+                            if(dataCount){
+                                // console.log(dataCount,activeLength,"object")
+                                if(activeLength >= dataCount){
+                                    $(this).parent().siblings().find('.city').not('.active').attr('disabled',true)
+                                }
+                            }
+                        })
+
                     }
                 })
+
             })
-            for (const c in count) {
-                if (p[k].length >= count[c]) {
-                    if (isAll != -1) {
-                        $('.city:not(.active)').attr('disabled', true)
-                    } else {
-                        $('.city:not(.active)').removeAttr('disabled')
-                    }
-                }
-            }
-        }
-    }
-    // 添加可选择城市文字 和自定义属性值
-    if (areaData.data.buyset.areacount != -1) {
-        for (const c in count) {
-            $('.province').each(function () {
-                let t = $(this).text().trim();
-                if (c == t) {
-                    $(this).attr("data-count", count[c]);
-                    $(this).after(`<em class="optional">可选择 ${count[c]} 个市</em>`)
-                    let that = $(this).parent('.tab:not(.municipality)');
-                    that.bind('click', function () {
-                        slideFun($(this));
-                    })
-                }
-            })
+
         }
     }
+    $('ul.area-list .province[data-count]').parent().on('click',  function(){
+        slideFun($(this));
+    })
     //$('.result_name').append(getAreaClassArr_index(areaData.data.area).join("、"));
     $('.count').html($('.checkbox:not(.other):checked').length)
     // 如果选中的省份数量等于购买的省份数量,则将其他未选中的省份禁用
@@ -242,7 +252,7 @@ function initResult() {
 
 $(function () {
     // 省下拉事件
-    $('.tab:not(.municipality)').on('click', function () {
+    /*$('.tab:not(.municipality)').on('click', function () {
         if (checkAnimatedRuning()) {
             return
         }
@@ -253,7 +263,7 @@ $(function () {
         }
         $(this).toggleClass('selected').next('.tab_content:not(:animated)').slideToggle(500);
         $(this).parent().siblings().children('.tab').removeClass('selected');
-    });
+    });*/
     getData();
     // 初始化
     init();
@@ -284,6 +294,11 @@ $(function () {
             getResult()
         } else {
             $('.checkbox:not(:checked)').attr('disabled', true)
+            if (areaData.data.isTrial) {
+                showTip(`<span style="white-space: nowrap;">您只选择试用了` + totalLength + `个省份</span>,<br><span style="white-space: nowrap;">如需更多,请前往VIP订阅进行购买</span>`);
+            } else {
+                showTip(`<span style="white-space: nowrap;">您只购买了` + totalLength + `个省份,如需更多请升级<span></p>`)
+            }
             getResult()
         }
         if ($(this).is(':checked')) {
@@ -336,6 +351,12 @@ $(function () {
             } else if (isActive > 0 && isActive == count) {
                 $(this).parents('li').find('input.checkbox').addClass('half');
                 $(this).parent('div').find('.city:not(.active)').attr('disabled', true)
+                //提示订阅
+                if (areaData.data.isTrial) {
+                    showTip(`<span style="white-space: nowrap;">您只选择试用了` + $(this).parents('li').find(".province").attr("data-count") + `个市</span>,<br><span style="white-space: nowrap;">如需更多,请前往VIP订阅进行购买</span>`);
+                } else {
+                    showTip(`<span style="white-space: nowrap;">您只购买了` + $(this).parents('li').find(".province").attr("data-count") + `个市,如需更多请升级<span></p>`)
+                }
                 getResult()
             } else {
                 $(this).parent('div').find('.city:not(.active)').removeAttr('disabled')
@@ -389,3 +410,10 @@ function theSameAs(select) {
     let tmp2 = getAreaClassArr(areaData.data.area);
     return (JSON.stringify(tmp1[0].sort()) === JSON.stringify(tmp2[0].sort())) && (JSON.stringify(tmp1[1].sort()) === JSON.stringify(tmp2[1].sort()));
 }
+
+function showTip(msg) {
+    weui.toast(msg, {
+        duration: 2000,
+        className: 'custom-toast',
+    });
+}

+ 75 - 52
src/jfw/modules/app/src/web/templates/vipsubscribe/choose_area.html

@@ -452,7 +452,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});
                 }
@@ -587,16 +589,25 @@
             console.log("this.selectObj:", tmpSelect)
             $('.result_name').append(html)
             AreaChoose.isOpen()
-
+            console.log(result)
             if (result.length > 0) { //已选择
                 $('.reset-btn').removeAttr("disabled");
                 $('.save-btn').removeAttr("disabled");
                 AreaChoose.flushPrice(); //刷新价格
+            } else {
+                $('.save-btn').attr("disabled", "disabled");
+                AreaChoose.flushPrice(-1); //刷新价格
             }
         },
         submitArea: function () {
             let addCity = $('.result_name').text(); //新增的城市
             sessionStorage.setItem("vipSubSelectArea", JSON.stringify(AreaChoose.selectObj));
+            if (sessionStorage.getItem("vipSubSelectArea_buyed")) {
+                sessionStorage.removeItem("vipSubSelectArea_buyed");
+            }
+            if (sessionStorage.getItem("areaSelectNotFlushed")) {
+                sessionStorage.removeItem("areaSelectNotFlushed");
+            }
             history.go(-1);
         },
         isAllSelected: function () {
@@ -613,42 +624,44 @@
             }
         },
         isOpen: function () {
-            let pHeight = $('.result_text').height();
-            let minHeight = $('.result_text').css('min-height');
+            let pHeight = $('.result_text').height()
+            let minHeight = $('.result_text').css('min-height')
             let rows = Math.round(Math.round(pHeight) / parseFloat(minHeight));
-            console.log("高度:" + pHeight, "最小高度" + minHeight, "行数:" + rows);
+            console.log("高度:" + pHeight, "最小高度" + minHeight, "行数:" + rows)
             if (rows == 1) {
-                $('.packup').hide();
-                $('.detail').hide();
+                $('.packup').hide()
+                $('.detail').hide()
             } else if (rows == 2) {
+                console.log($('.result_name').html().trim().length)
                 let length = $('.result_name').html().trim().length;
                 if (length >= 50) {
-                    $('.detail').show();
-                    $('.packup').hide();
+                    $('.detail').show()
+                    $('.packup').hide()
                 } else {
-                    $('.detail').hide();
-                    $('.packup').hide();
+                    $('.detail').hide()
+                    $('.packup').hide()
                 }
+
             } else {
-                $('.packup').show();
-                $('.detail').hide();
+                $('.packup').show()
+                $('.detail').hide()
             }
         },
         inintClick: function () {
             $('.detail').click(function () {
-                $('.result_text').removeClass('line_two');
-                $(".result").css("padding-bottom", "0.3rem");
+                $('.result_text').removeClass('line_two')
+                $(".result").css("padding-bottom", "0.3rem")
                 $(this).hide();
-                $('.packup').show();
-            });
+                $('.packup').show()
+            })
             $('.packup').click(function () {
-                $(".result").css("padding-bottom", "0.2rem");
-                $('.result_text').addClass('line_two');
+                $(".result").css("padding-bottom", "0.2rem")
+                $('.result_text').addClass('line_two')
                 $(this).hide();
-                $('.detail').show();
-            });
+                $('.detail').show()
+            })
             $("body").on('click', '.slide a', function () {
-                var s = $(this).html();
+                var s = $(this).html()
                 if (s == '#') {
                     return;
                 }
@@ -691,7 +704,7 @@
                         } else {
                             $(this).parent().parent().siblings('.tab_content').children('.city').removeClass('active');
                             if ($(".province .checkbox:checked").length == 0) {//若没有省份被选中 则选中全国
-                                $(".checkbox.other").prop('checked', true);
+                                //$(".checkbox.other").prop('checked', true);
                                 $(".checkbox").removeClass("half");
                             }
                         }
@@ -704,6 +717,7 @@
 
             //执行已购买城市函操作dom函数
             $('.tab_content').on('click', '.city', function () {
+                $(".checkbox.other").prop('checked', false);
                 //AreaChoose.showSelected(false)
                 $(this).toggleClass('active')
                 var isActive = $(this).parent().find('.city.active').length
@@ -720,52 +734,58 @@
                     $(this).parent('div').siblings('.tab').children().children('.checkbox').prop(
                         'checked', false).removeClass('half');
                 }
-                AreaChoose.isAllSelected()
+                //AreaChoose.isAllSelected()
                 AreaChoose.getResult($(this).parent('div').siblings('.tab').find('.province').text()) //出入选择的省份
             })
 
-            $('.other').on('change', function () { //选择全国
+            /*$('.other').on('change', function () { //选择全国
                 AreaChoose.reset();
-            })
+            })*/
 
             $('.save-btn').click(function () {  // 提交
                 AreaChoose.submitArea();
             })
             $('.reset-btn').click(function () {  //重置
-                if (!$(".other").is(':checked')) {
-                    $(".other").trigger("click");
-                }
+                AreaChoose.reset();
             })
         },
         reset: function () {
-            var checked = $(".other").is(':checked');
-            if (checked) {
-                $('.tab_content').slideUp(500)
-                $('.tab span i').css({
-                    "display": "inline-block",
-                    "transform": "rotate(0)"
-                })
-                $('.tab:not(.whole)').removeClass('selected').children('.province').find(
-                    'input').prop({
-                    'checked': false,
-                    "disabled": false
-                });
-                $('.tab_content').find('.city').removeClass('active').attr({
-                    "disabled": false,
-                    "checked": false
-                })
-                AreaChoose.getResult()
-            } else {
-                AreaChoose.getResult()
-            }
+            $('.tab_content').slideUp(500)
+            $('.tab span i').css({
+                "display": "inline-block",
+                "transform": "rotate(0)"
+            })
+            $('.tab').removeClass('selected').children('.province').find(
+                'input').prop({
+                'checked': false,
+                "disabled": false
+            }).removeClass('half');
+            $('.tab_content').find('.city').removeClass('active').attr({
+                "disabled": false,
+                "checked": false
+            })
+            AreaChoose.getResult()
         },
-        flushPrice: function () {
+        buyset: undefined,
+        flushPrice: function (flag) {
             if (!this.vipSubisTrial) {
+                if (!this.buyset && sessionStorage.getItem("vipSubBuySet")) {
+                    this.buyset = JSON.parse(sessionStorage.getItem("vipSubBuySet"))
+                }
                 $('.tips_d_money').css("display", "block");
-                var price = getsubVipOrderPrice(this.selectObj, this.selectedIndustryArr, this.timeSelect);
+                let price;
+                if (sessionStorage.getItem("industrySelectNotFlushed")) {
+                    let mBuyset = getBuySet(this.selectObj, []);
+                    mBuyset.buyerclasscount = this.buyset.buyerclasscount;
+                    price = getsubVipOrderPriceBybuyset(mBuyset, this.timeSelect);
+                } else {
+                    price = getsubVipOrderPrice(this.selectObj, this.selectedIndustryArr, this.timeSelect);
+                }
                 $('.tips_d_money').text('¥' + price);
             }
-
+            if (flag === -1) {
+                $('.tips_d_money').css("display", "none");
+            }
         },
         animatedRuning: false,
         checkAnimatedRuning: function () {
@@ -781,11 +801,14 @@
     };
 
     $(function () {
+        AreaChoose.isOpen();
         AreaChoose.inintData(); //初始化 已选择和已购买数据
         AreaChoose.inintPage(); //初始化城市数据
+
         //AreaChoose.getNationwide();//默认选中全国
         AreaChoose.showSelected(true);//回显已选择
         /* 判断已购买的城市 在不在 全部城市里面,在,将按钮置灰,不可点击 */
+
         AreaChoose.getResult("", true);
         AreaChoose.inintClick();
     })

+ 59 - 30
src/jfw/modules/app/src/web/templates/vipsubscribe/choose_industry.html

@@ -259,18 +259,18 @@
 
     // 点击导航跳转
     $("body").on('click', '.slide a', function () {
-        var s = $(this).html();
-        if (s === '#') {
+        var s = $(this).html()
+        if (s == '#') {
             return;
         }
         document.querySelector('#' + s).scrollIntoView({block: 'center'});
-    });
+    })
 
     function insertIndustryItem(letter, industryArr = []) {
-        if (!letter) return;
-        var query = `#${letter[0].toUpperCase()} .item_industry_list`;
-        var industryItemContainer = $(query);
-        var buttonArr = [];
+        if (!letter) return
+        var query = `#${letter[0].toUpperCase()} .item_industry_list`
+        var industryItemContainer = $(query)
+        var buttonArr = []
 
         for (var i = 0; i < industryArr.length; i++) {
             buttonArr.push(`<button class="industry_item" ${industryArr[i].disabled ? 'disabled' : ''}>${industryArr[i].name}</button>`)
@@ -279,16 +279,16 @@
     }
 
     function findSelectedIndustry(notShowTip) {
-        var buttons = $('.select-area-box .list button');
+        var buttons = $('.select-area-box .list button')
         // 找到已选择的数组(有active类的数组)
-        var selectedArr = [];
+        var selectedArr = []
         buttons.each(function () {
             if ($(this).hasClass('active')) {
                 if ($(this).attr("disabled") != "disabled") {
                     selectedArr.push($(this).text())
                 }
             }
-        });
+        })
 
         // 显示隐藏优惠tips
         if (selectedArr.length >= 4 && !vipSubisTrial && !notShowTip) {
@@ -298,22 +298,25 @@
         }
 
         if (selectedArr.length > 0) {//是否已选择
-            selectedIndustryArr = selectedArr;
+            selectedIndustryArr = selectedArr
 
             $(".reset-btn").removeAttr("disabled");
             $(".save-btn").removeAttr("disabled");
             flushPrice()//刷新价格
+        } else {
+            $(".save-btn").attr("disabled", "disabled");
+            flushPrice(-1)//刷新价格
         }
 
 
-        var selectedStr = selectedArr.join('、');
-        $('.result .result_name').text(selectedStr);
+        var selectedStr = selectedArr.join('、')
+        $('.result .result_name').text(selectedStr)
 
-        if (selectedArr.length === 0 && selectedIndustryArr[0] != "一个行业") {
-            var allButton = $('#all button');
-            allButton.trigger('click');
+        /*if (selectedArr.length === 0 && selectedIndustryArr[0] != "一个行业") {
+            var allButton = $('#all button')
+            allButton.trigger('click')
             $('.result .result_name').text(allButton.text())
-        }
+        }*/
         if (selectedArr.length === buttons.length - 1) {
             // 除全部行业外所有按钮都被选中了
             $('#all button').trigger('click');
@@ -334,47 +337,73 @@
         })
     }
 
-    function flushPrice() {
+    var buyset = undefined;
+
+    function flushPrice(flag) {
         if (!vipSubisTrial) {
-            var price = getsubVipOrderPrice(selectedAreaObj, selectedIndustryArr, timeSelect);
+            if (!buyset && sessionStorage.getItem("vipSubBuySet")) {
+                buyset = JSON.parse(sessionStorage.getItem("vipSubBuySet"))
+            }
+            let price;
+
+            if (sessionStorage.getItem("areaSelectNotFlushed")) {
+                mBuyset = getBuySet({}, selectedIndustryArr);
+                mBuyset.citys = buyset.citys;
+                mBuyset.areacount = buyset.areacount;
+                price = getsubVipOrderPriceBybuyset(mBuyset, timeSelect);
+            } else {
+                price = getsubVipOrderPrice(selectedAreaObj, selectedIndustryArr, timeSelect);
+            }
+
             $('.tips_d_money').css("display", "block").text('¥' + price);
         }
+        if (flag == -1) {
+            $('.tips_d_money').css("display", "none");
+        }
     }
 
     // 每个button的点击事件
     $('.select-area-box .list').on('click', 'button', function (e) {
-        $('.tips_btn .btns button').removeAttr('disabled');
+        $('.tips_btn .btns button').removeAttr('disabled')
 
-        $(this).toggleClass('active');
+        $(this).toggleClass('active')
         // 如果点击全部行业,则其他所有按钮都取消active
         if ($(this).parents('li')[0].id === 'all') {
-            $('.select-area-box .list button').removeClass('active');
+            $('.select-area-box .list button').removeClass('active')
             $('#all button').addClass('active')
         } else {
             $('#all button').removeClass('active')
         }
 
         findSelectedIndustry()
-    });
+    })
 
     // 重置按钮事件
     $('.reset-btn').on('click', function () {
-        $("#all .industry_item").trigger("click");
-    });
+        //$("#all .industry_item").trigger("click");
+        $('.select-area-box .list button').removeClass('active');
+        findSelectedIndustry()
+    })
 
     //=======================
 
 
     // 确认按钮事件
     $('.save-btn').on('click', function () {
-        console.log(selectedIndustryArr);
+        console.log(selectedIndustryArr)
         sessionStorage.setItem("vipSubSelectIndustry", JSON.stringify(selectedIndustryArr));
+        if (sessionStorage.getItem("vipSubSelectIndustry_buyed")) {
+            sessionStorage.removeItem("vipSubSelectIndustry_buyed");
+        }
+        if (sessionStorage.getItem("industrySelectNotFlushed")) {
+            sessionStorage.removeItem("industrySelectNotFlushed")
+        }
         history.go(-1);
-    });
+    })
 
-    var selectedIndustryArr = ["一个行业"]; //已选择行业
-    var selectedAreaObj = {"一个省": ["一个市"]};//计算价格临时变量
-    var timeSelect = [1, 2];//计算价格临时变量 timeSelect[0]时长  timeSelect[1] 1:年 2:月
+    var selectedIndustryArr = ["一个行业"] //已选择行业
+    var selectedAreaObj = {"一个省": ["一个市"]} //计算价格临时变量
+    var timeSelect = [1, 2]//计算价格临时变量 timeSelect[0]时长  timeSelect[1] 1:年 2:月
     var vipSubisTrial = false;
     $(function () {
         try {

+ 1 - 1
src/jfw/modules/app/src/web/templates/vipsubscribe/edit_subscribe.html

@@ -96,7 +96,7 @@
                     if (this.reqData.buyset.areacount > 0) {
                         descText += "、"
                     }
-                    descText += cityCount + "个地市"
+                    descText += cityCount + "个地市"
                 }
                 $(".edit_item.area .item_bottom").text(descText);
             }

+ 14 - 3
src/jfw/modules/app/src/web/templates/vipsubscribe/edit_subscribe_industry.html

@@ -293,6 +293,9 @@
             if (this.reqData.buyset.buyerclasscount != -1) { //非全部行业 展示数量
                 $('.total').html(this.reqData.buyset.buyerclasscount);
                 $('.count').html(this.reqData.industry.length);
+                //$('.optional_count').css({"width": "100%", "position": "fixed", "top": 0, "z-index": 9999});
+                $('.result').css({"top": $('.optional_count').height()});
+                //$('.select-area-box').css({"padding-top": $('.optional_count').height()});
                 if (this.reqData.industry.length >= this.reqData.buyset[2]) {
                     $('.industry_item:not(.active)').attr('disabled', true);
                 }
@@ -318,7 +321,11 @@
                         return
                     }
                     if (EditIndustry.reqData.buyset.buyerclasscount != -1) { //购买不是全部行业 不能点击
-                        EditIndustry.showTip(`<span style="white-space: nowrap;">您只购买了${EditIndustry.reqData.buyset.buyerclasscount}个行业,如需更多请升级<span></p>`);
+                        if (EditIndustry.reqData.isTrial) {
+                            EditIndustry.showTip(`<span style="white-space: nowrap;">您只选择试用了${EditIndustry.reqData.buyset.buyerclasscount}个行业</span>,<br><span style="white-space: nowrap;">如需更多,请前往VIP订阅进行购买</span>`);
+                        } else {
+                            EditIndustry.showTip(`<span style="white-space: nowrap;">您只购买了${EditIndustry.reqData.buyset.buyerclasscount}个行业,如需更多请升级<span></p>`);
+                        }
                         return
                     }
                     $('.select-area-box .list button').removeClass('active');
@@ -357,7 +364,7 @@
                     "value": JSON.stringify(EditIndustry.reqData.industry)
                 }, function (r) {
                     if (r.success) {
-                        window.location.replace('/jyapp/vipsubscribe/submitEditSubFinish');
+                        window.location.replace('/front/vipsubscribe/submitEditSubFinish');
                     }
                 }, false)
                 $("#enter").removeAttr("disabled");
@@ -387,7 +394,11 @@
             // 显示隐藏优惠tips
             if (selectedArr.length >= EditIndustry.reqData.buyset.buyerclasscount && EditIndustry.reqData.buyset.buyerclasscount != -1) {
                 if (!isInit) {
-                    EditIndustry.showTip(`<span style="white-space: nowrap;">您只购买了${EditIndustry.reqData.buyset.buyerclasscount}个行业,如需更多请升级<span></p>`);
+                    if (EditIndustry.reqData.isTrial) {
+                        EditIndustry.showTip(`<span style="white-space: nowrap;">您只选择试用了${EditIndustry.reqData.buyset.buyerclasscount}个行业</span>,<br><span style="white-space: nowrap;">如需更多,请前往VIP订阅进行购买</span>`);
+                    } else {
+                        EditIndustry.showTip(`<span style="white-space: nowrap;">您只购买了${EditIndustry.reqData.buyset.buyerclasscount}个行业,如需更多请升级<span></p>`);
+                    }
                 }
                 $('.industry_item:not(.active)').attr('disabled', 'disabled');
             } else {

+ 38 - 59
src/jfw/modules/app/src/web/templates/vipsubscribe/vip_purchase.html

@@ -55,9 +55,10 @@
                     {{if not .T.isTrial }}
                         <a href="javascript:;">
                             <span class="label">订阅周期</span>
-                            <input type="text" readonly="readonly" disabled style="color:#000;opacity:0.7;" value="1个月"
+                            <span class="show_time">一个月</span>
+                            <input type="text" readonly="readonly" disabled style="display:none;" value="1个月"
                                    class="info choose_time">
-                            <i class="iconfont icon-arrow choose_time"></i>
+                            <i class="iconfont icon-arrow"></i>
                         </a>
                     {{else}}
                         <div class="free-7day">
@@ -294,28 +295,6 @@
                 if (sessionStorage.getItem("vipSubSelectIndustry")) {
                     this.industrySelect = JSON.parse(sessionStorage.getItem("vipSubSelectIndustry"));
                 }
-                {{if eq .T.orderType 5 }}
-                $('#payHandle').text("立即续费");
-                //即将到期 回显已购买
-                if (!sessionStorage.getItem("vipSubSelectArea") || !sessionStorage.getItem("vipSubSelectIndustry")) {
-                    $DoPost("/subscribepay/editSub/getSubBuyMsg", {}, function (r) {
-                        if (r.success) {
-                            if (!$.isEmptyObject(r.data.area)) {
-                                purchase.areaSelect = r.data.area
-                            } else {
-                                purchase.areaSelect = {"全国": []}
-                            }
-                            if (r.data.industry.length != 0) {
-                                purchase.industrySelect = r.data.industry
-                            } else {
-                                purchase.industrySelect = ["全部行业"]
-                            }
-                            sessionStorage.setItem("vipSubSelectArea", JSON.stringify(purchase.areaSelect));
-                            sessionStorage.setItem("vipSubSelectIndustry", JSON.stringify(purchase.industrySelect));
-                        }
-                    }, false)
-                }
-                {{end}}
                 {{if .T.again}}    //再次购买回显
                 {{if eq .T.again 1 }}
                 var orderCode = getParam("orderCode")
@@ -383,9 +362,6 @@
 
             if (!$.isEmptyObject(this.areaSelect) && !this.areaSelect["全国"] && !this.areaSelect["一个省"]) { //选择有行业信息 且不是全国
                 var tipTxt = "已选择 ";
-                {{if eq .T.orderType 5 }}
-                tipTxt = "已购买 ";
-                {{end}}
                 if (provinceArr.length > 0) tipTxt += provinceArr.length + " 个省级区域";
                 if (cityArr.length > 0) {
                     if (provinceArr.length > 0) tipTxt += "、";
@@ -426,9 +402,6 @@
             }*/
             if (this.industrySelect.length > 0 && this.industrySelect[0] != "全部行业" && this.industrySelect[0] != "一个行业") { //选择有行业信息
                 var tipTxt = "已选择 ";
-                {{if eq .T.orderType 5 }}
-                tipTxt = "已购买 ";
-                {{end}}
                 $(".choose_industry").val(tipTxt+ this.industrySelect.length + " 个行业");
             } else if (this.industrySelect.length > 0 && this.industrySelect[0] == "全部行业") {
                 $(".choose_industry").val("全部行业");
@@ -451,26 +424,33 @@
                 if (this.timeSelect[0] >= 10) {
                     $('.profit_tips').text("已选择" + this.timeSelect[0] + "个月,建议“按年订阅”").show();
                 }
+                if (this.timeSelect[0] == 1) {
+                    $('#number_box_month button:eq(0)').attr("disabled", "disabled");
+                } else {
+                    $('#number_box_month button:eq(0)').removeAttr("disabled");
+                }
             }
+            $(".choose_item .show_time").text(tmp);
             $(".info.choose_time").val(tmp);
         },
-        flushPrice: function () {
+        flushPrice: function (time, flag) {
             if (this.vipSubisTrial) {
                 $('.price strong').text('¥0.00');
             } else {
-                var price = getsubVipOrderPrice(this.areaSelect, this.industrySelect, this.timeSelect, this.price);
-                $('.price strong').text('¥' + price);
-                $('.computed_price').html('¥' + price);
+                var price = getsubVipOrderPrice(this.areaSelect, this.industrySelect, time, this.price);
+                if (flag === 1) {
+                    $('.price strong').text('¥' + price);
+                } else if (flag === 2) {
+                    $('.computed_price').html('¥' + price);
+                } else {
+                    $('.price strong').text('¥' + price);
+                    $('.computed_price').html('¥' + price);
+                }
+
             }
         }
     };
 
-    $(window).bind("pageshow", function (event) {
-        if (event.originalEvent.persisted) {
-            window.location.reload();
-        }
-    });
-
 
     $(function () {
         purchase.initData();
@@ -478,7 +458,7 @@
         purchase.showIndustry();
         purchase.showPrice();
         purchase.showTime();
-        purchase.flushPrice();
+        purchase.flushPrice(purchase.timeSelect);
         checkOk();
         var time_limit;//定义一个周期变量
         /*------ 关闭弹窗事件  点击取消或遮罩层 -----*/
@@ -495,7 +475,6 @@
             $('#pay_way').show(200);
         });
 
-
         /* -----  选择完支付方式、订阅周期 回显到页面 -------*/
         // 对支付方式选择的input绑定点击事件
         $('#pay_way input:radio[name="way"]').click(function () {
@@ -562,16 +541,16 @@
                     .numboxStep;
             }
             $number.text(currentNum);
-            purchase.timeSelect = [Number(currentNum), 2];
-            purchase.flushPrice();
+            purchase.timeSelect_tmp = [Number(currentNum), 2];
+            purchase.flushPrice(purchase.timeSelect_tmp, 2);
             //var price = (5.8 * currentNum).toFixed(1);
             //$('.computed_price').html('¥' + price)
             var firstButton = $('#number_box_month button:first');
             var lastButton = $('#number_box_month button:last');
             if (currentNum >= 10) {
-                $('.profit_tips').text("已选择" + currentNum + "个月,建议“按年订阅”").show()
+                $('.profit_tips').text("已选择" + currentNum + "个月,建议“按年订阅”").show();
             } else {
-                $('.profit_tips').hide()
+                $('.profit_tips').hide();
             }
             // 如果为操作后的结果为1,则锁定减号按钮
             if (currentNum === data.numboxMin) {
@@ -600,8 +579,8 @@
             // 渲染结果 保留一位小数
             //let result = (Number(id) * 58).toFixed(1);
             //$('.computed_price').html('¥' + result)
-            purchase.timeSelect = [Number(id), 1];
-            purchase.flushPrice();
+            purchase.timeSelect_tmp = [Number(id), 1]
+            purchase.flushPrice(purchase.timeSelect_tmp, 2);
         });
 
         /* -------- 选择按月订阅  radio触发的事件------- */
@@ -613,13 +592,11 @@
             }
             if (!isChecked) {
                 $('#number_box_month button').attr('disabled', true)
-            } else {
-                $('#number_box_month button').removeAttr('disabled')
             }
             //let result = (Number(val) * 5.8).toFixed(1);
             //$('.computed_price').html('¥' + result);
-            purchase.timeSelect = [Number(val), 2];
-            purchase.flushPrice();
+            purchase.timeSelect_tmp = [Number(val), 2];
+            purchase.flushPrice(purchase.timeSelect_tmp, 2);
 
         });
         /* -------- 选择按年订阅  radio触发的事件------- */
@@ -633,8 +610,8 @@
             if (isChecked) {
                 $('#number_box_year span:eq(0)').addClass('active').siblings().removeClass('active')
             }
-            purchase.timeSelect = [Number(val), 1];
-            purchase.flushPrice();
+            purchase.timeSelect_tmp = [Number(val), 1];
+            purchase.flushPrice(purchase.timeSelect_tmp, 2);
         });
 
         // 确认订阅周期
@@ -646,17 +623,20 @@
                     val = $('.active').html();
                     $('#time_cycle').hide(function () {
                         $('.choose_time').val(val)
+                        $('.show_time').text(val);
                     });
-                    purchase.timeSelect = [parseInt(val[0]), 1]
+                    purchase.timeSelect_tmp = [parseInt(val[0]), 1]
                 } else if ($(v).is(':checked') === true) {
                     val = $('.month_number').html();
                     $('#time_cycle').hide(function () {
                         $('.choose_time').val(val + '个月')
+                        $('.show_time').text(val + '个月');
                     });
-                    purchase.timeSelect = [parseInt(val), 2]
+                    purchase.timeSelect_tmp = [parseInt(val), 2]
                 }
             });
-            purchase.flushPrice();
+            purchase.timeSelect = purchase.timeSelect_tmp;
+            purchase.flushPrice(purchase.timeSelect, 1);
             sessionStorage.setItem("vipSubSelectTime", JSON.stringify(purchase.timeSelect));
         });
         $("input").bind("input propertychange change", function (event) {
@@ -767,11 +747,10 @@
         sessionStorage.removeItem("vipSub_read");
         sessionStorage.removeItem("vipSubPayWay");
         sessionStorage.removeItem("historypushDataCache");
-        sessionStorage.To_introducePage=2;
+        sessionStorage.To_introducePage = 2;
     }
 
 </script>
-
 </body>
 
 </html>

+ 1 - 0
src/jfw/modules/app/src/web/templates/weixin/historypush.html

@@ -940,6 +940,7 @@ function AdClick(e,isExternal,link,title){
 </script>
 <script src="{{Msg "seo" "cdn"}}/vipsubscribe/js/weui.min.js?v={{Msg "seo" "version"}}"></script>
 <script src="{{Msg "seo" "cdn"}}/dataExport/js/mapJSON.js?v={{Msg "seo" "version"}}"></script>
+<script src="{{Msg "seo" "cdn"}}/vipsubscribe/js/mapArea.js?v={{Msg "seo" "version"}}"></script>
 <script type="text/javascript" charset="UTF-8">
 function mapData(){
 	var _citySessionData = null