index-pc.js 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  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. working: false,
  38. empty: false,
  39. dateVal: '',
  40. years: '',
  41. months: '',
  42. points: [],
  43. statusEnum: ['存续', '吊销', '注销', '撤销'],
  44. statusColors: ['#2CB7CA', '#F5AF5C', '#58A1E7', '#51CEA2'],
  45. seeList: {
  46. pageNum: 1, // 当前页
  47. pageSize: 10, // 每页多少条数据
  48. total: 0, // 总页数
  49. list: [] // 返回的数据
  50. }
  51. }
  52. },
  53. created() {
  54. this.years = new Date().getFullYear()
  55. this.months = parseInt(new Date().getMonth() + 1)
  56. this.dateVal = new Date()
  57. this.subPoint()
  58. this.subRecord()
  59. },
  60. methods: {
  61. subPoint() {
  62. $.ajax({
  63. url: '/bigmember/portrait/subVipPortrait/usage?p_type=1',
  64. type: 'POST',
  65. contentType: 'application/x-www-form-urlencoded',
  66. data: '',
  67. dataType: 'json'
  68. }).done(res => {
  69. if (res.error_code == 0) {
  70. this.points = res.data
  71. }
  72. })
  73. },
  74. getDatas() {
  75. return {
  76. year: this.years,
  77. month: this.months,
  78. pageSize: this.seeList.pageSize,
  79. pageNum: this.seeList.pageNum - 1,
  80. p_type:1
  81. }
  82. },
  83. subRecord() {
  84. this.working = true
  85. this.empty = false
  86. $.ajax({
  87. url: '/bigmember/portrait/subVipPortrait/record',
  88. type: 'POST',
  89. contentType: 'application/x-www-form-urlencoded',
  90. data: this.getDatas(),
  91. dataType: 'json'
  92. }).done(res => {
  93. var _this = this
  94. if (res.error_code === 0) {
  95. this.working = false
  96. this.empty = true
  97. if (res.data.total) {
  98. this.seeList.total = res.data.total
  99. }
  100. if (!res.data.list){
  101. res.data.list=[]
  102. }
  103. this.seeList.list = this.seeList.list.concat(res.data.list.map(function (v) {
  104. return {
  105. name: v.name,
  106. province: v.province,
  107. city: v.city,
  108. buyerclass: v.buyerclass,
  109. checked: false
  110. }
  111. }))
  112. }
  113. })
  114. },
  115. onPageChange(page) {
  116. this.seeList.pageNum = page
  117. this.seeList.list = []
  118. this.subRecord()
  119. },
  120. dateHandler(val) {
  121. this.years = val.getFullYear()
  122. this.months = val.getMonth() + 1
  123. this.seeList.pageNum = 1
  124. this.seeList.list = []
  125. this.subRecord()
  126. },
  127. detailed(ids) {
  128. window.open('/swordfish/page_big_pc/unit_portrayal/' + ids, '_blank')
  129. }
  130. }
  131. })