货无忧
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.
 
 
 
 
 

653 lines
13 KiB

<template>
<BasicContainer ref="basicContainer" :option="option">
<template #head>
<view class="hdstop">
<view class="">
<view class="mb20">
<text class="textTitleColor">
客户
</text>
{{details.pageInfo.client}}
</view>
<view class="mb20">
<text class="textTitleColor">
地址
</text>
{{details.pageInfo.address}}
</view>
<view class="flex-c-sb mb20">
<view>
<text class="textTitleColor">
电话
</text>
{{details.pageInfo.phone}}
</view>
<view class="butlur" @click="showsdqs">
录入包条码
</view>
</view>
<view class="flex-c-sb mb20">
<view class="searchBox">
<MyInput v-model="details.searchCode" clearable placeholder="请输入包条码" @remove="handleFilterData" />
</view>
<view class="butlur" @click="handleFilterData">
搜索
</view>
</view>
</view>
<view class="tps">
<view>
<view>包件总数</view>
<view>{{details.datalist.length}}</view>
</view>
<view>
<view>已签包件</view>
<view>{{details.signNub}}</view>
</view>
<view>
<view>未签包件</view>
<view>{{details.noSingnNum}}</view>
</view>
</view>
</view>
</template>
<template #body>
<!-- 表格表头 -->
<view class="main">
<view class="main_row main_title">
<view class="">
包条码
</view>
<view class="">
订单号
</view>
<view class="">
类型
</view>
<view class="">
一级品
</view>
<view class="">
二级品
</view>
<view class="">
三级品
</view>
<view class="">
物料名称
</view>
<view class="">
签收状态
</view>
<view class="">
异常状态
</view>
</view>
<view :style="{height: details.jpScorllViewHeight}" class="main_body">
<block v-for="item in details.datalist" :key="item.orderCode">
<view
:class="{'main_row': true, 'red': item.isSignfor === 0, 'green': item.isSignfor === 1, 'isHide': item.isShow}">
<view class="">
<MyQrCode :orderPackageCode="item.orderPackageCode" :infoOption="{
/** 订单码 */
orderCode: item.orderCode,
/** 物料名称 */
goodsName: item.materialName,
/** 商场 */
marketName: item.consigneeUnit,
/** 收货人 */
consignee: item.consigneePerson,
}" />
</view>
<view class="">
{{item.orderCode || '暂无数据'}}
</view>
<view class="">
{{item.type === 1 ? '定制品' : '库存品'}}
</view>
<view class="">
{{item.firsts}}
</view>
<view class="">
{{item.second}}
</view>
<view class="">
{{item.thirdProduct}}
</view>
<view class="">
{{item.materialName}}
</view>
<view class="">
{{item.isSignfor === 1?'已签':'未签'}}
</view>
<view :class="{'red': item.isAbnormal === 1}">
{{item.isAbnormal === 1 ? '异常' : '/'}}
</view>
</view>
</block>
</view>
</view>
</template>
</BasicContainer>
<tips ref="tip"></tips>
<tiplist ref="tiplists"></tiplist>
<saomiao2 :ishidestop="scanState !== 0"></saomiao2>
</template>
<script lang="ts" setup>
import {
signforinventory,
signforsignfor,
signforsignforIn,
signforsignforcontinue,
signforSigningPackageDetail,
postSignforNewSignfor
} from '@/api/user.js'
import {
onLoad,
onShow,
} from '@dcloudio/uni-app'
import { computed, inject, nextTick, onMounted, reactive, ref, toRefs } from "vue";
import useSystemSettingsStore from '@/store/useSystemSettingsStore';
import { storeToRefs } from 'pinia';
import utils from '@/utils/utils.js';
const { scanState } = storeToRefs(useSystemSettingsStore())
const option = {
title: '客户包件扫描',
haveData: true,
async pullDownRefreshInitPage() {
return await initpage()
},
haveReachBottom: false
}
let details = reactive({
schanvalue: '',
typearr: [
{
value: 3,
label: '齐套'
},
{
value: 2,
label: '部分扫'
},
{
value: 1,
label: '未扫'
}
],
items: {} as any,
pageInfo: {} as any,
datalist: [] as any,
reservationId: '',
orderStatus: 1,
scancode: '',
deliveryId: '',
orderType: '' as string | number,
inputtxt: '',
listcheckindex: -1,
scrollHeight: '60vh',
/** 计划件数 */
Plannednub: 0,
/** 滚动区高度 */
jpScorllViewHeight: '',
/** 签收数 */
signNub: 0,
/** 未签数 */
noSingnNum: 0,
/** 搜索的值 */
searchCode: ''
})
// 组件实例
const tiplists = ref(null)
const tip = ref(null)
const basicContainer = ref()
onLoad(async (op) => {
console.log('op :>> ', op);
// #ifdef APP
utils.ttsspke('请扫描包条码')
// #endif
// 获取路由中传递数据
details.reservationId = op.reservationId
details.deliveryId = op.deliveryId
})
onShow(async () => {
uni.$off('scancodedate')
uni.$on('scancodedate', function (code) {
if (code) {
// 关闭弹窗
tip.value.setdetails({ isshow: false })
console.log(code);
details.scancode = code
scandata()
}
})
await nextTick()
basicContainer.value.startPullDownRefresh()
})
// onHide(() => {
// uni.$off('scancodedate')
// })
onMounted(async () => {
await nextTick()
details.jpScorllViewHeight = await utils.getViewDistanceFormTop('.main_body')
details.scrollHeight = await utils.getViewDistanceFormTop('.main')
})
function goorderdetail(item) {
uni.navigateTo({
url: '/pagesHome/pages/orderDetails/orderDetails?orderCode=' + item.orderCode
})
}
/** 计算数据 */
function computedNum(orderPackageCode) {
details.signNub = 0
details.noSingnNum = 0
const _arr = [...details.datalist]
// 被扫描的包件在第一位, 中间是未扫描的包件, 最后为已扫描的包件
const _signArr = []
const _noSignArr = []
// 被扫描的包条
let _value : any
for (let item of _arr) {
if (!_value && item.orderPackageCode === orderPackageCode) _value = item
if (item.isSignfor === 1) {
details.signNub++
if (item !== _value) _signArr.push(item)
}
else {
details.noSingnNum++
if (item !== _value) _noSignArr.push(item)
}
}
details.datalist = _value ? [_value, ..._noSignArr, ..._signArr] : [..._noSignArr, ..._signArr]
}
async function scandata() {
let data = {
barcode: details.scancode,
deliveryId: details.deliveryId,
reservationId: details.reservationId,
type: 1
}
const _item = details.datalist.find(val => val.orderPackageCode === details.scancode)
// 定制品
if (!_item || _item.type === 1) {
let response = await postSignforNewSignfor(data)
console.log(response);
if (response.code === 200) {
// const num = details.datalist.reduce((curr, item) => curr + item.signforNub, 0)
// #ifdef APP
// utils.ttsspke(num + '件')
// #endif
}
else if (response.code == 3006) {
// #ifdef APP
utils.ttsspke('是否异常签收')
// #endif
tip.value.setdetails({
isshow: true,
content: '请确认是否异常签收',
success: async () => {
let data = {
barcode: details.scancode,
deliveryId: details.deliveryId,
reservationId: details.reservationId
}
let response = await signforsignforcontinue(data)
if (response.code !== 200) return
console.log(response);
uni.showToast({
title: response.msg,
icon: 'none'
})
initpage(details.scancode)
tip.value.setdetails({ isshow: false })
},
cancel: () => {
tip.value.setdetails({ isshow: false })
},
close: () => {
tip.value.setdetails({ isshow: false })
}
})
return
} else {
uni.showToast({
title: response.msg,
icon: 'none'
})
}
} else {
data.type = 3
// 库存品扫描
let response = await postSignforNewSignfor(data)
console.log(response);
if (response.code == 3006) {
tip.value.setdetails({
isshow: true,
content: '请确认是否异常签收',
success: async () => {
let data = {
barcode: details.scancode,
deliveryId: details.deliveryId,
reservationId: details.reservationId
}
let response = await signforsignforcontinue(data)
console.log(response);
if (response.code !== 200) return
uni.showToast({
title: response.msg,
icon: 'none'
})
initpage(details.scancode)
tip.value.setdetails({ isshow: false })
},
cancel: () => {
tip.value.setdetails({ isshow: false })
},
close: () => {
tip.value.setdetails({ isshow: false })
}
})
return
} else {
uni.showToast({
title: response.msg,
icon: 'none'
})
}
}
initpage(details.scancode)
}
function showsdqs() {
tiplists.value.setdetails({
isshow: true,
tipstate: 1,
title: '请输入扫描的码',
placeholder: '请输入扫描的码',
inputtext: '',
success: (detail) => {
details.scancode = detail.inputtext
scandata()
tiplists.value.setdetails({ isshow: false })
},
cancel: () => {
tiplists.value.setdetails({ isshow: false })
},
close: () => {
tiplists.value.setdetails({ isshow: false })
}
})
}
/** 筛选页面数据 */
const handleFilterData = () => {
const filterContent = new RegExp(details.searchCode)
for (let i = 0; i < details.datalist.length; i++) {
const val = details.datalist[i]
if (!filterContent.test(val.orderPackageCode)) val.isShow = true
else val.isShow = false
}
}
/** 请求页面数据 */
async function initpage(scancode = '') {
uni.showLoading({
mask: true
})
try {
// 初始化请求页面数据
let submitData = {
reservationId: details.reservationId,
}
details.datalist = []
const res = await signforSigningPackageDetail(submitData)
const { code, data } = res
if (code !== 200) return
console.log('data :>> ', data);
// 去除null值
details.datalist = data.filter(val => val)
if (data.length === 0) return
details.pageInfo = data[0]
} catch (err) {
console.log('err :>> ', err);
//TODO handle the exception
} finally {
handleFilterData()
computedNum(scancode)
uni.hideLoading()
return null
}
}
const { datalist, items } = toRefs(details)
</script>
<style lang="scss" scoped>
@import url(@/utils/style/common.scss);
.butlur {
width: 200upx !important;
height: 64upx !important;
background: #D3832A;
border-radius: 8upx;
display: flex;
align-items: center;
justify-content: center;
font-size: 0.9rem;
color: #FFFFFF;
}
// 头部
.hdstop {
font-size: 0.9rem;
margin: 20upx;
padding: 20upx;
background-color: #fff;
box-sizing: border-box;
color: #092C4D;
margin-bottom: 20upx;
word-break: break-all;
border-radius: 10upx;
.searchBox {
height: 2rem;
flex: 1;
margin-right: 20upx;
:deep(.input_container) {
border-color: #eee;
background: #F5F5F6 !important;
border-radius: 0.25rem !important;
// background-color: #999;
}
}
// >.khxb {
// display: flex;
// align-items: flex-start;
// margin-bottom: 10upx;
// flex-wrap: wrap;
// >view {
// width: 50%;
// margin-bottom: 20upx;
// }
// }
>.tps {
display: flex;
align-items: center;
justify-content: space-around;
>view {
display: flex;
align-items: center;
flex-direction: column;
&:nth-of-type(1) {
>view:nth-of-type(2) {
color: #092C4D;
font-size: 1.2rem;
}
}
&:nth-of-type(2) {
>view:nth-of-type(2) {
color: #0a0;
font-size: 1.2rem;
}
}
&:nth-of-type(3) {
>view:nth-of-type(2) {
color: #ff5500;
font-size: 1.2rem;
}
}
}
}
}
// 主体内容
.main {
background: #fff;
border-top: 2upx solid #999;
height: fit-content;
margin: 0 10upx;
width: calc(100vw - 20upx);
overflow-x: scroll;
}
.main_title {
width: 100%;
>view {
background: #eee;
}
}
.main_body {
overflow-y: scroll;
width: fit-content;
}
.main_row {
display: flex;
border-left: 2upx solid #999;
&.isHide {
display: none;
}
&.green {
color: #0a0;
}
&.red {
color: #ff5500
}
>view {
padding: 10upx 5upx;
font-size: 0.8rem;
word-break: break-all;
text-align: center;
border-bottom: 1upx solid #999;
width: 400upx;
flex: none;
border-right: 2upx solid #999;
// white-space: nowrap;
// /* 防止文本换行 */
// overflow: hidden;
// /* 隐藏溢出的文本 */
// text-overflow: ellipsis;
// /* 在溢出部分显示省略号 */
&:nth-child(3) {
width: 120upx;
flex: none;
}
&:nth-last-child(2) {
width: 120upx;
}
&:last-child {
&.red {
background-color: #ff5500;
color: #fff;
}
}
.main_tip {}
}
}
// .jpScorllView {
// overflow-y: scroll;
// }
</style>