update

parent 218c6c4b
......@@ -69,6 +69,17 @@ const formatMoney = (str: { amount: string }) => {
}
};
const formatMoneyv2 = (str: { amount: string }) => {
try {
return str == null || str.amount == null
? ''
: str.amount
.toString()
.replace(/\D/g, '')
.replace(/\B(?=(\d{3})+(?!\d))/g, ',');
} catch (e) {}
};
const isNullOrEmpty = (str: any) => {
return (
str === null ||
......@@ -86,4 +97,5 @@ export {
isHasVietnamese,
formatMoney,
isNullOrEmpty,
formatMoneyv2,
};
......@@ -20,6 +20,7 @@
hide-bottom-space
dense
:rules="errorMoney"
@update:model-value="(value) => checkValuePrice(value)"
label="Số tiền *"
/>
</div>
......@@ -61,6 +62,7 @@ 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 { formatMoneyv2, formatMoney } from 'src/boot/functions';
import { ListBooking } from 'src/assets/type';
export default defineComponent({
......@@ -77,7 +79,7 @@ export default defineComponent({
setup(props, context) {
const content: Ref<string | null> = ref(null);
const money: Ref<string | null> = ref(null);
const money: Ref<string | undefined> = ref(undefined);
const errorMoney = [
(val?: string) => (val && val.trim().length) || 'Vui lòng nhập số tiền',
......@@ -91,8 +93,7 @@ export default defineComponent({
(value) => {
if (value) {
content.value = null;
money.value = null;
money.value = undefined;
}
}
);
......@@ -106,7 +107,7 @@ export default defineComponent({
artistBooking: {
id: props.data.id,
},
fee: money.value,
fee: money.value?.replace(/,/g, ''),
reason: content.value,
},
})) as AxiosResponse<BaseResponseBody<unknown>>;
......@@ -126,10 +127,16 @@ export default defineComponent({
context.emit('toggle');
};
const checkValuePrice = (value: string) => {
money.value = formatMoneyv2({ amount: value });
};
return {
//
closeDialog,
confirmAdd,
checkValuePrice,
// formatNumber,
//
money,
errorMoney,
......
......@@ -46,7 +46,7 @@
<template v-slot:body-cell-artistName="item">
<td style="text-align: center">
<div>{{ item.row.artistBooking.artistName }}</div>
<div>SĐT: {{ item.row.artistBooking.artistName }}</div>
<div>SĐT: {{ item.row.artistBooking.phoneArtist }}</div>
</td>
</template>
<template v-slot:body-cell-bookingRandomCode="item">
......
......@@ -159,6 +159,7 @@
dense
type="text"
label="Số tiền"
@update:model-value="(value) => checkValuePrice(value)"
/>
</div>
......@@ -211,7 +212,7 @@ 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 { formatMoneyv2 } from 'src/boot/functions';
import { ListBooking } from 'src/assets/type';
export default defineComponent({
props: {
......@@ -231,7 +232,7 @@ export default defineComponent({
const contractTimeFrom: Ref<string | null> = ref(null);
const contractTimeTo: Ref<string | null> = ref(null);
const email: Ref<string | null> = ref(null);
const money: Ref<string | null> = ref(null);
const money: Ref<string | undefined> = ref(undefined);
const location: Ref<string | null> = ref(null);
watch(
......@@ -249,7 +250,7 @@ export default defineComponent({
contractTimeFrom.value = props.data.fromTime;
contractTimeTo.value = props.data.toTime;
email.value = props.data.customerDto.email;
money.value = props.data.expectFee;
money.value = formatMoneyv2({ amount: props.data.expectFee });
location.value = props.data.address;
};
......@@ -263,7 +264,7 @@ export default defineComponent({
status: 1,
address: location.value,
content: content.value,
expectFee: money.value,
expectFee: money.value?.replace(/,/g, ''),
fromTime: contractTimeFrom.value,
toTime: contractTimeTo.value,
email: email.value,
......@@ -294,10 +295,14 @@ export default defineComponent({
// (val?: string) => (val && val.trim().length) || 'Vui lòng nhập nội dung',
// ];
const checkValuePrice = (value: string) => {
money.value = formatMoneyv2({ amount: value });
};
return {
//
closeDialog,
confirmAdd,
checkValuePrice,
//
money,
content,
......
......@@ -21,6 +21,7 @@
dense
type="text"
:rules="errorMoney"
@update:model-value="(value) => checkValuePrice(value)"
label="Số tiền *"
/>
</div>
......@@ -62,7 +63,7 @@ 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 { formatMoneyv2 } from 'src/boot/functions';
import { ListBooking, ListFinedAmount } from 'src/assets/type';
export default defineComponent({
props: {
......@@ -82,14 +83,14 @@ export default defineComponent({
setup(props, context) {
const content: Ref<string | null> = ref(null);
const money: Ref<string | null> = ref(null);
const money: Ref<string | undefined> = ref(undefined);
watch(
() => props.open,
(value) => {
if (value) {
content.value = props.dataItem.reason;
money.value = props.dataItem.fee;
money.value = formatMoneyv2({ amount: props.dataItem.fee });
}
}
);
......@@ -104,7 +105,7 @@ export default defineComponent({
artistBooking: {
id: props.data.id,
},
fee: money.value,
fee: money.value?.replace(/,/g, ''),
reason: content.value,
},
})) as AxiosResponse<BaseResponseBody<unknown>>;
......@@ -123,6 +124,9 @@ export default defineComponent({
const closeDialog = () => {
context.emit('toggle');
};
const checkValuePrice = (value: string) => {
money.value = formatMoneyv2({ amount: value });
};
// const errorMoney = [
// (val?: string) => (val && val.trim().length) || 'Vui lòng nhập số tiền',
......@@ -136,6 +140,7 @@ export default defineComponent({
//
closeDialog,
confirmAdd,
checkValuePrice,
//
money,
content,
......
......@@ -10,7 +10,7 @@ export const MenuItemScript = defineComponent({
},
},
setup(props) {
console.log(props.item,'props');
const $route = useRoute();
const isActive = computed(() => {
return (
......
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