update

parent ab01ebd6
...@@ -135,5 +135,6 @@ export enum API_PATHS { ...@@ -135,5 +135,6 @@ export enum API_PATHS {
formalityDeposit = 'common/formalityDeposit', // danh sách hình thức đặt cọc formalityDeposit = 'common/formalityDeposit', // danh sách hình thức đặt cọc
configHomeProduct = 'config/home/product', configHomeProduct = 'config/home/product',
artistFeaturedProduct= 'artist/featuredProduct', artistFeaturedProduct= 'artist/featuredProduct',
homeProductNotActive = 'config/home/productNotActive' homeProductNotActive = 'config/home/productNotActive',
artistFeaturedProducts = 'artist/featuredProducts'
} }
...@@ -85,6 +85,10 @@ export type ArtistInfoType = { ...@@ -85,6 +85,10 @@ export type ArtistInfoType = {
}; };
}; };
export type artistFeatured = {
ids: string;
};
export type listProductNotActives = { export type listProductNotActives = {
artistId: number; artistId: number;
artistName: { artistName: {
......
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
:rows="bannerTableRows" :rows="bannerTableRows"
:columns="bannerTableColumns" :columns="bannerTableColumns"
row-key="id" row-key="id"
wrap-cells wrap-cells
:no-data-label="$t('emptyData')" :no-data-label="$t('emptyData')"
:rows-per-page-label="$t('recordPerPage')" :rows-per-page-label="$t('recordPerPage')"
...@@ -56,7 +55,13 @@ ...@@ -56,7 +55,13 @@
</div> </div>
<q-card-actions align="right"> <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 <q-btn
type="submit" type="submit"
color="primary" color="primary"
...@@ -97,12 +102,11 @@ export default defineComponent({ ...@@ -97,12 +102,11 @@ export default defineComponent({
() => props.isOpened, () => props.isOpened,
(value) => { (value) => {
if (value) { if (value) {
selected.value = [] selected.value = [];
void listProductNotActive(); void listProductNotActive();
} }
} }
); );
const bannerTableColumns = [ const bannerTableColumns = [
{ {
name: 'name', name: 'name',
...@@ -154,8 +158,8 @@ export default defineComponent({ ...@@ -154,8 +158,8 @@ export default defineComponent({
]; ];
const configImg = config; const configImg = config;
const selected = ref([]); const selected: Ref<listProductNotActives[]> = ref([]);
const getSelectedString = () => { const getSelectedString = () => {
return selected.value.length === 0 return selected.value.length === 0
? '' ? ''
: `${selected.value.length} sản phẩm đã được chọn `; : `${selected.value.length} sản phẩm đã được chọn `;
...@@ -165,15 +169,40 @@ export default defineComponent({ ...@@ -165,15 +169,40 @@ export default defineComponent({
pageIndex.value = 1; pageIndex.value = 1;
void listProductNotActive(); 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 = () => { const handleTogle = () => {
console.log(selected.value)
context.emit('update:isOpened', false);
}
const handleTogle = () => {
context.emit('update:isOpened', false); context.emit('update:isOpened', false);
} };
const pageIndex = ref(1); const pageIndex = ref(1);
const pageSize = ref(20); const pageSize = ref(20);
...@@ -219,6 +248,6 @@ export default defineComponent({ ...@@ -219,6 +248,6 @@ export default defineComponent({
handleTogle, handleTogle,
}; };
}, },
emits: ['update:isOpened'], emits: ['update:isOpened', 'saveBannerInfo'],
}); });
</script> </script>
...@@ -64,7 +64,7 @@ ...@@ -64,7 +64,7 @@
<AddDialog <AddDialog
v-model:isOpened="openAddDialog" v-model:isOpened="openAddDialog"
@saveBannerInfo="addBanner" @saveBannerInfo="configHomeProduct"
/> />
</div> </div>
</template> </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