update: 出货对接

This commit is contained in:
admin 2024-03-25 14:19:03 +08:00
parent d9d0024c73
commit 27bb35590b
9 changed files with 484 additions and 201 deletions

View File

@ -54,7 +54,7 @@
</view> </view>
<!-- 出货入库 --> <!-- 出货入库 -->
<text class="title title-shipment">出货入库</text> <text class="title title-shipment">出货销售</text>
<view class="data-shipment"> <view class="data-shipment">
<up-row justify="center" gutter="10"> <up-row justify="center" gutter="10">
<up-col span="3" v-for="(item, index) in shipmentList" :key="index" @click="(item as any).fn()"> <up-col span="3" v-for="(item, index) in shipmentList" :key="index" @click="(item as any).fn()">
@ -250,7 +250,7 @@ const shipmentList = reactive([
num: 0, num: 0,
fn: () => { fn: () => {
uni.navigateTo({ uni.navigateTo({
url: "/pagesShipment/shipmenting", // url: "/pagesShipment/shipmenting?scaleStatus=0", //
}); });
}, },
}, },
@ -259,7 +259,7 @@ const shipmentList = reactive([
num: 0, num: 0,
fn: () => { fn: () => {
uni.navigateTo({ uni.navigateTo({
url: "/pagesShipment/grossWeight", // url: "/pagesShipment/shipmenting?scaleStatus=1", //
}); });
}, },
}, },

View File

