update: 1.收货作废 出货作废显示优化 2.出货补单 收货补单 待定价 扣除杂质校验保留2位小数

This commit is contained in:
admin 2024-07-25 11:06:53 +08:00
parent a6416d85d1
commit 0a2180e3a6
8 changed files with 147 additions and 31 deletions

View File

@ -39,7 +39,7 @@
<view class="name">{{ item.userName }}</view>
<view class="type">{{ item.productName }}</view>
<view class="flex-box">
<text>定价人{{ item.pricingUserName }}</text>
<text>定价人{{ isNullV(item.pricingUserName) }}</text>
<!-- 过毛时间 -->
<text>过磅时间{{ item.grossTime }}</text>
</view>
@ -56,8 +56,8 @@
><text>
{{
item.buttonType === 0
? item[cItem.enName as string]
: item["points"]
? isNullV(item[cItem.enName as string])
: isNullV(item["points"])
}}
{{ item.buttonType === 0 ? cItem.unit : "%" }}
</text>
@ -66,7 +66,7 @@
<text v-if="cItem.name">{{ cItem.name }}</text
><text
>{{ cItem.isBefore ? cItem.unit : "" }}
{{ item[cItem.enName as string] }}
{{ isNullV(item[cItem.enName as string]) }}
{{ cItem.isBefore ? "" : cItem.unit }}
</text>
</block>
@ -79,6 +79,7 @@
<script setup lang="ts">
import { ReceiveApi } from "@/services";
import PageView from "@/components/PageView/index.vue";
import {isNullV} from '@/utils/index'
const keyword = ref("");
const gridList1 = reactive([

View File

@ -40,6 +40,7 @@
"
@change="(e:any) => {handleInput(e, item)}"
@clear="handleClear(item)"
@blur="(e:any) => {handleBlur(e, item)}"
>
<template #suffix>
<text v-if="item.key === 'subtractNum'">
@ -121,7 +122,6 @@
@changeCarNo="changeCarNo"
ref="carNoRef"
></CarNoDialog>
</template>
<script setup lang="ts">
import {
@ -130,7 +130,7 @@ import {
ReceiveApi,
ReceiveProductApi,
} from "@/services";
import { countDots, formatDate, isTwoDecimalPlaces } from "@/utils";
import { countDots, formatDate, isTwoDecimalPlaces, num_subtract, num_multiply } from "@/utils";
import { DeviceType, ImagesType, OrderType } from "@/utils/enum";
import _ from "underscore";
import ProductDialog from "@/components/Dialog/ProductDialog.vue";
@ -215,6 +215,21 @@ const handleInput = (e: any, item: any) => {
}
};
const handleBlur = (e: any, item: any) => {
if (item.key === "subtractNum") {
if (
countDots(model1.order.subtractNum) === 1 &&
isTwoDecimalPlaces(model1.order.subtractNum)
) {
uni.showToast({
title: "杂质扣除最多只能输入2位小数",
icon: "none",
});
return;
}
}
};
const model1 = reactive<any>({
order: {
buttonType: 0,
@ -333,8 +348,7 @@ const formAttrList = reactive<any>([
unit: "",
disabled: true,
fn: () => {
showDialog.showCarNo = true
showDialog.showCarNo = true;
},
},
{
@ -429,18 +443,15 @@ watch(
预估总价 结算单价*结算重量
实际收入实际结算金额-运费-杂费
*/
model1.order.netWeight = (
(parseFloat(grossWeightNew) || 0) - (parseFloat(tareNew) || 0)
).toFixed(2);
model1.order.netWeight = num_subtract((parseFloat(grossWeightNew) || 0), (parseFloat(tareNew) || 0))
if (model1.order.buttonType === 0) {
if (model1.order.subtractNum) {
model1.order.netWeight =
model1.order.netWeight - model1.order.subtractNum;
model1.order.netWeight = num_subtract(model1.order.netWeight, model1.order.subtractNum)
}
} else if (model1.order.buttonType === 1) {
if (model1.order.subtractNum) {
model1.order.netWeight =
model1.order.netWeight * ((100 - model1.order.subtractNum) / 100);
model1.order.netWeight = num_multiply(model1.order.netWeight, ((100 - model1.order.subtractNum) / 100))
}
}
model1.order.totalPrice = Math.floor(
@ -569,19 +580,35 @@ const save = () => {
return;
}
if (countDots(model1.order.price) === 1 && isTwoDecimalPlaces(model1.order.price)) {
if (
countDots(model1.order.price) === 1 &&
isTwoDecimalPlaces(model1.order.price)
) {
uni.showToast({
title: "单价最多只能输入2位小数",
icon: "none",
});
return
return;
}
if (countDots(model1.order.balanceTotalPrice) === 1 && isTwoDecimalPlaces(model1.order.balanceTotalPrice)) {
if (
countDots(model1.order.balanceTotalPrice) === 1 &&
isTwoDecimalPlaces(model1.order.balanceTotalPrice)
) {
uni.showToast({
title: "实际付款最多只能输入2位小数",
icon: "none",
});
return
return;
}
if (
countDots(model1.order.subtractNum) === 1 &&
isTwoDecimalPlaces(model1.order.subtractNum)
) {
uni.showToast({
title: "杂质扣除最多只能输入2位小数",
icon: "none",
});
return;
}
check().then((res) => {
if (res) {

View File

@ -56,7 +56,7 @@
<text v-if="cItem.name">{{ cItem.name }}</text
><text
>{{ cItem.isBefore ? cItem.unit : "" }}
{{ cItem.name === '送货方式' ? item[`${cItem.enName}`] === DeliveryMethod.Deliver ? '送货' : '自提' : item[`${cItem.enName}`] }}
{{ cItem.name === '送货方式' ? item[`${cItem.enName}`] === DeliveryMethod.Deliver ? '送货' : '自提' : isNullV(item[`${cItem.enName}`]) }}
{{ cItem.isBefore ? "" : cItem.unit }}
</text>
</view>
@ -66,9 +66,10 @@
</view>
</template>
<script setup lang="ts">
import { ReceiveApi, ShipmentApi } from "@/services";
import { ShipmentApi } from "@/services";
import PageView from "@/components/PageView/index.vue";
import { DeliveryMethod, ScaleStatus } from "@/utils/enum";
import {isNullV} from '@/utils/index'
const keyword = ref("");
const gridList1 = reactive([

View File

@ -120,13 +120,8 @@
></CarNoDialog>
</template>
<script setup lang="ts">
import {
DeviceApi,
GoodsApi,
PictureApi,
ShipmentApi,
} from "@/services";
import { countDots, formatDate } from "@/utils";
import { DeviceApi, GoodsApi, PictureApi, ShipmentApi } from "@/services";
import { countDots, formatDate, isTwoDecimalPlaces } from "@/utils";
import { DeviceType, ImagesType, OrderType } from "@/utils/enum";
import _ from "underscore";
import ProductDialog from "@/components/Dialog/ProductDialog.vue";
@ -207,6 +202,19 @@ const handleBlur = (e: any, item: any) => {
return;
}
}
if (item.key === "subtractNum") {
if (
countDots(model1.order.subtractNum) === 1 &&
isTwoDecimalPlaces(model1.order.subtractNum)
) {
uni.showToast({
title: "杂质扣除最多只能输入2位小数",
icon: "none",
});
return;
}
}
};
const model1 = reactive<any>({
@ -563,6 +571,17 @@ const save = () => {
return;
}
if (
countDots(model1.order.subtractNum) === 1 &&
isTwoDecimalPlaces(model1.order.subtractNum)
) {
uni.showToast({
title: "杂质扣除最多只能输入2位小数",
icon: "none",
});
return;
}
check().then((res) => {
if (res) {
startSave();

View File

@ -38,7 +38,7 @@
:disabled="item.disabled || item.type === 'select'"
:disabledColor="item.name === '收货产品' ? '#ffffff' : '#f5f7fa'"
@clear="handleClear(item)"
@blur="item.blur()"
@blur="(e:any) => {handleBlur(e, item)}"
>
<template #suffix>
<text v-if="item.key === 'subtractNum'">
@ -209,6 +209,25 @@ const handleInput = (e: any, item: any) => {
}
};
const handleBlur = (e: any, item: any) => {
if (item.blur) {
item.blur();
}
if (item.key === "subtractNum") {
if (
countDots(model1.order.subtractNum) === 1 &&
isTwoDecimalPlaces(model1.order.subtractNum)
) {
uni.showToast({
title: "杂质扣除最多只能输入2位小数",
icon: "none",
});
return;
}
}
};
const model1 = reactive<{ order: Order }>({
order: {
id: 0,
@ -695,6 +714,17 @@ const save = () => {
});
return;
}
if (
countDots(model1.order.subtractNum) === 1 &&
isTwoDecimalPlaces(model1.order.subtractNum)
) {
uni.showToast({
title: "杂质扣除最多只能输入2位小数",
icon: "none",
});
return;
}
check().then((res) => {
if (res) {
//

View File

@ -161,6 +161,7 @@ import { onLoad } from "@dcloudio/uni-app";
import PageView from "@/components/PageView/index.vue";
import { ScaleStatus } from "@/utils/enum";
import TimeDialog from "@/components/Dialog/TimeDialog.vue";
import _ from "underscore";
//
const filterState = reactive({
showTime: false,
@ -209,7 +210,7 @@ const pageList: PageResult<Order> = reactive({
total: 0,
list: [],
pageNum: 1,
pageSize: 100,
pageSize: 10,
});
const keyword = ref("");
const state = reactive<{
@ -332,6 +333,7 @@ const getList = (v?: boolean) => {
return { ...item, isChecked: false };
})
);
console.log(_.pluck(res.data.list, "id"))
pageList.total = (res.data as any).total;
}
});

View File

@ -36,6 +36,7 @@
:disabled="item.disabled || item.type === 'select'"
:disabledColor="item.name === '结算方式' ? '#ffffff' : '#f5f7fa'"
@change="(e:any) => {handleInput(e, item)}"
@blur="(e:any) => {handleBlur(e, item)}"
@clear="handleClear(item)"
>
<template #suffix>
@ -175,6 +176,21 @@ const handleInput = (e: any, item: any) => {
}, 10);
}
};
const handleBlur = (e: any, item: any) => {
if (item.key === "subtractNum") {
if (
countDots(model1.order.subtractNum) === 1 &&
isTwoDecimalPlaces(model1.order.subtractNum)
) {
uni.showToast({
title: "杂质扣除最多只能输入2位小数",
icon: "none",
});
return;
}
}
};
const model1 = reactive<{
scaleStatusBtnType: number;
order: Shipment;
@ -619,6 +635,17 @@ const save = () => {
return;
}
if (
countDots(model1.order.subtractNum) === 1 &&
isTwoDecimalPlaces(model1.order.subtractNum)
) {
uni.showToast({
title: "杂质扣除最多只能输入2位小数",
icon: "none",
});
return;
}
check().then((res) => {
if (res) {
if (

View File

@ -267,7 +267,12 @@ export function formatMoney(
// 判断字符串中有几个.
export function countDots(str: any) {
return (str.match(/\./g) || []).length;
if (str) {
return (str.toString().match(/\./g) || []).length;
} else {
return 0
}
}
export function isTwoDecimalPlaces(num: any) {
// 转换为字符串并移除可能的符号
@ -392,3 +397,7 @@ 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
}