update

parent 58365629
...@@ -97,7 +97,7 @@ export enum API_PATHS { ...@@ -97,7 +97,7 @@ export enum API_PATHS {
getListBooking = 'booking', getListBooking = 'booking',
getBookingDetail = 'booking/detail', getBookingDetail = 'booking/detail',
getArrayArtist = 'artist/arrayArtist', getArrayArtist = 'artist/arrayArtist',
getListBookingHis= 'booking/waitingCancellation', getListBookingHis = 'booking/waitingCancellation',
getArrayCust = 'customer/arrayCust', getArrayCust = 'customer/arrayCust',
getlistMenu = 'web-page/list', getlistMenu = 'web-page/list',
getDetailMenu = 'web-page/detail', getDetailMenu = 'web-page/detail',
...@@ -171,7 +171,6 @@ export enum API_PATHS { ...@@ -171,7 +171,6 @@ export enum API_PATHS {
// xóa công việc // xóa công việc
workDelete = 'work/delete', workDelete = 'work/delete',
// danh sách ngân hàng // danh sách ngân hàng
listBank = 'common/bank', listBank = 'common/bank',
...@@ -188,5 +187,8 @@ export enum API_PATHS { ...@@ -188,5 +187,8 @@ export enum API_PATHS {
contractPenaltiesUpdate = 'contractPenalties/update', contractPenaltiesUpdate = 'contractPenalties/update',
//Xóa phạt //Xóa phạt
contractPenaltiesDelete = 'contractPenalties/delete' contractPenaltiesDelete = 'contractPenalties/delete',
// xác nhận
depositUpdateStatus = 'deposit/updateStatus',
} }
...@@ -92,7 +92,7 @@ export default defineComponent({ ...@@ -92,7 +92,7 @@ export default defineComponent({
if (value) { if (value) {
content.value = null; content.value = null;
money.value = null; money.value = null;
console.log(props.data);
} }
} }
); );
...@@ -116,15 +116,14 @@ export default defineComponent({ ...@@ -116,15 +116,14 @@ export default defineComponent({
message: 'Thêm thành công', message: 'Thêm thành công',
actions: [{ icon: 'close', color: 'white' }], actions: [{ icon: 'close', color: 'white' }],
}); });
void closeDialog context.emit('toggle');
context.emit('success');
context.emit('success')
} }
} catch (error) {} } catch (error) {}
}; };
const closeDialog = () => { const closeDialog = () => {
context.emit('toggle', ); context.emit('toggle');
}; };
return { return {
......
...@@ -60,7 +60,13 @@ ...@@ -60,7 +60,13 @@
</template> </template>
<template v-slot:body-cell-action="item"> <template v-slot:body-cell-action="item">
<q-td style="padding: 0; text-align: center"> <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-tooltip :offset="[10, 10]">Cập nhật</q-tooltip>
</q-btn> </q-btn>
...@@ -101,6 +107,14 @@ ...@@ -101,6 +107,14 @@
:data="data" :data="data"
@success="getList" @success="getList"
></add> ></add>
<update
:open="openUpdate"
@toggle="openUpdate = !openUpdate"
:data="data"
:dataItem="dataItem"
@success="getList"
></update>
</q-card> </q-card>
</q-dialog> </q-dialog>
</template> </template>
...@@ -114,9 +128,11 @@ import { api, BaseResponseBody } from 'src/boot/axios'; ...@@ -114,9 +128,11 @@ import { api, BaseResponseBody } from 'src/boot/axios';
import { formatMoney } from '../../boot/functions'; import { formatMoney } from '../../boot/functions';
import { ListBooking, ListFinedAmount } from 'src/assets/type'; import { ListBooking, ListFinedAmount } from 'src/assets/type';
import add from '../booking/addFinedAmount.vue'; import add from '../booking/addFinedAmount.vue';
import update from '../booking/updateFinedAmount.vue';
export default defineComponent({ export default defineComponent({
components: { components: {
add, add,
update,
}, },
props: { props: {
open: { open: {
...@@ -129,8 +145,10 @@ export default defineComponent({ ...@@ -129,8 +145,10 @@ export default defineComponent({
}, },
setup(props, context) { setup(props, context) {
const listFinedAmount: Ref<ListFinedAmount[]> = ref([]); const listFinedAmount: Ref<ListFinedAmount[]> = ref([]);
const dataItem: Ref<ListFinedAmount | undefined> = ref();
const totalPage = ref(1); const totalPage = ref(1);
const openAddDialog = ref(false); const openAddDialog = ref(false);
const openUpdate = ref(false);
const tableColumnsFinedAmount = [ const tableColumnsFinedAmount = [
{ {
name: 'stt', name: 'stt',
...@@ -248,6 +266,11 @@ export default defineComponent({ ...@@ -248,6 +266,11 @@ export default defineComponent({
} catch (error) {} } catch (error) {}
}; };
const openDialogUpdate = (item: ListFinedAmount) => {
openUpdate.value = true;
dataItem.value = item;
};
const toggle = () => { const toggle = () => {
context.emit('toggle'); context.emit('toggle');
}; };
...@@ -257,11 +280,14 @@ export default defineComponent({ ...@@ -257,11 +280,14 @@ export default defineComponent({
getList, getList,
isformatMoney, isformatMoney,
confirmDelete, confirmDelete,
openDialogUpdate,
// //
listFinedAmount, listFinedAmount,
tableColumnsFinedAmount, tableColumnsFinedAmount,
totalPage, totalPage,
openAddDialog, openAddDialog,
dataItem,
openUpdate,
}; };
}, },
emits: ['click:CloseBtn', 'editReCustomer', 'toggle'], 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 @@ ...@@ -58,9 +58,9 @@
<div class="col-8 fs-14">{{ detailInfoBooking.toTime }}</div> <div class="col-8 fs-14">{{ detailInfoBooking.toTime }}</div>
<div class="col-4 fs-14 color"> <div class="col-4 fs-14 color">
{{ $t('listBooking.titleColumnsTable.fee') }} : {{ $t('listBooking.titleColumnsTable.fee') }}:
</div> </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"> <div class="col-4 fs-14 color">
{{ $t('listBooking.titleColumnsTable.favoriteScore') }}: {{ $t('listBooking.titleColumnsTable.favoriteScore') }}:
...@@ -112,7 +112,6 @@ ...@@ -112,7 +112,6 @@
<div class="col-4 fs-14 color"> <div class="col-4 fs-14 color">
{{ $t('listBooking.titleColumnsTable.performStatus') }}: {{ $t('listBooking.titleColumnsTable.performStatus') }}:
</div> </div>
...@@ -163,6 +162,7 @@ ...@@ -163,6 +162,7 @@
<script lang="ts"> <script lang="ts">
import { defineComponent, PropType, watch } from 'vue'; import { defineComponent, PropType, watch } from 'vue';
import { ListBooking } from 'src/assets/type'; import { ListBooking } from 'src/assets/type';
import { formatMoney } from '../../boot/functions';
import tableDeposit from '../../components/detailBooking/tableDeposit/index.vue'; import tableDeposit from '../../components/detailBooking/tableDeposit/index.vue';
export default defineComponent({ export default defineComponent({
components: { components: {
...@@ -187,7 +187,13 @@ export default defineComponent({ ...@@ -187,7 +187,13 @@ export default defineComponent({
} }
); );
return {}; const isformatMoney = (value: string) => {
return formatMoney({ amount: value });
};
return {
isformatMoney,
};
}, },
emits: ['update:showDialog', 'click:CloseBtn'], emits: ['update:showDialog', 'click:CloseBtn'],
}); });
......
...@@ -49,6 +49,7 @@ ...@@ -49,6 +49,7 @@
<q-tooltip :offset="[20, 10]">Cập nhật</q-tooltip> <q-tooltip :offset="[20, 10]">Cập nhật</q-tooltip>
</q-btn> </q-btn>
<q-btn <q-btn
v-if="rowData.row.status == 0"
flat flat
round round
color="primary" color="primary"
...@@ -176,6 +177,7 @@ import addNewDialog from '../../detailBooking/tableDeposit/add.vue'; ...@@ -176,6 +177,7 @@ import addNewDialog from '../../detailBooking/tableDeposit/add.vue';
import update from '../../detailBooking/tableDeposit/update.vue'; import update from '../../detailBooking/tableDeposit/update.vue';
import { formatMoney } from 'boot/functions'; import { formatMoney } from 'boot/functions';
import { ListDeposit, FileUploadType } from 'src/assets/type'; import { ListDeposit, FileUploadType } from 'src/assets/type';
import { Dialog, Notify } from 'quasar';
export default defineComponent({ export default defineComponent({
components: { components: {
addNewDialog, addNewDialog,
...@@ -312,11 +314,37 @@ export default defineComponent({ ...@@ -312,11 +314,37 @@ export default defineComponent({
dialogUpdate.value = true; dialogUpdate.value = true;
}; };
const confirmBrowser = (id: number) => { 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) => { const isformatMoney = (value: string) => {
...@@ -382,7 +410,7 @@ export default defineComponent({ ...@@ -382,7 +410,7 @@ export default defineComponent({
handleUpdate, handleUpdate,
isformatMoney, isformatMoney,
confirmBrowser, confirmBrowser,
confirmRefuse,
}; };
}, },
}); });
......
...@@ -231,7 +231,7 @@ ...@@ -231,7 +231,7 @@
<template v-slot:body-cell-finedAmount="item"> <template v-slot:body-cell-finedAmount="item">
<q-td style="cursor: pointer" align="center"> <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) }} {{ isformatMoney(item.row.finedAmount) }}
</div> </div>
</q-td> </q-td>
......
...@@ -281,8 +281,8 @@ export default defineComponent({ ...@@ -281,8 +281,8 @@ export default defineComponent({
sortable: false, sortable: false,
}, },
{ {
name: 'email', name: 'representativeEmail',
field: 'email', field: 'representativeEmail',
required: true, required: true,
label: i18n.global.t('customer.tableColumnsCustomer.email'), label: i18n.global.t('customer.tableColumnsCustomer.email'),
headerStyle: 'text-align: center !important;', 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