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

343 lines
8.5 KiB

<template>
<!-- <u-navbar title="备货列表" placeholder border=true :autoBack="true" leftIconSize='35'></u-navbar> -->
<BasicContainer ref="basicContainer" :option="option">
<template #head>
<view class="head">
<view class="type1">
<view>客户{{ details.info.consignee }}</view>
</view>
<view class="type1">
<view>商场{{ details.info.marketName }}</view>
</view>
<view class="type1">
<view>计划件数{{ details.info.planNum }}</view>
<view>扫描件数{{ details.info.scanNum }}</view>
</view>
</view>
</template>
<template #body>
<view class="mabxs">
<view class="ite" @click="showsdqs" v-for="item in dataList">
<view class="mb10" @click.stop="goorderdetail(item)">订单号:{{ item.orderCode }}</view>
<view class="mb10">包条码:{{ item.orderPackageCode }}</view>
<view>备货状态:{{ item.stockupStatusName }}</view>
</view>
</view>
<view class="footer">
<view class="prtbut" @click="prinbut">打印</view>
</view>
</template>
</BasicContainer>
<u-navbar title="备货列表" bgColor="#D3832A" leftIconColor="#ffffff" titleStyle="color:#ffffff" placeholder
:autoBack="true" leftIconSize="35"></u-navbar>
<tiplist ref="tiplists"></tiplist>
<BluetoothList ref="bluetoothList"></BluetoothList>
<saomiao2 :ishidestop="scanState !== 0"></saomiao2>
</template>
<script lang="ts" setup>
import { onLoad, onShow, onHide, onUnload, onPullDownRefresh } from '@dcloudio/uni-app'
import { distributionStockupPackageDetail, distributionStockupstockupScan } from '@/api/user.js'
import { detailType } from '@/interfaces/pagesHome/StockUplistScandetails'
import { reactive, ref, toRefs, inject } from 'vue'
import utils from '@/utils/utils'
import useBluetoothStore from '@/store/useBluetoothStore.js'
import useSystemSettingsStore from '@/store/useSystemSettingsStore'
import { storeToRefs } from 'pinia'
const { scanState } = storeToRefs(useSystemSettingsStore())
// 获取组件实例
const bluetoothList = ref(null)
const basicContainer = ref(null)
// 获取Pinia仓库中蓝牙信息
const bluetoothStore = useBluetoothStore()
const { bluetoothInfo } = storeToRefs(bluetoothStore)
const option = reactive({
title: '备货列表',
haveData: true,
async pullDownRefreshInitPage() {
console.log('1231 :>> ', 1231)
return await initpage()
},
})
let details = reactive({
dataList: [],
reservationId: '',
stockupId: '',
orderId: '',
typeService: '',
info: {
customer: '',
planNum: 0,
scanNum: 0,
},
trays: '',
scancode: '',
isscan: false,
})
const tiplists = ref(null)
onLoad(op => {
details.stockupId = op.stockupId
details.reservationId = op.reservationId
details.orderId = op.orderId
details.typeService = op.typeService
// #ifdef APP
if (Number(details.status) === 0) utils.ttsspke('请按件备货')
// #endif
})
onShow(() => {
uni.$off('scancodedate')
uni.$on('scancodedate', function (code) {
if (code) {
console.log(code)
details.scancode = code
scandata()
}
})
// 延时调用组件刷新函数
const timer = setTimeout(() => {
basicContainer.value.startPullDownRefresh()
clearTimeout(timer)
}, 200)
})
function goorderdetail(item) {
uni.navigateTo({
url: '/pagesHome/pages/orderDetails/orderDetails?orderCode=' + item.orderCode,
})
}
function prinbut() {
let list = [],
checklist = []
details.dataList.map((item, index) => {
list.push(item.packageBarCode)
checklist.push(index)
})
tiplists.value.setdetails({
title: '请选择需要打印的包条码',
isshow: true,
tipstate: 2,
list,
checklist,
inputtext: '',
confirmTxt: '确认选择',
isonecheck: false,
success: deta => {
if (deta.checklist.length == 0) {
uni.showToast({
title: '请选择包条码',
icon: 'none',
})
return
}
console.log('deta.checklist :>> ', deta.checklist)
// #ifdef APP
// 没有蓝牙信息, 开启弹窗选择打印
if (!bluetoothInfo.value.name) return bluetoothList.value.setdetails({ isshow: true })
let _isReturn = false
deta.checklist.forEach(item => {
if (_isReturn) return
let text = '! 0 200 200 333 1\r\n'
text += 'SETBOLD 2\r\n'
text += `T 56 0 0 0 ${details.dataList[item]?.orderCode}\r\n`
text += 'LINE 0 50 420 50 3\r\n'
text += `T 55 0 0 60 客户\r\n`
text += 'LINE 40 50 40 110 3\r\n'
text += `T 55 0 50 60 ${details.customer}\r\n`
text += 'LINE 40 80 420 80 3\r\n'
text += `T 55 0 50 90 ${details.address}\r\n`
text += 'LINE 0 110 420 110 3\r\n'
text += `T 55 0 0 120 物料\r\n`
text += 'LINE 40 110 40 140 3\r\n'
text += `T 55 0 50 120 ${details.dataList[item]?.materialName}\r\n`
text += 'LINE 0 140 420 140 3\r\n'
text += 'B QR 150 150 M 2 U 4\r\n'
text += `MA,${details.dataList[item]?.packageBarCode}\r\n`
text += 'ENDQR\r\n'
text += `T 55 0 140 260 ${details.dataList[item]?.packageBarCode}\r\n`
text += 'FORM\r\n'
text += 'PRINT\r\n'
// return
utils.getbl(bluetoothInfo.value, text).catch(() => {
bluetoothList.value.setdetails({ isshow: true })
_isReturn = true
})
})
if (_isReturn) return
// #endif
tiplists.value.setdetails({ isshow: false })
},
cancel: details => {
tiplists.value.setdetails({ isshow: false })
},
close: details => {
tiplists.value.setdetails({ isshow: false })
},
})
}
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 })
},
})
}
async function scandata() {
let data = {
scanType: 1,
packetBarCode: details.scancode,
reservationId: details.reservationId,
stockupId: details.stockupId,
typeService: details.typeService,
}
let res = await distributionStockupstockupScan(data)
console.log(res)
if (res.code == 200) {
details.isscan = true
// 调用组件刷新函数
basicContainer.value.startPullDownRefresh()
} else if (res.code === 3001) {
// 不在本次任务备货
if (res.audio) utils.ttsspke(res.audio)
}
}
async function initpage() {
let data = {
reservationId: details.reservationId,
stockupId: details.stockupId,
typeService: details.typeService,
orderId: details.orderId
}
let response = await distributionStockupPackageDetail(data)
if (response.code !== 200) return
console.log(response)
details.dataList = response.data.deliveryPackageDetailList
details.info = response.data
details.info.planNum = response.data.planNum
details.info.scanNum = response.data.scanNum
if (Number(details.info.scanNum) > 0 && details.isscan) {
utils.ttsspke(details.info.scanNum + '件')
}
}
const { dataList } = toRefs(details)
</script>
<style lang="scss">
.mabxs {
padding: 20upx;
.ite {
font-size: 0.9rem;
padding: 20upx;
box-sizing: border-box;
border-radius: 8upx;
box-shadow: 0upx 2upx 10upx 0upx #e2e2e3;
margin-bottom: 20upx;
color: #092c4d;
background-color: #fff;
}
}
.footer {
$height: 88upx;
height: calc($height + 40upx);
.prtbut {
position: fixed;
left: 50%;
transform: translateX(-50%);
bottom: 40upx;
width: 320upx;
height: $height;
background: #d3832a;
border-radius: 8upx;
font-size: 32upx;
font-weight: 400;
color: #ffffff;
display: flex;
align-items: center;
justify-content: center;
}
}
.head {
display: flex;
flex-direction: column;
align-items: center;
width: 100%;
padding: 20upx;
box-sizing: border-box;
background-color: #ffffff;
>.type1 {
width: 100%;
display: flex;
align-items: center;
margin: 14upx 0;
font-size: 28upx;
font-weight: 400;
color: #092c4d;
>view {
flex: 1;
word-wrap: break-word;
word-break: break-all;
&:nth-of-type(1) {
margin-right: 30upx;
}
}
}
>.type2 {
width: 100%;
display: flex;
align-items: center;
justify-content: space-between;
margin: 14upx 0;
font-size: 28upx;
font-weight: 400;
color: #092c4d;
>view:nth-of-type(2) {
width: 50%;
display: flex;
align-items: center;
>view:nth-of-type(2) {
font-size: 28upx;
font-weight: 400;
color: #0086f1;
margin-left: 20upx;
}
}
}
}
</style>