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

View File

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

View File

@ -56,7 +56,7 @@
<text v-if="cItem.name">{{ cItem.name }}</text <text v-if="cItem.name">{{ cItem.name }}</text
><text ><text
>{{ cItem.isBefore ? cItem.unit : "" }} >{{ 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 }} {{ cItem.isBefore ? "" : cItem.unit }}
</text> </text>
</view> </view>
@ -66,9 +66,10 @@
</view> </view>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { ReceiveApi, ShipmentApi } from "@/services"; import { ShipmentApi } from "@/services";
import PageView from "@/components/PageView/index.vue"; import PageView from "@/components/PageView/index.vue";
import { DeliveryMethod, ScaleStatus } from "@/utils/enum"; import { DeliveryMethod, ScaleStatus } from "@/utils/enum";
import {isNullV} from '@/utils/index'
const keyword = ref(""); const keyword = ref("");
const gridList1 = reactive([ const gridList1 = reactive([

View File

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

View File

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

View File

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

View File

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

View File

@ -267,7 +267,12 @@ export function formatMoney(
// 判断字符串中有几个. // 判断字符串中有几个.
export function countDots(str: any) { 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) { 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); return (r1 / r2) * Math.pow(10, t2 - t1);
} }
export function isNullV(item: any) {
return item === null ? '-' : item
}