create add account bank

parent 31591ff3
...@@ -116,16 +116,16 @@ export type StoriesType = { ...@@ -116,16 +116,16 @@ export type StoriesType = {
}; };
export type BankAccountType = { export type BankAccountType = {
id: number;
isDefault: number;
nameInCard: string;
status: number;
accountNumber: string; accountNumber: string;
accountOwner: string;
bankName: string;
branchName: string;
cardNumber: string; cardNumber: string;
bankName: string;
cardType: number; cardType: number;
isDefault: number;
id: number;
nameInCard: string | null;
status: number;
accountOwner: string | null;
branchName: string | null;
}; };
export type ProductType = { export type ProductType = {
......
...@@ -111,4 +111,5 @@ export default defineComponent({ ...@@ -111,4 +111,5 @@ export default defineComponent({
changePageSize, changePageSize,
}; };
}, },
emits: ['click:addBankBtn'],
}); });
...@@ -3,59 +3,56 @@ import { i18n } from 'src/boot/i18n'; ...@@ -3,59 +3,56 @@ import { i18n } from 'src/boot/i18n';
export default defineComponent({ export default defineComponent({
props: { props: {
isOpenDialog: { isOpenAddAccountBankDialog: {
type: Boolean, type: Boolean,
required: true, required: true,
}, },
accountNumber: { type: String, required: true },
cardNumber: { type: String, required: true },
bankName: { type: String, required: true },
cardType: { type: Number, required: true },
isDefault: { type: Number, required: true },
}, },
setup() { setup() {
const idCard = ref(''); const accountNumberRules = [
const numberCard = ref('');
const bankName: Ref<number | undefined> = ref();
const cardType: Ref<number | undefined> = ref();
const defaultStatus: Ref<boolean> = ref(false);
const bankOptions = ref([
{ id: 1, text: 'TP Bank' },
{ id: 2, text: 'MB Bank' },
{ id: 3, text: 'BIDV' },
]);
const cardTypeOptions = ref([
{ id: 1, text: 'ATM' },
{ id: 2, text: 'Visa' },
]);
const idCardRules = [
(val?: string) => (val?: string) =>
(val && val.trim().length) || (val && val.trim().length) ||
i18n.global.t('userPage.validateMessages.requireUserName'), i18n.global.t(
'artist.dialogLabel.validateMessages.requireAccountNumber'
),
]; ];
const numberCardRules = [ const cardNumberRules = [
(val?: string) => (val?: string) =>
(val && val.trim().length) || (val && val.trim().length) ||
i18n.global.t('userPage.validateMessages.requireUserName'), i18n.global.t('artist.dialogLabel.validateMessages.requireCardNumber'),
]; ];
const bankNameRules = [ const bankNameRules = [
(val: number | undefined) => (val?: string) =>
val !== undefined || (val && val.trim().length) ||
i18n.global.t('userPage.validateMessages.requireUserName'), i18n.global.t('artist.dialogLabel.validateMessages.requireBankName'),
]; ];
const cardTypeRules = [ const cardTypeRules = [
(val: number | undefined) => (val: number | undefined) =>
val !== undefined || val !== undefined ||
i18n.global.t('userPage.validateMessages.requireUserName'), i18n.global.t('artist.dialogLabel.validateMessages.requireCardType'),
]; ];
return { return {
idCard,
numberCard,
bankName,
cardType,
defaultStatus, defaultStatus,
bankOptions,
cardTypeOptions,
bankNameRules, bankNameRules,
cardTypeRules, cardTypeRules,
idCardRules, accountNumberRules,
numberCardRules, cardNumberRules,
}; };
}, },
emits: ['update:isOpenDialog', 'click:CloseBtn', 'addNewBankAccount'], emits: [
'update:isOpenAddAccountBankDialog',
'click:CloseBtn',
'addNewBankAccount',
'update:accountNumber',
'update:cardNumber',
'update:bankName',
'update:cardType',
'update:isDefault',
'click:addAccountBankBtn',
],
}); });
<template> <template>
<q-dialog <q-dialog
persistent persistent
:model-value="isOpenDialog" :model-value="isOpenAddAccountBankDialog"
@update:model-value="$emit('update:isOpenDialog', $event)" @update:model-value="$emit('update:isOpenAddAccountBankDialog', $event)"
> >
<q-card style="min-width: 500px" bordered> <q-card style="min-width: 500px" bordered>
<q-form greedy @submit.prevent="$emit('addNewBankAccount')"> <q-form greedy @submit.prevent="$emit('addNewBankAccount')">
<q-card-section> <q-card-section>
<q-item> <q-item style="padding-top: 0; padding-bottom: 0">
<q-item-section> <q-item-section>
<q-item-label class="text-h6 text-weight-regular">{{ <q-item-label
$t('userPage.dialogLabel.title.addUser') ><div class="text-h6 text-weight-regular" align="center">
}}</q-item-label> {{ $t('artist.dialogLabel.title.addAccountBank') }}
</div></q-item-label
>
</q-item-section> </q-item-section>
</q-item> </q-item>
</q-card-section> </q-card-section>
...@@ -19,59 +21,56 @@ ...@@ -19,59 +21,56 @@
<q-card-section> <q-card-section>
<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
v-model="idCard" :model-value="accountNumber"
:label="$t('userPage.dialogLabel.fieldLabels.userName')" @update:model-value="$emit('update:accountNumber', $event)"
:rules="idCardRules" :label="$t('artist.dialogLabel.fieldLabels.accountNumber')"
:rules="accountNumberRules"
hide-bottom-space hide-bottom-space
type="text" type="text"
class="q-my-sm" class="q-my-sm"
outlined outlined
></q-input> ></q-input>
<q-input <q-input
v-model="numberCard" :model-value="cardNumber"
:label="$t('userPage.dialogLabel.fieldLabels.password')" @update:model-value="$emit('update:cardNumber', $event)"
type="password" :label="$t('artist.dialogLabel.fieldLabels.cardNumber')"
class="q-my-sm" :rules="cardNumberRules"
outlined
:rules="numberCardRules"
hide-bottom-space hide-bottom-space
></q-input> type="text"
<q-select
v-model="bankName"
:label="$t('userPage.dialogLabel.fieldLabels.sex')"
class="q-my-sm" class="q-my-sm"
:options="bankOptions"
option-value="id"
option-label="text"
outlined outlined
map-options ></q-input>
<q-input
:model-value="bankName"
@update:model-value="$emit('update:bankName', $event)"
:label="$t('artist.dialogLabel.fieldLabels.bankName')"
:rules="bankNameRules" :rules="bankNameRules"
hide-bottom-space hide-bottom-space
></q-select> type="text"
<q-select
v-model="cardType"
:label="$t('userPage.dialogLabel.fieldLabels.sex')"
class="q-my-sm" class="q-my-sm"
:options="cardTypeOptions"
option-value="id"
option-label="text"
outlined outlined
map-options ></q-input>
<q-input
:model-value="cardType"
@update:model-value="$emit('update:cardType', $event)"
:label="$t('artist.dialogLabel.fieldLabels.cardType')"
:rules="cardTypeRules" :rules="cardTypeRules"
hide-bottom-space hide-bottom-space
></q-select> type="text"
<q-select
v-model="defaultStatus"
:label="$t('userPage.dialogLabel.fieldLabels.sex')"
class="q-my-sm" class="q-my-sm"
option-value="id"
option-label="text"
outlined outlined
map-options ></q-input>
<q-input
:model-value="isDefault"
@update:model-value="$emit('update:isDefault', $event)"
:label="$t('artist.dialogLabel.fieldLabels.isDefault')"
hide-bottom-space hide-bottom-space
></q-select> type="text"
class="q-my-sm"
outlined
></q-input>
</div> </div>
</div> </div>
</q-card-section> </q-card-section>
...@@ -80,6 +79,7 @@ ...@@ -80,6 +79,7 @@
type="submit" type="submit"
color="primary" color="primary"
:label="$t('userPage.crudActions.save')" :label="$t('userPage.crudActions.save')"
@click="$emit('click:addAccountBankBtn')"
/> />
<q-btn <q-btn
color="black" color="black"
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
<q-space></q-space> <q-space></q-space>
<div class="col-auto"> <div class="col-auto">
<q-btn <q-btn
@click="isOpenDialog" @click="$emit('click:addBankBtn')"
color="primary" color="primary"
no-caps no-caps
style="width: 100px" style="width: 100px"
...@@ -30,20 +30,10 @@ ...@@ -30,20 +30,10 @@
<template v-slot:body-cell-action> <template v-slot:body-cell-action>
<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-information-outline"> <q-btn flat round color="primary" icon="mdi-information-outline">
<!-- <q-tooltip :offset="[20, 10]">{{
$t('userPage.toolTipMessage.informationUser')
}}</q-tooltip> -->
</q-btn> </q-btn>
<q-btn flat round color="primary" icon="mdi-minus-circle-outline"> <q-btn flat round color="primary" icon="mdi-minus-circle-outline">
<!-- <q-tooltip :offset="[20, 10]">{{
$t('userPage.toolTipMessage.updateUserInfo')
}}</q-tooltip> -->
</q-btn>
<q-btn flat round color="primary" icon="mdi-lock-outline">
<!-- <q-tooltip :offset="[20, 10]">{{
$t('userPage.toolTipMessage.updateUserInfo')
}}</q-tooltip> -->
</q-btn> </q-btn>
<q-btn flat round color="primary" icon="mdi-lock-outline"> </q-btn>
</q-td> </q-td>
</template> </template>
</q-table> </q-table>
...@@ -77,10 +67,10 @@ ...@@ -77,10 +67,10 @@
</div> </div>
</div> --> </div> -->
</div> </div>
<AddNewBankAccountDialog <!-- <AddNewBankAccountDialog
v-model:is-open-dialog="isOpenDialog" v-model:is-open-dialog="isOpenDialog"
@click:CloseBtn="!isOpenDialog" @click:CloseBtn="!isOpenDialog"
></AddNewBankAccountDialog> ></AddNewBankAccountDialog> -->
</div> </div>
</template> </template>
......
...@@ -358,6 +358,20 @@ export default { ...@@ -358,6 +358,20 @@ export default {
title: { title: {
addArtist: 'Thêm nghệ sỹ', addArtist: 'Thêm nghệ sỹ',
updateArtist: 'Cập nhật nghệ sỹ', updateArtist: 'Cập nhật nghệ sỹ',
addAccountBank: 'Thêm tài khoản ngân hàng',
},
fieldLabels: {
accountNumber: 'Mã thẻ',
cardNumber: 'Số ghi trên thẻ',
bankName: 'Ngân hàng',
cardType: 'Loại thẻ',
isDefault: 'Mặc định',
},
validateMessages: {
requireAccountNumber: 'Vui lòng nhập mã thẻ',
requireCardNumber: 'Vui lòng nhập số ghi trên thẻ',
requireBankName: 'Vui lòng chọn ngân hàng',
requireCardType: 'Vui lòng chọn loại thẻ',
}, },
}, },
confirmActionsTitle: { confirmActionsTitle: {
......
...@@ -71,7 +71,10 @@ ...@@ -71,7 +71,10 @@
></VabAccount> ></VabAccount>
</q-tab-panel> </q-tab-panel>
<q-tab-panel name="bankAccount"> <q-tab-panel name="bankAccount">
<BankAccount :bank-accounts="bankAccounts"></BankAccount> <BankAccount
:bank-accounts="bankAccounts"
@click:addBankBtn="isOpenAddAccountBankDialog = true"
></BankAccount>
</q-tab-panel> </q-tab-panel>
<q-tab-panel name="hotProduct"> <q-tab-panel name="hotProduct">
<HotProduct :products="products"></HotProduct> <HotProduct :products="products"></HotProduct>
...@@ -79,6 +82,16 @@ ...@@ -79,6 +82,16 @@
</q-tab-panels> </q-tab-panels>
</q-card> </q-card>
</div> </div>
<AddNewBankAccountDialog
v-model:is-open-add-account-bank-dialog="isOpenAddAccountBankDialog"
v-model:account-number="accountNumber"
v-model:card-number="cardNumber"
v-model:bank-name="bankName"
v-model:card-type="cardType"
v-model:is-default="isDefault"
@click:addAccountBankBtn="addAccBank"
@click:CloseBtn="isOpenAddAccountBankDialog = false"
></AddNewBankAccountDialog>
<div class="col-12 q-mt-md"> <div class="col-12 q-mt-md">
<div class="row"> <div class="row">
<q-space></q-space> <q-space></q-space>
......
...@@ -3,6 +3,7 @@ import PersonalInformation from '../../components/artist-information/personal-in ...@@ -3,6 +3,7 @@ import PersonalInformation from '../../components/artist-information/personal-in
import VabAccount from '../../components/artist-information/VAB-account/index.vue'; import VabAccount from '../../components/artist-information/VAB-account/index.vue';
import BankAccount from '../../components/artist-information/bank-account/index.vue'; import BankAccount from '../../components/artist-information/bank-account/index.vue';
import HotProduct from '../../components/artist-information/hot-product/index.vue'; import HotProduct from '../../components/artist-information/hot-product/index.vue';
import AddNewBankAccountDialog from 'components/artist-information/bank-account/add-new-bank-account-dialog/index.vue';
import { api, BaseResponseBody } from 'src/boot/axios'; import { api, BaseResponseBody } from 'src/boot/axios';
import { API_PATHS, config } from 'src/assets/configurations'; import { API_PATHS, config } from 'src/assets/configurations';
import { useRoute } from 'vue-router'; import { useRoute } from 'vue-router';
...@@ -26,6 +27,7 @@ export default defineComponent({ ...@@ -26,6 +27,7 @@ export default defineComponent({
VabAccount, VabAccount,
BankAccount, BankAccount,
HotProduct, HotProduct,
AddNewBankAccountDialog,
}, },
watch: { watch: {
tab(value) { tab(value) {
...@@ -42,7 +44,10 @@ export default defineComponent({ ...@@ -42,7 +44,10 @@ export default defineComponent({
setup() { setup() {
const tab = ref('information'); const tab = ref('information');
const clickBtn = () => {
console.log('askdaskdkasds');
};
const isOpenAddAccountBankDialog: Ref<boolean> = ref(false);
const fieldOptions: Ref<FieldType[]> = ref([]); const fieldOptions: Ref<FieldType[]> = ref([]);
const nationalityOptions: Ref<NationalityType[]> = ref([]); const nationalityOptions: Ref<NationalityType[]> = ref([]);
const professionOptions: Ref<QualificationType[]> = ref([]); const professionOptions: Ref<QualificationType[]> = ref([]);
...@@ -96,6 +101,14 @@ export default defineComponent({ ...@@ -96,6 +101,14 @@ export default defineComponent({
const stories: Ref<StoriesType[]> = ref([]); const stories: Ref<StoriesType[]> = ref([]);
const route = useRoute(); const route = useRoute();
//state accountBank
const accountNumber: Ref<string | null | undefined> = ref();
const cardNumber: Ref<string | null | undefined> = ref();
const bankName: Ref<string | null | undefined> = ref();
const cardType: Ref<number | undefined> = ref();
const isDefault: Ref<number | undefined> = ref();
const getInformationArtist = async () => { const getInformationArtist = async () => {
const response = (await api({ const response = (await api({
url: API_PATHS.getDetailArtist, url: API_PATHS.getDetailArtist,
...@@ -183,6 +196,18 @@ export default defineComponent({ ...@@ -183,6 +196,18 @@ export default defineComponent({
workOptions.value = response.data.data; workOptions.value = response.data.data;
} }
}; };
const addAccBank = () => {
const newAccount = {
accountNumber: accountNumber.value,
cardNumber: cardNumber.value,
bankName: bankName.value,
cardType: cardType.value,
isDefault: isDefault.value,
};
bankAccounts.value.push(newAccount as BankAccountType);
isOpenAddAccountBankDialog.value = false;
};
onMounted(() => { onMounted(() => {
void getInformationArtist(); void getInformationArtist();
void getFieldOptions(); void getFieldOptions();
...@@ -232,6 +257,14 @@ export default defineComponent({ ...@@ -232,6 +257,14 @@ export default defineComponent({
banners, banners,
shortDescription, shortDescription,
stories, stories,
isOpenAddAccountBankDialog,
clickBtn,
accountNumber,
cardNumber,
bankName,
cardType,
isDefault,
addAccBank,
}; };
}, },
}); });
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