完成商城下单功能

This commit is contained in:
gxwebsoft
2024-05-27 01:24:02 +08:00
parent dea6ae1c23
commit 4bae8599e1
26 changed files with 803 additions and 129 deletions

View File

@@ -0,0 +1,69 @@
<!-- 选择下拉框 -->
<template>
<a-select
:allow-clear="true"
:show-search="true"
mode="multiple"
optionFilterProp="label"
:options="options"
:value="value"
:placeholder="placeholder"
@update:value="updateValue"
@blur="onBlur"
@change="onChange"
/>
</template>
<script lang="ts" setup>
import { ref } from 'vue';
import { Merchant } from '@/api/shop/merchant/model';
import { listMerchant } from '@/api/shop/merchant';
const emit = defineEmits<{
(e: 'update:value', value: string, item: any): void;
(e: 'done', item: Merchant): void;
(e: 'blur'): void;
}>();
const props = withDefaults(
defineProps<{
value?: any;
type?: any;
placeholder?: string;
dictCode?: string;
}>(),
{
placeholder: '请选择场馆'
}
);
// 字典数据
const options = ref<Merchant[]>([]);
/* 更新选中数据 */
const updateValue = (value: string) => {
const item = options.value?.find((d) => d.merchantName == value);
emit('update:value', value, item);
};
/* 失去焦点 */
const onBlur = () => {
emit('blur');
};
const onChange = (item: Merchant) => {
emit('done', item);
};
const reload = () => {
listMerchant({}).then((list) => {
options.value = list.map((d) => {
d.label = d.merchantName;
d.value = d.merchantId;
d.key = d.merchantCode;
return d;
});
});
};
reload();
</script>

View File

@@ -53,7 +53,7 @@
showEdit.value = true;
};
const onChange = (row) => {
const onChange = (row?: User) => {
emit('done', row);
};
// 查询租户列表