| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192 |
- <div id="app">
- <div class="content">
- <el-button
- :loading="submitLoading"
- class="button-item"
- size="small"
- type="primary"
- @click="updateStoreConfirm"
- >
- 更新全部选品({{ storeCount }})
- </el-button>
- </div>
- </div>
- <script>
- const app = new Vue({
- el: '#app',
- data() {
- return {
- storeCount: 0,
- submitLoading: false,
- }
- },
- mounted: function () {
- this.getStoreCount()
- },
- methods: {
- /**
- * 更新前提示
- */
- updateStoreConfirm() {
- if (this.storeCount > 1000) {
- this.$confirm('当前选片较多, 更新入比较耗时, 是否继续更新?', '提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning'
- }).then(() => {
- this.updateStore()
- }).catch(() => {
- })
- } else {
- this.updateStore()
- }
- },
- /**
- * 更新全部选品
- */
- updateStore() {
- request({
- params: {
- r: 'qi-juhe/default/debug',
- },
- method: 'post',
- data: {
- type: 'updateStore'
- }
- }).then(e => {
- if (e.data.code == 0) {
- this.$message.success('后台更新中');
- }
- })
- },
- /**
- * 获取选品数量
- */
- getStoreCount() {
- request({
- params: {
- r: 'qi-juhe/default/debug',
- },
- method: 'post',
- data: {
- type: 'storeCount'
- }
- }).then(e => {
- if (e.data.code == 0) {
- this.storeCount = e.data.data
- }
- })
- },
- },
- })
- </script>
- <style>
- .content {
- margin: 100px;
- }
- </style>
|