4 changed files with 1109 additions and 0 deletions
@ -0,0 +1,166 @@ |
|||
<template> |
|||
<view class="" style="background-color: #fff;"> |
|||
<u-collapse ref="collapse1" @change=""> |
|||
<u-collapse-item :open="true"> |
|||
<template v-slot:title> |
|||
<item-compare-qty :dataContent="dataContent" :handleQty="dataContent.handleQty" |
|||
:isShowStdPack="false"> |
|||
</item-compare-qty> |
|||
</template> |
|||
|
|||
<view class="" v-for="(item,index) in dataContent.subList" :key="index"> |
|||
<u-swipe-action ref="swipeAction" :options="item.scaned?scanOptions:detailOptions" |
|||
@click="(...event)=>swipeClick(event,item)"> |
|||
<recommend :detail="item" :isShowStatus="isShowStatus" :isShowToLocation="isShowToLocation"> |
|||
</recommend> |
|||
</u-swipe-action> |
|||
</view> |
|||
</u-collapse-item> |
|||
</u-collapse> |
|||
<balance-qty-edit ref="qtyEdit" :settingParam="settingParam" :queryBalance="queryBalance" |
|||
@confirm="confirm"></balance-qty-edit> |
|||
<win-scan-location ref="scanLocationCode" title="目标库位" @getLocation='getLocation' |
|||
:locationAreaTypeList="locationAreaTypeList"></win-scan-location> |
|||
<comMessage ref="message"></comMessage> |
|||
</view> |
|||
</template> |
|||
|
|||
<script setup lang="ts"> |
|||
import itemCompareQty from '@/mycomponents/item/itemCompareQty.vue' |
|||
import recommend from '@/mycomponents/recommend/recommend.vue' |
|||
import balanceQtyEdit from '@/mycomponents/qty/balanceQtyEdit.vue' |
|||
import winScanLocation from "@/mycomponents/scan/winScanLocation.vue" |
|||
import {getDetailOption, getPurchaseReceiptOption} from '@/common/array.js'; |
|||
|
|||
import {ref, watch, onMounted, nextTick} from 'vue'; |
|||
|
|||
|
|||
// 定义 props |
|||
const props = defineProps({ |
|||
dataContent: { |
|||
type: Object, |
|||
default: null |
|||
}, |
|||
settingParam: { |
|||
type: Object, |
|||
default: null |
|||
}, |
|||
isShowPack: { |
|||
type: Boolean, |
|||
default: true |
|||
}, |
|||
isShowBatch: { |
|||
type: Boolean, |
|||
default: true |
|||
}, |
|||
isShowLocation: { |
|||
type: Boolean, |
|||
default: true |
|||
}, |
|||
isShowToLocation: { |
|||
type: Boolean, |
|||
default: false |
|||
}, |
|||
locationAreaTypeList: { |
|||
type: Array, |
|||
default: null |
|||
}, |
|||
queryBalance: { |
|||
type: Boolean, |
|||
default: true |
|||
}, |
|||
isShowStatus: { |
|||
type: Boolean, |
|||
default: true |
|||
} |
|||
}); |
|||
|
|||
// 定义 emits |
|||
const emit = defineEmits(['openDetail', 'updateData', 'remove']); |
|||
|
|||
// 响应式数据 |
|||
const option = ref([]); |
|||
const showItem = ref({}); |
|||
const locatonItem = ref({}); |
|||
const editItem = ref({}); |
|||
const detailOptions = ref([]); |
|||
const scanOptions = ref([]); |
|||
|
|||
const collapse1 = ref(null); |
|||
const qtyEdit = ref(null); |
|||
const message = ref(null); |
|||
const scanLocationCode = ref(null); |
|||
// 监听 dataContent 变化 |
|||
watch(() => props.dataContent, (newVal, oldVal) => { |
|||
if (newVal?.subList?.length > 0) { |
|||
nextTick(() => { |
|||
setTimeout(() => { |
|||
if (collapse1.value) { |
|||
collapse1.value.init(); |
|||
} |
|||
}, 500); |
|||
}); |
|||
} |
|||
}, {immediate: true, deep: true}); |
|||
|
|||
// 生命周期钩子 |
|||
onMounted(() => { |
|||
if (detailOptions.value.length === 0) { |
|||
detailOptions.value = getDetailOption(); |
|||
} |
|||
if (scanOptions.value.length === 0) { |
|||
scanOptions.value = getPurchaseReceiptOption(props.settingParam.allowModifyQty, false); |
|||
} |
|||
}); |
|||
|
|||
// 方法 |
|||
const swipeClick = (e, item) => { |
|||
if (e.content.text === "详情") { |
|||
detail(item); |
|||
} else if (e.content.text === "编辑") { |
|||
edit(item); |
|||
} else if (e.content.text === "库位") { |
|||
showLocation(item); |
|||
} else if (e.content.text === "移除") { |
|||
remove(item); |
|||
} |
|||
}; |
|||
|
|||
const edit = (item) => { |
|||
editItem.value = item; |
|||
qtyEdit.value.openEditPopup(item.balance, item.handleQty); |
|||
}; |
|||
|
|||
const detail = (item) => { |
|||
emit('openDetail', item); |
|||
}; |
|||
|
|||
const remove = (item) => { |
|||
message.value.showQuestionMessage("确定移除扫描信息?", res => { |
|||
if (res) { |
|||
item.scaned = false; |
|||
item.balance = {}; |
|||
item.handleQty = null; |
|||
emit('remove', item); |
|||
} |
|||
}); |
|||
}; |
|||
|
|||
const confirm = (qty) => { |
|||
editItem.value.handleQty = qty; |
|||
emit('updateData'); |
|||
}; |
|||
|
|||
const showLocation = (item) => { |
|||
locatonItem.value = item; |
|||
scanLocationCode.value.openScanPopup(); |
|||
}; |
|||
|
|||
const getLocation = (location, code) => { |
|||
locatonItem.value.toLocationCode = code; |
|||
emit('updateData'); |
|||
}; |
|||
</script> |
|||
|
|||
<style> |
|||
</style> |
@ -0,0 +1,177 @@ |
|||
<template> |
|||
<view class="" style="background-color: #fff;"> |
|||
<u-collapse ref="collapse1"> |
|||
<u-collapse-item :open="true"> |
|||
<template v-slot:title> |
|||
<u-swipe-action ref="swipeAction" :options="removeOptions" @click="removeData($event,dataContent)"> |
|||
<item-qty :dataContent="dataContent" |
|||
:isShowBalanceQty="false" |
|||
:isShowBalance="true"></item-qty> |
|||
</u-swipe-action> |
|||
</template> |
|||
|
|||
<view class="" v-for="(item,index) in dataContent.subList"> |
|||
<u-swipe-action ref="swipeAction" :options="item.scaned?scanOptions:detailOptions" |
|||
@click="swipeClick($event,item,index)"> |
|||
<comMovebalance :dataContent="item" :isShowStdPack="false" :isShowPack="true" |
|||
:fromInventoryStatus="item.inventoryStatus" :toInventoryStatus="item.toInventoryStatus" |
|||
:isShowLocation="true" :allowEditStatus='allowEditStatus'></comMovebalance> |
|||
</u-swipe-action> |
|||
<view class='split_line'></view> |
|||
</view> |
|||
</u-collapse-item> |
|||
</u-collapse> |
|||
<balanceQtyEdit ref="balanceQtyEdit" @confirm="confirm" :isShowStatus="isShowStatus" |
|||
:allowEditStatus="allowEditStatus" |
|||
:allowEditQty="allowEditQty" |
|||
> |
|||
</balanceQtyEdit> |
|||
<job-detail-popup ref="winHint" :dataContent="showItem"></job-detail-popup> |
|||
<comMessage ref="comMessage"></comMessage> |
|||
</view> |
|||
</template> |
|||
|
|||
<script setup lang="ts"> |
|||
import itemQty from '@/mycomponents/item/itemQty.vue' |
|||
import recommend from '@/mycomponents/recommend/recommend.vue' |
|||
import jobDetailPopup from '@/mycomponents/job/jobDetailPopup.vue' |
|||
import balance from '@/mycomponents/balance/balance.vue' |
|||
import balanceMove from '@/mycomponents/balance/balanceMove.vue' |
|||
import comMovebalance from '@/pages/inventoryMove/coms/comMovebalance.vue' |
|||
import balanceQtyEdit from '@/mycomponents/qty/balanceQtyEdit.vue' |
|||
|
|||
import { |
|||
getDetailOption, |
|||
getDetailRemoveOption, |
|||
getRemoveOption |
|||
} from '@/common/array.js'; |
|||
import {ref, watch, onMounted, nextTick} from 'vue'; |
|||
|
|||
// 定义 props |
|||
const props = defineProps({ |
|||
dataContent: { |
|||
type: Object, |
|||
default: () => ({}) |
|||
}, |
|||
settingParam: { |
|||
type: Object, |
|||
default: () => ({}) |
|||
}, |
|||
fromInventoryStatus: { |
|||
type: String, |
|||
default: "" |
|||
}, |
|||
toInventoryStatus: { |
|||
type: String, |
|||
default: "" |
|||
}, |
|||
isShowStatus: { |
|||
type: Boolean, |
|||
default: true |
|||
}, |
|||
allowEditStatus: { |
|||
type: Boolean, |
|||
default: false |
|||
}, |
|||
allowEditQty: { |
|||
type: Boolean, |
|||
default: false |
|||
} |
|||
}); |
|||
|
|||
// 定义 emits |
|||
const emit = defineEmits(['removeData', 'removePack', 'updateData']); |
|||
|
|||
// 响应式数据 |
|||
const option = ref([]); |
|||
const title = ref("推荐详情"); |
|||
const showItem = ref({}); |
|||
const editItem = ref({}); |
|||
const detailOptions = ref([]); |
|||
const scanOptions = ref([]); |
|||
const removeOptions = ref([]); |
|||
const dataList = ref([]); |
|||
|
|||
const collapse1 = ref(null); |
|||
const comMessage = ref(null); |
|||
const balanceQtyEdit = ref(null); |
|||
const winHint = ref(null); |
|||
|
|||
// 监听 dataContent 变化 |
|||
watch(() => props.dataContent, (newVal, oldVal) => { |
|||
if (newVal?.subList?.length > 0) { |
|||
nextTick(() => { |
|||
setTimeout(() => { |
|||
if (collapse1.value) { |
|||
collapse1.value.init(); |
|||
} |
|||
}, 500); |
|||
}); |
|||
} |
|||
}, {immediate: true, deep: true}); |
|||
|
|||
// 生命周期钩子 |
|||
onMounted(() => { |
|||
detailOptions.value = getDetailOption(); |
|||
scanOptions.value = getDetailRemoveOption(); |
|||
removeOptions.value = getRemoveOption(); |
|||
}); |
|||
|
|||
// 方法 |
|||
const removeData = (e, dataContent) => { |
|||
if (e.content.text === "移除") { |
|||
comMessage.value.showQuestionMessage("确定移除扫描信息?", res => { |
|||
if (res) { |
|||
emit('removeData', dataContent); |
|||
} |
|||
}); |
|||
} |
|||
}; |
|||
|
|||
const swipeClick = (e, item, index) => { |
|||
if (e.content.text === "详情") { |
|||
detail(item); |
|||
} else if (e.content.text === "编辑") { |
|||
edit(item); |
|||
} else if (e.content.text === "移除") { |
|||
remove(item, index); |
|||
} |
|||
}; |
|||
|
|||
const edit = (item) => { |
|||
editItem.value = item; |
|||
balanceQtyEdit.value.openEditPopup(item, item.qty); |
|||
}; |
|||
|
|||
const detail = (item) => { |
|||
showItem.value = item; |
|||
dataList.value = [ |
|||
{title: "箱码", content: item.packingNumber}, |
|||
{title: "批次", content: item.batch}, |
|||
{title: "库位", content: item.locationCode}, |
|||
{title: "数量", content: item.qty}, |
|||
{title: "单位", content: item.uom} |
|||
]; |
|||
winHint.value.openScanPopup(showItem.value); |
|||
}; |
|||
|
|||
const remove = (item, index) => { |
|||
comMessage.value.showQuestionMessage("确定移除扫描信息?", res => { |
|||
if (res) { |
|||
item.scaned = false; |
|||
item.balance = {}; |
|||
item.handleQty = null; |
|||
emit('removePack', item); |
|||
} |
|||
}); |
|||
}; |
|||
|
|||
const confirm = (qty) => { |
|||
editItem.value.handleQty = qty; |
|||
emit('updateData'); |
|||
}; |
|||
|
|||
</script> |
|||
|
|||
<style> |
|||
</style> |
@ -0,0 +1,348 @@ |
|||
<template> |
|||
<view class="uni-flex" style="flex-direction: column;;"> |
|||
<job-filter ref="filter" otherTitle="ASN" :isShowProductionLineCode="false" :isShowItemCode="false" |
|||
:isShowQurery='true' @onQuery="getListByFilter"> |
|||
</job-filter> |
|||
<com-empty-view v-if="recordList.length==0"></com-empty-view> |
|||
<view v-if="recordList.length>0"> |
|||
<u-swipe-action ref="swipeAction" v-for="(item, index) in recordList" :key="index"> |
|||
<comReturnRecordCard :dataContent="item" @click='openJobDetail(item)'> |
|||
</comReturnRecordCard> |
|||
</u-swipe-action> |
|||
|
|||
<job-list-popup ref="jobListPopup" @selectedItem="selectedItem"></job-list-popup> |
|||
<job-info-popup ref='jobInfoPopup'></job-info-popup> |
|||
|
|||
<uni-load-more :status="loadingType"/> |
|||
</view> |
|||
<win-scan-button @goScan='openScanPopup' v-if="recordList.length>0"></win-scan-button> |
|||
<winScanPackJob ref="scanPopup" @getResult='getScanResult'></winScanPackJob> |
|||
<jobList ref="recordList" @selectItem="selectItem"></jobList> |
|||
<comMessage ref="comMessage"></comMessage> |
|||
</view> |
|||
</template> |
|||
|
|||
<script setup lang="ts"> |
|||
import {getInventoryMoveRecordList,} from '@/api/request2.js'; |
|||
import {goHome, updateTitle} from '@/common/basic.js'; |
|||
import {planRefreshTime, productionReceiptJobFilter} from '@/common/config.js'; |
|||
|
|||
import {getDetailOption, getDetailGiveupOption} from '@/common/array.js'; |
|||
|
|||
import comEmptyView from '@/mycomponents/common/comEmptyView.vue' |
|||
import jobFilter from '@/mycomponents/job/jobFilter.vue' |
|||
import comReturnRecordCard from '@/pages/customerReturn/coms/comReturnRecordCard.vue' |
|||
import jobListPopup from '@/pages/productionReceipt/coms/jobListPopup.vue' |
|||
import jobInfoPopup from '@/pages/productionReceipt/coms/jobInfoPopup.vue' |
|||
import winScanButton from '@/mycomponents/scan/winScanButton.vue' |
|||
import winScanPackJob from "@/mycomponents/scan/winScanPackJob.vue" |
|||
import jobList from '@/mycomponents/jobList/jobList.vue' |
|||
|
|||
|
|||
import { |
|||
ref, |
|||
onMounted, |
|||
onBeforeMount, |
|||
onBeforeUnmount, |
|||
onActivated, |
|||
onDeactivated, |
|||
onUpdated, |
|||
onRenderTracked, |
|||
onRenderTriggered |
|||
} from 'vue'; |
|||
import { |
|||
onLoad, |
|||
onShow, |
|||
onReady, |
|||
onReachBottom, |
|||
onPullDownRefresh, |
|||
onBackPress, |
|||
onNavigationBarButtonTap |
|||
} from '@dcloudio/uni-app' |
|||
// 定义 props |
|||
const props = defineProps({ |
|||
// 如果有 props 需要定义 |
|||
}); |
|||
|
|||
// 定义 emits |
|||
const emit = defineEmits(['someEvent']); // 如果有自定义事件需要定义 |
|||
|
|||
// 响应式数据 |
|||
const recordList = ref([]); |
|||
const pageNo = ref(1); |
|||
const pageSize = ref(10); |
|||
const totalCount = ref(0); |
|||
const loadingType = ref("nomore"); |
|||
const checkedToday = ref(false); |
|||
const checkedWaitTask = ref(false); |
|||
const todayTime = ref(""); |
|||
const detailOptions = ref([]); |
|||
const detailGiveupOptions = ref([]); |
|||
const title = ref(''); |
|||
const scanMessage = ref(""); |
|||
const filterItemCode = ref(""); |
|||
const queryParams = ref({ |
|||
creationTime: "", |
|||
receiveStatus: "", |
|||
itemCode: "" |
|||
}); |
|||
|
|||
const filter = ref(null); |
|||
const jobListPopup = ref(null); |
|||
const jobInfoPopup = ref(null); |
|||
const comMessage = ref(null); |
|||
const scanPopup = ref(null); |
|||
const recordList = ref(null); |
|||
|
|||
// 生命周期函数 |
|||
onLoad((option) => { |
|||
title.value = option.title; |
|||
}); |
|||
|
|||
onShow(() => { |
|||
getList('refresh'); |
|||
}); |
|||
|
|||
onReady(() => { |
|||
detailOptions.value = getDetailOption(); |
|||
detailGiveupOptions.value = getDetailGiveupOption(); |
|||
}); |
|||
|
|||
onReachBottom(() => { |
|||
// 避免多次触发 |
|||
if (loadingType.value === 'loading' || loadingType.value === 'nomore') { |
|||
return; |
|||
} |
|||
getList('more'); |
|||
}); |
|||
|
|||
onPullDownRefresh(() => { |
|||
getList('refresh'); |
|||
}); |
|||
|
|||
onBackPress((options) => { |
|||
if (options.from === 'navigateBack') { |
|||
uni.navigateBack({ |
|||
delta: 1 |
|||
}); |
|||
return false; |
|||
} |
|||
}); |
|||
|
|||
onNavigationBarButtonTap((e) => { |
|||
if (e.index === 0) { |
|||
goHome(); |
|||
} else if (e.index === 1) { |
|||
filter.value.openFilter(); |
|||
} |
|||
}); |
|||
|
|||
// 方法 |
|||
const setQueryParam = () => { |
|||
const filterParams = []; |
|||
|
|||
// 只看当天 |
|||
if (queryParams.value.creationTime) { |
|||
filterParams.push({ |
|||
column: "create_time", |
|||
action: "between", |
|||
value: queryParams.value.creationTime |
|||
}); |
|||
} |
|||
|
|||
// 只看待处理 |
|||
if (queryParams.value.receiveStatus) { |
|||
filterParams.push({ |
|||
column: "receiveStatus", |
|||
action: "in", |
|||
value: queryParams.value.receiveStatus |
|||
}); |
|||
} else { |
|||
filterParams.push({ |
|||
column: "receiveStatus", |
|||
action: "in", |
|||
value: "0" |
|||
}); |
|||
} |
|||
|
|||
// 物料代码 |
|||
if (queryParams.value.itemCode) { |
|||
filterParams.push({ |
|||
column: "itemCode", |
|||
action: "like", |
|||
value: queryParams.value.itemCode |
|||
}); |
|||
filterItemCode.value = queryParams.value.itemCode; |
|||
} else if (filterItemCode.value) { |
|||
filterParams.push({ |
|||
column: "itemCode", |
|||
action: "like", |
|||
value: filterItemCode.value |
|||
}); |
|||
} |
|||
|
|||
return filterParams; |
|||
}; |
|||
|
|||
const getList = (type) => { |
|||
uni.showLoading({ |
|||
title: "加载中....", |
|||
mask: true |
|||
}); |
|||
|
|||
loadingType.value = "loading"; |
|||
if (type === "refresh") { |
|||
pageNo.value = 1; |
|||
recordList.value = []; |
|||
} |
|||
|
|||
const queryFiltersParams = setQueryParam(); |
|||
const params = { |
|||
filters: queryFiltersParams, |
|||
pageNo: pageNo.value, |
|||
pageSize: pageSize.value, |
|||
}; |
|||
|
|||
console.log("查询条件", JSON.stringify(params)); |
|||
|
|||
getInventoryMoveRecordList(params).then((res) => { |
|||
uni.hideLoading(); |
|||
if (type === "refresh") { |
|||
uni.stopPullDownRefresh(); |
|||
} |
|||
|
|||
const list = res.data.list; |
|||
totalCount.value = res.data.total; |
|||
updateTitle(title.value + " (" + totalCount.value + ")"); |
|||
loadingType.value = "loadmore"; |
|||
|
|||
if (!list || list.length === 0) { |
|||
loadingType.value = "nomore"; |
|||
return; |
|||
} |
|||
|
|||
list.forEach((item) => { |
|||
item.packingNumber = item.toPackingNumber; |
|||
}); |
|||
|
|||
recordList.value = type === "refresh" ? list : recordList.value.concat(list); |
|||
pageNo.value++; |
|||
}).catch((error) => { |
|||
if (type === "refresh") { |
|||
uni.stopPullDownRefresh(); |
|||
} |
|||
loadingType.value = ""; |
|||
updateTitle(title.value); |
|||
uni.hideLoading(); |
|||
showMessage(error); |
|||
}); |
|||
}; |
|||
|
|||
const openJobDetail = (item, scanMes = '') => { |
|||
uni.navigateTo({ |
|||
url: `./recordListDetail?id=${item.masterId}&receiveStatus=${item.receiveStatus}&scanMessage=${scanMes}&title=${title.value}` |
|||
}); |
|||
scanMessage.value = ""; |
|||
}; |
|||
|
|||
const showItemList = (itemList) => { |
|||
jobListPopup.value.openPopup(itemList); |
|||
}; |
|||
|
|||
const selectedItem = (item) => { |
|||
openJobDetail(item); |
|||
}; |
|||
|
|||
const openjobInfoPopup = (item) => { |
|||
jobInfoPopup.value.openPopup(item); |
|||
}; |
|||
|
|||
const showMessage = (message) => { |
|||
if (scanPopup.value) { |
|||
scanPopup.value.packLoseFocus(); |
|||
} |
|||
comMessage.value.showErrorMessage(message, (res) => { |
|||
if (res && scanPopup.value) { |
|||
scanPopup.value.packGetFocus(); |
|||
} |
|||
}); |
|||
}; |
|||
|
|||
const openScanPopup = () => { |
|||
scanPopup.value.openScanPopup(); |
|||
}; |
|||
|
|||
const selectItem = (item) => { |
|||
scanPopup.value.closeScanPopup(); |
|||
openJobDetail(item, scanMessage.value); |
|||
}; |
|||
|
|||
const getScanResult = (result) => { |
|||
try { |
|||
scanMessage.value = ""; |
|||
const filters = [ |
|||
{ |
|||
column: "toPackingNumber", |
|||
action: "in", |
|||
value: `${result.package.number},${result.package.parentNumber}` |
|||
}, |
|||
{ |
|||
column: "receiveStatus", |
|||
action: "in", |
|||
value: '0' |
|||
}, |
|||
{ |
|||
column: "toBatch", |
|||
action: "==", |
|||
value: result.label.batch |
|||
}, |
|||
{ |
|||
column: "itemCode", |
|||
action: "==", |
|||
value: result.label.itemCode |
|||
}, |
|||
]; |
|||
|
|||
getInventoryMoveRecordList({ |
|||
filters: filters, |
|||
pageNo: 1, |
|||
pageSize: 100, |
|||
}).then((res) => { |
|||
scanMessage.value = result.scanMessage; |
|||
const resultList = res.data.list; |
|||
if (resultList.length > 0) { |
|||
resultList.forEach((item) => { |
|||
item.title = item.number; |
|||
item.selected = false; |
|||
}); |
|||
|
|||
const list = resultList.filter((item, index, self) => self.findIndex((t) => t.title === item.title) === index); |
|||
|
|||
if (list.length > 1) { |
|||
recordList.value.openList(list); |
|||
} else { |
|||
selectItem(list[0]); |
|||
} |
|||
} else { |
|||
showMessage(`未查找到任务\n扫描[${result.scanMessage}]`); |
|||
} |
|||
}).catch((error) => { |
|||
showMessage(`${error}\n扫描[${result.scanMessage}]`); |
|||
}); |
|||
} catch (e) { |
|||
showMessage(e.message); |
|||
} |
|||
}; |
|||
|
|||
const getListByFilter = (params) => { |
|||
queryParams.value.creationTime = params.creationTime; |
|||
queryParams.value.receiveStatus = params.receiveStatus; |
|||
queryParams.value.itemCode = params.itemCode; |
|||
getList('refresh'); |
|||
}; |
|||
|
|||
</script> |
|||
|
|||
<style scoped lang="scss"> |
|||
|
|||
</style> |
@ -0,0 +1,418 @@ |
|||
<template> |
|||
<view class="page-wraper"> |
|||
<view class="page-main"> |
|||
<view class="page-header"> |
|||
<view class="header-view"> |
|||
<view class="header_job_top"> |
|||
<receive-top :dataContent="recordContent"></receive-top> |
|||
</view> |
|||
</view> |
|||
</view> |
|||
<view v-if="detailSource.length>0" class="uni-flex uni-row " |
|||
style=";margin-top: 15rpx; margin-bottom: 15rpx; margin-left: 20rpx; text-align: right;"> |
|||
<view class="font_default" style="display: block; font-weight: bold;"> |
|||
整单接收 |
|||
</view> |
|||
<view class="uni-flex" style="margin-left: 20rpx; align-items: center; text-align: center;"> |
|||
<u-switch v-model="isAllReceived" active-color="#5FCB94" inactive-color="#eee" size="35" |
|||
@change="switchChange"></u-switch> |
|||
</view> |
|||
</view> |
|||
<scroll-view scroll-y="true"> |
|||
<view class="detail-list" v-for="(item, index) in detailSource" :key="item.id"> |
|||
<view class=""> |
|||
<com-detail-card :dataContent="item" :index="index" :settingParam="recordContent" |
|||
@remove="updateData" :isShowToLocation="true" @updateData="updateData" |
|||
@openDetail="openDetail"> |
|||
</com-detail-card> |
|||
|
|||
<view class='split_line'></view> |
|||
</view> |
|||
|
|||
</view> |
|||
</scroll-view> |
|||
</view> |
|||
|
|||
<view class="page-footer"> |
|||
<view class="uni-flex u-col-center space-between padding_10" |
|||
style="background-color:ghostwhite; width: 100%; "> |
|||
<view class=" uni-flex uni-row"> |
|||
<button class="btn_single_commit" style="width: 280rpx;" hover-class="btn_commit_after" |
|||
@click="reject">拒绝 |
|||
</button> |
|||
</view> |
|||
<view class=" uni-flex uni-row"> |
|||
<button class="btn_single_commit" style="width: 280rpx;" hover-class="btn_commit_after" |
|||
@click="receive" :disabled="receiveDisable">接收 |
|||
</button> |
|||
</view> |
|||
</view> |
|||
</view> |
|||
|
|||
<win-scan-button @goScan='openScanPopup'></win-scan-button> |
|||
<win-scan-pack ref="scanPopup" @getResult='getScanResult' headerType="HPQ,HMQ"></win-scan-pack> |
|||
|
|||
<detail-info-popup ref="detailInfoPopup"></detail-info-popup> |
|||
|
|||
<comMessage ref="comMessage"></comMessage> |
|||
</view> |
|||
</template> |
|||
|
|||
<script setup lang="ts"> |
|||
|
|||
import { |
|||
getInventoryMoveRecordDetail, |
|||
inventoryMoveRecordRefuse, |
|||
inventoryMoveRecordReceive, |
|||
} from '@/api/request2.js'; |
|||
import { |
|||
goHome, |
|||
navigateBack, |
|||
getCurrDateTime, |
|||
getInventoryStatusName, |
|||
getSwitchInfoByCode |
|||
} from '@/common/basic.js'; |
|||
import { |
|||
getDataSource, |
|||
calcHandleQty, |
|||
getScanCount |
|||
} from '@/common/detail.js'; |
|||
|
|||
import winScanButton from '@/mycomponents/scan/winScanButton.vue' |
|||
import comDetailCard from "@/mycomponents/detail/comDetailCard.vue" |
|||
import receiveTop from '@/mycomponents/receive/receiveTop.vue' |
|||
import winScanPack from '@/mycomponents/scan/winScanPack.vue' |
|||
import {ref} from 'vue'; |
|||
import { |
|||
onLoad, |
|||
onBackPress, |
|||
onNavigationBarButtonTap |
|||
} from '@dcloudio/uni-app' |
|||
|
|||
// 定义 props |
|||
const props = defineProps({ |
|||
// 如果有 props 需要定义 |
|||
}); |
|||
|
|||
// 定义 emits |
|||
const emit = defineEmits(['someEvent']); // 如果有自定义事件需要定义 |
|||
|
|||
// 响应式数据 |
|||
const id = ref(''); |
|||
const scanCount = ref(0); |
|||
const recordContent = ref({}); |
|||
const subList = ref([]); |
|||
const detailSource = ref([]); |
|||
const fromLocationCode = ref(""); |
|||
const toLocationCode = ref(""); |
|||
const isAllReceived = ref(false); |
|||
const receiveDisable = ref(true); |
|||
|
|||
const detailInfoPopup = ref(null); |
|||
const scanPopup = ref(null); |
|||
const comMessage = ref(null); |
|||
|
|||
onLoad((option) => { |
|||
uni.setNavigationBarTitle({ |
|||
title: option.title + '详情' |
|||
}); |
|||
id.value = option.id; |
|||
if (id.value !== undefined) { |
|||
if (option.receiveStatus === "0") { |
|||
getDetail(); |
|||
} |
|||
} |
|||
}); |
|||
|
|||
onNavigationBarButtonTap((e) => { |
|||
if (e.index === 0) { |
|||
goHome(); |
|||
} |
|||
}); |
|||
|
|||
onBackPress((e) => { |
|||
if (e.from === 'backbutton') { |
|||
uni.navigateBack(); |
|||
return true; |
|||
} |
|||
}); |
|||
|
|||
const getDetail = () => { |
|||
uni.showLoading({ |
|||
title: "加载中....", |
|||
mask: true |
|||
}); |
|||
getInventoryMoveRecordDetail(id.value).then((res) => { |
|||
uni.hideLoading(); |
|||
isAllReceived.value = false; |
|||
receiveDisable.value = true; |
|||
if (res.data == null) { |
|||
showMessage('未获取到详情'); |
|||
} else { |
|||
if (res.data.list.length > 0) { |
|||
recordContent.value = res.data.list[0]; |
|||
subList.value = res.data.list; |
|||
subList.value.forEach((item) => { |
|||
item.batch = item.toBatch; |
|||
item.packingNumber = item.toPackingNumber; |
|||
item.inventoryStatus = item.fromInventoryStatus; |
|||
item.toInventoryStatus = item.toInventoryStatus; |
|||
}); |
|||
detailSource.value = getDataSource(subList.value); |
|||
} else { |
|||
showMessage('列表数据为0'); |
|||
} |
|||
} |
|||
}).catch((error) => { |
|||
uni.hideLoading(); |
|||
showErrorMessage(error); |
|||
}); |
|||
}; |
|||
|
|||
const calcHandleQty = () => { |
|||
calcHandleQty(detailSource.value); |
|||
updateBtn(); |
|||
continueScan(); |
|||
// $forceUpdate() 在 Vue 3 中不需要 |
|||
}; |
|||
|
|||
const updateBtn = () => { |
|||
scanCount.value = getScanCount(subList.value); |
|||
if (scanCount.value === subList.value.length) { |
|||
receiveDisable.value = false; |
|||
} else { |
|||
receiveDisable.value = true; |
|||
} |
|||
}; |
|||
|
|||
const continueScan = () => { |
|||
scanCount.value = getScanCount(subList.value); |
|||
if (scanCount.value === subList.value.length) { |
|||
closeScanPopup(); |
|||
} else { |
|||
scanPopupGetFocus(); |
|||
} |
|||
}; |
|||
|
|||
const updateData = () => { |
|||
calcHandleQty(); |
|||
updateBtn(); |
|||
}; |
|||
|
|||
const openDetail = (item) => { |
|||
detailInfoPopup.value.openPopup(item); |
|||
}; |
|||
|
|||
const openScanPopup = () => { |
|||
scanPopup.value.openScanPopup(); |
|||
}; |
|||
|
|||
const closeScanPopup = () => { |
|||
scanPopup.value.closeScanPopup(); |
|||
}; |
|||
|
|||
const getScanResult = (result) => { |
|||
try { |
|||
const itemCode = result.label.itemCode; |
|||
const packingNumber = result.package.number; |
|||
const batch = result.label.batch; |
|||
const detail = detailSource.value.find((r) => r.itemCode === itemCode); |
|||
|
|||
if (detail === undefined) { |
|||
showErrorMessage(`物料号【${itemCode}】不在列表中`); |
|||
} else { |
|||
const itemDetail = detail.subList.find((r) => r.packingNumber === packingNumber && r.batch === batch); |
|||
if (itemDetail === undefined) { |
|||
showErrorMessage(`箱码[${packingNumber}]批次[${batch}]不在列表中`); |
|||
} else { |
|||
if (itemDetail.scaned) { |
|||
showErrorMessage(`箱码[${packingNumber}]批次[${batch}]已经扫描`); |
|||
} else { |
|||
itemDetail.scaned = true; |
|||
itemDetail.handleQty = Number(itemDetail.qty); |
|||
calcHandleQty(); |
|||
} |
|||
} |
|||
} |
|||
} catch (e) { |
|||
showMessage(e.message); |
|||
} |
|||
}; |
|||
|
|||
const reject = () => { |
|||
showQuestionMessage("是否拒绝接收?", (res) => { |
|||
if (res) { |
|||
uni.showLoading({ |
|||
title: "提交中....", |
|||
mask: true |
|||
}); |
|||
inventoryMoveRecordRefuse(id.value).then((res) => { |
|||
uni.hideLoading(); |
|||
if (res.data) { |
|||
showCommitSuccessMessage("拒绝成功"); |
|||
} else { |
|||
showErrorMessage(`拒绝失败[${res.msg}]`); |
|||
} |
|||
}).catch((error) => { |
|||
uni.hideLoading(); |
|||
showErrorMessage(error); |
|||
}); |
|||
} |
|||
}); |
|||
}; |
|||
|
|||
const receive = () => { |
|||
scanCount.value = getScanCount(subList.value); |
|||
if (scanCount.value === 0) { |
|||
showErrorMessage("扫描数为0,请先扫描"); |
|||
return; |
|||
} |
|||
if (scanCount.value < subList.value.length) { |
|||
showErrorMessage("还有未扫描的数据,请先扫描"); |
|||
return; |
|||
} |
|||
|
|||
if (scanCount.value === subList.value.length) { |
|||
receiveSubmit(); |
|||
} |
|||
}; |
|||
|
|||
const showMessageHint = (hint, callback) => { |
|||
comMessage.value.showErrorMessage(hint, (res) => { |
|||
if (res) { |
|||
callback(); |
|||
} |
|||
}); |
|||
}; |
|||
|
|||
const receiveSubmit = () => { |
|||
uni.showLoading({ |
|||
title: "提交中....", |
|||
mask: true |
|||
}); |
|||
inventoryMoveRecordReceive(id.value).then((res) => { |
|||
uni.hideLoading(); |
|||
if (res.data) { |
|||
showCommitSuccessMessage("接收成功"); |
|||
} else { |
|||
showErrorMessage(`接收失败[${res.msg}]`); |
|||
} |
|||
}).catch((error) => { |
|||
uni.hideLoading(); |
|||
showErrorMessage(error); |
|||
}); |
|||
}; |
|||
|
|||
const showMessage = (message) => { |
|||
setTimeout(() => { |
|||
scanPopupLoseFocus(); |
|||
comMessage.value.showMessage(message, (res) => { |
|||
if (res) { |
|||
afterCloseMessage(); |
|||
} |
|||
}); |
|||
}); |
|||
}; |
|||
|
|||
const showErrorMessage = (message) => { |
|||
setTimeout(() => { |
|||
scanPopupLoseFocus(); |
|||
comMessage.value.showErrorMessage(message, (res) => { |
|||
if (res) { |
|||
afterCloseMessage(); |
|||
} |
|||
}); |
|||
}); |
|||
}; |
|||
|
|||
const showQuestionMessage = (message, callback) => { |
|||
setTimeout(() => { |
|||
scanPopupLoseFocus(); |
|||
comMessage.value.showQuestionMessage(message, (res) => { |
|||
if (res) { |
|||
callback(res); |
|||
} |
|||
}); |
|||
}); |
|||
}; |
|||
|
|||
const scanPopupGetFocus = () => { |
|||
if (scanPopup.value) { |
|||
scanPopup.value.getfocus(); |
|||
} |
|||
}; |
|||
|
|||
const scanPopupLoseFocus = () => { |
|||
if (scanPopup.value) { |
|||
scanPopup.value.losefocus(); |
|||
} |
|||
}; |
|||
|
|||
const afterCloseMessage = () => { |
|||
scanPopupGetFocus(); |
|||
}; |
|||
|
|||
const showCommitSuccessMessage = (hint) => { |
|||
comMessage.value.showSuccessMessage(hint, (res) => { |
|||
navigateBack(1); |
|||
}); |
|||
}; |
|||
|
|||
const switchChange = (isOn) => { |
|||
isAllReceived.value = isOn; |
|||
if (isAllReceived.value) { |
|||
detailSource.value.forEach((item) => { |
|||
item.subList.forEach((info) => { |
|||
info.scaned = true; |
|||
info.handleQty = Number(info.qty); |
|||
}); |
|||
}); |
|||
calcHandleQty(); |
|||
} else { |
|||
showQuestionMessage("是否要关闭整单收货?", (res) => { |
|||
if (res) { |
|||
getDetail(); |
|||
} else { |
|||
isAllReceived.value = true; |
|||
} |
|||
}); |
|||
} |
|||
}; |
|||
</script> |
|||
|
|||
<style scoped lang="scss"> |
|||
page { |
|||
width: 100%; |
|||
height: 100%; |
|||
background-color: #fff; |
|||
} |
|||
|
|||
.page-wraper { |
|||
display: flex; |
|||
flex-direction: column; |
|||
width: 100%; |
|||
height: 100%; |
|||
} |
|||
|
|||
|
|||
.page-main { |
|||
flex: 1; |
|||
position: relative; |
|||
} |
|||
|
|||
.page-main-scroll { |
|||
position: absolute; |
|||
left: 0; |
|||
right: 0; |
|||
top: 0; |
|||
bottom: 0; |
|||
} |
|||
|
|||
.page-main-list { |
|||
/* height: 80rpx; |
|||
line-height: 80rpx; */ |
|||
text-align: center; |
|||
background: #e0e0e0; |
|||
|
|||
} |
|||
</style> |
Loading…
Reference in new issue