Commit b1172282 authored by 贺世双's avatar 贺世双

新增运单

parent 8e475743
......@@ -50,7 +50,7 @@ export function downloadImg(data) {
//获取基础订单信息--订舱委托
export function getOrderBaseList(data) {
return Request(`/api/entry/{mini}/m-action/getBookingOrder`, data);
return Request(`/api/entry/{mini}/m-action/getBookingOrder`, data);
}
// 查询订舱委托订单明细
......@@ -65,20 +65,54 @@ export function getOrderBaseEvent(data) {
}
// 查询所有船公司信息
export function queryShipownerAll(data) {
return Request(`/api/entry/{mini}/m-action/getShipownerAll`, data);
}
// 订舱确认操作
export function updateTmBlEvent(data) {
return Request(`/api/entry/{mini}/m-action/updateTmBlEvent`, data);
}
// 修改船期操作
export function changeShippingDateSubmit(data) {
return Request(`/api/entry/{mini}/m-action/changeShippingDateSubmit`, data);
}
// 提货单上传操作
export function getLadingUpload(data) {
return Request(`/api/entry/{mini}/m-action/getLadingUpload`, data);
}
//查询运单列表
export function findShipmentOrders(data) {
return Request(
`/api/entry/{mini}/m-action/biz.tm.Shipment.tm_shipment_m_carrier.paging`,
data
);
export function getShipmentOrders(data) {
return Request( `/api/entry/{mini}/m-action/getShipmentOrders`, data);
}
//查询运单详情
export function findShipmentDetail(data) {
return Request(
`/api/entry/{mini}/m-action/biz.tm.Shipment.tm_shipment_m_carrier_page.get`,
data
);
// 查询运单的所有节点信息
export function getShipmentEvent(data) {
return Request(`/api/entry/{mini}/m-action/getShipmentEvent`, data);
}
//查询司机列表
export function searchDriverList(data) {
return Request(`/api/entry/{mini}/m-action/getDriverAll`,data);
}
//查询车辆列表
export function searchTruckList(data) {
return Request(`/api/entry/{mini}/m-action/getVehicleAll`, data);
}
//派车确认
export function getMassShipmentTruckList(data) {
return Request(`/api/entry/{mini}/m-action/getMassShipmentTruckList`, data );
}
//查询运单途径站点
export function findShipmentStops(data) {
return Request(
......@@ -123,20 +157,7 @@ export function queryTruckType(data) {
);
}
//查询司机列表
export function searchDriverList(data) {
return Request(
`/api/entry/{mini}/m-action/biz.md.Driver.md_driver_m_search.paging`,
data
);
}
//查询车辆列表
export function searchTruckList(data) {
return Request(
`/api/entry/{mini}/m-action/biz.md.Truck.md_truck_m_search.paging`,
data
);
}
//查询道口
export function searchDockList(data) {
return Request(
......@@ -249,13 +270,7 @@ export function UpdateTruckInfo(data) {
//获取大宗订单已分配车辆
export function getMassOrderTruckList(data) {
return Request(
`/api/entry/{mini}/m-action/biz.tm.MassOrderTruck.tm_massordertruck_m_search.paging`,
data
);
}
//大宗订单车辆分配 assignType: 分配单辆车:assignTruck 分配多量车:assignTrucks
export function massAssignTruck(data, assignType) {
......
......@@ -4,6 +4,9 @@
<view class="consumer_code flex_center">
<text selectable> 基础订单号:{{propData['order_base_no'] || ''}}</text>
</view>
<view :class="propData.execute_bu == null ? 'shipment-state' : 'shipment-state shipmenting'">
{{propData.execute_bu}}
</view>
</view>
<u-line color="#E5E5E5" margin="20rpx 0" />
<view style="padding: 0 24rpx 32rpx;" @click="toOrderDetail">
......@@ -12,7 +15,7 @@
<bs-customCell label="起运港 :" :value="propData.port_of_source_location_name" labelCol="4" wrapCol="6" />
</view>
<view style="width: 50%;float: left;">
<bs-customCell label="目的港 :" :value="propData.port_of_dest_location_name" labelCol="4" wrapCol="6" />
<bs-customCell label="目的港 :" :value="propData.port_of_dest_location_name" labelCol="4" wrapCol="8" />
</view>
</view>
<view class=" flex_sb">
......@@ -34,10 +37,10 @@
<bs-customCell label="承运商 :" :value="propData.carrier" labelCol="2" wrapCol="6" />
</view>
<view class="flex_cen flex_center orderItemButtonGroup">
<button class="flex_cen flex_center" @click="onAllotCar('unMulti')">订舱确认</button>
<button class="flex_cen flex_center" @click="onAllotCar('multi')">提单上传</button>
<button class="flex_cen flex_center" style="margin-top: 24rpx;" @click="onAllotCar('record')">修改船期</button>
<button class="flex_cen flex_center" @click="onAllotCar('multi')">异常上报</button>
<button class="flex_cen flex_center" @click="onBookingConfirm()">订舱确认</button>
<button class="flex_cen flex_center" @click="onLadingUpload()">提单上传</button>
<button class="flex_cen flex_center" style="margin-top: 24rpx;" @click="onChangeShippingDate()">修改船期</button>
<button class="flex_cen flex_center" @click="onAbnormalEvent()">异常上报</button>
</view>
</view>
......@@ -62,11 +65,32 @@
url: `/subpkg/orderDetail/orderDetail`,
})
},
onAllotCar(allotType) {
const orderNo = this.propData['massOrder.orderNo']
const orderId = this.propData['id']
//跳转订舱确认界面
onBookingConfirm() {
getApp().globalData.bookingConfirm = this.propData
uni.navigateTo({
url: `/subpkg/bookingConfirm/bookingConfirm`,
})
},
//跳转修改船期界面
onChangeShippingDate() {
getApp().globalData.changeShippingDate = this.propData
uni.navigateTo({
url: `/subpkg/changeShippingDate/changeShippingDate`,
})
},
//跳转提单上传界面
onLadingUpload() {
getApp().globalData.ladingUpload = this.propData
uni.navigateTo({
url: `/subpkg/ladingUpload/ladingUpload`,
})
},
//跳转异常反馈界面
onAbnormalEvent() {
getApp().globalData.abnormalEvent = this.propData
uni.navigateTo({
url: `/subpkg/allotCars/allotCars?orderId=${orderId}&orderNo=${orderNo}&allotType=${allotType}`,
url: `/subpkg/abnormalEvent/abnormalEvent`,
})
},
},
......
<template>
<view class="shipmentItem box_shadow_card" @click="navToShipmentDetail">
<view class="shipment-header flex_sb" style="padding: 28rpx 24rpx 0;">
<u-checkbox iconSize="20rpx" shape="circle" size="20px" :name="propData" :checked="propData.checked">
</u-checkbox>
<view class="consumer_code flex_center">
<text selectable> 运单号:{{propData.shipmentNo}}</text>
<text selectable> 运单号:{{propData.shipment_no}}</text>
</view>
<view :class="propData.shipmentStatus ==='Approved' ? 'shipment-state' : 'shipment-state shipmenting'">
{{propData.shipmentStatusLabel}}
<view :class="propData.execute_bu == null ? 'shipment-state' : 'shipment-state shipmenting'">
{{propData.execute_bu}}
</view>
</view>
<u-line color="#E5E5E5" margin="20rpx 0" />
<view style="padding: 0 24rpx 32rpx;">
<view class="stations">
<view class="stations">
<view class="start-station flex_center">
<view class="t-icon-start-sddress t-icon" style="margin-right: 8rpx;"></view>
{{propData['original.name'] || ''}}
{{propData['source_location_name'] || ''}}
</view>
<view class="end-station flex_center">
<view class="t-icon-end-sddress t-icon" style="margin-right: 8rpx;"></view>
{{propData['destination.name'] || ''}}
{{propData['dest_location_name'] || ''}}
</view>
</view>
<bs-customCell label="要求提货日期 :" :value="propData.early_pickup_date" labelCol="3.5" wrapCol="6" />
<view class=" flex_sb">
<view style="width: 50%;float: left;">
<bs-customCell label="车牌号 :" :value="propData.truck_no" labelCol="4" wrapCol="6" />
</view>
<view style="width: 50%;float: left;">
<bs-customCell label="司机 :" :value="propData.driver_name" labelCol="3" wrapCol="8" />
</view>
</view>
<view class=" flex_sb">
<view style="width: 50%;float: left;">
<bs-customCell label="承运商 :" :value="propData.carrier" labelCol="4" wrapCol="6" />
</view>
<view style="width: 50%;float: left;">
<bs-customCell label="司机电话 :" :value="propData.driver_tel" labelCol="5" wrapCol="8" />
</view>
</view>
<bs-customCell label="发运日期 :" :value="propData.shipmentDate" labelCol="3" wrapCol="6" />
<!-- <customCell label="运输时效" :value="propData.shipTime || '0天'" labelCol="4" wrapCol="6" /> -->
<template v-if="0">
<bs-customCell label="司机名" :value="propData['driver1.tel']" labelCol="2" wrapCol="10" />
<bs-customCell label="车牌号" :value="propData['truck.name']" labelCol="2" wrapCol="10" />
</template>
<bs-customCell label="货量 :" labelCol="2" wrapCol="10" :value="`${propData.shipOrders}单 / ${propData.shipQty}件 / ${propData.shipWeight}千克 / ${propData.shipVolume}方`" />
<template v-if="propData.shipmentStatus ==='Approving'">
<view class="operationBtn flex_center flex_cen" @click.stop="onClick(propData.id, 'approve')">确认</view>
</template>
<template v-if="propData.shipmentStatus ==='Approved'">
<view class="operationBtn flex_center flex_cen" @click.stop="onClick(propData.id, 'approveCancel')">取消确认</view>
</template>
<!-- <bs-customCell label="货量 :" labelCol="2" wrapCol="10" :value="`${propData.shipOrders}单 / ${propData.shipQty}件 / ${propData.shipWeight}千克 / ${propData.shipVolume}方`" /> -->
</view>
</view>
</template>
<script>
......@@ -42,18 +51,13 @@
export default {
name: 'shipmentItem',
options: { styleIsolation: 'shared' },
props: {
propData: {
type: Object,
default: {}
},
},
props: ['propData'],
methods: {
navToShipmentDetail() {
this.onSetGlobalData()
const shipmentId = this.propData.id
//路由跳转==预约单详情界面
navToShipmentDetail() {
getApp().globalData.shipmentDetail = this.propData
wx.navigateTo({
url: `/subpkg/shipmentDetail/shipmentDetail?id=${shipmentId}`,
url: `/subpkg/shipmentDetail/shipmentDetail`,
})
},
//设置全局变量
......@@ -93,16 +97,19 @@
position: relative;
margin: 24rpx 24rpx 0;
padding: 0;
padding-bottom: 32rpx;
&/deep/.custom-cell-row {
margin-top: 20rpx;
}
.consumer_code {
line-height: 40rpx;
text-shadow: 1rpx 3rpx 12rpx rgba(0, 0, 0, 0.04);
}
margin-right: 85px;
}
.shipment-state {
font-size: 24rpx;
color: #F7A64A;
......@@ -112,18 +119,18 @@
background: rgba(247, 166, 74, .1);
text-shadow: 1rpx 3rpx 12rpx rgba(0, 0, 0, 0.04);
}
.shipmenting {
color: #66CCCC;
background: rgba(61, 204, 185, .1);
}
.start-station,
.end-station {
margin: 20rpx 0;
font-size: 30rpx;
font-weight: bolder;
.start-icon,
.end-icon {
width: 40rpx;
......@@ -135,20 +142,28 @@
background-color: #2E75E6;
margin-right: 20rpx;
}
.end-icon {
background-color: #F7A64A;
}
}
.operationBtn {
color: #FFFFFF;
padding: 20rpx;
margin-top: 32rpx;
border-radius: 44rpx;
box-shadow: 1rpx 3rpx 12rpx 0px rgba(0, 0, 0, 0.04);
background: linear-gradient(90deg, #2E75E6 0%, #5E58EE 100%);
width: 100%;
.orderItemButtonGroup {
justify-content: space-between;
padding: 0 24rpx;
flex-wrap: wrap;
button {
font-size: 32rpx;
font-weight: 500;
color: #FFFFFF;
width: 315rpx;
height: 80rpx;
margin: 0;
border-radius: 44rpx;
background: linear-gradient(90deg, #2E75E6 0%, #5E58EE 100%);
box-shadow: 1rpx 3rpx 12rpx 0rpx rgba(0, 0, 0, 0.04);
}
}
}
</style>
......@@ -95,9 +95,9 @@
"enablePullDownRefresh": false
}
}, {
"path": "reserveDockTime/reserveDockTime",
"path": "abnormalEvent/abnormalEvent",
"style": {
"navigationBarTitleText": "预约到站时间",
"navigationBarTitleText": "异常反馈",
"enablePullDownRefresh": false
}
}, {
......@@ -126,28 +126,28 @@
"disableScroll": false
}
}, {
"path": "checkTruck/checkTruck",
"path": "changeShippingDate/changeShippingDate",
"style": {
"navigationBarTitleText": "",
"navigationBarTitleText": "修改船期",
"enablePullDownRefresh": false
}
}, {
"path": "allotCars/allotCars",
"path": "bookingConfirm/bookingConfirm",
"style": {
"navigationBarTitleText": "配车确认",
"navigationBarTitleText": "订舱确认",
"enablePullDownRefresh": false
}
}, {
"path": "choiceTruck/choiceTruck",
"path": "ladingUpload/ladingUpload",
"style": {
"navigationBarTitleText": "",
"navigationBarTitleText": "提单上传",
"enablePullDownRefresh": false
}
}, {
"path": "shipmentLbs/shipmentLbs",
"path": "shipmentDispatch/shipmentDispatch",
"style": {
"navigationBarTitleText": "运单轨迹",
"navigationBarTitleText": "派车",
"enablePullDownRefresh": false,
"disableScroll": true
}
......
This diff is collapsed.
......@@ -29,8 +29,11 @@
searchValue: "", //搜索值
};
},
onLoad() {
this.initData()
onShow() {
this.pageNum = 1
this.orderList = []
this.initData()
},
//下拉刷新
onPullDownRefresh() {
......@@ -51,6 +54,8 @@
let reqData = {
"args": { pageNum, pageSize }
}
console.log('2222=============')
console.log(reqData)
if(this.searchValue){
reqData.args.restrictions = [{
"field": 'order_base_no',
......@@ -60,7 +65,7 @@
}
getOrderBaseList(reqData).then(res=>{
uni.stopPullDownRefresh()
const data = res.data.data.datas
const data = res.data.data.datas
if (data.length > 0) {
this.orderList = this.orderList.concat(data);
this.pageNum += 1
......
.t-icon {
display: inline-block;
width: 16px;
height: 16px;
width: 30px;
height: 30px;
background-repeat: no-repeat;
background-position: center;
background-size: 100%;
......
<template>
<view class="allotCars content_box">
<view class=" flex_center flex_sb allotCarsHeader">
<view>订单号:{{orderNo}}</view>
<template v-if="allotType !== 'record'">
<u-button @click="addNewCar" :disabled="orderTrucks.length || (allotType === 'multi' ? false : newTrucks.length)" text="添加新车辆"/>
</template>
</view>
<!-- 待分配车辆 -->
<template v-if="newTrucks.length">
<view style="padding: 24rpx;">
<orderTruckCard :ref='`allotTruck${newOrderTruck.id}`' v-for="(newOrderTruck, index) in newTrucks" :key="index"
:propData="newOrderTruck" :isNewAllot="true" />
</view>
</template>
<!-- 已分配车辆 -->
<template v-if="orderTrucks.length">
<view style="padding: 24rpx;">
<orderTruckCard :ref='`allotTruck${orderTruck.id}`' v-for="(orderTruck, index) in orderTrucks" :key="index" :propData="orderTruck" />
</view>
</template>
<view class="operation-btn">
<button v-if="allotType === 'record' ? orderTrucks.length === 0 : newTrucks.length === 0" :class="['submitBtn common_btn', 'disabledBtn' ]"
disabled @click="onConfirmAllot">确认分配</button>
<button v-else :class="['submitBtn common_btn']"
@click="onConfirmAllot">确认分配</button>
<!-- <button :class="['submitBtn common_btn']"
@click="onConfirmAllot">确认分配</button> -->
</view>
</view>
</template>
<script>
import { getMassOrderTruckList, massAssignTruck, updateMassAssignTruck} from '../../api/apiList.js'
export default {
data() {
return {
orderId: '', //订单Id
orderNo: '', //订单号
allotType: 'unMulti', //配车类型 单辆车:unMulti 多辆车:multi 分配记录:record
orderTrucks: [], //订单已分配车辆
deleteTruckIds: [], //订单删除已分配车辆ID列表
newTrucks: [], //新增分配车辆
pageNum: 1, //页码
pageSize: 20, //每页条数
loadMore: true, //加载更多
};
},
onLoad(option) {
const { orderId, orderNo, allotType } = option
this.orderNo = orderNo
this.orderId = orderId
this.allotType = allotType
this.onAddListener() //添加事件监听
if(allotType === 'record'){
this.initTruckList()
}
},
onUnload(){
this.onRemoveListener() //移除事件监听
},
//下拉刷新
onPullDownRefresh() {
if(this.orderTrucks.length){
this.pageNum = 1
this.orderTrucks = []
this.initTruckList()
}
},
// 触底加载更多
onReachBottom() {
if (this.loadMore && this.orderTrucks.length) {
this.initTruckList()
this.loadMore = false
}
},
methods: {
initTruckList() {
const reqData = {
"args": {
pageNum: this.pageNum,
pageSize: this.pageSize,
"restrictions": [{
"field": 'orderCarrier.massOrder.orderNo',
"type": "EQ",
"value": this.orderNo
}]
}
}
getMassOrderTruckList(reqData).then(res => {
uni.stopPullDownRefresh()
const data = res.data.data.datas
if (data.length > 0) {
const newList = this.orderTrucks.concat(data)
this.orderTrucks = [...newList]
this.pageNum += 1
this.loadMore = true
}
})
},
//新增分配车辆
addNewCar() {
const data = {
allotTrucks: this.newTrucks,
isMulti: this.allotType === 'multi'
}
uni.navigateTo({
url: `/subpkg/choiceTruck/choiceTruck?data=${JSON.stringify(data)}`
})
},
onAddListener(){
uni.$on('onAddMassAssignTruck', this.onAddMassAssignTruck) //监听大宗订单车辆分配
uni.$on('onRemoveMassAssignTruck', this.onRemoveMassAssignTruck) //监听大宗订单车辆分配
},
onRemoveListener(){
uni.$off('onAddMassAssignTruck', this.onAddMassAssignTruck)
uni.$off('onRemoveMassAssignTruck', this.onRemoveMassAssignTruck)
},
//添加分配车辆
onAddMassAssignTruck(truckInfo){
let truckList = this.newTrucks.concat(truckInfo)
const newList = []
truckList.map(item => { //数组去重
const flag = newList.find(itm => itm.id === item.id)
if(!flag){
newList.push(item)
}
})
this.newTrucks = [...newList]
},
//移除分配车辆
onRemoveMassAssignTruck(truckId){
if(this.allotType === 'record'){
const list = this.orderTrucks.filter(item => item.id !== truckId)
this.deleteTruckIds = this.deleteTruckIds.concat(truckId)
this.orderTrucks = [...list]
} else {
const list = this.newTrucks.filter(item => item.id !== truckId)
this.newTrucks = [...list]
}
},
//确认分配
onConfirmAllot(){
const _this = this
if(_this.allotType === 'record'){ //更新订单配车
_this.onUpdateAllot()
return
}
let allotData = []
_this.newTrucks.map(item => {
const minShipments = _this.$refs[`allotTruck${item.id}`][0].minFrequency
const maxShipments = _this.$refs[`allotTruck${item.id}`][0].maxFrequency
const capacity = _this.$refs[`allotTruck${item.id}`][0].alloutQty
allotData.push({
truckId: item.id, //车辆ID
driverId: item['driver1.id'] ,//司机ID
minShipments: Number(minShipments), //最少趟数
maxShipments: Number(maxShipments), //最多趟数
capacity: Number(capacity), //核定装运量
})
})
const assignType = _this.allotType === 'multi' ? 'service.mobileAssignTrucks' : 'operation.assignTruck'
const reqData = {
'aux': _this.allotType === 'multi' ? {trucks:allotData} : allotData[0],
'args': {"selectedIds": [_this.orderId]}
}
massAssignTruck(reqData, assignType).then(res => {
if (res.data.messageType === 'success') {
uni.showToast({
title: '分配成功',
duration: 3000
})
setTimeout(() => {
uni.navigateBack()
}, 1500)
}
})
},
onUpdateAllot(){
const _this = this
let allotData = []
this.orderTrucks.map(item => {
const minShipments = _this.$refs[`allotTruck${item.id}`][0].minFrequency
const maxShipments = _this.$refs[`allotTruck${item.id}`][0].maxFrequency
const capacity = _this.$refs[`allotTruck${item.id}`][0].alloutQty
allotData.push({
truckId: item.id, //车辆ID
driverId: item['driver1.id'] ,//司机ID
minShipments: Number(minShipments), //最少趟数
maxShipments: Number(maxShipments), //最多趟数
capacity: Number(capacity), //核定装运量
})
})
const reqData = {
'aux': {
'trucks': [...allotData],
'delete': [...this.deleteTruckIds]
},
}
updateMassAssignTruck(reqData).then(res => {
if (res.data.messageType === 'success') {
uni.showToast({
title: '分配成功',
duration: 3000
})
setTimeout(() => {
uni.navigateBack()
}, 1500)
}
})
}
},
}
</script>
<style lang="scss">
.allotCars {
padding-top: 120rpx;
.allotCarsHeader {
background-color: #FFFFFF;
height: 120rpx;
width: 100vw;
padding: 40rpx 24rpx;
font-size: 28rpx;
font-weight: 400;
color: #8C8C8C;
position: fixed;
top: 0;
z-index: 999;
button {
width: 220rpx;
height: 80rpx;
line-height: 80rpx;
border-radius: 40rpx;
color: #2E75E6;
background-color: rgba(46, 117, 230, .1);
margin: 0;
font-size: 28rpx;
font-weight: 500;
}
}
.operation-btn {
padding-bottom: 40rpx;
margin-bottom: 0;
position: fixed;
bottom: 0;
z-index: 999;
background-color: #FFFFFF;
.submitBtn {
width: 90%;
border: none;
font-weight: 500;
color: #FFFFFF;
background: linear-gradient(90deg, #2E75E6 0%, #5E58EE 100%);
box-shadow: 1rpx -3rpx 12rpx 0rpx rgba(0,0,0,0.04);
border-radius: 48rpx;
}
.disabledBtn{
background: linear-gradient(90deg, rgba(46, 117, 230, .3) 0%, rgba(94, 88, 238, .3) 100%);
}
}
}
</style>
\ No newline at end of file
<template>
<view class="view-driver-truck content_box">
<view class="queueSubscribeTitle">
<u--input placeholder="请输入司机姓名" border="surround" prefixIcon="search" shape="circle" color="#ffffff"
placeholderStyle="color:#ffffff" @blur="searchText" v-model="searchValue"></u--input>
</view>
<view class="content-list" style="margin-bottom: 120rpx;">
<u-empty mode="data" textSize='32' iconSize="160" text="暂无数据" v-if="!datas.length" />
<bs-customCell v-for="item in datas" :key="item.id" :label="item.name" labelCol='4' wrapCol="7.2"
:value="isDriver ? item.tel : item['facilityMode.name']" @click.native="onNavDetail(item.id, item.name)">
</bs-customCell>
</view>
</view>
</template>
<script>
import {
searchDriverList,
searchTruckList
} from '../../api/apiList'
export default {
options: {
styleIsolation: 'shared'
},
data() {
return {
datas: [], //候选项列表
isDriver: true, //是否查看司机
pageNum: 1, //页码
pageSize: 20, //每页条数
loadMore: true, //加载更多
searchValue: ''
}
},
onLoad: function() {},
onShow() {
this.pageNum = 1
this.datas = []
this.initData(this.isDriver)
},
onReachBottom() {
if (this.loadMore) {
this.initData(this.isDriver);
this.loadMore = false
}
},
methods: {
//设置页面头部标题
setNavTitle(title) {
uni.setNavigationBarTitle({
title: title,
searchValue: ''
})
},
//初始化数据
initData(isDriver) {
const {
pageNum,
pageSize
} = this
const reqData = {
args: {
pageNum,
pageSize,
"restrictions": [{
"field": "name",
"type": "LK",
"value": this.searchValue
}]
}
}
searchDriverList(reqData).then(res => {
const datas = res.data.data.datas
if (datas.length) {
const newData = this.datas.concat(datas)
this.datas = [...newData]
this.pageNum += 1
this.loadMore = true
}
})
},
searchText(searchValue) {
this.searchValue = searchValue
this.pageNum = 1
this.datas = []
this.initData(this.isDriver)
},
onNavDetail(id, name){
let pages = getCurrentPages(); // 当前页面
if (pages.length > 1) {
var beforePage = pages[pages.length - 2]; // 前一个页面
beforePage.$vm.setTruckDriver(id, name) //clear 是你要调用上个页面的方法,$vm 是必须要有的
}
uni.navigateBack()
}
}
}
</script>
<style lang="scss">
.view-driver-truck {
.queueSubscribeTitle {
width: 100%;
height: 128rpx;
background-color: #2E75E6;
display: flex;
align-items: center;
padding: 0 25rpx;
.u-input {
background-color: rgba(240, 240, 240, .5);
height: 80rpx;
}
.u-icon__icon {
font-size: 48rpx !important;
color: #FFFFFF !important;
}
}
/deep/.content-list {
background-color: #fff;
padding: 0 32rpx;
.custom-cell-row {
padding: 40rpx 0;
margin-top: 0;
border-bottom: 2rpx solid #dadada;
&:last-child {
border-bottom: none;
}
}
}
.submitBtn {
width: 90%;
}
.add_driver_btn {
position: fixed;
bottom: 40rpx;
left: 50%;
transform: translateX(-50%);
margin-bottom: 0;
}
}
</style>
<template>
<view style="padding-top: 128rpx;">
<view class="queueSubscribeTitle">
<u--input placeholder="请输入车牌号" border="surround" prefixIcon="search" shape="circle" color="#ffffff"
placeholderStyle="color:#ffffff" @blur="change"></u--input>
</view>
<view v-for="(truck, index) in truckList" :key="index" style="padding: 0 24rpx;">
<view class="flex_center flex_sb" style="height: 130rpx;">
<view class="">
<view style="color: #262626;font-size: 28rpx;font-weight: bolder;">
{{truck.name || ''}}{{' '}}{{truck['facilityMode.name'] || ''}}
</view>
<view style="color: #8C8C8C;font-size: 24rpx; margin-top: 24rpx;">
{{truck['driver1.name'] || ''}}{{' '}}{{truck['driver1.tel'] || ''}}
</view>
</view>
<view @click="choiceTruck(truck.id)"
:class="['queueSubscribeNoChoice', currentDriver.includes(truck.id) ?'queueSubscribeChoice':'']">
</view>
</view>
<u-line></u-line>
</view>
<view v-if="truckList.length" @click="onConfirm" class="queueSubscribeConfirm">
<button>选择车辆</button>
</view>
</view>
</template>
<script>
import { searchTruckList } from '../../api/apiList.js'
export default {
data() {
return {
isMulti: false, //是否分配多辆车, 分配多辆车时支持多选
truckList: [],
currentDriver: '', //单辆车为字符串,多辆车为数组
searchValue: '',
pageNum: 1, //页码
pageSize: 20, //每页条数
loadMore: true, //加载更多
}
},
//下拉刷新
onPullDownRefresh() {
this.pageNum = 1
this.truckList = []
this.getTruckList()
},
// 触底加载更多
onReachBottom() {
if (this.loadMore) {
this.getTruckList()
this.loadMore = false
}
},
onLoad(option) {
const {isMulti, allotTrucks} = JSON.parse(option.data)
const pageTitle = isMulti ? '分配多辆车' : '分配车辆'
this.isMulti = isMulti
this.setNavTitle(pageTitle)
this.getTruckList()
this.initSelect(isMulti, allotTrucks)
},
methods: {
//设置页面头部标题
setNavTitle(title) {
uni.setNavigationBarTitle({ title })
},
//多选车辆时设置默认值
initSelect(isMulti, allotTrucks){
if(isMulti){
this.currentDriver = allotTrucks.map(item => item.id) || []
}
},
getTruckList() {
searchTruckList({
"args": {
pageNum: this.pageNum,
pageSize: this.pageSize,
"restrictions": [{
"field": 'name',
"type": "LK",
"value": this.searchValue
}]
}
}).then(res => {
uni.stopPullDownRefresh()
const data = res.data.data.datas
if (data.length > 0) {
this.truckList = this.truckList.concat(data)
this.pageNum += 1
this.loadMore = true
}
})
},
change(value) {
this.searchValue = value
this.truckList = []
this.pageNum = 1
this.getTruckList()
},
choiceTruck(truckId) {
if(this.isMulti){
const isSelect = this.currentDriver.find(item => item === truckId)
if(isSelect){
const newList = this.currentDriver.filter(item => item !== truckId) //取消选择
this.currentDriver = [...newList]
} else {
this.currentDriver = this.currentDriver.concat(truckId) //选择
}
} else {
this.currentDriver = truckId
}
},
onConfirm() {
const _this = this
const flag = _this.isMulti ? _this.currentDriver.length : _this.currentDriver
if(flag){
let truckInfo = {}
if(_this.isMulti){ //分配多车
const datas = []
_this.currentDriver.map(truckId => {
const info = _this.truckList.find(item => item.id === truckId)
datas.push(info)
})
truckInfo = [...datas]
} else {
truckInfo = _this.truckList.find(item => item.id === _this.currentDriver)
}
uni.$emit('onAddMassAssignTruck', truckInfo)
uni.navigateBack()
} else {
uni.showToast({
title: '请选择车辆',
icon:'none',
duration: 1500
})
}
}
}
}
</script>
<style lang="scss">
.queueSubscribeTitle {
width: 100%;
height: 128rpx;
background-color: #2E75E6;
display: flex;
align-items: center;
padding: 0 25rpx;
position: fixed;
top: 0;
z-index: 1;
.u-input {
background-color: rgba(240, 240, 240, .5);
height: 80rpx;
border: none;
}
.u-icon__icon {
font-size: 48rpx !important;
color: #FFFFFF !important;
}
}
.queueSubscribeNoChoice {
border: 2rpx solid #BFBFBF;
width: 40rpx;
height: 40rpx;
border-radius: 20rpx;
line-height: 40rpx;
text-align: center;
color: #FFFFFF;
font-weight: bolder;
}
.queueSubscribeChoice {
border: none;
background-color: #2E75E6;
}
.queueSubscribeConfirm {
position: sticky;
background-color: #FFFFFF;
padding: 24rpx;
bottom: 0;
button {
width: 686rpx;
height: 88rpx;
border-radius: 44rpx;
line-height: 88rpx;
background-image: linear-gradient(90deg, #2E75E6, #5E58EE);
color: #FFFFFF;
font-weight: bolder;
font-size: 32rpx;
}
}
</style>
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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