商户下拉选择

This commit is contained in:
ctw committed 2025-01-07 18:25:20 +08:00
1 parent 5da50dbc19
commit 79497d7b05
8 files changed
+209 -248

No files matched your search

+2 -28
View File
@@ -4,15 +4,7 @@
<el-row :gutter="24">
<el-col :span="12" class="mb20">
<el-form-item label="商户" prop="merchantId">
<el-select
v-model="form.merchantId"
placeholder="请选择商户"
size="large"
style="width: 240px; display: inline-block"
:disabled="merchantStatus"
>
<el-option v-for="item in merchantInfo" :key="item.id" :label="item.name" :value="item.id" />
</el-select>
<select-mch v-model="form.merchantId" />
</el-form-item>
</el-col>
<el-col :span="12" class="mb20">
@@ -64,16 +56,12 @@ import { useDict } from '/@/hooks/dict';
import { useMessage } from '/@/hooks/message';
import { getObj, addObj, putObj } from '/@/api/canteen/boxesInfo';
import { rule } from '/@/utils/validate';
import { selectMerchantList } from '/@/api/canteen/merchantInfo';
const emit = defineEmits(['refresh']);
// 定义变量内容
const dataFormRef = ref();
const visible = ref(false);
const loading = ref(false);
//业务变量
const merchantStatus = ref(true);
const merchantInfo = ref<any>([]);
// 定义字典
const { boxes_status } = useDict('boxes_status');
@@ -115,8 +103,6 @@ const openDialog = (id: string) => {
form.id = id;
getboxesInfoData(id);
}
//初始化商户信息
merchantInit();
};
// 提交
@@ -149,19 +135,7 @@ const getboxesInfoData = (id: string) => {
loading.value = false;
});
};
const merchantInit = async () => {
// 获取下拉框
let res = await selectMerchantList('1');
merchantInfo.value = res.data;
//默认选中第一个
if (merchantInfo.value) {
if (merchantInfo.value.length > 1) {
merchantStatus.value = false;
} else {
form.merchantId = merchantInfo.value[0].id;
}
}
};
// 暴露变量
defineExpose({
openDialog,