debug.php 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. <div id="app">
  2. <div class="content">
  3. <el-button
  4. :loading="submitLoading"
  5. class="button-item"
  6. size="small"
  7. type="primary"
  8. @click="updateStoreConfirm"
  9. >
  10. 更新全部选品({{ storeCount }})
  11. </el-button>
  12. </div>
  13. </div>
  14. <script>
  15. const app = new Vue({
  16. el: '#app',
  17. data() {
  18. return {
  19. storeCount: 0,
  20. submitLoading: false,
  21. }
  22. },
  23. mounted: function () {
  24. this.getStoreCount()
  25. },
  26. methods: {
  27. /**
  28. * 更新前提示
  29. */
  30. updateStoreConfirm() {
  31. if (this.storeCount > 1000) {
  32. this.$confirm('当前选片较多, 更新入比较耗时, 是否继续更新?', '提示', {
  33. confirmButtonText: '确定',
  34. cancelButtonText: '取消',
  35. type: 'warning'
  36. }).then(() => {
  37. this.updateStore()
  38. }).catch(() => {
  39. })
  40. } else {
  41. this.updateStore()
  42. }
  43. },
  44. /**
  45. * 更新全部选品
  46. */
  47. updateStore() {
  48. request({
  49. params: {
  50. r: 'qi-juhe/default/debug',
  51. },
  52. method: 'post',
  53. data: {
  54. type: 'updateStore'
  55. }
  56. }).then(e => {
  57. if (e.data.code == 0) {
  58. this.$message.success('后台更新中');
  59. }
  60. })
  61. },
  62. /**
  63. * 获取选品数量
  64. */
  65. getStoreCount() {
  66. request({
  67. params: {
  68. r: 'qi-juhe/default/debug',
  69. },
  70. method: 'post',
  71. data: {
  72. type: 'storeCount'
  73. }
  74. }).then(e => {
  75. if (e.data.code == 0) {
  76. this.storeCount = e.data.data
  77. }
  78. })
  79. },
  80. },
  81. })
  82. </script>
  83. <style>
  84. .content {
  85. margin: 100px;
  86. }
  87. </style>