update: 更新收货补单 出货补单对接
This commit is contained in:
parent
30faf31b8a
commit
270ca68aae
|
@ -7,9 +7,10 @@
|
|||
ref="form"
|
||||
:labelWidth="80"
|
||||
:labelStyle="{ padding: '0rpx 10rpx' }"
|
||||
:errorType="'border-bottom'"
|
||||
>
|
||||
<u-form-item
|
||||
:prop="`order[${item.key}]`"
|
||||
:prop="`order.${item.key}`"
|
||||
:label="item.name"
|
||||
:required="item.required"
|
||||
v-for="(item, index) in formAttrList"
|
||||
|
@ -30,10 +31,11 @@
|
|||
:clearable="true"
|
||||
:customStyle="{}"
|
||||
border="none"
|
||||
:disabled="item.disabled"
|
||||
>
|
||||
<template #suffix>
|
||||
<text v-if="item.key === 'subtractNum'">
|
||||
{{ model1.order.buttonType === 1 ? item.unit : "%" }}
|
||||
{{ model1.order.buttonType === 0 ? item.unit : "%" }}
|
||||
</text>
|
||||
<text v-else>
|
||||
{{ item.unit }}
|
||||
|
@ -44,13 +46,14 @@
|
|||
@delete="deletePic" -->
|
||||
<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="filesRef"
|
||||
@delete="handleDelete"
|
||||
></uni-file-picker>
|
||||
|
||||
<u-radio-group
|
||||
|
@ -58,9 +61,9 @@
|
|||
v-model="(model1.order as any)[item.key]"
|
||||
placement="row"
|
||||
>
|
||||
<u-radio activeColor="#00DCEE" label="按固定重量" :name="1"></u-radio>
|
||||
<u-radio activeColor="#00DCEE" label="按固定重量" :name="0"></u-radio>
|
||||
|
||||
<u-radio activeColor="#00DCEE" label="按百分比" :name="2"></u-radio>
|
||||
<u-radio activeColor="#00DCEE" label="按百分比" :name="1"></u-radio>
|
||||
</u-radio-group>
|
||||
<template #right v-if="item.type === 'select'">
|
||||
<u-icon name="arrow-right"></u-icon>
|
||||
|
@ -97,6 +100,7 @@ import {
|
|||
ProfileApi,
|
||||
ReceiveApi,
|
||||
ReceiveProductApi,
|
||||
SupplierApi,
|
||||
} from "@/services";
|
||||
import { formatDate } from "@/utils";
|
||||
import { DeviceType, ImagesType, OrderType } from "@/utils/enum";
|
||||
|
@ -105,22 +109,58 @@ import _ from "underscore";
|
|||
const model1 = reactive<any>({
|
||||
order: {
|
||||
buttonType: 0,
|
||||
fileList: [],
|
||||
fileLists: [],
|
||||
splTime: "",
|
||||
subtractType: 1,
|
||||
},
|
||||
});
|
||||
const rules = ref({
|
||||
"userInfo.userName": {
|
||||
const rules = reactive({
|
||||
"order.repairTime": {
|
||||
type: "string",
|
||||
required: true,
|
||||
message: "请输入手机号",
|
||||
message: "请选择补单时间",
|
||||
trigger: ["blur", "change"],
|
||||
},
|
||||
"userInfo.password": {
|
||||
"order.deviceName": {
|
||||
type: "string",
|
||||
required: true,
|
||||
message: "请输入密码",
|
||||
message: "请选择站点磅秤",
|
||||
trigger: ["blur", "change"],
|
||||
},
|
||||
"order.userName": {
|
||||
type: "string",
|
||||
required: true,
|
||||
message: "请选择供应商",
|
||||
trigger: ["blur", "change"],
|
||||
},
|
||||
"order.productName": {
|
||||
type: "string",
|
||||
required: true,
|
||||
message: "请选择收货产品",
|
||||
trigger: ["blur", "change"],
|
||||
},
|
||||
"order.grossWeight": {
|
||||
type: "string",
|
||||
required: true,
|
||||
message: "请输入毛重",
|
||||
trigger: ["blur", "change"],
|
||||
},
|
||||
"order.tare": {
|
||||
type: "string",
|
||||
required: true,
|
||||
message: "请输入皮重",
|
||||
trigger: ["blur", "change"],
|
||||
},
|
||||
"order.price": {
|
||||
type: "string",
|
||||
required: true,
|
||||
message: "请输入单价",
|
||||
trigger: ["blur", "change"],
|
||||
},
|
||||
"order.balanceTotalPrice": {
|
||||
type: "string",
|
||||
required: true,
|
||||
message: "请输入货款金额",
|
||||
trigger: ["blur", "change"],
|
||||
},
|
||||
});
|
||||
|
@ -227,6 +267,7 @@ const formAttrList = reactive<any>([
|
|||
key: "netWeight",
|
||||
type: "input",
|
||||
unit: "KG",
|
||||
disabled: true
|
||||
},
|
||||
{
|
||||
name: "单价",
|
||||
|
@ -240,9 +281,10 @@ const formAttrList = reactive<any>([
|
|||
key: "totalPrice",
|
||||
type: "input",
|
||||
unit: "元",
|
||||
disabled: true
|
||||
},
|
||||
{
|
||||
name: "贷款金额",
|
||||
name: "货款金额",
|
||||
key: "balanceTotalPrice",
|
||||
type: "input",
|
||||
required: true,
|
||||
|
@ -259,24 +301,73 @@ const formAttrList = reactive<any>([
|
|||
type: "upload",
|
||||
},
|
||||
]);
|
||||
// 监听毛重 皮重
|
||||
watch(
|
||||
[
|
||||
() => model1.order.grossWeight,
|
||||
() => model1.order.tare,
|
||||
() => model1.order.price,
|
||||
() => model1.order.subtractNum,
|
||||
() => model1.order.buttonType,
|
||||
],
|
||||
([grossWeightNew, tareNew]) => {
|
||||
/**
|
||||
* 过磅净重: 毛重-皮重
|
||||
结算重量: 过磅净重-扣杂
|
||||
预估总价: 结算单价*结算重量
|
||||
实际收入:实际结算金额-运费-杂费
|
||||
*/
|
||||
model1.order.netWeight = (grossWeightNew || 0) - (tareNew || 0);
|
||||
if (model1.order.buttonType === 0) {
|
||||
if (model1.order.subtractNum) {
|
||||
model1.order.netWeight =
|
||||
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.totalPrice =
|
||||
(model1.order.price || 0) * (model1.order.netWeight || 0);
|
||||
}
|
||||
);
|
||||
|
||||
const handleDelete = (e: any) => {
|
||||
console.log(model1.order.fileLists);
|
||||
if (e.tempFile.fileID) {
|
||||
PictureApi.deleteById({ id: e.tempFile.fileID }).then((res) => {
|
||||
if (res.code === 200) {
|
||||
uni.showToast({ title: "已删除" });
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
const filesRef = ref();
|
||||
const handleUpload = () => {
|
||||
// console.log(event.tempFilePaths)
|
||||
const list = filesRef.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) => {
|
||||
})
|
||||
.then((res) => {
|
||||
if (res.code === 200) {
|
||||
resolve({
|
||||
...(res.data as any),
|
||||
businessId: (model1.order as any).id,
|
||||
businessId: model1.order.id,
|
||||
imagesType: ImagesType.NORMARL, // 普通资源
|
||||
orderType: OrderType.Receive, // 入库单
|
||||
});
|
||||
}
|
||||
})
|
||||
.catch((e) => {
|
||||
return;
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -296,10 +387,9 @@ const handleSelect = (key: string, v: any) => {
|
|||
}
|
||||
};
|
||||
// 供应商信息
|
||||
ProfileApi.getUserList({ userType: 2 }).then((res) => {
|
||||
SupplierApi.getSupplierUserList({}).then((res) => {
|
||||
if (res.code === 200) {
|
||||
contrlModalParams.user.list = res.data;
|
||||
console.log(contrlModalParams.user.list);
|
||||
}
|
||||
});
|
||||
// 产品信息
|
||||
|
@ -330,16 +420,42 @@ const upload = () => {
|
|||
if (res.length > 0) {
|
||||
PictureApi.addListAnnex({ annexPos: res }).then((res1) => {
|
||||
if (res1.code === 200) {
|
||||
uni.showToast({
|
||||
title: "图片资源上传成功",
|
||||
icon: "success",
|
||||
});
|
||||
console.log("*** 资源文件更新成功");
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* 校验
|
||||
*/
|
||||
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 || "校验失败",
|
||||
});
|
||||
});
|
||||
});
|
||||
};
|
||||
const save = () => {
|
||||
check().then((res) => {
|
||||
if (res) {
|
||||
startSave();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
const startSave = () => {
|
||||
if (model1.order.buttonType === 0) {
|
||||
model1.order.buckleMiscellaneous = model1.order.subtractNum;
|
||||
} else if (model1.order.buttonType === 1) {
|
||||
|
@ -349,8 +465,8 @@ const save = () => {
|
|||
if (res.code === 200) {
|
||||
model1.order.id = res.data;
|
||||
upload();
|
||||
uni.navigateTo({
|
||||
url: "/pages/index/index", // 要跳转到的页面路径
|
||||
uni.redirectTo({
|
||||
url: "/pagesHome/index", // 要跳转到的页面路径
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
|
@ -7,9 +7,10 @@
|
|||
ref="form"
|
||||
:labelWidth="80"
|
||||
:labelStyle="{ padding: '0rpx 10rpx' }"
|
||||
:errorType="'border-bottom'"
|
||||
>
|
||||
<u-form-item
|
||||
:prop="`order[${item.key}]`"
|
||||
:prop="`order.${item.key}`"
|
||||
:label="item.name"
|
||||
:required="item.required"
|
||||
v-for="(item, index) in formAttrList"
|
||||
|
@ -30,6 +31,7 @@
|
|||
:clearable="true"
|
||||
:customStyle="{}"
|
||||
border="none"
|
||||
:disabled="item.disabled"
|
||||
>
|
||||
<template #suffix>
|
||||
<text v-if="item.key === 'subtractNum'">
|
||||
|
@ -44,13 +46,14 @@
|
|||
@delete="deletePic" -->
|
||||
<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="filesRef"
|
||||
@delete="handleDelete"
|
||||
></uni-file-picker>
|
||||
|
||||
<u-radio-group
|
||||
|
@ -58,9 +61,9 @@
|
|||
v-model="(model1.order as any)[item.key]"
|
||||
placement="row"
|
||||
>
|
||||
<u-radio activeColor="#00DCEE" label="按固定重量" :name="1"></u-radio>
|
||||
<u-radio activeColor="#00DCEE" label="送货" :name="0"></u-radio>
|
||||
|
||||
<u-radio activeColor="#00DCEE" label="按百分比" :name="2"></u-radio>
|
||||
<u-radio activeColor="#00DCEE" label="自提" :name="1"></u-radio>
|
||||
</u-radio-group>
|
||||
<template #right v-if="item.type === 'select'">
|
||||
<u-icon name="arrow-right"></u-icon>
|
||||
|
@ -92,6 +95,7 @@
|
|||
</template>
|
||||
<script setup lang="ts">
|
||||
import {
|
||||
CustomerApi,
|
||||
DeviceApi,
|
||||
GoodsApi,
|
||||
PictureApi,
|
||||
|
@ -106,23 +110,53 @@ import _ from "underscore";
|
|||
|
||||
const model1 = reactive<any>({
|
||||
order: {
|
||||
buttonType: 0,
|
||||
fileList: [],
|
||||
deliveryMethod: 0,
|
||||
fileLists: [],
|
||||
splTime: "",
|
||||
subtractType: 1,
|
||||
},
|
||||
});
|
||||
const rules = ref({
|
||||
"userInfo.userName": {
|
||||
const rules = reactive({
|
||||
"order.repairTime": {
|
||||
type: "string",
|
||||
required: true,
|
||||
message: "请输入手机号",
|
||||
message: "请选择补单时间",
|
||||
trigger: ["blur", "change"],
|
||||
},
|
||||
"userInfo.password": {
|
||||
"order.deviceName": {
|
||||
type: "string",
|
||||
required: true,
|
||||
message: "请输入密码",
|
||||
message: "请选择过磅设备",
|
||||
trigger: ["blur", "change"],
|
||||
},
|
||||
"order.userName": {
|
||||
type: "string",
|
||||
required: true,
|
||||
message: "请选择客户",
|
||||
trigger: ["blur", "change"],
|
||||
},
|
||||
"order.productName": {
|
||||
type: "string",
|
||||
required: true,
|
||||
message: "请选择出货产品",
|
||||
trigger: ["blur", "change"],
|
||||
},
|
||||
"order.number": {
|
||||
type: "string",
|
||||
required: true,
|
||||
message: "请输入数量",
|
||||
trigger: ["blur", "change"],
|
||||
},
|
||||
"order.grossWeight": {
|
||||
type: "string",
|
||||
required: true,
|
||||
message: "请输入毛重",
|
||||
trigger: ["blur", "change"],
|
||||
},
|
||||
"order.tare": {
|
||||
type: "string",
|
||||
required: true,
|
||||
message: "请输入皮重",
|
||||
trigger: ["blur", "change"],
|
||||
},
|
||||
});
|
||||
|
@ -178,7 +212,7 @@ const formAttrList = reactive<any>([
|
|||
unit: "",
|
||||
fn: () => {
|
||||
contrlModalParams.user.isShow = true;
|
||||
contrlModalParams.user.title = "供应商";
|
||||
contrlModalParams.user.title = "客户";
|
||||
},
|
||||
},
|
||||
{
|
||||
|
@ -219,6 +253,7 @@ const formAttrList = reactive<any>([
|
|||
key: "netWeight",
|
||||
type: "input",
|
||||
required: true,
|
||||
disabled: true,
|
||||
unit: "KG",
|
||||
},
|
||||
{
|
||||
|
@ -280,28 +315,62 @@ const formAttrList = reactive<any>([
|
|||
type: "upload",
|
||||
},
|
||||
]);
|
||||
|
||||
// 监听毛重 皮重
|
||||
watch(
|
||||
[
|
||||
() => model1.order.grossWeight,
|
||||
() => model1.order.tare,
|
||||
],
|
||||
([grossWeightNew, tareNew]) => {
|
||||
/**
|
||||
* 过磅净重: 毛重-皮重
|
||||
结算重量: 过磅净重-扣杂
|
||||
预估总价: 结算单价*结算重量
|
||||
实际收入:实际结算金额-运费-杂费
|
||||
*/
|
||||
model1.order.netWeight = (grossWeightNew || 0) - (tareNew || 0);
|
||||
}
|
||||
);
|
||||
|
||||
const filesRef = ref();
|
||||
const handleUpload = () => {
|
||||
// console.log(event.tempFilePaths)
|
||||
const list = filesRef.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) => {
|
||||
})
|
||||
.then((res) => {
|
||||
if (res.code === 200) {
|
||||
resolve({
|
||||
...(res.data as any),
|
||||
businessId: (model1.order as any).id,
|
||||
businessId: model1.order.id,
|
||||
imagesType: ImagesType.NORMARL, // 普通资源
|
||||
orderType: OrderType.Receive, // 入库单
|
||||
orderType: OrderType.Shipment, // 出库单
|
||||
});
|
||||
}
|
||||
})
|
||||
.catch((e) => {
|
||||
return;
|
||||
});
|
||||
});
|
||||
});
|
||||
};
|
||||
const handleDelete = (e: any) => {
|
||||
console.log(model1.order.fileLists);
|
||||
if (e.tempFile.fileID) {
|
||||
PictureApi.deleteById({ id: e.tempFile.fileID }).then((res) => {
|
||||
if (res.code === 200) {
|
||||
uni.showToast({ title: "已删除" });
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
const handleSelect = (key: string, v: any) => {
|
||||
contrlModalParams[key].isShow = false;
|
||||
if (key === "user") {
|
||||
|
@ -316,11 +385,10 @@ const handleSelect = (key: string, v: any) => {
|
|||
model1.order.deviceId = v.id;
|
||||
}
|
||||
};
|
||||
// 供应商信息
|
||||
ProfileApi.getUserList({ userType: 3 }).then((res) => {
|
||||
// 客户信息
|
||||
CustomerApi.getCustomUserList({}).then((res) => {
|
||||
if (res.code === 200) {
|
||||
contrlModalParams.user.list = res.data;
|
||||
console.log(contrlModalParams.user.list);
|
||||
}
|
||||
});
|
||||
// 产品信息
|
||||
|
@ -351,27 +419,50 @@ const upload = () => {
|
|||
if (res.length > 0) {
|
||||
PictureApi.addListAnnex({ annexPos: res }).then((res1) => {
|
||||
if (res1.code === 200) {
|
||||
uni.showToast({
|
||||
title: "图片资源上传成功",
|
||||
icon: "success",
|
||||
});
|
||||
console.log("*** 资源文件更新成功");
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* 校验
|
||||
*/
|
||||
const form = ref();
|
||||
const check = () => {
|
||||
return new Promise((resolve) => {
|
||||
form.value
|
||||
.validate()
|
||||
.then((res: boolean) => {
|
||||
resolve(res);
|
||||
})
|
||||
.catch((errors: any) => {
|
||||
debugger
|
||||
resolve(false);
|
||||
uni.showToast({
|
||||
icon: "none",
|
||||
title: errors[0].message || "校验失败",
|
||||
});
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
const save = () => {
|
||||
if (model1.order.buttonType === 0) {
|
||||
model1.order.buckleMiscellaneous = model1.order.subtractNum;
|
||||
} else if (model1.order.buttonType === 1) {
|
||||
model1.order.points = model1.order.subtractNum;
|
||||
check().then((res) => {
|
||||
if (res) {
|
||||
startSave();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
const startSave = () => {
|
||||
ShipmentApi.addOrderOut(model1.order).then((res) => {
|
||||
if (res.code === 200) {
|
||||
model1.order.id = res.data;
|
||||
upload();
|
||||
uni.navigateTo({
|
||||
url: "/pages/index/index", // 要跳转到的页面路径
|
||||
uni.redirectTo({
|
||||
url: "/pagesHome/index", // 要跳转到的页面路径
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue