wangkaiyue 5 жил өмнө
parent
commit
2c2be38bfc

+ 13 - 26
src/jfw/front/vipsubscribe.go

@@ -1,22 +1,19 @@
 package front
 
 import (
-	"log"
-	"qfw/util"
-
 	"github.com/go-xweb/xweb"
 )
 
 type Subscribepay struct {
 	*xweb.Action
-	introduce         xweb.Mapper `xweb:"/front/vipsubscribe/introducePage"`         //订阅收费介绍页
-	tailInfo          xweb.Mapper `xweb:"/front/vipsubscribe/tailInfo"`              //vip订阅服务-用户信息录入页面
-	toPurchasePage    xweb.Mapper `xweb:"/front/vipsubscribe/toPurchasePage"`        //订阅收费购买页面
-	toChooseArea      xweb.Mapper `xweb:"/front/vipsubscribe/toChooseArea/(.*)"`     //订阅收费地区筛选
-	toChooseIndustry  xweb.Mapper `xweb:"/front/vipsubscribe/toChooseIndustry/(.*)"` //订阅收费行业筛选
-	toPaySuccessPage  xweb.Mapper `xweb:"/front/vipsubscribe/toPaySuccessPage"`      //订阅支付完成页面
-	toOrderDetailPage xweb.Mapper `xweb:"/front/vipsubscribe/toOrderDetailPage"`     //订阅收费支付订单详情页面
-	toSetKeyWordPage  xweb.Mapper `xweb:"/front/vipsubscribe/toSetKeyWordPage"`      //订阅收费设置关键词
+	introduce         xweb.Mapper `xweb:"/front/vipsubscribe/introducePage"`     //订阅收费介绍页
+	tailInfo          xweb.Mapper `xweb:"/front/vipsubscribe/tailInfo"`          //vip订阅服务-用户信息录入页面
+	toPurchasePage    xweb.Mapper `xweb:"/front/vipsubscribe/toPurchasePage"`    //订阅收费购买页面
+	toChooseArea      xweb.Mapper `xweb:"/front/vipsubscribe/toChooseArea"`      //订阅收费地区筛选
+	toChooseIndustry  xweb.Mapper `xweb:"/front/vipsubscribe/toChooseIndustry"`  //订阅收费行业筛选
+	toPaySuccessPage  xweb.Mapper `xweb:"/front/vipsubscribe/toPaySuccessPage"`  //订阅支付完成页面
+	toOrderDetailPage xweb.Mapper `xweb:"/front/vipsubscribe/toOrderDetailPage"` //订阅收费支付订单详情页面
+	toSetKeyWordPage  xweb.Mapper `xweb:"/front/vipsubscribe/toSetKeyWordPage"`  //订阅收费设置关键词
 
 	//修改
 	toEditSubPage     xweb.Mapper `xweb:"/front/vipsubscribe/toEditSubPage"`     //订阅收费修改页面
@@ -44,7 +41,7 @@ func (s *Subscribepay) Introduce() {
 }
 
 //试用完善信息
-func (s *Subscribepay) TailInfo() error {
+func (s *Subscribepay) TailInfo() {
 	s.Render("/weixin/vipsubscribe/trial_info.html", &s.T)
 }
 
@@ -53,23 +50,13 @@ func (s *Subscribepay) ToPurchasePage() {
 	s.Render("/weixin/vipsubscribe/vip_purchase.html")
 }
 
-//订阅收费地区筛选(new:新订单;upgrade:升级)
-func (s *Subscribepay) ToChooseArea(sign string) {
-	if sign == "new" { //新订单
-
-	} else if sign == "upgrade" { //升级服务
-		s.T["hasCity"] = []string{"北京市", "上海市", "广州市"}
-	}
+//订阅收费地区筛选
+func (s *Subscribepay) ToChooseArea() {
 	s.Render("/weixin/vipsubscribe/choose_area.html", &s.T)
 }
 
-//订阅收费地区筛选(new:新订单;upgrade:升级)
-func (s *Subscribepay) ToChooseIndustry(sign string) {
-	if sign == "new" { //新订单
-
-	} else if sign == "upgrade" { //升级服务
-
-	}
+//订阅收费地区筛选
+func (s *Subscribepay) ToChooseIndustry() {
 	s.Render("/weixin/vipsubscribe/choose_industry.html", &s.T)
 }
 

+ 1 - 1
src/jfw/modules/subscribepay/src/a/init.go

@@ -22,6 +22,6 @@ func init() {
 	xweb.RootApp().Logger.SetOutputLevel(1) //输出日志,改为4则不输出任何日志
 	//
 	xweb.AddAction(&service.Test{})
-	//xweb.AddAction(&service.Public{})
 	xweb.AddAction(&service.Trial{})
+	xweb.AddAction(&service.Order{})
 }

+ 4 - 8
src/jfw/modules/subscribepay/src/service/trial.go

@@ -17,14 +17,10 @@ import (
 //试用用户接口
 type Trial struct {
 	*xweb.Action
-	getUserPhone     xweb.Mapper `xweb:"/subscribepay/trial/GetUserPhone"`     //获取用户手机号码
-	captcha          xweb.Mapper `xweb:"/subscribepay/trial/captcha"`          //图形验证码
-	sendPhoneCaptcha xweb.Mapper `xweb:"/subscribepay/trial/sendPhoneCaptcha"` //发送手机验证码
-	submitApply      xweb.Mapper `xweb:"/subscribepay/trial/submitApply"`      //提交申请信息
-}
-
-func init() {
-	xweb.AddAction(&Trial{})
+	getUserPhone     xweb.Mapper `xweb:"/trial/GetUserPhone"`     //获取用户手机号码
+	captcha          xweb.Mapper `xweb:"/trial/captcha"`          //图形验证码
+	sendPhoneCaptcha xweb.Mapper `xweb:"/trial/sendPhoneCaptcha"` //发送手机验证码
+	submitApply      xweb.Mapper `xweb:"/trial/submitApply"`      //提交申请信息
 }
 
 var (

+ 264 - 267
src/web/templates/weixin/vipsubscribe/choose_area.html

@@ -385,202 +385,217 @@
     <script src="/vipsubscribe/js/fastclick.js?v={{Msg "seo" "version"}}"></script>
     <script src="/vipsubscribe/js/mapJSON.js?v={{Msg "seo" "version"}}"></script>
     <script>
-        var hasCity = []; //定义已购买的城市数组
-        var saveObj ;//数据
-        // 获取url传参
-        function getParam(name) {
-            var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
-            var r = window.location.search.substr(1).match(reg); //获取url中"?"符后的字符串并正则匹配
-            var context = "";
-            if (r != null)
-                context = r[2];
-            reg = null;
-            r = null;
-            return context == null || context == "" || context == "undefined" ? "" : context;
-        }
-
-        function createMoreCity(arr) {
-            var tempHtml = arr.map(function (v) {
-                // v.name.replace(/市$/g, '')
-                return '<button class="city">' + v.name + '</button>'
-            }).join('')
-            return tempHtml
-        }
-
-        function isAllSelected() {
-            var _f = true
-            $($('.tab_content .city')).each(function (index, dom) {
-                // 如果有所有被选中,就设置标记为true
-                // 有一个没被选中,就设置标记为false
-                if ($(dom).hasClass('active')) {
-                    _f = false
-                    $('.other').prop('checked', false);
-                }
-            })
-            // 如果循环结束仍为true说明 没有全部都被选中
-            if (_f) {
-                $('.other').prop('checked', true);
+      var AreaChoose={
+        selectObj:{},//已选择,未购买城市;
+        inintData:function(){ //初始化selectObj
+          //已选择
+          try{
+            let select =sessionStorage.getItem("vipSubSelectArea");
+            if(select){
+              this.selectObj=JSON.parse(select);
             }
-        }
-        /* 判断已购买的城市 在不在 全部城市里面,在,将按钮置灰,不可点击 */
-        function hasBuyCity() {
-            hasCity.forEach(v => {
-                $($('.tab_content .city')).each(function (index, dom) {
-                    if (v == $(dom).text()) {
-                        $(".checkbox .other").attr("checked", false); //取消全国选中
-                        $(dom).addClass('active').attr('disabled', true).parents().siblings('.tab')
-                            .addClass('selected').children('.province').children('input').attr({
-                                'disabled': true,
-                                "checked": true
-                            })
-                    }
+          }catch(e){
+            console.log(e);
+            this.selectObj={};
+          }
+          console.log(this.selectObj)
+        },
+        inintPage:function(){//初始化省份城市选项   
+          $(".select-area-box ul li:not('.index')").each(function () {
+                var text = $(this).find(".province").text().trim()
+                var data = null
+                chinaMapJSON.some(function (v) {
+                    data = v
+                    return v.name.indexOf(text) !== -1
                 })
+                var box = $(this).find('div.tab_content')
+                var html = AreaChoose.createMoreCity(data.city)
+                box.html(html)
             })
-        }
-        /* 判断有无购买过的城市,无购买或首次进入默认选中全国 */
-        function getNationwide() {
-            console.log(hasCity.length)
-            if (hasCity.length == 0) {
-                $('.other').prop('checked', true);
-                $('.tab_content').slideUp(500)
-                $('.tab span i').css({
-                    "display":"inline-block",
-                    "transform":"rotate(0)"
-                })
-                getResult() 
+        },
+        createMoreCity:function(arr){
+          var tempHtml = arr.map(function (v) {
+                return '<button class="city">' + v.name + '</button>'
+            }).join('')
+            return tempHtml
+        },
+        showSelected:function(canClick){ //回显已选择
+          let ran = this.selectObj;
+          for(var province in ran) {
+            let citys=ran[province]
+            if(citys.length>0){//地市
+              this.selectCity(citys,canClick)
+            }else{//省份
+              this.selectProvince(province,canClick)
             }
-        }
-        /* 选中结果 */
-        function getResult() {
-            saveObj = {};
-            $('.result_name').empty()
-            var data = []; //定义一个总数组
-            var cityArr =[]; //定义一个选中城市数组
-            var val = $('.other').parents('.province').text().trim();
-            if ($('.other').is(':checked')) {
-                // data.push(val)
-                data =[{name:val,children:[]}] //全国
+          }
+        },
+        selectProvince:function(province,canClick){ //设置选中省份 province 省份
+          $($('.tab .province')).each(function (index, dom) {
+            if (province == $.trim($(dom).text())) {
+              if(province!="全国") $(".checkbox.other").attr("checked", false); //取消全国选中
+              $(dom).children('.checkbox').attr({"checked": true,"disabled":!canClick});//选中此省份
+              $(dom).parents().siblings('.tab_content').find(".city").addClass("active").attr({"disabled":!canClick});
             }
-            
-            $(".tab_content").find(".city.active:not('[disabled]')").each(function () {
-                var length = $(this).parent('.tab_content').find('.city').length; //省份下城市的length
-                var activeLeng = $(this).parent('.tab_content').find('.city.active').length; //省份下选中城市的length
-                let arr =[];
-                // 判断省份下的城市是否等于选中的城市长度,相等就是全部选中
-                if (length == activeLeng) {
-                    $('.tips_btn .tips_d_text').hide()
-                    // data.push($(this).parent('.tab_content').siblings('.tab:not(.whole)').children('.province').text().trim())
-                    let province = $(this).parent('.tab_content').siblings('.tab:not(.whole)').children('.province').text().trim();
-                    data.push({
-                        name:province,
-                        children:[]
-                    })
-                } else {
-                    // data.push($(this).parent('.tab_content').siblings('.tab:not(.whole)').children('.province').text().trim())
-                    // data.push($(this).html())
-                    // console.log($(this).parent('.tab_content').find('.city.active').text().trim())
-                    
-                    let province = $(this).parent('.tab_content').siblings('.tab:not(.whole)').children('.province').text().trim();
-                    let city = $(this).html()
-                    arr.push({name:city,parent:province})
-                    for(let i =0;i<arr.length;i++){
-                        let obj ={};
-                        obj.name = arr[i].name;
-                        obj.parent = arr[i].parent;
-                        cityArr.push(obj)
-                    }
-                    data.push({
-                        name:province,
-                        children:cityArr
-                    })
-                }
-            })
-            //数组对象去重
-            let obj = {};
-            data = data.reduce((cur,next) =>{
-                obj[next.name] ? "" : obj[next.name] = true && cur.push(next);
-                return cur
-            },[]) 
-            // 数组筛选
-            let result = data.map(v =>{
-            // result = data.map(v =>{
-                let filterArr = v.children.filter(s =>{
-                   return s.parent === v.name
-                })
-                return {
-                    name:v.name,
-                    children:filterArr
+          })
+        },
+        selectCity:function(citys,canClick){ //设置选中城市
+          citys.forEach(v => {
+            $($('.tab_content .city')).each(function (index, dom) {
+                if (v == $(dom).text()) {
+                    $(".checkbox.other").attr("checked", false); //取消全国选中
+                    $(dom).addClass('active').attr('disabled', !canClick).parents().siblings('.tab')
+                        .addClass('selected').children('.province').children('.checkbox').attr({
+                            "checked": true
+                        })
                 }
             })
-            //console.log("rrr",result)
-            var html = '';
-            for (var i = 0; i < result.length; i++) {
-                let children = result[i].children;
-                if( children.length >0){
-                    // 判断每个省份下选中的城市长度,当大于等于4的时候 弹出"选择全省更划算的弹窗"
-                    let childrenArr=[];
-                    if (children.length >= 4) {
-                        $('.tips_btn .tips_d_text').show()
-                    } 
-                    html += `${result[i].name}(`
-                    for(var j = 0;j < children.length;j++){
-                        childrenArr.push(children[j].name)
-                        if (j != children.length - 1) {
-                            html += `${children[j].name}、`
-                        } else {
-                            html += `${children[j].name}`
-                        }
-                    }
-                    if(i !=result.length -1){
-                        html += `)、`
-                    }else{
-                        html += `)`
-                    }
-                    saveObj[result[i].name]=childrenArr.toString();//
-                }else{
-                    if(i !=result.length -1){
-                        html += `${result[i].name}、`
-                    }else{
-                        html += `${result[i].name}`
-                    }
-                    saveObj[result[i].name]="";//
-                }
-            }
-            console.log("saveObj--",saveObj)
-            $('.result_name').append(html)
-            isOpen()
-            
-        }
-        // 判断选中结果是展开还是收起
-        function isOpen(){
-            let pHeight = $('.result_text').height()
-            let minHeight = $('.result_text').css('min-height')
-            let rows = Math.round(Math.round(pHeight)/ parseFloat(minHeight));
-            console.log("高度:"+ pHeight,"最小高度"+ minHeight,"行数:" + rows)
-            if(rows == 1){
-                $('.packup').hide()
-                $('.detail').hide()
-            }else if(rows == 2){
-                // $('.result_text').addClass('line_two')
-                console.log($('.result_name').html().trim().length)
-                let length = $('.result_name').html().trim().length;
-                if(length >= 50){
-                    $('.detail').show()
-                    $('.packup').hide()
-                }else{
-                    $('.detail').hide()
-                    $('.packup').hide()
-                }
-                
-            } else{
-                $('.packup').show()
-                $('.detail').hide()
-            }
-        }
-        $(function () {
-            isOpen()
-            // 展开收起事件
-            $('.detail').click(function () {  
+          })
+        },
+        getResult:function(){   /* 选中结果 */
+          this.selectObj = {};
+          $('.result_name').empty()
+          var data = []; //定义一个总数组
+          var cityArr =[]; //定义一个选中城市数组
+          var val = $('.other').parents('.province').text().trim();
+          if ($('.other').is(':checked')) {
+            // data.push(val)
+            data =[{name:val,children:[]}] //全国
+          }
+          $(".tab_content").find(".city.active:not('[disabled]')").each(function () {
+              var length = $(this).parent('.tab_content').find('.city').length; //省份下城市的length
+              var activeLeng = $(this).parent('.tab_content').find('.city.active').length; //省份下选中城市的length
+              let arr =[];
+              // 判断省份下的城市是否等于选中的城市长度,相等就是全部选中
+              if (length == activeLeng) {
+                  $('.tips_btn .tips_d_text').hide()
+                  // data.push($(this).parent('.tab_content').siblings('.tab:not(.whole)').children('.province').text().trim())
+                  let province = $(this).parent('.tab_content').siblings('.tab:not(.whole)').children('.province').text().trim();
+                  data.push({
+                      name:province,
+                      children:[]
+                  })
+              } else { 
+                  let province = $(this).parent('.tab_content').siblings('.tab:not(.whole)').children('.province').text().trim();
+                  let city = $(this).html()
+                  arr.push({name:city,parent:province})
+                  for(let i =0;i<arr.length;i++){
+                      let obj ={};
+                      obj.name = arr[i].name;
+                      obj.parent = arr[i].parent;
+                      cityArr.push(obj)
+                  }
+                  data.push({
+                      name:province,
+                      children:cityArr
+                  })
+              }
+          })
+          //数组对象去重
+          let obj = {};
+          data = data.reduce((cur,next) =>{
+              obj[next.name] ? "" : obj[next.name] = true && cur.push(next);
+              return cur
+          },[]) 
+          // 数组筛选
+          let result = data.map(v =>{
+              let filterArr = v.children.filter(s =>{
+                 return s.parent === v.name
+              })
+              return {
+                  name:v.name,
+                  children:filterArr
+              }
+          })
+          var html = '';
+          for (var i = 0; i < result.length; i++) {
+              let children = result[i].children;
+              if( children.length >0){
+                  // 判断每个省份下选中的城市长度,当大于等于4的时候 弹出"选择全省更划算的弹窗"
+                  let childrenArr=[];
+                  if (children.length >= 4) {
+                      $('.tips_btn .tips_d_text').show()
+                  } 
+                  html += `${result[i].name}(`
+                  for(var j = 0;j < children.length;j++){
+                      childrenArr.push(children[j].name)
+                      if (j != children.length - 1) {
+                          html += `${children[j].name}、`
+                      } else {
+                          html += `${children[j].name}`
+                      }
+                  }
+                  if(i !=result.length -1){
+                      html += `)、`
+                  }else{
+                      html += `)`
+                  }
+                  this.selectObj[result[i].name]=childrenArr;//
+              }else{
+                  if(i !=result.length -1){
+                      html += `${result[i].name}、`
+                  }else{
+                      html += `${result[i].name}`
+                  }
+                  this.selectObj[result[i].name]=[];//
+              }
+          }
+          console.log("this.selectObj:",this.selectObj)
+          $('.result_name').append(html)
+          AreaChoose.isOpen()
+        },
+        submitArea:function(){
+          let addCity = $('.result_name').text(); //新增的城市
+          sessionStorage.setItem("vipSubSelectArea",JSON.stringify(AreaChoose.selectObj));
+          history.go(-1);
+        },
+        isAllSelected:function(){
+          var _f = true
+          $($('.tab_content .city')).each(function (index, dom) {
+              if ($(dom).hasClass('active')) {
+                  _f = false
+                  $('.other').prop('checked', false);
+              }
+          })
+          // 如果循环结束仍为true说明 没有全部都被选中
+          if (_f) {
+              $('.other').prop('checked', true);
+          }
+        },
+        getNationwide:function(){/*默认选中全国 */
+          $('.other').prop('checked', true);
+          $('.tab_content').slideUp(500)
+          $('.tab span i').css({
+              "display":"inline-block",
+              "transform":"rotate(0)"
+          });
+        },
+        isOpen:function(){
+          let pHeight = $('.result_text').height()
+          let minHeight = $('.result_text').css('min-height')
+          let rows = Math.round(Math.round(pHeight)/ parseFloat(minHeight));
+          console.log("高度:"+ pHeight,"最小高度"+ minHeight,"行数:" + rows)
+          if(rows == 1){
+              $('.packup').hide()
+              $('.detail').hide()
+          }else if(rows == 2){
+              console.log($('.result_name').html().trim().length)
+              let length = $('.result_name').html().trim().length;
+              if(length >= 50){
+                  $('.detail').show()
+                  $('.packup').hide()
+              }else{
+                  $('.detail').hide()
+                  $('.packup').hide()
+              }
+              
+          } else{
+              $('.packup').show()
+              $('.detail').hide()
+          }
+        },
+        inintClick:function(){
+          $('.detail').click(function () {  
                 $('.result_text').removeClass('line_two')
                 $(".result").css("padding-bottom","0.3rem")
                 $(this).hide();
@@ -599,32 +614,7 @@
                 }
                 document.querySelector('#' + s).scrollIntoView({block:'center'});
             })
-
-            //取上个页面url参数,中文解码)
-            let strCity = decodeURIComponent(getParam('city'))
-            // console.log(strCity)
-            // 判断有无购买过的区域城市
-            if (strCity) {
-                //将已购买过的城市,由字符串转数组
-                hasCity = decodeURIComponent(getParam('city')).split('、');
-                console.log(hasCity)
-            }
-            $(".select-area-box ul li:not('.index')").each(function () {
-                var text = $(this).find(".province").text().trim()
-                var data = null
-                chinaMapJSON.some(function (v) {
-                    data = v
-                    return v.name.indexOf(text) !== -1
-                })
-                var box = $(this).find('div.tab_content')
-                var html = createMoreCity(data.city)
-                box.html(html)
-            })
-
-            //用户首次购买 默认选中全国 
-            getNationwide();
-            
-            $(".select-area-box .tab:not(.municipality)").on('click', function (event) {
+          $(".select-area-box .tab:not(.municipality)").on('click', function (event) {
                 if($(this).next('.tab_content:not(:animated)').css("display") == "block"){
                     $(this).children().children('i').css({
                         "display":"inline-block",
@@ -637,89 +627,96 @@
                     })
                 }
                 $(this).toggleClass('selected').next('.tab_content:not(:animated)').stop(true, true).slideToggle()
-                // $(this).parent().siblings().children('.tab_content').slideUp(500)
                 $(this).parent().siblings().children('.tab').removeClass('selected');
                 
             })
+            $('.checkbox').click(function (e) {  
+                e.stopPropagation();
+            })
             $('.province .checkbox:not(.other)').on('change', function () {
-                hasBuyCity();
+                //AreaChoose.showSelected(false);
                 var isCheckded = $(this).is(':checked')
                 if (isCheckded) {
                     $(this).parents('.tab').siblings('.tab_content').find('.city').addClass(
                         'active')
-                    isAllSelected()
-                    getResult() 
+                    AreaChoose.isAllSelected()
+                    AreaChoose.getResult() 
                 } else {
                     $(this).parents('.tab').siblings('.tab_content').find('.city').removeClass(
                         'active')
-                    isAllSelected()
-                    getResult() 
+                    $(this).parents('.tab').siblings('.tab_content').find('.city').attr('disabled',false);    
+                    AreaChoose.isAllSelected()
+                    AreaChoose.getResult() 
                 }
             })
 
-            /* 判断已购买的城市 在不在 全部城市里面,在,将按钮置灰,不可点击 */
-            hasBuyCity(); 
             //执行已购买城市函操作dom函数
             $('.tab_content').on('click', '.city', function () {
-                hasBuyCity()
+                //AreaChoose.showSelected(false)
                 $(this).toggleClass('active')
                 var isActive = $(this).parent().find('.city.active').length
                 if (isActive) {
                     var input = $(this).parents('li').find('input.checkbox')
                     window.input = input
                     input.prop('checked', true)
-                    isAllSelected()
-                    getResult() 
+                    AreaChoose.isAllSelected()
+                    AreaChoose.getResult() 
                 } else {
                     $(this).parent('div').siblings('.tab').children().children('.checkbox').prop(
                         'checked', false)
-                    isAllSelected()
-                    getResult() 
+                    AreaChoose.isAllSelected()
+                    AreaChoose.getResult() 
                 }
             })
-            /* 用户选择全国*/
-            $('.other').on('change', function () {
-                var checked = $(this).is(':checked');
-                if (checked) {
-                    $('.tab_content').slideUp(500)
-                    $('.tab span i').css({
-                        "display":"inline-block",
-                        "transform":"rotate(0)"
-                    })
-                    $('.tab:not(.whole)').removeClass('selected').children('.province').find(
-                        'input').prop({
-                        'checked': false,
-                        "disabled": false
-                    });
-                    $('.tab_content').find('.city').removeClass('active').attr({
-                        "disabled": false,
-                        "checked": false
-                    })
-                    getResult() 
-                }else{
-                    getResult() 
-                }
+
+            $('.other').on('change', function () { //选择全国
+              AreaChoose.reset();
             })
 
-            $('.save-btn').click(function () {
-                // 提交
-                let addCity = $('.result_name').text(); //新增的城市
-                let oldCity = decodeURIComponent(getParam('city'));
-                console.log(`新增城市:${addCity} ----- 已购买过的城市:${oldCity}`)
-                
-                localStorage.setItem("vipsubscribeArea",JSON.stringify(saveObj));
-                history.go(-1);
+            $('.save-btn').click(function () {  // 提交
+                AreaChoose.submitArea();              
             })
-            $('.reset-btn').click(function () {
-                hasBuyCity();
-                $('.tips_d_text').hide(200)
-                $('input[type="checkbox"]:not("[disabled]")').attr("checked", false)
-                $('.tab_content .city:not("[disabled]")').removeClass('active')
-                $('.result_name').empty()
-                getNationwide();
-                
-                // $('.result_name').html(decodeURIComponent(getParam('city')));  //重置已购买过的城市
+            $('.reset-btn').click(function () {  //重置
+              if(!$(".other").is(':checked')){
+                $(".other").trigger("click");
+              }
             })
+        },
+        reset:function(){
+           var checked = $(".other").is(':checked');
+            if (checked) {
+                $('.tab_content').slideUp(500)
+                $('.tab span i').css({
+                    "display":"inline-block",
+                    "transform":"rotate(0)"
+                })
+                $('.tab:not(.whole)').removeClass('selected').children('.province').find(
+                    'input').prop({
+                    'checked': false,
+                    "disabled": false
+                });
+                $('.tab_content').find('.city').removeClass('active').attr({
+                    "disabled": false,
+                    "checked": false
+                })
+                AreaChoose.getResult() 
+            }else{
+                AreaChoose.getResult() 
+            }
+        }
+      }
+      
+      $(function () {
+            AreaChoose.isOpen()
+            AreaChoose.inintData(); //初始化 已选择和已购买数据
+            AreaChoose.inintPage(); //初始化城市数据
+
+            AreaChoose.getNationwide();//默认选中全国 
+            AreaChoose.showSelected(true);//回显已选择
+            /* 判断已购买的城市 在不在 全部城市里面,在,将按钮置灰,不可点击 */
+
+            AreaChoose.getResult();
+            AreaChoose.inintClick();
         })
     </script>
 </body>

+ 122 - 193
src/web/templates/weixin/vipsubscribe/choose_industry.html

@@ -24,7 +24,7 @@
                         <li class="list_item" id="all">
                             <div class="item_label"></div>
                             <div class="item_industry_list">
-                                <button class="industry_item">全部行业</button>
+                                <button class="industry_item active">全部行业</button>
                             </div>
                         </li>
                         <li class="list_item" id="A">
@@ -43,240 +43,163 @@
                             <div class="item_label">C</div>
                             <div class="item_industry_list">
                                 <button class="industry_item">财政</button>
-                                <button class="industry_item">出版广电</button>
                                 <button class="industry_item">传媒</button>
                                 <button class="industry_item">城管</button>
                                 <button class="industry_item">采矿业</button>
+                                <button class="industry_item">出版广电</button>
                             </div>
                         </li>
                         <li class="list_item" id="D">
                             <div class="item_label">D</div>
                             <div class="item_industry_list">
-                                <button class="industry_item">电力</button>
-                                <button class="industry_item">广电</button>
-                                <button class="industry_item">传媒</button>
-                                <button class="industry_item">城管</button>
-                                <button class="industry_item">采矿业</button>
-                            </div>
-                        </li>
-                        <li class="list_item" id="E">
-                            <div class="item_label">E</div>
-                            <div class="item_industry_list">
-                                <button class="industry_item">电力</button>
-                                <button class="industry_item">广电</button>
-                                <button class="industry_item">传媒</button>
-                                <button class="industry_item">城管</button>
-                                <button class="industry_item">采矿业</button>
+                                <button class="industry_item">档案</button>
+                                <button class="industry_item">地震</button>
+                                <button class="industry_item">党委办</button>
+                                <button class="industry_item">电信行业</button>
                             </div>
                         </li>
                         <li class="list_item" id="F">
                             <div class="item_label">F</div>
                             <div class="item_industry_list">
-                                <button class="industry_item">电力</button>
-                                <button class="industry_item">广电</button>
-                                <button class="industry_item">传媒</button>
-                                <button class="industry_item">城管</button>
-                                <button class="industry_item">采矿业</button>
+                                <button class="industry_item">法院</button>
+                                <button class="industry_item">发改</button>
                             </div>
                         </li>
                         <li class="list_item" id="G">
                             <div class="item_label">G</div>
                             <div class="item_industry_list">
-                                <button class="industry_item">电力</button>
-                                <button class="industry_item">广电</button>
-                                <button class="industry_item">传媒</button>
-                                <button class="industry_item">城管</button>
-                                <button class="industry_item">采矿业</button>
+                                <button class="industry_item">工商</button>
+                                <button class="industry_item">工信</button>
+                                <button class="industry_item">国土</button>
+                                <button class="industry_item">公安</button>
+                                <button class="industry_item">国资委</button>
+                                <button class="industry_item">公共资源交易</button>
                             </div>
                         </li>
                         <li class="list_item" id="H">
                             <div class="item_label">H</div>
                             <div class="item_industry_list">
-                                <button class="industry_item">电力</button>
-                                <button class="industry_item">广电</button>
-                                <button class="industry_item">传媒</button>
-                                <button class="industry_item">城管</button>
-                                <button class="industry_item">采矿业</button>
-                            </div>
-                        </li>
-                        <li class="list_item" id="I">
-                            <div class="item_label">I</div>
-                            <div class="item_industry_list">
-                                <button class="industry_item">电力</button>
-                                <button class="industry_item">广电</button>
-                                <button class="industry_item">传媒</button>
-                                <button class="industry_item">城管</button>
-                                <button class="industry_item">采矿业</button>
+                                <button class="industry_item">环保</button>
+                                <button class="industry_item">海关</button>
                             </div>
                         </li>
                         <li class="list_item" id="J">
                             <div class="item_label">J</div>
                             <div class="item_industry_list">
-                                <button class="industry_item">电力</button>
-                                <button class="industry_item">广电</button>
-                                <button class="industry_item">传媒</button>
-                                <button class="industry_item">城管</button>
-                                <button class="industry_item">采矿业</button>
+                                <button class="industry_item">教育</button>
+                                <button class="industry_item">军队</button>
+                                <button class="industry_item">交通</button>
+                                <button class="industry_item">纪委</button>
+                                <button class="industry_item">金融业</button>
+                                <button class="industry_item">建筑业</button>
+                                <button class="industry_item">检察院</button>
+                                <button class="industry_item">机关事务</button>
                             </div>
                         </li>
                         <li class="list_item"  id="K">
                             <div class="item_label">K</div>
                             <div class="item_industry_list">
-                                <button class="industry_item">电力</button>
-                                <button class="industry_item">广电</button>
-                                <button class="industry_item">传媒</button>
-                                <button class="industry_item">城管</button>
-                                <button class="industry_item">采矿业</button>
+                                <button class="industry_item">科技</button>
                             </div>
                         </li>
                         <li class="list_item" id="L">
                             <div class="item_label">L</div>
                             <div class="item_industry_list">
-                                <button class="industry_item">电力</button>
-                                <button class="industry_item">广电</button>
-                                <button class="industry_item">传媒</button>
-                                <button class="industry_item">城管</button>
-                                <button class="industry_item">采矿业</button>
+                                <button class="industry_item">林业</button>
+                                <button class="industry_item">旅游</button>
                             </div>
                         </li>
                         <li class="list_item" id="M">
                             <div class="item_label">M</div>
                             <div class="item_industry_list">
-                                <button class="industry_item">电力</button>
-                                <button class="industry_item">广电</button>
-                                <button class="industry_item">传媒</button>
-                                <button class="industry_item">城管</button>
-                                <button class="industry_item">采矿业</button>
+                                <button class="industry_item">民政</button>
+                                <button class="industry_item">民宗</button>
                             </div>
                         </li>
                         <li class="list_item" id="N">
                             <div class="item_label">N</div>
                             <div class="item_industry_list">
-                                <button class="industry_item">电力</button>
-                                <button class="industry_item">广电</button>
-                                <button class="industry_item">传媒</button>
-                                <button class="industry_item">城管</button>
-                                <button class="industry_item">采矿业</button>
-                            </div>
-                        </li>
-                        <li class="list_item" id="O">
-                            <div class="item_label">O</div>
-                            <div class="item_industry_list">
-                                <button class="industry_item">电力</button>
-                                <button class="industry_item">广电</button>
-                                <button class="industry_item">传媒</button>
-                                <button class="industry_item">城管</button>
-                                <button class="industry_item">采矿业</button>
+                                <button class="industry_item">农业</button>
+                                <button class="industry_item">能源化工</button>
+                                <button class="industry_item">农林牧渔</button>
                             </div>
                         </li>
                         <li class="list_item" id="P">
                             <div class="item_label">P</div>
                             <div class="item_industry_list">
-                                <button class="industry_item">电力</button>
-                                <button class="industry_item">广电</button>
-                                <button class="industry_item">传媒</button>
-                                <button class="industry_item">城管</button>
-                                <button class="industry_item">采矿业</button>
+                                <button class="industry_item">批发零售</button>
                             </div>
                         </li>
                         <li class="list_item" id="Q">
                             <div class="item_label">Q</div>
                             <div class="item_industry_list">
-                                <button class="industry_item">电力</button>
-                                <button class="industry_item">广电</button>
-                                <button class="industry_item">传媒</button>
-                                <button class="industry_item">城管</button>
-                                <button class="industry_item">采矿业</button>
+                                <button class="industry_item">气象</button>
                             </div>
                         </li>
                         <li class="list_item" id="R">
                             <div class="item_label">R</div>
                             <div class="item_industry_list">
-                                <button class="industry_item">电力</button>
-                                <button class="industry_item">广电</button>
-                                <button class="industry_item">传媒</button>
-                                <button class="industry_item">城管</button>
-                                <button class="industry_item">采矿业</button>
+                                <button class="industry_item">人行</button>
+                                <button class="industry_item">人社</button>
+                                <button class="industry_item">人大</button>
                             </div>
                         </li>
                         <li class="list_item" id="S">
                             <div class="item_label">S</div>
                             <div class="item_industry_list">
-                                <button class="industry_item">电力</button>
-                                <button class="industry_item">广电</button>
-                                <button class="industry_item">传媒</button>
-                                <button class="industry_item">城管</button>
-                                <button class="industry_item">采矿业</button>
+                                <button class="industry_item">食药</button>
+                                <button class="industry_item">税务</button>
+                                <button class="industry_item">水利</button>
+                                <button class="industry_item">市政</button>
+                                <button class="industry_item">审计</button>
+                                <button class="industry_item">商务</button>
+                                <button class="industry_item">司法</button>
+                                <button class="industry_item">社会团体</button>
                             </div>
                         </li>
                         <li class="list_item" id="T">
                             <div class="item_label">T</div>
                             <div class="item_industry_list">
-                                <button class="industry_item">电力</button>
-                                <button class="industry_item">广电</button>
-                                <button class="industry_item">传媒</button>
-                                <button class="industry_item">城管</button>
-                                <button class="industry_item">采矿业</button>
-                            </div>
-                        </li>
-                        <li class="list_item" id="U">
-                            <div class="item_label">U</div>
-                            <div class="item_industry_list">
-                                <button class="industry_item">电力</button>
-                                <button class="industry_item">广电</button>
-                                <button class="industry_item">传媒</button>
-                                <button class="industry_item">城管</button>
-                                <button class="industry_item">采矿业</button>
+                                <button class="industry_item">统计</button>
+                                <button class="industry_item">统战</button>
+                                <button class="industry_item">体育</button>
                             </div>
-                        </li>
-                        <li class="list_item" id="V">
-                            <div class="item_label">V</div>
-                            <div class="item_industry_list">
-                                <button class="industry_item">电力</button>
-                                <button class="industry_item">广电</button>
-                                <button class="industry_item">传媒</button>
-                                <button class="industry_item">城管</button>
-                                <button class="industry_item">采矿业</button>
-                            </div>
-                        </li>
+                        </li>                    
                         <li class="list_item" id="W">
                             <div class="item_label">W</div>
                             <div class="item_industry_list">
-                                <button class="industry_item">电力</button>
-                                <button class="industry_item">广电</button>
-                                <button class="industry_item">传媒</button>
-                                <button class="industry_item">城管</button>
-                                <button class="industry_item">采矿业</button>
+                                <button class="industry_item">文化</button>
+                                <button class="industry_item">卫生</button>
                             </div>
                         </li>
                         <li class="list_item" id="X">
                             <div class="item_label">X</div>
                             <div class="item_industry_list">
-                                <button class="industry_item">电力</button>
-                                <button class="industry_item">广电</button>
-                                <button class="industry_item">传媒</button>
-                                <button class="industry_item">城管</button>
-                                <button class="industry_item">采矿业</button>
+                                <button class="industry_item">学校</button>
+                                <button class="industry_item">宣传</button>
+                                <button class="industry_item">信息技术</button>
                             </div>
                         </li>
                         <li class="list_item" id="Y">
                             <div class="item_label">Y</div>
                             <div class="item_industry_list">
-                                <button class="industry_item">电力</button>
-                                <button class="industry_item">广电</button>
-                                <button class="industry_item">传媒</button>
-                                <button class="industry_item">城管</button>
-                                <button class="industry_item">采矿业</button>
+                                <button class="industry_item">医疗</button>
+                                <button class="industry_item">银监</button>
+                                <button class="industry_item">运输物流</button>
                             </div>
                         </li>
                         <li class="list_item" id="Z">
                             <div class="item_label">Z</div>
                             <div class="item_industry_list">
-                                <button class="industry_item">电力</button>
-                                <button class="industry_item">广电</button>
-                                <button class="industry_item">传媒</button>
-                                <button class="industry_item">城管</button>
-                                <button class="industry_item">采矿业</button>
+                                <button class="industry_item">质监</button>
+                                <button class="industry_item">组织</button>
+                                <button class="industry_item">政协</button>
+                                <button class="industry_item">住建</button>
+                                <button class="industry_item">证监</button>
+                                <button class="industry_item">政府办</button>
+                                <button class="industry_item">制造业</button>
+                                <button class="industry_item">政务中心</button>
+                                <button class="industry_item">住宿餐饮</button>
                             </div>
                         </li>
                     </ul>
@@ -288,33 +211,24 @@
                 <a href="javascript:;">B</a>
                 <a href="javascript:;">C</a>
                 <a href="javascript:;">D</a>
-                <a href="javascript:;">E</a>
                 <a href="javascript:;">F</a>
                 <a href="javascript:;">G</a>
                 <a href="javascript:;">H</a>
-                <a href="javascript:;">I</a>
                 <a href="javascript:;">J</a>
                 <a href="javascript:;">K</a>
                 <a href="javascript:;">L</a>
                 <a href="javascript:;">M</a>
                 <a href="javascript:;">N</a>
-                <a href="javascript:;">O</a>
                 <a href="javascript:;">P</a>
                 <a href="javascript:;">Q</a>
                 <a href="javascript:;">R</a>
                 <a href="javascript:;">S</a>
                 <a href="javascript:;">T</a>
-                <a href="javascript:;">U</a>
-                <a href="javascript:;">V</a>
                 <a href="javascript:;">W</a>
                 <a href="javascript:;">X</a>
                 <a href="javascript:;">Y</a>
                 <a href="javascript:;">Z</a>
             </div>
-            <!-- <div class="bottom_button">
-                <button class="reset-btn left_btn" disabled>重置</button>
-                <button class="save-btn right_btn" disabled>确认</button>
-            </div> -->
             <div class="tips_btn">
                 <div class="tips_discount">
                     <div class="tips_d_money" style="display: block">&yen;38</div>
@@ -330,7 +244,8 @@
         <script src="/vipsubscribe/js/fastclick.js?v={{Msg "seo" "version"}}"></script>
         <script src="/vipsubscribe/js/weui.min.js?v={{Msg "seo" "version"}}"></script>
         <script>
-            // 点击导航跳转
+              
+           // 点击导航跳转
             $("body").on('click','.slide a',function(){
                 var s = $(this).html()
                 if(s == '#'){
@@ -338,18 +253,7 @@
                 }
                 document.querySelector('#' + s).scrollIntoView({block:'center'});
             })
-            // 是否选中全国
-            function checkedAll(){
-                // 判断全部行业以外有没有被选中
-                $('.list_item:not(#all)').each(function () { 
-                    let isActive = $(this).children().children('button').hasClass('active')
-                    if(!isActive){
-                        $('#all').children().children('button').addClass('active')
-                    }else{
-                        $('#all').children().children('button').removeClass('active')
-                    }
-                })
-            }
+            
             // 在续订里,要保存已经选中的数组并置灰,按需要拼接上选中的行业数组
 
             // button一共有以下几个操作属性
@@ -366,6 +270,15 @@
             //     { name: '电力', disabled: true },
             //     { name: '采矿业', disabled: true }
             // ]
+            /* 
+            插入行业
+            var insertArr = [
+                { name: '医疗1', disabled: true },
+                { name: '医疗2', disabled: false },
+                { name: '医疗3', disabled: true }
+            ]
+            insertIndustryItem('E', insertArr)
+            */
             function insertIndustryItem (letter, industryArr = []) {
                 if (!letter) return
                 var query = `#${letter[0].toUpperCase()} .item_industry_list`
@@ -377,24 +290,16 @@
                 }
                 industryItemContainer.html(buttonArr.join(''))
             }
-            // 例子
-            var insertArr = [
-                { name: '医疗1', disabled: true },
-                { name: '医疗2', disabled: false },
-                { name: '医疗3', disabled: true }
-            ]
-            insertIndustryItem('E', insertArr)
-
-
-            // 选中行业在已选择提示中显示
-            var selectedIndustryArr = null
+            
             function findSelectedIndustry () {
                 var buttons = $('.select-area-box .list button')
                 // 找到已选择的数组(有active类的数组)
                 var selectedArr = []
                 buttons.each(function(){
                     if ($(this).hasClass('active')) {
-                        selectedArr.push($(this).text())
+                        if($(this).attr("disabled")!="disabled"){
+                          selectedArr.push($(this).text())
+                        }
                     }
                 })
                 
@@ -404,7 +309,7 @@
                 } else {
                     $('.tips_btn .tips_d_text').slideUp()
                 }
-
+          
                 selectedIndustryArr = selectedArr
                 
                 var selectedStr = selectedArr.join('、')
@@ -420,18 +325,21 @@
                     $('#all button').trigger('click')
                 }
             }
-            findDisabledIndustry()
-            // 找disabled的button函数
-            var disabledIndustryArr = null
-            function findDisabledIndustry () {
-                var $disabledButton = $('.select-area-box .list button:disabled')
-                var arr = []
-                $disabledButton.each(function (index, dom) {
-                    arr.push($(dom).text())
+                      
+            function showSelect(arr,canclick){
+              if(!arr)return
+              arr.forEach(v => {
+                $($('.industry_item')).each(function (index, dom) {
+                    if (canclick&&v!="全部行业"){
+                      $('#all').children().children('button').removeClass('active');
+                    } 
+                    if (v == $(dom).text()) {
+                      $(dom).addClass("active").attr({"disabled":!canclick})
+                    }
                 })
-                disabledIndustryArr = arr
+              })
             }
-            checkedAll()
+            
             // 每个button的点击事件
             $('.select-area-box .list').on('click', 'button', function (e) {
                 $('.tips_btn .btns button').removeAttr('disabled')
@@ -450,14 +358,35 @@
 
             // 重置按钮事件
             $('.reset-btn').on('click', function () {
-                $('.tips_btn .btns button').attr('disabled', true)
-                $('.choose_industry .result').slideUp(200)
-                $('.select-area-box .list button').removeClass('active');
-                $('.tips_d_text').hide(200)
+              $("#all .industry_item").trigger("click");
             })
-            // 确认按钮事件
+           
+            //=======================
+             
+
+             // 确认按钮事件
             $('.save-btn').on('click', function () {
                 console.log(selectedIndustryArr)
+                sessionStorage.setItem("vipSubSelectIndustry",JSON.stringify(selectedIndustryArr));
+                history.go(-1);
+            })
+                       
+            var selectedIndustryArr //已选择
+            
+            $(function(){
+ 
+              try{
+                if(sessionStorage.getItem("vipSubSelectIndustry")){
+                  selectedIndustryArr=JSON.parse(sessionStorage.getItem("vipSubSelectIndustry"));
+                }else{
+                  selectedIndustryArr=[];
+                }
+              }catch(e){
+                console.log(e)
+              }
+              //已选择
+              showSelect(selectedIndustryArr,true);
+              findSelectedIndustry();
             })
         </script>
     </body>

+ 9 - 1
src/web/templates/weixin/vipsubscribe/trial_info.html

@@ -79,6 +79,14 @@
     <script src="/vipsubscribe/js/common.js?v={{Msg "seo" "version"}}"></script>
     <script>
         $(function () {
+            //获取用户信息
+            $DoPost("/subscribepay/trial/GetUserPhone",{},function(r){
+              if(r.success){
+                $(".phone").val(r.phoneNum);
+                check_tel($('.phone'),$('.code_btn'),false);
+              }
+            })
+            
             //实时校验
             $('.name').bind("input propertychang",function(event){
               check_name($(this),false);
@@ -128,7 +136,7 @@
             $('#formInfo').submit(function(e) {	
                 var name = $('.name').val();
                 var tel = $('.phone').val();
-                var code = $('.code').val();
+                var code = $('.phonecode').val();
                 var company = $('.company').val();
                 var job = $('.job').val();
                 var post_data = {

+ 94 - 55
src/web/templates/weixin/vipsubscribe/vip_purchase.html

@@ -18,7 +18,7 @@
         <div class="choose_condition">
             <ul class="chooseList">
                 <li class="choose_item">
-                    <a href="/front/vipsubscribe/toChooseArea/new">
+                    <a href="/front/vipsubscribe/toChooseArea">
                         <span class="label">区域</span>
                         <!-- <input type="text" disabled value="" placeholder="选择全国、省份、地市" class="info"> -->
                         <input type="text" disabled value="" placeholder="1个市" class="info choose_area">
@@ -28,7 +28,7 @@
                     <p class="add_tips area" style="display:none">已选择 0 个省级区域、0 个地市</p>
                 </li>
                 <li class="choose_item">
-                    <a href="/front/vipsubscribe/toChooseIndustry/new">
+                    <a href="/front/vipsubscribe/toChooseIndustry">
                         <span class="label">行业</span>
                         <!-- <input type="text" disabled value="" placeholder="选择采购单位行业" class="info"> -->
                         <input type="text" disabled value="" placeholder="1个行业" class="info choose_industry">
@@ -42,7 +42,7 @@
                     <!-- 需要选择试用就用div标签,a标签隐藏 -->
                     <a href="javascript:;">
                         <span class="label">订阅周期</span>
-                        <input type="text" disabled value="" placeholder="1个月" class="info choose_time">
+                        <input type="text" disabled value="1个月" class="info choose_time">
                         <i class="iconfont icon-arrow choose_time"></i>
                     </a>
                     <!-- <div class="free-7day" style="display: none">
@@ -223,7 +223,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="wx" id="wx" checked />
                                 <i class="weui-icon-checked"></i>
                             </div>
                         </label>
@@ -232,7 +232,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="ali" id="zfb" />
                                 <i class="weui-icon-checked"></i>
                             </div>
                         </label>
@@ -244,57 +244,74 @@
     <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/weui.min.js?v={{Msg "seo" "version"}}"></script>
+    <script src="/vipsubscribe/js/common.js?v={{Msg "seo" "version"}}"></script>
     <script>
-    
-      var EntSearch = {
-        cityArr: [],
-        provinceArr:[],
-        industryArr: [],
+ 
+      var purchase = {
+        areaSelect:{},//已选择地区
+        industrySelect:[],
         initData: function(){
-          var vipsubscribeArea = {}
+          //已选择
           try{
-            vipsubscribeArea=JSON.parse(localStorage.getItem("vipsubscribeArea"))
+            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("vipSub_read")=="true")$("#buy").prop("checked",true);
           }catch(e){
             console.log(e)
-          }
-          for(var i in vipsubscribeArea) {
-            let citys=vipsubscribeArea[i].split(",")
-            if(citys[0]!=""){
-              this.cityArr = this.cityArr.concat(citys);
+          }  
+        },
+        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{
-              this.provinceArr.push(i)
+              provinceArr.push(i)
             }
           }
-          console.log(this.provinceArr)
-          console.log(this.cityArr)
           
-          if(this.provinceArr.length>0||this.cityArr.length>0){
-            var tipTxt="已选择 "
-            if(this.provinceArr.length>0)tipTxt+=this.provinceArr.length+" 个省级区域";
-            if(this.cityArr.length>0){
-              if(this.provinceArr.length>0) tipTxt+="、"
-              tipTxt+=this.cityArr.length+" 个地市";
+          if(!$.isEmptyObject(data)){
+            $(".choose_area").val(provinceArr.join(" ")+" "+cityArr.join(" "));
+          }
+
+          if(!$.isEmptyObject(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+" 个地市";
             }
-            $(".choose_area").val(this.provinceArr.join(" ")+" "+this.cityArr.join(" "));
             $(".add_tips.area").text(tipTxt).css("display","");
           }
-          
-          return
-          if(chooseIndustry){
-            this.industryArr=chooseIndustry.split(",");
-            $(".choose_industry").val(chooseIndustry);
+        },
+        showIndustry:function(){
+          let data = this.industrySelect;
+          if(data.length>0){
+            $(".choose_industry").val(data.join(" "));
+          }
+          if(this.industrySelect.length>0&&this.industrySelect[0]!="全部行业"){ //选择有行业信息
+            var tipTxt="已选择 ";
+            $(".add_tips.industry").text(tipTxt+this.industrySelect.length+" 个行业").css("display","");
           }
-          console.log("chooseCity:",this.chooseCity,"  provinceArr:",this.provinceArr,"  chooseIndustry:",this.chooseIndustry)
         }
       }
         
         
-        
-        
+
         $(function () {
-            EntSearch.initData();
+            purchase.initData();
+            purchase.showArea();
+            purchase.showIndustry();
+            checkOk();
             var time_limit;//定义一个周期变量
-
             /*------ 关闭弹窗事件  点击取消或遮罩层 -----*/
             $('.weui-mask').click(hideDialog);
             $('.cancel').click(hideDialog);
@@ -314,8 +331,7 @@
             /* -----  选择完支付方式、订阅周期 回显到页面 -------*/
             // 对支付方式选择的input绑定点击事件
             $('#pay_way input:radio[name="way"]').click(function () {
-                var checkValue = $('input:radio[name="way"]:checked').val();
-                console.log(checkValue);
+                var checkValue = $('input:radio[name="way"]:checked').val();              
                 $('.pay_way').hide(200);
                 $('.pay_mode .select_payment .choose_way.info').html(checkValue);
             });
@@ -456,23 +472,30 @@
                 })
             })
             $("input").bind("input propertychange change", function (event) {
-                var area = $(".info:eq(0)").val().trim();
-                var industry = $(".info:eq(1)").val().trim();
-                var checked = $('#buy').prop('checked');
-                // console.log(area,industry,checked)
-                if (area != '' && industry != '' && checked == true) {
-                    // console.info("所有输入框都有值")
-                    $(".enter").removeAttr('disabled');
-                } else {
-
-                    $(".submit").attr({
-                        'disabled': 'true'
-                    });
-                    // console.info("有输入框没有输入")
-                }
+              checkOk();  
             });
+            
             $('#payHandle').click(function () {
-                // alert("支付成功")
+                //支付请求
+                var area=purchase.areaSelect;
+                var industry=purchase.industrySelect;
+                if(area["全国"]){
+                  area={};
+                }
+                if(industry.length==1&&industry[0]=="全部行业"){
+                  industry=[];
+                }
+                var payWay=$('input:radio[name="way"]:checked').val();
+                var time=$(".info:eq(2)").val().trim();
+
+                console.log(area,industry,time,payWay)
+                $DoPost("/subscribepay/order/toPay",{"area":area,"industry":industry,"time":time,"payWay":payWay},function(r){
+                  if(r.success){
+                    $(".phone").val(r.phoneNum);
+                    check_tel($('.phone'),$('.code_btn'),false);
+                  }
+                })
+                return
                 window.location.href = "/front/vipsubscribe/toPaySuccessPage"
             })
           
@@ -482,7 +505,23 @@
             $('#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');
+          // console.log(area,industry,checked)
+          if (area != '' && industry != '' && checked == true) {
+              console.info("所有输入框都有值")
+              $(".enter").removeAttr('disabled');
+          } else {
+              $(".enter").attr({
+                  'disabled': 'true'
+              });
+              console.info("有输入框没有输入")
+          }
+          sessionStorage.setItem("vipSub_read",checked)
+        }
         
     </script>
 </body>