update: 更新待出货
This commit is contained in:
parent
27bb35590b
commit
30faf31b8a
|
@ -7,14 +7,16 @@
|
||||||
ref="form"
|
ref="form"
|
||||||
:labelWidth="80"
|
:labelWidth="80"
|
||||||
:labelStyle="{ padding: '0rpx 10rpx' }"
|
:labelStyle="{ padding: '0rpx 10rpx' }"
|
||||||
|
:errorType="'border-bottom'"
|
||||||
>
|
>
|
||||||
<block v-for="(item, index) in formAttrList" :key="index">
|
<block v-for="(item, index) in formAttrList" :key="index">
|
||||||
<u-form-item
|
<u-form-item
|
||||||
:prop="`order[${item.key}]`"
|
:prop="`order.${item.key}`"
|
||||||
:label="item.name"
|
:label="item.name"
|
||||||
:required="item.required"
|
:required="item.required"
|
||||||
@click="item.fn"
|
@click="item.fn"
|
||||||
v-if="item.key !== 'paymentMethodName'"
|
v-if="item.key !== 'paymentMethodName'"
|
||||||
|
:borderBottom="false"
|
||||||
>
|
>
|
||||||
<u-textarea
|
<u-textarea
|
||||||
v-if="item.type === 'textarea'"
|
v-if="item.type === 'textarea'"
|
||||||
|
@ -30,6 +32,7 @@
|
||||||
:clearable="true"
|
:clearable="true"
|
||||||
:customStyle="{}"
|
:customStyle="{}"
|
||||||
border="none"
|
border="none"
|
||||||
|
:disabled="item.disabled"
|
||||||
>
|
>
|
||||||
<template #suffix>
|
<template #suffix>
|
||||||
<text v-if="item.key === 'subtractNum'">
|
<text v-if="item.key === 'subtractNum'">
|
||||||
|
@ -42,13 +45,14 @@
|
||||||
</u-input>
|
</u-input>
|
||||||
<uni-file-picker
|
<uni-file-picker
|
||||||
v-if="item.type === 'upload'"
|
v-if="item.type === 'upload'"
|
||||||
v-model="model1.order.fileList"
|
v-model="model1.order.fileLists"
|
||||||
limit="10"
|
limit="9"
|
||||||
title="最多可上传10张图片"
|
title="最多可上传9张图片"
|
||||||
:auto-upload="false"
|
:auto-upload="false"
|
||||||
fileMediatype="image"
|
fileMediatype="image"
|
||||||
mode="grid"
|
mode="grid"
|
||||||
ref="filesShipmentRef"
|
ref="filesRef"
|
||||||
|
@delete="handleDelete"
|
||||||
></uni-file-picker>
|
></uni-file-picker>
|
||||||
|
|
||||||
<u-radio-group
|
<u-radio-group
|
||||||
|
@ -134,29 +138,66 @@ import {
|
||||||
} from "@/utils/enum";
|
} from "@/utils/enum";
|
||||||
import { onLoad } from "@dcloudio/uni-app";
|
import { onLoad } from "@dcloudio/uni-app";
|
||||||
const model1 = reactive<{
|
const model1 = reactive<{
|
||||||
scaleStatusBtnType: number,
|
scaleStatusBtnType: number;
|
||||||
order: Shipment
|
order: Shipment;
|
||||||
}>({
|
}>({
|
||||||
scaleStatusBtnType: 2,
|
scaleStatusBtnType: 2,
|
||||||
order: {
|
order: {
|
||||||
id: '',
|
id: "",
|
||||||
splTime: "",
|
splTime: "",
|
||||||
takeType: 1,
|
takeType: 1,
|
||||||
fileList: [],
|
fileLists: [],
|
||||||
buttonType: 0,
|
buttonType: 0,
|
||||||
|
deliveryMethod: 0,
|
||||||
|
settlementGross: 0,
|
||||||
|
settlementTare: 0,
|
||||||
|
settlementWeight: 0,
|
||||||
|
unitPrice: 0,
|
||||||
|
estimatePrice: 0,
|
||||||
|
subtractNum: 0,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
const rules = ref({
|
const rules = reactive({
|
||||||
"userInfo.userName": {
|
"order.settlementGross": {
|
||||||
type: "string",
|
type: "number",
|
||||||
required: true,
|
required: true,
|
||||||
message: "请输入手机号",
|
message: "请输入结算毛重",
|
||||||
trigger: ["blur", "change"],
|
trigger: ["blur", "change"],
|
||||||
},
|
},
|
||||||
"userInfo.password": {
|
"order.settlementTare": {
|
||||||
type: "string",
|
type: "number",
|
||||||
required: true,
|
required: true,
|
||||||
message: "请输入密码",
|
message: "请输入结算皮重",
|
||||||
|
trigger: ["blur", "change"],
|
||||||
|
},
|
||||||
|
"order.settlementNet": {
|
||||||
|
type: "number",
|
||||||
|
required: true,
|
||||||
|
message: "请输入过磅净重",
|
||||||
|
trigger: ["blur", "change"],
|
||||||
|
},
|
||||||
|
"order.unitPrice": {
|
||||||
|
type: "number",
|
||||||
|
required: true,
|
||||||
|
message: "请输入结算单价",
|
||||||
|
trigger: ["blur", "change"],
|
||||||
|
},
|
||||||
|
"order.settlementWeight": {
|
||||||
|
type: "number",
|
||||||
|
required: true,
|
||||||
|
message: "请输入结算重量",
|
||||||
|
trigger: ["blur", "change"],
|
||||||
|
},
|
||||||
|
"order.estimatePrice": {
|
||||||
|
type: "number",
|
||||||
|
required: true,
|
||||||
|
message: "请输入预估总价",
|
||||||
|
trigger: ["blur", "change"],
|
||||||
|
},
|
||||||
|
"order.totalPrice": {
|
||||||
|
type: "number",
|
||||||
|
required: true,
|
||||||
|
message: "请输入结算金额",
|
||||||
trigger: ["blur", "change"],
|
trigger: ["blur", "change"],
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
@ -207,6 +248,7 @@ const formAttrList = reactive<ComType>([
|
||||||
key: "settlementNet",
|
key: "settlementNet",
|
||||||
type: "input",
|
type: "input",
|
||||||
required: true,
|
required: true,
|
||||||
|
disabled: true,
|
||||||
unit: "kg",
|
unit: "kg",
|
||||||
fn: () => {},
|
fn: () => {},
|
||||||
},
|
},
|
||||||
|
@ -251,12 +293,14 @@ const formAttrList = reactive<ComType>([
|
||||||
key: "settlementWeight",
|
key: "settlementWeight",
|
||||||
type: "input",
|
type: "input",
|
||||||
required: true,
|
required: true,
|
||||||
|
disabled: true,
|
||||||
unit: "KG",
|
unit: "KG",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "预估总价",
|
name: "预估总价",
|
||||||
key: "estimatePrice",
|
key: "estimatePrice",
|
||||||
required: true,
|
required: true,
|
||||||
|
disabled: true,
|
||||||
type: "input",
|
type: "input",
|
||||||
unit: "元",
|
unit: "元",
|
||||||
},
|
},
|
||||||
|
@ -300,6 +344,7 @@ const formAttrList = reactive<ComType>([
|
||||||
key: "realIncome",
|
key: "realIncome",
|
||||||
type: "input",
|
type: "input",
|
||||||
unit: "元",
|
unit: "元",
|
||||||
|
disabled: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "结算方式",
|
name: "结算方式",
|
||||||
|
@ -324,25 +369,74 @@ const formAttrList = reactive<ComType>([
|
||||||
type: "upload",
|
type: "upload",
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
const filesShipmentRef = ref();
|
|
||||||
|
// 监听毛重 皮重
|
||||||
|
watch(
|
||||||
|
[
|
||||||
|
() => model1.order.settlementGross,
|
||||||
|
() => model1.order.settlementTare,
|
||||||
|
() => model1.order.unitPrice,
|
||||||
|
() => model1.order.subtractNum,
|
||||||
|
() => model1.order.buttonType,
|
||||||
|
() => model1.order.freight,
|
||||||
|
() => model1.order.incidentals,
|
||||||
|
() => model1.order.totalPrice
|
||||||
|
|
||||||
|
],
|
||||||
|
([settlementGrossNew, settlementTareNew]) => {
|
||||||
|
/**
|
||||||
|
* 过磅净重: 毛重-皮重
|
||||||
|
结算重量: 过磅净重-扣杂
|
||||||
|
预估总价: 结算单价*结算重量
|
||||||
|
实际收入:实际结算金额-运费-杂费
|
||||||
|
*/
|
||||||
|
model1.order.settlementNet = (settlementGrossNew || 0) - (settlementTareNew || 0);
|
||||||
|
if (model1.order.buttonType === 0) {
|
||||||
|
if (model1.order.subtractNum) {
|
||||||
|
model1.order.settlementWeight =
|
||||||
|
model1.order.settlementNet - model1.order.subtractNum;
|
||||||
|
} else {
|
||||||
|
model1.order.settlementWeight = model1.order.settlementNet;
|
||||||
|
}
|
||||||
|
} else if (model1.order.buttonType === 1) {
|
||||||
|
if (model1.order.subtractNum) {
|
||||||
|
model1.order.settlementWeight =
|
||||||
|
model1.order.settlementNet * ((100 - model1.order.subtractNum)/100);
|
||||||
|
} else {
|
||||||
|
model1.order.settlementWeight = model1.order.settlementNet;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
model1.order.estimatePrice =
|
||||||
|
(model1.order.unitPrice || 0) * (model1.order.settlementWeight || 0);
|
||||||
|
model1.order.realIncome = (model1.order.totalPrice || 0) - (model1.order.freight || 0) - (model1.order.incidentals || 0)
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
const filesRef = ref();
|
||||||
const handleUpload = () => {
|
const handleUpload = () => {
|
||||||
// console.log(event.tempFilePaths)
|
// console.log(event.tempFilePaths)
|
||||||
const list = filesShipmentRef.value[0].filesList;
|
return filesRef.value[0].filesList.map((item: any, index: number) => {
|
||||||
return list.map((item: any) => {
|
if (item.fileID) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
return new Promise((resolve) => {
|
return new Promise((resolve) => {
|
||||||
PictureApi.upload({
|
PictureApi.upload({
|
||||||
files: item,
|
files: item,
|
||||||
path: item.path,
|
path: item.path,
|
||||||
}).then((res) => {
|
})
|
||||||
if (res.code === 200) {
|
.then((res) => {
|
||||||
resolve({
|
if (res.code === 200) {
|
||||||
...(res.data as any),
|
resolve({
|
||||||
businessId: model1.order.id,
|
...(res.data as any),
|
||||||
imagesType: ImagesType.Settlement, // 单据资源
|
businessId: model1.order.id,
|
||||||
orderType: OrderType.Shipment, // 出库单
|
imagesType: ImagesType.Settlement, // 单据资源
|
||||||
});
|
orderType: OrderType.Shipment, // 出库单
|
||||||
}
|
});
|
||||||
});
|
}
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
return;
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
@ -351,29 +445,65 @@ const handleSelect = (key: string, v: any) => {
|
||||||
contrlModalParams[key].isShow = false;
|
contrlModalParams[key].isShow = false;
|
||||||
if (key === "select") {
|
if (key === "select") {
|
||||||
model1.order.paymentMethodName = v.name;
|
model1.order.paymentMethodName = v.name;
|
||||||
model1.order.paymentMethod = v.id;
|
model1.order.paymentMethod = v.key;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
const handleDelete = (e: any) => {
|
||||||
|
if (e.tempFile.fileID) {
|
||||||
|
PictureApi.deleteById({ id: e.tempFile.fileID }).then((res) => {
|
||||||
|
if (res.code === 200) {
|
||||||
|
uni.showToast({ title: "已删除" });
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* 校验
|
||||||
|
*/
|
||||||
|
const form = ref();
|
||||||
|
const check = () => {
|
||||||
|
return new Promise((resolve) => {
|
||||||
|
form.value
|
||||||
|
.validate()
|
||||||
|
.then((res: boolean) => {
|
||||||
|
resolve(res);
|
||||||
|
})
|
||||||
|
.catch((errors: any) => {
|
||||||
|
resolve(false);
|
||||||
|
uni.showToast({
|
||||||
|
icon: "none",
|
||||||
|
title: errors[0].message || "校验失败",
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
};
|
||||||
/**
|
/**
|
||||||
* 点击保存 先执行upload接口
|
* 点击保存 先执行upload接口
|
||||||
* 上传成功后 保存图片资源 和更新订单数据
|
* 上传成功后 保存图片资源 和更新订单数据
|
||||||
*/
|
*/
|
||||||
const save = () => {
|
const save = () => {
|
||||||
|
check().then((res) => {
|
||||||
|
if (res) {
|
||||||
|
startSave();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
const startSave = () => {
|
||||||
Promise.all(handleUpload()).then((res) => {
|
Promise.all(handleUpload()).then((res) => {
|
||||||
// 上传多个资源
|
// 上传多个资源
|
||||||
if (res.length > 0) {
|
if (res.length > 0) {
|
||||||
PictureApi.addListAnnex({ annexPos: res }).then((res1) => {
|
PictureApi.addListAnnex({ annexPos: res }).then((res1) => {
|
||||||
if (res1.code === 200) {
|
if (res1.code === 200) {
|
||||||
uni.showToast({
|
console.log("*** 资源文件更新成功");
|
||||||
title: "图片资源上传成功",
|
|
||||||
icon: "success",
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
updateOrder();
|
||||||
|
};
|
||||||
|
|
||||||
|
const updateOrder = () => {
|
||||||
// 根据不同按钮点击到form 状态不同
|
// 根据不同按钮点击到form 状态不同
|
||||||
let scaleStatus = ref(0);
|
let scaleStatus = ref(0);
|
||||||
if (model1.scaleStatusBtnType === ScaleStatusBtnType.ShipmentNoPay) {
|
if (model1.scaleStatusBtnType === ScaleStatusBtnType.ShipmentNoPay) {
|
||||||
|
@ -382,7 +512,7 @@ const save = () => {
|
||||||
if (model1.scaleStatusBtnType === ScaleStatusBtnType.ShipmentPay) {
|
if (model1.scaleStatusBtnType === ScaleStatusBtnType.ShipmentPay) {
|
||||||
scaleStatus.value = ScaleStatus.ShipmentPaid;
|
scaleStatus.value = ScaleStatus.ShipmentPaid;
|
||||||
}
|
}
|
||||||
model1.order.signTime = formatDate(new Date(), '{y}-{m}-{d} {h}:{i}:{s}')
|
model1.order.signTime = formatDate(new Date(), "{y}-{m}-{d} {h}:{i}:{s}");
|
||||||
// 更新出货单
|
// 更新出货单
|
||||||
ShipmentApi.updateOrderIn({
|
ShipmentApi.updateOrderIn({
|
||||||
orderOutPos: [{ ...model1.order, scaleStatus: scaleStatus.value }],
|
orderOutPos: [{ ...model1.order, scaleStatus: scaleStatus.value }],
|
||||||
|
@ -392,7 +522,7 @@ const save = () => {
|
||||||
title: "编辑成功",
|
title: "编辑成功",
|
||||||
icon: "success",
|
icon: "success",
|
||||||
});
|
});
|
||||||
uni.navigateTo({
|
uni.redirectTo({
|
||||||
url:
|
url:
|
||||||
"/pagesShipment/review/index?id=" +
|
"/pagesShipment/review/index?id=" +
|
||||||
model1.order.id +
|
model1.order.id +
|
||||||
|
@ -408,8 +538,15 @@ onLoad((option) => {
|
||||||
if (model1.order.id) {
|
if (model1.order.id) {
|
||||||
ShipmentApi.getDetailById({ id: model1.order.id }).then((res) => {
|
ShipmentApi.getDetailById({ id: model1.order.id }).then((res) => {
|
||||||
if (res.code === 200) {
|
if (res.code === 200) {
|
||||||
model1.order = { ...res.data };
|
model1.order = {
|
||||||
console.log(model1.order);
|
...res.data,
|
||||||
|
buttonType: res.data.buttonType !== null ? res.data.buttonType : 0,
|
||||||
|
deliveryMethod:
|
||||||
|
res.data.deliveryMethod !== null ? res.data.deliveryMethod : 0,
|
||||||
|
fileLists: model1.order.fileLists.map((item: any) => {
|
||||||
|
return { ...item, fileID: item.id };
|
||||||
|
}),
|
||||||
|
};
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -419,6 +556,7 @@ onLoad((option) => {
|
||||||
imagesType: ImagesType.Settlement,
|
imagesType: ImagesType.Settlement,
|
||||||
}).then((res) => {
|
}).then((res) => {
|
||||||
if (res.code === 200) {
|
if (res.code === 200) {
|
||||||
|
model1.order.fileLists = res.data;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -272,7 +272,6 @@ const handleSelect = (key: string, v: any) => {
|
||||||
|
|
||||||
const filesRef = ref();
|
const filesRef = ref();
|
||||||
const handleUpload = () => {
|
const handleUpload = () => {
|
||||||
debugger;
|
|
||||||
// console.log(event.tempFilePaths)
|
// console.log(event.tempFilePaths)
|
||||||
return filesRef.value[0].filesList.map((item: any, index: number) => {
|
return filesRef.value[0].filesList.map((item: any, index: number) => {
|
||||||
if (item.fileID) {
|
if (item.fileID) {
|
||||||
|
|
|
@ -124,7 +124,14 @@
|
||||||
<text v-if="item.name">{{ item.name }}:</text
|
<text v-if="item.name">{{ item.name }}:</text
|
||||||
><text
|
><text
|
||||||
>{{ item.isBefore ? item.unit : "" }}
|
>{{ item.isBefore ? item.unit : "" }}
|
||||||
{{ item.num }}
|
<text v-if="item.name === '净重误差'">
|
||||||
|
{{ (state.order.netWeight || 0)- (state.order.settlementNet || 0) }}
|
||||||
|
</text>
|
||||||
|
<text v-else-if="item.name === '结算方式'">
|
||||||
|
{{ payMethodMap[item.num] || '暂无' }}
|
||||||
|
</text>
|
||||||
|
<text v-else> {{ item.num }}</text>
|
||||||
|
|
||||||
{{ item.isBefore ? "" : item.unit }}
|
{{ item.isBefore ? "" : item.unit }}
|
||||||
</text>
|
</text>
|
||||||
</view>
|
</view>
|
||||||
|
@ -201,7 +208,12 @@ import { ShipmentApi } from "@/services/index";
|
||||||
import { ScaleStatusBtnType } from "@/utils/enum";
|
import { ScaleStatusBtnType } from "@/utils/enum";
|
||||||
import { onLoad } from "@dcloudio/uni-app";
|
import { onLoad } from "@dcloudio/uni-app";
|
||||||
import SmallModal from "@/components/Modal/smallModal.vue";
|
import SmallModal from "@/components/Modal/smallModal.vue";
|
||||||
const keyword = ref("");
|
const payMethodMap:any = {
|
||||||
|
'1': '现金',
|
||||||
|
'2': '转账',
|
||||||
|
'3': '微信',
|
||||||
|
'4': '支付宝'
|
||||||
|
}
|
||||||
const contrlModalParams = reactive<{ [attrName: string]: any }>({
|
const contrlModalParams = reactive<{ [attrName: string]: any }>({
|
||||||
paySelect: {
|
paySelect: {
|
||||||
isShow: false,
|
isShow: false,
|
||||||
|
@ -433,7 +445,13 @@ const gridList3 = reactive([
|
||||||
unit: "元",
|
unit: "元",
|
||||||
isBefore: false,
|
isBefore: false,
|
||||||
},
|
},
|
||||||
{},
|
{
|
||||||
|
name: "结算方式",
|
||||||
|
enName: "paymentMethod",
|
||||||
|
num: "",
|
||||||
|
unit: "",
|
||||||
|
isBefore: false,
|
||||||
|
},
|
||||||
// 客户过磅净重-机器过磅净重
|
// 客户过磅净重-机器过磅净重
|
||||||
{
|
{
|
||||||
name: "净重误差",
|
name: "净重误差",
|
||||||
|
@ -533,7 +551,7 @@ const handleReWeight = () => {
|
||||||
ShipmentApi.reGrossWeight({ id: state.order.id }).then((res) => {
|
ShipmentApi.reGrossWeight({ id: state.order.id }).then((res) => {
|
||||||
if (res.code === 200) {
|
if (res.code === 200) {
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: "/pagesShipment/grossWeight", // 要跳转到的页面路径
|
url: "/pagesShipment/shipmenting?scaleStatus=1", // 要跳转到的页面路径
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -120,21 +120,21 @@ interface Shipment {
|
||||||
number?: number; //数量
|
number?: number; //数量
|
||||||
notes?: string; //备注
|
notes?: string; //备注
|
||||||
settlementNotes?: string; //结算备注
|
settlementNotes?: string; //结算备注
|
||||||
deliveryMethod?: string; //提货方式:0:送货1:自提
|
deliveryMethod?: number; //提货方式:0:送货1:自提
|
||||||
phone?: string; //手机号
|
phone?: string; //手机号
|
||||||
box?: string; //箱号
|
box?: string; //箱号
|
||||||
title?: string; //封号
|
title?: string; //封号
|
||||||
freight?: string; //运费
|
freight?: number; //运费
|
||||||
incidentals?: string; //杂费
|
incidentals?: number; //杂费
|
||||||
pricingPerson?: string; //定价人
|
pricingPerson?: string; //定价人
|
||||||
reviewerId?: string; //审核人
|
reviewerId?: string; //审核人
|
||||||
buttonType: number; //扣点状态:默认0:扣杂1扣点
|
buttonType: number; //扣点状态:默认0:扣杂1扣点
|
||||||
points?: string; //扣点
|
points?: string; //扣点
|
||||||
buckleMiscellaneous?: string; //扣杂
|
buckleMiscellaneous?: string; //扣杂
|
||||||
unitPrice?: string; //结算单价
|
unitPrice?: number; //结算单价
|
||||||
estimatePrice?: string; //预估金额 结算总价
|
estimatePrice?: number; //预估金额 结算总价
|
||||||
totalPrice?: string; //结算金额 实际金额
|
totalPrice?: number; //结算金额 实际金额
|
||||||
realIncome?: string; //实际收入 实际收入 实收金额
|
realIncome?: number; //实际收入 实际收入 实收金额
|
||||||
errorPrice?: string; //误差金额
|
errorPrice?: string; //误差金额
|
||||||
repairTime?: string; //补单时间
|
repairTime?: string; //补单时间
|
||||||
createTime?: string; //undefined
|
createTime?: string; //undefined
|
||||||
|
|
Loading…
Reference in New Issue