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