index-pc.js 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  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. helpDialog: false,
  52. tipDialog: false
  53. }
  54. },
  55. computed: {
  56. dialogBtnText: function() {
  57. if (this.points.provin == -1) {
  58. return '联系客服'
  59. } else {
  60. return '前往升级'
  61. }
  62. }
  63. },
  64. created () {
  65. this.years = new Date().getFullYear()
  66. this.months = parseInt(new Date().getMonth() + 1)
  67. this.dateVal = new Date()
  68. this.subPoint()
  69. this.subRecord()
  70. },
  71. methods: {
  72. showTip () {
  73. this.tipDialog = true
  74. },
  75. goHandle (item) {
  76. if (item == '前往升级') {
  77. window.open('/swordfish/page_big_pc/free/svip/buy?type=upgrade')
  78. this.tipDialog = false
  79. } else {
  80. $('.open-customer').unbind('click').trigger('click')
  81. this.tipDialog = false
  82. }
  83. },
  84. subPoint () {
  85. var _this = this
  86. $.ajax({
  87. url: '/bigmember/portrait/subVipPortrait/usage?p_type=1',
  88. type: 'POST',
  89. contentType: 'application/x-www-form-urlencoded',
  90. data: '',
  91. dataType: 'json'
  92. }).done(res => {
  93. if (res.error_code == 0) {
  94. _this.points = res.data
  95. if (res.data.total == res.data.usage) {
  96. _this.tipDialog = true
  97. }
  98. }
  99. })
  100. },
  101. getDatas () {
  102. return {
  103. year: this.years,
  104. month: this.months,
  105. pageSize: this.seeList.pageSize,
  106. pageNum: this.seeList.pageNum - 1,
  107. p_type: 1
  108. }
  109. },
  110. subRecord () {
  111. this.working = true
  112. this.empty = false
  113. $.ajax({
  114. url: '/bigmember/portrait/subVipPortrait/record',
  115. type: 'POST',
  116. contentType: 'application/x-www-form-urlencoded',
  117. data: this.getDatas(),
  118. dataType: 'json'
  119. }).done(res => {
  120. var _this = this
  121. if (res.error_code === 0) {
  122. this.working = false
  123. this.empty = true
  124. if (res.data.total) {
  125. this.seeList.total = res.data.total
  126. }
  127. if (!res.data.list) {
  128. res.data.list = []
  129. return
  130. }
  131. this.seeList.list = this.seeList.list.concat(res.data.list.map(function (v) {
  132. return {
  133. name: v.name,
  134. province: v.province,
  135. city: v.city,
  136. buyerclass: v.buyerclass,
  137. checked: false
  138. }
  139. }))
  140. }
  141. })
  142. },
  143. onPageChange (page) {
  144. this.seeList.pageNum = page
  145. this.seeList.list = []
  146. this.subRecord()
  147. },
  148. dateHandler (val) {
  149. this.years = val.getFullYear()
  150. this.months = val.getMonth() + 1
  151. this.seeList.pageNum = 1
  152. this.seeList.list = []
  153. this.subRecord()
  154. },
  155. detailed (ids) {
  156. window.open('/swordfish/page_big_pc/unit_portrayal/' + ids, '_blank')
  157. }
  158. }
  159. })