Files
cashier_app/pageConsumables/components/select-cons.vue
2025-12-25 15:38:00 +08:00

53 lines
847 B
Vue

<template>
<u-picker
title="选择耗材"
:show="visable"
:columns="columns"
keyName="conName"
@close="visable = false"
closeOnClickOverlay
@cancel="visable = false"
@confirm="confirmHandle"
></u-picker>
</template>
<script setup>
import { ref, onMounted } from 'vue';
import { getConsList } from '@/http/api/cons.js';
const visable = ref(false);
const columns = ref([]);
const emits = defineEmits(['success']);
function confirmHandle(e) {
emits('success', e.value);
visable.value = false;
}
// 获取耗材列表
async function getConsListAjax() {
try {
const res = await getConsList();
columns.value = [res];
} catch (error) {
console.log(error);
}
}
function show() {
visable.value = true;
}
defineExpose({
show
});
onMounted(() => {
getConsListAjax();
});
</script>
<style scoped lang="scss"></style>