update: 收货补单 预估总价单位设置

This commit is contained in:
admin 2024-08-02 10:57:31 +08:00
parent 66ec75c5b2
commit df076996f3
3 changed files with 86 additions and 12 deletions

View File

@ -33,8 +33,9 @@
border="none" border="none"
:disabled="item.disabled || item.type === 'select'" :disabled="item.disabled || item.type === 'select'"
:disabledColor=" :disabledColor="
['补单时间', '站点磅秤', '供应商', '收货产品', '车牌号'].indexOf(item.name) > ['补单时间', '站点磅秤', '供应商', '收货产品', '车牌号'].indexOf(
-1 item.name
) > -1
? '#ffffff' ? '#ffffff'
: '#f5f7fa' : '#f5f7fa'
" "
@ -126,11 +127,19 @@
<script setup lang="ts"> <script setup lang="ts">
import { import {
DeviceApi, DeviceApi,
OtherConfigApi,
PictureApi, PictureApi,
ReceiveApi, ReceiveApi,
ReceiveProductApi, ReceiveProductApi,
} from "@/services"; } from "@/services";
import { countDots, formatDate, isTwoDecimalPlaces, num_subtract, num_multiply } from "@/utils"; import {
countDots,
formatDate,
isTwoDecimalPlaces,
num_subtract,
num_multiply,
getNumberValue,
} 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";
@ -443,19 +452,35 @@ watch(
预估总价 结算单价*结算重量 预估总价 结算单价*结算重量
实际收入实际结算金额-运费-杂费 实际收入实际结算金额-运费-杂费
*/ */
model1.order.netWeight = num_subtract((parseFloat(grossWeightNew) || 0), (parseFloat(tareNew) || 0)).toFixed(2) 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).toFixed(2) 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)).toFixed(2) model1.order.netWeight = num_multiply(
model1.order.netWeight,
(100 - model1.order.subtractNum) / 100
).toFixed(2);
} }
} }
model1.order.totalPrice = num_multiply((model1.order.price || 0), (model1.order.netWeight || 0)).toFixed(2)
const tempTotalPrice = num_multiply(
model1.order.price || 0,
model1.order.netWeight || 0
).toFixed(2);
model1.order.totalPrice = getNumberValue(
settlementConfig.value,
tempTotalPrice
);
// = // =
model1.order.balanceTotalPrice = model1.order.totalPrice; model1.order.balanceTotalPrice = model1.order.totalPrice;
} }
@ -634,11 +659,18 @@ const handleTime = (v: any) => {
contrlModalParams.isShowSplTime = false; contrlModalParams.isShowSplTime = false;
}; };
onLoad((option: any) => { const settlementConfig = ref();
onLoad((option) => {
uni.$on("getSupplier", (data) => { uni.$on("getSupplier", (data) => {
model1.order.userName = data.item.name; // model1.order.userName = data.item.name; //
model1.order.userId = data.item.id; // Id, model1.order.userId = data.item.id; // Id,
}); });
//
OtherConfigApi.printdetail({}).then((res: any) => {
if (res.code === 200) {
settlementConfig.value = res.data.settlementConfig;
}
});
}); });
onUnmounted(() => { onUnmounted(() => {

View File

@ -147,6 +147,7 @@
@select="selectClick" @select="selectClick"
:closeOnClickOverlay="true" :closeOnClickOverlay="true"
:closeOnClickAction="true" :closeOnClickAction="true"
@close="state.show = false"
></up-action-sheet> ></up-action-sheet>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">

View File

@ -270,9 +270,8 @@ export function countDots(str: any) {
if (str) { if (str) {
return (str.toString().match(/\./g) || []).length; return (str.toString().match(/\./g) || []).length;
} else { } else {
return 0 return 0;
} }
} }
export function isTwoDecimalPlaces(num: any) { export function isTwoDecimalPlaces(num: any) {
// 转换为字符串并移除可能的符号 // 转换为字符串并移除可能的符号
@ -396,7 +395,49 @@ export function num_divide(num1: number, num2: number) {
return (r1 / r2) * Math.pow(10, t2 - t1); return (r1 / r2) * Math.pow(10, t2 - t1);
} }
export function isNullV(item: any) { export function isNullV(item: any) {
return item === null ? '-' : item return item === null ? "-" : item;
}
// 四舍五入到指定的小数位数
export function roundToDecimalPlace(number: number, decimalPlaces: number) {
const factor = Math.pow(10, decimalPlaces);
return Math.round(number * factor) / factor;
}
export function floorToDecimalPlace(number: number, decimalPlaces: number) {
const factor = Math.pow(10, decimalPlaces);
return Math.floor(number * factor) / factor;
}
// { id: 1, name: "正常计算" },
// { id: 2, name: "抹分" },
// { id: 3, name: "抹角分" },
// { id: 4, name: "抹元" },
// { id: 5, name: "分位四舍五入" },
// { id: 6, name: "角位四舍五入" },
// { id: 7, name: "元位四舍五入" },
export function getNumberValue(
settlementConfig: number,
tempTotalPrice: string
) {
let totalPrice = 0;
if (settlementConfig === 1) {
totalPrice = parseFloat(tempTotalPrice);
} else if (settlementConfig === 2) {
totalPrice = floorToDecimalPlace(parseFloat(tempTotalPrice), 1);
} else if (settlementConfig === 3) {
totalPrice = floorToDecimalPlace(parseFloat(tempTotalPrice), 0);
} else if (settlementConfig === 4) {
totalPrice = floorToDecimalPlace(parseFloat(tempTotalPrice), -1);
} else if (settlementConfig === 5) {
totalPrice = roundToDecimalPlace(parseFloat(tempTotalPrice), 1);
} else if (settlementConfig === 6) {
totalPrice = roundToDecimalPlace(parseFloat(tempTotalPrice), 0);
} else if (settlementConfig === 7) {
totalPrice = roundToDecimalPlace(parseFloat(tempTotalPrice), -1);
} else {
totalPrice = parseFloat(tempTotalPrice);
}
return totalPrice;
} }