123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339 |
- var vm = new Vue({
- el: '#select-meau',
- components: {
- dateComponent: dateComponent,
- areaCityMobile: areaCityMobileComponent,
- industryComponent: industryComponent,
- cateComponent: cateComponent,
- keywordComponent: keywordComponent,
- noticeComponent: noticeComponent,
- rootComponent: rootComponent
- },
- data () {
- return {
- sessStorageKey: '$data-historypush',
- // 时间参数
- time:'',
- // 选择的时间数据
- selectDate: {
- startDate: '',
- endDate: '',
- exact: ''
- },
- // 地区参数
- area: '',
- // 城市
- city: '',
- // 行业参数
- subscopeclass: '',
- // 采购单位
- buyerclass: '',
- // 关键词
- key: '',
- // 公告类型
- subtype: '',
- screenShow: false,
- tagText: {
- timeText: '时间',
- areaText: '地区',
- industryText: '行业',
- cateText: '采购单位',
- keywordText: '关键词',
- noticeText: '公告类型'
- },
- selectCateList: [], // 选择的采购单位类型列表
- selectAreaList: {}, // 选择的地区列表
- selectIndustryList: [], // 选择的行业列表
- selectKeyWordList: [], // 选择的关键词列表
- selectNoticeList: [], // 选择的公告类型列表
- setTimer: {
- datetimer: '',
- areatimer: '',
- catetimer: '',
- industrytimer: '',
- keytimer: '',
- noticetimer: ''
- },
- iosMeauStyle: false,
- goUpText: ''
- }
- },
- created () {
- this.getUserRoot()
- if (firstTime) {
- firstTime = `${firstTime}_${firstTime}`
- this.time = firstTime
- this.setPushTime(firstTime)
- } else {
- firstTime = this.time
- }
- },
- mounted () {
- var recover = this.recover()
- if (!recover) {
- setTimeout(() => {
- // 如果订阅消息进来时间不为空
- if(this.time !== '') {
- this.setPushTime(this.time)
- this.revorceOtherData()
- }else{
- // 清空筛选数据
- this.revorceData()
- }
- })
- }
- // utils.iosBackRefresh()
- },
- methods: {
- recover: function () {
- var excludeKey = ['sessStorageKey']
- var $data = sessionStorage.getItem(this.sessStorageKey)
- if ($data) {
- $data = JSON.parse($data)
- for (var key in $data) {
- if (excludeKey.indexOf(key) !== -1) {
- continue
- }
- this.$data[key] = $data[key]
- }
- const res = $data
- // 时间
- console.log(res)
- if(res.time != '') {
- this.selectDate.startDate = res.time.split('_')[0] * 1000
- this.selectDate.endDate= res.time.split('_')[1] * 1000
- }
- // 地区
- if(res.area || res.city) {
- setTimeout(() => {
- this.$refs.areaCitySelector.setState(this.selectAreaList)
- $('.areaText').html(res.tagText.areaText)
- }, 0)
- }
- // 采购单位类型
- if(res.buyerclass != '') {
- setTimeout(() => {
- $('.cateText').html(res.tagText.cateText)
- })
- this.selectCateList = res.buyerclass.split(',')
- }
- // 行业
- if(res.subscopeclass != '') {
- setTimeout(() => {
- $('.industryText').html(res.tagText.industryText)
- })
- this.selectIndustryList = res.subscopeclass.split(',')
- }
- // 关键词
- if(res.key != '') {
- setTimeout(() => {
- $('.keywordText').html(res.tagText.keywordText)
- })
- this.selectKeyWordList = res.key.split(',')
- }
- // 公告类型
- if(res.subtype != '') {
- setTimeout(() => {
- $('.noticeText').html(res.tagText.noticeText)
- })
- this.selectNoticeList = res.subtype.split(',')
- }
- sessionStorage.removeItem(this.sessStorageKey)
- }
- return !!$data
- },
- // 清空筛选数据
- revorceData: function() {
- this.time = ''
- this.area = ''
- this.city = ''
- this.subtype = ''
- this.subscopeclass = ''
- this.key = ''
- this.buyerclass = ''
- },
- revorceOtherData: function() {
- this.area = ''
- this.city = ''
- this.subtype = ''
- this.subscopeclass = ''
- this.key = ''
- this.buyerclass = ''
- },
- open: function(name) {
- this.goUpText = name
- },
- close: function() {
- this.iosMeauStyle = false
- },
- // 订阅推送消息展示数据
- setPushTime: function(time) {
- let pushtime = {
- start: parseInt(time.split('_')[0] * 1000),
- end: parseInt(time.split('_')[0] * 1000),
- }
- this.tagText.timeText = new Date(pushtime.end).pattern('yyyy.MM.dd')
- this.selectDate.startDate = pushtime.start
- this.selectDate.endDate= pushtime.end
- this.selectDate.exact = 'exact'
- },
- // 判断是否是有筛选条件
- getUserRoot: function() {
- let _this = this
- $.ajax({
- url: '/publicapply/bidcoll/power',
- type: 'POST',
- success: function(res) {
- // 如果是商机管理、大会员、超级订阅会员有筛选权限
- if(res.data.entniche || res.data.member || res.data.vip > 0) {
- _this.screenShow = true
- } else {
- _this.screenShow = false
- }
- }
- })
- },
- confirm: function(data){
- console.log(data)
- if(data.name === 'dateItem'){
- const timeRange = {
- start: (data.data.start / 1000).toFixed(0),
- end: (data.data.end / 1000).toFixed(0)
- }
- if (timeRange.start == 0 && timeRange.end == 0) {
- this.time = ''
- this.tagText.timeText = '时间'
- } else if(timeRange.start == 0 && timeRange.end != 0) {
- this.time = '_' + timeRange.end
- } else if(timeRange.start != 0 && timeRange.end == 0) {
- this.time = timeRange.start + '_'
- } else {
- this.time = timeRange.start + '_' + timeRange.end
- }
- this.selectDate.exact = data.data.exact
- switch (data.data.exact) {
- case 'all': {
- this.tagText.timeText = '时间'
- break
- }
- case 'lately7': {
- this.tagText.timeText = '最近7天'
- break
- }
- case 'lately30': {
- this.tagText.timeText = '最近30天'
- break
- }
- case 'lastYear': {
- this.tagText.timeText = '去年'
- break
- }
- case 'exact': {
- this.tagText.timeText = new Date(timeRange.end*1000).pattern('yyyy.MM.dd')
- break
- }
- }
- } else if(data.name === 'areaCityItem'){
- var areaCityRes = data.data
- var count = data.count
- this.selectAreaList = areaCityRes
- if (!areaCityRes || Object.keys(areaCityRes).length === 0) {
-
- } else {
- var obj = {
- p: [], // 省份全选
- c: [] // 所有的市
- }
- for (var key in areaCityRes) {
- if (areaCityRes[key].length === 0) {
- obj.p.push(key)
- } else {
- obj.c = obj.c.concat(areaCityRes[key])
- }
- }
- $('.areaText').text('地区 ' + count)
- this.tagText.areaText = '地区 ' + count
- this.area = obj.p.join(',')
- this.city = obj.c.join(',')
- }
- } else if(data.name === 'industryItem'){
- $('.industryText').html(data.t)
- this.tagText.industryText = data.t
- this.subscopeclass = data.data.join(',')
- } else if(data.name === 'cateItem'){
- $('.cateText').html('采购单位' + data.t)
- this.tagText.cateText = '采购单位' + data.t
- this.buyerclass = data.data.join(',')
- } else if(data.name === 'keywordItem'){
- $('.keywordText').html(data.t)
- this.tagText.keywordText = data.t
- this.key = data.data.join(',')
- } else if(data.name === 'noticeItem'){
- $('.noticeText').html(data.t)
- this.tagText.noticeText = data.t
- this.subtype = data.data.join(',')
- } else if(data.name === 'rootItem'){
- try {
- _hmt.push(['_trackEvent','超级订阅-wx', 'click', '推送列表页' + this.goUpText + '-去开通']);
- } catch (e) {
- console.log('未初始化百度统计')
- }
- topay()
- } else {
- return console.log('暂无数据')
- }
- this.setToggle()
- setTimeout(()=>{
- this.getAjaXParams()
- }, 500)
- },
- cancel: function(data){
- console.log(data)
- if(data.name === 'dateItem'){
- this.time = ''
- this.tagText.timeText = '时间'
- this.selectDate.start = ''
- this.selectDate.end = ''
- this.selectDate.exact = 'all'
- this.setTimer.datetimer = new Date().getTime()
- } else if(data.name === 'areaCityItem'){
- this.area = ''
- this.city = ''
- $('.areaText').html('地区')
- this.setTimer.areatimer = new Date().getTime()
- } else if(data.name === 'industryItem'){
- this.subscopeclass = ''
- $('.industryText').html('行业')
- this.setTimer.industrytimer = new Date().getTime()
- } else if(data.name === 'cateItem'){
- this.buyerclass = ''
- $('.cateText').html('采购单位')
- this.setTimer.catetimer = new Date().getTime()
- } else if(data.name === 'keywordItem'){
- this.key = ''
- $('.keywordText').html('关键词')
- this.setTimer.keytimer = new Date().getTime()
- } else if(data.name === 'noticeItem'){
- this.subtype = ''
- $('.noticeText').html('公告类型')
- this.setTimer.noticetimer = new Date().getTime()
- }
- this.setToggle()
- setTimeout(()=>{
- this.getAjaXParams()
- }, 500)
- },
- getAjaXParams: function() {
- ajaxFun(this.time, this.area, this.city, this.subscopeclass, this.buyerclass, this.key, this.subtype)
- },
- setToggle: function() {
- this.$refs.dateItem.toggle(false)
- this.$refs.areaCityItem.toggle(false)
- this.$refs.industryItem.toggle(false)
- this.$refs.cateItem.toggle(false)
- this.$refs.keywordItem.toggle(false)
- this.$refs.noticeItem.toggle(false)
- }
- }
- })
|