@ -46,8 +46,8 @@
@delete="deletePic" --> @delete="deletePic" -->
<uni-file-picker <uni-file-picker
v-if="item.type === 'upload'" v-if="item.type === 'upload'"
:limit="10" :limit="9"
title="最多可上传10张图片" title="最多可上传9张图片"
:auto-upload="false" :auto-upload="false"
fileMediatype="image" fileMediatype="image"
ref="filesRef" ref="filesRef"
@ -94,7 +94,6 @@
<script setup lang="ts"> <script setup lang="ts">
import type { ComType } from "@/types/global"; import type { ComType } from "@/types/global";
import { import {
ProfileApi,
ReceiveProductApi, ReceiveProductApi,
ReceiveApi, ReceiveApi,
PictureApi, PictureApi,
@ -123,7 +122,7 @@ const rules = reactive({
"order.userName": { "order.userName": {
type: "string", type: "string",
required: true, required: true,
message: "请输入选择供应商", message: "请选择供应商",
trigger: ["blur", "change"], trigger: ["blur", "change"],
}, },
"order.productName": { "order.productName": {

View File

@ -13,6 +13,7 @@
:clearabled="true" :clearabled="true"
:showAction="false" :showAction="false"
placeholderColor="#C1C1C1" placeholderColor="#C1C1C1"
@search="handleSearch()"
></u-search> ></u-search>
</view> </view>
@ -136,7 +137,7 @@ const pageList: PageResult<Order> = reactive({
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
}); });
const keyword = ref(); const keyword = ref('');
const isShowSearch = ref(false); const isShowSearch = ref(false);
const state = reactive<{ const state = reactive<{
[attrName: string]: any; [attrName: string]: any;
@ -171,6 +172,11 @@ const handleTab = (item: any) => {
resetPageList(); resetPageList();
getList(); getList();
}; };
const handleSearch = () => {
resetPageList();
getList();
}
const handleReview = (id: number, scaleStatus: number, title: string) => { const handleReview = (id: number, scaleStatus: number, title: string) => {
uni.navigateTo({ uni.navigateTo({
url: url:
@ -210,6 +216,7 @@ const handleSelect = () => {
return { ...item, isChecked: state.isAll }; return { ...item, isChecked: state.isAll };
}); });
}; };
const getList = (v?: boolean) => { const getList = (v?: boolean) => {
if (v) { if (v) {
if (Math.ceil(pageList.total / pageList.pageSize) > pageList.pageNum) { if (Math.ceil(pageList.total / pageList.pageSize) > pageList.pageNum) {
@ -219,16 +226,19 @@ const getList = (v?: boolean) => {
return; return;
} }
} }
pageList.isLoading = true;
ReceiveApi.getOrderPage({ ReceiveApi.getOrderPage({
pageSize: pageList.pageSize, pageSize: pageList.pageSize,
pageNumber: pageList.pageNum, pageNumber: pageList.pageNum,
scaleStatus: currentTab.value, scaleStatus: currentTab.value,
userName: keyword.value
}).then((res) => { }).then((res) => {
if (res.code === 200) { if (res.code === 200) {
(pageList as any).list = (res.data.list as any).map((item: any) => { (pageList as any).list = (res.data.list as any).map((item: any) => {
return { ...item, isChecked: false }; return { ...item, isChecked: false };
}); });
pageList.total = (res.data as any).total; pageList.total = (res.data as any).total;
pageList.isLoading = false;
} }
}); });
}; };

View File

@ -7,14 +7,16 @@
ref="form" ref="form"
:labelWidth="80" :labelWidth="80"
:labelStyle="{ padding: '0rpx 10rpx' }" :labelStyle="{ padding: '0rpx 10rpx' }"
:errorType="'border-bottom'"
> >
<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" v-for="(item, index) in formAttrList"
:key="index" :key="index"
@click="item.fn" @click="item.fn"
:borderBottom="false"
> >
<u-textarea <u-textarea
v-if="item.type === 'textarea'" v-if="item.type === 'textarea'"
@ -44,15 +46,17 @@
multiple multiple
:maxCount="10" :maxCount="10"
></u-upload> --> ></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.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
@ -69,80 +73,111 @@
</template> </template>
</u-form-item> </u-form-item>
</u-form> </u-form>
<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'"
: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"
:safeAreaInsetBottom="true"
></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>
</view> </view>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { PictureApi, ShipmentApi } from "@/services"; import { CustomerApi, GoodsApi, PictureApi, ShipmentApi } from "@/services";
import type { ComType } from "@/types/global";
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";
import _ from "underscore";
const model1 = reactive<any>({ const model1 = reactive<any>({
order: { order: {
id: 0, id: 0,
splTime: "", splTime: "",
takeType: 1, takeType: 1,
fileList: [], fileLists: [],
}, },
}); });
const rules = ref({ const rules = reactive({
"userInfo.userName": { "order.userName": {
type: "string", type: "string",
required: true, required: true,
message: "请输入手机号", message: "请选择客户",
trigger: ["blur", "change"], trigger: ["blur", "change"],
}, },
"userInfo.password": { "order.productName": {
type: "string", type: "string",
required: true, required: true,
message: "请输入密码", message: "请选择出货产品名称",
trigger: ["blur", "change"],
},
"order.tare": {
type: "number",
required: true,
message: "请输入皮重",
trigger: ["blur", "change"],
},
"order.number": {
type: "number",
required: true,
message: "请输入数量",
trigger: ["blur", "change"],
},
"order.weighingMethod": {
type: "number",
required: true,
message: "请选择称重方式",
trigger: ["blur", "change"],
},
"order.deliveryMethod": {
type: "number",
required: true,
message: "请选择提货方式",
trigger: ["blur", "change"], trigger: ["blur", "change"],
}, },
}); });
const contrlModalParams = reactive({ const contrlModalParams = reactive<ComType>({
select: { userSelect: {
isShow: false, isShow: false,
title: "标题", title: "标题",
selectList: [ list: [],
{ },
name: "选项一", productSelect: {
}, isShow: false,
{ title: "标题",
name: "选项二", list: [],
},
],
}, },
}); });
const formAttrList = reactive([ const formAttrList = reactive<ComType>([
{ {
name: "客户", name: "客户",
key: "userId", key: "userName",
type: "select", type: "select",
required: true, required: true,
childKey: "userSelect",
unit: "", unit: "",
fn: () => { fn: () => {
contrlModalParams.select.isShow = true; contrlModalParams.userSelect.isShow = true;
contrlModalParams.select.title = "客户"; contrlModalParams.userSelect.title = "客户";
}, },
}, },
{ {
name: "出货产品", name: "出货产品",
key: "productId", key: "productName",
type: "select", type: "select",
required: true, required: true,
childKey: "productSelect",
unit: "", unit: "",
fn: () => { fn: () => {
contrlModalParams.select.isShow = true; contrlModalParams.productSelect.isShow = true;
contrlModalParams.select.title = "出货产品"; contrlModalParams.productSelect.title = "出货产品";
}, },
}, },
{ {
@ -153,8 +188,8 @@ const formAttrList = reactive([
unit: "件", unit: "件",
}, },
{ {
name: "重", name: "重",
key: "grossWeight", key: "tare",
type: "input", type: "input",
required: true, required: true,
unit: "KG", unit: "KG",
@ -208,91 +243,194 @@ const formAttrList = reactive([
type: "upload", type: "upload",
}, },
]); ]);
const filesShipmentRef = ref();
CustomerApi.getCustomUserList({}).then((res) => {
if (res.code === 200) {
contrlModalParams.userSelect.list = res.data;
}
});
GoodsApi.getShipmentProductList().then((res) => {
if (res.code === 200) {
contrlModalParams.productSelect.list = _.map(
res.data as any,
function (item: any) {
return { name: item.shmProductsName, ...item };
}
);
}
});
const handleSelect = (key: string, v: any) => {
contrlModalParams[key].isShow = false;
if (key === "userSelect") {
model1.order.userName = v.name;
model1.order.userId = v.id;
} else if (key === "productSelect") {
model1.order.productName = v.name;
model1.order.productId = v.id;
}
};
const filesRef = ref();
const handleUpload = () => { const handleUpload = () => {
debugger;
// 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.NORMARL, // businessId: model1.order.id,
orderType: OrderType.Shipment, // imagesType: ImagesType.NORMARL, //
}); 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: "已删除" });
}
});
}
};
/** /**
* 点击保存 先执行upload接口 * 点击保存 先执行upload接口
* 上传成功后 保存图片资源 和更新订单数据 * 上传成功后 保存图片资源 和更新订单数据
*/ */
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 = () => { 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();
};
let scaleStatus = 0; const updateOrder = () => {
if (ScaleStatus.ToBeShipment === model1.order.scaleStatus) { //
scaleStatus = ScaleStatus.ToBeGrossWeight; let status = 0;
} else if (ScaleStatus.ToBeGrossWeight === model1.order.scaleStatus) { if (state.scaleStatus === ScaleStatus.ToBeShipment) {
scaleStatus = ScaleStatus.ToBeShipmentReview; status = ScaleStatus.ToBeGrossWeight;
} else if (state.scaleStatus === ScaleStatus.ToBeGrossWeight) {
status = ScaleStatus.ToBeShipmentReview;
} else {
status = model1.order.status;
} }
// //
ShipmentApi.updateOrderIn({ ShipmentApi.updateOrderIn({
orderOutPos: [{ ...model1.order, scaleStatus: scaleStatus }], orderOutPos: [{ ...model1.order, scaleStatus: status }],
}).then((res) => { }).then((res) => {
if (res.code === 200) { if (res.code === 200) {
uni.showToast({ uni.showToast({
title: "编辑成功", title: "编辑成功",
icon: "success", icon: "success",
}); });
debugger if (state.scaleStatus === ScaleStatus.ToBeShipment) {
if (scaleStatus === ScaleStatus.ToBeGrossWeight) { uni.redirectTo({
uni.navigateTo({ url: "/pagesShipment/shipmenting?scaleStatus=" + status, //
url: "/pagesShipment/grossWeight", //
}); });
} else if (scaleStatus === ScaleStatus.ToBeShipmentReview) { } else if (state.scaleStatus === ScaleStatus.ToBeGrossWeight) {
uni.navigateTo({ uni.redirectTo({
url: "/pagesShipment/shipmentSettlement?scaleStatus=2", // url: "/pagesShipment/shipmentSettlement?scaleStatus=" + status, //
});
} else {
uni.redirectTo({
url:
"/pagesShipment/review/index?id=" +
model1.order.id +
`&scaleStatusBtnType=1`, //
}); });
} }
} }
}); });
}; };
const state = reactive({
scaleStatus: 0,
});
onLoad((option) => { onLoad((option) => {
model1.order.id = (option as any).id; model1.order.id = (option as any).id;
state.scaleStatus = parseInt((option as any).scaleStatus);
if (state.scaleStatus === ScaleStatus.ToBeShipment) {
uni.setNavigationBarTitle({
title: "待出货编辑",
});
} else if (state.scaleStatus === ScaleStatus.ToBeGrossWeight) {
uni.setNavigationBarTitle({
title: "待过毛重编辑",
});
} else {
uni.setNavigationBarTitle({
title: "审核结算编辑",
});
}
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,
deliveryMethod:
res.data.deliveryMethod !== null ? res.data.deliveryMethod : 0,
fileLists: model1.order.fileLists.map((item: any) => {
return { ...item, fileID: item.id };
}),
};
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.NORMARL,
}).then((res) => { }).then((res) => {
if (res.code === 200) { if (res.code === 200) {
model1.order.fileLists = res.data;
} }
}); });
} }

