货无忧
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

671 lines
16 KiB

<template>
<!-- <u-navbar title="自提扫描" placeholder border=true :autoBack="true" leftIconSize='35'></u-navbar> -->
<BasicContainer :option="option" ref="basicContainer" :leftClick="leftClick">
<template #head>
<!-- tabBar选项卡 -->
<view class="tabBar">
<view :class="{'tabBar-item': true, 'active': details.tabBarCode === 10}" @click="handleTabBarCode(10)">
待提货
</view>
<view :class="{'tabBar-item': true, 'active': details.tabBarCode === 20}" @click="handleTabBarCode(20)">
已提货
</view>
</view>
<view class="schbox">
<view>自提日期</view>
<view @click='showCalendar' class="inputsr">
<input :value='datatime' disabled placeholder="请选择时间" />
<view @click.stop.prevent>
<u-icon @click='showCalendar' style="margin-right: 10rpx;" v-if="!datatime" name="calendar"
color="#999999" size="50"></u-icon>
<u-icon @click="cleartime" style="margin-right: 10rpx;" v-else name="close-circle" color="#999999"
size="40"></u-icon>
</view>
</view>
<view @click="handlSearch">
查询
</view>
</view>
</template>
<template #body>
<scroll-view scroll-y="true" :style="{height: details.scrollHeight}" class="scvbx" @scrolltolower="jiazai">
<view class="mabxslist">
<view class="item" v-for="item in recordsList">
<view class="headtop">
<!-- <view class="type1s">
<view>
<text style="color: #90A0AF;">配车类型:</text>{{item.item}}
</view>
<view>
<text style="color: #90A0AF;">配车状态:</text>{{item.conditionStr}}
</view>
</view> -->
<view class="type1s">
<view>
<text style="color: #90A0AF;">车牌号:</text>{{item.pickUpPlate}}
</view>
<view>
<text style="color: #90A0AF;">司机:</text>{{item.consignee}}
</view>
</view>
<view class="type1s">
<view>
<text style="color: #90A0AF;">装御班组:</text>A班组
</view>
<view>
<text style="color: #90A0AF;">备货是否完成:</text>是
</view>
</view>
<view class="type1s">
<view>
<text style="color: #90A0AF;">制单时间:</text>{{item.createTime}}
</view>
</view>
<view class="type1s">
<view>
<text style="color: #90A0AF;">任务时间:</text>{{item.createTime}}
</view>
</view>
<view class="liebs">
<view>
<view>订单总数</view>
<view>{{item.orderNum}}</view>
</view>
<view>
<view>自提件数</view>
<view>{{item.planNum}}</view>
</view>
<view>
<view>签收件数</view>
<view>{{item.signedNum}}</view>
</view>
<view>
<view>库存品数</view>
<view>{{item.inventoryNub}}</view>
</view>
</view>
</view>
<view class="buts">
<template v-if="Number(details.tabBarCode) === 10">
<view @click="goselscandetails(item)">明细扫描</view>
<view @click="goselscan(item)">扫描</view>
</template>
<view @click="showUpImg(item)">签收图片</view>
</view>
</view>
</view>
</scroll-view>
<l-calendar v-model:value="show" :initStartDate='date[0]' :initEndDate='date[1]' @hide='showCalendar'
@change="onConfirm"></l-calendar>
</template>
</BasicContainer>
<!-- 上传签收图片 -->
<PopUp ref="UpReceivedImage"></PopUp>
<tiplist ref="tiplists"></tiplist>
</template>
<script lang="ts" setup>
import {
onLoad,
onShow,
onHide,
onUnload
} from '@dcloudio/uni-app'
import { billLadingpageList, billLadingGetReceivedImage, billLadingAddReceivedImage } from '@/api/user.js'
import { detailsType } from '@/interfaces/pagesHome/SelfPickupScan'
import { reactive, toRefs, ref, watchEffect, nextTick } from "vue";
import useSearchInfoStore from '@/store/useSearchInfoStore';
import { storeToRefs } from 'pinia';
import utils from '@/utils/utils.js';
const option = {
title: '自提扫描',
haveData: true,
async pullDownRefreshInitPage() {
details.recordsList = []
details.current = 1
await initpage()
}
}
let details = reactive({
datatime: '',
show: false,
current: 1,
size: 10,
recordsList: [],
imgList: [{
state: 1,
dictValue: '提货证件',
imgList: []
},
{
state: 2,
dictValue: '文员确认',
imgList: []
},
{
state: 3,
dictValue: '库管签收',
imgList: []
}
],
isChange: false,
changeImageList: [],
/**
* 必填照片 (无用)
*/
ImagesRequiredFields: [
],
/** 下拉高度 */
scrollHeight: '',
/**
* 10: 待提货
* 20: 已提货
* 30: 已签收
*/
tabBarCode: 10,
/** 待提货查询 */
searchInfo1: {
date: []
},
/** 已提货查询 */
searchInfo2: {
date: []
},
/** 已签收查询 */
searchInfo3: {
date: []
}
})
const date = ref<number | string[]>([])
// 组件实例
const basicContainer = ref(null)
/** 上传自提签收图片 */
const UpReceivedImage = ref()
const tiplists = ref()
// 初始化Pinia仓库
const searchInfoStore = useSearchInfoStore()
const { searchInfo } = storeToRefs(searchInfoStore)
const { HANDLE_EDIT_INFO, HANDLE_DELETE } = searchInfoStore
function showCalendar() {
details.show = !details.show
}
function onConfirm(e : any) {
console.log(e);
date.value[0] = e.startDate
date.value[1] = e.endDate
details.datatime = date.value[0] + ' 至 ' + date.value[1]
// details.datatime=(uni as any).$u.timeFormat(date.value[0], 'yyyy-mm-dd')+' 至 '+(uni as any).$u.timeFormat(date.value[1], 'yyyy-mm-dd')
}
// 改变选项卡激活状态
function handleTabBarCode(code : number) {
console.log('details :>> ', details);
details.tabBarCode = code
if (code === 10) date.value = details.searchInfo1.date
else if (code === 20) date.value = details.searchInfo2.date
// 开启刷新请求
basicContainer.value.startPullDownRefresh()
}
watchEffect(() => {
if ((date.value as []).length != 0) {
details.datatime = date.value[0] + ' 至 ' + date.value[1]
}
else details.datatime = ''
})
onLoad(() => {
// date.value[0] = (uni as any).$u.timeFormat((new Date().valueOf() - 1000 * 60 * 60 * 24 * 3), 'yyyy-mm-dd')
// date.value[1] = (uni as any).$u.timeFormat((new Date().valueOf()), 'yyyy-mm-dd')
})
onShow(async () => {
// #ifdef APP
uni.$off('scancodedate')
// #endif
// 初始化获取搜索值
const pageSearchInfo = searchInfo.value['SelfPickupScan']
console.log('pageSearchInfo :>> ', pageSearchInfo);
if (pageSearchInfo) {
const code = pageSearchInfo.conditions
details.searchInfo1 = pageSearchInfo.searchInfo1
details.searchInfo2 = pageSearchInfo.searchInfo2
// 获取存储在Pinia中的搜索参数
if (code === 10 || pageSearchInfo.searchInfo1) date.value = pageSearchInfo.searchInfo1.date
else if (code === 20 || pageSearchInfo.searchInfo2) date.value = pageSearchInfo.searchInfo2.date
details.tabBarCode = code
} else {
date.value[0] = (uni as any).$u.timeFormat((new Date().valueOf() - 1000 * 60 * 60 * 24 * 3), 'yyyy-mm-dd')
date.value[1] = (uni as any).$u.timeFormat((new Date().valueOf()), 'yyyy-mm-dd')
details.searchInfo1.date = [...date.value]
details.searchInfo2.date = [...date.value]
}
await nextTick()
basicContainer.value.startPullDownRefresh()
details.scrollHeight = await utils.getViewDistanceFormTop('.scvbx')
})
function init() {
details.current = 1
initpage()
}
function jiazai() {
details.current++
initpage()
}
async function initpage() {
console.log('details :>> ', details);
console.log('date.value :>> ', date.value);
if (details.tabBarCode === 10) details.searchInfo1.date = [...date.value]
else if (details.tabBarCode === 20) details.searchInfo2.date = [...date.value]
let data = {
current: details.current,
size: details.size,
pickUpTimeStart: date.value[0],
pickUpTimeEnd: date.value[1],
conditions: details.tabBarCode
}
HANDLE_EDIT_INFO('SelfPickupScan', {
searchInfo1: details.searchInfo1,
searchInfo2: details.searchInfo2,
searchInfo3: details.searchInfo3,
conditions: details.tabBarCode
})
let response = await billLadingpageList(data)
if (response.code !== 200) return
// details.recordsList=response.data.records
if (details.current == 1) {
details.recordsList = response.data.records
} else {
if (response.data.records.lngth == 0) {
uni.showToast({
title: '已经到底了。',
icon: 'none'
})
return
}
details.recordsList = details.recordsList.concat(response.data.records)
}
// details.recordsList = [{}]
}
function checktime(event : any) {
console.log(event);
details.datatime = (uni as any).$u.timeFormat(event.value, 'yyyy-mm-dd');
details.show = false
console.log(details.datatime);
}
function goselscan(item : any) {
uni.navigateTo({
url: '/pagesHome/pages/SelfPScanList/SelfPScanList?billLadingId=' + item.billLadingId
})
}
function goselscandetails(item : any) {
uni.navigateTo({
url: '/pagesHome/pages/SelfPickupDetails/SelfPickupDetails?billLadingId=' + item.billLadingId
})
}
function cleartime() {
// console.log(1231211);
details.datatime = ''
date.value = []
handlSearch()
}
/** 显示上传自提图片的弹窗 */
const showUpImg = async (item) => {
// UpReceivedImage.value.setDetails({
// title: '上传自提签收图片',
// showPopUp: true
// })
let submitData = {
billLadingId: item.billLadingId,
}
// 请求签收照片数据
let res = await billLadingGetReceivedImage(submitData)
const { code, data } = res
// console.log('res>>>>>', res)
let remark = ''
if (code !== 200) return
remark = res.data.remark
if (data.list) {
for (let item of data.list) {
details.imgList.find(val => val.state === Number(item.state)).imgList.push({ ...item, urlRoute: item.url })
}
}
tiplists.value.setdetails({
title: '请上传签收图片(每项最少一张)',
isshow: true,
tipstate: 3,
placeholder: '请填写备注',
confirmTxt: '确认',
inputtext: remark,
imglist: details.imgList,
maximglength: 20,
isChange: details.isChange,
changeImageList: details.changeImageList,
ImagesRequiredFields: details.ImagesRequiredFields,
success: async (detail) => {
console.log('detail :>> ', detail);
let data = {
billLadingId: item.billLadingId,
printList: [],
remark: detail.inputtext
}
let res : any = null
// 是否符合提交条件
const isSubmit = detail.imglist.every(item => {
if (item.imgList.length < 1) return false
else {
data.printList = [...data.printList, ...item.imgList.map(val => {
val.state = item.state
val.url = val.urlRoute
return val
})]
return true
}
})
if (!isSubmit) {
uni.showToast({
title: '请根据要求上传照片',
icon: 'none'
})
utils.ttsspke('必传照片不足')
return
}
try {
uni.showLoading({
mask: true
})
console.log('data :>> ', data);
res = await billLadingAddReceivedImage(data)
if (res.code !== 200) return
for (let item of details.imgList) {
// 清空照片
item.imgList = []
}
initpage()
uni.showToast({
title: res.msg,
icon: 'none'
})
tiplists.value.setdetails({ isshow: false })
} catch (err) {
console.log('err :>> ', err);
//TODO handle the exception
} finally {
uni.hideLoading()
}
},
cancel: () => {
for (let item of details.imgList) {
// 清空照片
item.imgList = []
}
tiplists.value.setdetails({ isshow: false })
},
close: () => {
for (let item of details.imgList) {
// 清空照片
item.imgList = []
}
tiplists.value.setdetails({ isshow: false })
},
})
}
/** 搜索 */
const handlSearch = () => {
basicContainer.value.startPullDownRefresh()
}
// 头部返回事件
const leftClick = () => {
HANDLE_DELETE('SelfPickupScan')
uni.navigateBack()
}
const { datatime, dataList, show, recordsList } = toRefs(details)
</script>
<style lang="scss" scoped>
.inputsr {
width: 400upx !important;
height: 64upx;
background: #F5F5F6;
border-radius: 8upx 8upx 8upx 8upx;
opacity: 1;
border: 2upx solid #EEEEEE;
padding: 16upx 18upx;
box-sizing: border-box;
padding-right: 0;
display: flex;
align-items: center;
justify-content: space-between;
font-size: 26upx;
font-weight: 400;
color: #092C4D;
>input {
flex: 1;
font-size: 26upx;
}
}
.scvbx {
width: 100%;
height: 81vh;
margin-top: 20upx;
.mabxslist {
display: flex;
flex-direction: column;
align-items: center;
>.item {
width: 686upx;
// height: 610upx;
background: #FFFFFF;
border-radius: 8upx;
padding: 20upx 0;
box-sizing: border-box;
margin-bottom: 20upx;
>.headtop {
display: flex;
flex-direction: column;
padding: 24upx;
>.type1s {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 20upx;
box-sizing: border-box;
font-size: 28upx;
font-weight: 400;
color: #092C4D;
>view {
flex: 1;
}
}
>.liebs {
display: flex;
align-items: center;
justify-content: space-around;
>view {
display: flex;
flex-direction: column;
align-items: center;
margin-top: 20upx;
&:nth-of-type(1) {
>view:nth-of-type(2) {
color: #092C4D;
}
}
&:nth-of-type(2) {
>view:nth-of-type(2) {
color: #0086F1;
}
}
&:nth-of-type(3) {
>view:nth-of-type(2) {
color: #3AD8BC;
}
}
&:nth-of-type(4) {
>view:nth-of-type(2) {
color: #FA8C16;
}
}
>view:nth-of-type(1) {
font-size: 28upx;
font-weight: 400;
color: #092C4D;
}
>view:nth-of-type(2) {
font-size: 36upx;
font-weight: 400;
margin-top: 20upx;
}
}
}
}
>.buts {
border-top: 3upx solid #EEEEEE;
display: flex;
align-items: center;
justify-content: space-around;
padding-top: 20upx;
>view {
width: 204upx;
height: 64upx;
border-radius: 8upx;
opacity: 1;
display: flex;
align-items: center;
justify-content: center;
font-size: 28upx;
}
>view:nth-of-type(1) {
border: 2upx solid #0086F1;
color: #0086F1;
}
>view:nth-of-type(2) {
border: 2upx solid var(--subjectColor);
color: var(--subjectColor);
}
>view:nth-of-type(3) {
border: 2upx solid #16d46b;
color: #16d46b;
}
}
}
}
}
.schbox {
display: flex;
align-items: center;
justify-content: space-between;
padding: 15upx 32upx;
box-sizing: border-box;
background-color: #ffffff;
>view:nth-of-type(1) {
// width: 150upx;
font-size: 28upx;
font-weight: 400;
color: #092C4D;
}
>view:nth-of-type(2) {
width: 380upx;
// height: 64upx;
}
>view:nth-of-type(3) {
width: 128upx;
height: 64upx;
background: #D3832A;
border-radius: 8upx;
display: flex;
align-items: center;
justify-content: center;
font-size: 32upx;
font-weight: 400;
color: #FFFFFF;
}
}
// tabBar选项卡
.tabBar {
display: flex;
justify-content: space-evenly;
background-color: #fff;
margin-bottom: 10upx;
&-item {
position: relative;
flex: 1;
flex-basis: 0;
padding: 20upx 0;
text-align: center;
&::after {
content: '';
position: absolute;
bottom: 0;
left: 50%;
display: block;
width: 0;
box-sizing: border-box;
border: 1upx solid var(--subjectColor);
transition: all 0.5s;
}
&.active {
color: var(--subjectColor);
&::after {
left: 0;
width: 100%;
}
}
}
}
</style>