修复: 定价 结算 出货补单 计算中可能出现的数字精度问题
This commit is contained in:
parent
d5fed6e7ff
commit
082a7b58ff
|
@ -33,7 +33,7 @@
|
||||||
border="none"
|
border="none"
|
||||||
:disabled="item.disabled || item.type === 'select'"
|
:disabled="item.disabled || item.type === 'select'"
|
||||||
:disabledColor="
|
:disabledColor="
|
||||||
['补单时间', '站点磅秤', '供应商', '收货产品'].indexOf(item.name) >
|
['补单时间', '站点磅秤', '供应商', '收货产品', '车牌号'].indexOf(item.name) >
|
||||||
-1
|
-1
|
||||||
? '#ffffff'
|
? '#ffffff'
|
||||||
: '#f5f7fa'
|
: '#f5f7fa'
|
||||||
|
@ -443,20 +443,19 @@ watch(
|
||||||
预估总价: 结算单价*结算重量
|
预估总价: 结算单价*结算重量
|
||||||
实际收入:实际结算金额-运费-杂费
|
实际收入:实际结算金额-运费-杂费
|
||||||
*/
|
*/
|
||||||
model1.order.netWeight = num_subtract((parseFloat(grossWeightNew) || 0), (parseFloat(tareNew) || 0))
|
model1.order.netWeight = num_subtract((parseFloat(grossWeightNew) || 0), (parseFloat(tareNew) || 0)).toFixed(2)
|
||||||
|
|
||||||
if (model1.order.buttonType === 0) {
|
if (model1.order.buttonType === 0) {
|
||||||
if (model1.order.subtractNum) {
|
if (model1.order.subtractNum) {
|
||||||
model1.order.netWeight = num_subtract(model1.order.netWeight, model1.order.subtractNum)
|
model1.order.netWeight = num_subtract(model1.order.netWeight, model1.order.subtractNum).toFixed(2)
|
||||||
}
|
}
|
||||||
} else if (model1.order.buttonType === 1) {
|
} else if (model1.order.buttonType === 1) {
|
||||||
if (model1.order.subtractNum) {
|
if (model1.order.subtractNum) {
|
||||||
model1.order.netWeight = num_multiply(model1.order.netWeight, ((100 - model1.order.subtractNum) / 100))
|
model1.order.netWeight = num_multiply(model1.order.netWeight, ((100 - model1.order.subtractNum) / 100)).toFixed(2)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
model1.order.totalPrice = Math.floor(
|
model1.order.totalPrice = num_multiply((model1.order.price || 0), (model1.order.netWeight || 0)).toFixed(2)
|
||||||
(model1.order.price || 0) * (model1.order.netWeight || 0)
|
|
||||||
);
|
|
||||||
// 实际付款默认=预估总价,当系统自动算出预估总价时,值需同步
|
// 实际付款默认=预估总价,当系统自动算出预估总价时,值需同步
|
||||||
model1.order.balanceTotalPrice = model1.order.totalPrice;
|
model1.order.balanceTotalPrice = model1.order.totalPrice;
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,7 +33,7 @@
|
||||||
border="none"
|
border="none"
|
||||||
:disabled="item.disabled || item.type === 'select'"
|
:disabled="item.disabled || item.type === 'select'"
|
||||||
:disabledColor="
|
:disabledColor="
|
||||||
['补单时间', '过磅设备', '客户', '出货产品'].indexOf(item.name) > -1
|
['补单时间', '过磅设备', '客户', '出货产品','车牌号'].indexOf(item.name) > -1
|
||||||
? '#ffffff'
|
? '#ffffff'
|
||||||
: '#f5f7fa'
|
: '#f5f7fa'
|
||||||
"
|
"
|
||||||
|
@ -121,7 +121,7 @@
|
||||||
</template>
|
</template>
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { DeviceApi, GoodsApi, PictureApi, ShipmentApi } from "@/services";
|
import { DeviceApi, GoodsApi, PictureApi, ShipmentApi } from "@/services";
|
||||||
import { countDots, formatDate, isTwoDecimalPlaces } from "@/utils";
|
import { countDots, formatDate, isTwoDecimalPlaces, num_subtract } from "@/utils";
|
||||||
import { DeviceType, ImagesType, OrderType } from "@/utils/enum";
|
import { DeviceType, ImagesType, OrderType } from "@/utils/enum";
|
||||||
import _ from "underscore";
|
import _ from "underscore";
|
||||||
import ProductDialog from "@/components/Dialog/ProductDialog.vue";
|
import ProductDialog from "@/components/Dialog/ProductDialog.vue";
|
||||||
|
@ -438,7 +438,7 @@ watch(
|
||||||
预估总价: 结算单价*结算重量
|
预估总价: 结算单价*结算重量
|
||||||
实际收入:实际结算金额-运费-杂费
|
实际收入:实际结算金额-运费-杂费
|
||||||
*/
|
*/
|
||||||
model1.order.netWeight = (grossWeightNew || 0) - (tareNew || 0);
|
model1.order.netWeight = num_subtract((grossWeightNew || 0), (tareNew || 0)).toFixed(2);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,7 @@
|
||||||
:value="(model1.order as any)[item.key]"
|
:value="(model1.order as any)[item.key]"
|
||||||
@change="(e:any) => {handleInput(e, item)}"
|
@change="(e:any) => {handleInput(e, item)}"
|
||||||
:disabled="item.disabled || item.type === 'select'"
|
:disabled="item.disabled || item.type === 'select'"
|
||||||
:disabledColor="item.name === '收货产品' ? '#ffffff' : '#f5f7fa'"
|
:disabledColor="['收货产品','车牌号'].indexOf(item.name) > -1 ? '#ffffff' : '#f5f7fa'"
|
||||||
@clear="handleClear(item)"
|
@clear="handleClear(item)"
|
||||||
@blur="(e:any) => {handleBlur(e, item)}"
|
@blur="(e:any) => {handleBlur(e, item)}"
|
||||||
>
|
>
|
||||||
|
@ -143,7 +143,7 @@ import { onLoad, onShow } from "@dcloudio/uni-app";
|
||||||
import { ImagesType, OrderType } from "@/utils/enum";
|
import { ImagesType, OrderType } from "@/utils/enum";
|
||||||
import ProductDialog from "@/components/Dialog/ProductDialog.vue";
|
import ProductDialog from "@/components/Dialog/ProductDialog.vue";
|
||||||
import valid from "@/utils/validate";
|
import valid from "@/utils/validate";
|
||||||
import { countDots, isTwoDecimalPlaces } from "@/utils";
|
import { countDots, isTwoDecimalPlaces, num_subtract, num_multiply } from "@/utils";
|
||||||
import Photo from "@/components/Photo/index.vue";
|
import Photo from "@/components/Photo/index.vue";
|
||||||
import CarNoDialog from "@/components/Dialog/CarNoDialog.vue";
|
import CarNoDialog from "@/components/Dialog/CarNoDialog.vue";
|
||||||
|
|
||||||
|
@ -548,21 +548,14 @@ watch(
|
||||||
if (model1.order.scaleStatus === 0) {
|
if (model1.order.scaleStatus === 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
model1.order.netWeight = parseFloat(
|
model1.order.netWeight = <any>num_subtract((parseFloat(grossWeightNew as any) || 0), (parseFloat(tareNew as any) || 0)).toFixed(2)
|
||||||
(
|
|
||||||
(parseFloat(grossWeightNew as any) || 0) -
|
|
||||||
(parseFloat(tareNew as any) || 0)
|
|
||||||
).toFixed(2)
|
|
||||||
);
|
|
||||||
if (model1.order.buttonType === 0) {
|
if (model1.order.buttonType === 0) {
|
||||||
if (model1.order.subtractNum) {
|
if (model1.order.subtractNum) {
|
||||||
model1.order.netWeight =
|
model1.order.netWeight = <any>num_subtract(<any>model1.order.netWeight, model1.order.subtractNum).toFixed(2)
|
||||||
model1.order.netWeight - model1.order.subtractNum;
|
|
||||||
}
|
}
|
||||||
} else if (model1.order.buttonType === 1) {
|
} else if (model1.order.buttonType === 1) {
|
||||||
if (model1.order.subtractNum) {
|
if (model1.order.subtractNum) {
|
||||||
model1.order.netWeight =
|
model1.order.netWeight = <any>num_multiply(<any>model1.order.netWeight,((100 - model1.order.subtractNum) / 100)).toFixed(2)
|
||||||
model1.order.netWeight * ((100 - model1.order.subtractNum) / 100);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -111,6 +111,7 @@ import {
|
||||||
num_subtract,
|
num_subtract,
|
||||||
countDots,
|
countDots,
|
||||||
isTwoDecimalPlaces,
|
isTwoDecimalPlaces,
|
||||||
|
num_multiply
|
||||||
} from "@/utils";
|
} from "@/utils";
|
||||||
import {
|
import {
|
||||||
ImagesType,
|
ImagesType,
|
||||||
|
@ -492,30 +493,25 @@ watch(
|
||||||
预估总价: 结算单价*结算重量
|
预估总价: 结算单价*结算重量
|
||||||
实际收入:实际结算金额-运费-杂费
|
实际收入:实际结算金额-运费-杂费
|
||||||
*/
|
*/
|
||||||
model1.order.settlementNet = num_subtract(
|
model1.order.settlementNet = <any>num_subtract(
|
||||||
settlementGrossNew || 0,
|
settlementGrossNew || 0,
|
||||||
settlementTareNew || 0
|
settlementTareNew || 0
|
||||||
);
|
).toFixed(2);
|
||||||
if (model1.order.buttonType === 0) {
|
if (model1.order.buttonType === 0) {
|
||||||
if (model1.order.subtractNum) {
|
if (model1.order.subtractNum) {
|
||||||
model1.order.settlementWeight =
|
model1.order.settlementWeight = <any>num_subtract(<any>model1.order.settlementNet, model1.order.subtractNum).toFixed(2)
|
||||||
model1.order.settlementNet - model1.order.subtractNum;
|
// model1.order.settlementNet - model1.order.subtractNum;
|
||||||
} else {
|
} else {
|
||||||
model1.order.settlementWeight = model1.order.settlementNet;
|
model1.order.settlementWeight = model1.order.settlementNet;
|
||||||
}
|
}
|
||||||
} else if (model1.order.buttonType === 1) {
|
} else if (model1.order.buttonType === 1) {
|
||||||
if (model1.order.subtractNum) {
|
if (model1.order.subtractNum) {
|
||||||
model1.order.settlementWeight =
|
model1.order.settlementWeight = <any>num_multiply(<any>model1.order.settlementNet, ((100 - model1.order.subtractNum) / 100)).toFixed(2)
|
||||||
model1.order.settlementNet * ((100 - model1.order.subtractNum) / 100);
|
|
||||||
} else {
|
} else {
|
||||||
model1.order.settlementWeight = model1.order.settlementNet;
|
model1.order.settlementWeight = model1.order.settlementNet;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
model1.order.estimatePrice = parseInt(
|
model1.order.estimatePrice = <any>num_multiply((model1.order.unitPrice || 0),(model1.order.settlementWeight || 0)).toFixed(2)
|
||||||
(
|
|
||||||
(model1.order.unitPrice || 0) * (model1.order.settlementWeight || 0)
|
|
||||||
).toFixed(2)
|
|
||||||
);
|
|
||||||
// if (!model1.order.totalPrice) {
|
// if (!model1.order.totalPrice) {
|
||||||
// model1.order.totalPrice = model1.order.estimatePrice;
|
// model1.order.totalPrice = model1.order.estimatePrice;
|
||||||
// }
|
// }
|
||||||
|
|
|
@ -33,7 +33,7 @@
|
||||||
:customStyle="{}"
|
:customStyle="{}"
|
||||||
border="none"
|
border="none"
|
||||||
:disabled="item.disabled || item.type === 'select'"
|
:disabled="item.disabled || item.type === 'select'"
|
||||||
:disabledColor="item.name === '出货产品' ? '#ffffff' : '#f5f7fa'"
|
:disabledColor="['出货产品','车牌号'].indexOf(item.name) > -1 ? '#ffffff' : '#f5f7fa'"
|
||||||
@change="(e:any) => {handleInput(e, item)}"
|
@change="(e:any) => {handleInput(e, item)}"
|
||||||
@blur="(e:any) => {handleBlur(e, item)}"
|
@blur="(e:any) => {handleBlur(e, item)}"
|
||||||
@clear="handleClear(item)"
|
@clear="handleClear(item)"
|
||||||
|
|
Loading…
Reference in New Issue