View File

@ -15,7 +15,7 @@
plain plain
shape="circle" shape="circle"
:bgColor="'rgba(237, 254, 255, 1)'" :bgColor="'rgba(237, 254, 255, 1)'"
@click="handleScenePhoto(state.order.imagesId as number)" @click="handleScenePhoto(state.order.id)"
></u-tag ></u-tag
></view> ></view>
<view <view
@ -200,6 +200,7 @@
import { ShipmentApi } from "@/services/index"; 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";
const keyword = ref(""); const keyword = ref("");
const contrlModalParams = reactive<{ [attrName: string]: any }>({ const contrlModalParams = reactive<{ [attrName: string]: any }>({
paySelect: { paySelect: {
@ -451,9 +452,9 @@ const handleSettlement = () => {
`&scaleStatusBtnType=${ScaleStatusBtnType.ShipmentPay}`, // `&scaleStatusBtnType=${ScaleStatusBtnType.ShipmentPay}`, //
}); });
}; };
const handleScenePhoto = (imagesId: number) => { const handleScenePhoto = (id: string) => {
uni.navigateTo({ uni.navigateTo({
url: "/pagesScenePhoto/index?orderType=1&id=" + imagesId, // url: "/pagesScenePhoto/index?orderType=1&imagesType=1&id=" + id, //
}); });
}; };
// // 3 // // 3

View File

@ -1,8 +1,7 @@
<template> <template>
<view class="search"> <view class="search">
<view v-if="!isShowSearch" @click="isShowSearch = true"> <view v-if="!isShowSearch" @click="isShowSearch = true">
<u-icon color="#C1C1C1" name="search"></u-icon <u-icon color="#C1C1C1" name="search"></u-icon><text></text>
><text>请输入客户名称</text>
</view> </view>
<u-search <u-search
v-else v-else
@ -13,6 +12,7 @@
:clearabled="true" :clearabled="true"
:showAction="false" :showAction="false"
placeholderColor="#C1C1C1" placeholderColor="#C1C1C1"
@search="handleSearch()"
></u-search> ></u-search>
</view> </view>
@ -28,83 +28,111 @@
</text> </text>
</view> </view>
<block v-for="(item, index) in pageList.list" :key="index"> <page-view
<view class="c-layout"> @loadList="
<view (v) => {
><checkbox getList(v);
:color="'#00D2E3'" }
:checked="state.checkMap[item.id + '']" "
style="transform: scale(0.5)" :noMoreData="pageList.noMoreData"
@click="state.checkMap[item.id + ''] = !state.checkMap[item.id + '']" :list="pageList.list"
/></view> :height="ScaleStatus.ShipmentPaid === currentTab ? 160 : 240"
<view class="inner-box"> :isLoading="pageList.isLoading"
<view class="top-flex-box"> >
<view> <block v-for="(item, index) in pageList.list" :key="index">
<view class="c-layout">
<view style="min-width: 20px;"
><checkbox
v-if="
ScaleStatus.ToBeShipmentReview === currentTab ||
ScaleStatus.ToBeShipmentPay === currentTab
"
:color="'#00D2E3'"
:checked="item.isChecked"
style="transform: scale(0.5)"
@click="item.isChecked = !item.isChecked"
/></view>
<view class="inner-box">
<view class="top-flex-box">
<view> <view>
<text class="number">出货单号{{ item.orderNumber }}</text> <view>
</view> <text class="number">出货单号{{ item.orderNumber }}</text>
<view> </view>
<text class="name">{{ item.userName }}</text> <view>
<text class="name">{{ item.userName }}</text>
</view>
</view> </view>
</view> </view>
</view> <view class="bottom-flex-box">
<view class="bottom-flex-box">
<view>
<view> <view>
<text class="desc" <view>
>过磅总净重{{ item.netWeight || 0 }}KG</text <text class="desc"
> >过磅总净重{{ item.netWeight || 0 }}KG</text
>
</view>
</view>
<view>
<text class="btn">
<text
v-if="currentTab === 2"
@click="handleReview(item.id, 2)"
>出货结算</text
>
<text
v-if="currentTab === 3"
@click="handleReview(item.id, 3)"
>去结算</text
>
<text
v-if="currentTab === 4"
@click="handleReview(item.id, 4)"
>查看</text
>
</text>
</view> </view>
</view>
<view>
<text class="btn">
<text
v-if="currentTab === 2"
@click="handleReview(item.id, 2)"
>出货结算</text
>
<text v-if="currentTab === 3" @click="handleReview(item.id, 3)">去结算</text>
<text v-if="currentTab === 4" @click="handleReview(item.id, 4)">查看</text>
</text>
</view> </view>
</view> </view>
</view> </view>
</view> <u-gap
<u-gap height="10"
height="10" bgColor="#f8f8f8"
bgColor="#f8f8f8" v-if="index < pageList.list.length - 1"
v-if="index < pageList.list.length - 1" ></u-gap>
></u-gap> </block>
</block> </page-view>
</view> </view>
<view class="btn-box" v-if="(currentTab === 2 || currentTab === 3) && pageList.list.length > 0"> <view
class="btn-box"
v-if="(currentTab === 2 || currentTab === 3) && pageList.list.length > 0"
>
<u-button <u-button
text="全选/取消" text="全选/取消"
color="#fff" color="#fff"
:customStyle="{ color: '#00DCEE', border: '1px solid #00DCEE' }" :customStyle="{ color: '#00DCEE', border: '1px solid #00DCEE' }"
@click="handleSelect" @click="handleSelect"
></u-button> ></u-button>
<u-button type="primary" :text="`${currentTab === 2 ? '批量审核' : '批量支付'}`"></u-button> <u-button
type="primary"
:text="`${currentTab === 2 ? '批量审核' : '批量支付'}`"
@click="handleReviewOrPay(currentTab)"
></u-button>
</view> </view>
</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 { ScaleStatus, ScaleStatusBtnType } from "@/utils/enum";
import { onLoad } from "@dcloudio/uni-app"; import { onLoad } from "@dcloudio/uni-app";
import PageView from "@/components/PageView/index.vue";
// scaleStatus // scaleStatus
interface PageResult<T> {
total: number;
list: T[];
pageNum: number;
pageSize: number;
}
const pageList: PageResult<Shipment> = reactive({ const pageList: PageResult<Shipment> = reactive({
isLoading: false,
noMoreData: false,
total: 0, total: 0,
list: [], list: [],
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
}); });
const keyword = ref(); const keyword = ref("");
const isShowSearch = ref(false); const isShowSearch = ref(false);
const state = reactive<{ const state = reactive<{
[attrName: string]: any; [attrName: string]: any;
@ -129,46 +157,96 @@ const tabList = reactive([
const currentTab = ref(2); const currentTab = ref(2);
const handleTab = (item: any) => { const handleTab = (item: any) => {
currentTab.value = item.key; currentTab.value = item.key;
getOrderList(); getList();
}; };
const handleReview = (id: string, scaleStatus: number) => { const handleReview = (id: string, scaleStatus: number) => {
let type = ScaleStatusBtnType.ShipmentSettlement let type = ScaleStatusBtnType.ShipmentSettlement;
if (scaleStatus === 2) { if (scaleStatus === 2) {
type = ScaleStatusBtnType.ShipmentSettlement type = ScaleStatusBtnType.ShipmentSettlement;
} else if (scaleStatus === 3) { } else if (scaleStatus === 3) {
type = ScaleStatusBtnType.ShipmentNoPay type = ScaleStatusBtnType.ShipmentNoPay;
} else if (scaleStatus === 4) { } else if (scaleStatus === 4) {
type = ScaleStatusBtnType.ShipmentPay type = ScaleStatusBtnType.ShipmentPay;
} }
console.log('**************', type)
uni.navigateTo({ uni.navigateTo({
url: "/pagesShipment/review/index?id=" + id + `&scaleStatusBtnType=${type}`, // url: "/pagesShipment/review/index?id=" + id + `&scaleStatusBtnType=${type}`, //
}); });
}; };
const handleReviewOrPay = (status: number) => {
//
if (ScaleStatus.ToBeShipmentReview === status) {
updateStatus(ScaleStatus.ToBeShipmentPay);
} else if (ScaleStatus.ToBeShipmentPay === status) {
//
updateStatus(ScaleStatus.ShipmentPaid);
}
};
const updateStatus = (status: number) => {
const list = pageList.list
.filter((item) => item.isChecked)
.map((item) => {
return { ...item, scaleStatus: status };
});
ShipmentApi.updateOrderIn({ orderOutPos: list }).then((res) => {
if (res.code === 200) {
resetPageList();
getList();
}
});
};
const handleSelect = () => { const handleSelect = () => {
state.isAll = !state.isAll; state.isAll = !state.isAll;
Object.keys(state.checkMap).forEach((item) => { console.log(state.isAll);
state.checkMap[item] = state.isAll; pageList.list = pageList.list.map((item) => {
return { ...item, isChecked: state.isAll };
}); });
console.log(state.checkMap)
}; };
const getOrderList = () => { const resetPageList = () => {
ShipmentApi.getOrderPage({ pageNumber: 1, pageSize: 10, scaleStatus: currentTab.value }).then( pageList.noMoreData = false;
(res) => { pageList.total = 0;
if (res.code === 200) { pageList.list = [];
(pageList as any).list = res.data.list; pageList.pageNum = 1;
(res.data.list as any).forEach((item: any) => { pageList.pageSize = 10;
state.checkMap[item.id] = false; };
}); const handleSearch = () => {
} resetPageList();
getList();
};
const getList = (v?: boolean) => {
if (v) {
if (Math.ceil(pageList.total / pageList.pageSize) > pageList.pageNum) {
pageList.pageNum++;
} else {
pageList.noMoreData = true;
return;
} }
); }
pageList.isLoading = true;
ShipmentApi.getOrderPage({
pageSize: pageList.pageSize,
pageNumber: pageList.pageNum,
scaleStatus: currentTab.value,
userName: keyword.value,
}).then((res) => {
if (res.code === 200) {
(pageList as any).list = (res.data.list as any).map((item: any) => {
return { ...item, isChecked: false };
});
pageList.total = (res.data as any).total;
pageList.isLoading = false;
}
});
}; };
onMounted(() => { onMounted(() => {
getOrderList(); getList();
}); });
onLoad((option) => { onLoad((option) => {
currentTab.value = parseInt((option as any).scaleStatus); currentTab.value = parseInt((option as any).scaleStatus);
}) console.log(option);
});
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.search { .search {

View File

@ -1,43 +1,61 @@
<template> <template>
<view class="card-box" v-for="(item, index) in pageList.list" :key="index"> <page-view
<view class="top-flex-box"> :noMoreData="pageList.noMoreData"
<view> :list="pageList.list"
:height="0"
:isLoading="pageList.isLoading"
@loadList="
(v) => {
getList(v);
}
"
>
<view class="card-box" v-for="(item, index) in pageList.list" :key="index">
<view class="top-flex-box">
<view> <view>
<text class="address">{{ item.deviceName || "-" }}</text> <view>
<text class="address">{{ item.deviceName || "-" }}</text>
</view>
<view>
<text class="number">出货单号{{ item.orderNumber }}</text>
</view>
<view>
<text class="name">{{ item.cardNumber }}</text>
</view>
</view> </view>
<view> <view>
<text class="number">出货单号{{ item.orderNumber }}</text> <u-button
</view> :customStyle="{ border: '1px solid #00dcee', color: '#00dcee' }"
<view> @click="handleScenePhoto(item.id)"
<text class="name">{{ item.cardId }}</text> text="现场照片"
plain
shape="circle"
type="success"
size="small"
></u-button>
</view> </view>
</view> </view>
<view> <view>
<text class="btn" @click="handleScenePhoto((item.imagesId as number))" <text class="desc">过磅时间{{ item.tareTime }}</text>
>现场照片</text </view>
> <view class="flex-box">
<text>皮重{{ item.tare }}kg</text>
</view>
<view class="btn-box">
<u-button
text="点击作废"
color="#E8E8E8"
:customStyle="{ color: '#999' }"
@click="handleModal(true, item.id as any)"
></u-button>
<u-button
type="primary"
text="点击编辑"
@click="pricingDetail(item.id as any)"
></u-button>
</view> </view>
</view> </view>
<view> </page-view>
<text class="desc">过磅时间{{ item.tareTime }}</text>
</view>
<view class="flex-box">
<text>皮重{{ item.tare }}kg</text>
</view>
<view class="btn-box">
<u-button
text="点击作废"
color="#E8E8E8"
:customStyle="{ color: '#999' }"
@click="handleModal(true, (item.id as any))"
></u-button>
<u-button
type="primary"
text="点击编辑"
@click="pricingDetail((item.id as any))"
></u-button>
</view>
</view>
<SmallModal <SmallModal
:title="'确认作废吗?'" :title="'确认作废吗?'"
@ -52,14 +70,13 @@
<script setup lang="ts"> <script setup lang="ts">
import { ShipmentApi } from "@/services/index"; import { ShipmentApi } from "@/services/index";
import SmallModal from "@/components/Modal/smallModal.vue"; import SmallModal from "@/components/Modal/smallModal.vue";
import PageView from "@/components/PageView/index.vue";
import { onLoad } from "@dcloudio/uni-app";
import { ScaleStatus } from "@/utils/enum";
interface PageResult<T> {
total: number;
list: T[];
pageNum: number;
pageSize: number;
}
const pageList: PageResult<Shipment> = reactive({ const pageList: PageResult<Shipment> = reactive({
isLoading: false,
noMoreData: false,
total: 0, total: 0,
list: [], list: [],
pageNum: 1, pageNum: 1,
@ -71,34 +88,72 @@ const handleModal = (v: boolean, id: number) => {
isShowCancelModal.value = v; isShowCancelModal.value = v;
deleteId.value = id; deleteId.value = id;
}; };
const handleScenePhoto = (imagesId: number) => { const handleScenePhoto = (id: any) => {
uni.navigateTo({ uni.redirectTo({
url: "/pagesScenePhoto/index?orderType=2&id=" + imagesId, // url: `/pagesScenePhoto/index?orderType=1&id=${id}&imagesType=1`, //
}); });
}; };
const pricingDetail = (id: string) => { const pricingDetail = (id: string) => {
console.log(state.scaleStatus)
uni.navigateTo({ uni.navigateTo({
url: "/pagesShipment/form/shipmentForm?id=" + id, // url: "/pagesShipment/form/shipmentForm?id=" + id + `&scaleStatus=${state.scaleStatus}`, //
}); });
}; };
const getOrderList = () => { const getList = (v?: boolean) => {
ShipmentApi.getOrderPage({ pageNumber: 1, pageSize: 10, scaleStatus: 0 }).then((res) => { if (v) {
if (Math.ceil(pageList.total / pageList.pageSize) > pageList.pageNum) {
pageList.pageNum++;
} else {
pageList.noMoreData = true;
return;
}
}
pageList.isLoading = true;
ShipmentApi.getOrderPage({
pageSize: pageList.pageSize,
pageNumber: pageList.pageNum,
scaleStatus: state.scaleStatus,
}).then((res) => {
if (res.code === 200) { if (res.code === 200) {
(pageList as any).list = res.data.list; if (res.code === 200) {
pageList.isLoading = false;
(pageList as any).list = (pageList as any).list = (
pageList as any
).list.concat(res.data.list);
pageList.total = (res.data as any).total;
}
} }
}); });
}; };
const handleOk = () => { const handleOk = () => {
console.log(deleteId.value); console.log(deleteId.value);
ShipmentApi.deleteOrder({ids:[deleteId.value]}).then((res) => { ShipmentApi.deleteOrder({ ids: [deleteId.value] }).then((res) => {
if (res.code === 200) { if (res.code === 200) {
getOrderList(); getList();
} }
}); });
}; };
onMounted(() => { onMounted(() => {
getOrderList(); getList();
});
const state = reactive({
scaleStatus: 0
})
onLoad((option) => {
//
state.scaleStatus = parseInt((option as any).scaleStatus);
//
if (state.scaleStatus === ScaleStatus.ToBeShipment) {
uni.setNavigationBarTitle({
title: '待出货',
});
} else if (state.scaleStatus === ScaleStatus.ToBeGrossWeight) {
uni.setNavigationBarTitle({
title: '待过毛重',
});
}
}); });
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>

View File

@ -36,6 +36,7 @@ type PageParams = {
startTime?: string; // 开始时间 startTime?: string; // 开始时间
endTime?: string; // 结束时间 endTime?: string; // 结束时间
isDeleted?: boolean; isDeleted?: boolean;
userName?: string;
}; };
// 根据条件获取出库单,并且进行分页 // 根据条件获取出库单,并且进行分页

View File

@ -99,6 +99,7 @@ type PageParams = {
repairFlag?: boolean; // 是否为补单,true 是未补单false是补单 repairFlag?: boolean; // 是否为补单,true 是未补单false是补单
scaleStatus?: number; // 磅单状态:0待定价1待过皮2待审核3已审核待支付4已支付 scaleStatus?: number; // 磅单状态:0待定价1待过皮2待审核3已审核待支付4已支付
isDeleted?: boolean; isDeleted?: boolean;
userName?: string; // 供应商名称
}; };
interface Shipment { interface Shipment {