<template> <view class=""> <job-filter ref="filter" button1Title="ASN" button2Title="任务编号" @switchChangeToday="switchChangeToday" @switchChangeWait="switchChangeWait" @OnButton1Click="scanAsN" @OnButton2Click="scanAppro" :checkedToday="checkedToday" :checkedWaitTask="checkedWaitTask"> </job-filter> <com-empty-view v-if="receiptList.length==0"></com-empty-view> <uni-swipe-action ref="swipeAction"> <view v-for="(item, index) in receiptList" :key="index"> <uni-swipe-action-item :right-options="item.status=='2'?detailGiveupOptions:detailOptions" @click="swipeClick($event,item)"> <comInventoryJobCard :dataContent="item" @click='openJobDetail(item)'></comInventoryJobCard> </uni-swipe-action-item> </view> </uni-swipe-action> <uni-load-more :status="loadingType" v-if="receiptList.length>0" /> <win-scan-asn-number ref="scanAsnNumber" title="ASN" @getScanCode='getByAsnNumber'></win-scan-asn-number> <win-scan-job-number ref="scanNumber" title="任务编号" @getScanCode='getByNumber'></win-scan-job-number> <job-info-popup ref='jobInfoPopup'></job-info-popup> <com-message ref="comMessage"></com-message> </view> </template> <script> import { getInventoryMoveJobList, getPurchasereceiptByAsnNumber, getPurchaseReceiptJobByNumber, cancelTakeReceiptJob } from '@/api/request.js'; import { goHome, updateTitle } from '@/common/basic.js'; import { getDetailOption, getDetailGiveupOption } from '@/common/array.js'; import comEmptyView from '@/mycomponents/common/comEmptyView.vue' import comMessage from '@/mycomponents/common/comMessage.vue' import jobFilter from '@/mycomponents/job/jobFilter.vue' import winScanJobNumber from "@/mycomponents/scan/winScanJobNumber.vue" import winScanAsnNumber from "@/mycomponents/scan/winScanAsnNumber.vue" import jobInfoPopup from '@/mycomponents/job/jobInfoPopup.vue' import comInventoryJobCard from '@/pages/inventoryMove/coms/comInventoryJobCard.vue' export default { name: 'receipt', components: { comEmptyView, jobFilter, comInventoryJobCard, winScanJobNumber, winScanAsnNumber, jobInfoPopup, comMessage, }, data() { return { receiptList: [], contentText: { contentdown: '上拉加载更多', contentrefresh: '加载中', contentnomore: '没有更多' }, pageSize: 5, pageIndex: 1, totalCount: 0, loadingType: "nomore", checkedToday: false, checkedWaitTask: false, status: ['JOB_PENDING', '1'], creationTimeStart: "", creationTimeEnd: "", detailOptions: [], detailGiveupOptions: [] }; }, onShow() { this.getList('refresh'); }, onReady() { const rightButtonEle2 = document.getElementsByClassName('uni-page-head-btn')[2] this.detailOptions = getDetailOption(); this.detailGiveupOptions = getDetailGiveupOption(); }, //后退按钮 onBackPress(options) { if (options.from === 'navigateBack') { uni.navigateBack({ delta: 1 }) return false; } }, //返回首页 onNavigationBarButtonTap(e) { if (e.index === 0) { goHome(); } else if (e.index == 1) { this.$refs.filter.openFilter(); } }, methods: { updateTitle() { var title = "" if (this.totalCount > 0) { title = ; } else { title = "库存转移" } uni.setNavigationBarTitle({ title: title }) }, getList() { let that = this; uni.showLoading({ title: "加载中....", mask: true }); var params = { status: this.status, CreationTimeStart: this.creationTimeStart, CreationTimeEnd: this.creationTimeEnd } getInventoryMoveJobList(params).then(res => { uni.hideLoading(); var list = res.data; this.totalCount = res.data.length; that.receiptList = list updateTitle("库存转移(" + this.totalCount + ")"); }).catch(error => { uni.hideLoading(); that.showMessage(error) }) }, getByAsnNumber(code) { let that = this; uni.showLoading({ title: "加载中....", mask: true }); getPurchasereceiptByAsnNumber(code).then(res => { uni.hideLoading(); if (res.data.length == 0) { that.showMessage('未查找到' + '【' + code + '】的收货任务'); } else if (res.data.length == 1) { this.$refs.scanAsnNumber.closeScanPopup(); that.openJobDetail(res.data[0]); } else { this.$refs.scanAsnNumber.closeScanPopup(); that.showItemList(res.data); } }).catch(error => { uni.hideLoading(); that.showMessage(error); }) }, getByNumber(code) { let that = this; uni.showLoading({ title: "加载中....", mask: true }); getPurchaseReceiptJobByNumber(code).then(res => { uni.hideLoading(); if (res.data.length == 0) { that.showMessage('未查找到' + '【' + code + '】的收货任务'); } else if (res.data.length == 1) { this.$refs.scanNumber.closeScanPopup(); that.openJobDetail(res.data[0]); } }).catch(error => { uni.hideLoading(); that.showMessage(error); }) }, openJobDetail(item) { uni.navigateTo({ url: './inventoryMoveDetail?id=' + item.id + '&status=' + item.status }); }, showItemList(itemList) { // this.$refs.comReceiptJobList.openPopup(itemList); }, selectedItem(item) { this.openJobDetail(item); }, swipeClick(e, dataContent) { if (e.content.text == "详情") { this.openjobInfoPopup(dataContent); } else if (e.content.text == "放弃") { this.$refs.comMessage.showQuestionMessage("确定要放弃当前任务?", res => { if (res) { var id = dataContent.id this.cancleJob(id); } }); } }, openjobInfoPopup(item) { let dataList = [{ title: "申请单号", content: item.requestNumber }, { title: "要货计划单号", content: item.ppNumber }, { title: "供应商代码", content: item.supplierCode }, { title: "允许修改库位", content: item.allowModifyLocation == 1 ? "是" : "否" }, { title: "允许修改数量", content: item.allowModifyQty == 1 ? "是" : "否" }, { title: "允许大于推荐数量", content: item.allowBiggerQty == 1 ? "是" : "否" }, { title: "允许小于推荐数量", content: item.allowSmallerQty == 1 ? "是" : "否" }, { title: "允许修改库存状态", content: item.allowModifyInventoryStatus == 1 ? "是" : "否" }, { title: "允许连续扫描", content: item.allowContinuousScanning == 1 ? "是" : "否" }, { title: "允许部分完成", content: item.allowPartialComplete == 1 ? "是" : "否" }, { title: "允许修改批次", content: item.allowModifyBach == 1 ? "是" : "否" } ] this.$refs.jobInfoPopup.openPopup(item, dataList) }, cancleJob(id) { cancelTakeReceiptJob(id).then(res => { if(res.data){ this.getList("refresh") uni.showToast({ title:"放弃任务成功" }) }else { this.showMessage("放弃任务失败") } }).catch(res => { this.showMessage(res) }) }, switchChangeToday(state, creationTime) { this.checkedToday = state; this.todayTime = creationTime; this.getList("refresh"); }, switchChangeWait(state, jobStatus) { this.checkedWaitTask = state; this.status = jobStatus; this.getList("refresh"); }, showMessage(message) { this.$refs.comMessage.showErrorMessage(message, res => { if (res) { } }); }, } } </script> <style scoped lang="scss"> </style>