popup-data-export.js 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. Vue.component('popup-data-export', {
  2. delimiters: ['@@', '@@'],
  3. template: `
  4. <div class="popupDataexport">
  5. <van-popup v-model="show">
  6. <div class="warm">
  7. <div class="close" @click="show = false"></div>
  8. <div class="content_box">
  9. <p class="title">温馨提示</p>
  10. <div class="text_box">您选择的数据超过了导出数据最大值<span class="blue">20,000</span>,请优化条件后导出。您也可联系客服:<span @click="callPhone('400-108-6670')">400-108-6670</span>,或添加<span class="blue">客服微信</span>进行定制化导出。</div>
  11. <div class="qr_box">
  12. <img :src="img" alt="">
  13. </div>
  14. <div class="desc">客服微信</div>
  15. <div class="btn_box">
  16. <div class="btn"><div :class="choose?'choosed':'nochoose'" @click="btnClick"></div></div>
  17. <p class="text">后续不再提醒</p>
  18. </div>
  19. </div>
  20. <div class="footer" @click="next">
  21. <span>继续导出20000条</span>
  22. </div>
  23. </div>
  24. </van-popup>
  25. </div>
  26. `,
  27. props: {
  28. },
  29. data: function () {
  30. return {
  31. show: false,
  32. choose:false,
  33. img:'',
  34. isPrompt:true
  35. }
  36. } ,
  37. created (){
  38. let this_ = this
  39. this.getqr()
  40. $.ajax({
  41. type: 'POST',
  42. url:this_.isWX ? '/front/dataExport/getDontPromptAgain' : '/jyapp/front/dataExport/getDontPromptAgain',
  43. success: function (res) {
  44. if(!res){return}
  45. this_.isPrompt = res.isPrompt
  46. },
  47. error: function (error) {
  48. }
  49. })
  50. },
  51. mounted () {
  52. },
  53. computed: {
  54. isWX () {
  55. if (navigator.userAgent.toLowerCase().indexOf('micromessenger') !== -1) {
  56. return true
  57. }else{
  58. return false
  59. }
  60. }
  61. },
  62. methods: {
  63. getqr () {
  64. let _this = this
  65. $.ajax({
  66. type: 'POST',
  67. url: '/bigmember/use/isAdd?t=' + Date.now(),
  68. success: function (res) {
  69. if(!res.data){return}
  70. if(res.data.customers&&res.data.customers.length>0){
  71. let list = res.data.customers
  72. list.forEach(e => {
  73. if(e.remark === '客户经理'){
  74. _this.img = e.wxer
  75. }
  76. })
  77. if(_this.img == ''){
  78. _this.img = customer[0].wxer
  79. }
  80. }
  81. },
  82. error: function (error) {
  83. }
  84. })
  85. },
  86. btnClick(){
  87. this.choose = !this.choose
  88. this.setDontPrompt()
  89. },
  90. next(){
  91. this.$emit('next',{choose:this.choose})
  92. },
  93. setDontPrompt: debounce_(function(){
  94. let this_ = this
  95. let url_ = this.isWX ? '/front/dataExport/setDontPromptAgain' : '/jyapp/front/dataExport/setDontPromptAgain'
  96. if(this.choose){
  97. $.ajax({
  98. type: 'POST',
  99. url: url_,
  100. data: {status:1},
  101. contentType: 'application/x-www-form-urlencoded',
  102. success: function (res) {
  103. this_.isPrompt = true
  104. },
  105. error: function (error) {
  106. }
  107. })
  108. }else{
  109. $.ajax({
  110. type: 'POST',
  111. url: url_,
  112. data: {status:0},
  113. contentType: 'application/x-www-form-urlencoded',
  114. success: function (res) {
  115. this_.isPrompt = false
  116. },
  117. error: function (error) {
  118. }
  119. })
  120. }
  121. },300),
  122. callPhone: function (tel) {
  123. if (navigator.userAgent.toLowerCase().indexOf('micromessenger') !== -1) { // 微信
  124. location.href = 'tel:' + tel
  125. } else {
  126. try {
  127. JyObj.callPhone(tel);
  128. } catch (error) {
  129. console.log(error)
  130. }
  131. }
  132. },
  133. }
  134. })
  135. function debounce_ (func, delay, immediate){
  136. var timer = null;
  137. delay = delay || 200
  138. return function() {
  139. var context = this;
  140. var args = arguments;
  141. if(timer) clearTimeout(timer);
  142. if(immediate){
  143. var doNow = !timer;
  144. timer = setTimeout(function(){
  145. timer = null;
  146. },delay);
  147. if(doNow){
  148. func.apply(context,args);
  149. }
  150. }else{
  151. timer = setTimeout(function(){
  152. func.apply(context,args);
  153. },delay);
  154. }
  155. }
  156. }