update: 收货补单 出货补单接口对接

This commit is contained in:
admin 2024-03-12 16:44:37 +08:00
parent 136f99b639
commit 4f40642986
5 changed files with 265 additions and 92 deletions

View File

@ -33,7 +33,7 @@
> >
<template #suffix> <template #suffix>
<text v-if="item.key === 'subtractNum'"> <text v-if="item.key === 'subtractNum'">
{{ model1.order.subtractType === 1 ? item.unit : "%" }} {{ model1.order.buttonType === 1 ? item.unit : "%" }}
</text> </text>
<text v-else> <text v-else>
{{ item.unit }} {{ item.unit }}
@ -75,15 +75,15 @@
@cancel="contrlModalParams.isShowSplTime = false" @cancel="contrlModalParams.isShowSplTime = false"
></u-datetime-picker> ></u-datetime-picker>
<block v-for="(item, index) in formAttrList" :key="index"> <block v-for="(item, index) in formAttrList" :key="index">
<!-- <u-action-sheet <u-action-sheet
v-if="item.type === 'select'" v-if="item.type === 'select' && item.key !== 'repairTime'"
:actions="contrlModalParams[item.childKey].list" :actions="contrlModalParams[item.childKey].list"
:title="contrlModalParams[item.childKey].title" :title="contrlModalParams[item.childKey].title"
:show="contrlModalParams[item.childKey].isShow" :show="contrlModalParams[item.childKey].isShow"
@select="(v: any) => handleSelect(item.childKey, v)" @select="(v: any) => handleSelect(item.childKey, v)"
@close="contrlModalParams[item.childKey].isShow = false" @close="contrlModalParams[item.childKey].isShow = false"
:closeOnClickAction="true" :closeOnClickAction="true"
></u-action-sheet> --> ></u-action-sheet>
</block> </block>
</view> </view>
<view class="btn-box"> <view class="btn-box">
@ -91,12 +91,14 @@
</view> </view>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { PictureApi, ReceiveApi } from "@/services"; import { DeviceApi, PictureApi, ProfileApi, ReceiveApi, ReceiveProductApi } from "@/services";
import { formatDate } from "@/utils"; import { formatDate } from "@/utils";
import { ImagesType, OrderType } from "@/utils/enum"; import { DeviceType, ImagesType, OrderType } from "@/utils/enum";
import _ from "underscore";
const model1 = reactive<any>({ const model1 = reactive<any>({
order: { order: {
buttonType: 0,
fileList: [], fileList: [],
splTime: "", splTime: "",
subtractType: 1, subtractType: 1,
@ -122,14 +124,7 @@ const contrlModalParams = reactive<any>({
device: { device: {
isShow: false, isShow: false,
title: "标题", title: "标题",
selectList: [ list: [],
{
name: "选项一",
},
{
name: "选项二",
},
],
}, },
user: { user: {
isShow: false, isShow: false,
@ -143,7 +138,7 @@ const contrlModalParams = reactive<any>({
}, },
}); });
const formAttrList = reactive([ const formAttrList = reactive<any>([
{ {
name: "补单时间", name: "补单时间",
key: "repairTime", key: "repairTime",
@ -162,8 +157,8 @@ const formAttrList = reactive([
required: true, required: true,
unit: "", unit: "",
fn: () => { fn: () => {
contrlModalParams.select.isShow = true; contrlModalParams.device.isShow = true;
contrlModalParams.select.title = "站点磅秤"; contrlModalParams.device.title = "站点磅秤";
}, },
}, },
{ {
@ -174,8 +169,8 @@ const formAttrList = reactive([
required: true, required: true,
unit: "", unit: "",
fn: () => { fn: () => {
contrlModalParams.select.isShow = true; contrlModalParams.user.isShow = true;
contrlModalParams.select.title = "供应商"; contrlModalParams.user.title = "供应商";
}, },
}, },
{ {
@ -192,8 +187,8 @@ const formAttrList = reactive([
required: true, required: true,
unit: "", unit: "",
fn: () => { fn: () => {
contrlModalParams.select.isShow = true; contrlModalParams.product.isShow = true;
contrlModalParams.select.title = "收货产品"; contrlModalParams.product.title = "收货产品";
}, },
}, },
{ {
@ -280,20 +275,64 @@ const handleUpload = () => {
}); });
}); });
}; };
const handleSelect = (key: string, v: any) => {
contrlModalParams[key].isShow = false;
if (key === "user") {
debugger
model1.order.userName = v.name;
model1.order.userId = v.id;
} else if (key === "product") {
model1.order.productName = v.name;
model1.order.productId = v.id;
} else if (key === "device") {
model1.order.deviceName = v.name;
model1.order.deviceId = v.id;
}
};
//
ProfileApi.getUserList({ userType: 2 }).then((res) => {
if (res.code === 200) {
contrlModalParams.user.list = res.data;
console.log(contrlModalParams.user.list)
}
});
//
ReceiveProductApi.getAllReProducts().then((res) => {
if (res.code === 200) {
contrlModalParams.product.list = _.map(
res.data as any,
function (item: any) {
return { name: item.reProductsName, ...item };
}
);
}
});
//
DeviceApi.getDeviceList({deviceType: DeviceType.Weighbridge}).then(res => {
if (res.code === 200) {
contrlModalParams.device.list = _.map(
res.data as any,
function (item: any) {
return { name: item.deviceName, ...item };
}
);
}
})
const save = () => { const save = () => {
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({ // uni.showToast({
title: "图片资源上传成功", // title: "",
icon: "success", // icon: "success",
}); // });
} // }
}); // });
} // }
}); // });
if (model1.order.buttonType === 0) { if (model1.order.buttonType === 0) {
model1.order.buckleMiscellaneous = model1.order.subtractNum; model1.order.buckleMiscellaneous = model1.order.subtractNum;
} else if (model1.order.buttonType === 1) { } else if (model1.order.buttonType === 1) {
@ -301,9 +340,10 @@ const save = () => {
} }
ReceiveApi.addOrderIn(model1.order).then((res) => { ReceiveApi.addOrderIn(model1.order).then((res) => {
if (res.code === 200) { if (res.code === 200) {
uni.navigateTo({ model1.order.id = (res.data as any).id
url: "/pages/index/index", // // uni.navigateTo({
}); // url: "/pages/index/index", //
// });
} }
}); });
}; };

View File

@ -33,32 +33,34 @@
> >
<template #suffix> <template #suffix>
<text v-if="item.key === 'subtractNum'"> <text v-if="item.key === 'subtractNum'">
{{ model1.order.subtractType === 1 ? item.unit : "%" }} {{ model1.order.buttonType === 1 ? item.unit : "%" }}
</text> </text>
<text v-else> <text v-else>
{{ item.unit }} {{ item.unit }}
</text> </text>
</template> </template>
</u-input> </u-input>
<!-- @afterRead="afterRead" <!-- @afterRead="afterRead"
@delete="deletePic" --> @delete="deletePic" -->
<u-upload <uni-file-picker
v-if="item.type === 'upload'" v-if="item.type === 'upload'"
:fileList="[]" v-model="model1.order.fileList"
name="1" limit="10"
multiple title="最多可上传10张图片"
:maxCount="10" :auto-upload="false"
></u-upload> fileMediatype="image"
mode="grid"
ref="filesRef"
></uni-file-picker>
<u-radio-group <u-radio-group
v-if="item.type === 'radio'" v-if="item.type === 'radio'"
v-model="(model1.order as any)[item.key]" v-model="(model1.order as any)[item.key]"
placement="row" placement="row"
> >
<u-radio activeColor="#00DCEE" label="送货" :name="1"></u-radio> <u-radio activeColor="#00DCEE" label="按固定重量" :name="1"></u-radio>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
<u-radio activeColor="#00DCEE" label="自提" :name="2"></u-radio> <u-radio activeColor="#00DCEE" label="按百分比" :name="2"></u-radio>
</u-radio-group> </u-radio-group>
<template #right v-if="item.type === 'select'"> <template #right v-if="item.type === 'select'">
<u-icon name="arrow-right"></u-icon> <u-icon name="arrow-right"></u-icon>
@ -69,26 +71,37 @@
:show="contrlModalParams.isShowSplTime" :show="contrlModalParams.isShowSplTime"
v-model="contrlModalParams.spltime" v-model="contrlModalParams.spltime"
mode="datetime" mode="datetime"
@confirm="contrlModalParams.isShowSplTime = false" @confirm="(v: any) => {handleTime(v)}"
@cancel="contrlModalParams.isShowSplTime = false" @cancel="contrlModalParams.isShowSplTime = false"
></u-datetime-picker> ></u-datetime-picker>
<u-action-sheet <block v-for="(item, index) in formAttrList" :key="index">
:actions="contrlModalParams.select.selectList" <u-action-sheet
:title="contrlModalParams.select.title" v-if="item.type === 'select' && item.key !== 'repairTime'"
:show="contrlModalParams.select.isShow" :actions="contrlModalParams[item.childKey].list"
@select="contrlModalParams.select.isShow = false" :title="contrlModalParams[item.childKey].title"
@close="contrlModalParams.select.isShow = false" :show="contrlModalParams[item.childKey].isShow"
></u-action-sheet> @select="(v: any) => handleSelect(item.childKey, v)"
@close="contrlModalParams[item.childKey].isShow = false"
:closeOnClickAction="true"
></u-action-sheet>
</block>
</view> </view>
<view class="btn-box"> <view class="btn-box">
<u-button type="primary" text="保存"></u-button> <u-button type="primary" text="保存" @click="save()"></u-button>
</view> </view>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
const model1 = reactive({ import { DeviceApi, GoodsApi, PictureApi, ProfileApi, ReceiveApi, ReceiveProductApi, ShipmentApi } from "@/services";
import { formatDate } from "@/utils";
import { DeviceType, ImagesType, OrderType } from "@/utils/enum";
import _ from "underscore";
const model1 = reactive<any>({
order: { order: {
buttonType: 0,
fileList: [],
splTime: "", splTime: "",
takeType: 1, subtractType: 1,
}, },
}); });
const rules = ref({ const rules = ref({
@ -105,70 +118,76 @@ const rules = ref({
trigger: ["blur", "change"], trigger: ["blur", "change"],
}, },
}); });
const contrlModalParams = reactive({ const contrlModalParams = reactive<any>({
isShowSplTime: false, isShowSplTime: false,
spltime: "", spltime: "",
select: { device: {
isShow: false, isShow: false,
title: "标题", title: "标题",
selectList: [ list: [],
{ },
name: "选项一", user: {
}, isShow: false,
{ title: "标题",
name: "选项二", list: [],
}, },
], product: {
isShow: false,
title: "标题",
list: [],
}, },
}); });
const formAttrList = reactive([ const formAttrList = reactive<any>([
{ {
name: "补单时间", name: "补单时间",
key: "splTime", key: "repairTime",
type: "select", type: "select",
required: true,
unit: "", unit: "",
required: true,
fn: () => { fn: () => {
contrlModalParams.isShowSplTime = true; contrlModalParams.isShowSplTime = true;
}, },
}, },
{ {
name: "过磅设备", name: "过磅设备",
key: "weighDevice", key: "deviceName",
type: "select", type: "select",
childKey: 'device',
required: true, required: true,
unit: "", unit: "",
fn: () => { fn: () => {
contrlModalParams.select.isShow = true; contrlModalParams.device.isShow = true;
contrlModalParams.select.title = "站点磅秤"; contrlModalParams.device.title = "站点磅秤";
}, },
}, },
{ {
name: "客户", name: "客户",
key: "customer", key: "userName",
type: "select", type: "select",
childKey: 'user',
required: true, required: true,
unit: "", unit: "",
fn: () => { fn: () => {
contrlModalParams.select.isShow = true; contrlModalParams.user.isShow = true;
contrlModalParams.select.title = "供应商"; contrlModalParams.user.title = "供应商";
}, },
}, },
{ {
name: "出货产品", name: "出货产品",
key: "shipmentProduct", key: "productName",
type: "select", type: "select",
childKey: 'product',
required: true, required: true,
unit: "", unit: "",
fn: () => { fn: () => {
contrlModalParams.select.isShow = true; contrlModalParams.product.isShow = true;
contrlModalParams.select.title = "收货产品"; contrlModalParams.product.title = "收货产品";
}, },
}, },
{ {
name: "数量", name: "数量",
key: "grossWeight", key: "number",
type: "input", type: "input",
required: true, required: true,
unit: "件", unit: "件",
@ -191,13 +210,25 @@ const formAttrList = reactive([
name: "净重", name: "净重",
key: "netWeight", key: "netWeight",
type: "input", type: "input",
required: true,
unit: "KG", unit: "KG",
}, },
{ {
name: "提货方式", name: "提货方式",
key: "takeType", key: "deliveryMethod",
required: true,
type: "radio", type: "radio",
required: true,
unit: "",
child: [
{
id: 0,
name: "送货",
},
{
id: 1,
name: "自提",
},
],
}, },
{ {
name: "车辆信息", name: "车辆信息",
@ -205,7 +236,7 @@ const formAttrList = reactive([
}, },
{ {
name: "车牌号", name: "车牌号",
key: "carNo", key: "carNumber",
type: "input", type: "input",
unit: "", unit: "",
}, },
@ -221,27 +252,124 @@ const formAttrList = reactive([
}, },
{ {
name: "箱号", name: "箱号",
key: "boxNo", key: "box",
type: "input", type: "input",
unit: "", unit: "",
}, },
{ {
name: "封号", name: "封号",
key: "no", key: "title",
type: "input", type: "input",
unit: "",
}, },
{ {
name: "备注", name: "备注",
key: "remark", key: "notes",
type: "textarea", type: "textarea",
}, },
{ {
name: "上传照片", name: "货品照片",
key: "photo", key: "photo",
type: "upload", type: "upload",
}, },
]); ]);
const filesRef = ref();
const handleUpload = () => {
// console.log(event.tempFilePaths)
const list = filesRef.value[0].filesList;
return list.map((item: any) => {
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 as any).id,
imagesType: ImagesType.NORMARL, //
orderType: OrderType.Receive, //
});
}
});
});
});
};
const handleSelect = (key: string, v: any) => {
contrlModalParams[key].isShow = false;
if (key === "user") {
debugger
model1.order.userName = v.name;
model1.order.userId = v.id;
} else if (key === "product") {
model1.order.productName = v.name;
model1.order.productId = v.id;
} else if (key === "device") {
model1.order.deviceName = v.name;
model1.order.deviceId = v.id;
}
};
//
ProfileApi.getUserList({ userType: 3 }).then((res) => {
if (res.code === 200) {
contrlModalParams.user.list = res.data;
console.log(contrlModalParams.user.list)
}
});
//
GoodsApi.getShipmentProductList().then((res) => {
if (res.code === 200) {
contrlModalParams.product.list = _.map(
res.data as any,
function (item: any) {
return { name: item.shmProductsName, ...item };
}
);
}
});
//
DeviceApi.getDeviceList({deviceType: DeviceType.Weighbridge}).then(res => {
if (res.code === 200) {
contrlModalParams.device.list = _.map(
res.data as any,
function (item: any) {
return { name: item.deviceName, ...item };
}
);
}
})
const save = () => {
// Promise.all(handleUpload()).then((res) => {
// //
// if (res.length > 0) {
// PictureApi.addListAnnex({ annexPos: res }).then((res1) => {
// if (res1.code === 200) {
// uni.showToast({
// title: "",
// icon: "success",
// });
// }
// });
// }
// });
if (model1.order.buttonType === 0) {
model1.order.buckleMiscellaneous = model1.order.subtractNum;
} else if (model1.order.buttonType === 1) {
model1.order.points = model1.order.subtractNum;
}
ShipmentApi.addOrderOut(model1.order).then((res) => {
if (res.code === 200) {
model1.order.id = (res.data as any).id
uni.navigateTo({
url: "/pages/index/index", //
});
}
});
};
const handleTime = (v: any) => {
model1.order.repairTime = formatDate(v.value, "{y}-{m}-{d} {h}:{i}:{s}");
contrlModalParams.isShowSplTime = false;
};
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.c-card { .c-card {

View File

@ -172,10 +172,9 @@ export const getShipmentProductByPage = (data: any) => {
} }
// 出货产品查询所有 // 出货产品查询所有
export const getShipmentProductList = (data: any) => { export const getShipmentProductList = () => {
return http({ return http({
method: 'GET', method: 'GET',
url: '/api/shmproducts/allShmProducts', url: '/api/shmproducts/allShmProducts',
data,
}) })
} }

View File

@ -115,6 +115,7 @@ interface Shipment {
settlementNet?: number, // 结算净重 settlementNet?: number, // 结算净重
signTime?: string, // 签收时间 signTime?: string, // 签收时间
paymentMethod?: string; //支付方式0:未支付,1:现金支付2银行卡支付3线上支付微信4支付宝 paymentMethod?: string; //支付方式0:未支付,1:现金支付2银行卡支付3线上支付微信4支付宝
userType?: number;//用户类型0刷脸1刷卡
[attrName: string]: any; [attrName: string]: any;
} }

View File

@ -66,3 +66,8 @@ export enum DeliveryMethod {
Deliver = 0, Deliver = 0,
SelfPickup = 1 SelfPickup = 1
} }
export enum DeviceType {
Printer = 0,
Weighbridge = 1
}