update: 出货入库接口对接

This commit is contained in:
admin 2024-03-12 13:34:36 +08:00
parent 5780a0a2f1
commit 5b43226d3f
8 changed files with 511 additions and 193 deletions

View File

@ -8,13 +8,13 @@
:labelWidth="80" :labelWidth="80"
:labelStyle="{ padding: '0rpx 10rpx' }" :labelStyle="{ padding: '0rpx 10rpx' }"
> >
<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"
v-for="(item, index) in formAttrList"
:key="index"
@click="item.fn" @click="item.fn"
v-if="item.key !== 'paymentMethodName'"
> >
<u-textarea <u-textarea
v-if="item.type === 'textarea'" v-if="item.type === 'textarea'"
@ -32,18 +32,14 @@
border="none" border="none"
> >
<template #suffix> <template #suffix>
<text v-if="item.key === 'subtractNum'">
{{ model1.order.buttonType === 0 ? item.unit : "%" }}
</text>
<text v-else>
{{ item.unit }} {{ item.unit }}
</text>
</template> </template>
</u-input> </u-input>
<!-- @afterRead="afterRead"
@delete="deletePic" -->
<!-- <u-upload
v-if="item.type === 'upload'"
:fileList="[]"
name="1"
multiple
:maxCount="10"
></u-upload> -->
<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.fileList"
@ -57,25 +53,70 @@
<u-radio-group <u-radio-group
v-if="item.type === 'radio'" v-if="item.type === 'radio'"
v-model="(model1.order as any)[(item.key as any)]" v-model="(model1.order as any)[item.key]"
placement="row" placement="row"
> >
<u-radio activeColor="#00DCEE" label="送货" :name="0"></u-radio> <u-radio
&nbsp;&nbsp;&nbsp; v-for="(c, index) in item.child"
<u-radio activeColor="#00DCEE" label="自提" :name="1"></u-radio> :key="index"
activeColor="#00DCEE"
:label="c.name"
:name="c.id"
:customStyle="{ marginRight: '10px' }"
></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>
</template> </template>
</u-form-item> </u-form-item>
<!-- 控制结算方式是否显示 -->
<u-form-item
:prop="`order[${item.key}]`"
:label="item.name"
:required="item.required"
@click="item.fn"
v-if="
item.key === 'paymentMethodName' &&
model1.scaleStatusBtnType === ScaleStatusBtnType.ShipmentPay
"
>
<u-input
v-if="item.type === 'select' || item.type === 'input'"
v-model="(model1.order as any)[(item.key as any)]"
:placeholder="`${item.type === 'select' ? '选择' : '输入'}${
item.name
}`"
:clearable="true"
:customStyle="{}"
border="none"
>
<template #suffix>
<text v-if="item.key === 'subtractNum'">
{{ model1.order.buttonType === 0 ? item.unit : "%" }}
</text>
<text v-else>
{{ item.unit }}
</text>
</template>
</u-input>
<template #right v-if="item.type === 'select'">
<u-icon name="arrow-right"></u-icon>
</template>
</u-form-item>
</block>
</u-form> </u-form>
<block v-for="(item, index) in formAttrList" :key="index">
<u-action-sheet <u-action-sheet
:actions="contrlModalParams.select.selectList" v-if="item.type === 'select'"
:title="contrlModalParams.select.title" :actions="contrlModalParams[item.childKey].list"
:show="contrlModalParams.select.isShow" :title="contrlModalParams[item.childKey].title"
@select="contrlModalParams.select.isShow = false" :show="contrlModalParams[item.childKey].isShow"
@close="contrlModalParams.select.isShow = false" @select="(v: any) => handleSelect(item.childKey, v)"
@close="contrlModalParams[item.childKey].isShow = false"
:closeOnClickAction="true"
></u-action-sheet> ></u-action-sheet>
</block>
</view> </view>
<view class="btn-box"> <view class="btn-box">
<u-button type="primary" text="保存" @click="save()"></u-button> <u-button type="primary" text="保存" @click="save()"></u-button>
@ -83,14 +124,26 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { PictureApi, ShipmentApi } from "@/services"; import { PictureApi, ShipmentApi } from "@/services";
import { ImagesType, OrderType, ScaleStatus } from "@/utils/enum"; import type { ComType } from "@/types/global";
import { formatDate } from "@/utils";
import {
ImagesType,
OrderType,
ScaleStatus,
ScaleStatusBtnType,
} from "@/utils/enum";
import { onLoad } from "@dcloudio/uni-app"; import { onLoad } from "@dcloudio/uni-app";
const model1 = reactive<Shipment>({ const model1 = reactive<{
scaleStatusBtnType: number,
order: Shipment
}>({
scaleStatusBtnType: 2,
order: { order: {
id: 0, id: '',
splTime: "", splTime: "",
takeType: 1, takeType: 1,
fileList: [], fileList: [],
buttonType: 0,
}, },
}); });
const rules = ref({ const rules = ref({
@ -107,103 +160,166 @@ const rules = ref({
trigger: ["blur", "change"], trigger: ["blur", "change"],
}, },
}); });
const contrlModalParams = reactive({ const contrlModalParams = reactive<ComType>({
select: { select: {
isShow: false, isShow: false,
title: "标题", title: "标题",
selectList: [ list: [
{ {
name: "选项一", name: "微信",
key: 3,
}, },
{ {
name: "选项二", name: "现金",
key: 1,
},
{
name: "支付宝",
key: 4,
},
{
name: "转账",
key: 2,
}, },
], ],
}, },
}); });
const formAttrList = reactive([ const formAttrList = reactive<ComType>([
{
name: "客户",
key: "userId",
type: "select",
required: true,
unit: "",
fn: () => {
contrlModalParams.select.isShow = true;
contrlModalParams.select.title = "客户";
},
},
{
name: "出货产品",
key: "productId",
type: "select",
required: true,
unit: "",
fn: () => {
contrlModalParams.select.isShow = true;
contrlModalParams.select.title = "出货产品";
},
},
{
name: "数量",
key: "number",
type: "input",
required: true,
unit: "件",
},
{ {
name: "毛重", name: "毛重",
key: "grossWeight", key: "settlementGross",
type: "input",
required: true,
unit: "kg",
fn: () => {},
},
{
name: "皮重",
key: "settlementTare",
type: "input",
required: true,
unit: "kg",
fn: () => {},
},
{
name: "过磅净重",
key: "settlementNet",
type: "input",
required: true,
unit: "kg",
fn: () => {},
},
{
name: "结算单价",
key: "unitPrice",
type: "input",
required: true,
unit: "元/kg",
fn: () => {},
},
// {
// name: "",
// key: "number",
// type: "input",
// required: true,
// unit: "",
// },
{
name: "扣杂",
key: "buttonType",
type: "radio",
child: [
{
id: 0,
name: "按固定重量",
},
{
id: 1,
name: "按百分比",
},
],
},
{
name: "杂质扣除",
key: "subtractNum",
type: "input",
unit: "KG",
},
{
name: "结算重量",
key: "settlementWeight",
type: "input", type: "input",
required: true, required: true,
unit: "KG", unit: "KG",
}, },
{
name: "预估总价",
key: "estimatePrice",
required: true,
type: "input",
unit: "元",
},
{
name: "结算金额",
key: "totalPrice",
required: true,
type: "input",
unit: "元",
},
{ {
name: "提货方式", name: "提货方式",
key: "deliveryMethod", key: "deliveryMethod",
required: true,
type: "radio", type: "radio",
},
{
name: "车辆信息",
type: "text",
},
{
name: "车牌号",
key: "carNumber",
type: "input",
unit: "", unit: "",
child: [
{
id: 0,
name: "送货",
}, },
{ {
name: "司机电话", id: 1,
key: "phone", name: "自提",
},
],
},
{
name: "运费",
key: "freight",
type: "input", type: "input",
unit: "", unit: "",
}, },
{ {
name: "集装箱", name: "杂费",
type: "text", key: "incidentals",
},
{
name: "箱号",
key: "box",
type: "input", type: "input",
unit: "", unit: "元",
}, },
{ {
name: "封号", name: "实际收入",
key: "title", key: "realIncome",
type: "input", type: "input",
unit: "元",
},
{
name: "结算方式",
key: "paymentMethodName",
required: true,
type: "select",
unit: "", unit: "",
childKey: "select",
fn: () => {
contrlModalParams.select.isShow = true;
contrlModalParams.select.title = "结算方式";
},
}, },
{ {
name: "备注", name: "备注",
key: "notes", key: "settlementNotes",
type: "textarea", type: "textarea",
}, },
{ {
name: "上传照片", name: "结算单据",
key: "photo", key: "photo",
type: "upload", type: "upload",
}, },
@ -222,8 +338,8 @@ const handleUpload = () => {
resolve({ resolve({
...(res.data as any), ...(res.data as any),
businessId: model1.order.id, businessId: model1.order.id,
imagesType: ImagesType.NORMARL, // imagesType: ImagesType.Settlement, //
orderType: OrderType.Shipment, // orderType: OrderType.Shipment, //
}); });
} }
}); });
@ -231,6 +347,14 @@ const handleUpload = () => {
}); });
}; };
const handleSelect = (key: string, v: any) => {
contrlModalParams[key].isShow = false;
if (key === "select") {
model1.order.paymentMethodName = v.name;
model1.order.paymentMethod = v.id;
}
};
/** /**
* 点击保存 先执行upload接口 * 点击保存 先执行upload接口
* 上传成功后 保存图片资源 和更新订单数据 * 上传成功后 保存图片资源 和更新订单数据
@ -250,11 +374,18 @@ const save = () => {
} }
}); });
// form
let scaleStatus = ref(0);
if (model1.scaleStatusBtnType === ScaleStatusBtnType.ShipmentNoPay) {
scaleStatus.value = ScaleStatus.ToBeShipmentPay;
}
if (model1.scaleStatusBtnType === ScaleStatusBtnType.ShipmentPay) {
scaleStatus.value = ScaleStatus.ShipmentPaid;
}
model1.order.signTime = formatDate(new Date(), '{y}-{m}-{d} {h}:{i}:{s}')
// //
ShipmentApi.updateOrderIn({ ShipmentApi.updateOrderIn({
orderOutPos: [ orderOutPos: [{ ...model1.order, scaleStatus: scaleStatus.value }],
{ ...model1.order, scaleStatus: ScaleStatus.ToBeGrossWeight },
],
}).then((res) => { }).then((res) => {
if (res.code === 200) { if (res.code === 200) {
uni.showToast({ uni.showToast({
@ -262,7 +393,10 @@ const save = () => {
icon: "success", icon: "success",
}); });
uni.navigateTo({ uni.navigateTo({
url: "/pagesShipment/grossWeight", // url:
"/pagesShipment/review/index?id=" +
model1.order.id +
`&scaleStatusBtnType=${model1.scaleStatusBtnType}`, //
}); });
} }
}); });
@ -270,16 +404,19 @@ const save = () => {
onLoad((option) => { onLoad((option) => {
model1.order.id = (option as any).id; model1.order.id = (option as any).id;
model1.scaleStatusBtnType = parseInt((option as any).scaleStatusBtnType);
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 = { ...res.data };
console.log(model1.order);
} }
}); });
PictureApi.getAnnex({ PictureApi.getAnnex({
businessId: model1.order.id, businessId: model1.order.id,
orderType: 1, orderType: OrderType.Shipment,
imagesType: ImagesType.NORMARL, imagesType: ImagesType.Settlement,
}).then((res) => { }).then((res) => {
if (res.code === 200) { if (res.code === 200) {
} }

View File

@ -85,7 +85,7 @@
import { PictureApi, ShipmentApi } from "@/services"; import { PictureApi, ShipmentApi } from "@/services";
import { ImagesType, OrderType, ScaleStatus } from "@/utils/enum"; import { ImagesType, OrderType, ScaleStatus } from "@/utils/enum";
import { onLoad } from "@dcloudio/uni-app"; import { onLoad } from "@dcloudio/uni-app";
const model1 = reactive<Shipment>({ const model1 = reactive<any>({
order: { order: {
id: 0, id: 0,
splTime: "", splTime: "",
@ -250,20 +250,31 @@ const save = () => {
} }
}); });
let scaleStatus = 0;
if (ScaleStatus.ToBeShipment === model1.order.scaleStatus) {
scaleStatus = ScaleStatus.ToBeGrossWeight;
} else if (ScaleStatus.ToBeGrossWeight === model1.order.scaleStatus) {
scaleStatus = ScaleStatus.ToBeShipmentReview;
}
// //
ShipmentApi.updateOrderIn({ ShipmentApi.updateOrderIn({
orderOutPos: [ orderOutPos: [{ ...model1.order, scaleStatus: scaleStatus }],
{ ...model1.order, scaleStatus: ScaleStatus.ToBeGrossWeight },
],
}).then((res) => { }).then((res) => {
if (res.code === 200) { if (res.code === 200) {
uni.showToast({ uni.showToast({
title: "编辑成功", title: "编辑成功",
icon: "success", icon: "success",
}); });
debugger
if (scaleStatus === ScaleStatus.ToBeGrossWeight) {
uni.navigateTo({ uni.navigateTo({
url: "/pagesShipment/grossWeight", // url: "/pagesShipment/grossWeight", //
}); });
} else if (scaleStatus === ScaleStatus.ToBeShipmentReview) {
uni.navigateTo({
url: "/pagesShipment/shipmentSettlement?scaleStatus=2", //
});
}
} }
}); });
}; };

View File

@ -29,8 +29,8 @@
@click="handleModal(true, state.order.id as string)" @click="handleModal(true, state.order.id as string)"
></u-tag ></u-tag
></view> ></view>
<!-- 待审核才会有编辑信息--> <!-- 点击待出货结算-->
<view v-if="state.order.scaleStatus === 2" <view v-if="state.scaleStatusBtnType === ScaleStatusBtnType.ShipmentSettlement"
><u-tag ><u-tag
text="编辑信息" text="编辑信息"
plain plain
@ -44,7 +44,7 @@
</view> </view>
</view> </view>
<!-- 出库 过磅时间对应过皮时间 --> <!-- 出库 过磅时间对应过皮时间 -->
<view class="flex-box" v-if="state.order.scaleStatus === 2"> <view class="flex-box" v-if="state.scaleStatusBtnType === ScaleStatusBtnType.ShipmentSettlement || state.scaleStatusBtnType === ScaleStatusBtnType.ShipmentNoPay">
<text>审核人{{ state.order.pricingUserName || "-" }}</text> <text>审核人{{ state.order.pricingUserName || "-" }}</text>
<text>过磅时间{{ state.order.tareTime }}</text> <text>过磅时间{{ state.order.tareTime }}</text>
</view> </view>
@ -58,8 +58,8 @@
</view> --> </view> -->
<view class="more"> <view class="more">
<view v-if="getIsShow()"> 出货单号SHD20230901132333 </view> <view v-if="state.scaleStatusBtnType === ScaleStatusBtnType.ShipmentSettlement || state.scaleStatusBtnType === ScaleStatusBtnType.ShipmentNoPay"> 出货单号{{ state.order.orderNumber }} </view>
<view v-if="getIsShow()"></view> <view v-if="state.scaleStatusBtnType === ScaleStatusBtnType.ShipmentSettlement || state.scaleStatusBtnType === ScaleStatusBtnType.ShipmentNoPay"></view>
<view v-for="(item, index) in gridList1" :key="index"> <view v-for="(item, index) in gridList1" :key="index">
<text v-if="item.name">{{ item.name }}</text <text v-if="item.name">{{ item.name }}</text
><text ><text
@ -74,7 +74,7 @@
<view class="mt-30"> <view class="mt-30">
<u-line></u-line> <u-line></u-line>
</view> </view>
<view class="more"> <view class="more" v-if="state.scaleStatusBtnType === ScaleStatusBtnType.ShipmentSettlement">
<view v-for="(item, index) in gridList2" :key="index"> <view v-for="(item, index) in gridList2" :key="index">
<text v-if="item.name">{{ item.name }}</text <text v-if="item.name">{{ item.name }}</text
><text ><text
@ -84,13 +84,24 @@
</text> </text>
</view> </view>
</view> </view>
<view class="more" v-if="state.scaleStatusBtnType === ScaleStatusBtnType.ShipmentNoPay || state.scaleStatusBtnType === ScaleStatusBtnType.ShipmentPay">
<view v-for="(item, index) in gridList3" :key="index">
<text v-if="item.name">{{ item.name }}</text
><text
>{{ item.isBefore ? item.unit : "" }}
{{ item.num }}
{{ item.isBefore ? "" : item.unit }}
</text>
</view>
</view>
</view> </view>
<view class="op-btn"> <view class="op-btn">
<view class="c-btn-review" v-if="state.order.scaleStatus === 2"> <view class="c-btn-review" v-if="state.scaleStatusBtnType === ScaleStatusBtnType.ShipmentSettlement">
<view @click="handleReviewNoPay"> 出货未结算 </view> <view @click="handleReviewNoPay"> 出货未结算 </view>
<view class="active" @click="handleReviewPay"> 出货并结算 </view> <view class="active" @click="handleReviewPay"> 出货并结算 </view>
</view> </view>
<view v-if="state.order.scaleStatus === 2"> <view v-if="state.scaleStatusBtnType === ScaleStatusBtnType.ShipmentSettlement">
<u-button <u-button
text="重新过毛" text="重新过毛"
plain plain
@ -101,12 +112,13 @@
}" }"
></u-button> ></u-button>
</view> </view>
<view v-if="state.order.scaleStatus === 3"> <view>
<u-button <u-button
text="确认支付" v-if="state.scaleStatusBtnType === ScaleStatusBtnType.ShipmentNoPay"
@click="handleSettlement"
text="立即结算"
type="primary" type="primary"
:customStyle="{ 'border-radius': '43rpx' }" :customStyle="{ 'border-radius': '43rpx' }"
@click="handleReviewPay"
></u-button> ></u-button>
</view> </view>
<view> <view>
@ -142,6 +154,7 @@
<script setup lang="ts"> <script setup lang="ts">
import { ShipmentApi } from "@/services/index"; import { ShipmentApi } from "@/services/index";
import { ScaleStatusBtnType } from "@/utils/enum";
import { onLoad } from "@dcloudio/uni-app"; import { onLoad } from "@dcloudio/uni-app";
const keyword = ref(""); const keyword = ref("");
const contrlModalParams = reactive<{ [attrName: string]: any }>({ const contrlModalParams = reactive<{ [attrName: string]: any }>({
@ -195,7 +208,12 @@ const state = reactive<{
order: Shipment; order: Shipment;
[attrName: string]: any; [attrName: string]: any;
}>({ }>({
order: {}, order: {
id: '',
buttonType: 0,
netWeight: 0,
},
sheetList: [ sheetList: [
{ {
key: "paySelect", key: "paySelect",
@ -204,7 +222,7 @@ const state = reactive<{
key: "printSelect", key: "printSelect",
}, },
], ],
scaleStatus: 2, scaleStatusBtnType: 0,
}); });
const gridList1 = reactive([ const gridList1 = reactive([
{ {
@ -246,21 +264,21 @@ const gridList2 = reactive([
{}, {},
{ {
name: "毛重", name: "毛重",
enName: "signGrossWeight", enName: "settlementGross",
num: "", num: "",
unit: "KG", unit: "KG",
isBefore: false, isBefore: false,
}, },
{ {
name: "皮重", name: "皮重",
enName: "signTare", enName: "settlementTare",
num: "", num: "",
unit: "KG", unit: "KG",
isBefore: false, isBefore: false,
}, },
{ {
name: "结算重量", name: "结算重量",
enName: "signWeight", enName: "settlementWeight",
num: "", num: "",
unit: "KG", unit: "KG",
isBefore: false, isBefore: false,
@ -301,9 +319,92 @@ const gridList2 = reactive([
isBefore: false, isBefore: false,
}, },
]); ]);
const getIsShow = () => {
return state.order.scaleStatus === 2 || state.order.scaleStatus === 4; const gridList3 = reactive([
}; {
name: "客户名称",
enName: "userName",
num: "",
isBefore: false,
},
{
name: "结算人",
enName: "userName",
num: "",
isBefore: false,
},
{
name: "结算时间",
enName: "signTime",
num: "",
isBefore: false,
},
{},
{
name: "结算重量",
enName: "settlementWeight",
num: 0,
unit: "KG",
isBefore: false,
},
{
name: "结算单价",
enName: "unitPrice",
num: "",
unit: "元/KG",
isBefore: false,
},
{
name: "预估总价",
enName: "estimatePrice",
num: "",
unit: "元",
isBefore: false,
},
{
name: "结算金额",
enName: "totalPrice",
num: "",
unit: "元",
isBefore: false,
},
{
name: "运费",
enName: "freight",
num: "",
unit: "元",
isBefore: false,
},
{
name: "杂费",
enName: "incidentals",
num: "",
unit: "元",
isBefore: false,
},
{
name: "实际收入",
enName: "incidentals",
num: "",
unit: "元",
isBefore: false,
},
{},
// -
{
name: "净重误差",
enName: "netWeightError",
num: "",
unit: "KG",
isBefore: false,
},
]);
// // 4
const handleSettlement = () => {
uni.navigateTo({
url: "/pagesShipment/form/settlementForm?id=" + state.order.id + `&scaleStatusBtnType=${ScaleStatusBtnType.ShipmentPay}`, //
});
}
const handleScenePhoto = (imagesId: number) => { const handleScenePhoto = (imagesId: number) => {
uni.navigateTo({ uni.navigateTo({
url: "/pagesScenePhoto/index?orderType=1&id=" + imagesId, // url: "/pagesScenePhoto/index?orderType=1&id=" + imagesId, //
@ -312,7 +413,7 @@ const handleScenePhoto = (imagesId: number) => {
// // 3 // // 3
const handleReviewNoPay = () => { const handleReviewNoPay = () => {
uni.navigateTo({ uni.navigateTo({
url: "/pagesShipment/form/settlementForm?id=" + state.order.id, // url: "/pagesShipment/form/settlementForm?id=" + state.order.id + `&scaleStatusBtnType=${ScaleStatusBtnType.ShipmentNoPay}`, //
}); });
// ShipmentApi.updateOrderIn({ ...state.order, scaleStatus: 3 }).then((res) => { // ShipmentApi.updateOrderIn({ ...state.order, scaleStatus: 3 }).then((res) => {
// if (res.code === 200) { // if (res.code === 200) {
@ -324,7 +425,9 @@ const handleReviewNoPay = () => {
}; };
// //
const handleReviewPay = () => { const handleReviewPay = () => {
contrlModalParams.paySelect.isShow = true; uni.navigateTo({
url: "/pagesShipment/form/settlementForm?id=" + state.order.id + `&scaleStatusBtnType=${ScaleStatusBtnType.ShipmentPay}`, //
});
}; };
const handleSelect = (key: string, v: any) => { const handleSelect = (key: string, v: any) => {
@ -372,13 +475,14 @@ const handleUpdateOrder = () => {
}); });
}; };
onLoad((option) => { onLoad((option) => {
state.order.id = (option as any).id; state.order.id = (option as any).id;
state.scaleStatus = parseInt((option as any).scaleStatus); state.scaleStatusBtnType = parseInt((option as any).scaleStatusBtnType);
if (state.order.id) { if (state.order.id) {
ShipmentApi.getDetailById({ id: state.order.id }).then((res) => { ShipmentApi.getDetailById({ id: state.order.id }).then((res) => {
if (res.code === 200) { if (res.code === 200) {
state.order = res.data; state.order = res.data;
// gridList1.map((item) => { gridList1.map((item) => {
// if (item.name === "" || item.name === "") { // if (item.name === "" || item.name === "") {
// if (state.order.buttonType === 0) { // if (state.order.buttonType === 0) {
// item.name = ""; // item.name = "";
@ -390,8 +494,17 @@ onLoad((option) => {
// item.unit = "%"; // item.unit = "%";
// } // }
// } // }
// item.num = state.order[item.enName as string]; item.num = state.order[item.enName as string];
// }); });
gridList2.map((item) => {
item.num = state.order[item.enName as string];
});
gridList3.map((item) => {
if (item.name === '净重误差') {
item.num = (state.order as any).netWeight - (state.order as any).settlementNet
}
item.num = state.order[item.enName as string];
});
} }
}); });
} }

View File

@ -32,10 +32,10 @@
<view class="c-layout"> <view class="c-layout">
<view <view
><checkbox ><checkbox
value="cb"
:color="'#00D2E3'" :color="'#00D2E3'"
:checked="state.checkMap[(item.id as number)]" :checked="state.checkMap[item.id + '']"
style="transform: scale(0.5)" style="transform: scale(0.5)"
@click="state.checkMap[item.id + ''] = !state.checkMap[item.id + '']"
/></view> /></view>
<view class="inner-box"> <view class="inner-box">
<view class="top-flex-box"> <view class="top-flex-box">
@ -60,11 +60,11 @@
<text class="btn"> <text class="btn">
<text <text
v-if="currentTab === 2" v-if="currentTab === 2"
@click="handleReview(item.id as number, 2)" @click="handleReview(item.id, 2)"
>出货结算</text >出货结算</text
> >
<text v-if="currentTab === 3" @click="handleReview(item.id as number, 3)">去结算</text> <text v-if="currentTab === 3" @click="handleReview(item.id, 3)">去结算</text>
<text v-if="currentTab === 4" @click="handleReview(item.id as number, 4)">查看</text> <text v-if="currentTab === 4" @click="handleReview(item.id, 4)">查看</text>
</text> </text>
</view> </view>
</view> </view>
@ -89,6 +89,7 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { ShipmentApi } from "@/services/index"; import { ShipmentApi } from "@/services/index";
import { ScaleStatusBtnType } from "@/utils/enum";
import { onLoad } from "@dcloudio/uni-app"; import { onLoad } from "@dcloudio/uni-app";
// scaleStatus // scaleStatus
interface PageResult<T> { interface PageResult<T> {
@ -97,7 +98,7 @@ interface PageResult<T> {
pageNum: number; pageNum: number;
pageSize: number; pageSize: number;
} }
const pageList: PageResult<Order> = reactive({ const pageList: PageResult<Shipment> = reactive({
total: 0, total: 0,
list: [], list: [],
pageNum: 1, pageNum: 1,
@ -130,9 +131,17 @@ const handleTab = (item: any) => {
currentTab.value = item.key; currentTab.value = item.key;
getOrderList(); getOrderList();
}; };
const handleReview = (id: number, scaleStatus: number) => { const handleReview = (id: string, scaleStatus: number) => {
let type = ScaleStatusBtnType.ShipmentSettlement
if (scaleStatus === 2) {
type = ScaleStatusBtnType.ShipmentSettlement
} else if (scaleStatus === 3) {
type = ScaleStatusBtnType.ShipmentNoPay
} else if (scaleStatus === 4) {
type = ScaleStatusBtnType.ShipmentPay
}
uni.navigateTo({ uni.navigateTo({
url: "/pagesShipment/review/index?id=" + id + `&scaleStatus=`+ scaleStatus, // url: "/pagesShipment/review/index?id=" + id + `&scaleStatusBtnType=${type}`, //
}); });
}; };
const handleSelect = () => { const handleSelect = () => {
@ -140,6 +149,7 @@ const handleSelect = () => {
Object.keys(state.checkMap).forEach((item) => { Object.keys(state.checkMap).forEach((item) => {
state.checkMap[item] = state.isAll; state.checkMap[item] = state.isAll;
}); });
console.log(state.checkMap)
}; };
const getOrderList = () => { const getOrderList = () => {
ShipmentApi.getOrderPage({ pageNumber: 1, pageSize: 10, scaleStatus: currentTab.value }).then( ShipmentApi.getOrderPage({ pageNumber: 1, pageSize: 10, scaleStatus: currentTab.value }).then(
@ -147,7 +157,7 @@ const getOrderList = () => {
if (res.code === 200) { if (res.code === 200) {
(pageList as any).list = res.data.list; (pageList as any).list = res.data.list;
(res.data.list as any).forEach((item: any) => { (res.data.list as any).forEach((item: any) => {
state.checkMap[parseInt(item.id)] = false; state.checkMap[item.id] = false;
}); });
} }
} }

View File

@ -11,7 +11,7 @@ export const addAnnex = (data: any) => {
}; };
// 获取图片资源 // 获取图片资源
export const getAnnex = (data: {businessId: number, orderType: number, imagesType: ImagesType | any}) => { export const getAnnex = (data: {businessId: string, orderType: number, imagesType: ImagesType | any}) => {
return http<Resource>({ return http<Resource>({
method: "GET", method: "GET",
url: "/api/annex/getAnnex", url: "/api/annex/getAnnex",

14
src/types/order.d.ts vendored
View File

@ -16,7 +16,7 @@ interface Order {
tare?: string; //皮重 tare?: string; //皮重
grossTime?: string; //过毛日期 grossTime?: string; //过毛日期
tareTime?: string; //过皮日期 tareTime?: string; //过皮日期
netWeight?: string; //净重 netWeight?: number; //净重
buttonType?: number; //扣杂状态0扣杂1扣点 buttonType?: number; //扣杂状态0扣杂1扣点
points?: number; //扣点 points?: number; //扣点
buckleMiscellaneous?: number; //扣杂 buckleMiscellaneous?: number; //扣杂
@ -70,7 +70,7 @@ type PageParams = {
}; };
interface Shipment { interface Shipment {
id?: string; id: string;
userId?: number; //供应商id userId?: number; //供应商id
productId?: number; //产品id productId?: number; //产品id
cardId?: number; //库存卡id cardId?: number; //库存卡id
@ -83,7 +83,7 @@ interface Shipment {
grossTime?: string; //过毛时间 grossTime?: string; //过毛时间
tare?: number; //皮重 tare?: number; //皮重
tareTime?: string; //过皮时间 tareTime?: string; //过皮时间
netWeight?: string; //净重 netWeight?: number; //净重
number?: number; //数量 number?: number; //数量
notes?: string; //备注 notes?: string; //备注
settlementNotes?: string; //结算备注 settlementNotes?: string; //结算备注
@ -95,7 +95,7 @@ interface Shipment {
incidentals?: string; //杂费 incidentals?: string; //杂费
pricingPerson?: string; //定价人 pricingPerson?: string; //定价人
reviewerId?: string; //审核人 reviewerId?: string; //审核人
buttonType?: string; //扣点状态默认0扣杂1扣点 buttonType: number; //扣点状态默认0扣杂1扣点
points?: string; //扣点 points?: string; //扣点
buckleMiscellaneous?: string; //扣杂 buckleMiscellaneous?: string; //扣杂
unitPrice?: string; //结算单价 unitPrice?: string; //结算单价
@ -109,6 +109,12 @@ interface Shipment {
updateUserId?: string; //undefined updateUserId?: string; //undefined
updateTime?: string; //undefined updateTime?: string; //undefined
isDeleted?: string; //删除标识true删除false未删除 isDeleted?: string; //删除标识true删除false未删除
settlementWeight?: number, // 结算重量
settlementGross?: number, // 结算毛重
settlementTare?: number, // 结算皮重
settlementNet?: number, // 结算净重
signTime?: string, // 签收时间
paymentMethod?: string; //支付方式0:未支付,1:现金支付2银行卡支付3线上支付微信4支付宝
[attrName: string]: any; [attrName: string]: any;
} }

View File

@ -20,11 +20,12 @@ export enum MultiCategory {
Multiple = 1, Multiple = 1,
} }
// 0:普通资源1皮重 2毛重 // 0:普通资源1皮重 2毛重 3 结算单据
export enum ImagesType { export enum ImagesType {
NORMARL = 0, NORMARL = 0,
Tare = 1, Tare = 1,
GROSSWEIGHT = 2, GROSSWEIGHT = 2,
Settlement = 3
} }
//磅单状态:0待定价1待过皮2待审核3已审核待支付4已支付 //磅单状态:0待定价1待过皮2待审核3已审核待支付4已支付
// 磅单状态0待出货1:待过毛2待审核3已审未付4已审已付 // 磅单状态0待出货1:待过毛2待审核3已审未付4已审已付
@ -40,6 +41,12 @@ export enum ScaleStatus {
ToBeShipmentPay = 3, ToBeShipmentPay = 3,
ShipmentPaid = 4 ShipmentPaid = 4
} }
// 1 出货结算 2 出货未结算 3 出货并结算
export enum ScaleStatusBtnType {
ShipmentSettlement = 1,
ShipmentNoPay = 2,
ShipmentPay = 3
}
// 支付方式0:未支付,1:现金支付2银行卡支付3线上支付微信4支付宝 // 支付方式0:未支付,1:现金支付2银行卡支付3线上支付微信4支付宝
export enum PaymentMethod { export enum PaymentMethod {
NoPay = 0, NoPay = 0,

34
src/utils/index.ts Normal file
View File

@ -0,0 +1,34 @@
export function formatDate(time: any, cFormat: string) {
const format = cFormat || "{y}-{m}-{d}";
const date = new Date(time);
const formatObj:any = {
//年
y: date.getFullYear(),
//月
m: date.getMonth() + 1,
//日
d: date.getDate(),
//小时
h: date.getHours(),
//分钟
i: date.getMinutes(),
//秒
s: date.getSeconds(),
//星期
a: date.getDay(),
};
const time_str = format.replace(/{([ymdhisa])+}/g, (result, key) => {
const value = formatObj[key];
// Note: getDay() returns 0 on Sunday
if (key === "a") {
//如果key是a就是星期格式化成一~日
//例如formatDate(new Date(), '{y}-{m}-{d}-{h}-{i}-{s}-{a}');
//会输出2021-10-29-00-00-00-五
//星期的value会返回0-6['日', '一', '二', '三', '四', '五', '六'][2]代表周二
return ["日", "一", "二", "三", "四", "五", "六"][value];
}
//padStart用于字符串头部补全2个字符如果不够前面补0
return value.toString().padStart(2, "0");
});
return time_str;
}