修复提示bug和网络异常打印bug

main
chenjf 2 years ago
parent afbdbbfd6d
commit b554371822

@ -16,7 +16,7 @@
"type" : "uniCloud" "type" : "uniCloud"
}, },
{ {
"playground" : "custom", "playground" : "standard",
"type" : "uni-app:app-android" "type" : "uni-app:app-android"
} }
] ]

@ -29,7 +29,7 @@
import scanCode from "@/components/scan-code/scan-code.vue"; import scanCode from "@/components/scan-code/scan-code.vue";
import { getCLodop } from '@/common/print/CLodopfuncs.js'; import { getCLodop } from '@/common/print/CLodopfuncs.js';
const printPdf = uni.requireNativePlugin('YanYu-PrintPDF'); const printPdf = uni.requireNativePlugin('YanYu-PrintPDF');
const LODOP = getCLodop();
export default { export default {
data() { data() {
return { return {
@ -83,12 +83,14 @@
// //LODOP.ADD_PRINT_HTM(10, 20, "100mm", "150mm", "<img src="+this.imageData+" style=\"width: 100mm; height: 100mm;\"/>"); // //LODOP.ADD_PRINT_HTM(10, 20, "100mm", "150mm", "<img src="+this.imageData+" style=\"width: 100mm; height: 100mm;\"/>");
// LODOP.ADD_PRINT_PDF(0, 0, "100mm", "150mm", this.imgePdfData); // LODOP.ADD_PRINT_PDF(0, 0, "100mm", "150mm", this.imgePdfData);
// LODOP.PRINT(); // LODOP.PRINT();
uni.request({ uni.request({
url: this.httpRoot + this.ilsApi + '/jeecg-boot/front/getOrderPayStateAndPdfBase64?OrderId=' + orderCoder, url: this.httpRoot + this.ilsApi + '/jeecg-boot/front/getOrderPayStateAndPdfBase64?OrderId=' + orderCoder,
method: 'GET', method: 'GET',
success: (res) => { success: (res) => {
console.log( res.data.result); console.log( res.data.result);
if(res.data.code==200){ if(res.data.code==200){
let LODOP = getCLodop();
LODOP.PRINT_INIT(null, this.printIp); LODOP.PRINT_INIT(null, this.printIp);
LODOP.SET_PRINTER_INDEX(-1); LODOP.SET_PRINTER_INDEX(-1);
LODOP.PRINT_INITA(2, 0, "100mm", "150mm", "100X150"); LODOP.PRINT_INITA(2, 0, "100mm", "150mm", "100X150");
@ -99,18 +101,18 @@
LODOP.PRINT(); LODOP.PRINT();
uni.showToast({ uni.showToast({
title: '面单下发成功.正在打印,请稍候...', title: '面单下发成功.正在打印,请稍候...',
icon: 'success', icon: 'none',
duration: 3000 duration: 3000
}); });
}else{ }else{
uni.showToast({ uni.showToast({
title: '面单获取异常,打印失败', title: res.data.message,
icon: 'none', icon: 'none',
duration: 3000 duration: 3000
}) })
} }
}, },
fail: () => { fail: (error) => {
uni.showToast({ uni.showToast({
title: '接口访问异常,打印失败', title: '接口访问异常,打印失败',
icon: 'none', icon: 'none',
@ -137,6 +139,7 @@
success: (res) => { success: (res) => {
console.log( res.data.result); console.log( res.data.result);
if(res.data.code==200){ if(res.data.code==200){
let LODOP = getCLodop();
LODOP.PRINT_INIT(null, _this.printIp); LODOP.PRINT_INIT(null, _this.printIp);
LODOP.SET_PRINTER_INDEX(-1); LODOP.SET_PRINTER_INDEX(-1);
LODOP.PRINT_INITA(2, 0, "100mm", "150mm", "100X150"); LODOP.PRINT_INITA(2, 0, "100mm", "150mm", "100X150");
@ -147,18 +150,19 @@
LODOP.PRINT(); LODOP.PRINT();
uni.showToast({ uni.showToast({
title: '下发成功.正在打印,请稍候...', title: '下发成功.正在打印,请稍候...',
icon: 'success', icon: 'none',
duration: 3000 duration: 3000
}); });
}else{ }else{
uni.showToast({ uni.showToast({
title: '面单获取异常,打印失败', title: res.data.message,
icon: 'none', icon: 'none',
duration: 3000 duration: 3000
}) })
} }
}, },
fail: () => { fail: (error) => {
console.log("error: ", error);
uni.showToast({ uni.showToast({
title: '接口访问异常,打印失败', title: '接口访问异常,打印失败',
icon: 'none', icon: 'none',

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save