新增批量下载桌码

This commit is contained in:
gyq 2024-06-14 11:42:07 +08:00
parent 313ec6e6f9
commit 2026193f0f
8 changed files with 32 additions and 19 deletions

View File

@ -1,6 +1,7 @@
ENV = 'development'
# 接口地址
# VUE_APP_BASE_API = 'http://192.168.2.202:8000'
# VUE_APP_BASE_API = 'http://192.168.2.42:8000'
# VUE_APP_BASE_API = 'http://192.168.2.133:8000'
VUE_APP_BASE_API = 'https://admintestpapi.sxczgkj.cn'

View File

@ -2,8 +2,8 @@ ENV = 'production'
# 如果使用 Nginx 代理后端接口,那么此处需要改为 '/',文件查看 Docker 部署篇Nginx 配置
# 接口地址,注意协议,如果你没有配置 ssl需要将 https 改为 http
VUE_APP_BASE_API = 'https://cashieradmin.sxczgkj.cn'
# VUE_APP_BASE_API = 'https://admintestpapi.sxczgkj.cn'
# VUE_APP_BASE_API = 'https://cashieradmin.sxczgkj.cn'
VUE_APP_BASE_API = 'https://admintestpapi.sxczgkj.cn'
# VUE_APP_BASE_API = 'http://192.168.2.98:8000'
# 如果接口是 http 形式, wss 需要改为 ws
VUE_APP_WS_API = 'wss://123.56.110.252

View File

@ -79,8 +79,9 @@ export function tbShopTableDelete(data) {
*/
export function downloadTableCode(data) {
return request({
url: `/api/tbShopTable`,
url: `/api/deviceStock/batchDownload`,
method: "post",
data
data,
responseType: "blob"
});
}

View File

@ -107,7 +107,7 @@ export default {
this.loading = true
try {
const res = await queryAllShopUser({
telephone: query,
name: query,
})
this.loading = false
this.options = res.content

View File

@ -119,7 +119,7 @@ export default {
tableData: {
data: [],
page: 0,
size: 10,
size: 30,
loading: false,
total: 0
}

View File

@ -1,8 +1,8 @@
<template>
<el-dialog title="下载桌码" width="400px" :visible.sync="dialogVisible" @close="reset">
<el-dialog title="下载桌码" width="400px" :visible.sync="dialogVisible" @open="reset">
<el-form ref="form" :model="form" label-position="left">
<el-form-item label="下载数量">
<el-input-number v-model="form.number" :min="1"></el-input-number>
<el-input-number v-model="form.number" :min="1" :max="total * 2"></el-input-number>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
@ -13,8 +13,15 @@
</template>
<script>
import { downloadFile } from "@/utils/index";
import { downloadTableCode } from '@/api/table'
export default {
props: {
total: {
type: [Number, String],
default: 1
}
},
data() {
return {
dialogVisible: false,
@ -32,9 +39,14 @@ export default {
async onSubmitHandle() {
try {
this.loading = true
const res = await downloadTableCode({ number: this.form.number })
const file = await downloadTableCode({
count: this.form.number,
shopId: localStorage.getItem('shopId')
})
this.loading = false
window.location.href = res.url
this.dialogVisible = false
this.$message.success('下载成功')
downloadFile(file, "桌码", "zip");
} catch (error) {
this.loading = false
console.log(error);

View File

@ -63,7 +63,7 @@
</div>
<addEara ref="addEara" @success="tbShopAreaGet" />
<addTable ref="addTable" @success="tbShopTableGet" />
<downloadTableCode ref="downloadTableCode" />
<downloadTableCode :total="total" ref="downloadTableCode" />
</div>
</template>
@ -83,6 +83,7 @@ export default {
tabVlaue: '',
tabs: [],
loading: false,
total: 0,
tableList: [],
status: {
subscribe: {
@ -134,11 +135,12 @@ export default {
async tbShopTableGet() {
this.loading = true
try {
const { content } = await tbShopTableGet({
const { content, total } = await tbShopTableGet({
shopId: localStorage.getItem('shopId'),
areaId: this.tabVlaue
})
this.tableList = content
this.total = total
setTimeout(() => {
this.loading = false
}, 300)

View File

@ -3,7 +3,7 @@
<div class="head-container">
<el-form :model="query" inline>
<el-form-item label="搜索">
<el-input v-model="query.telephone" placeholder="请输入手机号"></el-input>
<el-input v-model="query.name" placeholder="请输入昵称或手机号"></el-input>
</el-form-item>
<el-form-item label="是否为会员">
<el-select v-model="query.isVip" placeholder="是否是会员">
@ -63,7 +63,7 @@
</el-table-column>
<el-table-column label="性别" prop="sex">
<template v-slot="scope">
<el-tag type="priamry">{{ scope.row.sex }}</el-tag>
<el-tag type="priamry">{{ scope.row.sex || '未知' }}</el-tag>
</template>
</el-table-column>
<el-table-column label="会员" prop="isVip">
@ -112,7 +112,7 @@ export default {
data() {
return {
query: {
telephone: '',
name: '',
isVip: ''
},
tableData: {
@ -160,10 +160,7 @@ export default {
async getTableData() {
this.tableData.loading = true
try {
const res = await queryAllShopUser({
telephone: this.query.telephone,
isVip: this.query.isVip
})
const res = await queryAllShopUser(this.query)
this.tableData.loading = false
this.tableData.data = res.content
this.tableData.total = res.totalElements