xuzhiheng 5 жил өмнө
parent
commit
e43a33eb67

+ 3 - 0
src/jfw/modules/subscribepay/src/entity/subscribeVip.go

@@ -465,6 +465,9 @@ func (this *vipSubscribeStruct) GetSubVipPrice(area *map[string]interface{}, ind
 //计算价格
 func (this *vipSubscribeStruct) GetSubVipBuysetPrice(buyset *map[string]interface{}, count, unit int) int {
 	industryNum := qutil.IntAll((*buyset)["buyerclasscount"])
+	if industryNum == -1 {
+		industryNum = 0
+	}
 	//当行业数量大于最大值SubVipPrice.BuyerClassMaxCount 按照全行业计算
 	//		industryNum := len(industry)
 	if industryNum > SubVipPrice.BuyerClassMaxCount {

+ 2 - 0
src/jfw/modules/subscribepay/src/service/vipRenewUpgrade.go

@@ -280,11 +280,13 @@ func (this *RenewUpgrade) RenewUpgradeCreateOrder() {
 			oldPriceY := entity.JyVipSubStruct.GetSubVipBuysetPrice(oldBuyset, upgradeYear, 1)
 			oldPriceM := entity.JyVipSubStruct.GetSubVipBuysetPrice(oldBuyset, upgradeMonth, 2)
 			oldPrice := oldPriceY + oldPriceM
+			log.Println("oldPrice", oldPrice)
 			//			newPriceY := entity.JyVipSubStruct.GetSubVipPrice(allBuyArea, allIndustry, upgradeYear, 1)
 			//			newPriceM := entity.JyVipSubStruct.GetSubVipPrice(allBuyArea, allIndustry, upgradeMonth, 2)
 			newPriceY := entity.JyVipSubStruct.GetSubVipBuysetPrice(buyset, upgradeYear, 1)
 			newPriceM := entity.JyVipSubStruct.GetSubVipBuysetPrice(buyset, upgradeMonth, 2)
 			newPrice := newPriceY + newPriceM
+			log.Println("newPrice", newPrice)
 			totalfee = newPrice - oldPrice
 			// --------升级价格差价计算--------
 			if date_unit == 1 { //升级中的延长时间

+ 14 - 3
src/web/staticres/vipsubscribe/js/updateArea.js

@@ -218,6 +218,7 @@ $(function () {
     }
 
     // 求需要M的数量
+	window.getResultWithMCount = getResultWithMCount
     function getResultWithMCount() {
         let added = {
             country: 0,
@@ -242,15 +243,24 @@ $(function () {
             } else {
                 added.country = 0
                 let pName = $(dom).find('.province').text().replace(/\s+ | [\r\n]/g, '')
-                // 获取当前dom下有几个按钮有active样式
+                // 获取当前dom下有几个按钮有active样式(点亮和灰色按钮的总数)
                 let activeButtonLength = $(dom).find('button.active').length
 
                 // 判断该省是否有购买过的城市
                 if ($(dom).attr('data-buy-city-count')) {
                     let buyCityCount = $(dom).attr('data-buy-city-count') - 0
+					// 获取城市不可点击的数量(灰色按钮的数量)
+					let alreadySelectedCount = $(dom).find('button[disabled]').length
+					// 得到你需要付钱的数量(可能是负值)
                     let aCityCount = activeButtonLength - buyCityCount
+					
                     if (aCityCount > 0) {
-                        added.city[pName] = aCityCount
+						// 说明有购买的城市
+						if (activeButtonLength - alreadySelectedCount === 0) {
+							added.province ++
+						} else {
+							added.city[pName] = aCityCount
+						}
                     } else {
                         // 选不到购买的个数
                     }
@@ -633,6 +643,7 @@ $(function () {
         //     province: 0,
         //     city: 0
         // }
+		sessionStorage.removeItem("vipAddCount");
         // 数组置0,在重新从数据中计算初始状态结果并返回
         for (let i in alreadyBuy) {
             for(let ii in alreadyBuy[i]) {
@@ -707,7 +718,7 @@ $(function () {
 		}else{
 			$(".tips_d_text").hide();
 		}
-		if(showCount === cityLength){
+		if(showCounts === cityLength){
 			showOther();
 		}
 	}

+ 20 - 4
src/web/templates/weixin/vipsubscribe/vip_upgrade.html

@@ -639,10 +639,24 @@
         	$("#buy").prop("checked", bCheck);
         }
         //新增区域
-	    if(sessionStorage.vipSubSelectAreaAdd!==""&&sessionStorage.vipSubSelectAreaAdd!==undefined&&sessionStorage.vipSubSelectCity!==undefined&&sessionStorage.vipSubSelectCity!==""){
-			var vipSubSelectArea = JSON.parse(sessionStorage.vipSubSelectAreaAdd);
+	  //   if(sessionStorage.vipSubSelectAreaAdd!==""&&sessionStorage.vipSubSelectAreaAdd!==undefined&&sessionStorage.vipSubSelectCity!==undefined&&sessionStorage.vipSubSelectCity!==""){
+			// var vipSubSelectArea = JSON.parse(sessionStorage.vipSubSelectAreaAdd);
+			// let cityLen = sessionStorage.vipSubSelectCity;
+			// if(vipSubSelectArea.country === -1){
+			// 	areaHtml = "已新增全国";
+			// 	$("#area").attr("placeholder", areaHtml);
+			// }else{
+			// 	areaHtml = "已新增 "+ vipSubSelectArea.province +" 个省级区域、"+ cityLen +" 个地市";
+			// 	if(Number(vipSubSelectArea.province) === 0 && Number(cityLen) === 0){
+			// 		areaHtml = "请选择升级区域";
+			// 	}
+			// 	$("#area").attr("placeholder", areaHtml);
+			// }
+	  //   }
+		if(sessionStorage.vipAddCount!==""&&sessionStorage.vipAddCount!==undefined&&sessionStorage.vipSubSelectCity!==undefined&&sessionStorage.vipSubSelectCity!==""){
+			var vipSubSelectArea = JSON.parse(sessionStorage.vipAddCount);
 			let cityLen = sessionStorage.vipSubSelectCity;
-			if(vipSubSelectArea.country === -1){
+			if(vipSubSelectArea.province === 0&&vipSubSelectArea.city === 0){
 				areaHtml = "已新增全国";
 				$("#area").attr("placeholder", areaHtml);
 			}else{
@@ -652,7 +666,7 @@
 				}
 				$("#area").attr("placeholder", areaHtml);
 			}
-	    }
+		}
 	    //新增行业
 	    if(sessionStorage.vipSubSelectIndustryAdd!==""&&sessionStorage.vipSubSelectIndustryAdd!==undefined){
 	    	var vipSubSelectIndustry = JSON.parse(sessionStorage.vipSubSelectIndustryAdd);
@@ -1305,6 +1319,8 @@
 	    	sessionStorage.removeItem("vipAddCount");
 	    	sessionStorage.removeItem("vipSubSelectCity");
 	    	sessionStorage.removeItem("buyCheck");
+			sessionStorage.removeItem("buyIndustry");
+			sessionStorage.removeItem("addIndustry");
 	    }
 	    
 	    //