开车管理列表
This commit is contained in:
@@ -73,4 +73,36 @@ export const reqDeletePipelineComponentFromPackaging = (id)=>get(`/PackagingMana
|
||||
/**
|
||||
* 包装确认到场
|
||||
*/
|
||||
export const reqPackingInfoConfirmArrival = (params={})=>get(`/PackagingManage/GetPackingInfoConfirmArrival?packagingManageId=${params.packagingManageId}&PersonId=${params.personId}`)
|
||||
export const reqPackingInfoConfirmArrival = (params={})=>get(`/PackagingManage/GetPackingInfoConfirmArrival?packagingManageId=${params.packagingManageId}&PersonId=${params.personId}`)
|
||||
|
||||
// ========================= 发货管理(车次管理)====================================
|
||||
/**
|
||||
* 获取车次管理列表
|
||||
*/
|
||||
export const reqTrainNumberList = (data={})=> get(`TrainNumberManage/GetTrainNumberList?filter.projectId=${data.projectId}&pageindex=${data.pageIndex}&pagesize=${data.pageSize}&filter.unitId=${data.unitId || ''}&preapitype=3`)
|
||||
|
||||
/**
|
||||
* 获取车次详情
|
||||
*/
|
||||
export const reqTrainNumberById = (id) => get(`TrainNumberManage/GetTrainNumberById?trainNumberId=${id}`)
|
||||
|
||||
/**
|
||||
* 保存/发货车次
|
||||
* @param {Object} data - { trainNumberId, projectId, unitId, trainNumber, driverName, driverPhone, licensePlateNumber, contactName, contactPhone, remark, state }
|
||||
*/
|
||||
export const reqSaveTrainNumber = (data) => post(`TrainNumberManage/SaveTrainNumber`, data)
|
||||
|
||||
/**
|
||||
* 签收车次
|
||||
*/
|
||||
export const reqSignTrainNumber = (params = {}) => get(`TrainNumberManage/SignTrainNumber?trainNumberId=${params.trainNumberId}&personId=${params.personId}`)
|
||||
|
||||
/**
|
||||
* 删除包装
|
||||
*/
|
||||
export const reqDeletePackagingFromTrain = (params = {}) => get(`TrainNumberManage/DeletePackagingFromTrain?trainNumberId=${params.trainNumberId}&packagingManageId=${params.packagingManageId}`)
|
||||
|
||||
/**
|
||||
* 获取包装列表
|
||||
*/
|
||||
export const reqPackagingListByTrain = (trainNumberId) => get(`PackagingManage/GetPackagingListByTrain?trainNumberId=${trainNumberId}`)
|
||||
+202
-19
@@ -377,24 +377,24 @@
|
||||
// 头部过滤区域
|
||||
.filter-header {
|
||||
background: #ffffff;
|
||||
padding: 20rpx 24rpx;
|
||||
border-bottom: 1rpx solid #f0f0f0;
|
||||
padding: 24rpx;
|
||||
// border-bottom: 1rpx solid #f0f0f0;
|
||||
|
||||
// 第一行:单位选择 + 刷新
|
||||
.filter-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 16rpx;
|
||||
margin-bottom: 16rpx;
|
||||
|
||||
.project-select-btn {
|
||||
.project-select-btn,
|
||||
.unit-select-btn {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
background: #f5f6f8;
|
||||
border-radius: 12rpx;
|
||||
padding: 0 16rpx;
|
||||
max-height: 70rpx;
|
||||
height: 70rpx;
|
||||
min-width: 0;
|
||||
|
||||
:deep(.u-input) {
|
||||
@@ -518,20 +518,21 @@
|
||||
// 悬浮新增按钮
|
||||
.fab-btn {
|
||||
position: fixed;
|
||||
right: 30rpx;
|
||||
right: 32rpx;
|
||||
bottom: 100rpx;
|
||||
width: 100rpx;
|
||||
height: 100rpx;
|
||||
background: $u-type-primary;
|
||||
background: linear-gradient(135deg, #4a7df5 0%, #356bdb 100%);
|
||||
border-radius: 50%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
box-shadow: 0 4rpx 20rpx rgba($color: $u-type-primary, $alpha: 0.4);
|
||||
box-shadow: 0 6rpx 24rpx rgba(74, 125, 245, 0.4);
|
||||
z-index: 99;
|
||||
border: 4rpx solid rgba(255, 255, 255, 0.2);
|
||||
|
||||
&:active {
|
||||
opacity: 0.8;
|
||||
opacity: 0.9;
|
||||
transform: scale(0.95);
|
||||
}
|
||||
}
|
||||
@@ -570,7 +571,8 @@
|
||||
}
|
||||
|
||||
.list-wrap {
|
||||
padding: 24rpx 24rpx 60rpx;
|
||||
padding: 24rpx;
|
||||
padding-bottom: 160rpx;
|
||||
}
|
||||
|
||||
// 列表项:序号 + 标题 + 箭头
|
||||
@@ -686,9 +688,15 @@
|
||||
.card-item {
|
||||
background: #ffffff;
|
||||
border-radius: 16rpx;
|
||||
padding: 24rpx;
|
||||
padding: 28rpx;
|
||||
margin-bottom: 20rpx;
|
||||
box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.06);
|
||||
transition: transform 0.15s, box-shadow 0.15s;
|
||||
|
||||
&:active {
|
||||
transform: scale(0.99);
|
||||
box-shadow: 0 1rpx 8rpx rgba(0, 0, 0, 0.04);
|
||||
}
|
||||
|
||||
&:last-child {
|
||||
margin-bottom: 0;
|
||||
@@ -698,7 +706,7 @@
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding-bottom: 20rpx;
|
||||
padding-bottom: 24rpx;
|
||||
border-bottom: 1rpx solid #f0f0f0;
|
||||
|
||||
.card-code {
|
||||
@@ -730,22 +738,37 @@
|
||||
color: #4caf50;
|
||||
}
|
||||
}
|
||||
|
||||
.card-title {
|
||||
font-size: 30rpx;
|
||||
font-weight: 600;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.card-status {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
padding: 8rpx 20rpx;
|
||||
border-radius: 24rpx;
|
||||
font-size: 24rpx;
|
||||
font-weight: 500;
|
||||
}
|
||||
}
|
||||
|
||||
.card-body {
|
||||
padding-top: 20rpx;
|
||||
padding-top: 24rpx;
|
||||
|
||||
.card-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 14rpx 0;
|
||||
padding: 16rpx 0;
|
||||
|
||||
&:not(:last-child) {
|
||||
border-bottom: 1rpx dashed #f0f0f0;
|
||||
}
|
||||
|
||||
.row-label {
|
||||
width: 200rpx;
|
||||
width: 180rpx;
|
||||
font-size: 26rpx;
|
||||
color: #999;
|
||||
flex-shrink: 0;
|
||||
@@ -957,9 +980,11 @@
|
||||
// 底部按钮
|
||||
.bottom-btns {
|
||||
position: fixed;
|
||||
left: 30rpx;
|
||||
right: 30rpx;
|
||||
bottom: 40rpx;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background-color: #ffffff;
|
||||
padding: 24rpx 32rpx;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
@@ -1025,4 +1050,162 @@
|
||||
white-space: nowrap;
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
}
|
||||
// 发货管理列表
|
||||
.page-list .deliver-card {
|
||||
.card-header {
|
||||
.card-status {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
padding: 8rpx 20rpx;
|
||||
border-radius: 24rpx;
|
||||
font-size: 24rpx;
|
||||
font-weight: 500;
|
||||
|
||||
&.status-0 {
|
||||
background: rgba(153, 153, 153, 0.1);
|
||||
color: #999;
|
||||
}
|
||||
|
||||
&.status-1 {
|
||||
background: rgba(255, 167, 38, 0.1);
|
||||
color: #ffa726;
|
||||
}
|
||||
|
||||
&.status-2 {
|
||||
background: rgba(76, 175, 80, 0.1);
|
||||
color: #4caf50;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 发货管理详情
|
||||
.page-detail {
|
||||
min-height: 100vh;
|
||||
background: #f5f6f8;
|
||||
padding-bottom: 160rpx;
|
||||
}
|
||||
|
||||
.info-group {
|
||||
background: #ffffff;
|
||||
margin: 24rpx;
|
||||
border-radius: 16rpx;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.info-item {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
padding: 28rpx 24rpx;
|
||||
border-bottom: 1rpx solid #f0f0f0;
|
||||
|
||||
&:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
}
|
||||
|
||||
.info-label {
|
||||
flex-shrink: 0;
|
||||
width: 180rpx;
|
||||
font-size: 28rpx;
|
||||
color: #666;
|
||||
line-height: 40rpx;
|
||||
|
||||
.required {
|
||||
color: #fa3534;
|
||||
margin-right: 4rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.info-value {
|
||||
flex: 1;
|
||||
font-size: 28rpx;
|
||||
color: #333;
|
||||
line-height: 40rpx;
|
||||
}
|
||||
|
||||
// 扫码行
|
||||
.scan-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 28rpx 24rpx;
|
||||
border-bottom: 1rpx solid #f0f0f0;
|
||||
|
||||
.scan-text {
|
||||
font-size: 28rpx;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.scan-btn {
|
||||
width: 80rpx;
|
||||
height: 80rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background: #f5f6f8;
|
||||
border-radius: 50%;
|
||||
}
|
||||
}
|
||||
|
||||
// 包装列表区域
|
||||
.package-section {
|
||||
padding: 24rpx;
|
||||
|
||||
.section-title {
|
||||
display: block;
|
||||
font-size: 30rpx;
|
||||
font-weight: 600;
|
||||
color: #333;
|
||||
margin-bottom: 16rpx;
|
||||
}
|
||||
}
|
||||
|
||||
// 包装表格
|
||||
.package-table {
|
||||
border: 1rpx solid #e5e5e5;
|
||||
border-radius: 8rpx;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
// 表格行
|
||||
.table-hd {
|
||||
display: flex;
|
||||
background: #f5f6f8;
|
||||
|
||||
.table-td {
|
||||
font-size: 24rpx;
|
||||
color: #666;
|
||||
}
|
||||
}
|
||||
|
||||
.table-tr {
|
||||
display: flex;
|
||||
border-top: 1rpx solid #e5e5e5;
|
||||
|
||||
&:active {
|
||||
background: #fafafa;
|
||||
}
|
||||
}
|
||||
|
||||
// 表格单元格
|
||||
.table-td {
|
||||
flex: 1;
|
||||
padding: 20rpx;
|
||||
font-size: 26rpx;
|
||||
color: #333;
|
||||
text-align: center;
|
||||
|
||||
&.td-operate {
|
||||
flex: 0 0 100rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
}
|
||||
|
||||
// 表格空状态
|
||||
.table-empty {
|
||||
padding: 40rpx 0;
|
||||
}
|
||||
|
||||
Generated
+2922
-89
File diff suppressed because it is too large
Load Diff
+9
-1
@@ -1,7 +1,15 @@
|
||||
{
|
||||
"dependencies": {
|
||||
"@dcloudio/uni-app": "^2.0.2-5000720260410001",
|
||||
"@dcloudio/uni-cli-shared": "^2.0.2-5000720260410001",
|
||||
"@dcloudio/uni-components": "^3.0.0-alpha-3000020210521001",
|
||||
"@dcloudio/uni-h5": "^2.0.2-5000720260410001",
|
||||
"@dcloudio/uni-mp-weixin": "^2.0.2-5000720260410001",
|
||||
"@dcloudio/vite-plugin-uni": "^3.0.0-alpha-3000020210521001",
|
||||
"pinia": "^2.3.1",
|
||||
"pinia-plugin-persist-uni": "^1.3.2",
|
||||
"uview-pro": "^0.6.2"
|
||||
"uview-pro": "^0.6.2",
|
||||
"vite": "^8.0.16",
|
||||
"vue": "^3.5.38"
|
||||
}
|
||||
}
|
||||
|
||||
+7
-1
@@ -6,7 +6,7 @@
|
||||
"^nbd-(.*)": "@/components/nbd-$1.vue"
|
||||
}
|
||||
},
|
||||
"pages": [ //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages
|
||||
"pages": [
|
||||
{
|
||||
"path": "pages/login/index",
|
||||
"style": {
|
||||
@@ -79,6 +79,12 @@
|
||||
"style": {
|
||||
"navigationBarTitleText": "发货管理"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "deliver/detail",
|
||||
"style": {
|
||||
"navigationBarTitleText": "发货管理"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -0,0 +1,384 @@
|
||||
<template>
|
||||
<view class="page-detail">
|
||||
<!-- 信息表单 -->
|
||||
<view class="info-group">
|
||||
<!-- 车次 -->
|
||||
<view class="info-item">
|
||||
<text class="info-label" v-if="isEdit"><text class="required">*</text>车次</text>
|
||||
<text class="info-label" v-else>车次</text>
|
||||
<u-input v-if="isEdit" v-model="form.TrainNumber" placeholder="请输入车次" />
|
||||
<text class="info-value" v-else>{{ form.TrainNumber || '--' }}</text>
|
||||
</view>
|
||||
|
||||
<!-- 单位名称 -->
|
||||
<view class="info-item">
|
||||
<text class="info-label" v-if="isEdit"><text class="required">*</text>单位名称</text>
|
||||
<text class="info-label" v-else>单位名称</text>
|
||||
<u-input v-if="isEdit" v-model="form.UnitName" :clearable="false" type="select" placeholder="请选择单位" @click="handleShowUnit" />
|
||||
<text class="info-value" v-else>{{ form.UnitName || '--' }}</text>
|
||||
</view>
|
||||
|
||||
<!-- 驾驶员姓名 -->
|
||||
<view class="info-item">
|
||||
<text class="info-label" v-if="isEdit"><text class="required">*</text>驾驶员姓名</text>
|
||||
<text class="info-label" v-else>驾驶员姓名</text>
|
||||
<u-input v-if="isEdit" v-model="form.DriverName" placeholder="请输入驾驶员姓名" />
|
||||
<text class="info-value" v-else>{{ form.DriverName || '--' }}</text>
|
||||
</view>
|
||||
|
||||
<!-- 驾驶员电话 -->
|
||||
<view class="info-item">
|
||||
<text class="info-label" v-if="isEdit"><text class="required">*</text>驾驶员电话</text>
|
||||
<text class="info-label" v-else>驾驶员电话</text>
|
||||
<u-input v-if="isEdit" v-model="form.DriverPhone" placeholder="请输入驾驶员电话" type="number" />
|
||||
<text class="info-value" v-else>{{ form.DriverPhone || '--' }}</text>
|
||||
</view>
|
||||
|
||||
<!-- 车牌号 -->
|
||||
<view class="info-item">
|
||||
<text class="info-label" v-if="isEdit"><text class="required">*</text>车牌号</text>
|
||||
<text class="info-label" v-else>车牌号</text>
|
||||
<u-input v-if="isEdit" v-model="form.LicensePlateNumber" placeholder="请输入车牌号" />
|
||||
<text class="info-value" v-else>{{ form.LicensePlateNumber || '--' }}</text>
|
||||
</view>
|
||||
|
||||
<!-- 联系人姓名 -->
|
||||
<view class="info-item">
|
||||
<text class="info-label" v-if="isEdit"><text class="required">*</text>联系人姓名</text>
|
||||
<text class="info-label" v-else>联系人姓名</text>
|
||||
<u-input v-if="isEdit" v-model="form.ContactName" placeholder="请输入联系人姓名" />
|
||||
<text class="info-value" v-else>{{ form.ContactName || '--' }}</text>
|
||||
</view>
|
||||
|
||||
<!-- 联系人电话 -->
|
||||
<view class="info-item">
|
||||
<text class="info-label" v-if="isEdit"><text class="required">*</text>联系人电话</text>
|
||||
<text class="info-label" v-else>联系人电话</text>
|
||||
<u-input v-if="isEdit" v-model="form.ContactPhone" placeholder="请输入联系人电话" type="number" />
|
||||
<text class="info-value" v-else>{{ form.ContactPhone || '--' }}</text>
|
||||
</view>
|
||||
|
||||
<!-- 备注 -->
|
||||
<view class="info-item">
|
||||
<text class="info-label">备注</text>
|
||||
<u-input v-if="isEdit" v-model="form.Remark" placeholder="请输入备注" type="textarea" />
|
||||
<text class="info-value" v-else>{{ form.Remark || '--' }}</text>
|
||||
</view>
|
||||
|
||||
<!-- 状态 -->
|
||||
<view class="info-item">
|
||||
<text class="info-label">状态</text>
|
||||
<text class="info-value">{{ form.StateName || '--' }}</text>
|
||||
</view>
|
||||
|
||||
<!-- 扫码添加(编辑状态有Id且未发货) -->
|
||||
<view class="scan-row" v-if="form.TrainNumberId && isEdit">
|
||||
<text class="scan-text">扫码添加</text>
|
||||
<view class="scan-btn" @click="handleScan">
|
||||
<u-icon name="scan" :size="40" color="#2979ff"></u-icon>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 包装列表 -->
|
||||
<view class="package-section" v-if="form.TrainNumberId">
|
||||
<text class="section-title">包装列表</text>
|
||||
<view class="package-table">
|
||||
<view class="table-hd">
|
||||
<text class="table-td">包装编号</text>
|
||||
<text class="table-td">预制工作包</text>
|
||||
<text class="table-td td-operate" v-if="isEdit">操作</text>
|
||||
</view>
|
||||
<view v-for="(item, index) in BZList" :key="index" class="table-tr">
|
||||
<text class="table-td">{{ item.PackagingCode }}</text>
|
||||
<text class="table-td">{{ item.StackingPosition || '--' }}</text>
|
||||
<text class="table-td td-operate" v-if="isEdit" @click="handleDeletePackage(item)">
|
||||
<u-icon name="trash" :size="20" color="#fa3534"></u-icon>
|
||||
</text>
|
||||
</view>
|
||||
<view v-if="BZList.length === 0" class="table-empty">
|
||||
<u-empty text="暂无数据" mode="list"></u-empty>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 底部按钮 -->
|
||||
<view class="bottom-btns" v-if="isEdit">
|
||||
<u-button size="medium" type="primary" :disabled="disabledBtn" @click="handleSave(0)">保存</u-button>
|
||||
<u-button size="medium" type="success" :disabled="disabledBtn" @click="handleSave(1)">发货</u-button>
|
||||
</view>
|
||||
<view class="bottom-btns" v-if="form.State === 1">
|
||||
<u-button size="medium" type="warning" :disabled="disabledBtn" @click="handleSign">签收</u-button>
|
||||
</view>
|
||||
|
||||
<!-- 单位选择弹窗 -->
|
||||
<nbd-select v-model="showUnitSelect" v-model:model="selectedUnit" :show-search="true" title="选择单位"
|
||||
:list="unitList" label-key="UnitName" value-key="UnitId" @confirm="handleUnitConfirm" />
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, computed } from 'vue'
|
||||
import { onLoad, onShow } from '@dcloudio/uni-app'
|
||||
import { useUserStore } from '@/store'
|
||||
import { storeToRefs } from 'pinia'
|
||||
import { reqUnitByProjectIdUnitType } from '@/api/base'
|
||||
import { reqTrainNumberById, reqSaveTrainNumber, reqSignTrainNumber, reqDeletePackagingFromTrain, reqPackagingListByTrain } from '@/api/hj'
|
||||
|
||||
// 是否编辑状态
|
||||
const isEdit = computed(() => !form.value.State || form.value.State === 0)
|
||||
|
||||
const userStore = useUserStore()
|
||||
const { currentProject } = storeToRefs(userStore)
|
||||
|
||||
// ===== 页面状态 =====
|
||||
const trainNumberId = ref('')
|
||||
const disabledBtn = ref(false)
|
||||
|
||||
// ===== 表单数据 =====
|
||||
const form = ref({
|
||||
TrainNumberId: '',
|
||||
TrainNumber: '',
|
||||
UnitId: '',
|
||||
UnitName: '',
|
||||
DriverName: '',
|
||||
DriverPhone: '',
|
||||
LicensePlateNumber: '',
|
||||
ContactName: '',
|
||||
ContactPhone: '',
|
||||
Remark: '',
|
||||
State: 0,
|
||||
StateName: ''
|
||||
})
|
||||
|
||||
// ===== 单位选择 =====
|
||||
const showUnitSelect = ref(false)
|
||||
const unitList = ref([{ UnitId: '', UnitName: '全部单位' }])
|
||||
const selectedUnit = ref({ UnitId: '', UnitName: '全部单位' })
|
||||
|
||||
// ===== 包装列表 =====
|
||||
const BZList = ref([])
|
||||
|
||||
// ===== 获取单位列表 =====
|
||||
const getUnitList = async () => {
|
||||
try {
|
||||
const res = await reqUnitByProjectIdUnitType(currentProject.value?.ProjectId || '')
|
||||
unitList.value = [{ UnitId: '', UnitName: '全部单位' }, ...(res.data || [])]
|
||||
} catch (error) {
|
||||
console.error('获取单位列表失败:', error)
|
||||
}
|
||||
}
|
||||
|
||||
// ===== 显示单位选择 =====
|
||||
const handleShowUnit = () => {
|
||||
if (form.value.UnitId) {
|
||||
selectedUnit.value = {
|
||||
UnitId: form.value.UnitId,
|
||||
UnitName: form.value.UnitName
|
||||
}
|
||||
}
|
||||
showUnitSelect.value = true
|
||||
}
|
||||
|
||||
// ===== 单位选择确认 =====
|
||||
const handleUnitConfirm = (item) => {
|
||||
form.value.UnitId = item.UnitId
|
||||
form.value.UnitName = item.UnitName
|
||||
selectedUnit.value = item
|
||||
showUnitSelect.value = false
|
||||
}
|
||||
|
||||
// ===== 获取车次详情 =====
|
||||
const getTrainNumberDetail = async () => {
|
||||
if (!trainNumberId.value) return
|
||||
|
||||
try {
|
||||
const res = await reqTrainNumberById(trainNumberId.value)
|
||||
if (res.data) {
|
||||
form.value = { ...form.value, ...res.data }
|
||||
selectedUnit.value = {
|
||||
UnitId: res.data.UnitId,
|
||||
UnitName: res.data.UnitName
|
||||
}
|
||||
}
|
||||
// 获取包装列表
|
||||
getPackagingList()
|
||||
} catch (error) {
|
||||
console.error('获取车次详情失败:', error)
|
||||
}
|
||||
}
|
||||
|
||||
// ===== 获取包装列表 =====
|
||||
const getPackagingList = async () => {
|
||||
if (!trainNumberId.value) return
|
||||
|
||||
try {
|
||||
const res = await reqPackagingListByTrain(trainNumberId.value)
|
||||
BZList.value = res.data || []
|
||||
} catch (error) {
|
||||
console.error('获取包装列表失败:', error)
|
||||
}
|
||||
}
|
||||
|
||||
// ===== 删除包装 =====
|
||||
const handleDeletePackage = async (item) => {
|
||||
try {
|
||||
await reqDeletePackagingFromTrain({
|
||||
trainNumberId: trainNumberId.value,
|
||||
packagingManageId: item.PackagingManageId || item.PackagingId
|
||||
})
|
||||
uni.showToast({
|
||||
title: '删除成功',
|
||||
icon: 'success'
|
||||
})
|
||||
getPackagingList()
|
||||
} catch (error) {
|
||||
console.error('删除包装失败:', error)
|
||||
uni.showToast({
|
||||
title: '删除失败',
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// ===== 扫码 =====
|
||||
const handleScan = () => {
|
||||
// #ifdef MP-WEIXIN
|
||||
wx.scanCode({
|
||||
success: (res) => {
|
||||
console.log('扫码结果:', res)
|
||||
uni.showToast({
|
||||
title: '扫码成功',
|
||||
icon: 'success'
|
||||
})
|
||||
// TODO: 根据扫码结果处理
|
||||
},
|
||||
fail: (err) => {
|
||||
console.error('扫码失败:', err)
|
||||
uni.showToast({
|
||||
title: '扫码失败',
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
})
|
||||
// #endif
|
||||
}
|
||||
|
||||
// ===== 保存/发货 =====
|
||||
const handleSave = async (state) => {
|
||||
// 验证必填项
|
||||
if (!form.value.TrainNumber) {
|
||||
uni.showToast({ title: '请输入车次', icon: 'none' })
|
||||
return
|
||||
}
|
||||
if (!form.value.UnitId) {
|
||||
uni.showToast({ title: '请选择单位', icon: 'none' })
|
||||
return
|
||||
}
|
||||
if (!form.value.DriverName) {
|
||||
uni.showToast({ title: '请输入驾驶员姓名', icon: 'none' })
|
||||
return
|
||||
}
|
||||
if (!form.value.DriverPhone) {
|
||||
uni.showToast({ title: '请输入驾驶员电话', icon: 'none' })
|
||||
return
|
||||
}
|
||||
if (!form.value.LicensePlateNumber) {
|
||||
uni.showToast({ title: '请输入车牌号', icon: 'none' })
|
||||
return
|
||||
}
|
||||
if (!form.value.ContactName) {
|
||||
uni.showToast({ title: '请输入联系人姓名', icon: 'none' })
|
||||
return
|
||||
}
|
||||
if (!form.value.ContactPhone) {
|
||||
uni.showToast({ title: '请输入联系人电话', icon: 'none' })
|
||||
return
|
||||
}
|
||||
|
||||
disabledBtn.value = true
|
||||
|
||||
try {
|
||||
const res = await reqSaveTrainNumber({
|
||||
trainNumberId: trainNumberId.value || '',
|
||||
projectId: currentProject.value?.ProjectId || '',
|
||||
unitId: form.value.UnitId,
|
||||
trainNumber: form.value.TrainNumber,
|
||||
driverName: form.value.DriverName,
|
||||
driverPhone: form.value.DriverPhone,
|
||||
licensePlateNumber: form.value.LicensePlateNumber,
|
||||
contactName: form.value.ContactName,
|
||||
contactPhone: form.value.ContactPhone,
|
||||
remark: form.value.Remark,
|
||||
state: state
|
||||
})
|
||||
|
||||
if (res.code === 1 || res.data) {
|
||||
uni.showToast({
|
||||
title: state === 1 ? '发货成功' : '保存成功',
|
||||
icon: 'success'
|
||||
})
|
||||
|
||||
setTimeout(() => {
|
||||
const newId = res.data?.trainNumberId || trainNumberId.value
|
||||
uni.redirectTo({
|
||||
url: `/pipe/deliver/add?id=${newId}&from=1`
|
||||
})
|
||||
}, 1500)
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('保存失败:', error)
|
||||
uni.showToast({
|
||||
title: '保存失败,请重试',
|
||||
icon: 'none'
|
||||
})
|
||||
} finally {
|
||||
disabledBtn.value = false
|
||||
}
|
||||
}
|
||||
|
||||
// ===== 签收 =====
|
||||
const handleSign = async () => {
|
||||
disabledBtn.value = true
|
||||
|
||||
try {
|
||||
const res = await reqSignTrainNumber({
|
||||
trainNumberId: trainNumberId.value,
|
||||
personId: currentProject.value?.PersonId || ''
|
||||
})
|
||||
|
||||
if (res.code === 1) {
|
||||
uni.showToast({
|
||||
title: '签收成功',
|
||||
icon: 'success'
|
||||
})
|
||||
|
||||
setTimeout(() => {
|
||||
uni.navigateBack()
|
||||
}, 1500)
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('签收失败:', error)
|
||||
uni.showToast({
|
||||
title: '签收失败,请重试',
|
||||
icon: 'none'
|
||||
})
|
||||
} finally {
|
||||
disabledBtn.value = false
|
||||
}
|
||||
}
|
||||
|
||||
// ===== 生命周期 =====
|
||||
onLoad((options) => {
|
||||
if (options.id) {
|
||||
trainNumberId.value = options.id
|
||||
}
|
||||
})
|
||||
|
||||
onShow(() => {
|
||||
getUnitList()
|
||||
if (trainNumberId.value) {
|
||||
getTrainNumberDetail()
|
||||
}
|
||||
})
|
||||
</script>
|
||||
@@ -0,0 +1,222 @@
|
||||
<template>
|
||||
<view class="page-list">
|
||||
<!-- 头部单位选择 -->
|
||||
<view class="filter-header">
|
||||
<view class="filter-row">
|
||||
<view class="unit-select-btn" >
|
||||
<u-input style="color: #333;" v-model="selectUnit.UnitName" :clearable="false" type="select"
|
||||
placeholder="请选择单位工程" @click="handleShowUnit" />
|
||||
</view>
|
||||
<view class="refresh-btn" @click="handleRefresh">
|
||||
<u-icon name="reload" :size="36" :class="{ rotating: loading }"></u-icon>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 列表内容 -->
|
||||
<scroll-view class="list-scroll" scroll-y @scrolltolower="loadMore" refresher-enabled
|
||||
:refresher-triggered="refreshing" @refresh="handleRefresh">
|
||||
<view class="list-wrap">
|
||||
<view v-for="(item, index) in list" :key="index" class="card-item deliver-card" @click="clickTap(item)">
|
||||
<view class="card-header">
|
||||
<text class="card-title">{{ item.TrainNumber || '--' }}</text>
|
||||
<text class="card-status" :style="{ background: getStatusBg(item.State) }">
|
||||
{{ getStatus(item.State) }}
|
||||
</text>
|
||||
</view>
|
||||
<view class="card-body">
|
||||
<view class="card-row">
|
||||
<text class="row-label">单位名称</text>
|
||||
<text class="row-value">{{ item.UnitId || '--' }}</text>
|
||||
</view>
|
||||
<view class="card-row">
|
||||
<text class="row-label">驾驶员</text>
|
||||
<text class="row-value">{{ item.DriverName || '--' }}</text>
|
||||
</view>
|
||||
<view class="card-row">
|
||||
<text class="row-label">驾驶员电话</text>
|
||||
<text class="row-value">{{ item.DriverPhone || '--' }}</text>
|
||||
</view>
|
||||
<view class="card-row">
|
||||
<text class="row-label">车牌号</text>
|
||||
<text class="row-value">{{ item.LicensePlateNumber || '--' }}</text>
|
||||
</view>
|
||||
<view class="card-row">
|
||||
<text class="row-label">联系人</text>
|
||||
<text class="row-value">{{ item.ContactName || '--' }}</text>
|
||||
</view>
|
||||
<view class="card-row">
|
||||
<text class="row-label">联系人电话</text>
|
||||
<text class="row-value">{{ item.ContactPhone || '--' }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 空状态 -->
|
||||
<u-empty v-if="!loading && list.length === 0" mode="list" text="暂无数据"></u-empty>
|
||||
|
||||
<!-- 加载提示 -->
|
||||
<view v-if="loading && list.length > 0" class="loading-more">
|
||||
<u-loading mode="circle" size="32"></u-loading>
|
||||
<text>加载中...</text>
|
||||
</view>
|
||||
|
||||
<!-- 没有更多 -->
|
||||
<view v-if="!loading && isFinished && list.length > 0" class="no-more">
|
||||
<text>— 没有更多了 —</text>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
|
||||
<!-- 新增按钮 -->
|
||||
<view class="fab-btn" @click="goAdd">
|
||||
<u-icon name="plus" :size="60" color="#ffffff"></u-icon>
|
||||
</view>
|
||||
|
||||
<!-- 单位选择弹窗 -->
|
||||
<nbd-select v-model="showUnitSelect" v-model:model="selectUnit" :show-search="true" title="选择单位"
|
||||
:list="unitList" label-key="UnitName" value-key="UnitId" @confirm="handleUnitConfirm" />
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
ref,
|
||||
onMounted
|
||||
} from 'vue'
|
||||
import {
|
||||
useUserStore
|
||||
} from '@/store'
|
||||
import {
|
||||
storeToRefs
|
||||
} from 'pinia'
|
||||
import { reqUnitByProjectIdUnitType } from '@/api/base'
|
||||
import { reqTrainNumberList } from '@/api/hj'
|
||||
|
||||
const userStore = useUserStore()
|
||||
const {
|
||||
currentProject
|
||||
} = storeToRefs(userStore)
|
||||
|
||||
// ===== 数据 =====
|
||||
const list = ref([])
|
||||
const loading = ref(false)
|
||||
const refreshing = ref(false)
|
||||
const isFinished = ref(false)
|
||||
const pageindex = ref(1)
|
||||
const pagesize = 15
|
||||
|
||||
// ===== 单位选择 =====
|
||||
const selectUnit = ref({
|
||||
UnitId: '',
|
||||
UnitName: '全部单位'
|
||||
})
|
||||
const showUnitSelect = ref(false)
|
||||
const unitList = ref([{
|
||||
UnitId: '',
|
||||
UnitName: '全部单位'
|
||||
}])
|
||||
|
||||
// ===== 状态映射 =====
|
||||
const getStatus = (val) => {
|
||||
const map = {
|
||||
'0': '未发货',
|
||||
'1': '已发货',
|
||||
'2': '已签收'
|
||||
}
|
||||
return map[String(val)] || '--'
|
||||
}
|
||||
|
||||
const getStatusBg = (val) => {
|
||||
const colorMap = {
|
||||
'0': '#999',
|
||||
'1': '#ffa726',
|
||||
'2': '#4caf50'
|
||||
}
|
||||
return `rgba(${val === '0' ? '153,153,153' : val === '1' ? '255,167,38' : '76,175,80'}, 0.1); color: ${colorMap[String(val)] || '#999'}`
|
||||
}
|
||||
|
||||
// ===== 单位选择 =====
|
||||
const handleShowUnit = async () => {
|
||||
const res = await reqUnitByProjectIdUnitType(currentProject.value.ProjectId)
|
||||
unitList.value = [{ UnitId: '', UnitName: '全部单位' }, ...(res.data || [])]
|
||||
showUnitSelect.value = true
|
||||
}
|
||||
|
||||
const handleUnitConfirm = (item) => {
|
||||
selectUnit.value = item
|
||||
showUnitSelect.value = false
|
||||
handleRefresh()
|
||||
}
|
||||
|
||||
// ===== 列表数据 =====
|
||||
const getList = async () => {
|
||||
if (loading.value || (!refreshing.value && isFinished.value)) return
|
||||
|
||||
loading.value = true
|
||||
|
||||
try {
|
||||
const res = await reqTrainNumberList({
|
||||
projectId: currentProject.value?.ProjectId || '',
|
||||
pageIndex: pageindex.value,
|
||||
pageSize: pagesize,
|
||||
unitId: selectUnit.value?.UnitId || ''
|
||||
})
|
||||
|
||||
const data = res.data.getDataList || []
|
||||
|
||||
if (data.length < pagesize) {
|
||||
isFinished.value = true
|
||||
}
|
||||
|
||||
if (refreshing.value) {
|
||||
list.value = data
|
||||
} else {
|
||||
list.value = [...list.value, ...data]
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('加载数据失败:', error)
|
||||
uni.showToast({
|
||||
title: '加载失败,请重试',
|
||||
icon: 'none'
|
||||
})
|
||||
} finally {
|
||||
loading.value = false
|
||||
refreshing.value = false
|
||||
}
|
||||
}
|
||||
|
||||
// ===== 刷新 =====
|
||||
const handleRefresh = () => {
|
||||
pageindex.value = 1
|
||||
isFinished.value = false
|
||||
list.value = []
|
||||
getList()
|
||||
}
|
||||
|
||||
// ===== 加载更多 =====
|
||||
const loadMore = () => {
|
||||
if (!loading.value && !isFinished.value) {
|
||||
pageindex.value++
|
||||
getList()
|
||||
}
|
||||
}
|
||||
|
||||
// ===== 跳转 =====
|
||||
const goAdd = () => {
|
||||
uni.navigateTo({
|
||||
url: '/pipe/deliver/detail'
|
||||
})
|
||||
}
|
||||
|
||||
const clickTap = (item) => {
|
||||
uni.navigateTo({
|
||||
url: `/pipe/deliver/detail?id=${item.TrainNumberId}&from=1`
|
||||
})
|
||||
}
|
||||
|
||||
// ===== 生命周期 =====
|
||||
onMounted(() => {
|
||||
handleRefresh()
|
||||
})
|
||||
</script>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<view class="page-list">
|
||||
<!-- 头部过滤区域 -->
|
||||
<view class="filter-header">
|
||||
<view class="filter-row">
|
||||
<view class="filter-row" style="margin-bottom: 16rpx;">
|
||||
<!-- 单位工程下拉选择 -->
|
||||
<view class="project-select-btn">
|
||||
<u-input style="color: #333;" v-model="unitWorkName" :clearable="false" type="select"
|
||||
|
||||
@@ -38,6 +38,7 @@ export const defaultApps = [{
|
||||
name: '发货管理',
|
||||
icon: 'a-facheguanli',
|
||||
menuId: "EEC0D060-C15E-4D25-B015-C2B91F735DAC",
|
||||
path: "/pipe/deliver/list",
|
||||
prefix: 'nbd-icon',
|
||||
selected: false
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user