Commit 3efe3d57 authored by wzy's avatar wzy

fix: 预付未空,向下取整

parent b1f56aa4
......@@ -24,6 +24,7 @@ import Submit from '@/components/NiceForm/components/Submit'
import BigNumber from 'bignumber.js';
import { useAsyncSelect } from '@/formSchema/effects/useAsyncSelect';
import moment from 'moment';
import { math } from '@/utils';
const intl = getIntl();
......@@ -102,12 +103,9 @@ const FormList = (props: any) => {
}
}
const val_taxPoint = (i) => {
function round(number, precision) {
return Math.round(+number + 'e' + precision) / Math.pow(10, precision);
}
i.isHasTax = !!i.taxPoint ? 1 : 0
i.taxRate = (i.taxPoint || 0) * 100
i.bidAmount = round(new BigNumber(+i.bidCount || i.quantity || 0).multipliedBy(i.price || 0).toNumber(),2)
i.bidAmount = math('round',new BigNumber(+i.bidCount || i.quantity || 0).multipliedBy(i.price || 0).toNumber(),2)
}
/* 确定 */
const handleOk = () => {
......
......@@ -364,7 +364,6 @@ const MemberDocCategoryPro: React.ForwardRefRenderFunction<MemberDocCategoryProR
classifyAreas: classifyAreas?.join(';'),
bankInfos: [...bankInfos] || [...bankInfosList]
});
console.log('123', value);
}
if (isEditable) getClassifyRecord()
......@@ -398,7 +397,9 @@ const MemberDocCategoryPro: React.ForwardRefRenderFunction<MemberDocCategoryProR
// days: days ? `${days}` : '',
// },
taxPoint: +taxPoint * 100,
...rest
...rest,
advanceCharge: rest.advanceCharge || undefined,
advanceChargeName: rest.advanceChargeName !== '未知' ? rest.advanceChargeName : undefined
})) : []
setClassifyInfo({
code: res.data?.code,
......
import { formatTimeString } from '@/utils'
import { formatTimeString, math } from '@/utils'
import { Row, TableColumnsType } from 'antd'
import { OrderModalType } from '@/constants/order'
import { getIntl } from 'umi'
......@@ -343,7 +343,7 @@ export const materialInfoColumns: any[] = [
dataIndex: 'amount',
key: 'amount',
width: COLUMNS_ACTION_WIDTH,
render: (t, r) => t ? `${Number(t).toFixed(2)}` : null
render: (t, r) => t ? `${math('ceil',Number(t),2)}` : null
},
// 接口调用
{
......@@ -448,7 +448,7 @@ export const materialInfoColumnsByRequisition: any[] = [
dataIndex: 'amount',
key: 'amount',
width: COLUMNS_ACTION_WIDTH,
render: (t, r) => t ? `${Number(t).toFixed(2)}` : null
render: (t, r) => t ? `${math('floor',Number(t),2)}` : null
},
// 接口调用
// {
......
......@@ -32,6 +32,7 @@ import { getLogisticsReceiverAddressGet, getLogisticsSelectListMemberShipperAddr
import { getContractSelectCurrencyList } from '@/services/ContractV2Api'
import AuthButton from '@/components/AuthButton'
import { PostOrderMaterialData } from './interface'
import { math } from '@/utils'
export interface PurchaseOrderDetailProps { }
......@@ -401,7 +402,7 @@ const PurchaseOrderDetail: React.FC<PurchaseOrderDetailProps> = (props) => {
logistics: item.deliveryType || 1,
memberId: contractValue.partyBMemberId,
memberRoleId: contractValue.partyBRoleId,
amount: +(item.price * item.quantity).toFixed(2), // 这里应该会出现计算不准的问题
amount: math('floor',+(item.price * item.quantity),2), // 这里应该会出现计算不准的问题
}))
addSchemaAction.setFieldValue('products', mergeArr);
};
......
......@@ -11,6 +11,7 @@ import { RequisitionModalTableRef } from '../components/requisitionModalTable';
import { CaretRightOutlined } from '@ant-design/icons';
import ExpandedRowRender from '../components/expandedRowRender';
import plusIcon from '../images/plus.png';
import { math } from '@/utils';
// 对象按key排序(运用于商城传过来的阶梯价格排序)
export const sortByKey = (params) => {
......@@ -24,7 +25,7 @@ export const sortByKey = (params) => {
export const getUnitPriceTotal = (record) => {
const purchaseCount = Number(record['quantity']) || 0
return Number((record.price * purchaseCount).toFixed(2))
return math('floor', Number((record.price * purchaseCount)),2)
}
/**
......
......@@ -745,6 +745,9 @@ export const isJSONString = (str) => {
return false
}
export function math(fn,number, precision) {
return Math[fn](+number + 'e' + precision) / Math.pow(10, precision);
}
export default {
isArray,
isObject,
......
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