Browse Source

PC打印 2024/8/4

hella_vue3
王志国 1 month ago
parent
commit
d63b25e478
  1. 47
      src/pages/fg/receiptByPlan.vue
  2. 48
      src/pages/fg/receiptNoPlan.vue

47
src/pages/fg/receiptByPlan.vue

@ -100,10 +100,14 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref, getCurrentInstance, nextTick } from 'vue' import { ref, getCurrentInstance, nextTick } from 'vue'
import { onLoad, onShow, onNavigationBarButtonTap, onReady, onBackPress, onReachBottom, onPullDownRefresh } from '@dcloudio/uni-app' import { onLoad, onShow, onNavigationBarButtonTap, onReady, onBackPress, onReachBottom, onPullDownRefresh } from '@dcloudio/uni-app'
import { isCheckMesCode, planReceiptSubmit, createPutawayRequestByPlan, createInspectRequestByPlan, getPlanByNumber } from '@/api/request2.js' import { isCheckMesCode, planReceiptSubmit,
createPutawayRequestByPlan, createInspectRequestByPlan,
getPlanByNumber,getBalanceToPackage,
batchPrintingLable } from '@/api/request2.js'
import { calc } from '@/common/calc.js' import { calc } from '@/common/calc.js'
import storage from '@/common/utils/storage.js'
import { getRemoveOption, deepCopyData, getCurrDateTime, compare,getSwitchInfoByCode } from '@/common/basic.js' import { getRemoveOption, deepCopyData,
getCurrDateTime, compare,getSwitchInfoByCode} from '@/common/basic.js'
import winScanButton from '@/mycomponents/scan/winScanButton.vue' import winScanButton from '@/mycomponents/scan/winScanButton.vue'
import comBlankView from '@/mycomponents/common/comBlankView.vue' import comBlankView from '@/mycomponents/common/comBlankView.vue'
import comReceiptPopup from '@/pages/fg/coms/comReceiptPopup.vue' import comReceiptPopup from '@/pages/fg/coms/comReceiptPopup.vue'
@ -390,13 +394,46 @@ const scanPopupLoseFocus = () => {
scanPopup.value.losefocus() scanPopup.value.losefocus()
} }
} }
const showCommitSuccessMessage = (hint, pointData) => { const getH5BatchPrintingLable = (number)=> {
comMessageRef.value.showSuccessMessage(hint, (res) => { batchPrintingLable(number).then(resLable => {
console.log('batchPrintingLable', resLable)
const webUrl = `${import.meta.env.VITE_JMREPORT_BASE_URL}/jmreport/view/922734157577715712`
const webData = {
token: storage.getStorage(storage.constant.token),
asn_number: resLable.data
}
uni.redirectTo({
url: `/pages/pointProductReceipt/webview?url=${webUrl}&webData=${JSON.stringify(webData)}`
});
})
}
const print = (pointData)=> {
// #ifdef APP
if (pointData.length > 0) { if (pointData.length > 0) {
uni.navigateTo({ uni.navigateTo({
url: `/pages/point/index?points=${JSON.stringify(pointData)}` url: `/pages/point/index?points=${JSON.stringify(pointData)}`
});
}
// #endif
// #ifdef H5
let packingNumber = []
pointData.forEach(item=>{
packingNumber.push(item.packageCode)
})
getBalanceToPackage({
packingNumber: packingNumber.join(',')
}).then(res => {
console.log('PC打印', res)
getH5BatchPrintingLable(res.data.number)
}).catch(error => {
showErrorMessage(error)
}) })
// #endif
} }
const showCommitSuccessMessage = (hint, pointData) => {
comMessageRef.value.showSuccessMessage(hint, (res) => {
print(pointData)
}) })
} }
const showErrorMessage = (message) => { const showErrorMessage = (message) => {

48
src/pages/fg/receiptNoPlan.vue

@ -100,12 +100,14 @@ import {
planReceiptSubmit, planReceiptSubmit,
createPutawayRequestByPlan, createPutawayRequestByPlan,
createInspectRequestByPlan, createInspectRequestByPlan,
getPlanByNumber getPlanByNumber,
getBalanceToPackage,
batchPrintingLable
} from '@/api/request2.js'; } from '@/api/request2.js';
import { import {
calc calc
} from '@/common/calc.js'; } from '@/common/calc.js';
import storage from '@/common/utils/storage.js'
import { import {
getRemoveOption, getRemoveOption,
deepCopyData, deepCopyData,
@ -411,9 +413,24 @@ export default {
this.$refs.scanPopup.losefocus(); this.$refs.scanPopup.losefocus();
} }
}, },
getH5BatchPrintingLable( number) {
let _this = this
batchPrintingLable(number).then(resLable => {
console.log('batchPrintingLable', resLable)
const webUrl = `${import.meta.env.VITE_JMREPORT_BASE_URL}/jmreport/view/922734157577715712`
const webData = {
token: storage.getStorage(storage.constant.token),
asn_number: resLable.data
}
uni.redirectTo({
url: `/pages/pointProductReceipt/webview?url=${webUrl}&webData=${JSON.stringify(webData)}`
});
})
},
showCommitSuccessMessage(hint, pointData) { print(pointData){
this.$refs.comMessage.showSuccessMessage(hint, res => { let _this = this
// #ifdef APP
if (pointData.length > 0) { if (pointData.length > 0) {
if (this.scanedQty + this.showList.length == this.dataContent.planQty) { if (this.scanedQty + this.showList.length == this.dataContent.planQty) {
uni.redirectTo({ uni.redirectTo({
@ -425,6 +442,29 @@ export default {
}); });
} }
} }
// #endif
// #ifdef H5
let packingNumber = []
pointData.forEach(item=>{
packingNumber.push(item.packageCode)
})
getBalanceToPackage({
packingNumber: packingNumber.join(',')
}).then(res => {
console.log('PC打印', res)
_this.getH5BatchPrintingLable(res.data.number)
}).catch(error => {
_this.showErrorMessage(error)
})
// #endif
},
showCommitSuccessMessage(hint, pointData) {
this.$refs.comMessage.showSuccessMessage(hint, res => {
this.print(pointData)
}) })
}, },

Loading…
Cancel
Save