Răsfoiți Sursa

fix: 超级订阅升级页面

yangfeng 4 ani în urmă
părinte
comite
eeedc5c0a2

+ 6 - 2
src/jfw/modules/app/src/web/staticres/jyapp/vipsubscribe/js/choose_area.js

@@ -457,12 +457,16 @@ $(function () {
   AreaChoose.isOpen();
   AreaChoose.inintData(); //初始化 已选择和已购买数据
   AreaChoose.inintPage(); //初始化城市数据
-
   //AreaChoose.getNationwide();//默认选中全国
   AreaChoose.showSelected(true);//回显已选择
   /* 判断已购买的城市 在不在 全部城市里面,在,将按钮置灰,不可点击 */
-
   AreaChoose.getResult("", true);
   AreaChoose.inintClick();
   sessionStorage.setItem("pay_read_cache", "1");
+  // 判断如果是从升级页面跳转来的,则解绑省份下拉事件,不让选择城市
+  // if (getParam('header') === 'upgrade') {
+  //   console.log('升级页面来的')
+    $(".select-area-box .tab:not(.municipality)").unbind('click')
+    $('.tab_content').unbind('click')
+  // }
 })

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

@@ -1,149 +1,149 @@
 //请求同意调用
-function $DoPost(url) {
-    var param = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
-    var callback = arguments.length > 2 ? arguments[2] : undefined;
-    var async = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
-    $.ajax({
-        url: url + "?t=" + new Date().getTime(),
-        type: "POST",
-        data: param,
-        async: async,
-        dataType: "json",
-        success: function success(r) {
-            callback(r);
+function $DoPost (url) {
+  var param = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
+  var callback = arguments.length > 2 ? arguments[2] : undefined;
+  var async = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
+  $.ajax({
+    url: url + "?t=" + new Date().getTime(),
+    type: "POST",
+    data: param,
+    async: async,
+    dataType: "json",
+    success: function success (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'
+        });
+      }
+    }
+  });
 }
 
 //获取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 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_index(area) {
-    var cityArr = [];//城市
-    var provinceArr = [];//省份
-    for (var i in area) {
-        var citys = area[i]
-        if (citys.length > 0) {
-            cityArr = cityArr.concat(citys);
-            provinceArr.push(i + "(" + cityArr.join("、") + ")")
-        } else {
-            if (i == "全国") {
-                continue
-            }
-            provinceArr.push(i)
-        }
+function getAreaClassArr_index (area) {
+  var cityArr = [];//城市
+  var provinceArr = [];//省份
+  for (var i in area) {
+    var citys = area[i]
+    if (citys.length > 0) {
+      cityArr = cityArr.concat(citys);
+      provinceArr.push(i + "(" + cityArr.join("、") + ")")
+    } else {
+      if (i == "全国") {
+        continue
+      }
+      provinceArr.push(i)
     }
-    return SortArr(provinceArr)
+  }
+  return SortArr(provinceArr)
 }
 
 //省份 城市 分类
-function getAreaClassArr(area) {
-    var cityArr = [];//城市
-    var provinceArr = [];//省份
-    for (var i in area) {
-        var citys = area[i]
-        if (citys.length > 0) {
-            cityArr = cityArr.concat(citys);
-        } else {
-            if (i == "全国") {
-                continue
-            }
-            provinceArr.push(i)
-        }
+function getAreaClassArr (area) {
+  var cityArr = [];//城市
+  var provinceArr = [];//省份
+  for (var i in area) {
+    var citys = area[i]
+    if (citys.length > 0) {
+      cityArr = cityArr.concat(citys);
+    } else {
+      if (i == "全国") {
+        continue
+      }
+      provinceArr.push(i)
     }
-    return [SortArr(provinceArr), SortArr(cityArr)]
+  }
+  return [SortArr(provinceArr), SortArr(cityArr)]
 }
 
 //对数组进行排序(拼音)
-function SortArr(arr) {
-    arr = arr.sort(function compareFunction(item1, item2) {
-        return item1.localeCompare(item2);
-    });
-    return arr
+function SortArr (arr) {
+  arr = arr.sort(function compareFunction (item1, item2) {
+    return item1.localeCompare(item2);
+  });
+  return arr
 }
 
 //获取选择
-function getSelectBuyset(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) {
-            var citys = area[i];
-            var thisLen = citys.length;
-            if (thisLen === 0) {
-                buyset.areacount++
-            } else {
-                buyset.citys.push(thisLen)
-            }
-        }
+function getSelectBuyset (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) {
+      var citys = area[i];
+      var thisLen = citys.length;
+      if (thisLen === 0) {
+        buyset.areacount++
+      } else {
+        buyset.citys.push(thisLen)
+      }
     }
-    return buyset
+  }
+  return buyset
 }
 
 
 //购买设置 area map
-function getBuySet(area, industry, price) {
-    price = checkPrice(price);
-    if (industry[0] === "全部行业") industry = [];
-    if (area["全国"]) area = {};
-    //计算地区数量
-    var buyset = {
-        "areacount": -1,  //省份数量
-        "buyerclasscount": -1,
-        "citys": [] //购买省份中城市数量
-    };
-    //行业
-    if (industry.length != 0 && industry.length <= price.buyerClassMaxCount) {
-        buyset.buyerclasscount = industry.length
-    }
-    //地区
-    if (!$.isEmptyObject(area)) {
-        buyset.areacount = 0;
-        for (var i in area) {
-            var citys = area[i];
-            var thisLen = citys.length;
-            if (thisLen === 0 || thisLen > price.cityMaxCount) {
-                buyset.areacount++
-            } else {
-                buyset.citys.push(thisLen)
-            }
-        }
-    }
-    if (buyset.areacount > price.provinceMaxCount) {
-        buyset.areacount = -1;
-        buyset.citys = [];
+function getBuySet (area, industry, price) {
+  price = checkPrice(price);
+  if (industry[0] === "全部行业") industry = [];
+  if (area["全国"]) area = {};
+  //计算地区数量
+  var buyset = {
+    "areacount": -1,  //省份数量
+    "buyerclasscount": -1,
+    "citys": [] //购买省份中城市数量
+  };
+  //行业
+  if (industry.length != 0 && industry.length <= price.buyerClassMaxCount) {
+    buyset.buyerclasscount = industry.length
+  }
+  //地区
+  if (!$.isEmptyObject(area)) {
+    buyset.areacount = 0;
+    for (var i in area) {
+      var citys = area[i];
+      var thisLen = citys.length;
+      if (thisLen === 0 || thisLen > price.cityMaxCount) {
+        buyset.areacount++
+      } else {
+        buyset.citys.push(thisLen)
+      }
     }
-    return buyset
+  }
+  if (buyset.areacount > price.provinceMaxCount) {
+    buyset.areacount = -1;
+    buyset.citys = [];
+  }
+  return buyset
 }
 
 /* vip订阅价格
@@ -155,257 +155,257 @@ function getBuySet(area, industry, price) {
 */
 var priceData;
 
-function getsubVipOrderPrice(area, industry, t, price) {
-    price = checkPrice(price);
-    return getsubVipOrderPriceBybuyset(getBuySet(area, industry, price), t, price)
+function getsubVipOrderPrice (area, industry, t, price) {
+  price = checkPrice(price);
+  return getsubVipOrderPriceBybuyset(getBuySet(area, industry, price), t, price)
 }
 
-function checkPrice(price) {
-    if (!price) {
-        if (priceData) {
-            price = priceData
+function checkPrice (price) {
+  if (!price) {
+    if (priceData) {
+      price = priceData
+    } else {
+      $DoPost("/subscribepay/vipsubscribe/getPrice", {}, function (r) {
+        if (r.new) {
+          price = r.new;
+          priceData = price;
         } else {
-            $DoPost("/subscribepay/vipsubscribe/getPrice", {}, function (r) {
-                if (r) {
-                    price = r;
-                    priceData = price;
-                } else {
-                    weui.toast("加载价格异常", {
-                        duration: 2000,
-                        className: 'custom-toast',
-                    });
-                }
-            }, false)
+          weui.toast("加载价格异常", {
+            duration: 2000,
+            className: 'custom-toast',
+          });
         }
-    } else {
-        priceData = price
+      }, false)
     }
-    return price
+  } else {
+    priceData = price
+  }
+  return price
 }
 
 //新旧buyset
-function getMergeNewBuyset(buyset, price) {
-    price = checkPrice(price);
-    if (buyset["newcitys"]) { //新buyset
-        return {
-            "areacount": buyset.areacount,  //省份数量
-            "buyerclasscount": buyset.buyerclasscount,
-            "citys": buyset.newcitys //购买省份中城市数量
-        }
-    } else { //旧buyset
-        var areaCount = buyset.areacount;
-        var buyerclasscount = buyset.buyerclasscount;
-        var oldCitys = buyset.citys;
-        var newCitys = [];
+function getMergeNewBuyset (buyset, price) {
+  price = checkPrice(price);
+  if (buyset["newcitys"]) { //新buyset
+    return {
+      "areacount": buyset.areacount,  //省份数量
+      "buyerclasscount": buyset.buyerclasscount,
+      "citys": buyset.newcitys //购买省份中城市数量
+    }
+  } else { //旧buyset
+    var areaCount = buyset.areacount;
+    var buyerclasscount = buyset.buyerclasscount;
+    var oldCitys = buyset.citys;
+    var newCitys = [];
 
-        if (!$.isEmptyObject(oldCitys)) {
-            for (var i in oldCitys) {
-                var thisLen = oldCitys[i];
-                if (thisLen === 0 || thisLen > price.cityMaxCount) {
-                    areaCount++
-                } else {
-                    newCitys.push(thisLen)
-                }
-            }
+    if (!$.isEmptyObject(oldCitys)) {
+      for (var i in oldCitys) {
+        var thisLen = oldCitys[i];
+        if (thisLen === 0 || thisLen > price.cityMaxCount) {
+          areaCount++
+        } else {
+          newCitys.push(thisLen)
         }
+      }
+    }
 
-        //省份数量自动转换全国
-        if (areaCount > price.provinceMaxCount) {
-            areaCount = -1;
-            newCitys = [];
-        }
-        //行业数量自动转换全行业
-        if (buyerclasscount > price.buyerClassMaxCount) {
-            buyerclasscount = -1
-        }
-        return {
-            "areacount": areaCount,  //省份数量
-            "buyerclasscount": buyerclasscount,
-            "citys": newCitys //购买省份中城市数量
-        }
+    //省份数量自动转换全国
+    if (areaCount > price.provinceMaxCount) {
+      areaCount = -1;
+      newCitys = [];
     }
+    //行业数量自动转换全行业
+    if (buyerclasscount > price.buyerClassMaxCount) {
+      buyerclasscount = -1
+    }
+    return {
+      "areacount": areaCount,  //省份数量
+      "buyerclasscount": buyerclasscount,
+      "citys": newCitys //购买省份中城市数量
+    }
+  }
 }
 
 //根据购买设置 获取支付金额
-function getsubVipOrderPriceBybuyset(buyset, t, price) {
-    //console.log("getsubVipOrderPriceBybuyset",buyset, t)
-    price = checkPrice(price);
-    var vipbuyset = JSON.parse(JSON.stringify(buyset));
-    if (t[0] > price.monthMaxCount && t[1] === 2) t[0] = 10;//月份十个月以上价格一样
+function getsubVipOrderPriceBybuyset (buyset, t, price) {
+  //console.log("getsubVipOrderPriceBybuyset",buyset, t)
+  price = checkPrice(price);
+  var vipbuyset = JSON.parse(JSON.stringify(buyset));
+  if (t[0] > price.monthMaxCount && t[1] === 2) t[0] = 16;//月份十个月以上价格一样
 
-    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 //全国多行业套餐
-    }
+  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;//计算省份价格
+  //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倍
-                }
-            }
+  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;
+      }
     }
-    final_price += vipbuyset.areacount * getSetMealPrice(1, vipbuyset.buyerclasscount, t[1], price) * t[0];
-    //console.log("getsubVipOrderPriceBybuyset-final_price",final_price)
-    return final_price / 100
+    final_price += thisPrice;
+  }
+  final_price += vipbuyset.areacount * getSetMealPrice(1, vipbuyset.buyerclasscount, t[1], price) * t[0];
+  //console.log("getsubVipOrderPriceBybuyset-final_price",final_price)
+  return final_price / 100
 }
 
 //获取套餐价格
 //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 === -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 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个行业
+      }
+  }
 }
 
 // 时间格式化
 Date.prototype.pattern = function (fmt) {
-    var o = {
-        "y+": this.getFullYear(),
-        "M+": this.getMonth() + 1, //月份
-        "d+": this.getDate(), //日
-        "h+": this.getHours() % 12 == 0 ? 12 : this.getHours() % 12, //小时
-        "H+": this.getHours(), //小时
-        "m+": this.getMinutes(), //分
-        "s+": this.getSeconds(), //秒
-        "q+": Math.floor((this.getMonth() + 3) / 3), //季度
-        "S": this.getMilliseconds() //毫秒
-    };
-    var week = {
-        "0": "日",
-        "1": "一",
-        "2": "二",
-        "3": "三",
-        "4": "四",
-        "5": "五",
-        "6": "六"
-    };
-    if (/(y+)/.test(fmt)) {
-        fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
-    }
-    if (/(E+)/.test(fmt)) {
-        fmt = fmt.replace(RegExp.$1, ((RegExp.$1.length > 1) ? (RegExp.$1.length > 2 ? "星期" : "周") : "") + week[this.getDay() + ""]);
+  var o = {
+    "y+": this.getFullYear(),
+    "M+": this.getMonth() + 1, //月份
+    "d+": this.getDate(), //日
+    "h+": this.getHours() % 12 == 0 ? 12 : this.getHours() % 12, //小时
+    "H+": this.getHours(), //小时
+    "m+": this.getMinutes(), //分
+    "s+": this.getSeconds(), //秒
+    "q+": Math.floor((this.getMonth() + 3) / 3), //季度
+    "S": this.getMilliseconds() //毫秒
+  };
+  var week = {
+    "0": "日",
+    "1": "一",
+    "2": "二",
+    "3": "三",
+    "4": "四",
+    "5": "五",
+    "6": "六"
+  };
+  if (/(y+)/.test(fmt)) {
+    fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
+  }
+  if (/(E+)/.test(fmt)) {
+    fmt = fmt.replace(RegExp.$1, ((RegExp.$1.length > 1) ? (RegExp.$1.length > 2 ? "星期" : "周") : "") + week[this.getDay() + ""]);
+  }
+  for (var k in o) {
+    if (new RegExp("(" + k + ")").test(fmt)) {
+      fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
     }
-    for (var k in o) {
-        if (new RegExp("(" + k + ")").test(fmt)) {
-            fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
-        }
-    }
-    return fmt;
+  }
+  return fmt;
 }
 
 //value ;flag 1:年 2:月 endtime 结束时间
-function getVipEndDate(flag, value, endtime) {
-    var EndTime = new Date(endtime * 1000);
-    var startDay = EndTime.getDate();
-    var yearNum = EndTime.getFullYear();
-    var monthNum = EndTime.getMonth();
-    if (flag === 1) {//将年转换成月
-        //年
-        yearNum += value;
-    } else {
-        //月
-        if (monthNum + value > 11) {
-            monthNum = monthNum + value - 12;
-            yearNum++
-        } else {
-            monthNum += value
-        }
-    }
-    //获取当月最后一天
-    var lastDay = new Date(yearNum, monthNum + 1, 0).getDate();
-    if (startDay < lastDay) {
-        return new Date(yearNum, monthNum, startDay, 23, 59, 59).getTime() / 1000;
+function getVipEndDate (flag, value, endtime) {
+  var EndTime = new Date(endtime * 1000);
+  var startDay = EndTime.getDate();
+  var yearNum = EndTime.getFullYear();
+  var monthNum = EndTime.getMonth();
+  if (flag === 1) {//将年转换成月
+    //年
+    yearNum += value;
+  } else {
+    //月
+    if (monthNum + value > 11) {
+      monthNum = monthNum + value - 12;
+      yearNum++
     } else {
-        return new Date(yearNum, monthNum, lastDay, 23, 59, 59).getTime() / 1000;
+      monthNum += value
     }
+  }
+  //获取当月最后一天
+  var lastDay = new Date(yearNum, monthNum + 1, 0).getDate();
+  if (startDay < lastDay) {
+    return new Date(yearNum, monthNum, startDay, 23, 59, 59).getTime() / 1000;
+  } else {
+    return new Date(yearNum, monthNum, lastDay, 23, 59, 59).getTime() / 1000;
+  }
 }
 // 格式化金钱的函数
 // s: 金额(number) 必传
 // n: 保留小数的位数(int:0-100)
-function formatMoney(s, n) {
-    if (n === undefined) {
-        n = -1
+function formatMoney (s, n) {
+  if (n === undefined) {
+    n = -1
+  } else {
+    n = n > 0 && n <= 20 ? n : 2;
+  }
+  var intS = parseInt(s)
+  var point = '.'
+  var left;
+  var right;
+  s = parseFloat((s + '').replace(/[^\d\.-]/g, ''))
+  // 没传n,默认(如果为整数,则不保留小数。如果为浮点数,则保留两位小数)
+  if (n === -1) {
+    if (s === intS) {
+      n = 0
+      right = ''
+      point = ''
     } else {
-        n = n > 0 && n <= 20 ? n : 2;
-    }
-    var intS = parseInt(s)
-    var point = '.'
-    var left;
-    var right;
-    s = parseFloat((s + '').replace(/[^\d\.-]/g, ''))
-    // 没传n,默认(如果为整数,则不保留小数。如果为浮点数,则保留两位小数)
-    if (n === -1) {
-        if (s === intS) {
-            n = 0
-            right = ''
-            point = ''
-        } else {
-            n = 2
-            s = s.toFixed(n);
-            right = s.split('.')[1];
-        }
-        s = s + ''
-        left = s.split('.')[0].split("").reverse();
-    } else {
-        s = parseFloat((s + '').replace(/[^\d\.-]/g, '')).toFixed(n) + '';
-        left = s.split('.')[0].split('').reverse();
-        right = s.split('.')[1];
+      n = 2
+      s = s.toFixed(n);
+      right = s.split('.')[1];
     }
+    s = s + ''
+    left = s.split('.')[0].split("").reverse();
+  } else {
+    s = parseFloat((s + '').replace(/[^\d\.-]/g, '')).toFixed(n) + '';
+    left = s.split('.')[0].split('').reverse();
+    right = s.split('.')[1];
+  }
 
-    t = "";
-    for (i = 0; i < left.length; i++) {
-        t += left[i] + ((i + 1) % 3 == 0 && (i + 1) != left.length ? ',' : '');
-    }
+  t = "";
+  for (i = 0; i < left.length; i++) {
+    t += left[i] + ((i + 1) % 3 == 0 && (i + 1) != left.length ? ',' : '');
+  }
 
-    var money = t.split('').reverse().join('') + point + right;
-    return money;
+  var money = t.split('').reverse().join('') + point + right;
+  return money;
 }

+ 17 - 11
src/jfw/modules/app/src/web/staticres/jyapp/vipsubscribe/js/vip_upgrade.js

@@ -10,6 +10,7 @@ var purchase = {
   nowBuyset: {},
   timeCheckOk: false,
   payWay: "wx_app",
+  isUpdate: 0, // 0未升级到新套餐 1已升级到新套餐
   initData: function () {
     //已选择
     try {
@@ -18,6 +19,7 @@ var purchase = {
       if (!sessionStorage.getItem("pay_read_cache")) {
         $DoPost("/subscribepay/vipsubscribe/getSubBuyMsg", {}, function (r) {
           if (r.success) {
+            purchase.isUpdate = r.data.buyset.upgrade
             if (!$.isEmptyObject(r.data.area)) {
               purchase.areaSelect = r.data.area
             } else {
@@ -37,6 +39,8 @@ var purchase = {
             sessionStorage.setItem("vipSubSelectIndustry", JSON.stringify(purchase.industrySelect));
             sessionStorage.setItem("endTime", JSON.stringify(purchase.endTime))
             sessionStorage.setItem("vipSub_read", true);
+            // 缓存是否升级到新套餐
+            sessionStorage.setItem('vipSub_is_upgrade', r.data.buyset.upgrade)
           }
         }, false)
       } else {
@@ -61,8 +65,9 @@ var purchase = {
       }
       //加载价格
       $DoPost("/subscribepay/vipsubscribe/getPrice", {}, function (r) {
-        if (r) {
-          purchase.price = r;
+        // r.new 新套餐价格 r.old旧套餐价格
+        if (r.new) {
+          purchase.price = r.new;
           purchase.can1111 = r.isActiving && r.isWritten === 0
           if (purchase.can1111) {
             if (!sessionStorage.getItem("vipSubSelectTime")) {
@@ -116,18 +121,18 @@ var purchase = {
     }
   },
   showPrice: function () {
-    $('.monthly span:eq(0)').text(purchase.price.month.oneCity_oneBuyerClass / 100);
-    $('.monthly span:eq(1)').text(purchase.price.month.oneCity_allBuyerClass / 100);
-    $('.monthly span:eq(2)').text(purchase.price.month.oneProvince_oneBuyerClass / 100);
+    // $('.monthly span:eq(0)').text(purchase.price.month.oneCity_oneBuyerClass / 100);
+    // $('.monthly span:eq(1)').text(purchase.price.month.oneCity_allBuyerClass / 100);
+    // $('.monthly span:eq(2)').text(purchase.price.month.oneProvince_oneBuyerClass / 100);
     $('.monthly span:eq(3)').text(purchase.price.month.oneProvince_allBuyerClass / 100);
-    $('.monthly span:eq(4)').text(purchase.price.month.allProvince_oneBuyerClass / 100);
+    // $('.monthly span:eq(4)').text(purchase.price.month.allProvince_oneBuyerClass / 100);
     $('.monthly span:eq(5)').text(purchase.price.month.allProvince_allBuyerClass / 100);
 
-    $('.yearly span:eq(0)').text(purchase.price.year.oneCity_oneBuyerClass / 100);
-    $('.yearly span:eq(1)').text(purchase.price.year.oneCity_allBuyerClass / 100);
-    $('.yearly span:eq(2)').text(purchase.price.year.oneProvince_oneBuyerClass / 100);
+    // $('.yearly span:eq(0)').text(purchase.price.year.oneCity_oneBuyerClass / 100);
+    // $('.yearly span:eq(1)').text(purchase.price.year.oneCity_allBuyerClass / 100);
+    // $('.yearly span:eq(2)').text(purchase.price.year.oneProvince_oneBuyerClass / 100);
     $('.yearly span:eq(3)').text(purchase.price.year.oneProvince_allBuyerClass / 100);
-    $('.yearly span:eq(4)').text(purchase.price.year.allProvince_oneBuyerClass / 100);
+    // $('.yearly span:eq(4)').text(purchase.price.year.allProvince_oneBuyerClass / 100);
     $('.yearly span:eq(5)').text(purchase.price.year.allProvince_allBuyerClass / 100);
   },
   showIndustry: function () {
@@ -191,6 +196,7 @@ var purchase = {
       $('.computed_price').html(showPrice);
     }
     this.flushSelectTime(times, flag === undefined ? 1 : flag);
+    console.log(givePrice,price,showPrice)
     coupon.updatePrice(price)
   },
   flushSelectTime (thisValue, flag) {
@@ -261,7 +267,7 @@ var purchase = {
 $(function () {
   purchase.initData();
   purchase.showArea();
-  purchase.showIndustry();
+  // purchase.showIndustry(); // 新套餐不展示行业(2021/5/19)
   purchase.showPrice();
   purchase.showTime();
   purchase.showTip();

+ 36 - 6
src/jfw/modules/app/src/web/templates/vipsubscribe/vip_UpgradePage.html

@@ -42,14 +42,11 @@
   </div>
   <div class="app-layout-content-b">
     <div class="vip-upgrade live-20200707">
-      <!-- <div class="vip-header">
-        <span class="header-left">提示:</span>
-        <span class="header-right">您的超级订阅服务即将到期,为不影响您的使用。请立即续费</span>
-      </div> -->
+      <!-- <div class="vip-header"></div> -->
       <div class="vip-body">
         <ul style="padding: .16rem .24rem;">
           <li class="body-item area">
-            <a class="item-container" href="/jyapp/vipsubscribe/toChooseArea">
+            <a class="item-container" href="/jyapp/vipsubscribe/toChooseArea?header=upgrade">
               <div class="item">
                 <span class="item-l">
                   <span class="item-label">省份数量</span>
@@ -95,10 +92,43 @@
           </div>
         </div>
       </div>
-      <!-- vue组件 -->
+      <!-- vue组件 现带优惠券的订单提交(与原订单提交事件绑定,原订单提交不可删除) -->
       <div class="vip-footer" id="coupon-vue">
         <pay-order-template ref="couponRef" :config="$data" @update="updateS" @save="saveEvent"></pay-order-template>
       </div>
+      <!-- 原订单提交 -->
+      <div class="vip-footer renew" style="display: none;">
+        <div class="footer-preview-container">
+          <div class="price-preview">
+            <span class="preview-label">合计:</span>
+            <span class="preview-content">
+              <span class="billing-list-btn"></span>
+              <span class="billing-price-container">
+                <span class="yen">&yen;</span>
+                <span class="billing-price"></span>
+              </span>
+            </span>
+          </div>
+          <div class="origin-price" style="display: none">
+            <span class="discount-button">
+              <span>优惠明细</span>
+              <span class="iconfont icon-arrow"></span>
+            </span>
+            <span class="price-label">原价:</span>
+            <div class="price-container">
+              <span class="currency-type">&yen;</span>
+              <span class="price-num"></span>
+            </div>
+          </div>
+          <div class="clause-box">
+            <span class="checkbox"></span>
+            <span class="clause-read">我已阅读,理解并接受<a onclick="toRead()">《剑鱼标讯线上购买与服务条款》</a></span>
+          </div>
+        </div>
+        <div class="footer-button-group j-button-group">
+          <button data-need-bind-phone style="height: 0.92rem!important;line-height: 0.92rem;" class="button-r confirm j-button-confirm" disabled>提交订单</button>
+        </div>
+      </div>
     </div>
   </div>
   <!-- 选择订阅周期picker -->

+ 9 - 2
src/jfw/modules/app/src/web/templates/vipsubscribe/vip_index_new.html

@@ -363,6 +363,13 @@
             </div>
             <a href="/jyapp/vipsubscribe/vipsubscribe_new" class="renew-r">去购买</a>
           </div>
+          <div class="header-renew renew" style="display: none">
+            <div class="renew-l">
+              <div class="vip-logo"></div>
+              <div class="vip-text">超级订阅服务</div>
+            </div>
+            <a href="/jyapp/vipsubscribe/vipsubscribe_renew" class="renew-r">续费</a>
+          </div>
           <div class="expire-remind" style="display: none">
             <i class="j-icon icon-chahao red close-expire-remind"></i>
             <span class="remind-text">超级订阅服务试用即将过期,请及时购买!</span>
@@ -685,9 +692,9 @@
       $('*[data-bind-renew]').on('click',function() {
         location.href = '/jyapp/vipsubscribe/vipsubscribe_renew'
       })
-      // 跳转到升级页面
+      // 跳转到权益页,有权益页跳转到升级页面
       $('*[data-bind-update]').on('click',function() {
-        location.href = '/jyapp/vipsubscribe/vipsubscribe_update'
+        location.href = '/jyapp/vipsubscribe/upgradeDetail'
       })
     </script>
     <script src='{{Cdns .Host "seo" "cdn"|SafeUrl}}/jyapp/vipsubscribe/js/UpgradePrice.js?v={{Msg "seo" "version"}}'></script>