|
@@ -257,7 +257,7 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
<script src="/vipsubscribe/js/jquery-2.1.4.js?v={{Msg "seo" "version"}}"></script>
|
|
|
- <script src="/vipsubscribe/js/fastclick.js?v={{Msg "seo" "version"}}"></script>
|
|
|
+ <!--<script src="/vipsubscribe/js/fastclick.js?v={{Msg "seo" "version"}}"></script>-->
|
|
|
<script src="/vipsubscribe/js/weui.min.js?v={{Msg "seo" "version"}}"></script>
|
|
|
<script src="/vipsubscribe/js/common.js?v={{Msg "seo" "version"}}"></script>
|
|
|
{{include "/common/weixin.html"}}
|
|
@@ -436,234 +436,239 @@
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
+ $(window).bind("pageshow", function(event){
|
|
|
+ if(event.originalEvent.persisted){
|
|
|
+ window.location.reload();
|
|
|
+ }
|
|
|
+ });
|
|
|
|
|
|
|
|
|
$(function () {
|
|
|
- purchase.initData();
|
|
|
- purchase.showArea();
|
|
|
- purchase.showIndustry();
|
|
|
- purchase.showTime();
|
|
|
- purchase.flushPrice();
|
|
|
- checkOk();
|
|
|
- var time_limit;//定义一个周期变量
|
|
|
- /*------ 关闭弹窗事件 点击取消或遮罩层 -----*/
|
|
|
- $('.weui-mask').click(hideDialog);
|
|
|
- $('.cancel').click(hideDialog);
|
|
|
+ purchase.initData();
|
|
|
+ purchase.showArea();
|
|
|
+ purchase.showIndustry();
|
|
|
+ purchase.showTime();
|
|
|
+ purchase.flushPrice();
|
|
|
+ checkOk();
|
|
|
+ var time_limit;//定义一个周期变量
|
|
|
+ /*------ 关闭弹窗事件 点击取消或遮罩层 -----*/
|
|
|
+ $('.weui-mask').click(hideDialog);
|
|
|
+ $('.cancel').click(hideDialog);
|
|
|
|
|
|
- /* ----- 订阅周期、支付方式弹窗弹出事件 -------*/
|
|
|
- // 选择订阅周期
|
|
|
- $('.select_cycle a').click(function (e) {
|
|
|
- $('#time_cycle').show(200);
|
|
|
- })
|
|
|
- // 选择支付方式
|
|
|
- $('.select_payment .choose_way').click(function () {
|
|
|
- return
|
|
|
- $('#pay_way').show(200);
|
|
|
- })
|
|
|
+ /* ----- 订阅周期、支付方式弹窗弹出事件 -------*/
|
|
|
+ // 选择订阅周期
|
|
|
+ $('.select_cycle a').click(function (e) {
|
|
|
+ $('#time_cycle').show(200);
|
|
|
+ })
|
|
|
+ // 选择支付方式
|
|
|
+ $('.select_payment .choose_way').click(function () {
|
|
|
+ return
|
|
|
+ $('#pay_way').show(200);
|
|
|
+ })
|
|
|
|
|
|
|
|
|
|
|
|
- /* ----- 选择完支付方式、订阅周期 回显到页面 -------*/
|
|
|
- // 对支付方式选择的input绑定点击事件
|
|
|
- $('#pay_way input:radio[name="way"]').click(function () {
|
|
|
- var checkValue = $('input:radio[name="way"]:checked').val();
|
|
|
- $('.pay_way').hide(200);
|
|
|
- $('.pay_mode .select_payment .choose_way.info').html(checkValue);
|
|
|
- });
|
|
|
- // 对订阅时间选择的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');
|
|
|
- }
|
|
|
- })
|
|
|
+ /* ----- 选择完支付方式、订阅周期 回显到页面 -------*/
|
|
|
+ // 对支付方式选择的input绑定点击事件
|
|
|
+ $('#pay_way input:radio[name="way"]').click(function () {
|
|
|
+ var checkValue = $('input:radio[name="way"]:checked').val();
|
|
|
+ $('.pay_way').hide(200);
|
|
|
+ $('.pay_mode .select_payment .choose_way.info').html(checkValue);
|
|
|
+ });
|
|
|
+ // 对订阅时间选择的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')
|
|
|
+ /* --------控制月份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
|
|
|
- }
|
|
|
+ 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')) {
|
|
|
+ if (!$monthlyInput.prop('checked')) {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ // 判断是点击的是+ 还是-
|
|
|
+ if ($(e.target).hasClass('add')) {
|
|
|
+ if(currentNum==11){ //12个月自动跳转1年
|
|
|
+ $("#number_box_year .year_number:eq(0)").trigger("click");
|
|
|
return
|
|
|
- }
|
|
|
- // 判断是点击的是+ 还是-
|
|
|
- if ($(e.target).hasClass('add')) {
|
|
|
- if(currentNum==11){ //12个月自动跳转1年
|
|
|
- $("#number_box_year .year_number:eq(0)").trigger("click");
|
|
|
- return
|
|
|
- }
|
|
|
- // 点的+
|
|
|
- // currentNum = currentNum >= 12 ? 12 : currentNum + 1;
|
|
|
- currentNum = currentNum >= data.numboxMax ? data.numboxMax : currentNum + data
|
|
|
- .numboxStep;
|
|
|
- } else {
|
|
|
- // 点的-
|
|
|
- // currentNum = currentNum <= 1 ? 1 : currentNum - 1;
|
|
|
- currentNum = currentNum <= data.numboxMin ? data.numboxMin : currentNum - data
|
|
|
- .numboxStep;
|
|
|
- }
|
|
|
- $number.text(currentNum)
|
|
|
- purchase.timeSelect=[Number(currentNum),2];
|
|
|
- purchase.flushPrice();
|
|
|
- //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').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')
|
|
|
- }
|
|
|
- })
|
|
|
+ }
|
|
|
+ // 点的+
|
|
|
+ // currentNum = currentNum >= 12 ? 12 : currentNum + 1;
|
|
|
+ currentNum = currentNum >= data.numboxMax ? data.numboxMax : currentNum + data
|
|
|
+ .numboxStep;
|
|
|
+ } else {
|
|
|
+ // 点的-
|
|
|
+ // currentNum = currentNum <= 1 ? 1 : currentNum - 1;
|
|
|
+ currentNum = currentNum <= data.numboxMin ? data.numboxMin : currentNum - data
|
|
|
+ .numboxStep;
|
|
|
+ }
|
|
|
+ $number.text(currentNum)
|
|
|
+ purchase.timeSelect=[Number(currentNum),2];
|
|
|
+ purchase.flushPrice();
|
|
|
+ //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').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')
|
|
|
- let id = e.target.dataset.id;
|
|
|
- $('.profit_tips').hide()
|
|
|
- $(this).addClass('active').siblings().removeClass('active')
|
|
|
- $('#yearly').prop('checked', true);
|
|
|
- $("#monthly").prop('checked', false);
|
|
|
+ /* -------- 控制年份number_box的事件 点击1年 2年 3年触发的事件------- */
|
|
|
+ $('#number_box_year').on('click', 'span', function (e) {
|
|
|
+ console.log(e.target.dataset.id)
|
|
|
+ $('#number_box_month').removeClass('active')
|
|
|
+ let id = e.target.dataset.id;
|
|
|
+ $('.profit_tips').hide()
|
|
|
+ $(this).addClass('active').siblings().removeClass('active')
|
|
|
+ $('#yearly').prop('checked', true);
|
|
|
+ $("#monthly").prop('checked', false);
|
|
|
|
|
|
- // 渲染结果 保留一位小数
|
|
|
- //let result = (Number(id) * 58).toFixed(1);
|
|
|
- //$('.computed_price').html('¥' + result)
|
|
|
- purchase.timeSelect=[Number(id),1];
|
|
|
- purchase.flushPrice();
|
|
|
- })
|
|
|
+ // 渲染结果 保留一位小数
|
|
|
+ //let result = (Number(id) * 58).toFixed(1);
|
|
|
+ //$('.computed_price').html('¥' + result)
|
|
|
+ purchase.timeSelect=[Number(id),1];
|
|
|
+ purchase.flushPrice();
|
|
|
+ })
|
|
|
|
|
|
- /* -------- 选择按月订阅 radio触发的事件------- */
|
|
|
- $('#monthly').on('change', function (e) {
|
|
|
- let isChecked = $(this).is(':checked')
|
|
|
- let val = $('.month_number').text();
|
|
|
- if (val >= 10) {
|
|
|
- $('.profit_tips').show()
|
|
|
- }
|
|
|
- if (!isChecked) {
|
|
|
- $('#number_box_month button').attr('disabled', true)
|
|
|
- } else {
|
|
|
- $('#number_box_month button').removeAttr('disabled')
|
|
|
- }
|
|
|
- //let result = (Number(val) * 5.8).toFixed(1);
|
|
|
- //$('.computed_price').html('¥' + result);
|
|
|
- purchase.timeSelect=[Number(val),2];
|
|
|
- purchase.flushPrice();
|
|
|
+ /* -------- 选择按月订阅 radio触发的事件------- */
|
|
|
+ $('#monthly').on('change', function (e) {
|
|
|
+ let isChecked = $(this).is(':checked')
|
|
|
+ let val = $('.month_number').text();
|
|
|
+ if (val >= 10) {
|
|
|
+ $('.profit_tips').show()
|
|
|
+ }
|
|
|
+ if (!isChecked) {
|
|
|
+ $('#number_box_month button').attr('disabled', true)
|
|
|
+ } else {
|
|
|
+ $('#number_box_month button').removeAttr('disabled')
|
|
|
+ }
|
|
|
+ //let result = (Number(val) * 5.8).toFixed(1);
|
|
|
+ //$('.computed_price').html('¥' + result);
|
|
|
+ purchase.timeSelect=[Number(val),2];
|
|
|
+ purchase.flushPrice();
|
|
|
|
|
|
- })
|
|
|
- /* -------- 选择按年订阅 radio触发的事件------- */
|
|
|
- $('#yearly').on('change', function (e) {
|
|
|
- $('.profit_tips').hide()
|
|
|
- // console.log($(this).is(':checked'))
|
|
|
- let isChecked = $(this).is(':checked')
|
|
|
- // 按年订阅默认选择1年
|
|
|
- //let val = 1;
|
|
|
- //$('.computed_price').html('¥' + Number(val) * 58)
|
|
|
- if (isChecked) {
|
|
|
- $('#number_box_year span:eq(0)').addClass('active').siblings().removeClass('active')
|
|
|
- }
|
|
|
- purchase.timeSelect=[Number(val),1];
|
|
|
- purchase.flushPrice();
|
|
|
- })
|
|
|
+ })
|
|
|
+ /* -------- 选择按年订阅 radio触发的事件------- */
|
|
|
+ $('#yearly').on('change', function (e) {
|
|
|
+ $('.profit_tips').hide()
|
|
|
+ // console.log($(this).is(':checked'))
|
|
|
+ let isChecked = $(this).is(':checked')
|
|
|
+ // 按年订阅默认选择1年
|
|
|
+ //let val = 1;
|
|
|
+ //$('.computed_price').html('¥' + Number(val) * 58)
|
|
|
+ if (isChecked) {
|
|
|
+ $('#number_box_year span:eq(0)').addClass('active').siblings().removeClass('active')
|
|
|
+ }
|
|
|
+ purchase.timeSelect=[Number(val),1];
|
|
|
+ purchase.flushPrice();
|
|
|
+ })
|
|
|
|
|
|
- // 确认订阅周期
|
|
|
- $('#enter_period').on('click', function () {
|
|
|
- var val;
|
|
|
- $('input[name="time"]').each(function (i, v) {
|
|
|
- let isChecked = $(v).is(':checked')
|
|
|
- if ($(v).is(':checked') === true && $('.year_number').hasClass('active')) {
|
|
|
- val = $('.active').html()
|
|
|
- $('#time_cycle').hide(function () {
|
|
|
- $('.choose_time').val(val)
|
|
|
- })
|
|
|
- purchase.timeSelect=[parseInt(val[0]),1]
|
|
|
- } else if ($(v).is(':checked') === true) {
|
|
|
- val = $('.month_number').html();
|
|
|
- $('#time_cycle').hide(function () {
|
|
|
- $('.choose_time').val(val + '个月')
|
|
|
- })
|
|
|
- purchase.timeSelect=[parseInt(val),2]
|
|
|
- }
|
|
|
- })
|
|
|
- purchase.flushPrice();
|
|
|
- sessionStorage.setItem("vipSubSelectTime",JSON.stringify(purchase.timeSelect));
|
|
|
- })
|
|
|
- $("input").bind("input propertychange change", function (event) {
|
|
|
- checkOk();
|
|
|
- });
|
|
|
+ // 确认订阅周期
|
|
|
+ $('#enter_period').on('click', function () {
|
|
|
+ var val;
|
|
|
+ $('input[name="time"]').each(function (i, v) {
|
|
|
+ let isChecked = $(v).is(':checked')
|
|
|
+ if ($(v).is(':checked') === true && $('.year_number').hasClass('active')) {
|
|
|
+ val = $('.active').html()
|
|
|
+ $('#time_cycle').hide(function () {
|
|
|
+ $('.choose_time').val(val)
|
|
|
+ })
|
|
|
+ purchase.timeSelect=[parseInt(val[0]),1]
|
|
|
+ } else if ($(v).is(':checked') === true) {
|
|
|
+ val = $('.month_number').html();
|
|
|
+ $('#time_cycle').hide(function () {
|
|
|
+ $('.choose_time').val(val + '个月')
|
|
|
+ })
|
|
|
+ purchase.timeSelect=[parseInt(val),2]
|
|
|
+ }
|
|
|
+ })
|
|
|
+ purchase.flushPrice();
|
|
|
+ sessionStorage.setItem("vipSubSelectTime",JSON.stringify(purchase.timeSelect));
|
|
|
+ })
|
|
|
+ $("input").bind("input propertychange change", function (event) {
|
|
|
+ checkOk();
|
|
|
+ });
|
|
|
|
|
|
- $('#payHandle').click(function () {
|
|
|
- $("#payHandle").attr("disabled","disabled")
|
|
|
- //支付请求
|
|
|
- var area=purchase.areaSelect;
|
|
|
- var industry=purchase.industrySelect;
|
|
|
- if(area["全国"]){
|
|
|
- area={};
|
|
|
- }
|
|
|
- if(industry.length==1&&industry[0]=="全部行业"){
|
|
|
- industry=[];
|
|
|
+ $('#payHandle').click(function () {
|
|
|
+ $("#payHandle").attr("disabled","disabled")
|
|
|
+ //支付请求
|
|
|
+ var area=purchase.areaSelect;
|
|
|
+ var industry=purchase.industrySelect;
|
|
|
+ if(area["全国"]){
|
|
|
+ area={};
|
|
|
+ }
|
|
|
+ if(industry.length==1&&industry[0]=="全部行业"){
|
|
|
+ industry=[];
|
|
|
+ }
|
|
|
+ {{if not .T.isTrial}}
|
|
|
+ //付费用户
|
|
|
+ var param={
|
|
|
+ "area":JSON.stringify(area),
|
|
|
+ "industry":industry.join(","),
|
|
|
+ "time":$(".info:eq(2)").val().trim(),
|
|
|
+ "payWay":"wx_js",
|
|
|
+ "orderType":{{.T.orderType}},
|
|
|
}
|
|
|
- {{if not .T.isTrial}}
|
|
|
- //付费用户
|
|
|
- var param={
|
|
|
- "area":JSON.stringify(area),
|
|
|
- "industry":industry.join(","),
|
|
|
- "time":$(".info:eq(2)").val().trim(),
|
|
|
- "payWay":"wx_js",
|
|
|
- "orderType":{{.T.orderType}},
|
|
|
+ $DoPost("/subscribepay/vipsubscribe/createOrder",param,function(r){
|
|
|
+ if(r.success){
|
|
|
+ clearSessionStorage();
|
|
|
+ onBridgeReady(JSON.parse(r.data.res),r.data.code);
|
|
|
}
|
|
|
- $DoPost("/subscribepay/vipsubscribe/createOrder",param,function(r){
|
|
|
- if(r.success){
|
|
|
- clearSessionStorage();
|
|
|
- onBridgeReady(JSON.parse(r.data.res),r.data.code);
|
|
|
- }
|
|
|
- $("#payHandle").removeAttr("disabled")
|
|
|
- })
|
|
|
- {{else}}
|
|
|
- //试用用户
|
|
|
- $DoPost("/subscribepay/order/trialPay",{"area":JSON.stringify(area),"industry":industry.join(",")},function(r){
|
|
|
- if(r.success){
|
|
|
- clearSessionStorage();
|
|
|
- $("#payHandle").attr("disabled","disabled");
|
|
|
- window.location.replace("/front/vipsubscribe/toPaySuccessPage?orderCode="+r.data.code);
|
|
|
- }
|
|
|
- })
|
|
|
- {{end}}
|
|
|
- })
|
|
|
+ $("#payHandle").removeAttr("disabled")
|
|
|
+ })
|
|
|
+ {{else}}
|
|
|
+ //试用用户
|
|
|
+ $DoPost("/subscribepay/order/trialPay",{"area":JSON.stringify(area),"industry":industry.join(",")},function(r){
|
|
|
+ if(r.success){
|
|
|
+ clearSessionStorage();
|
|
|
+ $("#payHandle").attr("disabled","disabled");
|
|
|
+ window.location.replace("/front/vipsubscribe/toPaySuccessPage?orderCode="+r.data.code);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ {{end}}
|
|
|
+ })
|
|
|
|
|
|
})
|
|
|
// 隐藏dialog选择框
|