update: 收货补单 预估总价单位设置
This commit is contained in:
parent
66ec75c5b2
commit
df076996f3
|
@ -33,8 +33,9 @@
|
|||
border="none"
|
||||
:disabled="item.disabled || item.type === 'select'"
|
||||
:disabledColor="
|
||||
['补单时间', '站点磅秤', '供应商', '收货产品', '车牌号'].indexOf(item.name) >
|
||||
-1
|
||||
['补单时间', '站点磅秤', '供应商', '收货产品', '车牌号'].indexOf(
|
||||
item.name
|
||||
) > -1
|
||||
? '#ffffff'
|
||||
: '#f5f7fa'
|
||||
"
|
||||
|
@ -126,11 +127,19 @@
|
|||
<script setup lang="ts">
|
||||
import {
|
||||
DeviceApi,
|
||||
OtherConfigApi,
|
||||
PictureApi,
|
||||
ReceiveApi,
|
||||
ReceiveProductApi,
|
||||
} 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 _ from "underscore";
|
||||
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.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) {
|
||||
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;
|
||||
}
|
||||
|
@ -634,11 +659,18 @@ const handleTime = (v: any) => {
|
|||
contrlModalParams.isShowSplTime = false;
|
||||
};
|
||||
|
||||
onLoad((option: any) => {
|
||||
const settlementConfig = ref();
|
||||
onLoad((option) => {
|
||||
uni.$on("getSupplier", (data) => {
|
||||
model1.order.userName = data.item.name; // 供应商名称
|
||||
model1.order.userId = data.item.id; // 供应商Id,
|
||||
});
|
||||
// 获取配置信息
|
||||
OtherConfigApi.printdetail({}).then((res: any) => {
|
||||
if (res.code === 200) {
|
||||
settlementConfig.value = res.data.settlementConfig;
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
onUnmounted(() => {
|
||||
|
|
|
@ -147,6 +147,7 @@
|
|||
@select="selectClick"
|
||||
:closeOnClickOverlay="true"
|
||||
:closeOnClickAction="true"
|
||||
@close="state.show = false"
|
||||
></up-action-sheet>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
|
|
|
@ -270,9 +270,8 @@ export function countDots(str: any) {
|
|||
if (str) {
|
||||
return (str.toString().match(/\./g) || []).length;
|
||||
} else {
|
||||
return 0
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue