function getShortName (comName) { var areaMap = chinaMapJSON || [] var shortname = comName // 1. 循环省份城市进行替换 areaMap.forEach(function (item) { var p = item.name.replace(/[省市]/, '') if (shortname.indexOf(p) !== -1) { shortname = shortname.replace(item.name, '').replace(p, '') console.log(p + ' -> \'\'') } item.city.forEach(function (iitem) { var c = iitem.name.replace(/[省市]/, '') if (shortname.indexOf(c) !== -1) { shortname = shortname.replace(iitem.name, '').replace(c, '') console.log(c + ' -> \'\'') } iitem.area.forEach(function (iiitem) { if (shortname.indexOf(iiitem) !== -1) { shortname = shortname.replace(iiitem, '') console.log(iiitem + ' -> \'\'') } }) }) }) var matchRes = shortname.match(/[\u4e00-\u9fa5]{4}/gm) var shortname = matchRes ? matchRes[0] : shortname.slice(0, 4) if (shortname.length < 4) { shortname = shortname.slice(0, 4) } return shortname } var vm = new Vue({ el: '.see-container', delimiters: ['{', '}'], data () { return { working: false, empty: false, dateVal: '', years: '', months: '', points: {}, statusEnum: ['存续', '吊销', '注销', '撤销'], statusColors: ['#2CB7CA', '#F5AF5C', '#58A1E7', '#51CEA2'], seeList: { pageNum: 1, // 当前页 pageSize: 10, // 每页多少条数据 total: 0, // 总页数 list: [] // 返回的数据 }, helpDialog: false, tipDialog: false } }, computed: { dialogBtnText: function() { if (this.points.provin == -1) { return '联系客服' } else { return '前往升级' } } }, created () { this.years = new Date().getFullYear() this.months = parseInt(new Date().getMonth() + 1) this.dateVal = new Date() this.subPoint() this.subRecord() }, methods: { showTip () { this.tipDialog = true }, goHandle (item) { if (item == '前往升级') { window.open('/swordfish/page_big_pc/free/svip/buy?type=upgrade') this.tipDialog = false } else { $('.open-customer').unbind('click').trigger('click') this.tipDialog = false } }, subPoint () { var _this = this $.ajax({ url: '/bigmember/portrait/subVipPortrait/usage?p_type=1', type: 'POST', contentType: 'application/x-www-form-urlencoded', data: '', dataType: 'json' }).done(res => { if (res.error_code == 0) { _this.points = res.data if (res.data.total == res.data.usage) { _this.tipDialog = true } } }) }, getDatas () { return { year: this.years, month: this.months, pageSize: this.seeList.pageSize, pageNum: this.seeList.pageNum - 1, p_type: 1 } }, subRecord () { this.working = true this.empty = false $.ajax({ url: '/bigmember/portrait/subVipPortrait/record', type: 'POST', contentType: 'application/x-www-form-urlencoded', data: this.getDatas(), dataType: 'json' }).done(res => { var _this = this if (res.error_code === 0) { this.working = false this.empty = true if (res.data.total) { this.seeList.total = res.data.total } if (!res.data.list) { res.data.list = [] return } this.seeList.list = this.seeList.list.concat(res.data.list.map(function (v) { return { name: v.name, province: v.province, city: v.city, buyerclass: v.buyerclass, checked: false } })) } }) }, onPageChange (page) { this.seeList.pageNum = page this.seeList.list = [] this.subRecord() }, dateHandler (val) { this.years = val.getFullYear() this.months = val.getMonth() + 1 this.seeList.pageNum = 1 this.seeList.list = [] this.subRecord() }, detailed (ids) { window.open('/swordfish/page_big_pc/unit_portrayal/' + ids, '_blank') } } })