update: 出货对接
This commit is contained in:
parent
d9d0024c73
commit
27bb35590b
|
@ -54,7 +54,7 @@
|
|||
</view>
|
||||
|
||||
<!-- 出货入库 -->
|
||||
<text class="title title-shipment">出货入库</text>
|
||||
<text class="title title-shipment">出货销售</text>
|
||||
<view class="data-shipment">
|
||||
<up-row justify="center" gutter="10">
|
||||
<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,
|
||||
fn: () => {
|
||||
uni.navigateTo({
|
||||
url: "/pagesShipment/shipmenting", // 要跳转到的页面路径
|
||||
url: "/pagesShipment/shipmenting?scaleStatus=0", // 要跳转到的页面路径
|
||||
});
|
||||
},
|
||||
},
|
||||
|
@ -259,7 +259,7 @@ const shipmentList = reactive([
|
|||
num: 0,
|
||||
fn: () => {
|
||||
uni.navigateTo({
|
||||
url: "/pagesShipment/grossWeight", // 要跳转到的页面路径
|
||||
url: "/pagesShipment/shipmenting?scaleStatus=1", // 要跳转到的页面路径
|
||||
});
|
||||
},
|
||||
},
|
||||
|
|
|
@ -46,8 +46,8 @@
|
|||
@delete="deletePic" -->
|
||||
<uni-file-picker
|
||||
v-if="item.type === 'upload'"
|
||||
:limit="10"
|
||||
title="最多可上传10张图片"
|
||||
:limit="9"
|
||||
title="最多可上传9张图片"
|
||||
:auto-upload="false"
|
||||
fileMediatype="image"
|
||||
ref="filesRef"
|
||||
|
@ -94,7 +94,6 @@
|
|||
<script setup lang="ts">
|
||||
import type { ComType } from "@/types/global";
|
||||
import {
|
||||
ProfileApi,
|
||||
ReceiveProductApi,
|
||||
ReceiveApi,
|
||||
PictureApi,
|
||||
|
@ -123,7 +122,7 @@ const rules = reactive({
|
|||
"order.userName": {
|
||||
type: "string",
|
||||
required: true,
|
||||
message: "请输入选择供应商",
|
||||
message: "请选择供应商",
|
||||
trigger: ["blur", "change"],
|
||||
},
|
||||
"order.productName": {
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
:clearabled="true"
|
||||
:showAction="false"
|
||||
placeholderColor="#C1C1C1"
|
||||
@search="handleSearch()"
|
||||
></u-search>
|
||||
</view>
|
||||
|
||||
|
@ -136,7 +137,7 @@ const pageList: PageResult<Order> = reactive({
|
|||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
});
|
||||
const keyword = ref();
|
||||
const keyword = ref('');
|
||||
const isShowSearch = ref(false);
|
||||
const state = reactive<{
|
||||
[attrName: string]: any;
|
||||
|
@ -171,6 +172,11 @@ const handleTab = (item: any) => {
|
|||
resetPageList();
|
||||
getList();
|
||||
};
|
||||
|
||||
const handleSearch = () => {
|
||||
resetPageList();
|
||||
getList();
|
||||
}
|
||||
const handleReview = (id: number, scaleStatus: number, title: string) => {
|
||||
uni.navigateTo({
|
||||
url:
|
||||
|
@ -210,6 +216,7 @@ const handleSelect = () => {
|
|||
return { ...item, isChecked: state.isAll };
|
||||
});
|
||||
};
|
||||
|
||||
const getList = (v?: boolean) => {
|
||||
if (v) {
|
||||
if (Math.ceil(pageList.total / pageList.pageSize) > pageList.pageNum) {
|
||||
|
@ -219,16 +226,19 @@ const getList = (v?: boolean) => {
|
|||
return;
|
||||
}
|
||||
}
|
||||
pageList.isLoading = true;
|
||||
ReceiveApi.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;
|
||||
}
|
||||
});
|
||||
};
|
||||
|
|
|
@ -7,14 +7,16 @@
|
|||
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"
|
||||
:key="index"
|
||||
@click="item.fn"
|
||||
:borderBottom="false"
|
||||
>
|
||||
<u-textarea
|
||||
v-if="item.type === 'textarea'"
|
||||
|
@ -44,15 +46,17 @@
|
|||
multiple
|
||||
:maxCount="10"
|
||||
></u-upload> -->
|
||||
|
||||
<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
|
||||
|
@ -69,80 +73,111 @@
|
|||
</template>
|
||||
</u-form-item>
|
||||
</u-form>
|
||||
<u-action-sheet
|
||||
:actions="contrlModalParams.select.selectList"
|
||||
:title="contrlModalParams.select.title"
|
||||
:show="contrlModalParams.select.isShow"
|
||||
@select="contrlModalParams.select.isShow = false"
|
||||
@close="contrlModalParams.select.isShow = false"
|
||||
></u-action-sheet>
|
||||
<block v-for="(item, index) in formAttrList" :key="index">
|
||||
<u-action-sheet
|
||||
v-if="item.type === 'select'"
|
||||
:actions="contrlModalParams[item.childKey].list"
|
||||
:title="contrlModalParams[item.childKey].title"
|
||||
:show="contrlModalParams[item.childKey].isShow"
|
||||
@select="(v: any) => handleSelect(item.childKey, v)"
|
||||
@close="contrlModalParams[item.childKey].isShow = false"
|
||||
:closeOnClickAction="true"
|
||||
:safeAreaInsetBottom="true"
|
||||
></u-action-sheet>
|
||||
</block>
|
||||
</view>
|
||||
<view class="btn-box">
|
||||
<u-button type="primary" text="保存" @click="save()"></u-button>
|
||||
</view>
|
||||
</template>
|
||||
<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 { onLoad } from "@dcloudio/uni-app";
|
||||
import _ from "underscore";
|
||||
const model1 = reactive<any>({
|
||||
order: {
|
||||
id: 0,
|
||||
splTime: "",
|
||||
takeType: 1,
|
||||
fileList: [],
|
||||
fileLists: [],
|
||||
},
|
||||
});
|
||||
const rules = ref({
|
||||
"userInfo.userName": {
|
||||
const rules = reactive({
|
||||
"order.userName": {
|
||||
type: "string",
|
||||
required: true,
|
||||
message: "请输入手机号",
|
||||
message: "请选择客户",
|
||||
trigger: ["blur", "change"],
|
||||
},
|
||||
"userInfo.password": {
|
||||
"order.productName": {
|
||||
type: "string",
|
||||
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"],
|
||||
},
|
||||
});
|
||||
const contrlModalParams = reactive({
|
||||
select: {
|
||||
const contrlModalParams = reactive<ComType>({
|
||||
userSelect: {
|
||||
isShow: false,
|
||||
title: "标题",
|
||||
selectList: [
|
||||
{
|
||||
name: "选项一",
|
||||
},
|
||||
{
|
||||
name: "选项二",
|
||||
},
|
||||
],
|
||||
list: [],
|
||||
},
|
||||
productSelect: {
|
||||
isShow: false,
|
||||
title: "标题",
|
||||
list: [],
|
||||
},
|
||||
});
|
||||
|
||||
const formAttrList = reactive([
|
||||
const formAttrList = reactive<ComType>([
|
||||
{
|
||||
name: "客户",
|
||||
key: "userId",
|
||||
key: "userName",
|
||||
type: "select",
|
||||
required: true,
|
||||
childKey: "userSelect",
|
||||
unit: "",
|
||||
fn: () => {
|
||||
contrlModalParams.select.isShow = true;
|
||||
contrlModalParams.select.title = "客户";
|
||||
contrlModalParams.userSelect.isShow = true;
|
||||
contrlModalParams.userSelect.title = "客户";
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "出货产品",
|
||||
key: "productId",
|
||||
key: "productName",
|
||||
type: "select",
|
||||
required: true,
|
||||
childKey: "productSelect",
|
||||
unit: "",
|
||||
fn: () => {
|
||||
contrlModalParams.select.isShow = true;
|
||||
contrlModalParams.select.title = "出货产品";
|
||||
contrlModalParams.productSelect.isShow = true;
|
||||
contrlModalParams.productSelect.title = "出货产品";
|
||||
},
|
||||
},
|
||||
{
|
||||
|
@ -153,8 +188,8 @@ const formAttrList = reactive([
|
|||
unit: "件",
|
||||
},
|
||||
{
|
||||
name: "毛重",
|
||||
key: "grossWeight",
|
||||
name: "皮重",
|
||||
key: "tare",
|
||||
type: "input",
|
||||
required: true,
|
||||
unit: "KG",
|
||||
|
@ -208,91 +243,194 @@ const formAttrList = reactive([
|
|||
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 = () => {
|
||||
debugger;
|
||||
// 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.NORMARL, // 普通资源
|
||||
orderType: OrderType.Shipment, // 入库单
|
||||
});
|
||||
}
|
||||
});
|
||||
})
|
||||
.then((res) => {
|
||||
if (res.code === 200) {
|
||||
resolve({
|
||||
...(res.data as any),
|
||||
businessId: model1.order.id,
|
||||
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接口
|
||||
* 上传成功后 保存图片资源 和更新订单数据
|
||||
*/
|
||||
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 = () => {
|
||||
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();
|
||||
};
|
||||
|
||||
let scaleStatus = 0;
|
||||
if (ScaleStatus.ToBeShipment === model1.order.scaleStatus) {
|
||||
scaleStatus = ScaleStatus.ToBeGrossWeight;
|
||||
} else if (ScaleStatus.ToBeGrossWeight === model1.order.scaleStatus) {
|
||||
scaleStatus = ScaleStatus.ToBeShipmentReview;
|
||||
const updateOrder = () => {
|
||||
// 编辑更新状态值
|
||||
let status = 0;
|
||||
if (state.scaleStatus === ScaleStatus.ToBeShipment) {
|
||||
status = ScaleStatus.ToBeGrossWeight;
|
||||
} else if (state.scaleStatus === ScaleStatus.ToBeGrossWeight) {
|
||||
status = ScaleStatus.ToBeShipmentReview;
|
||||
} else {
|
||||
status = model1.order.status;
|
||||
}
|
||||
// 更新出货单
|
||||
ShipmentApi.updateOrderIn({
|
||||
orderOutPos: [{ ...model1.order, scaleStatus: scaleStatus }],
|
||||
orderOutPos: [{ ...model1.order, scaleStatus: status }],
|
||||
}).then((res) => {
|
||||
if (res.code === 200) {
|
||||
uni.showToast({
|
||||
title: "编辑成功",
|
||||
icon: "success",
|
||||
});
|
||||
debugger
|
||||
if (scaleStatus === ScaleStatus.ToBeGrossWeight) {
|
||||
uni.navigateTo({
|
||||
url: "/pagesShipment/grossWeight", // 要跳转到的页面路径
|
||||
if (state.scaleStatus === ScaleStatus.ToBeShipment) {
|
||||
uni.redirectTo({
|
||||
url: "/pagesShipment/shipmenting?scaleStatus=" + status, // 要跳转到的页面路径
|
||||
});
|
||||
} else if (scaleStatus === ScaleStatus.ToBeShipmentReview) {
|
||||
uni.navigateTo({
|
||||
url: "/pagesShipment/shipmentSettlement?scaleStatus=2", // 要跳转到的页面路径
|
||||
} else if (state.scaleStatus === ScaleStatus.ToBeGrossWeight) {
|
||||
uni.redirectTo({
|
||||
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) => {
|
||||
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) {
|
||||
ShipmentApi.getDetailById({ id: model1.order.id }).then((res) => {
|
||||
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({
|
||||
businessId: model1.order.id,
|
||||
orderType: 1,
|
||||
orderType: OrderType.Shipment,
|
||||
imagesType: ImagesType.NORMARL,
|
||||
}).then((res) => {
|
||||
if (res.code === 200) {
|
||||
model1.order.fileLists = res.data;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
plain
|
||||
shape="circle"
|
||||
:bgColor="'rgba(237, 254, 255, 1)'"
|
||||
@click="handleScenePhoto(state.order.imagesId as number)"
|
||||
@click="handleScenePhoto(state.order.id)"
|
||||
></u-tag
|
||||
></view>
|
||||
<view
|
||||
|
@ -200,6 +200,7 @@
|
|||
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 contrlModalParams = reactive<{ [attrName: string]: any }>({
|
||||
paySelect: {
|
||||
|
@ -451,9 +452,9 @@ const handleSettlement = () => {
|
|||
`&scaleStatusBtnType=${ScaleStatusBtnType.ShipmentPay}`, // 要跳转到的页面路径
|
||||
});
|
||||
};
|
||||
const handleScenePhoto = (imagesId: number) => {
|
||||
const handleScenePhoto = (id: string) => {
|
||||
uni.navigateTo({
|
||||
url: "/pagesScenePhoto/index?orderType=1&id=" + imagesId, // 要跳转到的页面路径
|
||||
url: "/pagesScenePhoto/index?orderType=1&imagesType=1&id=" + id, // 要跳转到的页面路径
|
||||
});
|
||||
};
|
||||
// 出货未结算 // 先填写结算信息后更新状态为3
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
<template>
|
||||
<view class="search">
|
||||
<view v-if="!isShowSearch" @click="isShowSearch = true">
|
||||
<u-icon color="#C1C1C1" name="search"></u-icon
|
||||
><text>请输入客户名称</text>
|
||||
<u-icon color="#C1C1C1" name="search"></u-icon><text>请输入客户名称</text>
|
||||
</view>
|
||||
<u-search
|
||||
v-else
|
||||
|
@ -13,6 +12,7 @@
|
|||
:clearabled="true"
|
||||
:showAction="false"
|
||||
placeholderColor="#C1C1C1"
|
||||
@search="handleSearch()"
|
||||
></u-search>
|
||||
</view>
|
||||
|
||||
|
@ -28,83 +28,111 @@
|
|||
</text>
|
||||
</view>
|
||||
|
||||
<block v-for="(item, index) in pageList.list" :key="index">
|
||||
<view class="c-layout">
|
||||
<view
|
||||
><checkbox
|
||||
:color="'#00D2E3'"
|
||||
:checked="state.checkMap[item.id + '']"
|
||||
style="transform: scale(0.5)"
|
||||
@click="state.checkMap[item.id + ''] = !state.checkMap[item.id + '']"
|
||||
/></view>
|
||||
<view class="inner-box">
|
||||
<view class="top-flex-box">
|
||||
<view>
|
||||
<page-view
|
||||
@loadList="
|
||||
(v) => {
|
||||
getList(v);
|
||||
}
|
||||
"
|
||||
:noMoreData="pageList.noMoreData"
|
||||
:list="pageList.list"
|
||||
:height="ScaleStatus.ShipmentPaid === currentTab ? 160 : 240"
|
||||
:isLoading="pageList.isLoading"
|
||||
>
|
||||
<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>
|
||||
<text class="number">出货单号:{{ item.orderNumber }}</text>
|
||||
</view>
|
||||
<view>
|
||||
<text class="name">{{ item.userName }}</text>
|
||||
<view>
|
||||
<text class="number">出货单号:{{ item.orderNumber }}</text>
|
||||
</view>
|
||||
<view>
|
||||
<text class="name">{{ item.userName }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="bottom-flex-box">
|
||||
<view>
|
||||
<view class="bottom-flex-box">
|
||||
<view>
|
||||
<text class="desc"
|
||||
>过磅总净重:{{ item.netWeight || 0 }}KG</text
|
||||
>
|
||||
<view>
|
||||
<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>
|
||||
<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>
|
||||
<u-gap
|
||||
height="10"
|
||||
bgColor="#f8f8f8"
|
||||
v-if="index < pageList.list.length - 1"
|
||||
></u-gap>
|
||||
</block>
|
||||
<u-gap
|
||||
height="10"
|
||||
bgColor="#f8f8f8"
|
||||
v-if="index < pageList.list.length - 1"
|
||||
></u-gap>
|
||||
</block>
|
||||
</page-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
|
||||
text="全选/取消"
|
||||
color="#fff"
|
||||
:customStyle="{ color: '#00DCEE', border: '1px solid #00DCEE' }"
|
||||
@click="handleSelect"
|
||||
></u-button>
|
||||
<u-button type="primary" :text="`${currentTab === 2 ? '批量审核' : '批量支付'}`"></u-button>
|
||||
<u-button
|
||||
type="primary"
|
||||
:text="`${currentTab === 2 ? '批量审核' : '批量支付'}`"
|
||||
@click="handleReviewOrPay(currentTab)"
|
||||
></u-button>
|
||||
</view>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { ShipmentApi } from "@/services/index";
|
||||
import { ScaleStatusBtnType } from "@/utils/enum";
|
||||
import { ScaleStatus, ScaleStatusBtnType } from "@/utils/enum";
|
||||
import { onLoad } from "@dcloudio/uni-app";
|
||||
import PageView from "@/components/PageView/index.vue";
|
||||
// scaleStatus
|
||||
interface PageResult<T> {
|
||||
total: number;
|
||||
list: T[];
|
||||
pageNum: number;
|
||||
pageSize: number;
|
||||
}
|
||||
const pageList: PageResult<Shipment> = reactive({
|
||||
isLoading: false,
|
||||
noMoreData: false,
|
||||
total: 0,
|
||||
list: [],
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
});
|
||||
const keyword = ref();
|
||||
const keyword = ref("");
|
||||
const isShowSearch = ref(false);
|
||||
const state = reactive<{
|
||||
[attrName: string]: any;
|
||||
|
@ -129,46 +157,96 @@ const tabList = reactive([
|
|||
const currentTab = ref(2);
|
||||
const handleTab = (item: any) => {
|
||||
currentTab.value = item.key;
|
||||
getOrderList();
|
||||
getList();
|
||||
};
|
||||
const handleReview = (id: string, scaleStatus: number) => {
|
||||
let type = ScaleStatusBtnType.ShipmentSettlement
|
||||
let type = ScaleStatusBtnType.ShipmentSettlement;
|
||||
if (scaleStatus === 2) {
|
||||
type = ScaleStatusBtnType.ShipmentSettlement
|
||||
type = ScaleStatusBtnType.ShipmentSettlement;
|
||||
} else if (scaleStatus === 3) {
|
||||
type = ScaleStatusBtnType.ShipmentNoPay
|
||||
type = ScaleStatusBtnType.ShipmentNoPay;
|
||||
} else if (scaleStatus === 4) {
|
||||
type = ScaleStatusBtnType.ShipmentPay
|
||||
type = ScaleStatusBtnType.ShipmentPay;
|
||||
}
|
||||
console.log('**************', type)
|
||||
uni.navigateTo({
|
||||
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 = () => {
|
||||
state.isAll = !state.isAll;
|
||||
Object.keys(state.checkMap).forEach((item) => {
|
||||
state.checkMap[item] = state.isAll;
|
||||
console.log(state.isAll);
|
||||
pageList.list = pageList.list.map((item) => {
|
||||
return { ...item, isChecked: state.isAll };
|
||||
});
|
||||
console.log(state.checkMap)
|
||||
};
|
||||
const getOrderList = () => {
|
||||
ShipmentApi.getOrderPage({ pageNumber: 1, pageSize: 10, scaleStatus: currentTab.value }).then(
|
||||
(res) => {
|
||||
if (res.code === 200) {
|
||||
(pageList as any).list = res.data.list;
|
||||
(res.data.list as any).forEach((item: any) => {
|
||||
state.checkMap[item.id] = false;
|
||||
});
|
||||
}
|
||||
const resetPageList = () => {
|
||||
pageList.noMoreData = false;
|
||||
pageList.total = 0;
|
||||
pageList.list = [];
|
||||
pageList.pageNum = 1;
|
||||
pageList.pageSize = 10;
|
||||
};
|
||||
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(() => {
|
||||
getOrderList();
|
||||
getList();
|
||||
});
|
||||
onLoad((option) => {
|
||||
currentTab.value = parseInt((option as any).scaleStatus);
|
||||
})
|
||||
console.log(option);
|
||||
});
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.search {
|
||||
|
|
|
@ -1,43 +1,61 @@
|
|||
<template>
|
||||
<view class="card-box" v-for="(item, index) in pageList.list" :key="index">
|
||||
<view class="top-flex-box">
|
||||
<view>
|
||||
<page-view
|
||||
:noMoreData="pageList.noMoreData"
|
||||
: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>
|
||||
<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>
|
||||
<text class="number">出货单号:{{ item.orderNumber }}</text>
|
||||
</view>
|
||||
<view>
|
||||
<text class="name">{{ item.cardId }}</text>
|
||||
<u-button
|
||||
:customStyle="{ border: '1px solid #00dcee', color: '#00dcee' }"
|
||||
@click="handleScenePhoto(item.id)"
|
||||
text="现场照片"
|
||||
plain
|
||||
shape="circle"
|
||||
type="success"
|
||||
size="small"
|
||||
></u-button>
|
||||
</view>
|
||||
</view>
|
||||
<view>
|
||||
<text class="btn" @click="handleScenePhoto((item.imagesId as number))"
|
||||
>现场照片</text
|
||||
>
|
||||
<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>
|
||||
<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>
|
||||
</page-view>
|
||||
|
||||
<SmallModal
|
||||
:title="'确认作废吗?'"
|
||||
|
@ -52,14 +70,13 @@
|
|||
<script setup lang="ts">
|
||||
import { ShipmentApi } from "@/services/index";
|
||||
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({
|
||||
isLoading: false,
|
||||
noMoreData: false,
|
||||
total: 0,
|
||||
list: [],
|
||||
pageNum: 1,
|
||||
|
@ -71,34 +88,72 @@ const handleModal = (v: boolean, id: number) => {
|
|||
isShowCancelModal.value = v;
|
||||
deleteId.value = id;
|
||||
};
|
||||
const handleScenePhoto = (imagesId: number) => {
|
||||
uni.navigateTo({
|
||||
url: "/pagesScenePhoto/index?orderType=2&id=" + imagesId, // 要跳转到的页面路径
|
||||
const handleScenePhoto = (id: any) => {
|
||||
uni.redirectTo({
|
||||
url: `/pagesScenePhoto/index?orderType=1&id=${id}&imagesType=1`, // 要跳转到的页面路径
|
||||
});
|
||||
};
|
||||
const pricingDetail = (id: string) => {
|
||||
console.log(state.scaleStatus)
|
||||
uni.navigateTo({
|
||||
url: "/pagesShipment/form/shipmentForm?id=" + id, // 要跳转到的页面路径
|
||||
url: "/pagesShipment/form/shipmentForm?id=" + id + `&scaleStatus=${state.scaleStatus}`, // 要跳转到的页面路径
|
||||
});
|
||||
};
|
||||
const getOrderList = () => {
|
||||
ShipmentApi.getOrderPage({ pageNumber: 1, pageSize: 10, scaleStatus: 0 }).then((res) => {
|
||||
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: state.scaleStatus,
|
||||
}).then((res) => {
|
||||
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 = () => {
|
||||
console.log(deleteId.value);
|
||||
ShipmentApi.deleteOrder({ids:[deleteId.value]}).then((res) => {
|
||||
ShipmentApi.deleteOrder({ ids: [deleteId.value] }).then((res) => {
|
||||
if (res.code === 200) {
|
||||
getOrderList();
|
||||
getList();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
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>
|
||||
<style lang="scss" scoped>
|
||||
|
|
|
@ -36,6 +36,7 @@ type PageParams = {
|
|||
startTime?: string; // 开始时间
|
||||
endTime?: string; // 结束时间
|
||||
isDeleted?: boolean;
|
||||
userName?: string;
|
||||
|
||||
};
|
||||
// 根据条件获取出库单,并且进行分页
|
||||
|
|
|
@ -99,6 +99,7 @@ type PageParams = {
|
|||
repairFlag?: boolean; // 是否为补单,true 是未补单,false是补单
|
||||
scaleStatus?: number; // 磅单状态:0:待定价1:待过皮2:待审核3:已审核待支付4:已支付
|
||||
isDeleted?: boolean;
|
||||
userName?: string; // 供应商名称
|
||||
};
|
||||
|
||||
interface Shipment {
|
||||
|
|
Loading…
Reference in New Issue