$(function() { // 解决ios系统click 事件300毫秒的延迟 FastClick.attach(document.body); }); //请求同意调用 function $DoPost(url,param={},callback,async=true){ $.ajax({ url: url+"?t="+new Date().getTime(), type: "POST", data: param, async: async, dataType: "json", success: function(r){ if(r.error||r.errMsg){ var errTip = r.error||r.errMsg; weui.toast(errTip,{ duration: 2000, className: 'custom-toast', }); }else{ callback(r) } } }) } //获取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; } //省份 城市 分类 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) } } return [provinceArr,cityArr] } /* vip订阅 area:地区 {} industry:行业 [] time[count,unit] count:时间长度 unit 1:年 2:月 return 价格(单位:分) */ function getsubVipOrderPrice(area,industry,t){ if(industry[0] == "全部行业"){ industry= [] } if(area["全国"]){ if(industry.length==1) return getSetMealPrice(0,1,t[1])*t[0]/100 //全国1行业套餐 if(industry.length==0) return getSetMealPrice(0,0,t[1])*t[0]/100 //全国全行业套餐 return getSetMealPrice(0,0,t[1])*t[0]/100 //全国多行业套餐 } var final_price = 0//最终价格 for(var i in area) { let thisPrice = 0; let citys = area[i] if(citys.length>0){//市 if(citys.length==1){//单城市 thisPrice = getSetMealPrice(2,industry.length,t[1])*t[0]; }else{//多城市 if(industry.length==0||industry.length==1){//多城市 单行业 thisPrice = citys.length*getSetMealPrice(2,industry.length,t[1])*t[0]; }else{//多行业 多行业 if(t[1]==2){//月 var industry_Price= 580*industry.length>1800?1800:580*industry.length; var city_Price = citys.length*580>1180?1180:citys.length*580; if(t[0]>10) t[0]=10 //月份十个月以上价格一样 thisPrice = (industry_Price + city_Price)*t[0]; }else{//年 var industry_Price= 5800*industry.length>18000?18000:5800*industry.length; var city_Price = citys.length*5800>11800?11800:citys.length*5800; thisPrice = (industry_Price + city_Price)*5800*t[0]/100; } } } }else{//省 thisPrice = getSetMealPrice(1,industry.length,t[1])*t[0]; } //console.log("thisPrice",i,thisPrice) final_price += thisPrice; } return final_price/100 } //获取套餐价格 //c(city) 全国:0 省:1 市:2 //i(industry) 全行业:0 行业:1 其他:多个行业 //u(unit) 年:1 月:2 function getSetMealPrice(c,i,u){ let t = u==2 //是否是月单位 let icount=1 //行业个数 if(i>1){ icount=i; } switch(c){ case 0: if(i==0){ if(t)return 38800 //1月全国全行业 return 388000 //1年全国全行业 }else{ if(t)return 11800*icount //1月全国icount个行业 return 118000*icount //1年全国icount个行业 } case 1: if(i==0){ if(t)return 3800 //1月1省全行业 return 38000 //1年1省全行业 }else{ if(t)return 1180*icount //1月1省icount个行业 return 11800*icount //1年1省icount个行业 } default: if(i==0){ if(t)return 1800 //1月1市全行业 return 18000 //1年1市全行业 }else{ if(t)return 580*icount //1月1市icount个行业 return 5800*icount //1年1市icount个行业 } } }