Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Q
quasar-web-base
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Nguyễn Hải Sơn
quasar-web-base
Commits
eec5c80a
Commit
eec5c80a
authored
May 10, 2021
by
Tình Trương
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
7e6a2497
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
315 additions
and
276 deletions
+315
-276
configurations.example.ts
src/assets/configurations.example.ts
+5
-0
enums.ts
src/assets/enums.ts
+1
-1
type.ts
src/assets/type.ts
+34
-0
index.vue
src/components/add-update-customer-rank/index.vue
+35
-77
index.ts
src/i18n/vi/index.ts
+19
-24
index.vue
src/pages/don-vi-chu-quan/index.vue
+2
-2
index.vue
src/pages/xep-hang-khach-hang/index.vue
+217
-170
routes.ts
src/router/routes.ts
+2
-2
No files found.
src/assets/configurations.example.ts
View file @
eec5c80a
...
@@ -55,4 +55,9 @@ export enum API_PATHS {
...
@@ -55,4 +55,9 @@ export enum API_PATHS {
listCustomerLevel
=
'customerLevel'
,
listCustomerLevel
=
'customerLevel'
,
addCustomer
=
'customer/add'
,
addCustomer
=
'customer/add'
,
deleteCustomer
=
'customer/delete'
,
deleteCustomer
=
'customer/delete'
,
getListCustomersRank
=
'customerLevel'
,
deleteCustomerRank
=
'customerLevel/delete'
,
addCustomerRank
=
'customerLevel/add'
,
updateCustomerRank
=
'customerLevel/update'
,
getDetailCustomerRank
=
'customerLevel/detail'
,
}
}
src/assets/enums.ts
View file @
eec5c80a
...
@@ -16,5 +16,5 @@ export enum HotProductStatus {
...
@@ -16,5 +16,5 @@ export enum HotProductStatus {
export
enum
CustomerRankStatus
{
export
enum
CustomerRankStatus
{
active
=
1
,
active
=
1
,
inactive
=
2
,
inactive
=
0
,
}
}
src/assets/type.ts
View file @
eec5c80a
...
@@ -251,3 +251,37 @@ export type CustomerLevelType = {
...
@@ -251,3 +251,37 @@ export type CustomerLevelType = {
level
:
number
;
level
:
number
;
status
:
number
;
status
:
number
;
};
};
export
type
CustomerRank
=
{
id
:
number
;
code
:
string
;
name
:
string
;
description
:
string
;
level
:
number
;
status
:
number
;
};
export
type
AddCustomerRank
=
{
name
:
string
;
description
:
string
;
level
:
number
;
status
:
number
;
};
export
type
UpdateCustomerRank
=
{
id
:
number
;
code
:
string
;
name
:
string
;
description
:
string
;
level
:
number
;
status
:
number
;
};
export
type
DetailCustomerRank
=
{
id
:
number
;
code
:
string
;
name
:
string
;
description
:
string
;
level
:
number
;
status
:
number
;
};
src/components/add-update-customer-rank/index.vue
View file @
eec5c80a
...
@@ -4,7 +4,7 @@
...
@@ -4,7 +4,7 @@
:model-value=
"isOpened"
:model-value=
"isOpened"
@
update:model-value=
"$emit('update:isOpened', $event)"
@
update:model-value=
"$emit('update:isOpened', $event)"
>
>
<q-card
class=
"full-width"
style=
"max-width:
5
0rem"
bordered
>
<q-card
class=
"full-width"
style=
"max-width:
3
0rem"
bordered
>
<q-form
<q-form
greedy
greedy
@
submit
.
prevent=
"
@
submit
.
prevent=
"
...
@@ -30,70 +30,45 @@
...
@@ -30,70 +30,45 @@
style=
"max-height: calc(100vh - 10rem)"
style=
"max-height: calc(100vh - 10rem)"
>
>
<div
class=
"row q-col-gutter-sm"
>
<div
class=
"row q-col-gutter-sm"
>
<div
class=
"col-
6
"
>
<div
class=
"col-
12
"
>
<q-input
<q-input
:model-value=
"
rankC
ode"
:model-value=
"
c
ode"
@
update:model-value=
"$emit('update:
rankC
ode', $event)"
@
update:model-value=
"$emit('update:
c
ode', $event)"
:label=
"$t('customerRank.dialogLabel.fieldLabels.
rankC
ode')"
:label=
"$t('customerRank.dialogLabel.fieldLabels.
c
ode')"
type=
"text"
type=
"text"
class=
"q-my-sm"
class=
"q-my-sm"
outlined
outlined
:rules=
"
rankC
odeRules"
:rules=
"
c
odeRules"
clearable
clearable
></q-input>
></q-input>
<q-input
<q-input
:model-value=
"
rankN
ame"
:model-value=
"
n
ame"
@
update:model-value=
"$emit('update:
rankN
ame', $event)"
@
update:model-value=
"$emit('update:
n
ame', $event)"
:label=
"$t('customerRank.dialogLabel.fieldLabels.
rankN
ame')"
:label=
"$t('customerRank.dialogLabel.fieldLabels.
n
ame')"
type=
"text"
type=
"text"
class=
"q-my-sm"
class=
"q-my-sm"
outlined
outlined
:rules=
"
rankN
ameRules"
:rules=
"
n
ameRules"
clearable
clearable
></q-input>
></q-input>
<q-select
:model-value=
"rankType"
@
update:model-value=
"$emit('update:rankType', $event)"
:label=
"$t('customerRank.dialogLabel.fieldLabels.rankType')"
:options=
"rankTypeOptions"
:rules=
"rankTypeRules"
map-options
option-value=
"id"
option-label=
"name"
class=
"q-my-sm"
outlined
></q-select>
</div>
<div
class=
"col-6"
>
<q-input
<q-input
:model-value=
"discount"
:model-value=
"level"
@
update:model-value=
"$emit('update:discount', $event)"
@
update:model-value=
"$emit('update:level', $event)"
:label=
"$t('customerRank.dialogLabel.fieldLabels.discount')"
:label=
"$t('customerRank.dialogLabel.fieldLabels.level')"
type=
"text"
:rules=
"levelRules"
type=
"number"
class=
"q-my-sm"
class=
"q-my-sm"
outlined
outlined
:rules=
"discountRules"
clearable
></q-input>
<q-input
:model-value=
"discountCode"
@
update:model-value=
"$emit('update:discountCode', $event)"
:label=
"$t('customerRank.dialogLabel.fieldLabels.discountCode')"
type=
"text"
class=
"q-my-sm"
outlined
:rules=
"discountCodeRules"
clearable
></q-input>
></q-input>
<div
class=
"q-pt-sm"
>
<div
class=
"q-pt-sm"
>
<span
class=
"text-body1"
>
{{
<span
class=
"text-body1"
>
{{
$t
(
'customerRank.dialogLabel.fieldLabels.
rankS
tatus'
)
$t
(
'customerRank.dialogLabel.fieldLabels.
s
tatus'
)
}}
</span
}}
</span
><q-toggle
><q-toggle
:model-value=
"
rankS
tatus"
:model-value=
"
s
tatus"
:true-value=
"1"
:true-value=
"1"
:false-value=
"2"
:false-value=
"2"
@
update:model-value=
"$emit('update:
rankS
tatus', $event)"
@
update:model-value=
"$emit('update:
s
tatus', $event)"
/>
/>
</div>
</div>
</div>
</div>
...
@@ -134,56 +109,39 @@ export default defineComponent({
...
@@ -134,56 +109,39 @@ export default defineComponent({
required
:
true
,
required
:
true
,
},
},
isUpdate
:
{
type
:
Boolean
,
default
:
false
},
isUpdate
:
{
type
:
Boolean
,
default
:
false
},
rankCode
:
{
type
:
String
,
required
:
true
},
code
:
{
type
:
String
,
required
:
true
},
rankName
:
{
type
:
String
,
required
:
true
},
name
:
{
type
:
String
,
required
:
true
},
discount
:
{
type
:
String
,
required
:
true
},
level
:
{
type
:
Number
,
required
:
true
},
discountCode
:
{
type
:
String
,
required
:
true
},
status
:
{
type
:
Number
,
required
:
true
},
rankType
:
{
type
:
Number
,
required
:
true
},
rankTypeOptions
:
{
type
:
Array
,
required
:
true
},
rankStatus
:
{
type
:
Number
,
required
:
true
},
},
},
setup
()
{
setup
()
{
const
rankType
Rules
=
[
const
level
Rules
=
[
(
val
?:
number
)
=>
(
val
?:
number
)
=>
val
!==
undefined
||
val
!==
undefined
||
i18n
.
global
.
t
(
'customerRank.validateMessages.requireRankType'
),
i18n
.
global
.
t
(
'customerRank.validateMessages.requireLevel'
),
];
const
rankCodeRules
=
[
(
val
?:
string
)
=>
(
val
&&
val
.
trim
().
length
)
||
i18n
.
global
.
t
(
'customerRank.validateMessages.requireRankCode'
),
];
const
rankNameRules
=
[
(
val
?:
string
)
=>
(
val
&&
val
.
trim
().
length
)
||
i18n
.
global
.
t
(
'customerRank.validateMessages.requireRankName'
),
];
];
const
discount
Rules
=
[
const
code
Rules
=
[
(
val
?:
string
)
=>
(
val
?:
string
)
=>
(
val
&&
val
.
trim
().
length
)
||
(
val
&&
val
.
trim
().
length
)
||
i18n
.
global
.
t
(
'customerRank.validateMessages.require
Discount
'
),
i18n
.
global
.
t
(
'customerRank.validateMessages.require
Code
'
),
];
];
const
discountCod
eRules
=
[
const
nam
eRules
=
[
(
val
?:
string
)
=>
(
val
?:
string
)
=>
(
val
&&
val
.
trim
().
length
)
||
(
val
&&
val
.
trim
().
length
)
||
i18n
.
global
.
t
(
'customerRank.validateMessages.require
DiscountCod
e'
),
i18n
.
global
.
t
(
'customerRank.validateMessages.require
Nam
e'
),
];
];
return
{
return
{
rankTypeRules
,
levelRules
,
rankCodeRules
,
codeRules
,
rankNameRules
,
nameRules
,
discountRules
,
discountCodeRules
,
};
};
},
},
emits
:
[
emits
:
[
'update:isOpened'
,
'update:isOpened'
,
'update:rankCode'
,
'update:code'
,
'update:rankName'
,
'update:name'
,
'update:rankType'
,
'update:level'
,
'update:discount'
,
'update:status'
,
'update:discountCode'
,
'update:rankStatus'
,
'saveCustomerRankInfo'
,
'saveCustomerRankInfo'
,
],
],
});
});
...
...
src/i18n/vi/index.ts
View file @
eec5c80a
...
@@ -517,15 +517,13 @@ export default {
...
@@ -517,15 +517,13 @@ export default {
//xếp hạng khách hàng
//xếp hạng khách hàng
customerRank
:
{
customerRank
:
{
title
:
'
Xếp hạ
ng'
,
title
:
'
Danh mục xếp hạng khách hà
ng'
,
tableColumnsCustomerRank
:
{
tableColumnsCustomerRank
:
{
stt
:
'STT'
,
stt
:
'STT'
,
rankCode
:
'Mã xếp hạng'
,
code
:
'Mã xếp hạng'
,
rankName
:
'Tên xếp hạng'
,
name
:
'Tên xếp hạng'
,
rankType
:
'Loại xếp hạng'
,
level
:
'Loại xếp hạng'
,
discount
:
'Chiết khấu (%)'
,
status
:
'Trạng thái'
,
discountCode
:
'Mã chiết khấu'
,
rankStatus
:
'Trạng thái'
,
action
:
'Chức năng'
,
action
:
'Chức năng'
,
},
},
statusLabel
:
{
statusLabel
:
{
...
@@ -534,16 +532,14 @@ export default {
...
@@ -534,16 +532,14 @@ export default {
},
},
dialogLabel
:
{
dialogLabel
:
{
title
:
{
title
:
{
addCustomerRank
:
'Thêm
xếp hạ
ng'
,
addCustomerRank
:
'Thêm
danh mục xếp hạng khách hà
ng'
,
updateCustomerRank
:
'Cập nhật
xếp hạ
ng'
,
updateCustomerRank
:
'Cập nhật
danh mục xếp hạng khách hà
ng'
,
},
},
fieldLabels
:
{
fieldLabels
:
{
rankCode
:
'Mã xếp hạng *'
,
code
:
'Mã xếp hạng *'
,
rankName
:
'Tên xếp hạng *'
,
name
:
'Tên xếp hạng *'
,
rankType
:
'Loại xếp hạng *'
,
level
:
'Loại xếp hạng *'
,
discount
:
'Chiết khấu (%) *'
,
status
:
'Trạng thái'
,
discountCode
:
'Mã chiết khấu *'
,
rankStatus
:
'Trạng thái'
,
},
},
},
},
toolTipMessage
:
{
toolTipMessage
:
{
...
@@ -555,22 +551,21 @@ export default {
...
@@ -555,22 +551,21 @@ export default {
cancel
:
'Đóng'
,
cancel
:
'Đóng'
,
},
},
validateMessages
:
{
validateMessages
:
{
requireRankCode
:
'Vui lòng nhập Mã xếp hạng'
,
requireCode
:
'Vui lòng nhập Mã xếp hạng'
,
requireRankName
:
'Vui lòng nhập Tên xếp hạng'
,
requireName
:
'Vui lòng nhập Tên xếp hạng'
,
requireRankType
:
'Vui lòng chọn Loại xếp hạng'
,
requireLevel
:
'Vui lòng nhập Loại xếp hạng'
,
requireDiscount
:
'Vui lòng nhập % chiết khấu'
,
requireDiscountCode
:
'Vui lòng nhập Mã chiết khấu'
,
},
},
confirmActionsTitle
:
{
confirmActionsTitle
:
{
confirmDeleteCustomerRankTitle
:
'Xác nhận'
,
confirmDeleteCustomerRankTitle
:
'Xác nhận'
,
confirmDeleteCustomerRankCancelBtnLabel
:
'Huỷ'
,
confirmDeleteCustomerRankCancelBtnLabel
:
'Huỷ'
,
confirmDeleteCustomerRankContent
:
confirmDeleteCustomerRankContent
:
'Bạn có chắc
muốn xoá xếp hạ
ng này không?'
,
'Bạn có chắc
chắn muốn xoá danh mục xếp hạng khách hà
ng này không?'
,
},
},
actionMessages
:
{
actionMessages
:
{
addNewCustomerRankAccess
:
'Thêm xếp hạng thành công'
,
addNewCustomerRankAccess
:
'Thêm danh mục xếp hạng khách hàng thành công'
,
deleteCustomerRankAccess
:
'Xoá xếp hạng thành công'
,
deleteCustomerRankAccess
:
'Xoá danh mục xếp hạng khách hàng thành công'
,
updateCustomerRankAccess
:
'Cập nhật xếp hạng thành công'
,
updateCustomerRankAccess
:
'Cập nhật danh mục xếp hạng khách hàng thành công'
,
},
},
},
},
};
};
src/pages/don-vi-chu-quan/index.vue
View file @
eec5c80a
...
@@ -9,7 +9,7 @@
...
@@ -9,7 +9,7 @@
<q-input
<q-input
dense
dense
outlined
outlined
:label=
"$t('managingUnit.tableColumns.name')
"
label=
"Tên đơn vị
"
v-model=
"unitNameKeyword"
v-model=
"unitNameKeyword"
clearable
clearable
></q-input>
></q-input>
...
@@ -73,7 +73,7 @@
...
@@ -73,7 +73,7 @@
flat
flat
round
round
color=
"primary"
color=
"primary"
icon=
"mdi-delete"
icon=
"mdi-delete
-outline
"
@
click=
"confirmDeleteManagingUnits(item.row.id)"
@
click=
"confirmDeleteManagingUnits(item.row.id)"
>
>
<q-tooltip
:offset=
"[20, 10]"
>
{{
<q-tooltip
:offset=
"[20, 10]"
>
{{
...
...
src/pages/xep-hang-khach-hang/index.vue
View file @
eec5c80a
...
@@ -7,21 +7,33 @@
...
@@ -7,21 +7,33 @@
<q-space></q-space>
<q-space></q-space>
<div
class=
"col-2"
>
<div
class=
"col-2"
>
<q-input
<q-input
v-model=
"codeCustomerRank"
type=
"text"
dense
dense
outlined
outlined
:label=
"$t('customerRank.tableColumnsCustomerRank.rankName')
"
label=
"Mã xếp hạng
"
clearable
clearable
></q-input>
></q-input>
</div>
</div>
<div
class=
"col-2"
>
<div
class=
"col-2"
>
<q-select
<q-input
label=
"Loại xếp hạng"
v-model=
"nameCustomerRank"
option-label=
"name"
type=
"text"
option-value=
"id"
dense
dense
outlined
outlined
label=
"Tên đơn vị"
clearable
clearable
></q-select>
></q-input>
</div>
<div
class=
"col-2"
>
<q-input
v-model=
"levelCustomerRank"
type=
"number"
dense
outlined
label=
"Loại xếp hạng"
clearable
></q-input>
</div>
</div>
<div
class=
"col-auto"
>
<div
class=
"col-auto"
>
<q-btn
<q-btn
...
@@ -51,22 +63,35 @@
...
@@ -51,22 +63,35 @@
separator=
"cell"
separator=
"cell"
:no-data-label=
"$t('emptyData')"
:no-data-label=
"$t('emptyData')"
hide-pagination
hide-pagination
class=
"sticky-header-table"
>
>
<template
v-slot:body-cell-action=
""
>
<template
v-slot:body-cell-action=
"
item
"
>
<q-td
style=
"padding: 0"
class=
"flex flex-center"
>
<q-td
style=
"padding: 0"
class=
"flex flex-center"
>
<q-btn
flat
round
color=
"primary"
icon=
"mdi-account-edit-outline"
>
<q-btn
flat
round
color=
"primary"
icon=
"mdi-account-edit-outline"
@
click=
"openUpdateCustomerRankDialog(item.row.id)"
>
<q-tooltip
:offset=
"[20, 10]"
>
{{
<q-tooltip
:offset=
"[20, 10]"
>
{{
$t
(
'customerRank.toolTipMessage.updateCustomerRankInfo'
)
$t
(
'customerRank.toolTipMessage.updateCustomerRankInfo'
)
}}
</q-tooltip>
}}
</q-tooltip>
</q-btn>
</q-btn>
<q-btn
flat
round
color=
"primary"
icon=
"mdi-delete"
>
<q-btn
flat
round
color=
"primary"
icon=
"mdi-delete-outline"
@
click=
"confirmDeleteCustomerRank(item.row.id)"
>
<q-tooltip
:offset=
"[20, 10]"
>
{{
<q-tooltip
:offset=
"[20, 10]"
>
{{
$t
(
'customerRank.toolTipMessage.deleteCustomerRank'
)
$t
(
'customerRank.toolTipMessage.deleteCustomerRank'
)
}}
</q-tooltip>
}}
</q-tooltip>
</q-btn>
</q-btn>
</q-td>
</q-td>
</
template
>
</
template
>
<
template
v-slot:body-cell-
rankS
tatus=
"rowData"
>
<
template
v-slot:body-cell-
s
tatus=
"rowData"
>
<q-td>
<q-td>
<div
align=
"center"
>
<div
align=
"center"
>
<q-chip
<q-chip
...
@@ -89,31 +114,24 @@
...
@@ -89,31 +114,24 @@
</
template
>
</
template
>
</q-table>
</q-table>
</div>
</div>
<div
class=
"col-12 q-mt-sm"
>
<Pagination
v-model:currentPage=
"pageIndex"
v-model:pageSize=
"pageSize"
:totalPage=
"totalPage"
@
update:pageSize=
"changePageSize"
@
update:currentPage=
"getListCustomerRank"
/>
</div>
<AddUpdateCustomerRankDialog
<AddUpdateCustomerRankDialog
v-model:isOpened=
"addCustomerRankDialogIsOpened"
v-model:isOpened=
"addCustomerRankDialogIsOpened"
v-model:rankCode=
"rankCode"
v-model:code=
"code"
v-model:rankName=
"rankName"
v-model:name=
"name"
v-model:discount=
"discount"
v-model:level=
"level"
v-model:discountCode=
"discountCode"
v-model:status=
"status"
v-model:rankType=
"rankType"
v-model:rankStatus=
"rankStatus"
:rankTypeOptions=
"rankTypeOptions"
isUpdate
isUpdate
@
addNewCustomer
=
"addNewCustomer"
@
saveCustomerRankInfo
=
"addNewCustomer"
/>
/>
<AddUpdateCustomerRankDialog
<AddUpdateCustomerRankDialog
v-model:isOpened=
"updateCustomerRankDialogIsOpened"
v-model:isOpened=
"updateCustomerRankDialogIsOpened"
v-model:code=
"code"
v-model:name=
"name"
v-model:level=
"level"
v-model:status=
"status"
@
saveCustomerRankInfo=
"updateNewCustomer"
/>
/>
</div>
</div>
</template>
</template>
...
@@ -121,18 +139,22 @@
...
@@ -121,18 +139,22 @@
<
script
lang=
"ts"
>
<
script
lang=
"ts"
>
import
{
i18n
}
from
'src/boot/i18n'
;
import
{
i18n
}
from
'src/boot/i18n'
;
import
{
defineComponent
,
onMounted
,
ref
,
Ref
}
from
'vue'
;
import
{
defineComponent
,
onMounted
,
ref
,
Ref
}
from
'vue'
;
import
Pagination
from
'components/pagination/index.vue'
;
import
{
API_PATHS
}
from
'src/assets/configurations'
;
// import { API_PATHS } from 'src/assets/configurations';
import
{
AxiosResponse
}
from
'axios'
;
// import { AxiosResponse } from 'axios';
import
{
api
,
BaseResponseBody
}
from
'src/boot/axios'
;
// import { api, BaseResponseBody } from 'src/boot/axios';
import
{
// import { PaginationResponse } from 'src/assets/type';
CustomerRank
,
// import { config } from 'src/assets/configurations';
AddCustomerRank
,
DetailCustomerRank
,
UpdateCustomerRank
,
}
from
'src/assets/type'
;
import
{
config
}
from
'src/assets/configurations'
;
import
{
CustomerRankStatus
}
from
'src/assets/enums'
;
import
{
CustomerRankStatus
}
from
'src/assets/enums'
;
import
AddUpdateCustomerRankDialog
from
'components/add-update-customer-rank/index.vue'
;
import
AddUpdateCustomerRankDialog
from
'components/add-update-customer-rank/index.vue'
;
import
{
Dialog
,
Notify
}
from
'quasar'
;
export
default
defineComponent
({
export
default
defineComponent
({
components
:
{
components
:
{
Pagination
,
AddUpdateCustomerRankDialog
,
AddUpdateCustomerRankDialog
,
},
},
setup
()
{
setup
()
{
...
@@ -146,59 +168,37 @@ export default defineComponent({
...
@@ -146,59 +168,37 @@ export default defineComponent({
// sortable: false,
// sortable: false,
// },
// },
{
{
name
:
'
rankC
ode'
,
name
:
'
c
ode'
,
field
:
'
rankC
ode'
,
field
:
'
c
ode'
,
required
:
true
,
required
:
true
,
label
:
i18n
.
global
.
t
(
'customerRank.tableColumnsCustomerRank.
rankC
ode'
),
label
:
i18n
.
global
.
t
(
'customerRank.tableColumnsCustomerRank.
c
ode'
),
headerStyle
:
'text-align: center !important;'
,
headerStyle
:
'text-align: center !important;'
,
align
:
'left'
,
align
:
'left'
,
sortable
:
false
,
sortable
:
false
,
},
},
{
{
name
:
'
rankN
ame'
,
name
:
'
n
ame'
,
field
:
'
rankN
ame'
,
field
:
'
n
ame'
,
required
:
true
,
required
:
true
,
label
:
i18n
.
global
.
t
(
'customerRank.tableColumnsCustomerRank.
rankN
ame'
),
label
:
i18n
.
global
.
t
(
'customerRank.tableColumnsCustomerRank.
n
ame'
),
headerStyle
:
'text-align: center !important;'
,
headerStyle
:
'text-align: center !important;'
,
align
:
'left'
,
align
:
'left'
,
sortable
:
false
,
sortable
:
false
,
},
},
{
{
name
:
'
rankType
'
,
name
:
'
level
'
,
field
:
'
rankType
'
,
field
:
'
level
'
,
required
:
true
,
required
:
true
,
label
:
i18n
.
global
.
t
(
'customerRank.tableColumnsCustomerRank.
rankType
'
),
label
:
i18n
.
global
.
t
(
'customerRank.tableColumnsCustomerRank.
level
'
),
headerStyle
:
'text-align: center !important;'
,
headerStyle
:
'text-align: center !important;'
,
align
:
'left'
,
align
:
'left'
,
sortable
:
false
,
sortable
:
false
,
},
},
{
{
name
:
'
discount
'
,
name
:
'
status
'
,
field
:
'
discount
'
,
field
:
'
status
'
,
required
:
true
,
required
:
true
,
label
:
i18n
.
global
.
t
(
'customerRank.tableColumnsCustomerRank.discount'
),
label
:
i18n
.
global
.
t
(
'customerRank.tableColumnsCustomerRank.status'
),
headerStyle
:
'text-align: center !important;'
,
align
:
'left'
,
sortable
:
false
,
},
{
name
:
'discountCode'
,
field
:
'discountCode'
,
required
:
true
,
label
:
i18n
.
global
.
t
(
'customerRank.tableColumnsCustomerRank.discountCode'
),
headerStyle
:
'text-align: center !important;'
,
align
:
'left'
,
sortable
:
false
,
},
{
name
:
'rankStatus'
,
field
:
'rankStatus'
,
required
:
true
,
label
:
i18n
.
global
.
t
(
'customerRank.tableColumnsCustomerRank.rankStatus'
),
headerStyle
:
'text-align: center !important;'
,
headerStyle
:
'text-align: center !important;'
,
align
:
'center'
,
align
:
'center'
,
sortable
:
false
,
sortable
:
false
,
...
@@ -215,136 +215,183 @@ export default defineComponent({
...
@@ -215,136 +215,183 @@ export default defineComponent({
];
];
const
customerRankTableRows
:
Ref
<
unknown
[]
>
=
ref
([]);
const
customerRankTableRows
:
Ref
<
unknown
[]
>
=
ref
([]);
const
pageIndex
=
ref
(
1
);
const
pageSize
=
ref
(
20
);
const
totalPage
=
ref
(
1
);
const
addCustomerRankDialogIsOpened
=
ref
(
false
);
const
addCustomerRankDialogIsOpened
=
ref
(
false
);
const
updateCustomerRankDialogIsOpened
=
ref
(
false
);
const
updateCustomerRankDialogIsOpened
=
ref
(
false
);
const
rankCode
=
ref
(
''
);
const
code
=
ref
(
''
);
const
rankName
=
ref
(
''
);
const
name
=
ref
(
''
);
const
discount
=
ref
(
''
);
const
level
:
Ref
<
number
|
undefined
>
=
ref
(
undefined
);
const
discountCode
=
ref
(
''
);
const
status
:
Ref
<
number
>
=
ref
(
CustomerRankStatus
.
active
);
const
rankType
:
Ref
<
number
|
undefined
>
=
ref
(
undefined
);
const
customerRankId
:
Ref
<
number
|
undefined
>
=
ref
(
undefined
);
const
rankTypeOptions
:
Ref
<
number
|
undefined
>
=
ref
(
undefined
);
const
nameCustomerRank
=
ref
(
''
);
const
rankStatus
:
Ref
<
number
>
=
ref
(
CustomerRankStatus
.
active
);
const
levelCustomerRank
:
Ref
<
number
|
undefined
>
=
ref
(
undefined
);
const
codeCustomerRank
=
ref
(
''
);
//gọi api ds
const
getListCustomerRank
=
async
()
=>
{
const
getListCustomerRank
=
async
()
=>
{
// try {
const
response
=
(
await
api
({
// const response = (await api({
url
:
API_PATHS
.
getListCustomersRank
,
// url: API_PATHS.getListUnits,
method
:
'GET'
,
// method: 'GET',
params
:
{
// params: {
name
:
nameCustomerRank
.
value
,
// pageIndex: pageIndex.value,
level
:
levelCustomerRank
.
value
,
// pageSize: pageSize.value,
code
:
codeCustomerRank
.
value
,
// // name: unitNameKeyword.value,
},
// // fields: fieldSelected.value?.id,
}))
as
AxiosResponse
<
BaseResponseBody
<
CustomerRank
[]
>>
;
// },
if
(
response
.
data
.
error
.
code
===
config
.
API_RES_CODE
.
OK
.
code
)
{
// })) as AxiosResponse
<
BaseResponseBody
<
PaginationResponse
<
ArtistOwner
>>>
;
customerRankTableRows
.
value
=
response
.
data
.
data
;
// if (response.data.error.code === config.API_RES_CODE.OK.code) {
}
// customerRankTableRows.value = response.data.data.data;
// totalPage.value = response.data.data.totalPages;
// }
// } catch (error) {}
};
};
const
changePageSize
=
()
=>
{
const
confirmDeleteCustomerRank
=
(
id
:
number
)
=>
{
pageIndex
.
value
=
1
;
Dialog
.
create
({
void
getListCustomerRank
();
title
:
i18n
.
global
.
t
(
'customerRank.confirmActionsTitle.confirmDeleteCustomerRankTitle'
),
message
:
i18n
.
global
.
t
(
'customerRank.confirmActionsTitle.confirmDeleteCustomerRankContent'
),
cancel
:
i18n
.
global
.
t
(
'customerRank.confirmActionsTitle.confirmDeleteCustomerRankCancelBtnLabel'
),
color
:
'negative'
,
}).
onOk
(()
=>
{
void
deleteCustomerRank
(
id
);
});
};
};
//gọi API xóa đơn vị
//gói api xóa
// const confirmDeleteManagingUnits = (id: number) => {
const
deleteCustomerRank
=
async
(
id
:
number
)
=>
{
// Dialog.create({
try
{
// title: i18n.global.t(
const
deleteResult
=
(
await
api
({
// 'managingUnit.confirmActionsTitle.confirmDeleteManagingUnitsTitle'
url
:
API_PATHS
.
deleteCustomerRank
,
// ),
method
:
'GET'
,
// message: i18n.global.t(
params
:
{
// 'managingUnit.confirmActionsTitle.confirmDeleteManagingUnitsContent'
id
:
id
,
// ),
},
// cancel: i18n.global.t(
}))
as
AxiosResponse
<
BaseResponseBody
<
unknown
>>
;
// 'managingUnit.confirmActionsTitle.confirmDeleteManagingUnitsCancelBtnLabel'
// ),
// color: 'negative',
// }).onOk(() => {
// void deleteManagingUnits(id);
// });
// };
// const deleteManagingUnits = async (id: number) => {
// try {
// const deleteResult = (await api({
// url: API_PATHS.deleteManagingUnits,
// method: 'GET',
// params: {
// id: id,
// },
// })) as AxiosResponse
<
BaseResponseBody
<
unknown
>>
;
// if (deleteResult.data.error.code === config.API_RES_CODE.OK.code) {
if
(
deleteResult
.
data
.
error
.
code
===
config
.
API_RES_CODE
.
OK
.
code
)
{
// Notify.create({
Notify
.
create
({
// type: 'positive',
type
:
'positive'
,
// message: i18n.global.t(
message
:
i18n
.
global
.
t
(
// 'managingUnit.actionMessages.deleteManagingUnitsAccess'
'customerRank.actionMessages.deleteCustomerRankAccess'
// ),
),
// });
});
// void getListUnits();
void
getListCustomerRank
();
// }
}
// } catch (error) {}
}
catch
(
error
)
{}
// };
};
//gọi api lĩnh vực
// const getFieldOptions = async () => {
// const response = (await api({
// url: API_PATHS.getFieldOptions,
// method: 'GET',
// params: {},
// })) as AxiosResponse
<
BaseResponseBody
<
FieldType
[]
>>
;
// if (response.data.error.code === config.API_RES_CODE.OK.code) {
// fieldsOptions.value = response.data.data;
// }
// };
const
openAddCustomerRankDialog
=
()
=>
{
const
openAddCustomerRankDialog
=
()
=>
{
rankCode
.
value
=
''
;
code
.
value
=
''
;
rankName
.
value
=
''
;
name
.
value
=
''
;
discount
.
value
=
''
;
level
.
value
=
undefined
;
discountCode
.
value
=
''
;
status
.
value
=
CustomerRankStatus
.
active
;
rankType
.
value
=
undefined
;
rankStatus
.
value
=
CustomerRankStatus
.
active
;
addCustomerRankDialogIsOpened
.
value
=
true
;
addCustomerRankDialogIsOpened
.
value
=
true
;
};
};
const
addNewCustomer
=
()
=>
{
//gọi api add
console
.
log
(
Object
);
const
addNewCustomer
=
async
()
=>
{
const
data
=
{
name
:
name
.
value
,
code
:
code
.
value
,
level
:
level
.
value
,
status
:
status
.
value
,
};
const
response
=
(
await
api
({
url
:
API_PATHS
.
addCustomerRank
,
method
:
'POST'
,
data
,
}))
as
AxiosResponse
<
BaseResponseBody
<
AddCustomerRank
[]
>>
;
if
(
response
.
data
.
error
.
code
===
config
.
API_RES_CODE
.
OK
.
code
)
{
addCustomerRankDialogIsOpened
.
value
=
false
;
Notify
.
create
({
type
:
'positive'
,
message
:
i18n
.
global
.
t
(
'customerRank.actionMessages.addNewCustomerRankAccess'
),
actions
:
[{
icon
:
'close'
,
color
:
'white'
}],
});
void
getListCustomerRank
();
}
};
const
openUpdateCustomerRankDialog
=
(
id
:
number
)
=>
{
void
getDetailCustomerRank
(
id
);
updateCustomerRankDialogIsOpened
.
value
=
true
;
};
//gọi api detail
const
getDetailCustomerRank
=
async
(
id
:
number
)
=>
{
try
{
const
response
=
(
await
api
({
url
:
API_PATHS
.
getDetailCustomerRank
,
method
:
'GET'
,
params
:
{
id
:
id
,
},
}))
as
AxiosResponse
<
BaseResponseBody
<
DetailCustomerRank
>>
;
if
(
response
.
data
.
error
.
code
===
config
.
API_RES_CODE
.
OK
.
code
)
{
customerRankId
.
value
=
response
.
data
.
data
.
id
;
name
.
value
=
response
.
data
.
data
.
name
;
code
.
value
=
response
.
data
.
data
.
code
;
level
.
value
=
response
.
data
.
data
.
level
;
status
.
value
=
response
.
data
.
data
.
status
;
}
}
catch
(
error
)
{}
};
//gọi api update
const
updateNewCustomer
=
async
()
=>
{
const
data
=
{
id
:
customerRankId
.
value
,
name
:
name
.
value
,
code
:
code
.
value
,
level
:
level
.
value
,
status
:
status
.
value
,
};
const
response
=
(
await
api
({
url
:
API_PATHS
.
updateCustomerRank
,
method
:
'POST'
,
data
,
}))
as
AxiosResponse
<
BaseResponseBody
<
UpdateCustomerRank
[]
>>
;
if
(
response
.
data
.
error
.
code
===
config
.
API_RES_CODE
.
OK
.
code
)
{
updateCustomerRankDialogIsOpened
.
value
=
false
;
Notify
.
create
({
type
:
'positive'
,
message
:
i18n
.
global
.
t
(
'customerRank.actionMessages.updateCustomerRankAccess'
),
actions
:
[{
icon
:
'close'
,
color
:
'white'
}],
});
void
getListCustomerRank
();
}
};
};
onMounted
(()
=>
{
onMounted
(()
=>
{
void
getListCustomerRank
();
void
getListCustomerRank
();
// void getFieldOptions();
});
});
return
{
return
{
addCustomerRankDialogIsOpened
,
addCustomerRankDialogIsOpened
,
updateCustomerRankDialogIsOpened
,
updateCustomerRankDialogIsOpened
,
// getFieldOptions,
status
,
customerRanlTableColumns
,
customerRanlTableColumns
,
customerRankTableRows
,
customerRankTableRows
,
getListCustomerRank
,
getListCustomerRank
,
pageIndex
,
pageSize
,
totalPage
,
changePageSize
,
CustomerRankStatus
,
CustomerRankStatus
,
openAddCustomerRankDialog
,
openAddCustomerRankDialog
,
rankCode
,
code
,
rankName
,
name
,
discount
,
level
,
discountCode
,
status
,
rankType
,
rankStatus
,
rankTypeOptions
,
addNewCustomer
,
addNewCustomer
,
confirmDeleteCustomerRank
,
deleteCustomerRank
,
openUpdateCustomerRankDialog
,
getDetailCustomerRank
,
updateNewCustomer
,
nameCustomerRank
,
levelCustomerRank
,
codeCustomerRank
,
};
};
},
},
});
});
...
...
src/router/routes.ts
View file @
eec5c80a
...
@@ -10,7 +10,7 @@ export enum Pages {
...
@@ -10,7 +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'
,
addArtist
=
'them-nghe-sy'
,
addArtist
=
'them-nghe-sy'
,
customerRank
=
'
danh-muc-xep
-hang'
,
customerRank
=
'
xep-hang-khach
-hang'
,
}
}
const
routes
:
RouteRecordRaw
[]
=
[
const
routes
:
RouteRecordRaw
[]
=
[
...
@@ -64,7 +64,7 @@ const routes: RouteRecordRaw[] = [
...
@@ -64,7 +64,7 @@ const routes: RouteRecordRaw[] = [
name
:
Pages
.
customer
,
name
:
Pages
.
customer
,
},
},
{
{
path
:
'
danh-muc-xep
-hang'
,
path
:
'
xep-hang-khach
-hang'
,
component
:
()
=>
import
(
'pages/xep-hang-khach-hang/index.vue'
),
component
:
()
=>
import
(
'pages/xep-hang-khach-hang/index.vue'
),
name
:
Pages
.
customerRank
,
name
:
Pages
.
customerRank
,
},
},
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment