feat: 增加桌台统计跳转订单页面传参

This commit is contained in:
2025-03-19 15:53:09 +08:00
parent 6f779f19a3
commit c67424fe2c
4 changed files with 76 additions and 23 deletions

View File

@@ -1,13 +1,27 @@
<template> <template>
<el-card v-show="visible" v-hasPerm="[`${searchConfig.pageName}:query`]" shadow="never" class="mb-[10px]"> <el-card
v-show="visible"
v-hasPerm="[`${searchConfig.pageName}:query`]"
shadow="never"
class="mb-[10px]"
>
<el-form ref="queryFormRef" :model="queryParams" :inline="inline"> <el-form ref="queryFormRef" :model="queryParams" :inline="inline">
<template v-for="(item, index) in formItems" :key="item.prop"> <template v-for="(item, index) in formItems" :key="item.prop">
<el-form-item v-show="isExpand ? true : index < showNumber" :label="item.label" :prop="item.prop"> <el-form-item
v-show="isExpand ? true : index < showNumber"
:label="item.label"
:prop="item.prop"
>
<!-- Label --> <!-- Label -->
<template v-if="item.tips" #label> <template v-if="item.tips" #label>
<span> <span>
{{ item.label }} {{ item.label }}
<el-tooltip placement="bottom" effect="light" :content="item.tips" :raw-content="true"> <el-tooltip
placement="bottom"
effect="light"
:content="item.tips"
:raw-content="true"
>
<el-icon style="vertical-align: -0.15em" size="16"> <el-icon style="vertical-align: -0.15em" size="16">
<QuestionFilled /> <QuestionFilled />
</el-icon> </el-icon>
@@ -16,7 +30,11 @@
</template> </template>
<!-- Input 输入框 --> <!-- Input 输入框 -->
<template v-if="item.type === 'input' || item.type === undefined"> <template v-if="item.type === 'input' || item.type === undefined">
<el-input v-model="queryParams[item.prop]" v-bind="item.attrs" @keyup.enter="handleQuery" /> <el-input
v-model="queryParams[item.prop]"
v-bind="item.attrs"
@keyup.enter="handleQuery"
/>
</template> </template>
<!-- radio-button radio按钮组 --> <!-- radio-button radio按钮组 -->
<template v-if="item.type === 'radio-button'"> <template v-if="item.type === 'radio-button'">
@@ -29,17 +47,30 @@
<!-- InputTag 标签输入框 --> <!-- InputTag 标签输入框 -->
<template v-if="item.type === 'input-tag'"> <template v-if="item.type === 'input-tag'">
<div class="flex-center"> <div class="flex-center">
<el-tag v-for="tag in inputTagMap[item.prop].data" :key="tag" class="mr-2" :closable="true" <el-tag
v-bind="inputTagMap[item.prop].tagAttrs" @close="handleCloseTag(item.prop, tag)"> v-for="tag in inputTagMap[item.prop].data"
:key="tag"
class="mr-2"
:closable="true"
v-bind="inputTagMap[item.prop].tagAttrs"
@close="handleCloseTag(item.prop, tag)"
>
{{ tag }} {{ tag }}
</el-tag> </el-tag>
<template v-if="inputTagMap[item.prop].inputVisible"> <template v-if="inputTagMap[item.prop].inputVisible">
<el-input :ref="(el: HTMLElement) => (inputTagMap[item.prop].inputRef = el)" <el-input
v-model="inputTagMap[item.prop].inputValue" v-bind="inputTagMap[item.prop].inputAttrs" :ref="(el: HTMLElement) => (inputTagMap[item.prop].inputRef = el)"
@keyup.enter="handleInputConfirm(item.prop)" @blur="handleInputConfirm(item.prop)" /> v-model="inputTagMap[item.prop].inputValue"
v-bind="inputTagMap[item.prop].inputAttrs"
@keyup.enter="handleInputConfirm(item.prop)"
@blur="handleInputConfirm(item.prop)"
/>
</template> </template>
<template v-else> <template v-else>
<el-button v-bind="inputTagMap[item.prop].buttonAttrs" @click="handleShowInput(item.prop)"> <el-button
v-bind="inputTagMap[item.prop].buttonAttrs"
@click="handleShowInput(item.prop)"
>
{{ inputTagMap[item.prop].buttonAttrs.btnText }} {{ inputTagMap[item.prop].buttonAttrs.btnText }}
</el-button> </el-button>
</template> </template>
@@ -49,7 +80,10 @@
<template v-else-if="item.type === 'select'"> <template v-else-if="item.type === 'select'">
<el-select v-model="queryParams[item.prop]" v-bind="item.attrs"> <el-select v-model="queryParams[item.prop]" v-bind="item.attrs">
<template v-for="option in item.options" :key="option.value"> <template v-for="option in item.options" :key="option.value">
<el-option :label="option.label || option.name" :value="option.value || option.id" /> <el-option
:label="option.label || option.name"
:value="option.value || option.id"
/>
</template> </template>
</el-select> </el-select>
</template> </template>
@@ -67,8 +101,13 @@
<el-button type="primary" icon="search" @click="handleQuery">搜索</el-button> <el-button type="primary" icon="search" @click="handleQuery">搜索</el-button>
<el-button icon="refresh" @click="handleReset">重置</el-button> <el-button icon="refresh" @click="handleReset">重置</el-button>
<!-- 展开/收起 --> <!-- 展开/收起 -->
<el-link v-if="isExpandable && formItems.length > showNumber" class="ml-2" type="primary" :underline="false" <el-link
@click="isExpand = !isExpand"> v-if="isExpandable && formItems.length > showNumber"
class="ml-2"
type="primary"
:underline="false"
@click="isExpand = !isExpand"
>
<template v-if="isExpand"> <template v-if="isExpand">
收起 收起
<el-icon> <el-icon>
@@ -207,11 +246,12 @@ function handleShowInput(prop: string) {
inputTagMap[prop].inputRef.focus(); inputTagMap[prop].inputRef.focus();
}); });
} }
function setQueryParams(data: object) {
queryParams.orderNo = data.orderNo function setQueryValue(key: string, val: any) {
queryParams[key] = val;
} }
// 暴露的属性和方法 // 暴露的属性和方法
defineExpose({ getQueryParams, toggleVisible, setQueryParams }); defineExpose({ getQueryParams, toggleVisible, setQueryValue });
</script> </script>
<style lang="scss" scoped></style> <style lang="scss" scoped></style>

