update

parent ab01ebd6
......@@ -135,5 +135,6 @@ export enum API_PATHS {
formalityDeposit = 'common/formalityDeposit', // danh sách hình thức đặt cọc
configHomeProduct = 'config/home/product',
artistFeaturedProduct= 'artist/featuredProduct',
homeProductNotActive = 'config/home/productNotActive'
homeProductNotActive = 'config/home/productNotActive',
artistFeaturedProducts = 'artist/featuredProducts'
}
......@@ -85,6 +85,10 @@ export type ArtistInfoType = {
};
};
export type artistFeatured = {
ids: string;
};
export type listProductNotActives = {
artistId: number;
artistName: {
......
......@@ -16,7 +16,6 @@
:rows="bannerTableRows"
:columns="bannerTableColumns"
row-key="id"
wrap-cells
:no-data-label="$t('emptyData')"
:rows-per-page-label="$t('recordPerPage')"
......@@ -56,7 +55,13 @@
</div>
<q-card-actions align="right">
<q-btn @click="handleTogle" color="grey" no-caps style="width: 90px" label="Hủy" />
<q-btn
@click="handleTogle"
color="grey"
no-caps
style="width: 90px"
label="Hủy"
/>
<q-btn
type="submit"
color="primary"
......@@ -97,12 +102,11 @@ export default defineComponent({
() => props.isOpened,
(value) => {
if (value) {
selected.value = []
selected.value = [];
void listProductNotActive();
}
}
);
const bannerTableColumns = [
{
name: 'name',
......@@ -154,8 +158,8 @@ export default defineComponent({
];
const configImg = config;
const selected = ref([]);
const getSelectedString = () => {
const selected: Ref<listProductNotActives[]> = ref([]);
const getSelectedString = () => {
return selected.value.length === 0
? ''
: `${selected.value.length} sản phẩm đã được chọn `;
......@@ -165,15 +169,40 @@ export default defineComponent({
pageIndex.value = 1;
void listProductNotActive();
};
const handleConfirmAdd = async () => {
const data = [] as any[]
for (let i = 0; i < selected.value.length; i++) {
data.push(selected.value[i]?.id)
}
try {
const response = (await api({
url: API_PATHS.artistFeaturedProducts,
method: 'GET',
params: {
ids: data.join(),
},
})) as AxiosResponse<
BaseResponseBody<
PaginationResponse<BaseResponseBody<listProductNotActives[]>>
>
>;
if (response.data.error.code === config.API_RES_CODE.OK.code) {
Notify.create({
type: 'positive',
message: 'Thêm sản phẩm nổi bật thành công',
actions: [{ icon: 'close', color: 'white' }],
});
context.emit('saveBannerInfo')
context.emit('update:isOpened', false);
}
} catch (error) {}
};
const handleConfirmAdd = () => {
console.log(selected.value)
context.emit('update:isOpened', false);
}
const handleTogle = () => {
const handleTogle = () => {
context.emit('update:isOpened', false);
}
};
const pageIndex = ref(1);
const pageSize = ref(20);
......@@ -219,6 +248,6 @@ export default defineComponent({
handleTogle,
};
},
emits: ['update:isOpened'],
emits: ['update:isOpened', 'saveBannerInfo'],
});
</script>
......@@ -64,7 +64,7 @@
<AddDialog
v-model:isOpened="openAddDialog"
@saveBannerInfo="addBanner"
@saveBannerInfo="configHomeProduct"
/>
</div>
</template>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment