update

parent 58365629
......@@ -97,7 +97,7 @@ export enum API_PATHS {
getListBooking = 'booking',
getBookingDetail = 'booking/detail',
getArrayArtist = 'artist/arrayArtist',
getListBookingHis= 'booking/waitingCancellation',
getListBookingHis = 'booking/waitingCancellation',
getArrayCust = 'customer/arrayCust',
getlistMenu = 'web-page/list',
getDetailMenu = 'web-page/detail',
......@@ -171,7 +171,6 @@ export enum API_PATHS {
// xóa công việc
workDelete = 'work/delete',
// danh sách ngân hàng
listBank = 'common/bank',
......@@ -188,5 +187,8 @@ export enum API_PATHS {
contractPenaltiesUpdate = 'contractPenalties/update',
//Xóa phạt
contractPenaltiesDelete = 'contractPenalties/delete'
contractPenaltiesDelete = 'contractPenalties/delete',
// xác nhận
depositUpdateStatus = 'deposit/updateStatus',
}
......@@ -92,7 +92,7 @@ export default defineComponent({
if (value) {
content.value = null;
money.value = null;
console.log(props.data);
}
}
);
......@@ -116,15 +116,14 @@ export default defineComponent({
message: 'Thêm thành công',
actions: [{ icon: 'close', color: 'white' }],
});
void closeDialog
context.emit('success')
context.emit('toggle');
context.emit('success');
}
} catch (error) {}
};
const closeDialog = () => {
context.emit('toggle', );
context.emit('toggle');
};
return {
......
......@@ -60,7 +60,13 @@
</template>
<template v-slot:body-cell-action="item">
<q-td style="padding: 0; text-align: center">
<q-btn flat round color="primary" icon="mdi-pencil-outline">
<q-btn
@click="openDialogUpdate(item.row)"
flat
round
color="primary"
icon="mdi-pencil-outline"
>
<q-tooltip :offset="[10, 10]">Cập nhật</q-tooltip>
</q-btn>
......@@ -101,6 +107,14 @@
:data="data"
@success="getList"
></add>
<update
:open="openUpdate"
@toggle="openUpdate = !openUpdate"
:data="data"
:dataItem="dataItem"
@success="getList"
></update>
</q-card>
</q-dialog>
</template>
......@@ -114,9 +128,11 @@ import { api, BaseResponseBody } from 'src/boot/axios';
import { formatMoney } from '../../boot/functions';
import { ListBooking, ListFinedAmount } from 'src/assets/type';
import add from '../booking/addFinedAmount.vue';
import update from '../booking/updateFinedAmount.vue';
export default defineComponent({
components: {
add,
update,
},
props: {
open: {
......@@ -129,8 +145,10 @@ export default defineComponent({
},
setup(props, context) {
const listFinedAmount: Ref<ListFinedAmount[]> = ref([]);
const dataItem: Ref<ListFinedAmount | undefined> = ref();
const totalPage = ref(1);
const openAddDialog = ref(false);
const openUpdate = ref(false);
const tableColumnsFinedAmount = [
{
name: 'stt',
......@@ -248,6 +266,11 @@ export default defineComponent({
} catch (error) {}
};
const openDialogUpdate = (item: ListFinedAmount) => {
openUpdate.value = true;
dataItem.value = item;
};
const toggle = () => {
context.emit('toggle');
};
......@@ -257,11 +280,14 @@ export default defineComponent({
getList,
isformatMoney,
confirmDelete,
openDialogUpdate,
//
listFinedAmount,
tableColumnsFinedAmount,
totalPage,
openAddDialog,
dataItem,
openUpdate,
};
},
emits: ['click:CloseBtn', 'editReCustomer', 'toggle'],
......
<template>
<q-dialog persistent :model-value="open">
<q-card style="min-width: 750px" bordered>
<q-form greedy @submit.prevent="confirmAdd">
<q-card-section style="padding-bottom: 10px">
<q-item style="padding-left: 10px">
<q-item-section>
<q-item-label class="text-h6 text-weight-regular"
>Cập nhật phạt</q-item-label
>
</q-item-section>
</q-item>
</q-card-section>
<q-card-section style="padding-top: 0px">
<div class="cols-12 q-mb-sm">
<q-input
v-model="money"
outlined
hide-bottom-space
dense
type="text"
:rules="errorMoney"
label="Số tiền *"
/>
</div>
<div class="cols-12">
<q-input
outlined
hide-bottom-space
v-model="content"
:rules="errorContent"
label="Nội dung *"
type="textarea"
/>
</div>
</q-card-section>
<q-card-actions align="right">
<q-btn
color="grey"
no-caps
style="width: 90px"
label="Hủy"
@click="closeDialog"
/>
<q-btn
type="submit"
color="primary"
no-caps
style="width: 90px"
label="Cập nhật"
/>
</q-card-actions>
</q-form>
</q-card>
</q-dialog>
</template>
<script lang="ts">
import { defineComponent, PropType, Ref, ref, watch } from 'vue';
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 { ListBooking, ListFinedAmount } from 'src/assets/type';
export default defineComponent({
props: {
open: {
type: Boolean,
required: true,
},
data: {
type: Object as PropType<ListBooking>,
required: true,
},
dataItem: {
type: Object as PropType<ListFinedAmount>,
required: true,
},
},
setup(props, context) {
const content: Ref<string | null> = ref(null);
const money: Ref<string | null> = ref(null);
watch(
() => props.open,
(value) => {
if (value) {
content.value = props.dataItem.reason;
money.value = props.dataItem.fee;
}
}
);
const confirmAdd = async () => {
try {
const browserResult = (await api({
url: API_PATHS.contractPenaltiesUpdate,
method: 'POST',
data: {
id: props.dataItem.id,
artistBooking: {
id: props.data.id,
},
fee: money.value,
reason: content.value,
},
})) as AxiosResponse<BaseResponseBody<unknown>>;
if (browserResult.data.error.code === config.API_RES_CODE.OK.code) {
Notify.create({
type: 'positive',
message: 'Cập nhật thành công',
actions: [{ icon: 'close', color: 'white' }],
});
context.emit('toggle');
context.emit('success');
}
} catch (error) {}
};
const closeDialog = () => {
context.emit('toggle');
};
// const errorMoney = [
// (val?: string) => (val && val.trim().length) || 'Vui lòng nhập số tiền',
// ];
// const errorContent = [
// (val?: string) => (val && val.trim().length) || 'Vui lòng nhập nội dung',
// ];
return {
//
closeDialog,
confirmAdd,
//
money,
content,
// errorMoney,
// errorContent,
};
},
emits: ['toggle', 'success'],
});
</script>
......@@ -58,9 +58,9 @@
<div class="col-8 fs-14">{{ detailInfoBooking.toTime }}</div>
<div class="col-4 fs-14 color">
{{ $t('listBooking.titleColumnsTable.fee') }} :
{{ $t('listBooking.titleColumnsTable.fee') }}:
</div>
<div class="col-8 fs-14">{{ detailInfoBooking.expectFee }}</div>
<div class="col-8 fs-14">{{ isformatMoney(detailInfoBooking.expectFee) }}</div>
<div class="col-4 fs-14 color">
{{ $t('listBooking.titleColumnsTable.favoriteScore') }}:
......@@ -112,7 +112,6 @@
<div class="col-4 fs-14 color">
{{ $t('listBooking.titleColumnsTable.performStatus') }}:
</div>
......@@ -163,6 +162,7 @@
<script lang="ts">
import { defineComponent, PropType, watch } from 'vue';
import { ListBooking } from 'src/assets/type';
import { formatMoney } from '../../boot/functions';
import tableDeposit from '../../components/detailBooking/tableDeposit/index.vue';
export default defineComponent({
components: {
......@@ -187,7 +187,13 @@ export default defineComponent({
}
);
return {};
const isformatMoney = (value: string) => {
return formatMoney({ amount: value });
};
return {
isformatMoney,
};
},
emits: ['update:showDialog', 'click:CloseBtn'],
});
......
......@@ -49,6 +49,7 @@
<q-tooltip :offset="[20, 10]">Cập nhật</q-tooltip>
</q-btn>
<q-btn
v-if="rowData.row.status == 0"
flat
round
color="primary"
......@@ -176,6 +177,7 @@ import addNewDialog from '../../detailBooking/tableDeposit/add.vue';
import update from '../../detailBooking/tableDeposit/update.vue';
import { formatMoney } from 'boot/functions';
import { ListDeposit, FileUploadType } from 'src/assets/type';
import { Dialog, Notify } from 'quasar';
export default defineComponent({
components: {
addNewDialog,
......@@ -312,11 +314,37 @@ export default defineComponent({
dialogUpdate.value = true;
};
const confirmBrowser = (id: number) => {
console.log(id);
Dialog.create({
title: 'Xác nhận',
message: 'Bạn có chắc chắn duyệt đặt cọc này?',
cancel: 'Hủy',
color: 'negative',
}).onOk(() => {
void browser(id);
});
};
const confirmRefuse = (id: number) => {
console.log(id);
const browser = async (id: number) => {
try {
const deleteResult = (await api({
url: API_PATHS.depositUpdateStatus,
method: 'POST',
data: {
id: id,
},
})) as AxiosResponse<BaseResponseBody<unknown>>;
if (deleteResult.data.error.code === config.API_RES_CODE.OK.code) {
Notify.create({
type: 'positive',
message: 'Duyệt thành công',
actions: [{ icon: 'close', color: 'white' }],
});
void getList();
}
} catch (error) {}
};
const isformatMoney = (value: string) => {
......@@ -382,7 +410,7 @@ export default defineComponent({
handleUpdate,
isformatMoney,
confirmBrowser,
confirmRefuse,
};
},
});
......
......@@ -231,7 +231,7 @@
<template v-slot:body-cell-finedAmount="item">
<q-td style="cursor: pointer" align="center">
<div @click="openDialogfinedAmount(item.row)">
<div style="color: blue; text-decoration:underline;" @click="openDialogfinedAmount(item.row)">
{{ isformatMoney(item.row.finedAmount) }}
</div>
</q-td>
......
......@@ -281,8 +281,8 @@ export default defineComponent({
sortable: false,
},
{
name: 'email',
field: 'email',
name: 'representativeEmail',
field: 'representativeEmail',
required: true,
label: i18n.global.t('customer.tableColumnsCustomer.email'),
headerStyle: 'text-align: center !important;',
......
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