View File

@@ -141,10 +141,9 @@ export default {
toTableOrderList(data) { toTableOrderList(data) {
// console.log(data) // console.log(data)
this.$router.push({ this.$router.push({
path: "/order_manage/order_list", path: "/order/index",
query: { query: {
tableName: data.tableName, tableName: data.tableName,
timeValue: this.timeValue,
}, },
}); });
}, },

View File

@@ -39,6 +39,18 @@ const searchConfig: ISearchConfig = {
}, },
}, },
}, },
{
type: "input",
label: "台桌名称",
prop: "tableName",
attrs: {
placeholder: "请输入台桌名称",
clearable: true,
style: {
width: "200px",
},
},
},
{ {
type: "input", type: "input",
label: "商品名称", label: "商品名称",

View File

@@ -151,10 +151,12 @@ function returnOriginAmount(order: OrderInfoVo) {
}); });
return amount.toFixed(2); return amount.toFixed(2);
} }
const routeto = useRoute(); const route = useRoute();
onMounted(() => { onMounted(() => {
handleQueryClick({ orderNo: routeto.query.orderNo }); const { orderNo, tableName } = route.query;
searchRef.value?.setQueryParams({ orderNo: routeto.query.orderNo }); handleQueryClick({ orderNo, tableName });
searchRef.value?.setQueryValue("orderNo", orderNo);
searchRef.value?.setQueryValue("tableName", tableName);
}); });
// 新增 // 新增
@@ -207,10 +209,10 @@ function returnStateType(status: string) {
} }
} }
const route = useRouter(); const router = useRouter();
// 结账 // 结账
function toPayOrder(order: getListResponse) { function toPayOrder(order: getListResponse) {
route.push({ router.push({
path: "/tool/index", path: "/tool/index",
query: { query: {
id: order.id, id: order.id,