|
@@ -4,26 +4,27 @@
|
|
|
<head>
|
|
|
<meta charset="utf-8">
|
|
|
<meta name="viewport"
|
|
|
- content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
|
|
|
+ content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no"/>
|
|
|
<title>VIP订阅</title>
|
|
|
<script src="/vipsubscribe/js/rem.js?v={{Msg "seo" "version"}}"></script>
|
|
|
- <link rel="stylesheet" type="text/css" href="/vipsubscribe/css/base.css?v={{Msg "seo" "version"}}" />
|
|
|
+ <link rel="stylesheet" type="text/css" href="/vipsubscribe/css/base.css?v={{Msg "seo" "version"}}"/>
|
|
|
<link rel="stylesheet" href="/vipsubscribe/css/weui.min.css?v={{Msg "seo" "version"}}">
|
|
|
<link rel="stylesheet" href="/vipsubscribe/iconfont/iconfont.css?v={{Msg "seo" "version"}}">
|
|
|
- <link rel="stylesheet" href="/vipsubscribe/css/vip_purchase.css?v=3{{Msg "seo" "version"}}">
|
|
|
-</head>
|
|
|
+ <link rel="stylesheet" href="/vipsubscribe/css/vip_purchase.css?v={{Msg "seo" "version"}}">
|
|
|
+</head>
|
|
|
<body>
|
|
|
- <div>
|
|
|
+<div>
|
|
|
<div class="vip_purchase">
|
|
|
<div class="choose_condition">
|
|
|
<ul class="chooseList">
|
|
|
- <li class="choose_item">
|
|
|
+ <li class="choose_item">
|
|
|
<a href="/front/vipsubscribe/toChooseArea">
|
|
|
<span class="label">区域</span>
|
|
|
{{if not .T.isTrial }}
|
|
|
- <input type="text" disabled value="" placeholder="1个市" class="info choose_area">
|
|
|
+ <input type="text" disabled value="" placeholder="1个市"
|
|
|
+ class="info choose_area">
|
|
|
{{else}}
|
|
|
- <input type="text" disabled value="" placeholder="选择全国、省份、地市" class="info choose_area">
|
|
|
+ <input type="text" disabled value="" placeholder="选择全国、省份、地市" class="info choose_area">
|
|
|
{{end}}
|
|
|
<i class="iconfont icon-arrow"></i>
|
|
|
</a>
|
|
@@ -34,9 +35,10 @@
|
|
|
<a href="/front/vipsubscribe/toChooseIndustry">
|
|
|
<span class="label">行业</span>
|
|
|
{{if not .T.isTrial }}
|
|
|
- <input type="text" disabled value="" placeholder="1个行业" class="info choose_industry">
|
|
|
+ <input type="text" disabled value="" placeholder="1个行业"
|
|
|
+ class="info choose_industry">
|
|
|
{{else}}
|
|
|
- <input type="text" disabled value="" placeholder="选择采购单位行业" class="info choose_industry">
|
|
|
+ <input type="text" disabled value="" placeholder="选择采购单位行业" class="info choose_industry">
|
|
|
{{end}}
|
|
|
<i class="iconfont icon-arrow"></i>
|
|
|
</a>
|
|
@@ -47,29 +49,30 @@
|
|
|
<!-- 需要选择订阅周期就用a标签,div.class="free-7day"隐藏 opacity: 1 !important; -->
|
|
|
<!-- 需要选择试用就用div标签,a标签隐藏 -->
|
|
|
{{if not .T.isTrial }}
|
|
|
- <a href="javascript:;">
|
|
|
- <span class="label">订阅周期</span>
|
|
|
- <input type="text" readonly="readonly" disabled style="color:#000;opacity:0.7;" value="1个月" class="info choose_time">
|
|
|
- <i class="iconfont icon-arrow choose_time"></i>
|
|
|
- </a>
|
|
|
+ <a href="javascript:;">
|
|
|
+ <span class="label">订阅周期</span>
|
|
|
+ <input type="text" readonly="readonly" disabled style="color:#000;" value="1个月"
|
|
|
+ class="info choose_time">
|
|
|
+ <i class="iconfont icon-arrow choose_time"></i>
|
|
|
+ </a>
|
|
|
{{else}}
|
|
|
- <div class="free-7day" >
|
|
|
- <span class="label">订阅周期</span>
|
|
|
- <i class="info">免费试用7天</i>
|
|
|
- </div>
|
|
|
+ <div class="free-7day">
|
|
|
+ <span class="label">订阅周期</span>
|
|
|
+ <i class="info">免费试用7天</i>
|
|
|
+ </div>
|
|
|
{{end}}
|
|
|
-
|
|
|
+
|
|
|
</li>
|
|
|
</ul>
|
|
|
<div class="pay_mode">
|
|
|
{{if not .T.isTrial }}
|
|
|
- <div class="select_payment choose_item">
|
|
|
- <a href="javascript:;">
|
|
|
- <span class="label">支付方式</span>
|
|
|
- <span class="info choose_way" style="width: 6rem;">微信支付</span>
|
|
|
- <!--<i class="iconfont"></i>-->
|
|
|
- </a>
|
|
|
- </div>
|
|
|
+ <div class="select_payment choose_item">
|
|
|
+ <a href="javascript:;">
|
|
|
+ <span class="label">支付方式</span>
|
|
|
+ <span class="info choose_way" style="width: 6rem;">微信支付</span>
|
|
|
+ <!--<i class="iconfont"></i>-->
|
|
|
+ </a>
|
|
|
+ </div>
|
|
|
{{end}}
|
|
|
<div class="vip_rules">
|
|
|
<!--
|
|
@@ -135,7 +138,7 @@
|
|
|
<div class="weui-cells weui-cells_checkbox radio-form">
|
|
|
<label class="weui-cell weui-check__label" for="buy">
|
|
|
<div class="weui-cell__hd">
|
|
|
- <input type="checkbox" class="weui-check" name="buyService" id="buy" />
|
|
|
+ <input type="checkbox" class="weui-check" name="buyService" id="buy"/>
|
|
|
<i class="weui-icon-checked"></i>
|
|
|
</div>
|
|
|
<div class="weui-cell__bd read">
|
|
@@ -179,7 +182,7 @@
|
|
|
<label class="weui-cell weui-check__label monthly_label" for="monthly">
|
|
|
<div class="weui-cell__hd">
|
|
|
<input type="radio" class="weui-check monthly" name="time" value="month"
|
|
|
- id="monthly"/>
|
|
|
+ id="monthly"/>
|
|
|
<i class="weui-icon-checked"></i>
|
|
|
</div>
|
|
|
<div class="weui-cell__bd">
|
|
@@ -187,7 +190,7 @@
|
|
|
</div>
|
|
|
</label>
|
|
|
<div class="number_box" id="number_box_month" data-numbox-step="1" data-numbox-min="1"
|
|
|
- data-numbox-max="12">
|
|
|
+ data-numbox-max="12">
|
|
|
<button class="weui-btn weui-btn_plain-default" type="button">
|
|
|
<div class="jy_icon decrease"></div>
|
|
|
</button>
|
|
@@ -201,7 +204,7 @@
|
|
|
<label class="weui-cell weui-check__label yearly_label" for="yearly">
|
|
|
<div class="weui-cell__hd">
|
|
|
<input type="radio" class="weui-check yearly" name="time" value="year"
|
|
|
- id="yearly" checked/>
|
|
|
+ id="yearly" checked/>
|
|
|
<i class="weui-icon-checked"></i>
|
|
|
</div>
|
|
|
<div class="weui-cell__bd">
|
|
@@ -221,7 +224,7 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
- <!-- 选择支付方式 -->
|
|
|
+ <!-- 选择支付方式 -->
|
|
|
<div class="js_dialog pay_way" id="pay_way" style="display: none;">
|
|
|
<div class="weui-mask"></div>
|
|
|
<div class="box">
|
|
@@ -237,7 +240,7 @@
|
|
|
<p><img src="/vipsubscribe/image/weixin.png?v={{Msg "seo" "version"}}">微信支付</p>
|
|
|
</div>
|
|
|
<div class="weui-cell__hd">
|
|
|
- <input type="radio" class="weui-check" name="way" value="微信支付" id="wx" checked />
|
|
|
+ <input type="radio" class="weui-check" name="way" value="微信支付" id="wx" checked/>
|
|
|
<i class="weui-icon-checked"></i>
|
|
|
</div>
|
|
|
</label>
|
|
@@ -246,7 +249,7 @@
|
|
|
<p><img src="/vipsubscribe/image/zhifubao.png?v={{Msg "seo" "version"}}">支付宝支付</p>
|
|
|
</div>
|
|
|
<div class="weui-cell__hd">
|
|
|
- <input type="radio" class="weui-check" name="way" value="支付宝支付" id="zfb" />
|
|
|
+ <input type="radio" class="weui-check" name="way" value="支付宝支付" id="zfb"/>
|
|
|
<i class="weui-icon-checked"></i>
|
|
|
</div>
|
|
|
</label>
|
|
@@ -258,493 +261,492 @@
|
|
|
<script src="/vipsubscribe/js/jquery-2.1.4.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"}}
|
|
|
<script>
|
|
|
- //微信支付start
|
|
|
- {{if not .T.isTrial }}
|
|
|
- try{
|
|
|
- var signature = {{.T.signature}};
|
|
|
- var isConfigSuccess = true;
|
|
|
- var id = {{.T._id}}
|
|
|
- if(signature && signature.length == 4){
|
|
|
- wx.config({
|
|
|
- debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
|
|
|
- appId: signature[0], // 必填,公众号的唯一标识
|
|
|
- timestamp:signature[1], // 必填,生成签名的时间戳
|
|
|
- nonceStr: signature[2], // 必填,生成签名的随机串
|
|
|
- signature: signature[3],// 必填,签名,见附录1
|
|
|
- jsApiList: ['chooseWXPay','hideAllNonBaseMenuItem'] // 必填,需要使用的JS接口列表,所有JS接口列表见附录2
|
|
|
- });
|
|
|
- wx.ready(function () {
|
|
|
- if(!isConfigSuccess){
|
|
|
- return;
|
|
|
- }
|
|
|
- wx.hideAllNonBaseMenuItem();
|
|
|
- });
|
|
|
- wx.error(function(res){
|
|
|
- //config信息验证失败会执行error函数,如签名过期导致验证失败,具体错误信息可以打开config的debug模式查看,也可以在返回的res参数中查看,对于SPA可以在这里更新签名。
|
|
|
- //alert(res);
|
|
|
- isConfigSuccess = false;
|
|
|
- });
|
|
|
- }
|
|
|
- //调用微信支付接口
|
|
|
- function onBridgeReady(res,ordercode){
|
|
|
- WeixinJSBridge.invoke('getBrandWCPayRequest',{
|
|
|
- "appId": res["appId"],
|
|
|
- "timeStamp": res["timestamp"],
|
|
|
- "nonceStr": res["nonceStr"],
|
|
|
- "package": res["prepayId"],
|
|
|
- "signType": res["signType"],
|
|
|
- "paySign": res["sign"]
|
|
|
- },
|
|
|
- function(r){
|
|
|
- if(r.err_msg == "get_brand_wcpay_request:ok"){
|
|
|
- setTimeout(function(){
|
|
|
- window.location.replace("/front/vipsubscribe/toPaySuccessPage?orderCode="+ordercode);
|
|
|
- },500)
|
|
|
- }else if(r.err_msg == "get_brand_wcpay_request:cancel"){
|
|
|
- console.log("支付已取消")
|
|
|
- }else{
|
|
|
- weui.toast("系统异常,请稍微再试",{
|
|
|
- duration: 2000,
|
|
|
- className: 'custom-toast',
|
|
|
+ $(window).bind("pageshow", function (event) {
|
|
|
+ if (event.originalEvent.persisted) {
|
|
|
+ window.location.reload();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ //微信支付start
|
|
|
+ {{if not .T.isTrial }}
|
|
|
+ try {
|
|
|
+ var signature = {{.T.signature}};
|
|
|
+ var isConfigSuccess = true;
|
|
|
+ var id = {{.T._id}}
|
|
|
+ if (signature && signature.length == 4) {
|
|
|
+ wx.config({
|
|
|
+ debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
|
|
|
+ appId: signature[0], // 必填,公众号的唯一标识
|
|
|
+ timestamp: signature[1], // 必填,生成签名的时间戳
|
|
|
+ nonceStr: signature[2], // 必填,生成签名的随机串
|
|
|
+ signature: signature[3],// 必填,签名,见附录1
|
|
|
+ jsApiList: ['chooseWXPay', 'hideAllNonBaseMenuItem'] // 必填,需要使用的JS接口列表,所有JS接口列表见附录2
|
|
|
+ });
|
|
|
+ wx.ready(function () {
|
|
|
+ if (!isConfigSuccess) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ wx.hideAllNonBaseMenuItem();
|
|
|
+ });
|
|
|
+ wx.error(function (res) {
|
|
|
+ //config信息验证失败会执行error函数,如签名过期导致验证失败,具体错误信息可以打开config的debug模式查看,也可以在返回的res参数中查看,对于SPA可以在这里更新签名。
|
|
|
+ //alert(res);
|
|
|
+ isConfigSuccess = false;
|
|
|
});
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
- //微信支付end
|
|
|
- }catch(e){
|
|
|
- console.log(e)
|
|
|
- }
|
|
|
- sessionStorage.removeItem("vipSubisTrial");//非试用界面
|
|
|
- {{else}}
|
|
|
- sessionStorage.setItem("vipSubisTrial","1");//试用界面
|
|
|
- //试用用户
|
|
|
- {{end}}
|
|
|
- var purchase = {
|
|
|
- areaSelect:{"一个省":["一个市"]},//已选择地区 {"一个省":["一个市"]}计算价格临时变量
|
|
|
- industrySelect:["一个行业"],// 已选择行业 一个行业(计算价格临时变量)
|
|
|
- timeSelect:[1,2],//已选择时间 timeSelect[0]时长 timeSelect[1] 1:年 2:月
|
|
|
- price:{}, //价格
|
|
|
- vipSubisTrial:false,
|
|
|
- initData: function(){
|
|
|
- //已选择
|
|
|
- try{
|
|
|
- if(sessionStorage.getItem("vipSubSelectArea")){
|
|
|
- this.areaSelect=JSON.parse(sessionStorage.getItem("vipSubSelectArea"));
|
|
|
}
|
|
|
- if(sessionStorage.getItem("vipSubSelectIndustry")){
|
|
|
- this.industrySelect=JSON.parse(sessionStorage.getItem("vipSubSelectIndustry"));
|
|
|
+
|
|
|
+ //调用微信支付接口
|
|
|
+ function onBridgeReady(res, ordercode) {
|
|
|
+ WeixinJSBridge.invoke('getBrandWCPayRequest', {
|
|
|
+ "appId": res["appId"],
|
|
|
+ "timeStamp": res["timestamp"],
|
|
|
+ "nonceStr": res["nonceStr"],
|
|
|
+ "package": res["prepayId"],
|
|
|
+ "signType": res["signType"],
|
|
|
+ "paySign": res["sign"]
|
|
|
+ },
|
|
|
+ function (r) {
|
|
|
+ if (r.err_msg == "get_brand_wcpay_request:ok") {
|
|
|
+ setTimeout(function () {
|
|
|
+ clearSessionStorage();
|
|
|
+ window.location.replace("/front/vipsubscribe/toPaySuccessPage?orderCode=" + ordercode);
|
|
|
+ }, 500)
|
|
|
+ } else if (r.err_msg == "get_brand_wcpay_request:cancel") {
|
|
|
+ console.log("支付已取消")
|
|
|
+ } else {
|
|
|
+ weui.toast("系统异常,请稍微再试", {
|
|
|
+ duration: 2000,
|
|
|
+ className: 'custom-toast',
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
}
|
|
|
- {{if eq .T.orderType 5 }}
|
|
|
- //即将到期 回显已购买
|
|
|
- if(!sessionStorage.getItem("vipSubSelectArea")||!sessionStorage.getItem("vipSubSelectIndustry")){
|
|
|
- $DoPost("/subscribepay/editSub/getSubBuyMsg",{},function(r){
|
|
|
- if(r.success){
|
|
|
- if(!$.isEmptyObject(r.data.area)){
|
|
|
- purchase.areaSelect=r.data.area
|
|
|
- }else{
|
|
|
- purchase.areaSelect={"全国":[]}
|
|
|
+
|
|
|
+ //微信支付end
|
|
|
+ } catch (e) {
|
|
|
+ console.log(e)
|
|
|
+ }
|
|
|
+ sessionStorage.removeItem("vipSubisTrial");//非试用界面
|
|
|
+ {{else}}
|
|
|
+ sessionStorage.setItem("vipSubisTrial", "1");//试用界面
|
|
|
+ //试用用户
|
|
|
+ {{end}}
|
|
|
+ var purchase = {
|
|
|
+ areaSelect: {"一个省": ["一个市"]},//已选择地区 {"一个省":["一个市"]}计算价格临时变量
|
|
|
+ industrySelect: ["一个行业"],// 已选择行业 一个行业(计算价格临时变量)
|
|
|
+ timeSelect: [1, 2],//已选择时间 timeSelect[0]时长 timeSelect[1] 1:年 2:月
|
|
|
+ price: {}, //价格
|
|
|
+ vipSubisTrial: false,
|
|
|
+ initData: function () {
|
|
|
+ //已选择
|
|
|
+ try {
|
|
|
+ if (sessionStorage.getItem("vipSubSelectArea")) {
|
|
|
+ this.areaSelect = JSON.parse(sessionStorage.getItem("vipSubSelectArea"));
|
|
|
+ }
|
|
|
+ if (sessionStorage.getItem("vipSubSelectIndustry")) {
|
|
|
+ this.industrySelect = JSON.parse(sessionStorage.getItem("vipSubSelectIndustry"));
|
|
|
}
|
|
|
- if(r.data.industry.length!=0){
|
|
|
- purchase.industrySelect=r.data.industry
|
|
|
- }else{
|
|
|
- purchase.industrySelect=["全部行业"]
|
|
|
+ {{if eq .T.orderType 5 }}
|
|
|
+ //即将到期 回显已购买
|
|
|
+ if (!sessionStorage.getItem("vipSubSelectArea") || !sessionStorage.getItem("vipSubSelectIndustry")) {
|
|
|
+ $DoPost("/subscribepay/editSub/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 = ["全部行业"]
|
|
|
+ }
|
|
|
+ sessionStorage.setItem("vipSubSelectArea", JSON.stringify(purchase.areaSelect));
|
|
|
+ sessionStorage.setItem("vipSubSelectIndustry", JSON.stringify(purchase.industrySelect));
|
|
|
+ }
|
|
|
+ }, false)
|
|
|
}
|
|
|
- sessionStorage.setItem("vipSubSelectArea",JSON.stringify(purchase.areaSelect));
|
|
|
- sessionStorage.setItem("vipSubSelectIndustry",JSON.stringify(purchase.industrySelect));
|
|
|
- }
|
|
|
- },false)
|
|
|
- }
|
|
|
- {{end}}
|
|
|
-
|
|
|
- {{if .T.again}} //再次购买回显
|
|
|
- {{if eq .T.again 1 }}
|
|
|
- if(!sessionStorage.getItem("vipSubSelectArea")||!sessionStorage.getItem("vipSubSelectIndustry")){
|
|
|
- $DoPost("/subscribepay/editSub/getSubBuyMsg",{},function(r){
|
|
|
- if(r.success){
|
|
|
- if(!$.isEmptyObject(r.data.area)){
|
|
|
- purchase.areaSelect=r.data.area
|
|
|
- }else{
|
|
|
- purchase.areaSelect={"全国":[]}
|
|
|
+ {{end}}
|
|
|
+ {{if .T.again}} //再次购买回显
|
|
|
+ {{if eq .T.again 1 }}
|
|
|
+ if (!sessionStorage.getItem("vipSubSelectArea") || !sessionStorage.getItem("vipSubSelectIndustry")) {
|
|
|
+ $DoPost("/subscribepay/editSub/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 = ["全部行业"]
|
|
|
+ }
|
|
|
+ sessionStorage.setItem("vipSubSelectArea", JSON.stringify(purchase.areaSelect));
|
|
|
+ sessionStorage.setItem("vipSubSelectIndustry", JSON.stringify(purchase.industrySelect));
|
|
|
+ }
|
|
|
+ }, false)
|
|
|
}
|
|
|
- if(r.data.industry.length!=0){
|
|
|
- purchase.industrySelect=r.data.industry
|
|
|
- }else{
|
|
|
- purchase.industrySelect=["全部行业"]
|
|
|
+ {{end}}
|
|
|
+ {{end}}
|
|
|
+ if (sessionStorage.getItem("vipSubSelectTime")) {
|
|
|
+ this.timeSelect = JSON.parse(sessionStorage.getItem("vipSubSelectTime"));
|
|
|
}
|
|
|
- sessionStorage.setItem("vipSubSelectArea",JSON.stringify(purchase.areaSelect));
|
|
|
- sessionStorage.setItem("vipSubSelectIndustry",JSON.stringify(purchase.industrySelect));
|
|
|
- }
|
|
|
- },false)
|
|
|
- }
|
|
|
- {{end}}
|
|
|
- {{end}}
|
|
|
+ //是否已经点击已读
|
|
|
+ if (sessionStorage.getItem("vipSub_read") == "true") $("#buy").prop("checked", true);
|
|
|
+ //是否试用界面
|
|
|
+ if (sessionStorage.getItem("vipSubisTrial")) this.vipSubisTrial = true;
|
|
|
|
|
|
- if(sessionStorage.getItem("vipSubSelectTime")){
|
|
|
- this.timeSelect=JSON.parse(sessionStorage.getItem("vipSubSelectTime"));
|
|
|
- }
|
|
|
- //是否已经点击已读
|
|
|
- if(sessionStorage.getItem("vipSub_read")=="true") $("#buy").prop("checked",true);
|
|
|
- //是否试用界面
|
|
|
- if(sessionStorage.getItem("vipSubisTrial")) this.vipSubisTrial=true;
|
|
|
-
|
|
|
- //加载价格
|
|
|
- $DoPost("/subscribepay/vipsubscribe/getPrice",{},function(r){
|
|
|
- if(r){
|
|
|
- purchase.price=r;
|
|
|
- }
|
|
|
- },false)
|
|
|
-
|
|
|
- }catch(e){
|
|
|
- console.log(e)
|
|
|
- }
|
|
|
- },
|
|
|
- showArea:function(){
|
|
|
- let cityArr=[];//城市
|
|
|
- let provinceArr=[];//省份
|
|
|
- let data= this.areaSelect;
|
|
|
- for(var i in data) {
|
|
|
- let citys=data[i]
|
|
|
- if(citys.length>0){
|
|
|
- cityArr = cityArr.concat(citys);
|
|
|
- }else{
|
|
|
- provinceArr.push(i)
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- if(!$.isEmptyObject(data)&&!this.areaSelect["一个省"]){
|
|
|
- $(".choose_area").val(provinceArr.join(" ")+" "+cityArr.join(" "));
|
|
|
- }
|
|
|
+ //加载价格
|
|
|
+ $DoPost("/subscribepay/vipsubscribe/getPrice", {}, function (r) {
|
|
|
+ if (r) {
|
|
|
+ purchase.price = r;
|
|
|
+ }
|
|
|
+ }, false)
|
|
|
|
|
|
- if(!$.isEmptyObject(this.areaSelect)&&!this.areaSelect["全国"]&&!this.areaSelect["一个省"]){ //选择有行业信息 且不是全国
|
|
|
- var tipTxt="已选择 ";
|
|
|
- if(provinceArr.length>0)tipTxt+=provinceArr.length+" 个省级区域";
|
|
|
- if(cityArr.length>0){
|
|
|
- if(provinceArr.length>0) tipTxt+="、"
|
|
|
- tipTxt+=cityArr.length+" 个地市";
|
|
|
- }
|
|
|
- $(".add_tips.area").text(tipTxt).css("display","");
|
|
|
- }
|
|
|
- },
|
|
|
- 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(){
|
|
|
- let data = this.industrySelect;
|
|
|
- if(data.length>0&&data[0]!="一个行业"){
|
|
|
- $(".choose_industry").val(data.join(" "));
|
|
|
- }
|
|
|
- if(this.industrySelect.length>0&&this.industrySelect[0]!="全部行业"&&this.industrySelect[0]!="一个行业"){ //选择有行业信息
|
|
|
- var tipTxt="已选择 ";
|
|
|
- $(".add_tips.industry").text(tipTxt+this.industrySelect.length+" 个行业").css("display","");
|
|
|
- }
|
|
|
- },
|
|
|
- showTime:function(){
|
|
|
- let tmp = this.timeSelect[0];
|
|
|
- if(this.timeSelect[1]==1){
|
|
|
- tmp +="年"
|
|
|
- $("#yearly").prop('checked', true);
|
|
|
- $('.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();
|
|
|
+ } catch (e) {
|
|
|
+ console.log(e)
|
|
|
+ }
|
|
|
+ },
|
|
|
+ showArea: function () {
|
|
|
+ let cityArr = [];//城市
|
|
|
+ let provinceArr = [];//省份
|
|
|
+ let data = this.areaSelect;
|
|
|
+ for (var i in data) {
|
|
|
+ let citys = data[i];
|
|
|
+ if (citys.length > 0) {
|
|
|
+ cityArr = cityArr.concat(citys);
|
|
|
+ } else {
|
|
|
+ provinceArr.push(i)
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!$.isEmptyObject(data) && !this.areaSelect["一个省"]) {
|
|
|
+ $(".choose_area").val(provinceArr.join(" ") + " " + cityArr.join(" "));
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!$.isEmptyObject(this.areaSelect) && !this.areaSelect["全国"] && !this.areaSelect["一个省"]) { //选择有行业信息 且不是全国
|
|
|
+ var tipTxt = "已选择 ";
|
|
|
+ if (provinceArr.length > 0) tipTxt += provinceArr.length + " 个省级区域";
|
|
|
+ if (cityArr.length > 0) {
|
|
|
+ if (provinceArr.length > 0) tipTxt += "、";
|
|
|
+ tipTxt += cityArr.length + " 个地市";
|
|
|
+ }
|
|
|
+ $(".add_tips.area").text(tipTxt).css("display", "");
|
|
|
+ }
|
|
|
+ },
|
|
|
+ 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 () {
|
|
|
+ let data = this.industrySelect;
|
|
|
+ if (data.length > 0 && data[0] != "一个行业") {
|
|
|
+ $(".choose_industry").val(data.join(" "));
|
|
|
+ }
|
|
|
+
|
|
|
+ if (this.industrySelect.length > 0 && this.industrySelect[0] != "全部行业" && this.industrySelect[0] != "一个行业") { //选择有行业信息
|
|
|
+ var tipTxt = "已选择 ";
|
|
|
+ $(".add_tips.industry").text(tipTxt + this.industrySelect.length + " 个行业").css("display", "");
|
|
|
+ }
|
|
|
+ },
|
|
|
+ showTime: function () {
|
|
|
+ let tmp = this.timeSelect[0];
|
|
|
+ if (this.timeSelect[1] == 1) {
|
|
|
+ tmp += "年";
|
|
|
+ $("#yearly").prop('checked', true);
|
|
|
+ $('.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();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $(".info.choose_time").val(tmp);
|
|
|
+ },
|
|
|
+ flushPrice: function () {
|
|
|
+ if (this.vipSubisTrial) {
|
|
|
+ $('.price strong').text('¥0.00');
|
|
|
+ } else {
|
|
|
+ var price = getsubVipOrderPrice(this.areaSelect, this.industrySelect, this.timeSelect, this.price);
|
|
|
+ $('.price strong').text('¥' + price);
|
|
|
+ $('.computed_price').html('¥' + price);
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
- $(".info.choose_time").val(tmp);
|
|
|
- },
|
|
|
- flushPrice:function(){
|
|
|
- if(this.vipSubisTrial){
|
|
|
- $('.price strong').text('¥0.00');
|
|
|
- }else{
|
|
|
- var price=getsubVipOrderPrice(this.areaSelect,this.industrySelect,this.timeSelect,this.price);
|
|
|
- $('.price strong').text('¥'+price);
|
|
|
- $('.computed_price').html('¥' + price);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- $(window).bind("pageshow", function(event){
|
|
|
- if(event.originalEvent.persisted){
|
|
|
- window.location.reload();
|
|
|
- }
|
|
|
- });
|
|
|
-
|
|
|
+ };
|
|
|
|
|
|
- $(function () {
|
|
|
- purchase.initData();
|
|
|
- purchase.showArea();
|
|
|
- purchase.showIndustry();
|
|
|
- purchase.showPrice();
|
|
|
- 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);
|
|
|
- })
|
|
|
+ $(function () {
|
|
|
+ purchase.initData();
|
|
|
+ purchase.showArea();
|
|
|
+ purchase.showIndustry();
|
|
|
+ purchase.showPrice();
|
|
|
+ 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);
|
|
|
+ });
|
|
|
|
|
|
|
|
|
- /* ----- 选择完支付方式、订阅周期 回显到页面 -------*/
|
|
|
- // 对支付方式选择的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')) {
|
|
|
- return
|
|
|
- }
|
|
|
- // 判断是点击的是+ 还是-
|
|
|
- if ($(e.target).hasClass('add')) {
|
|
|
- if(currentNum==11){ //12个月自动跳转1年
|
|
|
- $("#number_box_year .year_number:eq(0)").trigger("click");
|
|
|
+ if (!$monthlyInput.prop('checked')) {
|
|
|
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').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')
|
|
|
- }
|
|
|
- })
|
|
|
+ }
|
|
|
+ // 判断是点击的是+ 还是-
|
|
|
+ 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').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')
|
|
|
- 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=[];
|
|
|
- }
|
|
|
- {{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}},
|
|
|
+ $('#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 = [];
|
|
|
}
|
|
|
- $DoPost("/subscribepay/vipsubscribe/createOrder",param,function(r){
|
|
|
- if(r.success){
|
|
|
- clearSessionStorage();
|
|
|
- onBridgeReady(JSON.parse(r.data.res),r.data.code);
|
|
|
- }
|
|
|
- $("#payHandle").removeAttr("disabled")
|
|
|
- })
|
|
|
- {{else}}
|
|
|
+ {{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) {
|
|
|
+ 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}}
|
|
|
- })
|
|
|
-
|
|
|
- })
|
|
|
+ $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选择框
|
|
|
function hideDialog() {
|
|
|
$('#pay_way').hide(200);
|
|
|
$('#time_cycle').hide(200);
|
|
|
}
|
|
|
+
|
|
|
//是否可点击
|
|
|
- function checkOk(){
|
|
|
- var area = $(".info:eq(0)").val().trim();
|
|
|
- var industry = $(".info:eq(1)").val().trim();
|
|
|
- var checked = $('#buy').prop('checked');
|
|
|
- if (area != '' && industry != '' && checked == true) {
|
|
|
- $("#payHandle").removeAttr('disabled');
|
|
|
- } else {
|
|
|
- $("#payHandle").attr({
|
|
|
- 'disabled': 'true'
|
|
|
- });
|
|
|
- }
|
|
|
- sessionStorage.setItem("vipSub_read",checked)
|
|
|
- }
|
|
|
-
|
|
|
- function clearSessionStorage(){
|
|
|
- sessionStorage.removeItem("vipSubSelectArea");
|
|
|
- sessionStorage.removeItem("vipSubSelectIndustry");
|
|
|
- sessionStorage.removeItem("vipSubSelectTime");
|
|
|
- sessionStorage.removeItem("vipSub_read");
|
|
|
+ function checkOk() {
|
|
|
+ var area = $(".info:eq(0)").val().trim();
|
|
|
+ var industry = $(".info:eq(1)").val().trim();
|
|
|
+ var checked = $('#buy').prop('checked');
|
|
|
+ if (area != '' && industry != '' && checked == true) {
|
|
|
+ $("#payHandle").removeAttr('disabled');
|
|
|
+ } else {
|
|
|
+ $("#payHandle").attr({
|
|
|
+ 'disabled': 'true'
|
|
|
+ });
|
|
|
+ }
|
|
|
+ sessionStorage.setItem("vipSub_read", checked)
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
+ function clearSessionStorage() {
|
|
|
+ sessionStorage.removeItem("vipSubSelectArea");
|
|
|
+ sessionStorage.removeItem("vipSubSelectIndustry");
|
|
|
+ sessionStorage.removeItem("vipSubSelectTime");
|
|
|
+ sessionStorage.removeItem("vipSub_read");
|
|
|
+ }
|
|
|
+
|
|
|
</script>
|
|
|
- </div>
|
|
|
+ {{include "/common/weixin.html"}}
|
|
|
+</div>
|
|
|
</body>
|
|
|
|
|
|
</html>
|