123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159 |
- 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')
- }
- }
- })
|