新增批量下载桌码

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' 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.42:8000'
# VUE_APP_BASE_API = 'http://192.168.2.133:8000' # VUE_APP_BASE_API = 'http://192.168.2.133:8000'
VUE_APP_BASE_API = 'https://admintestpapi.sxczgkj.cn' VUE_APP_BASE_API = 'https://admintestpapi.sxczgkj.cn'

View File

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

View File

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

View File

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

View File

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

View File

@ -1,8 +1,8 @@
<template> <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 ref="form" :model="form" label-position="left">
<el-form-item label="下载数量"> <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-item>
</el-form> </el-form>
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
@ -13,8 +13,15 @@
</template> </template>
<script> <script>
import { downloadFile } from "@/utils/index";
import { downloadTableCode } from '@/api/table' import { downloadTableCode } from '@/api/table'
export default { export default {
props: {
total: {
type: [Number, String],
default: 1
}
},
data() { data() {
return { return {
dialogVisible: false, dialogVisible: false,
@ -32,9 +39,14 @@ export default {
async onSubmitHandle() { async onSubmitHandle() {
try { try {
this.loading = true 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 this.loading = false
window.location.href = res.url this.dialogVisible = false
this.$message.success('下载成功')
downloadFile(file, "桌码", "zip");
} catch (error) { } catch (error) {
this.loading = false this.loading = false
console.log(error); console.log(error);

View File

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

View File

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