update

parent 739bb781
......@@ -83,6 +83,18 @@ export type QualificationType = {
status: number;
numIndex: number;
};
export type CardBankType = {
id: number;
name: string;
status: number;
numIndex: number;
};
export type TypeCardType = {
id: number;
name: string;
status: number;
numIndex: number;
};
export type WorkType = {
id: number;
name: string;
......@@ -171,30 +183,34 @@ export type ArtistDicitionary = {
};
export type ArtistOwnerAdd = {
code: string | undefined,
name: string | undefined,
representative: string | undefined,
address: string | undefined,
email: string | undefined,
phoneNumber: string | undefined,
status: number,
fields: Array<[
{
id: number,
name: string,
status: number,
numIndex: number
}
]>
contracts: Array<[
{
contractFrom: string,
contractTo: string,
status: number,
artistId: number,
artistName: string,
artistFullName: string,
field: string
},
]>
code: string | undefined;
name: string | undefined;
representative: string | undefined;
address: string | undefined;
email: string | undefined;
phoneNumber: string | undefined;
status: number;
fields: Array<
[
{
id: number;
name: string;
status: number;
numIndex: number;
}
]
>;
contracts: Array<
[
{
contractFrom: string;
contractTo: string;
status: number;
artistId: number;
artistName: string;
artistFullName: string;
field: string;
}
]
>;
};
import { defineComponent } from 'vue';
import { defineComponent, PropType, Ref, ref } from 'vue';
import { i18n } from 'src/boot/i18n';
import { BankAccountType } from 'src/assets/type';
import { Notify } from 'quasar';
export default defineComponent({
props: {
isOpenAddAccountBankDialog: {
type: Boolean,
required: true,
},
bankAccounts: {
type: Array as PropType<BankAccountType[]>,
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(props, context) {
const accountNumberRules = [
(val?: string) =>
(val && val.trim().length) ||
......@@ -36,12 +43,26 @@ export default defineComponent({
val !== undefined ||
i18n.global.t('artist.dialogLabel.validateMessages.requireCardType'),
];
const confirmAddAccBank = () => {
if (
props.isDefault === 1 &&
props.bankAccounts.filter((item) => item.isDefault === 1).length
) {
Notify.create({
type: 'negative',
message: i18n.global.t(
'artist.dialogLabel.validateMessages.errorIsDefault'
),
});
} else context.emit('addNewBankAccount');
};
return {
defaultStatus,
bankNameRules,
cardTypeRules,
accountNumberRules,
cardNumberRules,
confirmAddAccBank,
};
},
emits: [
......
......@@ -5,7 +5,7 @@
@update:model-value="$emit('update:isOpenAddAccountBankDialog', $event)"
>
<q-card style="min-width: 500px" bordered>
<q-form greedy @submit.prevent="$emit('addNewBankAccount')">
<q-form greedy @submit.prevent="confirmAddAccBank">
<q-card-section>
<q-item style="padding-top: 0; padding-bottom: 0">
<q-item-section>
......
......@@ -373,6 +373,7 @@ export default {
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ẻ',
errorIsDefault: 'Nghệ sỹ đã có tài khoản mặc định',
},
},
confirmActionsTitle: {
......
......@@ -96,6 +96,7 @@
v-model:bank-name="bankName"
v-model:card-type="cardType"
v-model:is-default="isDefault"
:bank-accounts="bankAccounts"
@addNewBankAccount="addAccBank"
@click:CloseBtn="isOpenAddAccountBankDialog = false"
></AddNewBankAccountDialog>
......
......@@ -26,6 +26,8 @@ import {
BannerType,
StoriesType,
SchedulesType,
CardBankType,
TypeCardType,
} from 'src/assets/type';
export default defineComponent({
......@@ -36,7 +38,7 @@ export default defineComponent({
HotProduct,
AddNewBankAccountDialog,
UploadEmbedDialog,
AddHotProductDialog
AddHotProductDialog,
},
watch: {
tab(value) {
......@@ -64,6 +66,17 @@ export default defineComponent({
const nationalityOptions: Ref<NationalityType[]> = ref([]);
const professionOptions: Ref<QualificationType[]> = ref([]);
const artistLevelOptions: Ref<ArtistLevelType[]> = ref([]);
const cardBankOptions: Ref<CardBankType[]> = ref([
{ id: 1, name: 'TPBank', status: 1, numIndex: 1 },
{ id: 2, name: 'BIDV', status: 1, numIndex: 1 },
{ id: 3, name: 'VietinBank', status: 1, numIndex: 1 },
{ id: 4, name: 'VietcomBank', status: 1, numIndex: 1 },
]);
const typeBankOptions: Ref<TypeCardType[]> = ref([
{ id: 1, name: 'ATM', status: 1, numIndex: 1 },
{ id: 2, name: 'Visa', status: 1, numIndex: 1 },
{ id: 3, name: 'Credit', status: 1, numIndex: 1 },
]);
const workOptions: Ref<WorkType[]> = ref([]);
const sexOptions = ref([
{ id: 1, name: 'Nam' },
......@@ -77,21 +90,33 @@ export default defineComponent({
const artistName: Ref<string | null | undefined> = ref();
const birthday: Ref<string | null | undefined> = ref('29/04/2021');
const sex: Ref<number | undefined> = ref();
const cardBank: Ref<CardBankType> = ref({
id: 0,
name: '',
status: 1,
numIndex: 1,
});
const typeCard: Ref<TypeCardType> = ref({
id: 0,
name: '',
status: 1,
numIndex: 1,
});
const nationality: Ref<NationalityType> = ref({
id: 0,
name: 'VN',
name: '',
status: 1,
numIndex: 1,
});
const qualification: Ref<QualificationType> = ref({
id: 0,
name: 'Chuyen nghiep',
name: '',
status: 1,
numIndex: 1,
});
const artistLevel: Ref<ArtistLevelType> = ref({
id: 0,
name: 'Hang 1',
name: '',
status: 1,
artistLevel: 1,
description: '',
......@@ -231,6 +256,7 @@ export default defineComponent({
cardType: cardType.value,
isDefault: isDefault.value,
};
bankAccounts.value.push(newAccount as BankAccountType);
isOpenAddAccountBankDialog.value = false;
};
......@@ -254,8 +280,8 @@ export default defineComponent({
const openDialogAddHotProduct = () => {
console.log('object');
// console.log(openAddHotProduct.value);
openAddHotProduct.value = true
}
openAddHotProduct.value = true;
};
const openDialogAddAccBank = () => {
accountNumber.value = null;
cardNumber.value = null;
......@@ -338,8 +364,11 @@ export default defineComponent({
isOpenDialogEmbed,
deleteAccBank,
openDialogAddAccBank,
openDialogAddHotProduct
openDialogAddHotProduct,
cardBankOptions,
typeBankOptions,
cardBank,
typeCard,
};
},
});
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