Commit 8fd0565b authored by 刘威龙's avatar 刘威龙

运单页面调整

parent 648dba92
<template> <template>
<view class="datetimePicker" @touchmove.stop.prevent="moveHandle"> <view class="datetimePicker" @touchmove.stop.prevent="moveHandle">
<u-datetime-picker ref="datetimePicker" itemHeight="120" :visibleItemCount="visibleItem" :show="visible" <u-datetime-picker ref="datetimePicker" itemHeight="120" :visibleItemCount="visibleItem" :show="visible"
v-model="timestamp" :mode="dateType" @confirm="onSelsectDate" @cancel="onVisible" /> v-model="timestamp" :mode="effectiveMode" @confirm="onSelsectDate" @cancel="onVisible" />
</view> </view>
</template> </template>
...@@ -16,7 +16,13 @@ ...@@ -16,7 +16,13 @@
}, },
dateType: { dateType: {
type: String, type: String,
default: 'date' default: 'date' // 默认改为 datetime 模式
}
},
computed: {
// 计算实际使用的模式,兼容旧用法
effectiveMode() {
return this.dateType === 'date' ? 'date' : 'datetime';
} }
}, },
onReady() { onReady() {
...@@ -29,28 +35,31 @@ ...@@ -29,28 +35,31 @@
showPopup: false, showPopup: false,
timestamp: new Date().getTime(), timestamp: new Date().getTime(),
dateValue: "", //时间戳转换后 年-月-日 dateValue: "", //时间戳转换后 年-月-日
visibleItem: 4, visibleItem: 4, // 增加可见行数,以显示小时、分钟和秒
}; };
}, },
methods: { methods: {
moveHandle(){ moveHandle(){
}, },
//自定义时间格式 // 自定义时间格式 - 增加对秒的格式化
formatter(type, value) { formatter(type, value) {
if (type === 'year') { switch (type) {
return `${value}年`; case 'year':
} return `${value}年`;
if (type === 'month') { case 'month':
return `${value}月`; return `${value}月`;
case 'day':
return `${value}日`;
case 'hour':
return `${value}时`;
case 'minute':
return `${value}分`;
case 'second':
return `${value}秒`;
default:
return value;
} }
if (type === 'day') {
return `${value}日`;
}
if (type === 'hour') {
return `${value}时`;
}
return `${value}分`;
}, },
onVisible() { onVisible() {
...@@ -64,18 +73,20 @@ ...@@ -64,18 +73,20 @@
this.$emit('onSelsectDate', { dateValue: date, timestamp: dateInfo.value, }) this.$emit('onSelsectDate', { dateValue: date, timestamp: dateInfo.value, })
}, },
//时间戳转换 // 时间戳转换 - 增加对秒的显示
formatDate(timestamp) { formatDate(timestamp) {
const nowDate = new Date(timestamp) const nowDate = new Date(timestamp)
var year = nowDate.getFullYear(); var year = nowDate.getFullYear();
var month = nowDate.getMonth() + 1; var month = nowDate.getMonth() + 1;
var date = nowDate.getDate(); var date = nowDate.getDate();
const hour = nowDate.getHours() const hour = nowDate.getHours().toString().padStart(2, '0');
const minute = nowDate.getMinutes() const minute = nowDate.getMinutes().toString().padStart(2, '0');
const second = nowDate.getSeconds().toString().padStart(2, '0');
if (this.dateType === 'date') { if (this.dateType === 'date') {
return `${year}-${ month}-${date}` return `${year}-${month}-${date}`;
} else { } else {
return `${year}-${ month}-${date} ${hour}-${ minute}` return `${year}-${month}-${date} ${hour}:${minute}:${second}`;
} }
}, },
} }
...@@ -87,7 +98,7 @@ ...@@ -87,7 +98,7 @@
z-index: 1000; z-index: 1000;
/* #ifdef MP */ /* #ifdef MP */
/deep/.u-popup__content { /deep/.u-popup__content {
height: 40vh !important; height: 50vh !important; /* 增加高度,以显示更多内容 */
.u-picker__view__column { .u-picker__view__column {
.u-picker__view__column__item { .u-picker__view__column__item {
...@@ -99,4 +110,4 @@ ...@@ -99,4 +110,4 @@
/* #endif */ /* #endif */
} }
</style> </style>
\ No newline at end of file
...@@ -16,14 +16,27 @@ ...@@ -16,14 +16,27 @@
<view class="box_8"> <view class="box_8">
<view class="section_8"> <view class="section_8">
<u-button @click="onDispatchCar()" shape="circle" color="#2E75E6" text="派车"></u-button> <u-button @click="onDispatchCar()" shape="circle" color="#2E75E6" v-if="shouldShowDispatchButton" text="派车"></u-button>
<u-button @click="onEmptyBox()" shape="circle" color="#2E75E6" customStyle="margin-left: 20rpx;" text="已提空箱"></u-button> <u-button @click="deliveryArrival()" shape="circle" color="#2E75E6" customStyle="margin-left: 20rpx;" v-if="shouldShowDeliveryArrivalButton" text="已到厂"></u-button>
<u-button @click="deliveryArrival()" shape="circle" color="#2E75E6" customStyle="margin-left: 20rpx;" text="已到厂"></u-button> <u-button @click="warehouseShipment()" shape="circle" color="#2E75E6" text="仓库已发货" customStyle="margin-left: 20rpx;" v-if="shouldShowwarehouseShipmentButton" ></u-button>
</view>
<view class="section_8">
<u-button @click="onEmptyBox()" shape="circle" color="#2E75E6" customStyle="margin-left: 20rpx;" v-if="shouldShowEmptyBoxButton" text="已提空箱"></u-button>
<u-button @click="arrivalPort()" shape="circle" color="#2E75E6" text="进港(到目的地)" v-if="shouldShowarrivalPortButton" customStyle="margin-left: 20rpx;"></u-button>
<u-button @click="loadedOnVessel()" shape="circle" color="#2E75E6" text="装船完成" v-if="shouldShowloadedOnVesselButton" customStyle="margin-left: 20rpx;"></u-button>
</view>
<view class="section_8">
<u-button @click="vesselDeparture()" shape="circle" color="#2E75E6" text="开船" v-if="shouldShowvesselDepartureButton" ></u-button>
<u-button @click="vesselArrival()" shape="circle" color="#2E75E6" text="到达目的港" v-if="shouldShowvesselArrivalButton" customStyle="margin-left: 20rpx;"></u-button>
<u-button @click="customsClearance()" shape="circle" color="#2E75E6" customStyle="margin-left: 20rpx;" v-if="shouldShowcustomsClearanceButton" text="清关完成"></u-button>
</view> </view>
<view class="section_9"> <view class="section_9">
<u-button @click="warehouseShipment()" shape="circle" color="#2E75E6" text="仓库已发货"></u-button> <u-button @click="outGate()" shape="circle" color="#2E75E6" text="已提重箱" v-if="shouldShowoutGateButton" ></u-button>
<u-button @click="arrivalPort()" shape="circle" color="#2E75E6" text="进港(到目的地)" customStyle="margin-left: 20rpx;"></u-button> <u-button @click="emptyCommitted()" shape="circle" color="#2E75E6" text="已还箱" v-if="shouldShowemptyCommittedButton" customStyle="margin-left: 20rpx;"></u-button>
<u-button @click="report()" shape="circle" color="#2E75E6" text="在途上报" v-if="shouldShowreportButton" customStyle="margin-left: 20rpx;"></u-button>
<u-button @click="onAbnormalEvents()" shape="circle" color="#2E75E6" customStyle="margin-left: 20rpx;" text="异常上报"></u-button> <u-button @click="onAbnormalEvents()" shape="circle" color="#2E75E6" customStyle="margin-left: 20rpx;" text="异常上报"></u-button>
</view> </view>
</view> </view>
...@@ -101,6 +114,120 @@ ...@@ -101,6 +114,120 @@
<button class="submitBtn common_btn" @click="onSubmitForm('truck_entry')">确认</button> <button class="submitBtn common_btn" @click="onSubmitForm('truck_entry')">确认</button>
</view> </view>
</u-popup> </u-popup>
<!-- 装船完成弹框 -->
<u-popup :show="visible3" @close="closeProcess3" @open="open" mode="center" :round="10" :safeAreaInsetBottom="0">
<view class="model_box">
<u--form :model="formData" :rules="rules" ref="myForm" errorType='none'>
<view class="basic-info">
<u-form-item prop="actual_shipment_time" required label="装船完成时间" labelWidth="30%" borderBottom>
<view @click="onVisibleDate('actual_shipment_time')">
<u-input :disabledColor="'#ffffff'" disabled border="none" readonly placeholder="请选择装船完成时间"
:value="formatDate(formData.actual_shipment_time)" />
</view>
</u-form-item>
</view>
</u--form>
</view>
<view class="operation-btn flex_sb">
<button class="backBtn common_btn" @click="closeProcess3">取消</button>
<button class="submitBtn common_btn" @click="onSubmitForm('loaded_on_vessel')">确认</button>
</view>
</u-popup>
<!-- 开船完成弹框 -->
<u-popup :show="visible4" @close="closeProcess4" @open="open" mode="center" :round="10" :safeAreaInsetBottom="0">
<view class="model_box">
<u--form :model="formData" :rules="rules" ref="myForm" errorType='none'>
<view class="basic-info">
<u-form-item prop="m_atd" required label="实际开船时间" labelWidth="30%" borderBottom>
<view @click="onVisibleDate('m_atd')">
<u-input :disabledColor="'#ffffff'" disabled border="none" readonly placeholder="请选择实际开船时间"
:value="formatDate(formData.m_atd)" />
</view>
</u-form-item>
</view>
</u--form>
</view>
<view class="operation-btn flex_sb">
<button class="backBtn common_btn" @click="closeProcess4">取消</button>
<button class="submitBtn common_btn" @click="onSubmitForm('vessel_departure')">确认</button>
</view>
</u-popup>
<!-- 到达目的港弹框 -->
<u-popup :show="visible5" @close="closeProcess5" @open="open" mode="center" :round="10" :safeAreaInsetBottom="0">
<view class="model_box">
<u--form :model="formData" :rules="rules" ref="myForm" errorType='none'>
<view class="basic-info">
<u-form-item prop="m_ata" required label="实际到港时间" labelWidth="30%" borderBottom>
<view @click="onVisibleDate('m_ata')">
<u-input :disabledColor="'#ffffff'" disabled border="none" readonly placeholder="请选择实际到港时间"
:value="formatDate(formData.m_ata)" />
</view>
</u-form-item>
</view>
</u--form>
</view>
<view class="operation-btn flex_sb">
<button class="backBtn common_btn" @click="closeProcess5">取消</button>
<button class="submitBtn common_btn" @click="onSubmitForm('vessel_arrival')">确认</button>
</view>
</u-popup>
<!-- 清关完成弹框 -->
<u-popup :show="visible6" @close="closeProcess6" @open="open" mode="center" :round="10" :safeAreaInsetBottom="0">
<view class="model_box">
<u--form :model="formData" :rules="rules" ref="myForm" errorType='none'>
<view class="basic-info">
<u-form-item prop="actual_clearance_time" required label="实际清关时间" labelWidth="30%" borderBottom>
<view @click="onVisibleDate('actual_clearance_time')">
<u-input :disabledColor="'#ffffff'" disabled border="none" readonly placeholder="请选择实际清关时间"
:value="formatDate(formData.actual_clearance_time)" />
</view>
</u-form-item>
</view>
</u--form>
</view>
<view class="operation-btn flex_sb">
<button class="backBtn common_btn" @click="closeProcess6">取消</button>
<button class="submitBtn common_btn" @click="onSubmitForm('customs_clearance')">确认</button>
</view>
</u-popup>
<!-- 已提重箱弹框 -->
<u-popup :show="visible7" @close="closeProcess7" @open="open" mode="center" :round="10" :safeAreaInsetBottom="0">
<view class="model_box">
<u--form :model="formData" :rules="rules" ref="myForm" errorType='none'>
<view class="basic-info">
<u-form-item prop="destination_pickup_time" required label="提重箱时间" labelWidth="30%" borderBottom>
<view @click="onVisibleDate('destination_pickup_time')">
<u-input :disabledColor="'#ffffff'" disabled border="none" readonly placeholder="请选择提重箱时间"
:value="formatDate(formData.destination_pickup_time)" />
</view>
</u-form-item>
</view>
</u--form>
</view>
<view class="operation-btn flex_sb">
<button class="backBtn common_btn" @click="closeProcess7">取消</button>
<button class="submitBtn common_btn" @click="onSubmitForm('out_gate')">确认</button>
</view>
</u-popup>
<!-- 还空箱弹框 -->
<u-popup :show="visible8" @close="closeProcess8" @open="open" mode="center" :round="10" :safeAreaInsetBottom="0">
<view class="model_box">
<u--form :model="formData" :rules="rules" ref="myForm" errorType='none'>
<view class="basic-info">
<u-form-item prop="back_empty_box_time" required label="还空箱时间" labelWidth="30%" borderBottom>
<view @click="onVisibleDate('back_empty_box_time')">
<u-input :disabledColor="'#ffffff'" disabled border="none" readonly placeholder="请选择还空箱时间"
:value="formatDate(formData.back_empty_box_time)" />
</view>
</u-form-item>
</view>
</u--form>
</view>
<view class="operation-btn flex_sb">
<button class="backBtn common_btn" @click="closeProcess8">取消</button>
<button class="submitBtn common_btn" @click="onSubmitForm('empty_committed')">确认</button>
</view>
</u-popup>
<!-- 时间选择 --> <!-- 时间选择 -->
<bs-datetimePicker ref="myTimePicker" :visible="showPopup" @onVisible="onVisibleDate" dateType="datetime" <bs-datetimePicker ref="myTimePicker" :visible="showPopup" @onVisible="onVisibleDate" dateType="datetime"
@onSelsectDate="onSelsectDate" /> @onSelsectDate="onSelsectDate" />
...@@ -128,18 +255,95 @@ ...@@ -128,18 +255,95 @@
visible:false,//到厂 visible:false,//到厂
visible1:false,//仓库发货 visible1:false,//仓库发货
visible2:false,//进港 visible2:false,//进港
visible3:false,//装船完成
visible4:false,//开船
visible5:false,//到达目的港
visible6:false,//清关完成
visible7:false,//已提重箱
visible8:false,//已提空箱
showPopup: false, //时间选择 showPopup: false, //时间选择
formData: { formData: {
actual_arrival_factory_time: "", //实际到达时间 actual_arrival_factory_time: "", //实际到达时间
local_atd:"",//实际发货时间 local_atd:"",//实际发货时间
local_ata:"",//实际进港时间 local_ata:"",//实际进港时间
actual_shipment_time:"",//装船完成时间
m_atd:"",//开船时间
m_ata:"",//实际到港时间
actual_clearance_time:"",//实际清关时间
destination_pickup_time:"",//提重箱时间
back_empty_box_time:""//实际还箱时间
}, },
rules: { rules: {
'local_atd': { required: true },//实际发货时间 'local_atd': { required: true },//实际发货时间
'local_ata': { required: true }, //实际进港时间 'local_ata': { required: true }, //实际进港时间
'actual_arrival_factory_time':{ required: true }, 'actual_arrival_factory_time':{ required: true },
}, },
shipment_type:'',
multi_shipment_type:false
}
},
computed: {
// 计算属性:判断是否显示派车按钮
shouldShowDispatchButton() {
const validTypes = ['国内直达', '国际直达', '拖车段'];
return validTypes.includes(this.shipment_type) && !this.multi_shipment_type;
},
//已到厂
shouldShowDeliveryArrivalButton(){
const validTypes = ['国内直达', '国际直达', '拖车段'];
return validTypes.includes(this.shipment_type) && !this.multi_shipment_type;
},
//已提空箱
shouldShowEmptyBoxButton(){
const validTypes = ['国际直达', '拖车段'];
return validTypes.includes(this.shipment_type) && !this.multi_shipment_type;
},
//仓库已发货
shouldShowwarehouseShipmentButton(){
const validTypes = ['国内直达', '国际直达', '拖车段'];
return validTypes.includes(this.shipment_type) && !this.multi_shipment_type;
},
//进港(到目的地)
shouldShowarrivalPortButton(){
const validTypes = ['国内直达', '国际直达', '拖车段','海铁空'];
return validTypes.includes(this.shipment_type) && !this.multi_shipment_type;
},
//装船完成节点
shouldShowloadedOnVesselButton(){
const validTypes = [ '国际直达','海铁空'];
return validTypes.includes(this.shipment_type) && !this.multi_shipment_type;
},
//开船节点
shouldShowvesselDepartureButton(){
const validTypes = [ '国际直达','海铁空'];
return validTypes.includes(this.shipment_type) && !this.multi_shipment_type;
},
//到达目的港
shouldShowvesselArrivalButton(){
const validTypes = [ '国际直达','海铁空'];
return validTypes.includes(this.shipment_type) && !this.multi_shipment_type;
},
//清关完成
shouldShowcustomsClearanceButton(){
const validTypes = [ '国际直达','海铁空'];
return validTypes.includes(this.shipment_type) && !this.multi_shipment_type;
},
//已提重箱
shouldShowoutGateButton(){
const validTypes = [ '国际直达','海铁空'];
return validTypes.includes(this.shipment_type) && !this.multi_shipment_type;
},
//已还箱
shouldShowemptyCommittedButton(){
const validTypes = [ '国际直达','海铁空'];
return validTypes.includes(this.shipment_type) && !this.multi_shipment_type;
},
//在途上报
shouldShowreportButton(){
const validTypes = [ '国内直达'];
return validTypes.includes(this.shipment_type) && !this.multi_shipment_type;
} }
}, },
/*onLoad(options) { /*onLoad(options) {
const time = setInterval(() => { const time = setInterval(() => {
...@@ -173,9 +377,31 @@ ...@@ -173,9 +377,31 @@
this.sum = e.length this.sum = e.length
this.message = e this.message = e
this.message.length=e.length this.message.length=e.length
this.shipment_type=""
this.multi_shipment_type=false
if(e.length>=1){
if(e[0].shipment_type == 1 && (e[0].order_type.indexOf('国内')>=0)){
this.shipment_type='国内直达'
}else if(e[0].shipment_type == 1 && (e[0].order_type.indexOf('国际')>=0)){
this.shipment_type='国际直达'
}else if(e[0].shipment_type == 2){
this.shipment_type='拖车段'
}else if(e[0].shipment_type == 3 || e[0].shipment_type == 6 || e[0].shipment_type == 5){
this.shipment_type='海铁空'
}
e.forEach((item, index) => {
if(item.shipment_type!=e[0].shipment_type || (item.shipment_type == 1 && e[0].shipment_type == 1 && e[0].order_type!=item.order_type)){
this.multi_shipment_type=true
}
});
}
console.log("选择的运输类型为"+this.shipment_type)
console.log("勾选的是否多类型"+this.multi_shipment_type)
}, },
//初始化数据 //初始化数据
initData() { initData() {
this.shipment_type=""
this.multi_shipment_type=false
const { pageNum, pageSize } = this const { pageNum, pageSize } = this
let reqData = { let reqData = {
"args": { pageNum, pageSize } "args": { pageNum, pageSize }
...@@ -219,6 +445,23 @@ ...@@ -219,6 +445,23 @@
}) })
} }
}, },
//在途上报
report(){
this.choose = []
if (this.message.length >0) {
this.choose = this.message
getApp().globalData.choose = this.choose
uni.navigateTo({
url: `/subpkg/shipmentReport/shipmentReport`,
})
} else {
uni.showToast({
title: "请选择运单",
duration: 3000,
icon: 'error'
})
}
},
//提空箱操作-支架 //提空箱操作-支架
onEmptyBox(){ onEmptyBox(){
this.choose = [] this.choose = []
...@@ -268,6 +511,30 @@ ...@@ -268,6 +511,30 @@
if(this.formData.local_ata){ if(this.formData.local_ata){
this.formData.local_ata= this.formatDate(this.formData.local_ata) this.formData.local_ata= this.formatDate(this.formData.local_ata)
} }
//装船完成时间
if(this.formData.actual_shipment_time){
this.formData.actual_shipment_time= this.formatDate(this.formData.actual_shipment_time)
}
//开船时间
if(this.formData.m_atd){
this.formData.m_atd= this.formatDate(this.formData.m_atd)
}
//实际到港时间
if(this.formData.m_ata){
this.formData.m_ata= this.formatDate(this.formData.m_ata)
}
//实际清关时间
if(this.formData.actual_clearance_time){
this.formData.actual_clearance_time= this.formatDate(this.formData.actual_clearance_time)
}
//提重箱时间
if(this.formData.destination_pickup_time){
this.formData.destination_pickup_time= this.formatDate(this.formData.destination_pickup_time)
}
//实际还箱时间
if(this.formData.back_empty_box_time){
this.formData.back_empty_box_time= this.formatDate(this.formData.back_empty_box_time)
}
var baseData = { var baseData = {
"aux": { "aux": {
"rows":rows, "rows":rows,
...@@ -288,9 +555,21 @@ ...@@ -288,9 +555,21 @@
this.closeProcess1(); this.closeProcess1();
}else if(type=="truck_entry"){ }else if(type=="truck_entry"){
this.closeProcess2(); this.closeProcess2();
}else if(type=='loaded_on_vessel'){
this.closeProcess3();
}else if(type=='vessel_departure'){
this.closeProcess4();
}else if(type=='vessel_arrival'){
this.closeProcess5();
}else if(type=='customs_clearance'){
this.closeProcess6();
}else if(type=='out_gate'){
this.closeProcess7();
}else if(type=='empty_committed'){
this.closeProcess8();
} }
setTimeout(() => { setTimeout(() => {
that.$emit('onReload') this.onReload()
}, 1000) }, 1000)
} }
}) })
...@@ -360,6 +639,36 @@ ...@@ -360,6 +639,36 @@
this.visible2 = false; this.visible2 = false;
this.formData.local_ata=""; this.formData.local_ata="";
}, },
//装船完成关闭弹框
closeProcess3() {
this.visible3 = false;
this.actual_shipment_time="";
},
//开船关闭弹框
closeProcess4() {
this.visible4 = false;
this.m_atd="";
},
//实际到港关闭弹框
closeProcess5() {
this.visible5 = false;
this.m_ata="";
},
//实际清关关闭弹框
closeProcess6() {
this.visible6 = false;
this.actual_clearance_time="";
},
//提重箱关闭弹框
closeProcess7() {
this.visible7 = false;
this.destination_pickup_time="";
},
//还箱关闭弹框
closeProcess8() {
this.visible8 = false;
this.back_empty_box_time="";
},
//关闭时间选择框 //关闭时间选择框
onVisibleDate(type) { onVisibleDate(type) {
if (type) { if (type) {
...@@ -388,6 +697,8 @@ ...@@ -388,6 +697,8 @@
onReload() { onReload() {
this.pageNum = 1 this.pageNum = 1
this.shipmentOrders = [] this.shipmentOrders = []
this.shipment_type=""
this.multi_shipment_type=false
this.initData() this.initData()
}, },
// 时间选择 // 时间选择
...@@ -444,6 +755,91 @@ ...@@ -444,6 +755,91 @@
return `${year}-${ month}-${date} ${hour}:${ minute}:${seconds}` return `${year}-${ month}-${date} ${hour}:${ minute}:${seconds}`
} }
}, },
//装船完成显示弹出框
loadedOnVessel(){
this.choose = []
if (this.message.length >0) {
this.choose = this.message
this.visible3 = true;
} else {
uni.showToast({
title: "请选择运单",
duration: 3000,
icon: 'error'
})
}
},
//开船显示弹出框
vesselDeparture(){
this.choose = []
if (this.message.length >0) {
this.choose = this.message
this.visible4 = true;
} else {
uni.showToast({
title: "请选择运单",
duration: 3000,
icon: 'error'
})
}
},
//到达目的港显示弹出框
vesselArrival(){
this.choose = []
if (this.message.length >0) {
this.choose = this.message
this.visible5 = true;
} else {
uni.showToast({
title: "请选择运单",
duration: 3000,
icon: 'error'
})
}
},
//清关完成显示弹出框
customsClearance(){
this.choose = []
if (this.message.length >0) {
this.choose = this.message
this.visible6 = true;
} else {
uni.showToast({
title: "请选择运单",
duration: 3000,
icon: 'error'
})
}
},
//已提重箱显示弹出框
outGate(){
this.choose = []
if (this.message.length >0) {
this.choose = this.message
this.visible7 = true;
} else {
uni.showToast({
title: "请选择运单",
duration: 3000,
icon: 'error'
})
}
},
//已提空箱显示弹出框
emptyCommitted(){
this.choose = []
if (this.message.length >0) {
this.choose = this.message
this.visible8 = true;
} else {
uni.showToast({
title: "请选择运单",
duration: 3000,
icon: 'error'
})
}
},
} }
} }
</script> </script>
......
...@@ -368,6 +368,17 @@ ...@@ -368,6 +368,17 @@
this.formData[key] = ''; // 清空对应字段 this.formData[key] = ''; // 清空对应字段
this.$refs.myForm.clearValidate(key); // 清除表单验证状态(如果有) this.$refs.myForm.clearValidate(key); // 清除表单验证状态(如果有)
}, },
onNavBack() {
uni.navigateBack({
delta: 1, // 返回的页面数,如果是1则表示返回上一页,默认为1
success: () => {
console.log('返回成功');
},
fail: (err) => {
console.error('返回失败:', err);
}
});
}
} }
} }
</script> </script>
......
<template>
<view class="shipmentDispatch-list content_box">
<view class="shipmentDispatch-item">
<!-- 基本信息 -->
<view class="module-title flex">
<text class="font_bolder">在途上报信息</text>
</view>
<!-- 注册内容 -->
<u--form :model="formData" :rules="rules" ref="myForm" errorType='none'>
<view class="basic-info">
<u-form-item prop="report_explain" label="事件内容" labelWidth="25%" borderBottom>
<u-textarea
:disabledColor="'#ffffff'"
border="none"
v-model="formData.report_explain"
:rows="4"
/>
</u-form-item>
<u-form-item prop="report_location" required label="上报地点" labelWidth="25%" borderBottom>
<u-input :disabledColor="'#ffffff'" border="none" v-model="formData.report_location" />
</u-form-item>
<u-form-item prop="report_time" required label="上报时间" labelWidth="35%" borderBottom>
<view @click="onVisibleDate('report_time')">
<u-input
:disabledColor="'#ffffff'"
disabled
border="none"
readonly
placeholder="请选择上报时间"
:value="convertTimeHh24(formData.report_time)"
>
<!-- 使用 suffix 插槽添加清除图标 -->
<template #suffix>
<view v-if="formData.report_time" @click.stop="clearDate('report_time')">
<u-icon name="close-circle-fill" size="24" color="#909399" />
</view>
</template>
</u-input>
</view>
</u-form-item>
</view>
</u--form>
</view>
<!-- 底部按钮 -->
<view class="operation-btn flex_sb">
<button class="backBtn common_btn" @click="onNavBack">返回</button>
<button class="submitBtn common_btn" @click="onSubmitForm">确认</button>
</view>
<!-- 时间选择 -->
<bs-datetimePicker ref="myTimePicker" :visible="showPopup" @onVisible="onVisibleDate"
@onSelsectDate="onSelsectDate" dateType="datetime"/>
</view>
</template>
<script>
import {getMassShipmentTruckList} from '../../api/apiList.js'
export default {
name: 'shipmentReport',
options: { styleIsolation: 'shared' },
data() {
return {
pageNum: 1, //页码
pageSize: 10, //每页条数
isEmpty: true, //是否为空
rows: [], //当前展开面板
formData: {
report_explain: "", //事件内容
report_location: "", //上报地点
report_time: "", //上报时间
},
rules: {
'report_location': { required: true }, //上报地点
'report_time': { required: true } //上报时间
},
showPopup: false, //时间选择
visibleKey: '', //当前显示字段的key
optionEnums: [], //候选项枚举
popTitle: '', //弹窗标题
visible: false, //类型选择
visible1: false, //类型选择
visible2:false,
viewEnums:[],//车辆枚举视图
driverViewEnums:[],//司机方式枚举
searchValue: "", //搜索值--车辆
searchValue1: "", //搜索值--司机
selectEnum:[],//接受返回值
selectEnum1:[],//接受返回值
currentChecked:'',
currentChecked1:'',
placeholder: "请输入搜索车牌号", //默认提示
placeholder1: "请输入搜索司机", //默认提示
carrier:''
}
},
onLoad(options) {
const data = getApp().globalData.choose;//勾选的数据
const isEmpty = !Object.keys(data).length
},
methods: {
// 提交表单数据
onSubmitForm() {
const rows = getApp().globalData.choose;
this.formData.rows= rows;
this.formData.ship_event_code="report";//派车接单
this.formData.report_time= this.convertTimeHh24(this.formData.report_time)
console.log(this.formData)
var baseData = {
"aux": {
"rows":rows,
"aux":this.formData,
},
}
//在途上报操作
getMassShipmentTruckList(baseData).then(res => {
if (res.data.data.messageType === 'success') {
uni.showToast({
title: '操作成功!',
duration: 1000
})
setTimeout(() => {
uni.navigateBack()
}, 1500)
}
})
},
//设置显示枚举
setViewEnums(optionEnums, key) {
let viewEnums = {}
optionEnums.map(item => {
viewEnums[item.value] = item.label
})
this[key] = viewEnums
},
//确认选择
onConfirmPicker(value) {
this.setFormData(value)
this.visible = false
this.visible1 = false
this.visible2 = false
},
//页面展示时间戳转换为日期
convertTime(timestamp) {
if (!timestamp) return
const nowDate = new Date(timestamp)
var year = nowDate.getFullYear();
var month = nowDate.getMonth() + 1;
var date = nowDate.getDate();
return `${year}-${ month}-${date}`
},
//页面展示时间戳转换为年月日时分秒
convertTimeHh24(timestamp) {
if (!timestamp) return
const nowDate = new Date(timestamp)
var year = nowDate.getFullYear();
var month = nowDate.getMonth() < 9 ? '0' + (nowDate.getMonth() + 1) : nowDate.getMonth() + 1;
var date = nowDate.getDate() < 10 ? '0' + nowDate.getDate() : nowDate.getDate();
var hour = nowDate.getHours() < 10 ? '0' + nowDate.getHours() : nowDate.getHours();
var minute = nowDate.getMinutes() < 10 ? '0' + nowDate.getMinutes() : nowDate.getMinutes();
var second = nowDate.getSeconds() < 10 ? '0' + nowDate.getSeconds() : nowDate.getSeconds();
return `${year}-${month}-${date} ${hour}:${minute}:${second}`
},
//设置formData
setFormData(value) {
//情况时间
const key = this.visibleKey
if (key.includes('.')) { //对象特殊处理
const keys = key.split('.')
this.formData[keys[0]][keys[1]] = value
} else {
this.formData[key] = value
}
},
clearDate(key) {
this.formData[key] = ''; // 清空对应字段
this.$refs.myForm.clearValidate(key); // 清除表单验证状态(如果有)
},
onVisibleDate(type) {
if (type) {
this.visibleKey = type
}
this.showPopup = !this.showPopup
},
// 时间选择
onSelsectDate(dateInfo) {
const {
timestamp
} = dateInfo
this.setFormData(timestamp)
this.showPopup = false
},
onNavBack() {
uni.navigateBack({
delta: 1, // 返回的页面数,如果是1则表示返回上一页,默认为1
success: () => {
console.log('返回成功');
},
fail: (err) => {
console.error('返回失败:', err);
}
});
}
}
}
</script>
<style lang="scss">
.shipmentDispatch-list {
.module-title {
margin-top: 20rpx;
//padding: 15rpx 0rpx 16rpx;
//background-color:#a2a2a2;
.vertical-separate {
height: 40rpx;
border-left: 7rpx solid #797979;
margin-right: 20rpx;
}
}
.select-container {
min-width: 70vw;
height: 50vh;
padding: 30rpx;
font-weight: 400;
.popTitle {
color: #8C8C8C;
font-size: 32rpx;
text-align: center;
margin-bottom: 44rpx;
}
.select-list{
height: 460rpx;
}
}
.shipmentDispatch-item {
padding: 32rpx;
margin-bottom: 24rpx;
background: #FFFFFF;
.detail-title {
font-size: 28rpx;
padding: 8rpx 0 30rpx;
border-bottom: 1rpx solid #E5E5E5;
.t-icon-order {
width: 50rpx;
height: 50rpx;
margin-right: 20rpx;
}
}
/deep/.custom-cell-row {
margin-top: 10rpx;
.custom-cell-label {
color: #8C8C8C;
}
}
.outer-frame {
margin-top: 32rpx;
border-radius: 16rpx;
border: 2rpx solid #F0F0F0;
overflow: hidden;
.foldPanel-title {
color: #2E75E6;
font-size: 28rpx;
padding-left: 20rpx;
height: 96rpx;
background: rgba(46, 117, 230, .1);
.foldPanel-right-icon {
margin-right: 20rpx;
}
}
/deep/.cargo-detail-table {
background: #FFFFFF;
padding-bottom: 10rpx;
.detail-row-title {
color: #8C8C8C;
background: #FAFAFA;
padding: 20rpx 0;
}
.detail-col-item {
margin: 20rpx;
.cargo-title {
font-size: 28rpx;
padding-left: 20rpx;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
}
}
}
}
.snapshoot image {
margin: 20rpx 15rpx;
width: 140rpx;
height: 140rpx;
}
/deep/.basic-info,
/deep/.driving-license {
padding: 0 10rpx;
background-color: #ffffff;
.input-tip {
font-size: 28rpx;
color: #BFBFBF;
}
.u-form-item__body__left__content__label {
color: #8C8C8C;
font-size: 28rpx;
}
.u-form-item__body {
padding: 25rpx 0;
}
.u-icon {
margin-left: 20rpx;
}
.u-upload__wrap>view {
width: 100%;
}
.previewImages {
width: 100%;
.previewImg {
width: 100% !important;
height: 240rpx !important;
}
}
.uploadeBtn {
width: 100% !important;
height: 240rpx !important;
margin-bottom: 30rpx;
margin-left: 0 !important;
}
.orderTotal {
display: none;
}
}
}
</style>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment