Procházet zdrojové kódy

Merge branch 'dev2.8.5' of http://192.168.3.207:10080/qmx/jy into dev2.8.5

zhangxinlei1996 před 5 roky
rodič
revize
0a925d2ef4

+ 13 - 8
src/jfw/modules/subscribepay/src/service/vipRenewUpgrade.go

@@ -88,10 +88,12 @@ func (this *RenewUpgrade) RenewUpgradeCreateOrder() {
 	} else {
 	} else {
 		industry = append(industry, "no")
 		industry = append(industry, "no")
 	}
 	}
-	areas := qutil.ObjToMap(this.GetString("areas"))               //已购买区域
-	industrys := strings.Split(this.GetString("industryarr"), ",") //已购买行业
-	date := this.GetString("time")                                 //不延长时为空,正常为 年或月
-	payWay := this.GetString("payWay")                             //支付方式
+	areas := qutil.ObjToMap(this.GetString("areas"))                 //已购买区域
+	industrys := strings.Split(this.GetString("industryarr"), ",")   //已购买行业
+	allArea := qutil.ObjToMap(this.GetString("allArea"))             //已购+新增区域
+	allIndustry := strings.Split(this.GetString("allIndustry"), ",") //已购+新增行业
+	date := this.GetString("time")                                   //不延长时为空,正常为 年或月
+	payWay := this.GetString("payWay")                               //支付方式
 	log.Println("payWay", payWay)
 	log.Println("payWay", payWay)
 	//	effect := this.GetString("effect")         //升级 生效日期 立即生效-now  下月一号生效-下月一号的时间戳
 	//	effect := this.GetString("effect")         //升级 生效日期 立即生效-now  下月一号生效-下月一号的时间戳
 	pay_source := this.GetString("pay_source") //类型  续费-Renew or 升级-Upgrade
 	pay_source := this.GetString("pay_source") //类型  续费-Renew or 升级-Upgrade
@@ -111,6 +113,9 @@ func (this *RenewUpgrade) RenewUpgradeCreateOrder() {
 		if len(industrys) == 1 && industrys[0] == "" { //去掉[""]
 		if len(industrys) == 1 && industrys[0] == "" { //去掉[""]
 			industrys = []string{}
 			industrys = []string{}
 		}
 		}
+		if len(allIndustry) == 1 && allIndustry[0] == "" { //去掉[""]
+			allIndustry = []string{}
+		}
 		if !(pay_source == "Renew" || pay_source == "Upgrade") {
 		if !(pay_source == "Renew" || pay_source == "Upgrade") {
 			return &entity.FuncResult{false, errors.New("未知操作"), nil}
 			return &entity.FuncResult{false, errors.New("未知操作"), nil}
 		}
 		}
@@ -227,11 +232,11 @@ func (this *RenewUpgrade) RenewUpgradeCreateOrder() {
 			//			totalfee = addPrice - nowPrice //已购+新增的总价格 - 已购总价格 = 升级差价
 			//			totalfee = addPrice - nowPrice //已购+新增的总价格 - 已购总价格 = 升级差价
 			totalfee = addAreaY + addAreaM + oldAreaY + oldAreaM + addIndustryY + addIndustryM
 			totalfee = addAreaY + addAreaM + oldAreaY + oldAreaM + addIndustryY + addIndustryM
 			if date_unit == 1 { //升级中的延长时间
 			if date_unit == 1 { //升级中的延长时间
-				lengPrice := entity.JyVipSubStruct.GetSubVipPrice(area, industry, date_count, 1) //单位为年的已购+新增延长时间价格
-				totalfee = totalfee + lengPrice                                                  //已购+新增延长时间价格 + 升级差价 = 最终价格
+				lengPrice := entity.JyVipSubStruct.GetSubVipPrice(allArea, allIndustry, date_count, 1) //单位为年的已购+新增延长时间价格
+				totalfee = totalfee + lengPrice                                                        //已购+新增延长时间价格 + 升级差价 = 最终价格
 			} else if date_unit == 2 {
 			} else if date_unit == 2 {
-				lengPrice := entity.JyVipSubStruct.GetSubVipPrice(area, industry, date_count, 2) //单位为月的已购+新增延长时间价格
-				totalfee = totalfee + lengPrice                                                  //已购+新增延长时间价格 + 升级差价 = 最终价格
+				lengPrice := entity.JyVipSubStruct.GetSubVipPrice(allArea, allIndustry, date_count, 2) //单位为月的已购+新增延长时间价格
+				totalfee = totalfee + lengPrice                                                        //已购+新增延长时间价格 + 升级差价 = 最终价格
 			}
 			}
 		}
 		}
 		log.Println("price", totalfee)
 		log.Println("price", totalfee)

+ 95 - 8
src/web/templates/weixin/vipsubscribe/vip_upgrade.html

@@ -975,6 +975,8 @@
         var oldMonthPrice = 0;
         var oldMonthPrice = 0;
         var areasArr = {};
         var areasArr = {};
 	    var industrysArr = [];
 	    var industrysArr = [];
+	    var allArea = {};
+	    var allIndustry = [];
 	    var nowRenew = "";
 	    var nowRenew = "";
         function FinallyPrice(){
         function FinallyPrice(){
         	$(".save_upgrade").attr('disabled','disabled');
         	$(".save_upgrade").attr('disabled','disabled');
@@ -1018,8 +1020,56 @@
 				if(buyCheck){
 				if(buyCheck){
 					$(".save_upgrade").removeAttr("disabled");
 					$(".save_upgrade").removeAttr("disabled");
 				}
 				}
+				if(area !== ""&&area !== undefined){
+					for(let province in area){
+			    		let citys = area[province];
+			    		if(citys.length===0){
+							allArea[province] = [];
+			    		}else{
+			    			allArea[province] = citys;
+			    		}
+			    	}
+					for(let province in vipArea){
+						let citys = vipArea[province];
+						if(allArea[province] === undefined){
+							allArea[province] = citys
+						}else{
+							let cityArr = [];
+							for(let i in citys){
+								cityArr.push(citys[i]);
+							}
+							for(let i in allArea[province]){
+								cityArr.push(allArea[province][i]);
+							}
+							//
+							for (var x = 0; x < cityArr.length; x++) {
+					            for (var j =x+1; j <cityArr.length; ) {
+					                if (cityArr[x] === cityArr[j]){
+					                    cityArr.splice(j, 1);
+					                }
+					                else j++;
+					            }
+					       	}
+							//
+							allArea[province] = cityArr;
+						}
+						if(province === "全国"){
+							allArea = {"全国":[]};
+						}
+					}
+				}
 			}else{
 			}else{
 				areasArr = null;
 				areasArr = null;
+				if(area !== ""&&area !== undefined){
+					for(let province in area){
+			    		let citys = area[province];
+			    		if(citys.length===0){
+							allArea[province] = [];
+			    		}else{
+			    			allArea[province] = citys;
+			    		}
+			    	}
+				}
 			}
 			}
 //			if(sessionStorage.vipSubSelectAreaUpgrade!==""&&sessionStorage.vipSubSelectAreaUpgrade!==undefined){
 //			if(sessionStorage.vipSubSelectAreaUpgrade!==""&&sessionStorage.vipSubSelectAreaUpgrade!==undefined){
 //				var vipArea = JSON.parse(sessionStorage.vipSubSelectAreaUpgrade);
 //				var vipArea = JSON.parse(sessionStorage.vipSubSelectAreaUpgrade);
@@ -1090,11 +1140,30 @@
 						industrysArr = ["全部行业"];
 						industrysArr = ["全部行业"];
 					}
 					}
 				}
 				}
+				if(buyerclass!==""&&buyerclass!==undefined){
+					for(let i in buyerclass){
+			    		let industry = buyerclass[i];
+			    		allIndustry.push(industry);
+			        }
+					for(let i in vipIndustry){
+						let industry = vipIndustry[i];
+						allIndustry.push(industry);
+						if(industry === "全部行业"){
+							allIndustry = ["全部行业"];
+						}
+					}
+				}
 				if(buyCheck){
 				if(buyCheck){
 					$(".save_upgrade").removeAttr("disabled");
 					$(".save_upgrade").removeAttr("disabled");
 				}
 				}
 			}else{
 			}else{
 				industrysArr = null;
 				industrysArr = null;
+				if(buyerclass!==""&&buyerclass!==undefined){
+					for(let i in buyerclass){
+			    		let industry = buyerclass[i];
+			    		allIndustry.push(industry);
+			    	}
+			    }
 			}
 			}
 			
 			
 //			if(sessionStorage.vipSubSelectIndustryUpgrade!==""&&sessionStorage.vipSubSelectIndustryUpgrade!==undefined){
 //			if(sessionStorage.vipSubSelectIndustryUpgrade!==""&&sessionStorage.vipSubSelectIndustryUpgrade!==undefined){
@@ -1133,6 +1202,14 @@
 		            }
 		            }
 		       	}
 		       	}
 			}
 			}
+			for (var x = 0; x < allIndustry.length; x++) {
+	            for (var j =x+1; j <allIndustry.length; ) {
+	                if (allIndustry[x] === allIndustry[j]){
+	                    allIndustry.splice(j, 1);
+	                }
+	                else j++;
+	            }
+	       	}
 			
 			
 			console.log("industrysArr",industrysArr);
 			console.log("industrysArr",industrysArr);
 //			if(sessionStorage.effectiveDate !== ""&&sessionStorage.effectiveDate!==undefined){
 //			if(sessionStorage.effectiveDate !== ""&&sessionStorage.effectiveDate!==undefined){
@@ -1242,12 +1319,12 @@
 					addIndustryPriceY = getsubVipOrderPrice(area,industrysArr,[nowUpgradeYear,1]);
 					addIndustryPriceY = getsubVipOrderPrice(area,industrysArr,[nowUpgradeYear,1]);
 					addIndustryPriceM = getsubVipOrderPrice(area,industrysArr,[nowUpgrade,2]);
 					addIndustryPriceM = getsubVipOrderPrice(area,industrysArr,[nowUpgrade,2]);
 				}
 				}
-//				let yearprice = getsubVipOrderPrice(areasArr,industrysArr,[nowUpgradeYear,1]);
-//				let monthprice = getsubVipOrderPrice(areasArr,industrysArr,[nowUpgrade,2]);
+				let yearprice = getsubVipOrderPrice(allArea,allIndustry,[nowUpgradeYear,1]);
+				let monthprice = getsubVipOrderPrice(allArea,allIndustry,[nowUpgrade,2]);
 //				price = yearprice + monthprice;
 //				price = yearprice + monthprice;
 				price = addAreaPriceY + addAreaPriceM + oldAreaPriceY + oldAreaPriceM + addIndustryPriceY + addIndustryPriceM;
 				price = addAreaPriceY + addAreaPriceM + oldAreaPriceY + oldAreaPriceM + addIndustryPriceY + addIndustryPriceM;
-				let yearprice = addAreaPriceY + oldAreaPriceY + addIndustryPriceY;
-				let monthprice = addAreaPriceM + oldAreaPriceM + addIndustryPriceM;
+//				let yearprice = addAreaPriceY + oldAreaPriceY + addIndustryPriceY;
+//				let monthprice = addAreaPriceM + oldAreaPriceM + addIndustryPriceM;
 				if(monthprice === 0){
 				if(monthprice === 0){
 					completeMonth = ((yearprice / nowUpgradeYear) / 10).toFixed(1);
 					completeMonth = ((yearprice / nowUpgradeYear) / 10).toFixed(1);
 					completeYear = (yearprice / nowUpgradeYear).toFixed(1);
 					completeYear = (yearprice / nowUpgradeYear).toFixed(1);
@@ -1271,10 +1348,11 @@
 				if(industrysArr !== null){
 				if(industrysArr !== null){
 					addIndustryPriceM = getsubVipOrderPrice(area,industrysArr,[nowUpgrade,2]);
 					addIndustryPriceM = getsubVipOrderPrice(area,industrysArr,[nowUpgrade,2]);
 				}
 				}
+				let monthprice = getsubVipOrderPrice(allArea,allIndustry,[nowUpgrade,2]);
 //				price = getsubVipOrderPrice(areasArr,industrysArr,[nowUpgrade,2]);
 //				price = getsubVipOrderPrice(areasArr,industrysArr,[nowUpgrade,2]);
 				price = addAreaPriceM + oldAreaPriceM + addIndustryPriceM;
 				price = addAreaPriceM + oldAreaPriceM + addIndustryPriceM;
-				completeMonth = (price / nowUpgrade).toFixed(1);
-				completeYear = ((price / nowUpgrade)*10).toFixed(1);
+				completeMonth = (monthprice / nowUpgrade).toFixed(1);
+				completeYear = ((monthprice / nowUpgrade)*10).toFixed(1);
 				console.log("<1",price)
 				console.log("<1",price)
 			}
 			}
 			
 			
@@ -1369,7 +1447,14 @@
             //
             //
             let areaarr = area;
             let areaarr = area;
         	let industryarr = buyerclass;
         	let industryarr = buyerclass;
-        	
+        	let allAreaArr = allArea;
+        	let allIndustryArr = allIndustry;
+        	if(allAreaArr["全国"]){
+                allAreaArr={};
+            }
+        	if(allIndustryArr.length==1&&allIndustryArr[0]=="全部行业"){
+                allIndustryArr=[];
+            }
             //
             //
             let renew_time = $('.choose_item.lengthen .info').text();
             let renew_time = $('.choose_item.lengthen .info').text();
             let times = "";
             let times = "";
@@ -1382,11 +1467,13 @@
 	    		"industry": industryArr,
 	    		"industry": industryArr,
 	    		"areas": JSON.stringify(areaarr),
 	    		"areas": JSON.stringify(areaarr),
 	    		"industryarr": industryarr.join(","),
 	    		"industryarr": industryarr.join(","),
+	    		"allArea": JSON.stringify(allAreaArr),
+	    		"allIndustry": allIndustryArr.join(","),
 	    		"payWay": "wx_js",
 	    		"payWay": "wx_js",
 //	    		"effect": effect,
 //	    		"effect": effect,
 	    		"pay_source" : "Upgrade",
 	    		"pay_source" : "Upgrade",
 	    		"time": times,
 	    		"time": times,
-	    		"nowUp": Number(nowRenew),
+//	    		"nowUp": Number(nowRenew),
 //	    		"isvalidOk" : isvalidOk,
 //	    		"isvalidOk" : isvalidOk,
 	    	}
 	    	}
 	    	console.log(param)
 	    	console.log(param)