fix: paysplit assign & info display
This commit is contained in:
parent
b55437fa7e
commit
3a192c0d77
3 changed files with 17 additions and 3 deletions
|
|
@ -275,6 +275,12 @@ async function convertDataToFormSubmit() {
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
quotationFormData.value.paySplit = JSON.parse(
|
||||||
|
JSON.stringify(
|
||||||
|
quotationFormData.value.paySplit.map((p) => ({ ...p, no: undefined })),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
quotationFormData.value = {
|
quotationFormData.value = {
|
||||||
id: quotationFormData.value.id,
|
id: quotationFormData.value.id,
|
||||||
productServiceList: quotationFormData.value.productServiceList,
|
productServiceList: quotationFormData.value.productServiceList,
|
||||||
|
|
@ -828,6 +834,7 @@ async function searchEmployee(text: string) {
|
||||||
:class="{ 'full-height': $q.screen.gt.xs }"
|
:class="{ 'full-height': $q.screen.gt.xs }"
|
||||||
>
|
>
|
||||||
<QuotationFormInfo
|
<QuotationFormInfo
|
||||||
|
:mode="quotationFormState.mode"
|
||||||
:quotation-no="(quotationFull && quotationFull.code) || ''"
|
:quotation-no="(quotationFull && quotationFull.code) || ''"
|
||||||
v-model:urgent="quotationFormData.urgent"
|
v-model:urgent="quotationFormData.urgent"
|
||||||
:actor="quotationFormState.createdBy?.($i18n.locale) || ''"
|
:actor="quotationFormState.createdBy?.($i18n.locale) || ''"
|
||||||
|
|
@ -993,7 +1000,6 @@ async function searchEmployee(text: string) {
|
||||||
"
|
"
|
||||||
@search="
|
@search="
|
||||||
(id, text, mode) => {
|
(id, text, mode) => {
|
||||||
console.log(mode);
|
|
||||||
if (mode === 'service') {
|
if (mode === 'service') {
|
||||||
getAllService(id, { force: true, query: text, pageSize: 50 });
|
getAllService(id, { force: true, query: text, pageSize: 50 });
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -13,9 +13,10 @@ import SelectInput from 'src/components/shared/SelectInput.vue';
|
||||||
import { storeToRefs } from 'pinia';
|
import { storeToRefs } from 'pinia';
|
||||||
import { precisionRound } from 'src/utils/arithmetic';
|
import { precisionRound } from 'src/utils/arithmetic';
|
||||||
|
|
||||||
defineProps<{
|
const props = defineProps<{
|
||||||
readonly?: boolean;
|
readonly?: boolean;
|
||||||
quotationNo?: string;
|
quotationNo?: string;
|
||||||
|
mode?: null | 'info' | 'create' | 'edit';
|
||||||
data?: {
|
data?: {
|
||||||
total: number;
|
total: number;
|
||||||
discount: number;
|
discount: number;
|
||||||
|
|
@ -182,6 +183,7 @@ function installmentsDate(date: Date | string) {
|
||||||
watch(
|
watch(
|
||||||
() => payType.value,
|
() => payType.value,
|
||||||
(v) => {
|
(v) => {
|
||||||
|
if (props.mode === 'info') return;
|
||||||
if (v === 'Split' || v === 'BillSplit') {
|
if (v === 'Split' || v === 'BillSplit') {
|
||||||
paySplitCount.value = 1;
|
paySplitCount.value = 1;
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -193,6 +195,7 @@ watch(
|
||||||
watch(
|
watch(
|
||||||
() => [paySplitCount.value, summaryPrice.value.finalPrice],
|
() => [paySplitCount.value, summaryPrice.value.finalPrice],
|
||||||
([newCount, _newF], [oldCount, _oldF]) => {
|
([newCount, _newF], [oldCount, _oldF]) => {
|
||||||
|
if (props.mode === 'info') return;
|
||||||
calculateInstallments({ newCount: newCount || 0, oldCount: oldCount || 0 });
|
calculateInstallments({ newCount: newCount || 0, oldCount: oldCount || 0 });
|
||||||
if (newCount !== oldCount) {
|
if (newCount !== oldCount) {
|
||||||
paySplit.value[0].date && installmentsDate(paySplit.value[0].date);
|
paySplit.value[0].date && installmentsDate(paySplit.value[0].date);
|
||||||
|
|
@ -366,7 +369,7 @@ watch(
|
||||||
class="row app-text-muted items-center"
|
class="row app-text-muted items-center"
|
||||||
:class="{ 'q-mb-sm': i !== paySplit.length }"
|
:class="{ 'q-mb-sm': i !== paySplit.length }"
|
||||||
>
|
>
|
||||||
{{ `${$t('quotation.periodNo')} ${period.no}` }}
|
{{ `${$t('quotation.periodNo')} ${i + 1}` }}
|
||||||
<q-input
|
<q-input
|
||||||
class="col q-mx-sm"
|
class="col q-mx-sm"
|
||||||
:label="$t('quotation.amount')"
|
:label="$t('quotation.amount')"
|
||||||
|
|
|
||||||
|
|
@ -109,6 +109,11 @@ export const useQuotationForm = defineStore('form-quotation', () => {
|
||||||
})),
|
})),
|
||||||
dueDate: new Date(data.dueDate),
|
dueDate: new Date(data.dueDate),
|
||||||
payBillDate: data.payBillDate ? new Date(data.payBillDate) : undefined,
|
payBillDate: data.payBillDate ? new Date(data.payBillDate) : undefined,
|
||||||
|
paySplit: data.paySplit.map((p, index) => ({
|
||||||
|
no: index + 1,
|
||||||
|
date: p.date,
|
||||||
|
amount: p.amount,
|
||||||
|
})),
|
||||||
worker: data.worker.map((v) =>
|
worker: data.worker.map((v) =>
|
||||||
Object.assign(v.employee, {
|
Object.assign(v.employee, {
|
||||||
dateOfBirth: new Date(v.employee.dateOfBirth),
|
dateOfBirth: new Date(v.employee.dateOfBirth),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue