index-pc.js 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. function getShortName (comName) {
  2. var areaMap = chinaMapJSON || []
  3. var shortname = comName
  4. // 1. 循环省份城市进行替换
  5. areaMap.forEach(function (item) {
  6. var p = item.name.replace(/[省市]/, '')
  7. if (shortname.indexOf(p) !== -1) {
  8. shortname = shortname.replace(item.name, '').replace(p, '')
  9. console.log(p + ' -> \'\'')
  10. }
  11. item.city.forEach(function (iitem) {
  12. var c = iitem.name.replace(/[省市]/, '')
  13. if (shortname.indexOf(c) !== -1) {
  14. shortname = shortname.replace(iitem.name, '').replace(c, '')
  15. console.log(c + ' -> \'\'')
  16. }
  17. iitem.area.forEach(function (iiitem) {
  18. if (shortname.indexOf(iiitem) !== -1) {
  19. shortname = shortname.replace(iiitem, '')
  20. console.log(iiitem + ' -> \'\'')
  21. }
  22. })
  23. })
  24. })
  25. var matchRes = shortname.match(/[\u4e00-\u9fa5]{4}/gm)
  26. var shortname = matchRes ? matchRes[0] : shortname.slice(0, 4)
  27. if (shortname.length < 4) {
  28. shortname = shortname.slice(0, 4)
  29. }
  30. return shortname
  31. }
  32. var vm = new Vue({
  33. el: '.see-container',
  34. delimiters: ['{', '}'],
  35. data () {
  36. return {
  37. dateVal: '',
  38. years: '',
  39. months: '',
  40. points: [],
  41. statusEnum: ['存续', '吊销', '注销', '撤销'],
  42. statusColors: ['#2CB7CA', '#F5AF5C', '#58A1E7', '#51CEA2'],
  43. listInfo: {
  44. value: '',
  45. pageNum: 0,
  46. pageSize: 10,
  47. total: -1,
  48. loading: true,
  49. finished: false
  50. },
  51. seeList: []
  52. }
  53. },
  54. created() {
  55. this.years = new Date().getFullYear()
  56. this.months = parseInt(new Date().getMonth() + 1)
  57. // this.dateVal = this.years + '年' + this.months + '月'
  58. this.dateVal = new Date()
  59. this.subPoint()
  60. this.subRecord()
  61. },
  62. methods: {
  63. subPoint() {
  64. $.ajax({
  65. url: '/bigmember/portrait/subVipPortrait/usage',
  66. type: 'POST',
  67. contentType: 'application/x-www-form-urlencoded',
  68. data: '',
  69. dataType: 'json'
  70. }).done(res => {
  71. if (res.error_code == 0) {
  72. this.points = res.data
  73. }
  74. })
  75. },
  76. getDatas() {
  77. return {
  78. year: this.years,
  79. month: this.months,
  80. pageSize: this.listInfo.pageSize,
  81. pageNum: this.listInfo.pageNum
  82. }
  83. },
  84. subRecord() {
  85. $.ajax({
  86. url: '/bigmember/portrait/subVipPortrait/record',
  87. type: 'POST',
  88. contentType: 'application/x-www-form-urlencoded',
  89. data: this.getDatas(),
  90. dataType: 'json'
  91. }).done(res => {
  92. var _this = this
  93. if (res.error_code == 0 && res.data.list) {
  94. res.data.list.forEach(v => {
  95. const arrs = {
  96. name: v.company_name,
  97. abbr: getShortName(v.company_name),
  98. color: _this.statusColors[Math.floor(Math.random() * _this.statusColors.length)],
  99. legal: v.legal_person,
  100. money: v.capital,
  101. phone: v.company_phone,
  102. time: v.establishStamp,
  103. address: v.company_address,
  104. _id: v.id,
  105. status: _this.statusEnum.indexOf(v.company_status) || 0,
  106. statusWord: v.company_status,
  107. checked: false
  108. }
  109. this.seeList.push(arrs)
  110. })
  111. }
  112. })
  113. },
  114. dateHandler(val) {
  115. this.years = val.getFullYear()
  116. this.months = val.getMonth() + 1
  117. this.listInfo.pageNum = 0
  118. this.seeList = []
  119. this.subRecord()
  120. },
  121. detailed(ids) {
  122. window.open('/swordfish/page_big_pc/svip/ent_ser_portrait/' + ids, '_blank')
  123. }
  124. }
  125. })