feat: 台桌列表增加绑定桌码功能(暂时隐藏)
This commit is contained in:
parent
274833d548
commit
3af175c506
|
|
@ -45,7 +45,15 @@ const API = {
|
|||
method: "delete",
|
||||
data: { id },
|
||||
});
|
||||
}
|
||||
},
|
||||
//绑定桌码
|
||||
bindTableCode(data: any) {
|
||||
return request({
|
||||
url: `${baseURL}/bind`,
|
||||
method: "post",
|
||||
data
|
||||
});
|
||||
},
|
||||
}
|
||||
export default API;
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -0,0 +1,82 @@
|
|||
<template>
|
||||
<el-dialog title="绑定桌码" v-model="dialogVisible" width="30%" @close="reset">
|
||||
<el-form :model="form" :rules="rules" ref="refForm">
|
||||
<el-form-item label="桌码" prop="tableCode">
|
||||
<el-input
|
||||
autofocus
|
||||
ref="refTableCode"
|
||||
v-model="form.tableCode"
|
||||
placeholder="请输入表码"
|
||||
></el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button @click="close">取 消</el-button>
|
||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
<script setup>
|
||||
import shopTableApi from "@/api/account/table";
|
||||
const dialogVisible = ref(false);
|
||||
|
||||
const form = reactive({
|
||||
id: "",
|
||||
tableCode: "",
|
||||
});
|
||||
const rules = {
|
||||
tableCode: [{ required: true, message: "请输入桌码", trigger: "blur" }],
|
||||
};
|
||||
const refForm = ref(null);
|
||||
|
||||
function reset() {
|
||||
refForm.value.resetFields();
|
||||
for (let i in form) {
|
||||
form[i] = "";
|
||||
}
|
||||
}
|
||||
|
||||
const refTableCode = ref(null);
|
||||
function open(item) {
|
||||
dialogVisible.value = true;
|
||||
nextTick(() => {
|
||||
setTimeout(() => {
|
||||
refTableCode.value.focus();
|
||||
}, 100);
|
||||
});
|
||||
form.tableCode = item.tableCode;
|
||||
form.id = item.id;
|
||||
}
|
||||
|
||||
const emits = defineEmits(["refresh"]);
|
||||
function submitForm() {
|
||||
refForm.value.validate((valid) => {
|
||||
if (valid) {
|
||||
shopTableApi
|
||||
.bindTableCode(form)
|
||||
.then((res) => {
|
||||
ElMessage({
|
||||
type: res ? "success" : "error",
|
||||
message: res ? "绑定成功" : "绑定失败",
|
||||
});
|
||||
if (res) {
|
||||
close();
|
||||
emits("refresh");
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log(error);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
function close() {
|
||||
dialogVisible.value = false;
|
||||
}
|
||||
defineExpose({
|
||||
open,
|
||||
close,
|
||||
});
|
||||
</script>
|
||||
|
|
@ -68,11 +68,12 @@
|
|||
<template #dropdown>
|
||||
<el-dropdown-menu>
|
||||
<el-dropdown-item command="edit">
|
||||
<i class="i el-icon-edit" />
|
||||
<span>编辑</span>
|
||||
</el-dropdown-item>
|
||||
<!-- <el-dropdown-item command="bindTableCode">
|
||||
<span>绑定桌码</span>
|
||||
</el-dropdown-item> -->
|
||||
<el-dropdown-item command="del">
|
||||
<i class="i el-icon-delete" />
|
||||
<span>删除</span>
|
||||
</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
|
|
@ -224,6 +225,8 @@
|
|||
<addTable ref="refAddTable" @success="tableInit" />
|
||||
<!-- 下载桌台码 -->
|
||||
<downloadTableCode ref="refDownloadTableCode" />
|
||||
<!-- 绑定桌码 -->
|
||||
<bindCode ref="refBindCode" @refresh="tableInit" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
|
@ -236,8 +239,15 @@ import shopAreaApi from "@/api/account/shopArea";
|
|||
import tableApi from "@/api/account/table";
|
||||
import addEara from "./components/addEara.vue";
|
||||
import addTable from "./components/addTable.vue";
|
||||
import bindCode from "./components/bind-table-code.vue";
|
||||
import downloadTableCode from "./components/downloadTableCode.vue";
|
||||
|
||||
//绑定桌码
|
||||
const refBindCode = ref();
|
||||
function showBindCode(item) {
|
||||
refBindCode.value.open(item);
|
||||
}
|
||||
|
||||
//桌台二维码
|
||||
const refDownloadTableCode = ref();
|
||||
function showDownloadTableCode() {
|
||||
|
|
@ -282,6 +292,10 @@ function downloadShopCpde() {
|
|||
* @param item
|
||||
*/
|
||||
function tableComman(command, item) {
|
||||
if (command === "bindTableCode") {
|
||||
showBindCode(item);
|
||||
return;
|
||||
}
|
||||
if (command === "edit") {
|
||||
return refAddTable.value.show(item);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue