freight-web/src/pagesShipment/shipmenting.vue

318 lines
7.5 KiB
Vue
Raw Normal View History

2024-03-09 12:37:17 +00:00
<template>
2024-07-15 06:15:49 +00:00
<view class="search">
<u-search
placeholder="请输入客户名称"
v-model="stateNew.keywoard"
:showAction="false"
:bgColor="'#fff'"
:borderColor="'rgba(0, 0, 0, 0.1)'"
:placeholderColor="'#C1C1C1'"
@search="handleSearch()"
@clear="handleSearch()"
></u-search>
<view class="btn" @click="stateNew.isShow = true">
{{
stateNew.currentDevice.name === "全部"
? "选择设备"
: stateNew.currentDevice.name
}}
</view>
</view>
2024-03-25 06:19:03 +00:00
<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">
2024-03-09 12:37:17 +00:00
<view>
2024-03-25 06:19:03 +00:00
<view>
<text class="address">{{ item.deviceName || "-" }}</text>
</view>
<view>
<text class="number">出货单号{{ item.orderNumber }}</text>
</view>
<view>
2024-07-15 06:15:49 +00:00
<text class="name">{{ item.userName }} / {{item.cardNumber}}</text>
2024-03-25 06:19:03 +00:00
</view>
2024-03-09 12:37:17 +00:00
</view>
<view>
2024-03-25 06:19:03 +00:00
<u-button
:customStyle="{ border: '1px solid #00dcee', color: '#00dcee' }"
@click="handleScenePhoto(item.id)"
text="现场照片"
plain
shape="circle"
type="success"
size="small"
></u-button>
2024-03-09 12:37:17 +00:00
</view>
</view>
<view>
2024-03-25 06:19:03 +00:00
<text class="desc">过磅时间{{ item.tareTime }}</text>
</view>
<view class="flex-box">
<text>皮重{{ item.tare }}kg</text>
</view>
<view class="btn-box">
<u-button
2024-07-15 06:15:49 +00:00
text="作废"
2024-03-25 06:19:03 +00:00
color="#E8E8E8"
:customStyle="{ color: '#999' }"
@click="handleModal(true, item.id as any)"
></u-button>
<u-button
type="primary"
2024-07-15 06:15:49 +00:00
text="编辑"
2024-03-25 06:19:03 +00:00
@click="pricingDetail(item.id as any)"
></u-button>
2024-03-09 12:37:17 +00:00
</view>
</view>
2024-03-25 06:19:03 +00:00
</page-view>
2024-03-09 12:37:17 +00:00
<SmallModal
:title="'确认作废吗?'"
:content="'确认作废后,该订单不能恢复!'"
:okText="'确认作废'"
:isMain="true"
:show="isShowCancelModal"
@handleModal="(v:boolean) => {handleModal(v, deleteId)}"
@handleOk="handleOk()"
/>
2024-07-15 06:15:49 +00:00
<block>
<u-action-sheet
:actions="stateNew.deviceList"
:title="'选择设备'"
:show="stateNew.isShow"
@select="(v: any) => handleSelect(v)"
@close="stateNew.isShow = false"
:closeOnClickAction="true"
></u-action-sheet>
</block>
2024-03-09 12:37:17 +00:00
</template>
<script setup lang="ts">
2024-07-15 06:15:49 +00:00
import { DeviceApi, ShipmentApi } from "@/services/index";
2024-03-09 12:37:17 +00:00
import SmallModal from "@/components/Modal/smallModal.vue";
2024-03-25 06:19:03 +00:00
import PageView from "@/components/PageView/index.vue";
2024-04-23 02:47:52 +00:00
import { onLoad, onShow } from "@dcloudio/uni-app";
2024-07-15 06:15:49 +00:00
import { DeviceType, ScaleStatus } from "@/utils/enum";
import _ from "underscore";
const stateNew = reactive<any>({
keywoard: "",
deviceList: [],
isShow: false,
currentDevice: {
name: "全部",
},
});
const handleSearch = () => {
resetPageList();
getList();
};
// 设备信息
DeviceApi.getDeviceList({ deviceType: DeviceType.Weighbridge }).then(
(res: any) => {
if (res.code === 200) {
stateNew.deviceList = [{ id: 0, name: "全部" }].concat(
_.map(res.data, function (item) {
return { name: item.deviceName, ...item };
})
);
}
}
);
const handleSelect = (v: any) => {
stateNew.currentDevice = v;
};
2024-03-09 12:37:17 +00:00
const pageList: PageResult<Shipment> = reactive({
2024-03-25 06:19:03 +00:00
isLoading: false,
noMoreData: false,
2024-03-09 12:37:17 +00:00
total: 0,
list: [],
pageNum: 1,
pageSize: 10,
});
2024-04-23 02:47:52 +00:00
const resetPageList = () => {
pageList.noMoreData = false;
pageList.total = 0;
pageList.list = [];
pageList.pageNum = 1;
2024-07-15 06:15:49 +00:00
pageList.pageSize = 100;
2024-04-23 02:47:52 +00:00
};
2024-03-09 12:37:17 +00:00
const isShowCancelModal = ref(false);
const deleteId = ref(0);
const handleModal = (v: boolean, id: number) => {
isShowCancelModal.value = v;
deleteId.value = id;
};
2024-03-25 06:19:03 +00:00
const handleScenePhoto = (id: any) => {
2024-04-16 07:53:59 +00:00
uni.navigateTo({
2024-06-05 05:44:33 +00:00
url: `/pagesScenePhoto/index?orderType=2&id=${id}&imagesType=1`, // 要跳转到的页面路径
2024-03-09 12:37:17 +00:00
});
};
const pricingDetail = (id: string) => {
2024-05-20 01:24:03 +00:00
ShipmentApi.getDetailById({ id: id }).then((res: any) => {
if (res.code === 200) {
if (res.data.scaleStatus > 1) {
uni.showToast({ title: "当前订单已处理" });
resetPageList();
getList();
} else {
uni.navigateTo({
url:
"/pagesShipment/form/shipmentForm?id=" +
id +
`&scaleStatus=${state.scaleStatus}`, // 要跳转到的页面路径
});
}
}
2024-03-09 12:37:17 +00:00
});
};
2024-03-25 06:19:03 +00:00
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,
2024-07-15 06:15:49 +00:00
userName: stateNew.keywoard,
2024-03-25 06:19:03 +00:00
}).then((res) => {
2024-03-09 12:37:17 +00:00
if (res.code === 200) {
2024-04-16 01:52:13 +00:00
pageList.isLoading = false;
2024-05-20 01:24:03 +00:00
(pageList as any).list = (pageList as any).list.concat(res.data.list);
pageList.total = (res.data as any).total;
2024-03-09 12:37:17 +00:00
}
});
};
const handleOk = () => {
console.log(deleteId.value);
2024-03-25 06:19:03 +00:00
ShipmentApi.deleteOrder({ ids: [deleteId.value] }).then((res) => {
2024-03-09 12:37:17 +00:00
if (res.code === 200) {
2024-05-30 02:07:35 +00:00
resetPageList();
2024-03-25 06:19:03 +00:00
getList();
2024-03-09 12:37:17 +00:00
}
});
};
2024-04-23 02:47:52 +00:00
onShow(() => {
resetPageList();
2024-03-25 06:19:03 +00:00
getList();
});
const state = reactive({
2024-05-20 01:24:03 +00:00
scaleStatus: 0,
});
2024-03-25 06:19:03 +00:00
onLoad((option) => {
// 接收传递的标题参数
state.scaleStatus = parseInt((option as any).scaleStatus);
2024-05-20 01:24:03 +00:00
// 设置页面标题
2024-03-25 06:19:03 +00:00
if (state.scaleStatus === ScaleStatus.ToBeShipment) {
uni.setNavigationBarTitle({
2024-05-20 01:24:03 +00:00
title: "待出货",
2024-03-25 06:19:03 +00:00
});
} else if (state.scaleStatus === ScaleStatus.ToBeGrossWeight) {
uni.setNavigationBarTitle({
2024-05-20 01:24:03 +00:00
title: "待过毛重",
2024-03-25 06:19:03 +00:00
});
}
2024-03-09 12:37:17 +00:00
});
</script>
<style lang="scss" scoped>
2024-07-15 06:15:49 +00:00
.search {
display: flex;
align-items: center;
justify-content: space-between;
margin: 26rpx 26rpx 0rpx 26rpx;
.btn {
background: #00dcee;
border-radius: 24rpx;
border: 1px solid #00dcee;
font-weight: 500;
font-size: 26rpx;
color: #ffffff;
margin-left: 50rpx;
padding: 6rpx 30rpx;
}
}
2024-03-09 12:37:17 +00:00
.card-box {
padding: 38rpx 50rpx;
box-shadow: 0rpx 0rpx 10rpx 0rpx rgba(5, 68, 37, 0.12);
border-radius: 13rpx;
margin: 0rpx 25rpx;
margin-top: 35rpx;
font-family: Source Han Sans CN;
font-weight: 400;
font-size: 26rpx;
color: #000000;
line-height: 41rpx;
.top-flex-box {
display: flex;
justify-content: space-between;
align-items: center;
.btn {
border-radius: 24rpx;
border: 1px solid #00dcee;
padding: 10rpx 30rpx;
font-weight: 500;
font-size: 24rpx;
color: #00dcee;
line-height: 41rpx;
cursor: pointer;
}
}
.address {
margin-right: 30rpx;
}
.desc {
font-size: 24rpx;
color: #999999;
margin-top: 30rpx;
display: inline-block;
}
.name {
font-size: 26rpx;
color: #000000;
font-weight: bold;
}
.flex-box {
font-weight: 400;
font-size: 26rpx;
color: #000000;
line-height: 41rpx;
display: flex;
align-items: center;
justify-content: space-between;
}
.btn-box {
margin-top: 60rpx;
display: flex;
::v-deep button {
border-radius: 43rpx;
}
::v-deep button + button {
margin-left: 50rpx;
}
}
}
</style>