Browse Source

app直播活动前端

xuzhiheng 5 years ago
parent
commit
2a2f532b9a

+ 7 - 3
src/jfw/modules/app/src/app/front/vipsubscribe.go

@@ -4,7 +4,6 @@ import (
 	"encoding/hex"
 	"jfw/config"
 	"jfw/public"
-	"log"
 	"qfw/util"
 	"strconv"
 	"strings"
@@ -74,7 +73,6 @@ func (s *Subscribepay) ToSetInfoTypePage() {
 //订阅设置
 func (s *Subscribepay) ToSetPage() {
 	nowTime := time.Now().Unix()
-	log.Println("startTime", config.Seoconfig)
 	startTime, _ := strconv.ParseInt(config.Seoconfig["liveActiveStartTime"].(string), 10, 64)
 	endTime, _ := strconv.ParseInt(config.Seoconfig["liveActiveEndTime"].(string), 10, 64)
 	if nowTime >= startTime && nowTime < endTime {
@@ -113,6 +111,12 @@ func (s *Subscribepay) Introduce() error {
 	if len(*m) == 0 {
 		return s.Redirect("/jyapp/login")
 	}
+	nowTime := time.Now().Unix()
+	startTime, _ := strconv.ParseInt(config.Seoconfig["liveActiveStartTime"].(string), 10, 64)
+	endTime, _ := strconv.ParseInt(config.Seoconfig["liveActiveEndTime"].(string), 10, 64)
+	if nowTime >= startTime && nowTime < endTime {
+		s.T["isLiveActive"] = true
+	}
 	if util.IntAll((*m)["i_vip_status"]) > 0 {
 		return s.Redirect("/jyapp/vipsubscribe/toSubVipSetPage")
 	}
@@ -145,7 +149,7 @@ func (s *Subscribepay) ToPurchasePage(flag string) {
 	if nowTime >= startTime && nowTime < endTime {
 		s.T["isLiveActive"] = true
 		//虚拟人数
-		buyCount := (nowTime - startTime) / 12
+		buyCount := (nowTime - startTime) / 13
 		s.T["buyCount"] = buyCount
 	}
 	if flag == "trial" { //试用

+ 1 - 1
src/jfw/modules/app/src/web/staticres/jyapp/vipsubscribe/css/base2.css

@@ -99,4 +99,4 @@ em,i{
 }
 .hide{
 	display: none;
-}
+}

+ 36 - 3
src/jfw/modules/app/src/web/staticres/jyapp/vipsubscribe/css/vip_renew.css

@@ -45,6 +45,7 @@
 
 .vip-body .body-item .item-container {
     display: block;
+	width: 100%;
 }
 
 .vip-body .body-item .item,
@@ -553,13 +554,45 @@
     margin-top: .3rem;
 }
 
+/* 2.10.9 直播优惠码新增 */
+.coupon-code-tx,
+.coupon-picker,
+.vip-bar {
+  display: none;
+}
+
 .live-20200707 .j-notice-bar,
+.live-20200707 .coupon-code-tx,
 .live-20200707 .origin-price {
   display: flex;
 }
 
-.vip-bar {
-  display: none;
+.coupon-code-tx {
+  margin-top: .32rem;
+}
+
+.coupon-picker .weui-half-screen-dialog__hd {
+  padding-left: 0;
+  padding-right: 0;
+}
+.coupon-picker .icon-del-grey {
+  padding-left: 0;
+  padding-right: 0;
+  order: 2;
+}
+
+.coupon-picker .weui-picker__bd {
+  padding: 0 0.2rem;
+}       
+
+.coupon-picker .weui-picker__group {
+  position: relative;
+  display: flex;
+  align-items: center;
+  padding: 0.3rem 0;
+  height: 1.08rem;
+  font-size: .3rem;
+  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
 }
 
 .origin-price {
@@ -572,4 +605,4 @@
 
 .origin-price .price-num {
   text-decoration: line-through;
-}
+}

+ 31 - 13
src/jfw/modules/app/src/web/staticres/jyapp/vipsubscribe/js/vip_index_new.js

@@ -720,17 +720,29 @@ $(function () {
             //需要付钱
             $(".vip-footer.upgrade").show();
             //价格展示
+			var nowTime = new Date().getTime();
+			var startTime = live20200707.startTime;
+			var endTime = live20200707.endTime;
+			var startTimes = parseInt(startTime) * 1000;
+			var endTimes = parseInt(endTime) * 1000;
+			if (nowTime >= startTimes && nowTime < endTimes) {
+				var price = status[0];
+				$(".price-num").text(price);
+				status[0] = parseFloat(price) * 0.6;
+				var activePrice = formatMoney(parseFloat(price) - parseFloat(price) * 0.6);
+				$(".reduce-price").text(formatMoney(activePrice));
+			}
             $(".vip-footer.upgrade .billing-price").text(formatMoney(status[0]));
             submitPrice = status[0] * 10000 / 100
 
             // 活动期间,则显示优惠码
             if ($('.vip-upgrade').hasClass('live-20200707')) {
               // 优惠码选项
-              $('.coupon-code-tx').show()
+              $('.coupon-code-tx').show();
               // 原价现价
-              $('.origin-price').show()
+              $('.origin-price').css("display","flex")
               // 优惠提示
-              $('.j-notice-bar.vip-bar').show()
+              $('.j-notice-bar.vip-bar').css("display","flex")
             }
         }
 
@@ -753,7 +765,7 @@ $(function () {
                 $(".billing-list-btn").text("计费清单");
                 $(".va-total-container .total-price").text("¥" + formatMoney(status[0]));
                 flushSubtotal(status[3]);
-                console.log("subtotail", status[3])
+                console.log("subtotail", status)
             }
             initBack(2);//升级
         }
@@ -827,7 +839,12 @@ $(function () {
       pickerShow('.coupon-picker', false)
     })
     $('.coupon-code-tx').on('click', function () {
-        pickerShow('.coupon-picker', true)
+		// 活动期间,则显示优惠码
+		if ($('.vip-upgrade').hasClass('live-20200707')) {
+			pickerShow('.coupon-picker', true)
+		} else {
+			return
+		}
         var input = $('.coupon-picker .weui-input')
         var confirmButton = $('.coupon-picker .weui-picker__btn')
         var cancelButton = $('.coupon-picker .cancel')
@@ -835,18 +852,19 @@ $(function () {
         input.focus().on('input', function () {
             value = this.value
             confirmButton.prop('disabled', (value === '' || value === undefined))
-            if (value.length === couponInfo.code.length && value !== couponInfo.code) {
-                weui.toast('优惠码输入错误', {
-                    className: 'j-toast',
-                    duration: 1500
-                })
-            }
         })
 
         confirmButton.on('click', function () {
-            cancelButton.trigger('click')
+			if (value !== couponInfo.code) {
+			    weui.toast('优惠码输入错误', {
+			        className: 'j-toast',
+			        duration: 1500
+			    })
+			}
             if (value.length === couponInfo.code.length && value === couponInfo.code) {
-                $('.coupon-code-tx .info').text(couponInfo.successTip)
+                $('.coupon-code-tx .keywords-text').text(couponInfo.successTip)
+				$('.coupon-code-tx').off('click')
+				cancelButton.trigger('click')
             }
         })
     })

+ 603 - 0
src/jfw/modules/app/src/web/staticres/jyapp/vipsubscribe/js/vip_renew.js

@@ -0,0 +1,603 @@
+var purchase = {
+	areaSelect: {
+		"一个省": ["一个市"]
+	}, //已选择地区 {"一个省":["一个市"]}计算价格临时变量
+	industrySelect: ["一个行业"], // 已选择行业 一个行业(计算价格临时变量)
+	timeSelect: [1, 2], //已选择时间 timeSelect[0]时长  timeSelect[1] 1:年 2:月
+	timeValue: "一个月",
+	endTime: "",
+	price: {}, //价格
+	nowBuyset: {},
+	timeCheckOk: false,
+	payWay: "wx_app",
+	initData: function() {
+		//已选择
+		try {
+			//即将到期 回显已购买
+			if (!sessionStorage.getItem("pay_read_cache")) {
+				$DoPost("/subscribepay/vipsubscribe/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 = ["全部行业"]
+						}
+						if (r.data.endTime) {
+							purchase.endTime = r.data.endTime;
+						}
+						sessionStorage.setItem("vipSubSelectArea", JSON.stringify(purchase.areaSelect));
+						sessionStorage.setItem("vipSubSelectIndustry", JSON.stringify(purchase.industrySelect));
+						sessionStorage.setItem("endTime", JSON.stringify(purchase.endTime))
+						sessionStorage.setItem("vipSub_read", true);
+					}
+				}, false)
+			} else {
+				sessionStorage.removeItem("pay_read_cache");
+				if (sessionStorage.getItem("vipSubSelectArea")) {
+					this.areaSelect = JSON.parse(sessionStorage.getItem("vipSubSelectArea"));
+				}
+				if (sessionStorage.getItem("vipSubSelectIndustry")) {
+					this.industrySelect = JSON.parse(sessionStorage.getItem("vipSubSelectIndustry"));
+				}
+				if (sessionStorage.getItem("endTime")) {
+					this.endTime = parseInt(sessionStorage.getItem("endTime"))
+				}
+			}
+			if (sessionStorage.getItem("vipSubSelectTime")) {
+				this.timeSelect = JSON.parse(sessionStorage.getItem("vipSubSelectTime"));
+			}
+
+			//加载价格
+			$DoPost("/subscribepay/vipsubscribe/getPrice", {}, function(r) {
+				if (r) {
+					purchase.price = r;
+				}
+			}, false)
+
+		} catch (e) {
+			console.log(e)
+		}
+		this.nowBuyset = getBuySet(purchase.areaSelect, purchase.industrySelect, this.price);
+
+		if (sessionStorage.getItem("payWay")) {
+			if (sessionStorage.getItem("payWay").indexOf("ali") > -1) {
+				this.payWay = "ali_app";
+				$("#zfb").prop("checked", true);
+				$(".pay-mode-text").text("支付宝支付");
+			}
+		}
+	},
+	showArea: function() {
+		if (!$.isEmptyObject(this.areaSelect) && !this.areaSelect["一个省"]) { //有选择
+			if (this.nowBuyset.areacount === -1) {
+				$(".selected-area").text("全国");
+			} else {
+				var tipTxt = "";
+				if (this.nowBuyset.areacount > 0) tipTxt += this.nowBuyset.areacount + " 个省";
+				var count = 0;
+				this.nowBuyset.citys.forEach(function(item, index) {
+					count += item;
+				});
+				if (count > 0) {
+					if (this.nowBuyset.areacount > 0) tipTxt += "、";
+					tipTxt += count + " 个市";
+					if (this.nowBuyset.citys.length > 1) tipTxt += "(分布在" + this.nowBuyset.citys.length + "个省内)"
+				}
+				$(".selected-area").text(tipTxt);
+			}
+		} else {
+			$(".selected-area").text("");
+		}
+	},
+	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(3)').text(purchase.price.month.oneProvince_allBuyerClass / 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(3)').text(purchase.price.year.oneProvince_allBuyerClass / 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() {
+		if (this.industrySelect.length > 0 && this.industrySelect[0] !== "一个行业") { //选择有行业信息
+			if (this.nowBuyset.buyerclasscount === -1) {
+				$(".selected-industry-count").text("全部行业");
+			} else {
+				var tipTxt = "";
+				$(".selected-industry-count").text(tipTxt + this.nowBuyset.buyerclasscount + " 个行业");
+			}
+		} else {
+			$(".selected-industry-count").text("");
+		}
+	},
+	showTime: function() {
+		var tmp = this.timeSelect[0];
+		if (this.timeSelect[1] === 1) {
+			tmp += "年";
+			$("#yearly").prop('checked', true);
+			//$('.year_number:eq(' + (this.timeSelect[0] - 1) + ')').trigger("click");
+			$('.year_number:eq(' + (this.timeSelect[0] - 1) + ')').addClass("active")
+			//$(".number_box:eq(1)").addClass("active");
+		} else {
+			tmp += "个月";
+			$("#monthly").prop('checked', true);
+			$(".number_box:eq(0)").addClass("active");
+			$("#number_box_month .month_number").text(this.timeSelect[0]);
+			//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");
+			}
+		}
+		this.timeValue = tmp;
+	},
+	flushPrice: function(time, flag) {
+		//var price = getsubVipOrderPrice(this.areaSelect, this.industrySelect, time, this.price);
+		var price = getsubVipOrderPriceBybuyset(this.nowBuyset, time);
+		var showPrice = formatMoney(price);
+		var nowTime = new Date().getTime();
+		var startTime = live20200707.startTime;
+		var endTime = live20200707.endTime;
+		var startTimes = parseInt(startTime) * 1000;
+		var endTimes = parseInt(endTime) * 1000;
+		if (nowTime >= startTimes && nowTime < endTimes) {
+			$(".price-num").text(showPrice);
+			showPrice = formatMoney(parseFloat(price) * 0.6);
+			var activePrice = formatMoney(parseFloat(price) - parseFloat(price) * 0.6);
+			$(".reduce-price").text(formatMoney(activePrice));
+		}
+		if (flag === 1) {
+			$('.billing-price').text('¥' + showPrice);
+		} else if (flag === 2) {
+			$('.computed_price').html(showPrice);
+		} else {
+			$('.billing-price').text('¥' + showPrice);
+			$('.computed_price').html(showPrice);
+		}
+		this.flushSelectTime(time, flag === undefined ? 1 : flag);
+	},
+	flushSelectTime(thisValue, flag) {
+		if (this.endTime) {
+			var time1 = new Date(this.endTime * 1000).pattern('yyyy年MM月dd日');
+			var end = getVipEndDate(thisValue[1], thisValue[0], this.endTime);
+			var time2 = new Date(end * 1000).pattern('yyyy年MM月dd日');
+
+			if (flag === 1) {
+				$(".select_cycle .month").text(this.timeValue);
+				$(".select_cycle .duration").text(time1 + "-" + time2);
+				$(".select_cycle .duration").show();
+			}
+
+			//是否超过三年
+			var now = Math.floor(new Date().getTime() / 1000);
+			var MaxEnd = getVipEndDate(1, 3, now);
+			if (end > MaxEnd) {
+				var timeShow = getDateSub(now, this.endTime);
+				var showTipText = "<div style='white-space: nowrap;'>最长订阅周期不可超过3年</div>剩余周期:";
+				if (timeShow[0] !== 0) {
+					showTipText += timeShow[0] + "年"
+				}
+				if (timeShow[1] !== 0) {
+					showTipText += timeShow[1] + "个月"
+				}
+				weui.toast(showTipText, {
+					duration: 3000,
+					className: 'jy-toast',
+				});
+				if (flag === 1) this.timeCheckOk = false;
+				if (flag === 2) $("#enter_period").prop("disabled", true);
+			} else {
+				if (flag === 1) this.timeCheckOk = true;
+				if (flag === 2) $("#enter_period").prop("disabled", false);
+			}
+			this.flushSubmit();
+		} else {
+			$(".select_cycle .duration").hide();
+		}
+	},
+	showTip() { //是否展示即将到期
+		var timeSub = this.endTime * 1000 - new Date().getTime();
+		if (timeSub > 0 && timeSub < 60 * 60 * 24 * 1000 * 3) {
+			$(".vip-header").show();
+		}
+	},
+	flushSubmit() { //是否可提交
+		if (this.timeCheckOk && sessionStorage.getItem("vipSub_read") === "true") {
+			$('.vip-footer.renew .confirm').prop('disabled', false)
+		} else {
+			$('.vip-footer.renew .confirm').prop('disabled', true)
+		}
+	}
+};
+
+
+$(function() {
+	purchase.initData();
+	purchase.showArea();
+	purchase.showIndustry();
+	purchase.showPrice();
+	purchase.showTime();
+	purchase.showTip();
+	purchase.flushPrice(purchase.timeSelect);
+	purchase.flushSubmit();
+	var time_limit; //定义一个周期变量
+	/*------ 关闭弹窗事件  点击取消或遮罩层 -----*/
+	$('.weui-mask').click(hideDialog);
+	$('.cancel').click(hideDialog);
+
+	/* -----  订阅周期、支付方式弹窗弹出事件 -------*/
+	// 选择订阅周期
+	$('.select_cycle a').click(function(e) {
+		$('#time_cycle').show(200);
+	});
+
+
+	/* -----  选择完支付方式、订阅周期 回显到页面 -------*/
+	$('.vip-body .pay-mode').on('click', function() {
+		pickerShow('#pay_way', true)
+	});
+
+	$('#pay_way input:radio[name="way"]').click(function() {
+		var checkValue = $('input:radio[name="way"]:checked').val();
+		pickerShow('#pay_way', false)
+		$('.vip-body .pay-mode .pay-mode-text').text(checkValue);
+		if (checkValue === "微信支付") {
+			purchase.payWay = "wx_app"
+		} else {
+			purchase.payWay = "ali_app"
+		}
+		sessionStorage.setItem("payWay", purchase.payWay);
+	});
+
+
+	// 对订阅时间选择的input绑定点击事件
+	$('#time_cycle input:radio[name="time"]').on('click', function(e) {
+		// 解除确认按钮的锁定
+		$('#time_cycle .form-btn button').removeAttr('disabled');
+		if ($(e.target).hasClass('monthly')) {
+			// 按月订阅
+			$('#number_box_month').addClass('active');
+			$('#number_box_year span').removeClass('active');
+		} else {
+			// 按年订阅
+			$('#number_box_month').removeClass('active');
+			// $('#number_box_year span:eq(0)').addClass('active').siblings().removeClass('active');
+		}
+	});
+
+	/* --------控制月份number_box的事件  点击加减号触发的事件------- */
+	$('#number_box_month').on('click', 'button', function(e) {
+		// 点击加减号让input radio选中
+		$('#monthly').prop('checked', true);
+		$('#yearly').prop('checked', false);
+		$('.number_box span').removeClass('active');
+		$('#number_box_month').addClass('active');
+
+		var $number = $('#number_box_month span.month_number');
+		var $monthlyInput = $('#monthly');
+		// 未整理的data数组,里面的值都是字符串
+		var preData = e.delegateTarget.dataset;
+		var currentNum = parseInt($number.text());
+		var data = {};
+		// 把字符串转换成数字
+		for (var i in preData) {
+			data[i] = preData[i] - 0
+		}
+
+		if (!$monthlyInput.prop('checked')) {
+			return
+		}
+		// 判断是点击的是+ 还是-
+		if ($(e.target).hasClass('add') || $(e.currentTarget).hasClass('add')) {
+			if (currentNum == 11) { //12个月自动跳转1年
+				$("#number_box_year .year_number:eq(0)").trigger("click");
+				return
+			}
+			// 点的+
+			currentNum = currentNum >= data.numboxMax ? data.numboxMax : (currentNum + data
+				.numboxStep);
+		} else {
+			// 点的-
+			currentNum = currentNum <= data.numboxMin ? data.numboxMin : (currentNum - data
+				.numboxStep);
+		}
+		$number.text(currentNum);
+		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();
+		} else {
+		    $('.profit_tips').hide();
+		}*/
+		// 如果为操作后的结果为1,则锁定减号按钮
+		if (currentNum === data.numboxMin) {
+			firstButton.attr('disabled', true)
+		} else {
+			firstButton.removeAttr('disabled')
+		}
+		// 如果为操作后的结果为12,则锁定加号按钮
+		if (currentNum === data.numboxMax) {
+			lastButton.attr('disabled', true)
+		} else {
+			lastButton.removeAttr('disabled')
+		}
+	});
+
+	/* -------- 控制年份number_box的事件  点击1年 2年 3年触发的事件------- */
+	$('#number_box_year').on('click', 'span', function(e) {
+		console.log(e.target.dataset.id);
+		$('#number_box_month').removeClass('active');
+		var id = e.target.dataset.id;
+		//$('.profit_tips').hide();
+		$(this).addClass('active').siblings().removeClass('active');
+		$('#yearly').prop('checked', true);
+		$("#monthly").prop('checked', false);
+
+		// 渲染结果 保留一位小数
+		//var result = (Number(id) * 58).toFixed(1);
+		//$('.computed_price').html('¥' + result)
+		purchase.timeSelect_tmp = [Number(id), 1];
+		purchase.flushPrice(purchase.timeSelect_tmp, 2);
+	});
+
+	/* -------- 选择按月订阅  radio触发的事件------- */
+	$('#monthly').on('change', function(e) {
+		var isChecked = $(this).is(':checked');
+		var val = $('.month_number').text();
+		/*if (val >= 10) {
+		    $('.profit_tips').show()
+		}*/
+		if (!isChecked) {
+			$('#number_box_month button').attr('disabled', true)
+		}
+		//var result = (Number(val) * 5.8).toFixed(1);
+		//$('.computed_price').html('¥' + result);
+		purchase.timeSelect_tmp = [Number(val), 2];
+		purchase.flushPrice(purchase.timeSelect_tmp, 2);
+	});
+	//计价清单
+	$('.billing-list-btn').on('click', function() {
+		pickerShow('.billing-list-container', true)
+	})
+	// 计算标准隐藏
+	$('.billing-list-container .dialog_hd__close').on('click', function() {
+		pickerShow('.billing-list-container', false)
+	})
+
+	$('.checkbox').on('click', function() {
+		$(this).toggleClass('checked')
+		var state = $(this).hasClass('checked');
+		sessionStorage.setItem("vipSub_read", state);
+		purchase.flushSubmit();
+		//$('.vip-footer.renew .confirm').prop('disabled', !state)
+	});
+	//是否点击已读
+	if (sessionStorage.getItem("vipSub_read") === "true") {
+		$('.checkbox').addClass("checked");
+	}
+
+	/* -------- 选择按年订阅  radio触发的事件------- */
+	$('#yearly').on('change', function(e) {
+		//$('.profit_tips').hide();
+		// console.log($(this).is(':checked'))
+		var isChecked = $(this).is(':checked');
+		// 按年订阅默认选择1年
+		var val = 1;
+		//$('.computed_price').html('¥' + Number(val) * 58)
+		if (isChecked) {
+			$('#number_box_year span:eq(0)').addClass('active').siblings().removeClass('active')
+		}
+		purchase.timeSelect_tmp = [Number(val), 1];
+		purchase.flushPrice(purchase.timeSelect_tmp, 2);
+		purchase.flushSelectTime(purchase.timeSelect_tmp, 2);
+	});
+
+	// 确认订阅周期
+	$('#enter_period').on('click', function() {
+		var val;
+		var selectedDOM = $('#time_cycle input[name=time]:checked');
+		if (selectedDOM.val() === 'year') {
+			val = $('#number_box_year .year_number.active').attr('data-id');
+			purchase.timeSelect_tmp = [parseInt(val), 1];
+			$('#time_cycle').hide(function() {
+				purchase.timeValue = val + "年";
+			});
+		} else if (selectedDOM.val() === 'month') {
+			val = $('#number_box_month .month_number').text();
+			purchase.timeSelect_tmp = [parseInt(val), 2];
+			$('#time_cycle').hide(function() {
+				purchase.timeValue = val + "个月";
+			});
+		}
+
+		purchase.timeSelect = purchase.timeSelect_tmp;
+		purchase.showTime();
+		purchase.flushPrice(purchase.timeSelect, 1);
+		sessionStorage.setItem("vipSubSelectTime", JSON.stringify(purchase.timeSelect));
+	});
+	$('.vip-footer.renew .confirm').click(function() {
+		$('.vip-footer.renew .confirm').attr("disabled", "disabled");
+		//支付请求
+		var area = purchase.areaSelect;
+		var industry = purchase.industrySelect;
+		if (area["全国"]) {
+			area = {};
+		}
+		if (industry.length === 1 && industry[0] === "全部行业") {
+			industry = [];
+		}
+		//付费用户
+		var param = {
+			"area": JSON.stringify(area),
+			"industry": industry.join(","),
+			"time": purchase.timeValue.trim(),
+			"payWay": purchase.payWay,
+			"orderType": 5,
+		};
+		$DoPost("/subscribepay/vipsubscribe/createOrder", param, function(r) {
+			if (r.success) {
+				try {
+					if (param.payWay === "wx_app") {
+						JyObj.wxPay(r.data.res)
+					} else {
+						JyObj.aliPay(r.data.res)
+					}
+					checkpay(r.data.code)
+				} catch (e) {
+					showToast(e)
+				}
+			}
+		}, false);
+		$('.vip-footer.renew .confirm').removeAttr("disabled");
+	})
+
+});
+
+// 隐藏dialog选择框
+function hideDialog() {
+	$('#pay_way').hide(200);
+	$('#time_cycle').hide(200);
+}
+
+function clearSessionStorage() {
+	sessionStorage.removeItem("vipSubSelectArea");
+	sessionStorage.removeItem("vipSubSelectIndustry");
+	sessionStorage.removeItem("vipSubSelectTime");
+	sessionStorage.removeItem("vipSub_read");
+	sessionStorage.removeItem("historypushDataCache");
+	sessionStorage.removeItem("endTime");
+	sessionStorage.removeItem("payWay");
+	sessionStorage.To_introducePage = 2;
+	//订阅首页
+	sessionStorage.removeItem("sub_vip_state");
+	sessionStorage.removeItem("vip_index_read");
+	sessionStorage.removeItem("vip_change_time");
+
+	sessionStorage.removeItem("pay_read_cache")
+}
+
+function pickerShow(selector, f) {
+	if (f) {
+		// 添加进场动画,并显示
+		$(selector).find('.weui-mask').removeClass('weui-animate-fade-out').addClass('weui-animate-fade-in')
+		$(selector).find('.weui-picker').removeClass('weui-animate-slide-down').addClass('weui-animate-slide-up')
+		$(selector).show(300);
+	} else {
+		// 添加离场动画,并隐藏
+		$(selector).find('.weui-mask').removeClass('weui-animate-fade-in').addClass('weui-animate-fade-out')
+		$(selector).find('.weui-picker').removeClass('weui-animate-slide-up').addClass('weui-animate-slide-down')
+		$(selector).hide(300);
+	}
+}
+
+//app支付 公共方法
+//查询是否支付完成
+var interval;
+
+function checkpay(orderid) {
+	if (interval) {
+		clearInterval(interval);
+	}
+	interval = setInterval(function() {
+		$.post("/jypay/isPaySuccess", {
+			code: orderid
+		}, function(r) {
+			if (r.success) {
+				clearSessionStorage();
+				window.location.replace("/jyapp/vipsubscribe/toPaySuccessPage?orderCode=" + orderid);
+			}
+		});
+		if (canpay && mySysIsIos()) {
+			clearInterval(interval);
+		}
+	}, 2000)
+}
+
+function payCallBack(status) {
+	switch (status) {
+		case "0": //支付取消
+			clearInterval(interval);
+			break;
+		case "1": //支付完成
+
+			break;
+		case "-1": //支付失败
+			clearInterval(interval);
+			break;
+	}
+}
+
+function showToast(content) {
+	weui.toast(content, {
+		duration: 2000,
+		className: 'custom-toast',
+	});
+}
+
+function toRead() {
+	sessionStorage.setItem("pay_read_cache", "0");
+	window.location.href = "/jyapp/front/staticPage/wx-serviceterms.html";
+}
+
+// 活动事件绑定
+var couponInfo = {
+	code: 'jianyu360',
+	successTip: '支付成功赠送30天订阅周期'
+}
+$('.weui-mask').on('click', function() {
+	pickerShow('.billing-list-container', false)
+	pickerShow('.coupon-picker', false)
+})
+$('.j-picker').on('click', '.cancel', function() {
+	pickerShow('.coupon-picker', false)
+})
+$('.coupon-code-tx').on('click', function() {
+	// 活动期间,则显示优惠码
+	if ($('.vip-renew').hasClass('live-20200707')) {
+		pickerShow('.coupon-picker', true)
+	} else {
+		return
+	}
+	var input = $('.coupon-picker .weui-input')
+	var confirmButton = $('.coupon-picker .weui-picker__btn')
+	var cancelButton = $('.coupon-picker .cancel')
+	var value = input.val()
+	input.focus().on('input', function() {
+		value = this.value
+		confirmButton.prop('disabled', (value === '' || value === undefined))
+	})
+
+	confirmButton.on('click', function() {
+		if (value !== couponInfo.code) {
+			weui.toast('优惠码输入错误', {
+				className: 'j-toast',
+				duration: 1500
+			})
+		}
+		if (value.length === couponInfo.code.length && value === couponInfo.code) {
+			$('.coupon-code-tx .keywords-text').text(couponInfo.successTip)
+			$('.coupon-code-tx').off('click')
+			cancelButton.trigger('click')
+		}
+	})
+})

+ 12 - 8
src/jfw/modules/app/src/web/templates/vipsubscribe/vip_index_new.html

@@ -506,16 +506,20 @@
     <script src="{{Msg "seo" "cdn"}}/jyapp/vipsubscribe/js/common.js?v={{Msg "seo" "version"}}"></script>
     <script src="{{Msg "seo" "cdn"}}/jyapp/js/common.js?v={{Msg "seo" "version"}}"></script>
     <script src="{{Msg "seo" "cdn"}}/jyapp/vipsubscribe/js/UpgradePrice.js?v={{Msg "seo" "version"}}"></script>
-    <script src="{{Msg "seo" "cdn"}}/jyapp/vipsubscribe/js/vip_index_new.js?v={{Msg "seo" "version"}}"></script>
+    <script>
+        $(window).bind("pageshow", function (event) {
+            if (event.originalEvent.persisted) {
+                window.location.reload();
+            }
+        });
+		var live20200707 = {
+			startTime: {{Msg "seo" "liveActiveStartTime"}},
+			endTime: {{Msg "seo" "liveActiveEndTime"}}
+		}
+    </script>
+	<script src="{{Msg "seo" "cdn"}}/jyapp/vipsubscribe/js/vip_index_new.js?v={{Msg "seo" "version"}}"></script>
 </div>
 
 </body>
-<script>
-    $(window).bind("pageshow", function (event) {
-        if (event.originalEvent.persisted) {
-            window.location.reload();
-        }
-    });
-</script>
 {{include "/common/baiducc.html"}}
 </html>

+ 8 - 7
src/jfw/modules/app/src/web/templates/vipsubscribe/vip_purchase.html

@@ -956,18 +956,19 @@
                 input.focus().on('input', function () {
                     value = this.value
                     confirmButton.prop('disabled', (value === '' || value === undefined))
-                    if (value.length === couponInfo.code.length && value !== couponInfo.code) {
-                        weui.toast('优惠码输入错误', {
-                            className: 'j-toast',
-                            duration: 1500
-                        })
-                    }
                 })
 
                 confirmButton.on('click', function () {
-                    cancelButton.trigger('click')
+					if (value !== couponInfo.code) {
+					    weui.toast('优惠码输入错误', {
+					        className: 'j-toast',
+					        duration: 1500
+					    })
+					}
                     if (value.length === couponInfo.code.length && value === couponInfo.code) {
                         $('.coupon-code-tx .info').text(couponInfo.successTip)
+						$('.coupon-code-tx').off('click')
+						cancelButton.trigger('click')
                     }
                 })
             })

+ 50 - 564
src/jfw/modules/app/src/web/templates/vipsubscribe/vip_renew.html

@@ -13,6 +13,7 @@
     <link rel="stylesheet" type="text/css" href="{{Msg "seo" "cdn"}}/jyapp/vipsubscribe/css/weui.min.css?v={{Msg "seo" "version"}}"/>
     <link rel="stylesheet" type="text/css" href="{{Msg "seo" "cdn"}}/jyapp/vipsubscribe/css/base2.css?v={{Msg "seo" "version"}}"/>
     <link rel="stylesheet" type="text/css" href="{{Msg "seo" "cdn"}}/jyapp/vipsubscribe/iconfont/iconfont.css?v={{Msg "seo" "version"}}"/>
+	<link rel="stylesheet" type="text/css" href="{{Msg "seo" "cdn"}}/jyapp/vipsubscribe/css/public_.css?v={{Msg "seo" "version"}}"/>
     <link rel="stylesheet" type="text/css" href="{{Msg "seo" "cdn"}}/jyapp/css/appbutton.css?v={{Msg "seo" "version"}}">
     <link rel="stylesheet" type="text/css" href="{{Msg "seo" "cdn"}}/jyapp/vipsubscribe/css/vip_renew.css?v={{Msg "seo" "version"}}">
     <link rel="stylesheet" type="text/css" href="{{Msg "seo" "cdn"}}/jyapp/css/layout.css?v={{Msg "seo" "version"}}"/>
@@ -109,6 +110,19 @@
                     </div>
                 </a>
             </li>
+			<li class="body-item coupon-code-tx">
+			    <a class="item-container" href="javascript:;">
+			        <div class="item">
+			            <span class="item-l">
+			                <span class="item-label">优惠码</span>
+			            </span>
+			            <span class="item-r">
+			                <span class="keywords-text">输入优惠码</span>
+			                <span class="iconfont icon-arrow"></span>
+			            </span>
+			        </div>
+			    </a>
+			</li>
         </ul>
         <div class="vip-footer renew">
             <div class="j-notice-bar bar-red vip-bar">限时6折,现在购买帮您省<span class="reduce-price">0</span>元</div>
@@ -299,576 +313,48 @@
             </div>
         </div>
     </div>
+	<!-- 优惠码弹窗 -->
+	<div class="j-picker adaption coupon-picker">
+	    <div class="weui-mask weui-animate-fade-in"></div>
+	    <div class="weui-half-screen-dialog weui-picker weui-animate-slide-up">
+	        <div class="weui-half-screen-dialog__hd">
+	            <div class="weui-half-screen-dialog__hd__main">
+	                <strong class="weui-half-screen-dialog__title">优惠码</strong>
+	            </div>
+	            <span class="j-icon icon-del-grey cancel"></span>
+	        </div>
+	        <div class="weui-half-screen-dialog__bd">
+	            <div class="weui-picker__bd">
+	                <div class="weui-picker__group">
+	                    <input type="text" class="weui-input" maxlength="9" placeholder="输入优惠码,即可赠送30天订阅周期">
+	                </div>
+	            </div>
+	        </div>
+	        <div class="weui-half-screen-dialog__ft">
+	          <button disabled class="weui-btn weui-btn_primary weui-picker__btn"
+	          data-action="select">确定</button>
+	        </div>
+	    </div>
+	</div>
     <script src="{{Msg "seo" "cdn"}}/jyapp/vipsubscribe/js/jquery-2.1.4.js?v={{Msg "seo" "version"}}"></script>
     <script src="{{Msg "seo" "cdn"}}/jyapp/vipsubscribe/js/weui.min.js?v={{Msg "seo" "version"}}"></script>
     <script src="{{Msg "seo" "cdn"}}/jyapp/vipsubscribe/js/common.js?v={{Msg "seo" "version"}}"></script>
     <script src="{{Msg "seo" "cdn"}}/jyapp/vipsubscribe/js/UpgradePrice.js?v={{Msg "seo" "version"}}"></script>
     <script src="{{Msg "seo" "cdn"}}/jyapp/js/common.js?v={{Msg "seo" "version"}}"></script>
-    <script>
-        $(window).bind("pageshow", function (event) {
-            if (event.originalEvent.persisted) {
-                window.location.reload();
-            }
-        });
-
-        var purchase = {
-            areaSelect: {"一个省": ["一个市"]},//已选择地区 {"一个省":["一个市"]}计算价格临时变量
-            industrySelect: ["一个行业"],// 已选择行业 一个行业(计算价格临时变量)
-            timeSelect: [1, 2],//已选择时间 timeSelect[0]时长  timeSelect[1] 1:年 2:月
-            timeValue: "一个月",
-            endTime: "",
-            price: {}, //价格
-            nowBuyset: {},
-            timeCheckOk: false,
-            payWay: "wx_app",
-            initData: function () {
-                //已选择
-                try {
-                    //即将到期 回显已购买
-                    if (!sessionStorage.getItem("pay_read_cache")) {
-                        $DoPost("/subscribepay/vipsubscribe/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 = ["全部行业"]
-                                }
-                                if (r.data.endTime) {
-                                    purchase.endTime = r.data.endTime;
-                                }
-                                sessionStorage.setItem("vipSubSelectArea", JSON.stringify(purchase.areaSelect));
-                                sessionStorage.setItem("vipSubSelectIndustry", JSON.stringify(purchase.industrySelect));
-                                sessionStorage.setItem("endTime", JSON.stringify(purchase.endTime))
-                                sessionStorage.setItem("vipSub_read", true);
-                            }
-                        }, false)
-                    } else {
-                        sessionStorage.removeItem("pay_read_cache");
-                        if (sessionStorage.getItem("vipSubSelectArea")) {
-                            this.areaSelect = JSON.parse(sessionStorage.getItem("vipSubSelectArea"));
-                        }
-                        if (sessionStorage.getItem("vipSubSelectIndustry")) {
-                            this.industrySelect = JSON.parse(sessionStorage.getItem("vipSubSelectIndustry"));
-                        }
-                        if (sessionStorage.getItem("endTime")) {
-                            this.endTime = parseInt(sessionStorage.getItem("endTime"))
-                        }
-                    }
-                    if (sessionStorage.getItem("vipSubSelectTime")) {
-                        this.timeSelect = JSON.parse(sessionStorage.getItem("vipSubSelectTime"));
-                    }
-
-                    //加载价格
-                    $DoPost("/subscribepay/vipsubscribe/getPrice", {}, function (r) {
-                        if (r) {
-                            purchase.price = r;
-                        }
-                    }, false)
-
-                } catch (e) {
-                    console.log(e)
-                }
-                this.nowBuyset = getBuySet(purchase.areaSelect, purchase.industrySelect, this.price);
-
-                if (sessionStorage.getItem("payWay")) {
-                    if (sessionStorage.getItem("payWay").indexOf("ali") > -1) {
-                        this.payWay = "ali_app";
-                        $("#zfb").prop("checked", true);
-                        $(".pay-mode-text").text("支付宝支付");
-                    }
-                }
-            },
-            showArea: function () {
-                if (!$.isEmptyObject(this.areaSelect) && !this.areaSelect["一个省"]) { //有选择
-                    if (this.nowBuyset.areacount === -1) {
-                        $(".selected-area").text("全国");
-                    } else {
-                        var tipTxt = "";
-                        if (this.nowBuyset.areacount > 0) tipTxt += this.nowBuyset.areacount + " 个省";
-                        var count = 0;
-                        this.nowBuyset.citys.forEach(function (item, index) {
-                            count += item;
-                        });
-                        if (count > 0) {
-                            if (this.nowBuyset.areacount > 0) tipTxt += "、";
-                            tipTxt += count + " 个市";
-                            if (this.nowBuyset.citys.length > 1) tipTxt += "(分布在" + this.nowBuyset.citys.length + "个省内)"
-                        }
-                        $(".selected-area").text(tipTxt);
-                    }
-                } else {
-                    $(".selected-area").text("");
-                }
-            },
-            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(3)').text(purchase.price.month.oneProvince_allBuyerClass / 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(3)').text(purchase.price.year.oneProvince_allBuyerClass / 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 () {
-                if (this.industrySelect.length > 0 && this.industrySelect[0] !== "一个行业") { //选择有行业信息
-                    if (this.nowBuyset.buyerclasscount === -1) {
-                        $(".selected-industry-count").text("全部行业");
-                    } else {
-                        var tipTxt = "";
-                        $(".selected-industry-count").text(tipTxt + this.nowBuyset.buyerclasscount + " 个行业");
-                    }
-                } else {
-                    $(".selected-industry-count").text("");
-                }
-            },
-            showTime: function () {
-                var tmp = this.timeSelect[0];
-                if (this.timeSelect[1] === 1) {
-                    tmp += "年";
-                    $("#yearly").prop('checked', true);
-                    //$('.year_number:eq(' + (this.timeSelect[0] - 1) + ')').trigger("click");
-                    $('.year_number:eq(' + (this.timeSelect[0] - 1) + ')').addClass("active")
-                    //$(".number_box:eq(1)").addClass("active");
-                } else {
-                    tmp += "个月";
-                    $("#monthly").prop('checked', true);
-                    $(".number_box:eq(0)").addClass("active");
-                    $("#number_box_month .month_number").text(this.timeSelect[0]);
-                    //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");
-                    }
-                }
-                this.timeValue = tmp;
-            },
-            flushPrice: function (time, flag) {
-                //var price = getsubVipOrderPrice(this.areaSelect, this.industrySelect, time, this.price);
-                var price = getsubVipOrderPriceBybuyset(this.nowBuyset, time);
-                var showPrice = formatMoney(price);
-				var nowTime = new Date().getTime();
-				var startTime = {{Msg "seo" "liveActiveStartTime"}};
-				var endTime = {{Msg "seo" "liveActiveEndTime"}};
-				var startTimes = parseInt(startTime)* 1000;
-				var endTimes = parseInt(endTime)* 1000;
-				if (nowTime >= startTimes && nowTime < endTimes) {
-					$(".price-num").text(showPrice);
-					showPrice = formatMoney(parseFloat(price) * 0.6);
-					var activePrice = formatMoney(parseFloat(price) - parseFloat(price) * 0.6);
-					$(".reduce-price").text(formatMoney(activePrice));
-				}
-                if (flag === 1) {
-                    $('.billing-price').text('¥' + showPrice);
-                } else if (flag === 2) {
-                    $('.computed_price').html(showPrice);
-                } else {
-                    $('.billing-price').text('¥' + showPrice);
-                    $('.computed_price').html(showPrice);
-                }
-                this.flushSelectTime(time, flag === undefined ? 1 : flag);
-            },
-            flushSelectTime(thisValue, flag) {
-                if (this.endTime) {
-                    var time1 = new Date(this.endTime * 1000).pattern('yyyy年MM月dd日');
-                    var end = getVipEndDate(thisValue[1], thisValue[0], this.endTime);
-                    var time2 = new Date(end * 1000).pattern('yyyy年MM月dd日');
-
-                    if (flag === 1) {
-                        $(".select_cycle .month").text(this.timeValue);
-                        $(".select_cycle .duration").text(time1 + "-" + time2);
-                        $(".select_cycle .duration").show();
-                    }
-
-                    //是否超过三年
-                    var now = Math.floor(new Date().getTime() / 1000);
-                    var MaxEnd = getVipEndDate(1, 3, now);
-                    if (end > MaxEnd) {
-                        var timeShow = getDateSub(now, this.endTime);
-                        var showTipText = "<div style='white-space: nowrap;'>最长订阅周期不可超过3年</div>剩余周期:";
-                        if (timeShow[0] !== 0) {
-                            showTipText += timeShow[0] + "年"
-                        }
-                        if (timeShow[1] !== 0) {
-                            showTipText += timeShow[1] + "个月"
-                        }
-                        weui.toast(showTipText, {
-                            duration: 3000,
-                            className: 'jy-toast',
-                        });
-                        if (flag === 1) this.timeCheckOk = false;
-                        if (flag === 2) $("#enter_period").prop("disabled", true);
-                    } else {
-                        if (flag === 1) this.timeCheckOk = true;
-                        if (flag === 2) $("#enter_period").prop("disabled", false);
-                    }
-                    this.flushSubmit();
-                } else {
-                    $(".select_cycle .duration").hide();
-                }
-            },
-            showTip() {//是否展示即将到期
-                var timeSub = this.endTime * 1000 - new Date().getTime();
-                if (timeSub > 0 && timeSub < 60 * 60 * 24 * 1000 * 3) {
-                    $(".vip-header").show();
-                }
-            },
-            flushSubmit() {//是否可提交
-                if (this.timeCheckOk && sessionStorage.getItem("vipSub_read") === "true") {
-                    $('.vip-footer.renew .confirm').prop('disabled', false)
-                } else {
-                    $('.vip-footer.renew .confirm').prop('disabled', true)
-                }
-            }
-        };
-
-
-        $(function () {
-            purchase.initData();
-            purchase.showArea();
-            purchase.showIndustry();
-            purchase.showPrice();
-            purchase.showTime();
-            purchase.showTip();
-            purchase.flushPrice(purchase.timeSelect);
-            purchase.flushSubmit();
-            var time_limit;//定义一个周期变量
-            /*------ 关闭弹窗事件  点击取消或遮罩层 -----*/
-            $('.weui-mask').click(hideDialog);
-            $('.cancel').click(hideDialog);
-
-            /* -----  订阅周期、支付方式弹窗弹出事件 -------*/
-            // 选择订阅周期
-            $('.select_cycle a').click(function (e) {
-                $('#time_cycle').show(200);
-            });
-
-
-            /* -----  选择完支付方式、订阅周期 回显到页面 -------*/
-            $('.vip-body .pay-mode').on('click', function () {
-                pickerShow('#pay_way', true)
-            });
-
-            $('#pay_way input:radio[name="way"]').click(function () {
-                var checkValue = $('input:radio[name="way"]:checked').val();
-                pickerShow('#pay_way', false)
-                $('.vip-body .pay-mode .pay-mode-text').text(checkValue);
-                if (checkValue === "微信支付") {
-                    purchase.payWay = "wx_app"
-                } else {
-                    purchase.payWay = "ali_app"
-                }
-                sessionStorage.setItem("payWay", purchase.payWay);
-            });
-
-
-            // 对订阅时间选择的input绑定点击事件
-            $('#time_cycle input:radio[name="time"]').on('click', function (e) {
-                // 解除确认按钮的锁定
-                $('#time_cycle .form-btn button').removeAttr('disabled');
-                if ($(e.target).hasClass('monthly')) {
-                    // 按月订阅
-                    $('#number_box_month').addClass('active');
-                    $('#number_box_year span').removeClass('active');
-                } else {
-                    // 按年订阅
-                    $('#number_box_month').removeClass('active');
-                    // $('#number_box_year span:eq(0)').addClass('active').siblings().removeClass('active');
-                }
-            });
-
-            /* --------控制月份number_box的事件  点击加减号触发的事件------- */
-            $('#number_box_month').on('click', 'button', function (e) {
-                // 点击加减号让input radio选中
-                $('#monthly').prop('checked', true);
-                $('#yearly').prop('checked', false);
-                $('.number_box span').removeClass('active');
-                $('#number_box_month').addClass('active');
-
-                var $number = $('#number_box_month span.month_number');
-                var $monthlyInput = $('#monthly');
-                // 未整理的data数组,里面的值都是字符串
-                var preData = e.delegateTarget.dataset;
-                var currentNum = parseInt($number.text());
-                var data = {};
-                // 把字符串转换成数字
-                for (var i in preData) {
-                    data[i] = preData[i] - 0
-                }
-
-                if (!$monthlyInput.prop('checked')) {
-                    return
-                }
-                // 判断是点击的是+ 还是-
-                if ($(e.target).hasClass('add') || $(e.currentTarget).hasClass('add')) {
-                    if (currentNum == 11) { //12个月自动跳转1年
-                        $("#number_box_year .year_number:eq(0)").trigger("click");
-                        return
-                    }
-                    // 点的+
-                    currentNum = currentNum >= data.numboxMax ? data.numboxMax : (currentNum + data
-                        .numboxStep);
-                } else {
-                    // 点的-
-                    currentNum = currentNum <= data.numboxMin ? data.numboxMin : (currentNum - data
-                        .numboxStep);
-                }
-                $number.text(currentNum);
-                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();
-                } else {
-                    $('.profit_tips').hide();
-                }*/
-                // 如果为操作后的结果为1,则锁定减号按钮
-                if (currentNum === data.numboxMin) {
-                    firstButton.attr('disabled', true)
-                } else {
-                    firstButton.removeAttr('disabled')
-                }
-                // 如果为操作后的结果为12,则锁定加号按钮
-                if (currentNum === data.numboxMax) {
-                    lastButton.attr('disabled', true)
-                } else {
-                    lastButton.removeAttr('disabled')
-                }
-            });
-
-            /* -------- 控制年份number_box的事件  点击1年 2年 3年触发的事件------- */
-            $('#number_box_year').on('click', 'span', function (e) {
-                console.log(e.target.dataset.id);
-                $('#number_box_month').removeClass('active');
-                var id = e.target.dataset.id;
-                //$('.profit_tips').hide();
-                $(this).addClass('active').siblings().removeClass('active');
-                $('#yearly').prop('checked', true);
-                $("#monthly").prop('checked', false);
-
-                // 渲染结果 保留一位小数
-                //var result = (Number(id) * 58).toFixed(1);
-                //$('.computed_price').html('¥' + result)
-                purchase.timeSelect_tmp = [Number(id), 1];
-                purchase.flushPrice(purchase.timeSelect_tmp, 2);
-            });
-
-            /* -------- 选择按月订阅  radio触发的事件------- */
-            $('#monthly').on('change', function (e) {
-                var isChecked = $(this).is(':checked');
-                var val = $('.month_number').text();
-                /*if (val >= 10) {
-                    $('.profit_tips').show()
-                }*/
-                if (!isChecked) {
-                    $('#number_box_month button').attr('disabled', true)
-                }
-                //var result = (Number(val) * 5.8).toFixed(1);
-                //$('.computed_price').html('¥' + result);
-                purchase.timeSelect_tmp = [Number(val), 2];
-                purchase.flushPrice(purchase.timeSelect_tmp, 2);
-            });
-            //计价清单
-            $('.billing-list-btn').on('click', function () {
-                pickerShow('.billing-list-container', true)
-            })
-            // 计算标准隐藏
-            $('.billing-list-container .dialog_hd__close').on('click', function () {
-                pickerShow('.billing-list-container', false)
-            })
-
-            $('.checkbox').on('click', function () {
-                $(this).toggleClass('checked')
-                var state = $(this).hasClass('checked');
-                sessionStorage.setItem("vipSub_read", state);
-                purchase.flushSubmit();
-                //$('.vip-footer.renew .confirm').prop('disabled', !state)
-            });
-            //是否点击已读
-            if (sessionStorage.getItem("vipSub_read") === "true") {
-                $('.checkbox').addClass("checked");
-            }
-
-            /* -------- 选择按年订阅  radio触发的事件------- */
-            $('#yearly').on('change', function (e) {
-                //$('.profit_tips').hide();
-                // console.log($(this).is(':checked'))
-                var isChecked = $(this).is(':checked');
-                // 按年订阅默认选择1年
-                var val = 1;
-                //$('.computed_price').html('¥' + Number(val) * 58)
-                if (isChecked) {
-                    $('#number_box_year span:eq(0)').addClass('active').siblings().removeClass('active')
-                }
-                purchase.timeSelect_tmp = [Number(val), 1];
-                purchase.flushPrice(purchase.timeSelect_tmp, 2);
-                purchase.flushSelectTime(purchase.timeSelect_tmp, 2);
-            });
-
-            // 确认订阅周期
-            $('#enter_period').on('click', function () {
-                var val;
-                var selectedDOM = $('#time_cycle input[name=time]:checked');
-                if (selectedDOM.val() === 'year') {
-                    val = $('#number_box_year .year_number.active').attr('data-id');
-                    purchase.timeSelect_tmp = [parseInt(val), 1];
-                    $('#time_cycle').hide(function () {
-                        purchase.timeValue = val + "年";
-                    });
-                } else if (selectedDOM.val() === 'month') {
-                    val = $('#number_box_month .month_number').text();
-                    purchase.timeSelect_tmp = [parseInt(val), 2];
-                    $('#time_cycle').hide(function () {
-                        purchase.timeValue = val + "个月";
-                    });
-                }
-
-                purchase.timeSelect = purchase.timeSelect_tmp;
-                purchase.showTime();
-                purchase.flushPrice(purchase.timeSelect, 1);
-                sessionStorage.setItem("vipSubSelectTime", JSON.stringify(purchase.timeSelect));
-            });
-            $('.vip-footer.renew .confirm').click(function () {
-                $('.vip-footer.renew .confirm').attr("disabled", "disabled");
-                //支付请求
-                var area = purchase.areaSelect;
-                var industry = purchase.industrySelect;
-                if (area["全国"]) {
-                    area = {};
-                }
-                if (industry.length === 1 && industry[0] === "全部行业") {
-                    industry = [];
-                }
-                //付费用户
-                var param = {
-                    "area": JSON.stringify(area),
-                    "industry": industry.join(","),
-                    "time": purchase.timeValue.trim(),
-                    "payWay": purchase.payWay,
-                    "orderType": 5,
-                };
-                $DoPost("/subscribepay/vipsubscribe/createOrder", param, function (r) {
-                    if (r.success) {
-                        try {
-                            if (param.payWay === "wx_app") {
-                                JyObj.wxPay(r.data.res)
-                            } else {
-                                JyObj.aliPay(r.data.res)
-                            }
-                            checkpay(r.data.code)
-                        } catch (e) {
-                            showToast(e)
-                        }
-                    }
-                }, false);
-                $('.vip-footer.renew .confirm').removeAttr("disabled");
-            })
-
-        });
-
-        // 隐藏dialog选择框
-        function hideDialog() {
-            $('#pay_way').hide(200);
-            $('#time_cycle').hide(200);
-        }
-
-        function clearSessionStorage() {
-            sessionStorage.removeItem("vipSubSelectArea");
-            sessionStorage.removeItem("vipSubSelectIndustry");
-            sessionStorage.removeItem("vipSubSelectTime");
-            sessionStorage.removeItem("vipSub_read");
-            sessionStorage.removeItem("historypushDataCache");
-            sessionStorage.removeItem("endTime");
-            sessionStorage.removeItem("payWay");
-            sessionStorage.To_introducePage = 2;
-            //订阅首页
-            sessionStorage.removeItem("sub_vip_state");
-            sessionStorage.removeItem("vip_index_read");
-            sessionStorage.removeItem("vip_change_time");
-
-            sessionStorage.removeItem("pay_read_cache")
-        }
-
-        function pickerShow(selector, f) {
-            if (f) {
-                // 添加进场动画,并显示
-                $(selector).find('.weui-mask').removeClass('weui-animate-fade-out').addClass('weui-animate-fade-in')
-                $(selector).find('.weui-picker').removeClass('weui-animate-slide-down').addClass('weui-animate-slide-up')
-                $(selector).show(300);
-            } else {
-                // 添加离场动画,并隐藏
-                $(selector).find('.weui-mask').removeClass('weui-animate-fade-in').addClass('weui-animate-fade-out')
-                $(selector).find('.weui-picker').removeClass('weui-animate-slide-up').addClass('weui-animate-slide-down')
-                $(selector).hide(300);
-            }
-        }
-
-        //app支付 公共方法
-        //查询是否支付完成
-        var interval;
-
-        function checkpay(orderid) {
-            if (interval) {
-                clearInterval(interval);
-            }
-            interval = setInterval(function () {
-                $.post("/jypay/isPaySuccess", {code: orderid}, function (r) {
-                    if (r.success) {
-                        clearSessionStorage();
-                        window.location.replace("/jyapp/vipsubscribe/toPaySuccessPage?orderCode=" + orderid);
-                    }
-                });
-                if (canpay && mySysIsIos()) {
-                    clearInterval(interval);
-                }
-            }, 2000)
-        }
-
-        function payCallBack(status) {
-            switch (status) {
-                case "0"://支付取消
-                    clearInterval(interval);
-                    break;
-                case "1"://支付完成
-
-                    break;
-                case "-1"://支付失败
-                    clearInterval(interval);
-                    break;
-            }
-        }
-
-        function showToast(content) {
-            weui.toast(content, {
-                duration: 2000,
-                className: 'custom-toast',
-            });
-        }
-
-        function toRead() {
-            sessionStorage.setItem("pay_read_cache", "0");
-            window.location.href = "/jyapp/front/staticPage/wx-serviceterms.html";
-        }
-
-    </script>
+	<script>
+	    $(window).bind("pageshow", function (event) {
+	        if (event.originalEvent.persisted) {
+	            window.location.reload();
+	        }
+	    });
+		var live20200707 = {
+			startTime: {{Msg "seo" "liveActiveStartTime"}},
+			endTime: {{Msg "seo" "liveActiveEndTime"}}
+		}
+	</script>
+	<script src="{{Msg "seo" "cdn"}}/jyapp/vipsubscribe/js/vip_renew.js?v={{Msg "seo" "version"}}"></script>
 </div>
 {{include "/common/baiducc.html"}}
 </body>
 
-</html>
+</html>