fix: quotation discount
This commit is contained in:
parent
36cabde5bc
commit
8fb2f5dfb4
2 changed files with 20 additions and 3 deletions
|
|
@ -7,7 +7,7 @@ import WorkerItem from './WorkerItem.vue';
|
|||
import DeleteButton from '../button/DeleteButton.vue';
|
||||
import { precisionRound } from 'src/utils/arithmetic';
|
||||
import { QuotationPayload } from 'stores/quotations/types';
|
||||
import { formatNumberDecimal } from 'stores/utils';
|
||||
import { formatNumberDecimal, commaInput } from 'stores/utils';
|
||||
import { useConfigStore } from 'stores/config';
|
||||
|
||||
const props = defineProps<{
|
||||
|
|
@ -51,6 +51,8 @@ function calcPrice(c: (typeof rows.value)[number]) {
|
|||
);
|
||||
}
|
||||
|
||||
const discount4Show = ref<string[]>([]);
|
||||
|
||||
const columns = [
|
||||
{
|
||||
name: 'order',
|
||||
|
|
@ -304,10 +306,24 @@ watch(
|
|||
min="0"
|
||||
outlined
|
||||
input-class="text-right"
|
||||
:type="readonly ? 'text' : 'number'"
|
||||
style="width: 90px"
|
||||
debounce="500"
|
||||
v-model="props.row.discount"
|
||||
:model-value="
|
||||
commaInput(props.row.discount.toString() || '0')
|
||||
"
|
||||
@update:model-value="
|
||||
(v) => {
|
||||
if (typeof v === 'string')
|
||||
discount4Show[props.rowIndex] = commaInput(v);
|
||||
const x = parseFloat(
|
||||
discount4Show[props.rowIndex] &&
|
||||
typeof discount4Show[props.rowIndex] === 'string'
|
||||
? discount4Show[props.rowIndex].replace(/,/g, '')
|
||||
: '',
|
||||
);
|
||||
props.row.discount = x;
|
||||
}
|
||||
"
|
||||
/>
|
||||
</q-td>
|
||||
<q-td align="right">
|
||||
|
|
|
|||
|
|
@ -309,6 +309,7 @@ async function convertDataToFormSubmit() {
|
|||
workName: quotationFormData.value.workName,
|
||||
_count: quotationFormData.value._count,
|
||||
status: quotationFormData.value.status,
|
||||
discount: quotationFormData.value.discount,
|
||||
};
|
||||
|
||||
const res = await quotationForm.submitQuotation();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue