12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379 |
- var subNode = new Vue({
- delimiters: ['${', '}'],
- el: '#vip-body',
- components: {
- subComponent: subComponent
- },
- data: function() {
- return {
- linkObj: {
- area: '/front/vipsubscribe/toChangeArea?header=save',
- industry: '/front/vipsubscribe/toChangeIndustry?header=save',
- keyword: '/front/vipsubscribe/toSetKeyWordPage',
- infotype: '/front/vipsubscribe/toSetInfoTypePage',
- resultview: '/front/vipsubscribe/toVIPViewPage?vSwitch=v',
- pushsetting: '/front/setting/push_detail?header=超级订阅推送设置&type=super_subscribe',
- freepush: '/front/setting/push_detail?header=订阅&type=free_subscribe',
- },
- initData: {},
- userAreaNum: 1, // 用户修改地区剩余次数
- userType: false, // 用户是否为付费用户
- userAreaAllNum: 1, // 用户可修改地区总次数
- subscribeTime: '', // 用户订阅的时间
- vSwitch:'', // 用户版本权限
- freeUserArea: {}, // 购买省份订阅包的用户所选择的地区
- isNewVip: 0,
- vipStatus: 0
- }
- },
- created () {
- var _this = this
- $.ajax({
- url: '/bigmember/use/isAdd?t=' + Date.now(),
- type: 'POST',
- success: function (res) {
- console.log(res)
- if (res) {
- _this.vipStatus = res.data.vipStatus
- }
- }
- })
- },
- mounted () {
- this.getUserType()
- this.$nextTick(function () {
- $(".app-layout-content-b").removeAttr('v-cloak')
- })
- },
- methods: {
- // 点击订阅周期事件
- toSubCycle () {
- // 如果是老超级订阅者用户提示升级到新版超级订阅再续费
- if (this.vSwitch == 'v' && this.isNewVip != 1) {
- $('[data-update-tips]').show()
- } else {
- location.href = '/jy_mobile/common/order/create/svip?type=renew'
- }
- },
- superOrderTemplateMounted () {
- $('#pushResultPreview').attr('data-cl-event', 'c_wx_preview_buttonclick')
- },
- // 点击广告跳转超级订阅落地页
- toPaySupSub: function() {
- if (this.vSwitch !== 'v') {
- var href = '/front/vipsubscribe/introducePage'
- location.href = href
- }
- },
- // 得到用户是否购买省份包
- getUserSubscribe: function () {
- let _this = this
- _this.$refs.subComponent.getUserSubscribe(function (res) {
- if (res && res.data) {
- _this.freeUserArea = res.data.area
- _this.userType = res.data.provincenum === 0 ? false : true
- _this.userAreaAllNum = res.data.provincenum === -1 ? '全国' : res.data.provincenum
- _this.subscribeTime = new Date(res.data.ppstart * 1000).pattern('yyyy年MM月dd日') + "-" + new Date(res.data.ppend * 1000).pattern('yyyy年MM月dd日')
- _this.initdata = res.data
- _this.linkObj.pushsetting = _this.linkObj.freepush
- }
- })
- $.ajax({
- url: '/publicapply/free/pushcount',
- type: 'POST',
- success: function (res) {
- if (res && res.count) {
- _this.$refs.subComponent.$data.resultTime = '(近3个月内共' + res.count + '条信息)'
- }
- }
- })
- },
- // 省份订阅包续费
- renewBtn: function () {
- location.href = '/jy_mobile/common/order/create/areapack?type=renew'
- },
- // 省份订阅包升级
- updateBtn: function () {
- location.href = '/jy_mobile/common/order/create/areapack?type=upgrade&area=' + encodeURIComponent(JSON.stringify(this.freeUserArea))
- },
- // 判断用户权限版本
- getUserType: function (data) {
- let _this = this
- $.ajax({
- type: 'POST',
- url: '/publicapply/subscribe/vipSwitch',
- success: function(res) {
- // 微信端暂无大会员订阅设置
- // 暂无切换用户身份(大会员or超级订阅)
- // 现只需判断用户身份是不是超级订阅(同时是超级订阅、大会员),是显示超级订阅设置,非则显示免费用户订阅设置
- // 下版本微信端完成大会员功能后 再判断切换的是哪个身份
- if (_this.vipStatus > 0) {
- _this.vSwitch = 'v'
- document.title = '订阅管理-超级订阅'
- $('.update_renew').show()
- $('.super-title').show();
- window.getDataWitXHR()
- } else {
- _this.vSwitch = 'f'
- _this.linkObj.pushsetting = _this.linkObj.freepush
- _this.linkObj.resultview = '/front/vipsubscribe/toVIPViewPage?vSwitch=f',
- document.title = '订阅管理-免费订阅'
- $('.update_renew').hide()
- $('.super-title').text('订阅管理-免费订阅');
- $('.super-title').css('background', 'none')
- _this.getUserSubscribe()
- }
- }
- })
- }
- }
- })
- function showGiveStatus (t) {
- if (t) {
- $(".banner-ad-box").hide()
- $("#giveTimeBox").attr('data-new-year', 'true')
- if ($(".try-seven").is(':visible')) {
- $(".banner-ad-box.trial").show()
- } else {
- $(".banner-ad-box.update").show()
- }
- // $(".banner-ad-box").css('display', 'flex')
- /*$("#giveTimeBox").addClass('hasDoubleEleven')
- $('.discount-button').show().on('click', function () {
- var details = $('.discount-details')
- if (details.is(':hidden')) {
- $('.discount-details').show()
- $(this).children('.icon-arrow').addClass('up')
- } else {
- $('.discount-details').hide()
- $(this).children('.icon-arrow').removeClass('up')
- }
- })
- $(".j-icon.icon-del-grey.cancel").on('click', function () {
- $('.weui-mask').trigger('click')
- })*/
- } else {
- /*$("#giveTimeBox").removeClass('hasDoubleEleven')
- $(".origin-price").hide()*/
- $(".banner-ad-box").hide()
- }
- }
- // @NewYearMarketing 2021/1/25
- getNewYearMarketing()
- function getNewYearMarketing () {
- $.ajax({
- url: '/getJson/NewYearMarketing?t=' + new Date().getTime(),
- async: false,
- success: function (r) {
- if (r && r.status) {
- showGiveStatus(true)
- }
- }
- })
- }
- // 拦截获取价格接口读取11.11活动信息
- /*$.ajaxSetup({
- complete:function(XMLHttpRequest,textStatus){
- if (this.url.indexOf('/subscribepay/vipsubscribe/getPrice') !== -1) {
- if (textStatus === 'success') {
- var data = XMLHttpRequest.responseJSON
- if (data && data.isActiving && data.isWritten === 0) {
- showGiveStatus(true)
- } else {
- showGiveStatus(false)
- }
- }
- }
- }
- });*/
- $(function () {
- /* vue 代码 start 提交订单 */
- // var coupon = new Vue({
- // el: '#coupon-vue',
- // data: function () {
- // return {
- // type: 'vip-update',
- // initPrice: 0, // 原价
- // realPrice: 0, // 实付价
- // checkboxStatus: false, // checkbox状态
- // submitStatus: true, // 提交按钮状态
- // links: [
- // {
- // text: '《剑鱼标讯线上购买与服务条款》',
- // url: '/front/staticPage/wx-serviceterms.html',
- // event: this.readEvent
- // }
- // ],
- // buttons: {
- // submit: this.submitOrder,
- // cancel: this.cancelEvent
- // },
- // }
- // },
- // mounted () {
- // this.init()
- // },
- // methods: {
- // // 更新价格相关
- // updatePrice: function (before) {
- // console.log( '原价:' + before)
- // this.initPrice = before;
- // // 调用子组件查询最优卡券
- // this.$refs.couponRef.getCoupon();
- // },
- // // 初始化及回显相关
- // init: function () {
- // if (sessionStorage.getItem("vip_index_read") === "true") {
- // this.checkboxStatus = true
- // this.$refs.couponRef.submitStatus = false
- // } else {
- // this.checkboxStatus = false
- // this.$refs.couponRef.submitStatus = true
- // }
- // },
- // // 勾选阅读协议
- // updateS: function(data) {
- // data.callback(this.checkSubmitStatus(data.check))
- // },
- // // 校验checkbox
- // checkSubmitStatus: function (checkStatus) {
- // if(checkStatus) {
- // $('.checkbox').addClass("checked");
- // } else {
- // $('.checkbox').removeClass("checked");
- // }
- // $('.vip-footer.upgrade .confirm').prop('disabled', !checkStatus);
- // sessionStorage.setItem("vip_index_read", checkStatus ? true : false);
- // return sessionStorage.getItem("vip_index_read") == 'true';
- // },
- // // 阅读协议点击事件
- // readEvent: function () {},
- // // 点击优惠券跳转存储当前页面数据
- // savePageData: function () {
- // sessionStorage.setItem('index_read_cache', '0');
- // },
- // cancelEvent: function() {
- // $('.weui-mask').trigger('click')
- // window.history.back();
- // },
- // // 订单提交事件
- // submitOrder: function () {
- // doSubmit()
- // }
- // }
- // })
- // 清除商品规格当前选择
- sessionStorage.removeItem("vip-cur-select-size")
- // 清除商品优惠券当前选择
- sessionStorage.removeItem("vip-cur-select-coupon")
- sessionStorage.removeItem("$select-coupon")
- /* vue 代码 end */
- //项目匹配开关
- var checkedflag = true;
- function setprojectmatch(index) {
- if (checkedflag) {
- checkedflag = false;
- $.post("/subscribepay/afterPay/setUserInfo", {pageType: "projectMatch", pmindex: index}, function (r) {
- if (r.flag) {
- checkedflag = true;
- reqData.projectmatch = index;
- sessionStorage.setItem('sub_vip_state', JSON.stringify(reqData))
- }
- })
- }
- }
- function setMatchway(index) {
- $.post("/subscribepay/afterPay/setUserInfo", {pageType: "saveSeniorset", matchtype: index}, function (r) {
- if (r.flag) {
- reqData.matchway = index;
- sessionStorage.setItem('sub_vip_state', JSON.stringify(reqData))
- }
- })
- }
- var checkedflag_other = true; //其他采购单位开关
- function setotherbuyerclass(index) {
- if (checkedflag_other) {
- checkedflag_other = false;
- $.post("/subscribepay/afterPay/setUserInfo", {pageType: "other_buyerclass", other: index}, function (r) {
- if (r.flag) {
- checkedflag_other = true;
- reqData.otherbuyerclass = index;
- sessionStorage.setItem('sub_vip_state', JSON.stringify(reqData))
- }
- })
- }
- }
- function flushSubtotal(list) {
- var returnHtml = "";
- for (var i = 0; i < list.length; i++) {
- var showTime = new Date(list[i].startTime * 1000).pattern('yyyy年MM月dd日') + "-" + new Date(list[i].endTime * 1000).pattern('yyyy年MM月dd日');
- var typeName = "";
- if (list[i].type === 1) {
- typeName = "续费"
- } else if (list[i].type === 0) {
- typeName = "升级"
- }
- var showArea = "";
- if (list[i].buyset.areacount === -1) {
- showArea = "全国"
- } else {
- if (list[i].buyset.areacount > 0) {
- showArea = list[i].buyset.areacount + "个省";
- }
- if (list[i].buyset.citys.length > 0) {
- var cityCount = 0;
- for (var j = 0; j < list[i].buyset.citys.length; j++) {
- cityCount += list[i].buyset.citys[j];
- }
- if (list[i].buyset.areacount > 0) showArea += "、";
- showArea += cityCount + "个市";
- if (list[i].buyset.citys.length > 1) {
- showArea += "(分布在" + list[i].buyset.citys.length + "个省内)"
- }
- }
- }
- var industryShow = "";
- if (list[i].buyset.buyerclasscount === -1) {
- industryShow = "全行业"
- } else {
- industryShow = list[i].buyset.buyerclasscount + "个行业";
- }
- returnHtml += "<li class=\"list-item\">"
- + "<div class=\"item-top\">"
- + "<div class=\"item-header\">"
- + "<span class=\"header-label\">有效日期:</span>"
- + "<span class=\"header-content ellipsis\">" + showTime + "</span>"
- + "</div>"
- + "<div class=\"item-body\">"
- + "<div class=\"b-item body-area\">"
- + "<div class=\"body-area-title text-title\">区域</div>"
- + "<div class=\"body-area-sub\">" + showArea + "</div>"
- + "</div>"
- + "<div class=\"b-item body-industry\">"
- + "<div class=\"body-industry-title text-title\">采购单位行业</div>"
- + "<div class=\"body-industry-sub\">" + industryShow + "</div>"
- + "</div>";
- if (typeName != "") {
- returnHtml += "<div class=\"vp-type\">"
- + "<div class=\"vp-type-text\">" + typeName + "</div>"
- + "</div>"
- }
- returnHtml += "</div>"
- + "</div>"
- + "<div class=\"item-footer\">"
- + "<span class=\"footer-label\">小计:</span>"
- + "<span class=\"footer-content text-title\">¥" + formatMoney(list[i].price) + "</span>"
- + "</div>"
- + "</li>"
- }
- $(".list-content").html(returnHtml);
- }
- window.getDataWitXHR = function () {
- $DoPost('/subscribepay/vipsubscribe/getSubBuyMsg', {}, function (res) {
- if (!res.success) return;
- if(!res.data.industry) {
- res.data.industry = []
- }
- res.data.oldArea = res.data.area;
- res.data.oldIndustry = res.data.industry;
- var globalStateStr = JSON.stringify(res.data);
- sessionStorage.setItem('sub_vip_state', globalStateStr);
- sessionStorage.setItem('vip_index_read', true);
- globalState = JSON.parse(globalStateStr);
- reqData = JSON.parse(globalStateStr);
- sessionStorage.removeItem('industryNull')
- sessionStorage.removeItem('areaNull')
- subNode.initData = res.data
- init(res.data)
- })
- }
- // 设置已选择的区域和行业
- function setSelectedAreaAndInd(selected) {
- // buySet = {
- // areacount: 2,
- // buyerclasscount: 2,
- // newcitys: []
- // }
- // 设置已选择区域
- var citySum = arrSum(selected.citys);
- var text = {
- p: selected.areacount === 0 ? '' : selected.areacount + '个省',
- c: citySum === 0 ? '' : citySum + '个市',
- s: selected.citys.length === 1 ? '' : '(分布在' + selected.citys.length + '个省内)'
- };
- if (selected.areacount === -1) {
- $('.vip-body .area .selected-area').text('全国')
- } else {
- var dunhao = '';
- if (citySum !== 0 && selected.areacount !== 0) {
- dunhao = '、'
- }
- if (citySum === 0 || citySum === 1) {
- text.s = ''
- }
- $('.vip-body .area .selected-area').text(text.p + dunhao + text.c + text.s);
- }
- // 设置已选择行业
- if (selected.buyerclasscount === -1) {
- $('.vip-body .industry .selected-industry').text('全行业')
- } else {
- $('.vip-body .industry .selected-industry').text(selected.buyerclasscount + '个行业')
- }
- }
- // 设置已购买的区域和行业
- function setBuyAreaAndInd(buySet) {
- // 设置已购买区域
- var buySetCitySum = arrSum(buySet.newcitys)
- var text = {
- p: buySet.areacount === 0 ? '' : buySet.areacount + '个省',
- c: buySetCitySum === 0 ? '' : buySetCitySum + '个市',
- s: buySet.newcitys.length === 1 ? '' : '(分布在' + buySet.newcitys.length + '个省内)'
- }
- if (buySet.areacount === -1) {
- $('.vip-body .area .buy-set-area').text('全国')
- } else {
- var dunhao = '';
- // 如果省或者市都不为0,则添加顿号
- if (buySetCitySum !== 0 && buySet.areacount !== 0) {
- dunhao = '、'
- }
- // 如果市等于0或者1,text.s不需要显示
- if (buySetCitySum === 0 || buySetCitySum === 1) {
- text.s = ''
- }
- $('.vip-body .area .buy-set-area').text(text.p + dunhao + text.c + text.s);
- }
- // 设置已选择行业
- if (buySet.buyerclasscount === -1) {
- $('.vip-body .industry .buy-set-industry').text('全行业')
- } else {
- $('.vip-body .industry .buy-set-industry').text(buySet.buyerclasscount + '个行业')
- }
- }
- function showTimeOut(endTime, isTrail) {
- if (!isTrail) {
- // $('.vip-header .expire-remind .remind-link').attr('href', '/front/vipsubscribe/vipsubscribe_renew').text('去续费')
- $('.vip-header .expire-remind .remind-link').attr('href', '/jy_mobile/common/order/create/svip?type=renew').text('去续费')
- } else {
- // $('.vip-header .expire-remind .remind-link').attr('href', '/front/vipsubscribe/vipsubscribe_new').text('去购买')
- $('.vip-header .expire-remind .remind-link').attr('href', '/jy_mobile/common/order/create/svip?type=buy').text('去购买')
- }
- var timeSub = endTime * 1000 - new Date().getTime();
- if (timeSub > 0 && timeSub < 60 * 60 * 24 * 1000 * 3) {
- var hours = Math.floor(timeSub / (60 * 60 * 1000));
- var day = Math.floor(hours / 24);
- if (day > 0) {
- if (!isTrail) {
- $(".expire-remind .remind-text").text("超级订阅服务还有" + (day + 1) + "天到期,请及时续费!");
- } else {
- $(".expire-remind .remind-text").text("超级订阅服务还有" + (day + 1) + "天到期,请及时购买!");
- }
- } else {
- if (!isTrail) {
- $(".expire-remind .remind-text").text("超级订阅服务今天到期,请及时续费!");
- } else {
- $(".expire-remind .remind-text").text("超级订阅服务今天到期,请及时购买!");
- }
- }
- $(".expire-remind").show();
- }
- }
- function arrSum(arr) {
- var sum = 0
- arr.forEach(function (item, i) {
- sum += item
- })
- return sum
- }
- // picker的显示隐藏
- function pickerShow(selector, f) {
- if (f) {
- // 添加进场动画,并显示
- $(selector).find('.weui-mask').removeClass('weui-animate-fade-out').addClass('weui-animate-fade-in')
- $(selector).find('.weui-picker').removeClass('weui-animate-slide-down').addClass('weui-animate-slide-up')
- $(selector).show(300);
- } else {
- // 添加离场动画,并隐藏
- $(selector).find('.weui-mask').removeClass('weui-animate-fade-in').addClass('weui-animate-fade-out')
- $(selector).find('.weui-picker').removeClass('weui-animate-slide-up').addClass('weui-animate-slide-down')
- $(selector).hide(300);
- }
- }
- // 其他采购单位行业问号点击事件
- $('.other .icon-bangzhu').on('click', function () {
- var str = '每条信息的采购单位行业属性由机器自动识别,会存在少数无法识别的情况,此时将归类为“其它”。(注:当采购单位行业选择为全部时,关闭无效)'
- weui.alert(str, {
- title: '“其它”采购单位',
- className: 'jy-alert',
- buttons: [{
- label: '我知道了'
- }]
- });
- })
- // 计算标准点击事件
- $('.billing-list-btn').on('click', function () {
- pickerShow('.billing-list-container', true)
- })
- // 计算标准隐藏
- $('.billing-list-container .dialog_hd__close').on('click', function () {
- pickerShow('.billing-list-container', false)
- })
- $('.weui-mask').on('click', function () {
- pickerShow('.billing-list-container', false)
- $('.coupon-picker').hide()
- $('.discount-details').hide()
- $('.discount-button .icon-arrow').removeClass('up')
- })
- $('body').on('click', '.jy-dialog .weui-mask', function () {
- pickerShow('.jy-dialog', false)
- })
- $('.close-expire-remind').on("click", function () {
- $(".expire-remind").hide();
- });
- // 阅读并接受协议前的模拟checkbox点击事件
- if (sessionStorage.getItem("vip_index_read") === "true") {
- $('.checkbox').addClass("checked");
- $('.vip-footer.upgrade .confirm').prop('disabled', false);
- }
- $('.checkbox').on('click', function () {
- $(this).toggleClass('checked');
- var state = $(this).hasClass('checked');
- $('.vip-footer.upgrade .confirm').prop('disabled', !state);
- sessionStorage.setItem("vip_index_read", state ? true : false);
- });
- if (sessionStorage.liveActiveCode_new === "jianyu360") {
- $('.coupon-code-tx .keywords-text').text("支付成功赠送30天订阅周期");
- $('.coupon-picker .weui-input').val("jianyu360");
- $('.coupon-code-tx').off('click');
- }
- var $dialog;
- //保存取消提示 module 1 修改 2升级 3续费 4购买
- function cancelTip(module) {
- var content = "";
- var labName = "";
- var title = "";
- if (module === 1) {
- content = "所选订阅设置已做修改,返回后修改的设置将不做保存。";
- labName = "保存修改";
- title = "";
- } else if (module === 2) {
- content = "所选订阅设置已超出购买范围,升级后方才生效,返回后修改的设置将不做保存。";
- labName = "立即升级";
- title = "并升级";
- } else if (module === 3) {
- content = "所选订阅设置已超出购买范围,续费后方才生效,返回后修改的设置将不做保存。";
- labName = "立即续费";
- } else {
- content = "所选订阅设置已超出试用范围,购买后方才生效,返回后修改的设置将不做保存。";
- labName = "立即购买";
- title = "去购买";
- }
- $dialog = weui.dialog({
- title: '保存修改' + title,
- content: content,
- className: 'jy-dialog',
- buttons: [
- {
- label: '不保存',
- type: 'default',
- onClick: function () {
- clearSessionStorage();
- window.history.go(-1);
- window.location.reload();
- }
- },
- {
- label: labName,
- type: 'primary',
- onClick: function () {
- // doSubmit();
- // $('.vip-footer .button-r.confirm').trigger('click')
- // coupon.submitOrder()
- }
- }
- ]
- });
- }
- //展示订阅周期时间
- function flushShowTime(isTrial, changeValue, startValue, endValue) {
- if (isTrial) {
- sessionStorage.removeItem("vip_trial_buy");
- }
- var dEnd;
- if (isTrial && changeValue) {
- // 初始化订阅周期
- endValue = new Date().getTime() / 1000;
- startValue = new Date().getTime() / 1000;
- }
- if (changeValue) {
- var afterEndTime;
- if (isTrial) {
- $(".cycle .tip").text("购买订阅周期" + changeValue).show();
- } else {
- $(".cycle .tip").text("延长订阅周期" + changeValue).show();
- }
- if (changeValue.indexOf("月") > -1) {
- var monthNum = parseInt(changeValue.replace("个月", ""));
- afterEndTime = getVipEndDate(2, monthNum, endValue);
- changeTime = [monthNum, 2]
- } else {
- var yearNum = parseInt(changeValue.replace("年", ""));
- afterEndTime = getVipEndDate(1, yearNum, endValue);
- changeTime = [yearNum, 1]
- }
- dEnd = new Date(afterEndTime * 1000).pattern('yyyy年MM月dd日');
- } else {
- dEnd = new Date(endValue * 1000).pattern('yyyy年MM月dd日')
- }
- var dStart = new Date(startValue * 1000).pattern('yyyy年MM月dd日');
- var sDuration = dStart + ' - ' + dEnd;
- $('.cycle .buy-cycle').text(sDuration);
- }
- function initCycleSelector() {
- $('.vip-body .cycle').on('click', function () {
- pickerShow('#time_cycle', true)
- })
- // 打开dialog
- $('#time_cycle .weui-mask').on('click', function () {
- pickerShow('#time_cycle', false)
- })
- // 关闭dialog
- $('#time_cycle .box_hd .cancel').on('click', function () {
- pickerShow('#time_cycle', false)
- })
- // 选择完成(确定)按钮的点击事件
- $('#enter_period').on('click', function () {
- var checkedValue = $('#time_cycle input:radio[name="time"]:checked').val();
- var result = null
- if (checkedValue == 'month') {
- result = $('#number_box_month .month_number').text() + '个月'
- } else if (checkedValue == 'year') {
- result = $('#number_box_year span.active').attr('data-id') + '年'
- }
- console.log(result)
- $('.vip-body .extend-cycle').show().text('延长订阅周期' + result)
- pickerShow('#time_cycle', false)
- })
- // 1. 对订阅时间选择的input绑定点击事件
- $('#time_cycle input:radio[name="time"]').on('click', function (e) {
- // 解除确认按钮的锁定
- $('#time_cycle .form-btn button').removeAttr('disabled')
- if ($(e.target).hasClass('monthly')) {
- // 按月订阅
- $('#number_box_month').addClass('active');
- $('#number_box_year span').removeClass('active');
- } else {
- // 按年订阅
- $('#number_box_month').removeClass('active');
- // $('#number_box_year span:eq(0)').addClass('active').siblings().removeClass('active');
- }
- })
- /* --------控制月份number_box的事件 点击加减号触发的事件------- */
- $('#number_box_month').on('click', 'button', function (e) {
- // 点击加减号让input radio选中
- $("#monthly").prop('checked', true);
- $('#yearly').prop('checked', false);
- $('.number_box span').removeClass('active')
- $('#number_box_month').addClass('active');
- var $number = $('#number_box_month span.month_number');
- var $monthlyInput = $('#monthly');
- // 未整理的data数组,里面的值都是字符串
- var preData = e.delegateTarget.dataset
- var currentNum = parseInt($number.text());
- var data = {};
- // 把字符串转换成数字
- for (var i in preData) {
- data[i] = preData[i] - 0
- }
- if (!$monthlyInput.prop('checked')) {
- return
- }
- // 判断是点击的是+ 还是-
- if ($(e.target).hasClass('add') || $(e.currentTarget).hasClass('add')) {
- // 点的+
- // 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)
- var price = (5.8 * currentNum).toFixed(1);
- $('.computed_price').html(price)
- var firstButton = $('#number_box_month button:first')
- var lastButton = $('#number_box_month button:last')
- if (currentNum >= 10) {
- $('.profit_tips').show()
- } else {
- $('.profit_tips').hide()
- }
- // 如果为操作后的结果为1,则锁定减号按钮
- if (currentNum === data.numboxMin) {
- firstButton.attr('disabled', true)
- } else {
- firstButton.removeAttr('disabled')
- }
- // 如果为操作后的结果为12,则锁定加号按钮
- if (currentNum === data.numboxMax) {
- lastButton.attr('disabled', true)
- } else {
- lastButton.removeAttr('disabled')
- }
- })
- /* -------- 控制年份number_box的事件 点击1年 2年 3年触发的事件------- */
- $('#number_box_year').on('click', 'span', function (e) {
- $('#number_box_month').removeClass('active');
- console.log(e.target.dataset.id)
- var id = e.target.dataset.id;
- $('.profit_tips').hide()
- $(this).addClass('active').siblings().removeClass('active')
- $('#yearly').prop('checked', true);
- $("#monthly").prop('checked', false);
- // 渲染结果 保留一位小数
- var result = (Number(id) * 58).toFixed(1);
- $('.computed_price').html(result)
- })
- /* -------- 选择按月订阅 radio触发的事件------- */
- $('#monthly').on('change', function (e) {
- var isChecked = $(this).is(':checked')
- var val = $('.month_number').text();
- if (val >= 10) {
- $('.profit_tips').show()
- }
- if (!isChecked) {
- $('#number_box_month button').attr('disabled', true)
- } else {
- $('#number_box_month button').removeAttr('disabled')
- }
- if (val === 1) {
- $('#number_box_month button:eq(0)').prop('disabled', true)
- }
- if (val === 12) {
- $('#number_box_month button:eq(1)').prop('disabled', true)
- }
- var result = (Number(val) * 5.8).toFixed(1);
- $('.computed_price').html(result)
- })
- /* -------- 选择按年订阅 radio触发的事件------- */
- $('#yearly').on('change', function (e) {
- $('.profit_tips').hide()
- // console.log($(this).is(':checked'))
- var isChecked = $(this).is(':checked')
- // 按年订阅默认选择1年
- var val = 1;
- $('.computed_price').html(Number(val) * 58);
- if (isChecked) {
- $('#number_box_year span:eq(0)').addClass('active').siblings().removeClass('active')
- }
- });
- }
- //提交请求
- $('.vip-footer .button-r.confirm').on('click', function () {
- $(this).attr("disabled", "disabled");
- // doSubmit();
- $(this).removeAttr("disabled");
- });
- // 以下数据交互 -------------------
- // 定义全部变量state
- var globalState = {};
- var changeTime = [];
- var submitPrice = 0;
- var selectTime = "";
- function init(state) {
- checkmerge(state.industry, state.isread)
- // init 已选择的区域和行业
- // var selectedAreaAndInd = getBuySet(state.area, state.industry);
- // 2021-5-21修改
- var selectedAreaAndInd = getSelectBuyset(state.area, state.industry)
- setSelectedAreaAndInd(selectedAreaAndInd);
- // 初始化,已购买的城市和行业
- // setBuyAreaAndInd(state.buyset);
- //是否提示即将到期
- showTimeOut(state.endTime, state.isTrial);
- selectTime = sessionStorage.getItem("vip_change_time");
- var endflag = state.endTime;
- var stratFlag = state.startTime;
- //刷新展示周期
- flushShowTime(state.isTrial, selectTime, stratFlag, endflag);
- // 初始化关键词
- // if (state.items.length === 0) {
- // $('.body-item.keywords .keywords-text').text('未分类')
- // } else {
- // var arr = []
- // state.items.forEach(function (item, index) {
- // arr.push(item['s_item'])
- // })
- // $('.body-item.keywords .keywords-text').text(arr.join('、'))
- // }
- if (state.matchway) {
- var ModeArr = ['按标题匹配', '按全文匹配']
- var nowMode = ModeArr[state.matchway - 1] || '按标题匹配'
- $(".body-item.match-way .keywords-text.match-way-value").text(nowMode)
- var popDom = $("#iosActionsheet .weui-actionsheet__cell.active")
- if (popDom.find('.cell_title').text() !== nowMode) {
- popDom.removeClass('active').siblings().addClass('active');
- }
- }
- // 推送设置初始化
- var pushSettingMap = {
- 1: '实时推送',
- 2: '每日推送',
- 3: '每周推送',
- 4: '每月推送',
- }
- $('.body-item.push-setting .push-setting-text').text(pushSettingMap[state.ratemode])
- // 初始化“其他"开关
- console.log(state.otherbuyerclass)
- if (state.otherbuyerclass == 1 || state.otherbuyerclass == null) {
- $('.switch_other').addClass('checked')
- } else {
- $('.switch_other').removeClass('checked')
- }
- //试用不展示续费
- if (!state.isTrial) {
- $('.super-title').show();
- $(".renew").show();
- if ($("#giveTimeBox").is('[data-new-year]')) {
- showGiveStatus(true)
- }
- } else {
- $('.try-seven').show();
- $(".trail").show();
- if ($("#giveTimeBox").is('[data-new-year]')) {
- showGiveStatus(true)
- }
- }
- $('[data-update-tips]').hide()
- // 如果购买的是升级版套餐 不显示升级提示 且如果是全国全行业 则不显示升级按钮
- subNode.isNewVip = state.buyset.upgrade
- if (state.buyset.upgrade === 1) {
- $('[data-update-tips]').hide()
- if (state.buyset.areacount == -1) {
- $('*[data-bind-update]').hide()
- $('button[data-bind-renew]').css("margin-right", 0)
- }
- }
- // 清除升级页面的区域选择
- sessionStorage.removeItem('vipSubSelectArea')
- }
- // 给订阅周期栏目绑定点击事件(订阅周期选择框显示与隐藏等各种操作)
- //initCycleSelector()
- var subVipState = sessionStorage.getItem('sub_vip_state');
- var reqData = JSON.parse(subVipState);
- // if (subVipState) {
- // init(reqData);
- // subNode.initData = reqData
- // //判断是否修改
- // var IndustryNoChange = JSON.stringify(reqData.oldIndustry.sort()) === JSON.stringify(reqData.industry.sort());
- // var tmp1 = getAreaClassArr(reqData.oldArea);
- // var tmp2 = getAreaClassArr(reqData.area);
- // var areaNoChange = (JSON.stringify(tmp1[0].sort()) === JSON.stringify(tmp2[0].sort())) && (JSON.stringify(tmp1[1].sort()) === JSON.stringify(tmp2[1].sort()));
- // if (IndustryNoChange && areaNoChange && changeTime.length === 0) {
- // getDataWitXHR()
- // return
- // }
- // //判断是否需要升级
- // var status = getUpgradeFinalStatus(getBuySet(reqData.area, reqData.industry), {
- // "areacount": reqData.buyset.areacount,
- // "buyerclasscount": reqData.buyset.buyerclasscount,
- // "citys": reqData.buyset.newcitys
- // }, changeTime, reqData.endTime, reqData.renewList, reqData.isTrial);
- // // 双11.11活动
- // var giveT = [changeTime[1] === 1 ? 1 :changeTime[0], changeTime[1]]
- // if (!giveT[0] || !giveT[1]) {
- // giveT = []
- // }
- // var giveStatue = getUpgradeFinalStatus(getBuySet(reqData.area, reqData.industry), {
- // "areacount": reqData.buyset.areacount,
- // "buyerclasscount": reqData.buyset.buyerclasscount,
- // "citys": reqData.buyset.newcitys
- // }, giveT, reqData.endTime, reqData.renewList, reqData.isTrial);
- // var givePrice = giveStatue[0]
- // var giveCycle = changeTime[1] === 1 ? ('1年') : ((changeTime[0] ? changeTime[0] : 1) + '个月')
- // if (status[0] === -2) {
- // weui.toast('订单冲突', {
- // duration: 3000,
- // className: 'jy-toast',
- // });
- // return
- // }
- // if (status[0] === -1) {
- // //直接修改
- // $(".vip-footer.modify").show();
- // // doSubmit()
- // // initBack(1);
- // return
- // }
- // //区域需要升级
- // if (status[1]) {
- // if (reqData.isTrial) {
- // $(".area .tip").text("需购买");
- // }
- // $(".area .tip-need-upgrade").show();
- // }
- // //行业需要升级
- // if (status[2]) {
- // if (reqData.isTrial) {
- // $(".industry .tip").text("需购买");
- // }
- // $(".industry .tip-need-upgrade").show()
- // }
- // console.log(status[0],'111111')
- // if (status[0] > 0) {
- // //需要付钱
- // $(".vip-footer.upgrade").show();
- // //价格展示
- // var nowTime = new Date().getTime();
- // var startTime = live20200707.startTime;
- // var endTime = live20200707.endTime;
- // var activeDiscount = parseFloat(live20200707.activeDiscount);
- // var startTimes = parseInt(startTime) * 1000;
- // var endTimes = parseInt(endTime) * 1000;
- // if (nowTime >= startTimes && nowTime < endTimes) {
- // var price = status[0];
- // $(".price-num").text(price);
- // status[0] = parseFloat(price) * activeDiscount;
- // var activePrice = formatMoney(parseFloat(price) - parseFloat(price) * activeDiscount);
- // $(".reduce-price").text(formatMoney(activePrice));
- // // for (var i=0;i<status.length;i++){
- // // if(i===3){
- // // for (var a in status[i]){
- // // status[i][a].price = parseFloat(status[i][a].price) * activeDiscount;
- // // }
- // // }
- // // }
- // }
- // $(".vip-footer.upgrade .billing-price").text(formatMoney(status[0]));
- // submitPrice = status[0] * 10000 / 100
- // // 活动期间,则显示优惠码
- // if ($('.vip-upgrade').hasClass('live-20200707')) {
- // // 优惠码选项
- // $('.coupon-code-tx').show()
- // // 原价现价
- // $('.origin-price').css('display', 'flex')
- // // 优惠提示
- // $('.j-notice-bar.vip-bar').css('display', 'flex')
- // }
- // // coupon.updatePrice(status[0])
- // }
- // if (reqData.isTrial) {//试用购买
- // if ($("#giveTimeBox").hasClass('hasDoubleEleven')) {
- // $(".origin-price").css('display', 'flex')
- // $("#giveTimeBox").show()
- // $("#giveTimeText").text(giveCycle)
- // $('.origin-price .price-num').text(formatMoney(status[0] + givePrice));
- // // 优惠明细
- // $('.discount-price .dis-price').text(formatMoney(givePrice))
- // $('.now-price .dis-price').text(formatMoney(status[0]));
- // }
- // if (changeTime.length === 0) {
- // //刷新展示时间
- // changeTime = [1, 2];//
- // flushShowTime(true, "1个月");
- // sessionStorage.setItem("vip_trial_buy", true);
- // selectTime = "1个月"
- // }
- // initBack(4);
- // $(".vip-footer.upgrade .confirm").text("立即购买");
- // // coupon.$refs.couponRef.btnText = "立即购买"
- // } else if ((!status[1] && !status[2])) {//续费
- // initBack(2);
- // } else {//升级
- // //升级展示计价清单
- // if (!reqData.isTrial) {
- // $(".preview-label").text("需补差价:");
- // $(".billing-list-btn").text("计费清单");
- // $(".va-total-container .total-price").text("共计:¥" + formatMoney(status[0]));
- // flushSubtotal(status[3]);
- // console.log("subtotail", status[3])
- // }
- // // initBack(2);// 升级
- // }
- // } else {
- // }
- // getDataWitXHR()
- //返回提示使用
- function pushHistory() {
- var state = {
- title: "title",
- url: "#"
- };
- window.history.pushState(state, "title", "#");
- }
- function initBack(module) {
- pushHistory();
- //weui.toast(module);
- $('.vip-footer .button-l.reset').off("click").on("click", function () {
- $('.weui-mask').trigger('click')
- cancelTip(module);
- });
- window.addEventListener("popstate", function (e) {
- // 如果订单计费清单显示,则关闭清单;
- if ($(".billing-list-container").css("display") != "none" && module === 2) {
- pickerShow('.billing-list-container', false);
- pushHistory();
- } else {
- // 提示是否保存
- $('.weui-mask').trigger('click')
- var flagString = location.href.slice(-1)
- if (flagString === '#') return
- if (history.state && history.state.flag === "pay") {
- return
- }
- cancelTip(module);
- }
- }, false);
- }
- //保存 or 升级
- var submited = false;
- function doSubmit() {
- if (submited) {
- return
- }
- submited = true;
- setTimeout(function () {
- submited = false;
- }, 1000);
- //校验是否点击阅读条款
- // if (submitPrice > 0) {
- // if (!$('.checkbox').hasClass("checked")) {
- // weui.toast('请勾选服务条款', {
- // duration: 1500,
- // className: 'jy-toast',
- // });
- // $dialog.hide(function () {
- // });
- // return
- // }
- // }
- //优惠码
- var activeCode = $('.coupon-picker .weui-input').val();
- var activeCodes = "";
- if (activeCode.toLowerCase() === 'jianyu360' && $('.coupon-code-tx .keywords-text').text() === '支付成功赠送30天订阅周期') {
- activeCodes = 'jianyu360';
- }
- weui.loading()
- $DoPost('/subscribepay/vipsubscribe/saveChange', {
- "userLotteryId":coupon.$refs.couponRef.coupon.userLotteryId,
- "lotteryId": coupon.$refs.couponRef.coupon.lotteryId,
- "area": reqData.area["全国"] ? '{}' : JSON.stringify(reqData.area),
- "industry": reqData.industry.join(","),
- "time": selectTime,
- "price": (coupon.initPrice - coupon.$refs.couponRef.coupon.value)* 10000 / 100,
- "activeCode": activeCodes
- }, function (r) {
- if (r.success) {
- if (r.data.needPay) {
- weui.loading().hide()
- //创建支付订单
- clearSessionStorage();
- history.replaceState({"flag": "pay"}, '', '/front/vipsubscribe/toOrderDetailPage?orderCode=' + r.data.code);
- var nextHref = "/weixin/pay/checkout_subvip?orderCode=" + r.data.code
- if (reqData.isTrial) {
- nextHref += "&t=3"
- } else {
- nextHref += "&t=2"
- }
- window.location.href = nextHref
- } else {
- weui.loading().hide()
- //订阅修改
- if (r.data.doSuccess) {
- clearSessionStorage();
- getDataWitXHR()
- // clearSessionStorage();
- // window.location.reload();
- } else {
- weui.toast('修改保存失败', {
- duration: 1500,
- className: 'jy-toast',
- });
- }
- }
- }
- }, false);
- }
- // 活动事件绑定
- var couponInfo = {
- code: 'jianyu360',
- successTip: '支付成功赠送30天订阅周期'
- }
- $('.j-picker').on('click', '.cancel', function () {
- $('.coupon-picker').hide()
- })
- $('.coupon-code-tx').on('click', function () {
- if ($('.vip-upgrade').hasClass('live-20200707')) {
- $('.coupon-picker').show()
- } else {
- return
- }
- var input = $('.coupon-picker .weui-input')
- var confirmButton = $('.coupon-picker .weui-picker__btn')
- var cancelButton = $('.coupon-picker .cancel')
- var value = input.val()
- input.val('').focus().val(value).on('input', function () {
- value = this.value
- confirmButton.prop('disabled', (value === '' || value === undefined))
- })
- confirmButton.on('click', function () {
- if (value.toLowerCase() !== couponInfo.code) {
- weui.toast('优惠码输入错误', {
- className: 'j-toast',
- duration: 1500
- })
- return
- }
- if (value.length === couponInfo.code.length && value.toLowerCase() === couponInfo.code) {
- $('.coupon-code-tx .keywords-text').text(couponInfo.successTip)
- sessionStorage.liveActiveCode_new = "jianyu360"
- $('.coupon-code-tx').off('click')
- cancelButton.trigger('click')
- }
- })
- })
- });
- function clearSessionStorage() {
- sessionStorage.removeItem("sub_vip_state");
- sessionStorage.removeItem("vip_index_read");
- sessionStorage.removeItem("vip_change_time");
- sessionStorage.removeItem("vip_trial_buy");
- //续费页面缓存
- sessionStorage.removeItem("vipSubSelectArea");
- sessionStorage.removeItem("vipSubSelectIndustry");
- sessionStorage.removeItem("vipSubSelectTime");
- sessionStorage.removeItem("endTime");
- sessionStorage.removeItem("liveActiveCode_new");
- sessionStorage.removeItem("liveActiveCode_renew");
- }
- var mergedlist = []
- var merge_industry = ["国土", "林业", "环保", "卫生", "工商", "质监", "食药", "安监", "地震", "公安", "文化", "旅游", "银监", "保监"]
- function checkmerge(state, isread) {
- if (checkindustry(state)) {
- var tips = "<span style='font-size:15px;font-family:PingFang SC;font-weight:bold;color:rgba(29,29,29,1);opacity:1;'>随着政府机构改革和职能转变工作深入推进,部分采购单位行业与现实不一致,为了提高订阅推送数据的准确性,剑鱼标讯需要针对采购单位行业名称进行优化。</span><br><span style='font-size:13px;font-family:PingFang SC;font-weight:400;color:rgba(104,104,104,1);opacity:1;'>采购单位名称的调整不影响所购买的采购单位数量,您仍可按需调整。<br><br>您订阅的:<br></span>"
- var hasMerged = isread
- var s_count = h_count = m_count = p_count = cultural_count = CBRC_count = t_count = 0
- var nature_source = ["国土", "林业"];
- var health_commission = ["卫生"]
- var market_supervision = ["工商", "质监", "食药"]
- var contingency_management = ["安监", "地震", "公安"]
- var cultural_tourism = ["文化", "旅游"]
- var CBRC = ["银监", "保监"]
- var ecological_environment = ["环保"]
- state.forEach(function (item, index) {
- if (merge_industry.indexOf(item) > -1) {
- if (item == "国土" || item == "林业") {
- mergedlist.push("自然资源")
- // hasMerged = true
- nature_source = Highlight(nature_source, item)
- s_count++
- } else if (item == "环保") {
- mergedlist.push("生态环境")
- // hasMerged = true
- ecological_environment = Highlight(ecological_environment, item)
- h_count++
- } else if (item == "卫生") {
- mergedlist.push("卫健委")
- // hasMerged = true
- health_commission = Highlight(health_commission, item)
- p_count++
- } else if (item == "工商" || item == "质监" || item == "食药") {
- mergedlist.push("市场监管")
- // hasMerged = true
- market_supervision = Highlight(market_supervision, item)
- m_count++
- } else if (item == "地震" || item == "安监" || item == "公安") {
- if (item !== "公安") {
- mergedlist.push("应急管理")
- } else {
- mergedlist.push("公安")
- }
- // hasMerged = true
- contingency_management = Highlight(contingency_management, item)
- t_count++
- } else if (item == "文化" || item == "旅游") {
- mergedlist.push("文旅")
- // hasMerged = true
- cultural_tourism = Highlight(cultural_tourism, item)
- cultural_count++
- } else if (item == "银监" || item == "保监") {
- mergedlist.push("银保监")
- // hasMerged = true
- CBRC = Highlight(CBRC, item)
- CBRC_count++
- }
- } else {
- mergedlist.push(item)
- }
- })
- if (s_count >= 1) {
- tips += nature_source.join('、') + " 合并为 【自然资源】<br>"
- }
- if (h_count >= 1) {
- tips += ecological_environment.join('、') + " 整合其他部门部分职能后更改为 【生态环境】<br>"
- }
- if (p_count >= 1) {
- tips += health_commission.join('、') + " 变更为 【卫健委】<br>"
- }
- if (m_count >= 1) {
- tips += market_supervision.join('、') + " 合并为 【市场监管】<br>"
- }
- if (t_count >= 1) {
- tips += contingency_management.join('、') + "中的消防 合并为 【应急管理】<br>"
- }
- if (cultural_count >= 1) {
- tips += cultural_tourism.join('、') + " 合并为 【文旅】<br>"
- }
- if (CBRC_count >= 1) {
- tips += CBRC.join('、') + " 合并为 【银保监】<br>"
- }
- if (!hasMerged) {
- $("#merge_content").html(tips)
- $("#merge_dialog").show()
- }
- }
- }
- function Highlight(a_list, key) {
- a_list.forEach(function (item, index) {
- if (item == key) {
- var m = "<span style='color:red'>" + item + "</span>"
- a_list[index] = m
- }
- })
- return a_list
- }
- function acceptchange() {
- var q = removeDuplicatedItem(mergedlist)
- $.post("/subscribepay/vipsubscribe/mergeIndustry", {"industry": q.toString(), "isread": true}, function (r) {
- if (r.success) {
- sessionStorage.removeItem("sub_vip_state")
- console.log("行业合并成功")
- } else {
- console.log("行业合并失败")
- }
- })
- $("#merge_dialog").hide()
- }
- function removeDuplicatedItem(ar) {
- var ret = [];
- for (var i = 0, j = ar.length; i < j; i++) {
- if (ret.indexOf(ar[i]) === -1) {
- ret.push(ar[i]);
- }
- }
- return ret;
- }
- function checkindustry(industry) {
- var isinclude = false
- industry.forEach(function (item, index) {
- if (merge_industry.indexOf(item) > -1) {
- isinclude = true
- return
- }
- })
- return isinclude
- }
- // 解决ios微信下软键盘收起后,页面留白
- document.body.addEventListener("focusout", function () {
- //软键盘收起的事件处理
- setTimeout(function () {
- const scrollHeight =
- document.documentElement.scrollTop || document.body.scrollTop || 0;
- window.scrollTo(0, Math.max(scrollHeight - 1, 0));
- }, 100);
- });
|