新增功能:收银台
This commit is contained in:
@@ -36,10 +36,31 @@
|
||||
|
||||
// 字典数据
|
||||
const options = ref<SelectProps['options']>([
|
||||
{ value: 0, label: '余额支付', key: 'balancePay', icon: 'PayCircleOutlined' },
|
||||
{
|
||||
value: 0,
|
||||
label: '余额支付',
|
||||
key: 'balancePay',
|
||||
icon: 'PayCircleOutlined'
|
||||
},
|
||||
{ value: 1, label: '微信支付', key: 'wxPay', icon: 'WechatOutlined' },
|
||||
{ value: 2, label: '会员卡支付',key: 'userCardPay', icon: 'IdcardOutlined' },
|
||||
{ value: 3, label: '支付宝支付',key: 'aliPay', icon: 'AlipayCircleOutlined' }
|
||||
{
|
||||
value: 2,
|
||||
label: '会员卡支付',
|
||||
key: 'userCardPay',
|
||||
icon: 'IdcardOutlined'
|
||||
},
|
||||
{
|
||||
value: 3,
|
||||
label: '支付宝支付',
|
||||
key: 'aliPay',
|
||||
icon: 'AlipayCircleOutlined'
|
||||
},
|
||||
{
|
||||
value: 4,
|
||||
label: '现金支付',
|
||||
key: 'cashPayment',
|
||||
icon: 'PayCircleOutlined'
|
||||
}
|
||||
]);
|
||||
|
||||
/* 更新选中数据 */
|
||||
|
||||
@@ -82,12 +82,9 @@
|
||||
// 表格配置
|
||||
const columns = ref<ColumnItem[]>([
|
||||
{
|
||||
key: 'index',
|
||||
width: 48,
|
||||
align: 'center',
|
||||
fixed: 'left',
|
||||
hideInSetting: true,
|
||||
customRender: ({ index }) => index + (tableRef.value?.tableIndex ?? 0)
|
||||
title: 'ID',
|
||||
dataIndex: 'dictDataId',
|
||||
key: 'dictDataId'
|
||||
},
|
||||
{
|
||||
title: '名称',
|
||||
|
||||
139
src/components/SelectUserByButton/components/select-data.vue
Normal file
139
src/components/SelectUserByButton/components/select-data.vue
Normal file
@@ -0,0 +1,139 @@
|
||||
<template>
|
||||
<ele-modal
|
||||
:width="750"
|
||||
:visible="visible"
|
||||
:maskClosable="false"
|
||||
:title="title"
|
||||
:footer="null"
|
||||
:body-style="{ paddingBottom: '28px' }"
|
||||
@update:visible="updateVisible"
|
||||
>
|
||||
<ele-pro-table
|
||||
ref="tableRef"
|
||||
row-key="userId"
|
||||
:datasource="datasource"
|
||||
:columns="columns"
|
||||
:pagination="false"
|
||||
>
|
||||
<template #toolbar>
|
||||
<a-space>
|
||||
<a-input-search
|
||||
allow-clear
|
||||
v-model:value="searchText"
|
||||
placeholder="用户ID|手机号码"
|
||||
style="width: 280px"
|
||||
@search="reload"
|
||||
@pressEnter="reload"
|
||||
/>
|
||||
</a-space>
|
||||
</template>
|
||||
<template #bodyCell="{ column, record }">
|
||||
<template v-if="column.key === 'action'">
|
||||
<a-space>
|
||||
<a-button type="primary" @click="done(record)">选择</a-button>
|
||||
</a-space>
|
||||
</template>
|
||||
</template>
|
||||
</ele-pro-table>
|
||||
</ele-modal>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ref } from 'vue';
|
||||
import {
|
||||
ColumnItem,
|
||||
DatasourceFunction
|
||||
} from 'ele-admin-pro/es/ele-pro-table/types';
|
||||
import { pageUsers } from '@/api/system/user';
|
||||
import { User, UserParam } from '@/api/system/user/model';
|
||||
import { EleProTable } from 'ele-admin-pro';
|
||||
import useSearch from '@/utils/use-search';
|
||||
|
||||
defineProps<{
|
||||
// 弹窗是否打开
|
||||
visible: boolean;
|
||||
title?: string;
|
||||
// 修改回显的数据
|
||||
data?: User | null;
|
||||
}>();
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'done', data: User): void;
|
||||
(e: 'update:visible', visible: boolean): void;
|
||||
}>();
|
||||
|
||||
/* 更新visible */
|
||||
const updateVisible = (value: boolean) => {
|
||||
emit('update:visible', value);
|
||||
};
|
||||
|
||||
// 搜索内容
|
||||
const searchText = ref(null);
|
||||
// 表单数据
|
||||
const { where } = useSearch<UserParam>({
|
||||
userId: undefined,
|
||||
nickname: undefined,
|
||||
isStaff: true,
|
||||
keywords: ''
|
||||
});
|
||||
|
||||
// 表格实例
|
||||
const tableRef = ref<InstanceType<typeof EleProTable> | null>(null);
|
||||
|
||||
// 表格配置
|
||||
const columns = ref<ColumnItem[]>([
|
||||
{
|
||||
title: 'ID',
|
||||
dataIndex: 'userId'
|
||||
},
|
||||
{
|
||||
title: '头像',
|
||||
dataIndex: 'avatar'
|
||||
},
|
||||
{
|
||||
title: '姓名',
|
||||
dataIndex: 'realName'
|
||||
},
|
||||
{
|
||||
title: '手机号码',
|
||||
dataIndex: 'mobile',
|
||||
key: 'mobile'
|
||||
},
|
||||
{
|
||||
title: '所属部门',
|
||||
dataIndex: 'organizationName'
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
key: 'action',
|
||||
align: 'center',
|
||||
hideInSetting: true
|
||||
}
|
||||
]);
|
||||
|
||||
// 表格数据源
|
||||
const datasource: DatasourceFunction = ({ page, limit, where, orders }) => {
|
||||
// 搜索条件
|
||||
if (searchText.value) {
|
||||
where.keywords = searchText.value;
|
||||
}
|
||||
return pageUsers({
|
||||
...where,
|
||||
...orders,
|
||||
page,
|
||||
limit
|
||||
});
|
||||
};
|
||||
|
||||
/* 搜索 */
|
||||
const reload = (where?: UserParam) => {
|
||||
// selection.value = [];
|
||||
tableRef?.value?.reload({ page: 1, where });
|
||||
};
|
||||
|
||||
const done = (record: User) => {
|
||||
updateVisible(false);
|
||||
emit('done', record);
|
||||
};
|
||||
</script>
|
||||
<style lang="less"></style>
|
||||
64
src/components/SelectUserByButton/index.vue
Normal file
64
src/components/SelectUserByButton/index.vue
Normal file
@@ -0,0 +1,64 @@
|
||||
<template>
|
||||
<div>
|
||||
<!-- <a-input-group compact>-->
|
||||
<!-- <a-input-->
|
||||
<!-- disabled-->
|
||||
<!-- style="width: calc(100% - 32px)"-->
|
||||
<!-- v-model:value="value"-->
|
||||
<!-- :placeholder="placeholder"-->
|
||||
<!-- />111-->
|
||||
<!-- <a-button @click="openEdit">-->
|
||||
<!-- <template #icon><BulbOutlined class="ele-text-warning" />1111</template>-->
|
||||
<!-- </a-button>-->
|
||||
<!-- </a-input-group>-->
|
||||
<a-button type="primary" :icon="h(UserAddOutlined)" @click="openEdit"
|
||||
>关联会员</a-button
|
||||
>
|
||||
<!-- 选择弹窗 -->
|
||||
<select-data
|
||||
v-model:visible="showEdit"
|
||||
:data="current"
|
||||
:title="placeholder"
|
||||
@done="onChange"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { BulbOutlined, UserAddOutlined } from '@ant-design/icons-vue';
|
||||
import { ref, h } from 'vue';
|
||||
import SelectData from './components/select-data.vue';
|
||||
import { User } from '@/api/system/user/model';
|
||||
|
||||
withDefaults(
|
||||
defineProps<{
|
||||
value?: any;
|
||||
placeholder?: string;
|
||||
}>(),
|
||||
{
|
||||
placeholder: '请选择'
|
||||
}
|
||||
);
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'done', User): void;
|
||||
(e: 'clear'): void;
|
||||
}>();
|
||||
|
||||
// 是否显示编辑弹窗
|
||||
const showEdit = ref(false);
|
||||
// 当前编辑数据
|
||||
const current = ref<User | null>(null);
|
||||
|
||||
/* 打开编辑弹窗 */
|
||||
const openEdit = (row?: User) => {
|
||||
current.value = row ?? null;
|
||||
showEdit.value = true;
|
||||
};
|
||||
|
||||
const onChange = (row?: User) => {
|
||||
emit('done', row);
|
||||
};
|
||||
// 查询租户列表
|
||||
// const appList = ref<App[] | undefined>([]);
|
||||
</script>
|
||||
Reference in New Issue
Block a user