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

646 lines
15 KiB

<template>
<BasicContainer :option="option">
<template #head>
<view class="container pt20">
<!-- 顶部搜索栏 -->
<view class="header-search mb20">
<view class="search flex1 mr20">
<MyInput clearable v-model="scancode"
:placeholder="'请扫描或输入' + (searchForm.type === 1 ? '包条码' : '订单号')" />
</view>
<view class="search">
<view class="searchType" @click="scandata">
搜索
</view>
</view>
</view>
<view class="align-center mb20">
<view class="title">搜索方式:</view>
<view class="flex1 align-center" @click="()=> handleCheckType(1)">
<view :class="{redioBox: true, active: searchForm.type === 1, mr20: true}">
</view>
包条码
</view>
<view class="flex1 align-center" @click="()=> handleCheckType(2)">
<view :class="{redioBox: true, active: searchForm.type === 2, mr20: true}">
</view>
订单号
</view>
</view>
<!-- 数据详情 -->
<view class="dataInfo">
<view class="dataInfo__item">
<text class="label">订单码:</text>{{dataInfo.orderCode}}
</view>
<view class="dataInfo__item">
<text class="label">订单状态:</text>{{orderStateDictionaries[dataInfo.orderStatus] || ''}}
</view>
<view class="dataInfo__item">
<text class="label">品牌:</text>
<text>
{{dataInfo.brand || ''}}
</text>
</view>
<view class="dataInfo__item">
<text class="label">商场名称:</text>
<text>
{{dataInfo.mallName || ''}}
</text>
</view>
<view class="dataInfo__item">
<text class="label">商场收货人:</text>
<text>
{{dataInfo.consigneePerson || ''}}
</text>
</view>
<view class="dataInfo__item">
<text class="label">商场电话:</text>
<text>
{{dataInfo.consigneeMobile || ''}}
</text>
</view>
<view class="dataInfo__item">
<text class="label">客户名称:</text>
<text>
{{dataInfo.customerName || ''}}
</text>
</view>
<view class="dataInfo__item">
<text class="label">客户电话:</text>
<text>
{{dataInfo.customerTelephone || ''}}
</text>
</view>
<view class="dataInfo__item">
<text class="label">发货日期:</text>
<text>{{''}}</text>
</view>
<view class="dataInfo__item">
<text class="label">齐套状态:</text>
<text>
{{dataInfo.completeSet === 2 ? '齐套' : '未齐套'}}
</text>
</view>
<view class="dataInfo__item w100">
<view class="label">收货地址:</view>
<view>{{dataInfo.customerAddress || ''}}</view>
</view>
</view>
<view class="tabbar">
<view @click="showArticleMadeToOrderModule" :class="{'active': showArticleMadeToOrder}">
定制品(<text class="tabbar__number">{{packageList.length}}</text>件)
</view>
<view @click="showArticleMadeToOrder = false" :class="{'active': !showArticleMadeToOrder}">
库存品(<text class="tabbar__number">{{stockList.length}}</text>件)
</view>
</view>
</view>
</template>
<template #body>
<view class="container mb20">
<view class="orderInfo">
<!-- 定制品 -->
<view class="packagesList" v-if="packageList.length !== 0 && showArticleMadeToOrder">
<view class="mb20">
<view v-if="!isBatchOperation">
<view class="batchOperationBtn" @click="batchOperationBtn">批量操作</view>
</view>
<view v-else style="display: flex;">
<view class="batchOperationBtn" @click="batchPrint">打印</view>
<!-- <view class="batchOperationBtn" @click="handleMaterialReplenishment">物料补充</view> -->
</view>
</view>
<MyTable :columnList="columnList" :data="packageList" :haveSelection="true"
@selectionChange="selectionChange" />
</view>
<!-- 库存品 -->
<view class="packagesList" v-else-if="stockList.length !== 0 && !showArticleMadeToOrder">
<MyTable :columnList="columnListByStock" :data="stockList" :haveSelection="false" />
</view>
</view>
</view>
</template>
</BasicContainer>
<tiplist ref="tiplists"></tiplist>
<PopUp ref="MaterialReplenishment">
<u--form labelPosition="left" label-width="80px" :model="form" ref="uForm">
<u-form-item label="物料名称" borderBottom ref="item1">
<u--input v-model="form.name" border="bottom"></u--input>
</u-form-item>
<u-form-item label="物料名称" borderBottom ref="item1">
<u--input v-model="form.name" border="bottom"></u--input>
</u-form-item>
<u-form-item label="物料名称" borderBottom ref="item1">
<u--input v-model="form.name" border="bottom"></u--input>
</u-form-item>
<u-form-item label="物料名称" borderBottom ref="item1">
<u--input v-model="form.name" border="bottom"></u--input>
</u-form-item>
</u--form>
</PopUp>
<saomiao2 :ishidestop="scanState !== 0"></saomiao2>
<BluetoothList ref="bluetoothList"></BluetoothList>
</template>
<script lang="ts" setup>
import { ref, reactive, shallowRef, watch, nextTick, computed } from 'vue';
import {
onShow,
onHide,
onLoad,
onReachBottom,
onPullDownRefresh
} from '@dcloudio/uni-app'
import utils from '@/utils/utils.js';
import {
distributionOrderInFuzzyQuery,
distributionOrderInfoInQuery,
BatchPrintPackages
} from '@/api/user.js'
import useBluetoothStore from '@/store/useBluetoothStore.js';
import useSystemSettingsStore from '@/store/useSystemSettingsStore';
import { storeToRefs } from 'pinia';
const { scanState } = storeToRefs(useSystemSettingsStore())
const bluetoothList = ref(null)
const bluetoothStore = useBluetoothStore()
const { bluetoothInfo } = storeToRefs(bluetoothStore)
const option = reactive({
title: "订单查询",
haveData: true,
pullDownRefreshInitPage() {
dataInfo.value = {}
scancode.value = ''
packageList.value = []
},
haveReachBottom: false
})
// 订单详情
const dataInfo = shallowRef<any>({})
// 包件列表
const packageList = ref([])
// 是否开启批量操作
const isBatchOperation = ref<Boolean>(false)
// 是否显示定制品
const showArticleMadeToOrder = ref<Boolean>(true)
// 扫码码值
const scancode = ref<string>('')
// 库存品列表
const stockList = shallowRef([])
/** 复选框被选中的值 */
const seletionList = ref([])
// 订单状态字典
const orderStateDictionaries = reactive({
'10': '部分入库',
'20': '已入库',
'30': '部分出库',
'40': '已出库',
'50': '部分装车',
'60': '已装车',
'70': '部分签收',
'80': '已签收',
})
// 顶部搜素表单
const searchForm = reactive({
condition: '',
type: 1,
})
/** 修改物料表单 */
const form = ref({})
const columnList = ref([
{
label: '包条码',
prop: 'orderPackageCode',
width: '250px'
},
{
label: '库位信息',
prop: 'goodsAllocation',
width: '100px'
},
{
label: '托盘名称',
prop: 'pallet',
width: '100px',
click(item) {
if (!item.trayCode) return
uni.navigateTo({
url: '/pagesHome/pages/OrderSortingDetail/OrderSortingDetail?trayCode='
+ item.trayCode + '&trayType='
+ item.trayType
})
}
},
{
label: '三级品',
prop: 'thirdProduct',
width: '200px',
},
{
label: '签收状态',
prop: 'orderPackageStatusName',
width: '100px'
}
])
/** 库存品表头 */
const columnListByStock = ref([
{
label: '物料编码',
prop: 'cargoNumber',
width: '250px'
},
{
label: '物料名称',
prop: 'descriptionGoods',
width: '100px'
},
{
label: '商场名称',
prop: 'marketName',
width: '100px',
},
{
label: '签收状态',
prop: 'orderPackageStatusName',
width: '100px'
}
])
// 组件实例
const tiplists = ref(null)
/** 物料补录 */
const MaterialReplenishment = ref()
/** 被选中的ids */
const ids = computed(() => {
const ids = []
seletionList.value.forEach(val => {
ids.push(val.id)
})
return ids
})
onLoad(() => {
// #ifdef APP
utils.ttsspke('订单查询, 请扫描或输入包条码')
// #endif
})
// 开启监听扫描
onShow(async () => {
uni.$off('scancodedate')
uni.$on('scancodedate', function (code) {
if (code) {
scancode.value = code
scandata()
}
})
})
/** 切换提交 */
const handleCheckType = (type : 1 | 2) => {
if (type === searchForm.type) return
searchForm.type = type
utils.handleToast('请扫描或输入' + (searchForm.type === 1 ? '包条码' : '订单号'))
}
async function scandata() {
// 扫描已查询出的包件,将包件排至首位
for (let i = 0; i < packageList.value.length; i++) {
const _value = packageList.value[i]
if (scancode.value !== _value.orderPackageCode) continue
packageList.value.unshift(packageList.value.splice(i, 1)[0])
showArticleMadeToOrder.value = true
return
}
searchForm.condition = scancode.value
const res = await distributionOrderInfoInQuery(searchForm)
const { code, data } = res
if (code === 200) {
dataInfo.value = data
let _packageList = data.list
for (let i = 0; i < _packageList.length; i++) {
const _value = _packageList[i]
_value.orderPackageStatusName = _value.orderPackageStatus === '70' ? '已签' : '未签'
_value.isChecked = false
if (scancode.value !== _value.orderPackageCode) continue
_packageList.unshift(_packageList.splice(i, 1)[0])
showArticleMadeToOrder.value = true
}
packageList.value = _packageList
stockList.value = data.stockList
for (let i = 0; i < stockList.value.length; i++) {
const _value = stockList.value[i]
_value.orderPackageStatusName = _value.orderPackageStatus === '70' ? '已签' : '未签'
}
}
}
const selectionChange = (list) => {
console.log('list :>> ', list);
seletionList.value = list
}
// 显示定制品模块
function showArticleMadeToOrderModule() {
showArticleMadeToOrder.value = true
isBatchOperation.value = false
}
// 开启批量操作
function batchOperationBtn() {
isBatchOperation.value = true
}
// 批量打印
async function batchPrint() {
const idsValue = ids.value.join(',')
if (!idsValue) return uni.showToast({
title: '最少选择一条数据',
icon: 'none'
})
const res = await BatchPrintPackages(idsValue)
const { code, data } = res
if (code !== 200) return
console.log('res :>> ', res);
tiplists.value.setdetails({
title: '请选择需要打印的包条码',
isshow: true,
tipstate: 2,
list: [],
inputtext: '',
confirmTxt: '确认选择',
isonecheck: true,
success: () => {
console.log('data :>> ', data);
// #ifdef APP
if (!bluetoothInfo.value.name) return bluetoothList.value.setdetails({ isshow: true })
let _isReturn = false
data.map(item => {
if (_isReturn) return
let text = '! 0 200 200 333 1\r\n'
text += 'SETBOLD 1\r\n'
text += `T 56 0 0 0 ${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 ${item.customerName}\r\n`
text += 'LINE 40 80 420 80 3\r\n'
text += `T 55 0 50 90 ${item.customerAddress}\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 ${item.materialName || item.category}\r\n`
text += 'LINE 0 140 420 140 3\r\n'
text += 'B QR 150 150 M 2 U 4\r\n'
text += `MA,${item.qrCode}\r\n`
text += 'ENDQR\r\n'
text += `T 55 0 140 260 ${item.qrCode}\r\n`
text += 'FORM\r\n'
text += 'PRINT\r\n'
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 })
}
})
}
/** 托盘详情 */
const handleGoTrayDetails = (item) => {
console.log('item :>> ', item);
if (!item.trayCode) return
uni.navigateTo({
url: '/pagesHome/pages/OrderSortingDetail/OrderSortingDetail?trayCode='
+ item.trayCode + '&trayType='
+ item.trayType
})
}
</script>
<style lang="scss" scoped>
@import url('@/utils/style/common.scss');
.w100 {
width: 100%;
}
// 最外层容器
.container {
padding: 0 20upx;
font-size: 0.8rem; // 本页字体大小
&.pt20 {
padding-top: 20upx;
}
}
// 顶部搜索栏
.header-search {
display: flex;
justify-content: space-between;
}
.search {
position: relative;
height: 70upx;
:deep(.input_container) {
border-color: var(--subjectColor);
background-color: #fff;
flex: 1;
box-sizing: border-box;
border-radius: 60upx;
}
}
// 搜索输入框
.searchInput {
background: #fff;
width: 500upx;
height: 100%;
padding-left: 20upx;
border: 2upx solid var(--subjectColor);
border-radius: 30upx;
}
// 搜索类型
.searchType {
height: 100%;
display: flex;
align-items: center;
padding: 0 40upx;
background: #fff;
border: 4upx solid var(--subjectColor);
border-radius: 10upx;
box-sizing: border-box;
color: var(--subjectColor);
}
// 数据详情
.dataInfo {
display: flex;
flex-wrap: wrap;
background: #fff;
}
.dataInfo__item {
flex: none;
min-width: 50%;
max-width: 100%;
line-height: 60upx;
display: inline-flex;
.label {
display: inline-block;
width: 160upx;
text-align: right;
margin-right: 20rpx;
flex: none;
}
}
// tabbar
.tabbar {
margin-top: 20upx;
background-color: #fff;
display: flex;
justify-content: space-around;
font-size: 1rem;
font-weight: bold;
margin-bottom: 20upx;
&>view {
padding: 15upx 0;
flex: 1;
text-align: center;
position: relative;
&::after {
content: '';
display: block;
position: absolute;
height: 6upx;
width: 0;
background: var(--subjectColor);
bottom: 0;
left: 50%;
transition: all 0.5s;
}
&.active::after {
width: 100%;
left: 0;
}
}
}
.tabbar__number {
color: var(--subjectColor);
}
// 订单列表信息
.orderInfo {
background: #fff;
margin-top: 10upx;
// 批量操作按钮
.batchOperationBtn {
border: 2upx solid var(--subjectColor);
text-align: center;
padding: 10upx 0;
color: var(--subjectColor);
border-radius: 10upx;
width: 200upx;
font-size: 28upx;
margin: 0;
margin-right: 10upx;
}
}
.redioBox {
$color: #bbb;
$width: 0.7rem;
padding: 8upx;
border: 6upx solid $color;
width: fit-content;
border-radius: 50%;
transition: all 0.5s;
&::after {
content: '';
display: block;
width: $width;
height: $width;
background-color: $color;
border-radius: 50%;
transition: all 0.5s;
}
&.active {
border-color: var(--subjectColor);
&::after {
background-color: var(--subjectColor);
}
}
}
</style>