first commit

main
chenjf 2 years ago
parent b554371822
commit e8d6f1c523

@ -11,7 +11,7 @@ window = {
let printListDev = [];
let printListOnline = [];
var CLODOP = {
strWebPageID: "7BCAAAH",
strWebPageID: "827AAAL",
strTaskID: "",
strHostURI: "http://localhost:8000",
wsHostURI: "ws://localhost:8000/c_webskt/",
@ -215,10 +215,9 @@ window = {
};
},
wsSend: function(strData) {
// console.info(strData);
console.log(strData);
console.log(this.webskt);
console.log(this.wsHostURI);
console.log(11);
if (this.webskt && this.webskt.readyState == 1) {
this.Result = null;
this.iTrySendTimes = 0;
@ -1885,10 +1884,12 @@ async function getPrinterList(ip){
let temp = res[1].data.match(/"list":(.+)/);
const printerListString = temp[1].substr(0,temp[1].length-2);
let printerListArray = JSON.parse(printerListString);
let printerList = [];
printerListArray.forEach(item=>{
printerList.push(item.name)
})
return printerList;
}catch(e){
console.log(e);
@ -1897,4 +1898,4 @@ async function getPrinterList(ip){
export {
getCLodop,
getPrinterList
}; //导出getLodop
};

@ -4,12 +4,16 @@
<!-- 导航栏 -->
<view v-if="showPop">
<view >
<text class="font-sm text-secondary px-3 py-2">ilsApi地址</text>
<input type="text" class="font-md border bg-white px-3" placeholder="请填写ilsApi地址" style="height: 100rpx;" v-model="ilsApi"/>
<text class="font-sm text-secondary px-3 py-2">ilsApi地址IP+端口</text>
<input type="text" class="font-md border bg-white px-3" placeholder="请填写ilsApi地址IP+端口" style="height: 100rpx;" v-model="ilsApi"/>
</view>
<view >
<text class="font-sm text-secondary px-3 py-2">打印机IP</text>
<input type="text" class="font-md border bg-white px-3" placeholder="请填写ilsApi地址" style="height: 100rpx;" v-model="printIp"/>
<text class="font-sm text-secondary px-3 py-2">打印机地址IP</text>
<input type="text" class="font-md border bg-white px-3" placeholder="请填写打印机地址IP" style="height: 100rpx;" v-model="printIp"/>
</view>
<view >
<text class="font-sm text-secondary px-3 py-2">打印机名称</text>
<input type="text" class="font-md border bg-white px-3" placeholder="请填写打印机名称" style="height: 100rpx;" v-model="printName"/>
</view>
<view >
<button class="systemSty" @tap="cancelAdd"></button>
@ -27,7 +31,8 @@
<script>
import scanCode from "@/components/scan-code/scan-code.vue";
import { getCLodop } from '@/common/print/CLodopfuncs.js';
// import { getCLodop } from '@/common/print/CLodopfuncs.js';
// import { getPrinterList } from '@/common/print/CLodopfuncs.js';
const printPdf = uni.requireNativePlugin('YanYu-PrintPDF');
export default {
@ -35,9 +40,12 @@
return {
codes: undefined,
showPop: false,
selectClassEnd:[],
httpRoot: 'http://',
ilsApi: '192.168.1.56:9090',
printIp: '192.168.1.26',
printIp: '192.168.1.56',
serviceApi: ':8080/ilsApp/print',
printName: 'Xprinter',
onLoad(option) {
this.$broadcastScan.init(this.getScancode);
},
@ -55,8 +63,11 @@
methods: {
pdaSystemInit: function(){
this.showPop = true;
this.showPop = true;
},
selectClass(event){
},
confirmAdd() {
//
this.showPop = false;
@ -75,30 +86,18 @@
console.log("doPrinter orderCoder: " + orderCoder);
console.log("ilsApi:", this.ilsApi);
console.log("printIp:", this.printIp);
// LODOP.PRINT_INIT(null, "192.168.1.26");
// LODOP.SET_PRINTER_INDEX(-1);
// LODOP.PRINT_INITA(0, 0, "100mm", "150mm", "100X150");
// LODOP.SET_PRINT_PAGESIZE(1, "100mm", "150mm", "");
// LODOP.SET_PRINT_MODE("POS_BASEON_PAPER", true);
// //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.PRINT();
uni.request({
url: this.httpRoot + this.ilsApi + '/jeecg-boot/front/getOrderPayStateAndPdfBase64?OrderId=' + orderCoder,
method: 'GET',
url: this.httpRoot + this.printIp + this.serviceApi,
method: 'POST',
data: {
ilsApi: this.ilsApi,
printIp: this.printIp,
orderId: orderCoder,
printName: this.printName
},
success: (res) => {
console.log( res.data.result);
console.log( res);
if(res.data.code==200){
let LODOP = getCLodop();
LODOP.PRINT_INIT(null, this.printIp);
LODOP.SET_PRINTER_INDEX(-1);
LODOP.PRINT_INITA(2, 0, "100mm", "150mm", "100X150");
LODOP.SET_PRINT_PAGESIZE(1, "100mm", "150mm", "");
LODOP.SET_PRINT_MODE("POS_BASEON_PAPER", true);
// LODOP.ADD_PRINT_HTM(2, 0, "100mm", "150mm", "<img src="+ this.imgBase64Root + res.data.message+" style=\"width: 100mm; height: 100mm;\"/>");
LODOP.ADD_PRINT_PDF(0, 0, "100mm", "150mm", res.data.result);
LODOP.PRINT();
uni.showToast({
title: '面单下发成功.正在打印,请稍候...',
icon: 'none',
@ -127,49 +126,55 @@
uni.$on('scancodedate', function(data) {
console.log('你想要的code', data.code);
_this.codes = data.code;
this.showPop = false;
_this.showPop = false;
let orderCoder = data.code;
console.log("onShow orderCoder: " + orderCoder);
console.log("ilsApi:", _this.ilsApi);
console.log("printIp:", _this.printIp);
//orderCoder = "SF1642682535344";
uni.request({
url: _this.httpRoot + _this.ilsApi + '/jeecg-boot/front/getOrderPayStateAndPdfBase64?OrderId=' + orderCoder,
method: 'GET',
success: (res) => {
console.log( res.data.result);
if(res.data.code==200){
let LODOP = getCLodop();
LODOP.PRINT_INIT(null, _this.printIp);
LODOP.SET_PRINTER_INDEX(-1);
LODOP.PRINT_INITA(2, 0, "100mm", "150mm", "100X150");
LODOP.SET_PRINT_PAGESIZE(1, "100mm", "150mm", "");
LODOP.SET_PRINT_MODE("POS_BASEON_PAPER", true);
// LODOP.ADD_PRINT_HTM(2, 0, "100mm", "150mm", "<img src="+ this.imgBase64Root + res.data.message+" style=\"width: 100mm; height: 100mm;\"/>");
LODOP.ADD_PRINT_PDF(0, 0, "100mm", "150mm", res.data.result);
LODOP.PRINT();
console.log("serviceApi:", _this.httpRoot + _this.printIp + _this.serviceApi);
if(orderCoder.length>18){
//orderCoder = "SF1642682535344";
uni.request({
url: _this.httpRoot + _this.printIp + _this.serviceApi,
method: 'POST',
data: {
ilsApi: _this.ilsApi,
printIp: _this.printIp,
orderId: orderCoder,
printName: _this.printName
},
success: (res) => {
console.log( res);
if(res.data.code==200){
uni.showToast({
title: '下发成功.正在打印,请稍候...',
icon: 'none',
duration: 3000
});
}else{
uni.showToast({
title: res.data.message,
icon: 'none',
duration: 3000
})
}
},
fail: (error) => {
console.log("error: ", error);
uni.showToast({
title: '下发成功.正在打印,请稍候...',
title: '接口访问异常,打印失败',
icon: 'none',
duration: 3000
});
}else{
uni.showToast({
title: res.data.message,
icon: 'none',
duration: 3000
})
}
},
fail: (error) => {
console.log("error: ", error);
uni.showToast({
title: '接口访问异常,打印失败',
icon: 'none',
duration: 3000
})
},
});
},
});
}else{
uni.showToast({
title: '非法单号',
icon: 'none',
duration: 3000
})
}
})
},
getScancode(code) {

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

@ -295,14 +295,14 @@ var render = function () {
_c(
"v-uni-text",
{ staticClass: _vm._$g(4, "sc"), attrs: { _i: 4 } },
[_vm._v("ilsApi地址")]
[_vm._v("ilsApi地址IP+端口")]
),
_c("v-uni-input", {
staticClass: _vm._$g(5, "sc"),
staticStyle: { height: "100rpx" },
attrs: {
type: "text",
placeholder: "请填写ilsApi地址",
placeholder: "请填写ilsApi地址IP+端口",
_i: 5,
},
model: {
@ -323,14 +323,14 @@ var render = function () {
_c(
"v-uni-text",
{ staticClass: _vm._$g(7, "sc"), attrs: { _i: 7 } },
[_vm._v("打印机IP")]
[_vm._v("打印机地址IP")]
),
_c("v-uni-input", {
staticClass: _vm._$g(8, "sc"),
staticStyle: { height: "100rpx" },
attrs: {
type: "text",
placeholder: "请填写ilsApi地址",
placeholder: "请填写打印机地址IP",
_i: 8,
},
model: {
@ -347,12 +347,40 @@ var render = function () {
_c(
"uni-view",
{ attrs: { _i: 9 } },
[
_c(
"v-uni-text",
{ staticClass: _vm._$g(10, "sc"), attrs: { _i: 10 } },
[_vm._v("打印机名称")]
),
_c("v-uni-input", {
staticClass: _vm._$g(11, "sc"),
staticStyle: { height: "100rpx" },
attrs: {
type: "text",
placeholder: "请填写打印机名称",
_i: 11,
},
model: {
value: _vm._$g(11, "v-model"),
callback: function ($$v) {
_vm.$handleVModelEvent(11, $$v)
},
expression: "printName",
},
}),
],
1
),
_c(
"uni-view",
{ attrs: { _i: 12 } },
[
_c(
"v-uni-button",
{
staticClass: _vm._$g(10, "sc"),
attrs: { _i: 10 },
staticClass: _vm._$g(13, "sc"),
attrs: { _i: 13 },
on: {
click: function ($event) {
return _vm.$handleViewEvent($event)
@ -364,8 +392,8 @@ var render = function () {
_c(
"v-uni-button",
{
staticClass: _vm._$g(11, "sc"),
attrs: { _i: 11 },
staticClass: _vm._$g(14, "sc"),
attrs: { _i: 14 },
on: {
click: function ($event) {
return _vm.$handleViewEvent($event)
@ -384,15 +412,15 @@ var render = function () {
_vm._v("当前单号:"),
_c(
"v-uni-text",
{ staticClass: _vm._$g(12, "sc"), attrs: { _i: 12 } },
[_vm._v(_vm._$g(12, "t0-0"))]
{ staticClass: _vm._$g(15, "sc"), attrs: { _i: 15 } },
[_vm._v(_vm._$g(15, "t0-0"))]
),
_vm._$g(13, "i")
_vm._$g(16, "i")
? _c(
"v-uni-button",
{
staticClass: _vm._$g(13, "sc"),
attrs: { _i: 13 },
staticClass: _vm._$g(16, "sc"),
attrs: { _i: 16 },
on: {
click: function ($event) {
return _vm.$handleViewEvent($event)
@ -402,12 +430,12 @@ var render = function () {
[_vm._v("PDA设置")]
)
: _vm._e(),
_vm._$g(14, "i")
_vm._$g(17, "i")
? _c(
"v-uni-button",
{
staticClass: _vm._$g(14, "sc"),
attrs: { _i: 14 },
staticClass: _vm._$g(17, "sc"),
attrs: { _i: 17 },
on: {
click: function ($event) {
return _vm.$handleViewEvent($event)
@ -420,7 +448,7 @@ var render = function () {
],
1
),
_c("scan-code", { attrs: { _i: 15 } }),
_c("scan-code", { attrs: { _i: 18 } }),
],
1
)

Loading…
Cancel
Save