updte

parent 9bd612c3
...@@ -7,16 +7,17 @@ ...@@ -7,16 +7,17 @@
"private": true, "private": true,
"scripts": { "scripts": {
"lint": "eslint --ext .js,.ts,.vue ./", "lint": "eslint --ext .js,.ts,.vue ./",
"test": "echo \"No test specified\" && exit 0" "test": "echo \"No test specified\" && exit 0",
"fix--lint": "eslint --fix --ext .js,.jsx ."
}, },
"dependencies": { "dependencies": {
"@quasar/extras": "^1.0.0", "@quasar/extras": "^1.14.0",
"@vue/runtime-core": "^3.2.33", "@vue/runtime-core": "^3.2.33",
"axios": "^0.21.1", "axios": "^0.21.1",
"core-js": "^3.6.5", "core-js": "^3.6.5",
"http-status-codes": "^2.1.4", "http-status-codes": "^2.1.4",
"moment": "^2.29.1", "moment": "^2.29.1",
"quasar": "^2.0.0-beta.1", "quasar": "^2.7.1",
"secure-ls": "^1.2.6", "secure-ls": "^1.2.6",
"vue": "^3.0.11", "vue": "^3.0.11",
"vue-i18n": "^9.0.0-beta.0", "vue-i18n": "^9.0.0-beta.0",
...@@ -24,7 +25,7 @@ ...@@ -24,7 +25,7 @@
"vuex-persistedstate": "^4.0.0-beta.3" "vuex-persistedstate": "^4.0.0-beta.3"
}, },
"devDependencies": { "devDependencies": {
"@quasar/app": "^3.0.0-beta.1", "@quasar/app-webpack": "^3.5.3",
"@quasar/cli": "^1.1.3", "@quasar/cli": "^1.1.3",
"@types/node": "^10.17.15", "@types/node": "^10.17.15",
"@typescript-eslint/eslint-plugin": "^4.16.1", "@typescript-eslint/eslint-plugin": "^4.16.1",
......
...@@ -3,8 +3,8 @@ export const config = { ...@@ -3,8 +3,8 @@ export const config = {
// API_ENDPOINT: 'https://cms.vab.vn/api/', // API_ENDPOINT: 'https://cms.vab.vn/api/',
// API_IMAGE_ENDPOINT: 'https://cms.vab.vn/file/upload/', // API_IMAGE_ENDPOINT: 'https://cms.vab.vn/file/upload/',
// dev // dev
API_ENDPOINT: 'https://cms.vab.xteldev.com/api/', API_ENDPOINT: 'https://103.147.34.20:10700/api/',
API_IMAGE_ENDPOINT: 'https://cms.vab.xteldev.com/file/upload/', API_IMAGE_ENDPOINT: 'https://103.147.34.20:10705/file/upload/',
API_RES_CODE: { API_RES_CODE: {
OK: { OK: {
...@@ -121,4 +121,7 @@ export enum API_PATHS { ...@@ -121,4 +121,7 @@ export enum API_PATHS {
updateConfigHotProduct = 'config/home/product/update/salient', updateConfigHotProduct = 'config/home/product/update/salient',
addConfigHotProduct = 'config/home/product/add/salient', addConfigHotProduct = 'config/home/product/add/salient',
deleteConfigHotProduct = 'config/home/product/delete/salient', deleteConfigHotProduct = 'config/home/product/delete/salient',
getLitCustomerWaiting = 'customer/listRegister',
detailCustomerWaiting = 'customer/detailRegister',
accountCustomerBrowsing = 'customer/accountCustomerBrowsing'
} }
<template>
<div>
<q-dialog
persistent
:model-value="showDialogUpdate"
@update:model-value="$emit('update:showDialogUpdate', $event)"
>
<q-card style="min-width: 900px" bordered>
<q-form greedy @submit.prevent="confirmEditCustomer">
<q-card-section>
<q-item>
<q-item-section>
<q-item-label class="text-h6 text-weight-regular">{{
$t('customer.dialogLabel.title.editCustomer')
}}</q-item-label>
</q-item-section>
</q-item>
</q-card-section>
<q-separator />
<q-card-section>
<div class="row q-col-gutter-sm">
<div class="col-6">
<q-input
v-model="userName"
:label="$t('customer.dialogLabel.fieldLabels.userName')"
:rules="userNameRules"
hide-bottom-space
type="text"
class="q-my-sm"
outlined
readonly
></q-input>
<q-input
v-model="password"
:label="$t('customer.dialogLabel.fieldLabels.password')"
:rules="passwordRules"
outlined
:type="isPwd ? 'password' : 'text'"
class="q-my-sm"
autocomplete="new-password"
hide-bottom-space
>
<template v-slot:append>
<q-icon
:name="isPwd ? 'visibility_off' : 'visibility'"
class="cursor-pointer"
@click="isPwd = !isPwd"
/> </template
></q-input>
<q-input
v-model="code"
label="Mã khách hàng"
hide-bottom-space
type="text"
class="q-my-sm"
outlined
readonly
></q-input>
<q-input
v-model="fullName"
:label="$t('customer.dialogLabel.fieldLabels.customerName')"
type="text"
class="q-my-sm"
outlined
:rules="customerNameRules"
hide-bottom-space
></q-input>
<q-input
v-model="companyName"
:label="$t('customer.dialogLabel.fieldLabels.businessName')"
type="text"
class="q-my-sm"
outlined
:rules="businessNameRules"
hide-bottom-space
></q-input>
<q-input
v-model="taxCode"
label="Mã số thuế"
type="text"
class="q-my-sm"
outlined
hide-bottom-space
></q-input>
<q-input
v-model="address"
:label="$t('customer.dialogLabel.fieldLabels.address')"
type="text"
class="q-my-sm"
:rules="addressRules"
outlined
hide-bottom-space
></q-input>
</div>
<div class="col-6">
<q-input
v-model="email"
:label="$t('customer.dialogLabel.fieldLabels.email')"
type="text"
class="q-my-sm"
outlined
:rules="emailRules"
hide-bottom-space
></q-input>
<q-input
v-model="type"
label="Loại doanh nghiệp"
emit-value
map-options
option-value="id"
option-label="text"
class="q-my-sm"
outlined
hide-bottom-space
></q-input>
<q-select
v-model="level"
:label="$t('customer.dialogLabel.fieldLabels.ratings')"
:options="levelOptions"
:rules="levelRules"
map-options
option-value="id"
option-label="name"
type="text"
class="q-my-sm"
outlined
clearable
hide-bottom-space
></q-select>
<q-input
v-model="representative"
:label="$t('customer.dialogLabel.fieldLabels.representative')"
class="q-my-sm"
type="text"
outlined
:rules="representativeRules"
hide-bottom-space
></q-input>
<q-input
v-model="position"
:label="$t('customer.dialogLabel.fieldLabels.position')"
class="q-my-sm"
type="text"
outlined
:rules="positionRules"
hide-bottom-space
></q-input>
<q-input
v-model="phone"
:label="$t('customer.dialogLabel.fieldLabels.phone')"
class="q-my-sm"
mask="##########"
:rules="phoneRules"
outlined
hide-bottom-space
></q-input>
<div style="padding-top: 13px; padding-left: 12px">
<span class="text-body1">{{
$t('customer.dialogLabel.fieldLabels.status')
}}</span
><q-toggle :true-value="1" :false-value="2" v-model="status" />
</div>
</div>
</div>
</q-card-section>
<q-card-actions align="right">
<q-btn
color="grey"
no-caps
style="width: 90px"
:label="$t('customer.crudActions.cancel')"
@click="$emit('click:CloseBtn')"
/>
<q-btn
type="submit"
color="primary"
no-caps
style="width: 90px"
:label="$t('customer.crudActions.save')"
/>
</q-card-actions>
</q-form>
</q-card>
</q-dialog>
</div>
</template>
<script lang="ts">
import { defineComponent, PropType, Ref, ref, watch } from 'vue';
import { i18n } from 'src/boot/i18n';
import { isEmail } from '../../boot/functions';
import { isMobilePhone } from '../../boot/functions';
import { CustomerLevelType, CustomerType } from 'src/assets/type';
export default defineComponent({
props: {
showDialogUpdate: {
type: Boolean,
required: true,
},
levelOptions: {
type: Array as PropType<CustomerLevelType[]>,
required: true,
},
customerInfo: { type: Object as PropType<CustomerType>, required: true },
},
setup(props, context) {
watch(
() => props.showDialogUpdate,
(value) => {
if (value) {
void getData();
}
}
);
const id: Ref<number | null> = ref(null);
const code: Ref<string | null> = ref(null);
const userName: Ref<string | null> = ref(null);
const fullName: Ref<string | null> = ref(null);
const companyName: Ref<string | null> = ref(null);
const taxCode: Ref<string | null> = ref(null);
const email: Ref<string | null> = ref(null);
const status: Ref<number | null> = ref(1);
const phone: Ref<string | null> = ref(null);
const password: Ref<string | null> = ref(null);
const address: Ref<string | null> = ref(null);
const type: Ref<string | null> = ref(null);
const representative: Ref<string | null> = ref(null);
const position: Ref<string | null> = ref(null);
const level: Ref<CustomerLevelType | null> = ref(null);
const confirmEditCustomer = () => {
context.emit('editCustomer', {
id: id.value,
code: code.value,
userName: userName.value,
fullName: fullName.value,
companyName: companyName.value,
taxCode: taxCode.value,
email: email.value,
status: status.value,
phone: phone.value,
password: password.value,
address: address.value,
type: type.value,
representative: representative.value,
position: position.value,
level: level.value,
});
};
const getData = () => {
id.value = props.customerInfo.id;
code.value = props.customerInfo.code;
userName.value = props.customerInfo.userName;
fullName.value = props.customerInfo.fullName;
companyName.value = props.customerInfo.companyName;
taxCode.value = props.customerInfo.taxCode;
email.value = props.customerInfo.email;
status.value = props.customerInfo.status;
phone.value = props.customerInfo.phone;
password.value = props.customerInfo.password;
address.value = props.customerInfo.address;
type.value = props.customerInfo.type;
representative.value = props.customerInfo.representative;
position.value = props.customerInfo.position;
level.value = props.customerInfo.level;
};
const userNameRules = [
(val?: string) =>
(val && val.trim().length) ||
i18n.global.t('customer.validateMessages.requireUserName'),
];
const passwordRules = [
(val?: string) =>
(val && val.trim().length) ||
i18n.global.t('customer.validateMessages.requirePassword'),
];
// const codeRules = [
// (val?: string) =>
// (val && val.trim().length) ||
// i18n.global.t('customer.validateMessages.requireCode'),
// ];
const customerNameRules = [
(val?: string) =>
(val && val.trim().length) ||
i18n.global.t('customer.validateMessages.requireCustomerName'),
];
const businessNameRules = [
(val?: string) =>
(val && val.trim().length) ||
i18n.global.t('customer.validateMessages.requireBusinessName'),
];
// const taxCodeRules = [
// (val?: string) =>
// (val && val.trim().length) ||
// i18n.global.t('customer.validateMessages.requireTaxCode'),
// ];
const phoneRules = [
(val?: string) =>
(val && val.trim().length) ||
i18n.global.t('customer.validateMessages.requirePhone'),
(val: string) =>
isMobilePhone(val) ||
i18n.global.t('customer.validateMessages.isPhone'),
];
const emailRules = [
(val?: string) =>
(val && val.trim().length) ||
i18n.global.t('customer.validateMessages.requireEmail'),
(val: string) =>
isEmail(val) || i18n.global.t('customer.validateMessages.isEmail'),
];
const addressRules = [
(val?: string) =>
(val && val.trim().length) ||
i18n.global.t('customer.validateMessages.requireAddress'),
];
// const businessTypeRules = [
// (val?: string) =>
// (val && val.trim().length) ||
// i18n.global.t('customer.validateMessages.requireBusinessType'),
// ];
const levelRules = [
(val?: CustomerLevelType) =>
val !== null ||
i18n.global.t('customer.validateMessages.requireRatings'),
];
const representativeRules = [
(val?: string) =>
(val && val.trim().length) ||
i18n.global.t('customer.validateMessages.requireRepresentative'),
];
const positionRules = [
(val?: string) =>
(val && val.trim().length) ||
i18n.global.t('customer.validateMessages.requiredPosition'),
];
return {
isPwd: ref(true),
userNameRules,
customerNameRules,
businessNameRules,
passwordRules,
// codeRules,
// taxCodeRules,
emailRules,
levelRules,
addressRules,
// businessTypeRules,
representativeRules,
positionRules,
phoneRules,
userName,
fullName,
companyName,
taxCode,
email,
status,
phone,
password,
address,
type,
representative,
position,
level,
code,
confirmEditCustomer,
id,
};
},
})
</script>
\ No newline at end of file
...@@ -462,7 +462,7 @@ export default defineComponent({ ...@@ -462,7 +462,7 @@ export default defineComponent({
const response = (await api({ const response = (await api({
headers: { 'Content-Type': 'multipart/form-data' }, headers: { 'Content-Type': 'multipart/form-data' },
// url: 'https://cms.vab.vn/file/upload/', // pro // url: 'https://cms.vab.vn/file/upload/', // pro
url: 'https://cms.vab.xteldev.com/file/upload/', // test url: 'https://103.147.34.20:10705/file/upload/', // test
method: 'POST', method: 'POST',
data: bodyFormData, data: bodyFormData,
......
...@@ -401,7 +401,7 @@ export default defineComponent({ ...@@ -401,7 +401,7 @@ export default defineComponent({
const response = (await api({ const response = (await api({
headers: { 'Content-Type': 'multipart/form-data' }, headers: { 'Content-Type': 'multipart/form-data' },
// url: 'https://cms.vab.vn/file/upload/', // pro // url: 'https://cms.vab.vn/file/upload/', // pro
url: 'https://cms.vab.xteldev.com/file/upload/', // test url: 'https://103.147.34.20:10705/file/upload/', // test
method: 'POST', method: 'POST',
data: bodyFormData, data: bodyFormData,
......
...@@ -409,7 +409,7 @@ export default defineComponent({ ...@@ -409,7 +409,7 @@ export default defineComponent({
const response = (await api({ const response = (await api({
headers: { 'Content-Type': 'multipart/form-data' }, headers: { 'Content-Type': 'multipart/form-data' },
// url: 'https://cms.vab.vn/file/upload/', // pro // url: 'https://cms.vab.vn/file/upload/', // pro
url: 'https://cms.vab.xteldev.com/file/upload/', // test url: 'https://103.147.34.20:10705/file/upload/', // test
method: 'POST', method: 'POST',
data: bodyFormData, data: bodyFormData,
......
...@@ -469,7 +469,7 @@ export default defineComponent({ ...@@ -469,7 +469,7 @@ export default defineComponent({
const response = (await api({ const response = (await api({
headers: { 'Content-Type': 'multipart/form-data' }, headers: { 'Content-Type': 'multipart/form-data' },
// url: 'https://cms.vab.vn/file/upload/', // pro // url: 'https://cms.vab.vn/file/upload/', // pro
url: 'https://cms.vab.xteldev.com/file/upload/', // test url: 'https://103.147.34.20:10705/file/upload/', // test
method: 'POST', method: 'POST',
data: bodyFormData, data: bodyFormData,
......
...@@ -414,7 +414,7 @@ export default defineComponent({ ...@@ -414,7 +414,7 @@ export default defineComponent({
const response = (await api({ const response = (await api({
headers: { 'Content-Type': 'multipart/form-data' }, headers: { 'Content-Type': 'multipart/form-data' },
// url: 'https://cms.vab.vn/file/upload/', // pro // url: 'https://cms.vab.vn/file/upload/', // pro
url: 'https://cms.vab.xteldev.com/file/upload/', // test url: 'https://103.147.34.20:10705/file/upload/', // test
method: 'POST', method: 'POST',
data: bodyFormData, data: bodyFormData,
})) as AxiosResponse<BaseResponseBody<FileUploadType>>; })) as AxiosResponse<BaseResponseBody<FileUploadType>>;
......
<template>
<div class="row q-col-gutter-sm flex-center q-mt-sm">
<div class="col-auto text-h6 text-weight-regular flex flex-center q-mr-md">
{{ $t('customer.title') }}
<q-separator vertical spaced />
</div>
<q-space></q-space>
<div class="col-2">
<q-input
v-model="companyNameSelected"
dense
outlined
:label="$t('customer.tableColumnsCustomer.businessName')"
clearable
></q-input>
</div>
<div class="col-2">
<q-input
v-model="taxCodeSelected"
dense
outlined
:label="$t('customer.tableColumnsCustomer.taxCode')"
clearable
></q-input>
</div>
<div class="col-2" dense outlined>
<q-select
v-model="levelSelected"
:options="levelOptions"
option-label="name"
option-value="id"
dense
outlined
label="Xếp hạng"
clearable
></q-select>
</div>
<div class="col-auto">
<q-btn
color="primary"
no-caps
:label="$t('crudActions.search')"
style="width: 100px"
@click="getListCustomers"
>
</q-btn>
</div>
<!-- <div class="col-auto">
<q-btn
color="primary"
no-caps
:label="$t('crudActions.add')"
style="width: 100px"
@click="openAddCustomerDialog"
>
</q-btn>
</div> -->
<div class="col-12 q-mt-sm">
<q-table
:rows="userTableRowsCustomer"
:columns="userTableColumnsCustomer"
:no-data-label="$t('emptyData')"
row-key="name"
separator="cell"
:rows-per-page-label="$t('recordPerPage')"
:pagination="{
rowsPerPage: 0,
}"
wrap-cells
hide-pagination
class="sticky-header-table"
>
<template v-slot:body-cell-stt="item">
<q-td :item="item" style="text-align: center">
{{ 1 + item.rowIndex + pageSize * (pageIndex - 1) }}
</q-td>
</template>
<template v-slot:body-cell-action="rowData">
<q-td style="padding: 0; text-align: center">
<!-- <q-btn
flat
round
color="primary"
icon="mdi-account-edit-outline"
@click="openUpdateCustomerDialog(rowData.row.id)"
>
<q-tooltip :offset="[20, 10]">{{
$t('customer.toolTipMessage.updateCustomerInfo')
}}</q-tooltip>
</q-btn> -->
<q-btn
flat
round
color="primary"
icon="mdi-check-circle-outline"
@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
round
color="primary"
icon="mdi-delete-outline"
@click="confirmDeleteCustomer(rowData.row.id)"
>
<q-tooltip :offset="[20, 10]">{{
$t('customer.toolTipMessage.deleteCustomer')
}}</q-tooltip>
</q-btn> -->
</q-td>
</template>
<template v-slot:body-cell-status="rowData">
<q-td>
<div align="center">
<q-chip
:color="rowData.value === 1 ? 'positive' : 'orange'"
text-color="white"
size="sm"
>
{{
rowData.value === 1
? $t('customer.statusLabel.active')
: $t('customer.statusLabel.inactive')
}}
</q-chip>
</div>
</q-td>
</template>
<template v-slot:body-cell-approvalStatus="rowData">
<q-td>
<div align="center">
<q-chip
:color="rowData.value === 1 ? 'positive' : 'orange'"
text-color="white"
size="sm"
>
{{
rowData.value === 1
? 'Đã duyệt'
: 'Chưa duyệt'
}}
</q-chip>
</div>
</q-td>
</template>
</q-table>
<div class="col-12 q-mt-sm">
<Pagination
v-model:currentPage="pageIndex"
v-model:pageSize="pageSize"
:totalPage="totalPage"
@update:pageSize="changePageSize"
@update:currentPage="getListCustomers"
/>
<!-- <AddNewCustomerDialogComponent
v-model:show-dialog="showDialog"
:level-options="levelOptions"
:list-customers="userTableRowsCustomer"
@click:CloseBtn="showDialog = false"
@addNewCustomer="addCustomer"
></AddNewCustomerDialogComponent> -->
<UpdateNewCustomerDialogComponent
v-model:show-dialog-update="showDialogUpdate"
:level-options="levelOptions"
:customer-info="customerInfo"
@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>
</template>
<script lang="ts">
import { i18n } from 'src/boot/i18n';
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/browser-new-customer-dialog.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';
import {
CustomerType,
PaginationResponse,
CustomerLevelType,
} from 'src/assets/type';
import { Dialog, Notify } from 'quasar';
export default defineComponent({
components: {
// AddNewCustomerDialogComponent,
UpdateNewCustomerDialogComponent,
RefusedBrowserCustomer,
Pagination,
},
setup() {
const dataTest = ref([]);
const userTableColumnsCustomer = [
{
name: 'stt',
field: 'stt',
required: true,
label: i18n.global.t('customer.tableColumnsCustomer.stt'),
align: 'center',
sortable: false,
},
{
name: 'code',
field: 'code',
required: true,
label: i18n.global.t('customer.tableColumnsCustomer.customerCode'),
align: 'center',
headerStyle: 'text-align: center !important;',
sortable: false,
},
{
name: 'userName',
field: 'userName',
required: true,
label: i18n.global.t('customer.tableColumnsCustomer.userName'),
headerStyle: 'text-align: center !important;',
align: 'left',
sortable: false,
},
{
name: 'fullName',
field: 'fullName',
required: true,
label: i18n.global.t('customer.tableColumnsCustomer.fullName'),
headerStyle: 'text-align: center !important;',
align: 'left',
sortable: false,
},
{
name: 'companyName',
field: 'companyName',
required: true,
label: i18n.global.t('customer.tableColumnsCustomer.businessName'),
headerStyle: 'text-align: center !important;',
align: 'left',
sortable: false,
},
{
name: 'taxCode',
field: 'taxCode',
required: true,
label: i18n.global.t('customer.tableColumnsCustomer.taxCode'),
headerStyle: 'text-align: center !important;',
align: 'left',
sortable: false,
},
{
name: 'email',
field: 'email',
required: true,
label: i18n.global.t('customer.tableColumnsCustomer.email'),
headerStyle: 'text-align: center !important;',
align: 'left',
sortable: false,
},
{
name: 'level',
field: 'level',
required: true,
label: i18n.global.t('customer.tableColumnsCustomer.ratings'),
headerStyle: 'text-align: center !important;',
align: 'left',
sortable: false,
},
{
name: 'status',
field: 'status',
required: true,
label: i18n.global.t('customer.tableColumnsCustomer.status'),
align: 'center',
sortable: false,
},
{
name: 'approvalStatus',
field: 'approvalStatus',
required: true,
label: 'T.thái duyệt',
align: 'center',
sortable: false,
},
{
name: 'action',
field: 'action',
required: true,
label: i18n.global.t('customer.tableColumnsCustomer.action'),
align: 'center',
sortable: false,
},
];
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);
const totalPage = ref(0);
const companyNameSelected: Ref<string | null> = ref(null);
const taxCodeSelected: Ref<string | null> = ref(null);
const levelSelected: Ref<CustomerLevelType | null> = ref(null);
const id: Ref<number | undefined> = ref(undefined);
const code: Ref<string | null> = ref(null);
const userName: Ref<string | null> = ref(null);
const fullName: Ref<string | null> = ref(null);
const companyName: Ref<string | null> = ref(null);
const taxCode: Ref<string | null> = ref(null);
const email: Ref<string | null> = ref(null);
const status: Ref<number | null> = ref(2);
const phone: Ref<string | null> = ref(null);
const password: Ref<string | null> = ref(null);
const address: Ref<string | null> = ref(null);
const type: Ref<string | null> = ref(null);
const representative: Ref<string | null> = ref(null);
const position: Ref<string | null> = ref(null);
const level: Ref<CustomerLevelType | null> = ref(null);
const levelOptions: Ref<CustomerLevelType[] | null> = ref([]);
const getListCustomers = async () => {
try {
const response = (await api({
url: API_PATHS.getLitCustomerWaiting,
method: 'GET',
params: {
pageIndex: pageIndex.value,
pageSize: pageSize.value,
},
})) as AxiosResponse<
BaseResponseBody<PaginationResponse<CustomerType>>
>;
if (response.data.error.code === config.API_RES_CODE.OK.code) {
userTableRowsCustomer.value = response.data.data.data;
totalPage.value = response.data.data.totalPages;
}
} catch (error) {}
};
const getCustomerLevelOptions = async () => {
const response = (await api({
url: API_PATHS.listCustomerLevel,
method: 'GET',
params: {},
})) as AxiosResponse<BaseResponseBody<CustomerLevelType[]>>;
if (response.data.error.code === config.API_RES_CODE.OK.code) {
levelOptions.value = response.data.data;
}
};
// const confirmDeleteCustomer = (id: number) => {
// Dialog.create({
// title: i18n.global.t(
// 'customer.confirmActionsTitle.confirmDeleteUserTitle'
// ),
// message: i18n.global.t(
// 'customer.confirmActionsTitle.confirmDeleteUserContent'
// ),
// cancel: i18n.global.t(
// 'customer.confirmActionsTitle.confirmDeleteUserCancelBtnLabel'
// ),
// color: 'negative',
// }).onOk(() => {
// void deleteCustomer(id);
// });
// };
const confirmRefusedBrowserCustomer = (id:number) => {
customerId.value = id
openDialogRefusedBrowser.value = true
}
// const deleteCustomer = async (id: number) => {
// try {
// const deleteResult = (await api({
// url: API_PATHS.deleteCustomer,
// method: 'GET',
// params: {
// id: id,
// },
// })) as AxiosResponse<BaseResponseBody<unknown>>;
// if (deleteResult.data.error.code === config.API_RES_CODE.OK.code) {
// Notify.create({
// type: 'positive',
// message: i18n.global.t('customer.actionMessages.deleteUserAccess'),
// actions: [{ icon: 'close', color: 'white' }],
// });
// void getListCustomers();
// }
// } catch (error) {}
// };
// const addCustomer = async (item: CustomerType) => {
// try {
// const response = (await api({
// url: API_PATHS.addCustomer,
// method: 'POST',
// data: {
// code: item.code,
// userName: item.userName,
// fullName: item.fullName,
// companyName: item.companyName,
// taxCode: item.taxCode,
// email: item.email,
// status: item.status,
// phone: item.phone,
// password: item.password,
// address: item.address,
// type: item.type,
// representative: item.representative,
// position: item.position,
// level: item.level,
// },
// })) as AxiosResponse<BaseResponseBody<unknown>>;
// if (response.data.error.code === config.API_RES_CODE.OK.code) {
// Notify.create({
// type: 'positive',
// message: i18n.global.t('customer.actionMessages.addNewUserAccess'),
// actions: [{ icon: 'close', color: 'white' }],
// });
// void getListCustomers();
// showDialog.value = false;
// }
// } catch (error) {}
// };
const changePageSize = () => {
pageIndex.value = 1;
void getListCustomers();
};
// const openAddCustomerDialog = () => {
// showDialog.value = true;
// userName.value = null;
// fullName.value = null;
// companyName.value = null;
// taxCode.value = null;
// email.value = null;
// level.value = null;
// address.value = null;
// type.value = null;
// representative.value = null;
// position.value = null;
// phone.value = null;
// status.value = 2;
// };
const getDetailCustomer = async (id: number) => {
try {
const response = (await api({
url: API_PATHS.detailCustomerWaiting,
method: 'GET',
params: {
id: id,
},
})) as AxiosResponse<BaseResponseBody<CustomerType>>;
if (response.data.error.code === config.API_RES_CODE.OK.code) {
customerInfo.value = response.data.data;
showDialogUpdate.value = true;
}
} catch (error) {}
};
const confirmBrowserCustomer = (id: number) => {
void getDetailCustomer(id);
};
//Bấm nút lưu ở dialog update thì gọi api cập nhật trong hàm updateCustomer
const updateCustomer = async (item: CustomerType) => {
try {
const response = (await api({
url: API_PATHS.accountCustomerBrowsing,
method: 'POST',
data: {
id: item.id,
code: item.code,
userName: item.userName,
fullName: item.fullName,
companyName: item.companyName,
taxCode: item.taxCode,
email: item.email,
status: item.status,
phone: item.phone,
password: item.password,
address: item.address,
type: item.type,
representative: item.representative,
position: item.position,
level: item.level,
},
})) as AxiosResponse<BaseResponseBody<unknown>>;
if (response.data.error.code === config.API_RES_CODE.OK.code) {
Notify.create({
type: 'positive',
message: 'Duyệt tài khaorn thành công',
actions: [{ icon: 'close', color: 'white' }],
});
void getListCustomers();
showDialogUpdate.value = false;
}
} catch (error) {}
};
onMounted(() => {
void getListCustomers();
void getCustomerLevelOptions();
});
return {
// openUpdateCustomerDialog,
updateCustomer,
// openAddCustomerDialog,
// addCustomer,
showDialogUpdate,
// showDialog,
openDialogRefusedBrowser,
id,
userName,
fullName,
companyName,
taxCode,
code,
password,
type,
email,
level,
levelOptions,
address,
representative,
position,
levelSelected,
phone,
companyNameSelected,
taxCodeSelected,
status,
userTableColumnsCustomer,
userTableRowsCustomer,
getListCustomers,
pageIndex,
pageSize,
dataTest,
totalPage,
changePageSize,
getCustomerLevelOptions,
// confirmDeleteCustomer,
confirmBrowserCustomer,
customerInfo,
customerId,
confirmRefusedBrowserCustomer
};
},
});
</script>
...@@ -89,7 +89,7 @@ ...@@ -89,7 +89,7 @@
$t('customer.toolTipMessage.updateCustomerInfo') $t('customer.toolTipMessage.updateCustomerInfo')
}}</q-tooltip> }}</q-tooltip>
</q-btn> </q-btn>
<q-btn <!-- <q-btn
flat flat
round round
color="primary" color="primary"
...@@ -97,8 +97,8 @@ ...@@ -97,8 +97,8 @@
@click="confirmBrowserCustomer(rowData.row.id)" @click="confirmBrowserCustomer(rowData.row.id)"
> >
<q-tooltip :offset="[20, 10]">Duyệt tài khoản</q-tooltip> <q-tooltip :offset="[20, 10]">Duyệt tài khoản</q-tooltip>
</q-btn> </q-btn> -->
<q-btn <!-- <q-btn
flat flat
round round
color="primary" color="primary"
...@@ -106,7 +106,7 @@ ...@@ -106,7 +106,7 @@
@click="confirmRefusedBrowserCustomer(rowData.row.id)" @click="confirmRefusedBrowserCustomer(rowData.row.id)"
> >
<q-tooltip :offset="[10, 10]">Từ chối duyệt</q-tooltip> <q-tooltip :offset="[10, 10]">Từ chối duyệt</q-tooltip>
</q-btn> </q-btn> -->
<q-btn <q-btn
flat flat
round round
...@@ -138,7 +138,7 @@ ...@@ -138,7 +138,7 @@
</q-td> </q-td>
</template> </template>
<template v-slot:body-cell-approvalStatus="rowData"> <!-- <template v-slot:body-cell-approvalStatus="rowData">
<q-td> <q-td>
<div align="center"> <div align="center">
<q-chip <q-chip
...@@ -154,7 +154,7 @@ ...@@ -154,7 +154,7 @@
</q-chip> </q-chip>
</div> </div>
</q-td> </q-td>
</template> </template> -->
</q-table> </q-table>
<div class="col-12 q-mt-sm"> <div class="col-12 q-mt-sm">
<Pagination <Pagination
...@@ -181,13 +181,13 @@ ...@@ -181,13 +181,13 @@
@editCustomer="updateCustomer" @editCustomer="updateCustomer"
></UpdateNewCustomerDialogComponent> ></UpdateNewCustomerDialogComponent>
<RefusedBrowserCustomer <!-- <RefusedBrowserCustomer
:customer-id="customerId" :customer-id="customerId"
v-model:open-dialog-refused-browser="openDialogRefusedBrowser" v-model:open-dialog-refused-browser="openDialogRefusedBrowser"
@click:CloseBtn="openDialogRefusedBrowser = false" @click:CloseBtn="openDialogRefusedBrowser = false"
@editReCustomer="getListCustomers" @editReCustomer="getListCustomers"
> >
</RefusedBrowserCustomer> </RefusedBrowserCustomer> -->
</div> </div>
</div> </div>
...@@ -200,7 +200,7 @@ import { defineComponent, onMounted, Ref, ref } from 'vue'; ...@@ -200,7 +200,7 @@ import { defineComponent, onMounted, Ref, ref } from 'vue';
import Pagination from 'components/pagination/index.vue'; import Pagination from 'components/pagination/index.vue';
import AddNewCustomerDialogComponent from '../../components/customer/add-new-customer-dialog/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 UpdateNewCustomerDialogComponent from '../../components/customer/update-new-customer-dialog/index.vue';
import RefusedBrowserCustomer from '../../components/customer/openDialogRefusedBrowser.vue' // import RefusedBrowserCustomer from '../../components/customer/openDialogRefusedBrowser.vue'
import { API_PATHS, config } from 'src/assets/configurations.example'; import { API_PATHS, config } from 'src/assets/configurations.example';
import { AxiosResponse } from 'axios'; import { AxiosResponse } from 'axios';
import { api, BaseResponseBody } from 'src/boot/axios'; import { api, BaseResponseBody } from 'src/boot/axios';
...@@ -214,7 +214,7 @@ export default defineComponent({ ...@@ -214,7 +214,7 @@ export default defineComponent({
components: { components: {
AddNewCustomerDialogComponent, AddNewCustomerDialogComponent,
UpdateNewCustomerDialogComponent, UpdateNewCustomerDialogComponent,
RefusedBrowserCustomer, // RefusedBrowserCustomer,
Pagination, Pagination,
}, },
setup() { setup() {
......
...@@ -285,7 +285,7 @@ export default defineComponent({ ...@@ -285,7 +285,7 @@ export default defineComponent({
const response = (await api({ const response = (await api({
headers: { 'Content-Type': 'multipart/form-data' }, headers: { 'Content-Type': 'multipart/form-data' },
// url: 'https://cms.vab.vn/file/upload/', // pro // url: 'https://cms.vab.vn/file/upload/', // pro
url: 'https://cms.vab.xteldev.com/file/upload/', // test url: 'https://103.147.34.20:10705/file/upload/', // test
method: 'POST', method: 'POST',
data: bodyFormData, data: bodyFormData,
})) as AxiosResponse<BaseResponseBody<FileUploadType>>; })) as AxiosResponse<BaseResponseBody<FileUploadType>>;
......
...@@ -10,6 +10,7 @@ export enum Pages { ...@@ -10,6 +10,7 @@ export enum Pages {
informationArtist = 'cap-nhat-thong-tin-nghe-sy', informationArtist = 'cap-nhat-thong-tin-nghe-sy',
customer = 'khach-hang', customer = 'khach-hang',
customerWaiting = 'khach-hang-cho-duyet',
addArtist = 'them-nghe-sy', addArtist = 'them-nghe-sy',
customerRank = 'xep-hang-khach-hang', customerRank = 'xep-hang-khach-hang',
artistRank = 'Xep-hang-nghi-sy', artistRank = 'Xep-hang-nghi-sy',
...@@ -82,6 +83,11 @@ const routes: RouteRecordRaw[] = [ ...@@ -82,6 +83,11 @@ const routes: RouteRecordRaw[] = [
component: () => import('pages/khach-hang/index.vue'), component: () => import('pages/khach-hang/index.vue'),
name: Pages.customer, name: Pages.customer,
}, },
{
path: '/khach-hang-cho-duyet',
component: () => import('pages/khach-hang-cho-duyet/index.vue'),
name: Pages.customerWaiting,
},
{ {
path: 'xep-hang-khach-hang', path: 'xep-hang-khach-hang',
component: () => import('pages/xep-hang-khach-hang/index.vue'), component: () => import('pages/xep-hang-khach-hang/index.vue'),
......
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