update

parent 184f9c53
export const config = {
API_ENDPOINT: 'https://cms.vab.vn/api/',// pro
// API_ENDPOINT:'http://103.147.34.34:10700/api/' ,
// API_IMAGE_ENDPOINT: 'http://103.147.34.34:10700/api/upload/' , // test
API_IMAGE_ENDPOINT: 'https://cms.vab.vn/file/upload/',
// pro
// API_ENDPOINT: 'https://cms.vab.vn/api/',
// API_IMAGE_ENDPOINT: 'https://cms.vab.vn/file/upload/',
// dev
API_ENDPOINT: 'https://cms.vab.xteldev.com/api/',
API_IMAGE_ENDPOINT: 'https://cms.vab.xteldev.com/file/upload/',
API_RES_CODE: {
OK: {
......
<template>
<q-dialog persistent
:model-value="openDialogRefusedBrowser"
>
<q-card style="min-width: 900px" bordered>
<q-form greedy @submit.prevent="confirmRefusedCustomer">
<q-card-section style="padding-bottom:10px">
<q-item style="padding-left: 10px">
<q-item-section>
<q-item-label class="text-h6 text-weight-regular">Lý do</q-item-label>
</q-item-section>
</q-item>
</q-card-section>
<q-card-section style="padding-top:0px">
<q-input outlined
hide-bottom-space
:rules="contentRules"
v-model="content"
label="Nội dung"
type="textarea" />
</q-card-section>
<q-card-actions align="right">
<q-btn
color="grey"
no-caps
style="width: 90px"
label="Hủy"
@click="$emit('click:CloseBtn')"
/>
<q-btn
type="submit"
color="primary"
no-caps
style="width: 90px"
label="Ok"
/>
</q-card-actions>
</q-form>
</q-card>
</q-dialog>
</template>
<script lang="ts">
import { defineComponent, PropType, Ref, ref, watch } from 'vue';
import { Dialog, Notify } from 'quasar';
import { API_PATHS, config } from 'src/assets/configurations.example';
import { AxiosResponse } from 'axios';
import { api, BaseResponseBody } from 'src/boot/axios';
import { emit } from 'cluster';
export default defineComponent ({
props: {
openDialogRefusedBrowser: {
type: Boolean,
required: true,
},
customerId: {
type: Number,
required: true
}
},
setup(props, context){
watch(
() => props.openDialogRefusedBrowser,
(value) => {
if (value) {
content.value = null
}
}
);
const content: Ref<string | null> = ref(null);
const contentRules = [
(val?: string) =>
(val && val.trim().length) ||
'Vui lòng nhập nội dung'
];
const confirmRefusedCustomer = async () => {
try {
const browserResult = (await api({
url: API_PATHS.browserCustomer,
method: 'POST',
data: {
id: props.customerId,
isCustomer: 1,
approvalStatus: 0,
reason: content.value
},
})) as AxiosResponse<BaseResponseBody<unknown>>;
if (browserResult.data.error.code === config.API_RES_CODE.OK.code) {
Notify.create({
type: 'positive',
message: 'Từ chối duyệt thành công',
actions: [{ icon: 'close', color: 'white' }],
});
context.emit('editReCustomer' )
context.emit('click:CloseBtn')
}
} catch (error) {}
}
return {
contentRules,
content,
confirmRefusedCustomer
}
},
emits:['click:CloseBtn','editReCustomer']
})
</script>
\ No newline at end of file
......@@ -461,7 +461,8 @@ export default defineComponent({
bodyFormData.append('file', file);
const response = (await api({
headers: { 'Content-Type': 'multipart/form-data' },
url: 'https://cms.vab.vn/file/upload/',
// url: 'https://cms.vab.vn/file/upload/', // pro
url: 'https://cms.vab.xteldev.com/file/upload/', // test
method: 'POST',
data: bodyFormData,
......
......@@ -400,7 +400,8 @@ export default defineComponent({
bodyFormData.append('file', file);
const response = (await api({
headers: { 'Content-Type': 'multipart/form-data' },
url: 'https://cms.vab.vn/file/upload/',
// url: 'https://cms.vab.vn/file/upload/', // pro
url: 'https://cms.vab.xteldev.com/file/upload/', // test
method: 'POST',
data: bodyFormData,
......
......@@ -408,7 +408,8 @@ export default defineComponent({
bodyFormData.append('file', file);
const response = (await api({
headers: { 'Content-Type': 'multipart/form-data' },
url: 'https://cms.vab.vn/file/upload/', // test
// url: 'https://cms.vab.vn/file/upload/', // pro
url: 'https://cms.vab.xteldev.com/file/upload/', // test
method: 'POST',
data: bodyFormData,
......
......@@ -468,7 +468,8 @@ export default defineComponent({
bodyFormData.append('file', file);
const response = (await api({
headers: { 'Content-Type': 'multipart/form-data' },
url: 'https://cms.vab.vn/file/upload/',
// url: 'https://cms.vab.vn/file/upload/', // pro
url: 'https://cms.vab.xteldev.com/file/upload/', // test
method: 'POST',
data: bodyFormData,
......
......@@ -413,8 +413,8 @@ export default defineComponent({
bodyFormData.append('file', file);
const response = (await api({
headers: { 'Content-Type': 'multipart/form-data' },
url: 'https://cms.vab.vn/file/upload/', // test
// url:'http://103.147.34.34:10700/api/upload/', // pro
// url: 'https://cms.vab.vn/file/upload/', // pro
url: 'https://cms.vab.xteldev.com/file/upload/', // test
method: 'POST',
data: bodyFormData,
})) as AxiosResponse<BaseResponseBody<FileUploadType>>;
......
......@@ -97,6 +97,15 @@
@click="confirmBrowserCustomer(rowData.row.id)"
>
<q-tooltip :offset="[20, 10]">Duyệt tài khoản</q-tooltip>
</q-btn>
<q-btn
flat
round
color="primary"
icon="mdi-block-helper"
@click="confirmRefusedBrowserCustomer(rowData.row.id)"
>
<q-tooltip :offset="[10, 10]">Từ chối duyệt</q-tooltip>
</q-btn>
<q-btn
flat
......@@ -140,7 +149,7 @@
{{
rowData.value === 1
? 'Đã duyệt'
: 'Ch duyệt'
: 'Chưa duyệt'
}}
</q-chip>
</div>
......@@ -171,6 +180,15 @@
@click:CloseBtn="showDialogUpdate = false"
@editCustomer="updateCustomer"
></UpdateNewCustomerDialogComponent>
<RefusedBrowserCustomer
:customer-id="customerId"
v-model:open-dialog-refused-browser="openDialogRefusedBrowser"
@click:CloseBtn="openDialogRefusedBrowser = false"
@editReCustomer="getListCustomers"
>
</RefusedBrowserCustomer>
</div>
</div>
</div>
......@@ -182,6 +200,7 @@ import { defineComponent, onMounted, Ref, ref } from 'vue';
import Pagination from 'components/pagination/index.vue';
import AddNewCustomerDialogComponent from '../../components/customer/add-new-customer-dialog/index.vue';
import UpdateNewCustomerDialogComponent from '../../components/customer/update-new-customer-dialog/index.vue';
import RefusedBrowserCustomer from '../../components/customer/openDialogRefusedBrowser.vue'
import { API_PATHS, config } from 'src/assets/configurations.example';
import { AxiosResponse } from 'axios';
import { api, BaseResponseBody } from 'src/boot/axios';
......@@ -195,6 +214,7 @@ export default defineComponent({
components: {
AddNewCustomerDialogComponent,
UpdateNewCustomerDialogComponent,
RefusedBrowserCustomer,
Pagination,
},
setup() {
......@@ -298,7 +318,9 @@ export default defineComponent({
];
const userTableRowsCustomer: Ref<CustomerType[]> = ref([]);
const customerInfo: Ref<CustomerType | null> = ref(null);
const customerId: Ref<number | null> = ref(null);
const showDialog = ref(false);
const openDialogRefusedBrowser = ref(false);
const showDialogUpdate = ref(false);
const pageIndex = ref(1);
const pageSize = ref(20);
......@@ -378,17 +400,21 @@ export default defineComponent({
// i18n.global.t(
// 'customer.confirmActionsTitle.confirmDeleteUserContent'
// ),
cancel: i18n.global.t(
'customer.confirmActionsTitle.confirmDeleteUserCancelBtnLabel'
),
color: 'negative',
color: 'secondary',
}).onOk(() => {
// void deleteCustomer(id);
void browserCustomer(id);
});
};
const browserCustomer =async (id:number) => {
const confirmRefusedBrowserCustomer = (id:number) => {
customerId.value = id
openDialogRefusedBrowser.value = true
}
const browserCustomer = async (id:number) => {
try {
const browserResult = (await api({
url: API_PATHS.browserCustomer,
......@@ -553,6 +579,7 @@ export default defineComponent({
addCustomer,
showDialogUpdate,
showDialog,
openDialogRefusedBrowser,
id,
userName,
fullName,
......@@ -584,6 +611,8 @@ export default defineComponent({
confirmDeleteCustomer,
confirmBrowserCustomer,
customerInfo,
customerId,
confirmRefusedBrowserCustomer
};
},
});
......
......@@ -284,8 +284,8 @@ export default defineComponent({
bodyFormData.append('file', file);
const response = (await api({
headers: { 'Content-Type': 'multipart/form-data' },
url: 'https://cms.vab.vn/file/upload/', // test
// url:'http://103.147.34.34:10700/api/upload/', // pro
// url: 'https://cms.vab.vn/file/upload/', // pro
url: 'https://cms.vab.xteldev.com/file/upload/', // test
method: 'POST',
data: bodyFormData,
})) as AxiosResponse<BaseResponseBody<FileUploadType>>;
......
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