From 0df189bbaec347a07d4eec9025b355f1d8820bca Mon Sep 17 00:00:00 2001
From: wtt <1985833171@qq.com>
Date: 星期五, 23 一月 2026 09:11:01 +0800
Subject: [PATCH] 惠康拆单扫码模块测试,检验模块优化
---
pages/ZLGL/chuchangjiaoyandan/QC_OutCompCheckBill.vue | 2
pages/ZLGL/shengchanrukujiaoyan/QC_LastPieceCheckBill_v2.vue | 2
pages.json | 6
pages/ZLGL/QualityReportStep/QualityReportStepBill.vue | 2
pages/ZLGL/WorkSelfCheckBill/WorkSelfCheckBill.vue | 2
.hbuilderx/launch.json | 4
pages/ZLGL/lailiaojianyan/POStockInCheckBill.vue | 2
nativeplugins/LcPrinter/android/unilcprinterplugin_module-release.aar | 0
pages/tiaomachaima/tiaomachaimaCopy.vue | 704 ++++++++++++++++++++++++++++++++++++++++++++++++++
pages/ZLGL/mojianjianyan/ProcessCheckBill.vue | 2
pages/ZLGL/checkFlowList/QC_CheckBillflowList.vue | 21
manifest.json | 16 +
pages/ZLGL/xunjianjianyan/PatrolProcCheckBill.vue | 2
pages/ZLGL/shoujianjianyan/firstCheckBill.vue | 2
nativeplugins/LcPrinter/package.json | 25 +
pages/index/index.vue | 8
16 files changed, 779 insertions(+), 21 deletions(-)
diff --git a/.hbuilderx/launch.json b/.hbuilderx/launch.json
index a7d9080..a41ed7d 100644
--- a/.hbuilderx/launch.json
+++ b/.hbuilderx/launch.json
@@ -22,9 +22,9 @@
},
{
"customPlaygroundType" : "local",
- "localRepoPath" : "D:/WorkBench/ZY_APP_Dev/STUWMS/unpackage/debug",
+ "localRepoPath" : "C:/Users/19858/Desktop/鏅轰簯杩堟��/APP/STUWMS/unpackage/debug",
"openVueDevtools" : true,
- "packageName" : "com.shebeiguanli.www",
+ "packageName" : "com.iflytek.inputmethod",
"playground" : "custom",
"type" : "uni-app:app-android"
}
diff --git a/manifest.json b/manifest.json
index 2a2de20..f78ad7d 100644
--- a/manifest.json
+++ b/manifest.json
@@ -131,8 +131,22 @@
}
}
}
+ },
+ "LcPrinter" : {
+ "__plugin_info__" : {
+ "name" : "LcPrinter",
+ "description" : "鏂扮増鎵撳嵃鎻掍欢",
+ "platforms" : "Android",
+ "url" : "",
+ "android_package_name" : "",
+ "ios_bundle_id" : "",
+ "isCloud" : false,
+ "bought" : -1,
+ "pid" : "",
+ "parameters" : {}
+ }
}
- }
+ }
},
/* 蹇簲鐢ㄧ壒鏈夌浉鍏� */
"quickapp" : {},
diff --git a/nativeplugins/LcPrinter/android/unilcprinterplugin_module-release.aar b/nativeplugins/LcPrinter/android/unilcprinterplugin_module-release.aar
new file mode 100644
index 0000000..76138ef
--- /dev/null
+++ b/nativeplugins/LcPrinter/android/unilcprinterplugin_module-release.aar
Binary files differ
diff --git a/nativeplugins/LcPrinter/package.json b/nativeplugins/LcPrinter/package.json
new file mode 100644
index 0000000..d2af7ef
--- /dev/null
+++ b/nativeplugins/LcPrinter/package.json
@@ -0,0 +1,25 @@
+{
+ "name": "LcPrinter",
+ "id": "LcPrinter",
+ "version": "1.0.1",
+ "description": "鏂扮増鎵撳嵃鎻掍欢",
+ "_dp_type":"nativeplugin",
+ "_dp_nativeplugin":{
+ "android": {
+ "plugins": [
+ {
+ "type": "module",
+ "name": "LcPrinter",
+ "class": "uni.dcloud.io.uniplugin_lcprint_new.PrinterModule"
+ }
+ ],
+ "abis": [
+ "armeabi-v7a",
+ "arm64-v8a",
+ "x86"
+ ],
+ "integrateType": "aar",
+ "minSdkVersion" : 21
+ }
+ }
+}
\ No newline at end of file
diff --git a/pages.json b/pages.json
index 0cabc1d..0424b2f 100644
--- a/pages.json
+++ b/pages.json
@@ -1603,6 +1603,12 @@
{
"navigationBarTitleText" : "璁惧鏁呴殰鐧昏鍗曞垪琛�"
}
+ },
+ {
+ "path": "pages/tiaomachaima/tiaomachaimaCopy",
+ "style": {
+ "navigationBarTitleText": "鏉$爜鎷嗙爜3"
+ }
}
diff --git a/pages/ZLGL/QualityReportStep/QualityReportStepBill.vue b/pages/ZLGL/QualityReportStep/QualityReportStepBill.vue
index fad9bf8..6b5a7e6 100644
--- a/pages/ZLGL/QualityReportStep/QualityReportStepBill.vue
+++ b/pages/ZLGL/QualityReportStep/QualityReportStepBill.vue
@@ -737,7 +737,7 @@
let res = await CommonUtils.doRequest2Async({
url: "/Gy_Employee/list",
data: {
- sWhere: ` and 绂佺敤鏍囪 = '' order by 閮ㄩ棬浠g爜`,
+ sWhere: ` and 绂佺敤鏍囪 = '' `,
user: getUserInfo()["Czymc"],
Organization: uni.getStorageSync("Organization"),
},
diff --git a/pages/ZLGL/WorkSelfCheckBill/WorkSelfCheckBill.vue b/pages/ZLGL/WorkSelfCheckBill/WorkSelfCheckBill.vue
index ef5d0a5..8f6b8f9 100644
--- a/pages/ZLGL/WorkSelfCheckBill/WorkSelfCheckBill.vue
+++ b/pages/ZLGL/WorkSelfCheckBill/WorkSelfCheckBill.vue
@@ -954,7 +954,7 @@
data: {
sWhere: ` and 缁勭粐鍚嶇О = '${uni.getStorageSync(
"Organization"
- )}' and 绂佺敤鏍囪 = ''and 瀹℃牳浜� !='' order by 閮ㄩ棬浠g爜`,
+ )}' and 绂佺敤鏍囪 = ''and 瀹℃牳浜� !='' `,
user: getUserInfo()["Czymc"],
Organization: uni.getStorageSync("Organization"),
},
diff --git a/pages/ZLGL/checkFlowList/QC_CheckBillflowList.vue b/pages/ZLGL/checkFlowList/QC_CheckBillflowList.vue
index 456e57f..bf4ee68 100644
--- a/pages/ZLGL/checkFlowList/QC_CheckBillflowList.vue
+++ b/pages/ZLGL/checkFlowList/QC_CheckBillflowList.vue
@@ -71,7 +71,7 @@
<button class="op3" size="mini" plain @tap.stop="audit(item, 1)">鍙嶅鏍�</button>
<button class="op3" size="mini" plain @tap.stop="fileUpload(item)">鏂囦欢涓婁紶</button>
<button class="op3" size="mini" plain @tap.stop="getImage(item)">棰勮鍥剧墖</button>
- <!-- <button class="op3" size="mini" plain @tap.stop="Reject(item)">椹冲洖</button> -->
+ <button class="op3" size="mini" plain @tap.stop="Reject(item)">椹冲洖</button>
<button class="op5" size="mini" plain @tap.stop="operations = -1">鍙栨秷鎿嶄綔</button>
</view>
</uni-card>
@@ -271,11 +271,13 @@
})
if(mode==1){
this.showDialog(item["hmainid"]);
+ }else{
+ setTimeout(() => {
+ this.cmdSearch()
+ }, 2000)
}
this.$forceUpdate()
- setTimeout(() => {
- this.cmdSearch()
- }, 2000)
+
}else {
CommonUtils.showTips({
title: '娓╅Θ鎻愮ず',
@@ -352,15 +354,15 @@
},
//鍙嶅鏍告彁浜ゆ剰瑙�
- showDialog(HInterID) {
+ async showDialog(HInterID) {
uni.showModal({
title: '璇锋彁浜ゅ弽瀹℃牳鎰忚',
editable: true,
placeholderText: '璇疯緭鍏ュ唴瀹�',
- success: (result) => {
+ success: async (result) => {
if (result.confirm) {
try {
- let res = CommonUtils.doRequest2Sync({
+ let res = await CommonUtils.doRequest2Sync({
url: '/LMES/AuditFlowOpinion',
data: {
"sWhere": result.content,
@@ -381,9 +383,9 @@
if (count > 0) {
uni.showToast({
icon: 'none',
- title: Message
+ title: "鎰忚鎻愪氦鎴愬姛"
})
-
+ this.cmdSearch();
} else {
uni.showToast({
icon: 'none',
@@ -442,6 +444,7 @@
} = res.data
if (count > 0) {
if(data.length>0){
+
const imageUrl = res.data.data[0]["url"];
//姝e垯琛ㄨ揪寮忚幏鍙栨湇鍔″櫒璺緞鍊掓暟绗簩涓唴瀹�
const regex = /^(.*\/)[^\/]+\/[^\/]*\/?$/;
diff --git a/pages/ZLGL/chuchangjiaoyandan/QC_OutCompCheckBill.vue b/pages/ZLGL/chuchangjiaoyandan/QC_OutCompCheckBill.vue
index d222463..cdb7f20 100644
--- a/pages/ZLGL/chuchangjiaoyandan/QC_OutCompCheckBill.vue
+++ b/pages/ZLGL/chuchangjiaoyandan/QC_OutCompCheckBill.vue
@@ -1231,7 +1231,7 @@
data: {
sWhere: ` and 缁勭粐鍚嶇О = '${uni.getStorageSync(
"Organization"
- )}' and 绂佺敤鏍囪 = ''and 瀹℃牳浜� !='' order by 閮ㄩ棬浠g爜`,
+ )}' and 绂佺敤鏍囪 = ''and 瀹℃牳浜� !='' `,
user: getUserInfo()["Czymc"],
Organization: uni.getStorageSync("Organization"),
},
diff --git a/pages/ZLGL/lailiaojianyan/POStockInCheckBill.vue b/pages/ZLGL/lailiaojianyan/POStockInCheckBill.vue
index 883975e..215a9d3 100644
--- a/pages/ZLGL/lailiaojianyan/POStockInCheckBill.vue
+++ b/pages/ZLGL/lailiaojianyan/POStockInCheckBill.vue
@@ -1231,7 +1231,7 @@
data: {
sWhere: ` and 缁勭粐鍚嶇О = '${uni.getStorageSync(
"Organization"
- )}' and 绂佺敤鏍囪 = ''and 瀹℃牳浜� !='' order by 閮ㄩ棬浠g爜`,
+ )}' and 绂佺敤鏍囪 = ''and 瀹℃牳浜� !='' `,
user: getUserInfo()["Czymc"],
Organization: uni.getStorageSync("Organization"),
},
diff --git a/pages/ZLGL/mojianjianyan/ProcessCheckBill.vue b/pages/ZLGL/mojianjianyan/ProcessCheckBill.vue
index b04deaa..c0b1d90 100644
--- a/pages/ZLGL/mojianjianyan/ProcessCheckBill.vue
+++ b/pages/ZLGL/mojianjianyan/ProcessCheckBill.vue
@@ -1120,7 +1120,7 @@
let res = await CommonUtils.doRequest2Async({
url: "/Gy_Employee/list",
data: {
- sWhere: ` and 缁勭粐鍚嶇О = '${uni.getStorageSync("Organization")}' and 绂佺敤鏍囪 = ''and 瀹℃牳浜� !='' order by 閮ㄩ棬浠g爜`,
+ sWhere: ` and 缁勭粐鍚嶇О = '${uni.getStorageSync("Organization")}' and 绂佺敤鏍囪 = ''and 瀹℃牳浜� !='' `,
user: getUserInfo()["Czymc"],
Organization: uni.getStorageSync("Organization"),
},
diff --git a/pages/ZLGL/shengchanrukujiaoyan/QC_LastPieceCheckBill_v2.vue b/pages/ZLGL/shengchanrukujiaoyan/QC_LastPieceCheckBill_v2.vue
index ef5dc7e..83e4ffd 100644
--- a/pages/ZLGL/shengchanrukujiaoyan/QC_LastPieceCheckBill_v2.vue
+++ b/pages/ZLGL/shengchanrukujiaoyan/QC_LastPieceCheckBill_v2.vue
@@ -1228,7 +1228,7 @@
data: {
sWhere: ` and 缁勭粐鍚嶇О = '${uni.getStorageSync(
"Organization"
- )}' and 绂佺敤鏍囪 = ''and 瀹℃牳浜� !='' order by 閮ㄩ棬浠g爜`,
+ )}' and 绂佺敤鏍囪 = ''and 瀹℃牳浜� !='' `,
user: getUserInfo()["Czymc"],
Organization: uni.getStorageSync("Organization"),
},
diff --git a/pages/ZLGL/shoujianjianyan/firstCheckBill.vue b/pages/ZLGL/shoujianjianyan/firstCheckBill.vue
index 4509b14..0e9ca6a 100644
--- a/pages/ZLGL/shoujianjianyan/firstCheckBill.vue
+++ b/pages/ZLGL/shoujianjianyan/firstCheckBill.vue
@@ -1090,7 +1090,7 @@
data: {
sWhere: ` and 缁勭粐鍚嶇О = '${uni.getStorageSync(
"Organization"
- )}' and 绂佺敤鏍囪 = ''and 瀹℃牳浜� !='' order by 閮ㄩ棬浠g爜`,
+ )}' and 绂佺敤鏍囪 = ''and 瀹℃牳浜� !='' `,
user: getUserInfo()["Czymc"],
Organization: uni.getStorageSync("Organization"),
},
diff --git a/pages/ZLGL/xunjianjianyan/PatrolProcCheckBill.vue b/pages/ZLGL/xunjianjianyan/PatrolProcCheckBill.vue
index dd4d5fa..ad56fad 100644
--- a/pages/ZLGL/xunjianjianyan/PatrolProcCheckBill.vue
+++ b/pages/ZLGL/xunjianjianyan/PatrolProcCheckBill.vue
@@ -954,7 +954,7 @@
data: {
sWhere: ` and 缁勭粐鍚嶇О = '${uni.getStorageSync(
"Organization"
- )}' and 绂佺敤鏍囪 = ''and 瀹℃牳浜� !='' order by 閮ㄩ棬浠g爜`,
+ )}' and 绂佺敤鏍囪 = ''and 瀹℃牳浜� !='' `,
user: getUserInfo()["Czymc"],
Organization: uni.getStorageSync("Organization"),
},
diff --git a/pages/index/index.vue b/pages/index/index.vue
index c486320..3809d50 100644
--- a/pages/index/index.vue
+++ b/pages/index/index.vue
@@ -337,7 +337,13 @@
"id": 26,
"hidden": false
},
-
+ {
+ "img": "../../static/icon/icon21.png",
+ "text": "鏉$爜鎷嗙爜",
+ "url": "/pages/tiaomachaima/tiaomachaimaCopy",
+ "id": 25,
+ "hidden": false
+ },
],
}
diff --git a/pages/tiaomachaima/tiaomachaimaCopy.vue b/pages/tiaomachaima/tiaomachaimaCopy.vue
new file mode 100644
index 0000000..dc52373
--- /dev/null
+++ b/pages/tiaomachaima/tiaomachaimaCopy.vue
@@ -0,0 +1,704 @@
+<template>
+ <view class="container">
+ <view class="header">
+ <view class="item">
+ <view class="left">鏉$爜缂栧彿锛�</view>
+ <view class="right">
+ <input :focus="HBarCodeFocus" v-model="barCodeInfoMeta.barCodeNo" placeholder="璇锋壂鎻忔潯鐮�"
+ @confirm="searchbarCodeInfo" />
+ </view>
+ <view>
+ <uni-icons type="scan"
+ style="background-color: #3A78FF;padding: 6rpx;color: #fff;border-radius: 100%;font-weight: 500;"
+ size="20" @click="toScanCode"></uni-icons>
+ </view>
+ </view>
+ <view class="item">
+ <view class="left">鎷嗙爜鏁伴噺锛�</view>
+ <view class="right">
+ <input type="number" name="HSplitNum" v-model="barCodeInfoMeta.splitNum" placeholder="璇疯緭鍏ユ媶鐮佹暟閲�" />
+ </view>
+ </view>
+ <view class="item">
+ <view class="left">鍒跺崟浜猴細</view>
+ <view class="right">
+ <input type="text" disabled name="HMaker" v-model="barCodeInfoMeta.billMaker"
+ style="background-color: #e4e4e4;" placeholder="璇疯緭鍏ュ埗鍗曚汉" />
+ </view>
+ </view>
+ <view class="operation-zone">
+ <button :class="cantSplit ? 'btn-disabled' : 'btn-c'" @click="searchbarCodeInfoMeta"
+ :disabled="cantSplit">鎷嗙爜</button>
+ <button type="default" :class="cantGenerate ? 'btn-disabled' : 'btn-c'" @click="SaveBarCodeCreate"
+ :disabled="cantGenerate">鐢熸垚</button>
+ <button type="default" :class="cantPrint ? 'btn-disabled' : 'btn-c'" @click="PrintHBarCode"
+ :disabled="cantPrint">鎵撳嵃</button>
+ <button type="primary" @click="printerLabel">娴嬭瘯鎵撳嵃</button>
+ <button type="primary" @click="printTest">鍥炵焊璺濈</button>
+ </view>
+ </view>
+ <view class="divide"></view>
+ <view class="content">
+ <view class="barcode-detail" v-show="CommonUtils.isEmpty(Object.assign(barCodeInfo, {})) === false">
+ <view class="title">鏉$爜淇℃伅</view>
+ <uni-card>
+ <view class="detail" style="display: none;">
+ <text>鏉$爜ID锛�</text>{{barCodeInfo['HItemID'] || '0'}}
+ </view>
+ <view class="detail">
+ <text>鏉$爜缂栧彿锛�</text>{{barCodeInfo['鏉$爜缂栧彿'] || ''}}
+ </view>
+ <view class="detail">
+ <text>鏉$爜鍘熸暟閲忥細</text>{{barCodeInfo['鏁伴噺'] || '0'}}
+ </view>
+ <view class="detail">
+ <text>鍓╀綑鏁伴噺锛�</text>{{barCodeInfo['鍓╀綑鏁伴噺'] || '0'}}
+ </view>
+ <view class="dWetail">
+ <text>鐗╂枡缂栫爜锛�</text>{{barCodeInfo['鐗╂枡浠g爜'] || ''}}
+ </view>
+ <view class="detail">
+ <text>鐗╂枡鍚嶇О锛�</text>{{barCodeInfo['鐗╂枡鍚嶇О'] || ''}}
+ </view>
+ <view class="detail">
+ <text>瑙勬牸鍨嬪彿锛�</text>{{barCodeInfo['瑙勬牸鍨嬪彿'] || ''}}
+ </view>
+ <view class="detail">
+ <text>璁¢噺鍗曚綅锛�</text>{{barCodeInfo['璁¢噺鍗曚綅'] || ''}}
+ </view>
+ </uni-card>
+ </view>
+ <view class="divide"></view>
+ <view class="barcode-split" v-show="barCodeSplitInfo.length>0">
+ <view class="title">鏉$爜鎷嗙爜</view>
+ <view class="barcode-split-list" v-for="(item,index) in barCodeSplitInfo" :key="index">
+ <uni-card @tap="ModityHQty(item)">
+ <view class="detail">
+ <text>鏉$爜缂栧彿锛�</text>{{item['HBarCode'] || ''}}
+ </view>
+ <view class="detail split-num">
+ <text>鎷嗗垎鏁伴噺锛�</text>{{item['HSplitNum'] || '0'}}
+ </view>
+ <view class="detail">
+ <text>鐗╂枡浠g爜锛�</text>{{item['HNumber'] || ''}}
+ </view>
+ <view class="detail">
+ <text>鐗╂枡鍚嶇О锛�</text>{{item['HName'] || ''}}
+ </view>
+ <view class="detail">
+ <text>瑙勬牸鍨嬪彿锛�</text>{{item['HModel'] || ''}}
+ </view>
+ <view class="detail">
+ <text>璁¢噺鍗曚綅锛�</text>{{barCodeInfo['璁¢噺鍗曚綅'] || ''}}
+ </view>
+ </uni-card>
+ </view>
+ </view>
+ </view>
+ <view class="over" v-if="barCodeSplitInfo.length == 0">鏆傛棤鏁版嵁</view>
+ <view class="over" v-if="barCodeSplitInfo.length != 0">宸插埌搴�</view>
+
+ </view>
+</template>
+
+<script>
+ const printer = uni.requireNativePlugin('LcPrinter');
+ const modal = uni.requireNativePlugin('modal');
+ var globalEvent = uni.requireNativePlugin('globalEvent');
+
+ // 鍦ㄥ叏灞�瀹氫箟涓�涓彉閲忔潵鏍囪瘑鏄惁宸茬粡鍒濆鍖�
+ var isPrinterInitialized = false;
+
+ import {
+ getUserInfo
+ } from "@/utils/auth.js";
+ import {
+ CommonUtils
+ } from "@/utils/common.js"
+ export default {
+ data() {
+ return {
+ CommonUtils,
+ userInfo: getUserInfo(),
+ serverUrl: uni.getStorageSync('serverUrl') || 'http://47.96.97.237/API',
+ barCodeInfoMeta: {
+ barCodeNo: "",
+ splitNum: "",
+ billMaker: getUserInfo().HEmpName?" ":getUserInfo().HEmpName,
+ billMakerID: getUserInfo().HEmpID?0:getUserInfo().HEmpID
+ },
+ base64:"",
+ barCodeInfo: {//鍘熸潯鐮佷俊鎭�
+
+ },
+ barCodeSplitInfo: [],//鎷嗙爜淇℃伅
+ cantGenerate: true, // 鐢熸垚鎸夐挳鍒濆绂佺敤
+ cantPrint: true, // 鎵撳嵃鎸夐挳鍒濆绂佺敤
+ cantSplit: false, // 鎷嗙爜鎸夐挳鍒濆鍙敤
+ HBarCodeFocus: false,
+ isPrinting:false,
+ printInfo: "" //鎵撳嵃
+ };
+ },
+ methods: {
+
+ //鎵撳嵃鏈哄垵濮嬪寲
+ initPrinter() {
+ // 璋冪敤寮傛鏂规硶
+ console.log('鏂扮増鍒濆鍖�');
+ var ret = printer.initPrinter({});
+ modal.toast({
+ message: ret,
+ duration: 1.5
+ });
+ printer.printEnableMark({
+ enable: true
+ });
+ printer.setConcentration({ //璁剧疆鎵撳嵃娴撳害銆俧ont_level 鍙栧�艰寖鍥达細1~39銆�
+ level: 39
+ });
+ printer.setLineSpacing({
+ spacing: 1
+ });
+ //add by ljh
+ printer.setFontSize({
+ fontSize: 8
+ });
+ //add end
+ printer.getsupportprint();
+
+ },
+ printTest() {
+ printer.printEnableMark({enable: false});
+ console.log('娴嬭瘯鍥炵焊璺濈');
+ printer.printBarcode({
+ text: 1234567890123456789,
+ height: 80,
+ barcodeType: 73
+ });
+ printer.setFeedPaperSpace({ space: 1000});
+ printer.setUnwindPaperLen({ length: 60 });
+ printer.printLine({
+ line_length: 5
+ });
+
+ printer.printGoToNextMark();//鏍囩鎵撳嵃浣跨敤,寮�濮嬭蛋绾�
+ //printer.start();//鐑晱鎵撳嵃浣跨敤,寮�濮嬭蛋绾�
+ },
+ printerLabel(item) {
+ console.log('娴嬭瘯鎵撳嵃');
+ printer.setUnwindPaperLen({ length: 60 });
+ printer.setFontSize({
+ fontSize: 1
+ });
+ printer.printText2({
+ offset: 1,
+ fontSize: 2,
+ isBold: false,
+ isUnderLine: false,
+ content: '鍑哄簱鍗曞彿锛歁ATO00049684\r\n',
+ });
+
+ printer.printText2({
+ offset: 1,
+ fontSize: 2,
+ isBold: false,
+ isUnderLine: false,
+ content: '渚涘簲鍟嗗悕绉帮細鎱堟邯鐟炵泭鐢靛瓙鏈夐檺鍏徃\r\n'
+ });
+
+ printer.printText2({
+ offset: 1,
+ fontSize:2,
+ isBold: false,
+ isUnderLine: false,
+ content: '鐗╂枡浠g爜锛歊.06.17.02.18002\r\n'
+ });
+ printer.printText2({
+ offset: 1,
+ fontSize: 2,
+ isBold: false,
+ isUnderLine: false,
+ content: '鐗╂枡绠�绉帮細12SH 鍑洪缃� 娉ㄥ鐏�011(鍚孏E鐏�)\r\n'
+ });
+ printer.printText2({
+ offset: 1,
+ fontSize:2,
+ isBold: false,
+ isUnderLine: false,
+ content: '鐗╂枡鍚嶇О锛�12SH 鍑洪缃� 娉ㄥ鐏�011(鍚孏E鐏�)\r\n'
+ });
+
+ printer.printText2({
+ offset: 1,
+ fontSize:2,
+ isBold: false,
+ isUnderLine: false,
+ content: '鏁伴噺锛�1\r\n'
+ });
+ printer.printText2({
+ offset: 1,
+ fontSize: 2,
+ isBold: false,
+ isUnderLine: false,
+ content: '宸ュ彿锛�1\r\n'
+ });
+ printer.printText2({
+ offset: 1,
+ fontSize: 2,
+ isBold: false,
+ isUnderLine: false,
+ content: '鐢熶骇鏃ユ湡锛�2025-8-13\r\n'
+ });
+ printer.printText2({
+ offset: 1,
+ fontSize: 2,
+ isBold: false,
+ isUnderLine: false,
+ content: '宸ュ彿锛�000001\r\n'
+ });
+ printer.printQR2({
+ text: 'title',
+ height: 100,
+ offset: 3
+ });
+
+ printer.printGoToNextMark();
+
+ console.log('娴嬭瘯鎵撳嵃QR缁撴潫');
+ },
+ doRequest(url, data, resFunction, errFunction, method) {
+ uni.showLoading({
+ title: '鍔犺浇涓�...'
+ })
+ uni.request({
+ method: method || "GET",
+ url: this.serverUrl + url,
+ data: data || "",
+ success: (res) => {
+ if (typeof resFunction === 'function') {
+ resFunction.call(this, res)
+ } else if (typeof errFunction === 'undefined') {
+ return
+ } else {
+ throw new TypeError("璁块棶鎴愬姛鍥炶皟鍑芥暟绫诲瀷寮傚父!")
+ }
+ },
+ fail: (err) => {
+ uni.showToast({
+ icon: "error",
+ title: "鎺ュ彛璁块棶寮傚父!",
+ duration: 2000
+ })
+ if (typeof errFunction === 'function') {
+ errFunction.call(this, err)
+ } else if (typeof errFunction === 'undefined') {
+ return
+ } else {
+ throw new TypeError("璁块棶澶辫触鍥炶皟鍑芥暟绫诲瀷寮傚父!")
+ }
+ }
+ })
+ uni.hideLoading()
+ },
+ //鍏夋爣
+ async refreshBarCodeState() {
+ this.HBarCodeFocus = false
+ await this.$nextTick(() => {
+ this.HBarCodeFocus = true
+ this.barCodeInfoMeta.barCodeNo = ""
+ })
+ },
+ //鎽勫儚澶磋皟鐢�
+ async searchbarCodeInfo() {
+ await this.$nextTick()
+ let urlEncode =
+ `/Gy_BarCodeBillList/page?sWhere= and 鏉$爜缂栧彿=''${this.barCodeInfoMeta.barCodeNo}''&user=${getUserInfo()["Czymc"]}&page=1&size=1`
+ .toString()
+ if (CommonUtils.isEmpty(this.barCodeInfoMeta.barCodeNo) == true) {
+ return uni.showToast({
+ icon: "fail",
+ title: "鏉$爜缂栧彿涓嶈兘涓虹┖!"
+ })
+ }
+ this.doRequest(
+ urlEncode, {},
+ (res) => {
+ console.log(res)
+ let res1 = res.data
+ let {
+ data,
+ count
+ } = res1
+ if (count > 0) {
+
+ this.barCodeInfo = data[0]
+ this.barCodeSplitInfo = []
+ // 鎵弿鏉$爜鍚庨噸缃寜閽姸鎬�
+ this.resetButtonState();
+
+ }else{
+ CommonUtils.showTips({
+ message: "璇ユ潯鐮佷笉瀛樺湪锛�"+this.barCodeInfoMeta.barCodeNo,
+ })
+ this.barCodeInfoMeta.barCodeNo="";
+ }
+ },
+ (err) => {
+ console.err(err)
+ uni.showToast({
+ icon: "fail",
+ title: err
+ })
+ }
+ )
+ },
+ //鎷嗙爜鎸夐挳璋冪敤
+ async searchbarCodeInfoMeta() {
+ this.cantGenerate = true
+ this.cantPrint = true
+ this.cantSplit = false // 鎷嗙爜鍓嶇‘淇濇媶鐮佹寜閽彲鐢�
+ if (CommonUtils.isEmpty(this.barCodeInfoMeta.barCodeNo) === true) {
+ return uni.showToast({
+ icon: 'none',
+ title: '鏉$爜缂栧彿涓嶅緱涓虹┖!'
+ });
+ }
+ if (CommonUtils.isEmpty(this.barCodeInfoMeta.splitNum, true) === true) {
+ return uni.showToast({
+ icon: 'none',
+ title: '鎷嗗垎鏁伴噺涓嶅緱涓虹┖!'
+ });
+ }
+ if (CommonUtils.isEmpty(this.barCodeInfoMeta.splitNum, true) === true) {
+ return uni.showToast({
+ icon: 'none',
+ title: '鎷嗗垎鏁伴噺涓嶅緱涓虹┖!'
+ });
+ }
+ if (parseFloat(this.barCodeInfoMeta.splitNum) > parseFloat(this.barCodeInfo['鏁伴噺'])) {
+ return uni.showToast({
+ icon: 'none',
+ title: '鎷嗗垎鏁伴噺涓嶈兘澶т簬鏉$爜鍘熸暟閲�!'
+ });
+ }
+ this.doRequest(
+ "/Sc_BarCode/SplitBarCode_Sub", {
+ HBarCodeNo: this.barCodeInfoMeta.barCodeNo,
+ },
+ (res) => {
+ this.barCodeSplitInfo = []
+ if (res.data.count > 0) {
+
+ if (res.data.data.length < 1) {
+ return uni.showToast({
+ icon: 'none',
+ title: Message
+ });
+ }
+
+ //鎷嗗垎鏉$爜锛氭暟閲忎负 splitNum
+ let barCodeItem1 = JSON.parse(JSON.stringify(res.data.data.SubBarCodes[0]));
+ let HSplitNum = this.barCodeInfoMeta.splitNum;
+ this.barCodeSplitInfo.push({
+ HSplitNum: this.barCodeInfoMeta.splitNum,
+ HBarCode: res.data.data.NextBarCode,
+ HNumber: barCodeItem1.HNumber,
+ HName: barCodeItem1.HName,
+ HModel: barCodeItem1.HModel
+ });
+
+ //鏇存柊鍘熷厛鏉$爜鏁伴噺
+ this.barCodeInfo['鍓╀綑鏁伴噺'] = this.barCodeInfo['鏁伴噺'] - this.barCodeInfoMeta.splitNum;
+
+ // 鎷嗙爜鎴愬姛锛岀鐢ㄦ媶鐮佹寜閽紝鏀惧紑鐢熸垚鎸夐挳
+ this.cantSplit = true;
+ this.cantGenerate = false;
+ this.cantPrint = true;
+ //鐢熸垚
+ this.SaveBarCodeCreate();
+ } else {
+ uni.showToast({
+ icon: 'none',
+ title: '娌℃湁鎵惧埌瀵瑰簲鐨勫崟鎹�'
+ });
+ }
+ },
+ (err) => {
+ CommonUtils.showTips({
+ message: "鏉$爜鎷嗙爜鍑虹幇閿欒"+err,
+ })
+ console.error(err)
+ }
+ )
+ },
+ //淇濆瓨鏂规硶
+ SaveBarCodeCreate() {
+ // 鏍¢獙鎷嗙爜鏁伴噺
+ let sum = this.barCodeSplitInfo.reduce((acc, obj) => {
+ return acc + obj["HSplitNum"]
+ }, 0)
+
+ if (sum > this.barCodeInfo["HQty"]) {
+ return uni.showToast({
+ icon: 'none',
+ title: '鎷嗙爜鏁伴噺鍜屼笉寰楀ぇ浜庢潯鐮佹暟閲�'
+ });
+ }
+ let msg =
+ `${this.barCodeInfoMeta["barCodeNo"]};${this.barCodeInfoMeta["splitNum"]};${JSON.stringify(this.barCodeSplitInfo)};${this.billMaker}`
+ this.doRequest(
+ "/Sc_BarCode/SplitBarCode_Save", {
+ msg: msg
+ },
+ (res) => {
+ if (res.data.code == 1) {
+ // 鐢熸垚鎴愬姛锛岀鐢ㄧ敓鎴愭寜閽紝鏀惧紑鎵撳嵃鎸夐挳
+ this.cantGenerate = true;
+ this.cantPrint = false;
+ this.cantSplit = true;
+ this.barCodeInfoMeta.barCodeNo="";//娓呯┖杈撳叆妗�
+ uni.showToast({
+ title: '鐢熸垚鎴愬姛!'
+ });
+ } else {
+ this.cantGenerate = false;
+ uni.showToast({
+ title: res.data.Message
+ });
+ }
+
+ },
+ (err) => {
+ console.log(err)
+ CommonUtils.showTips({
+ message: "鏉$爜鐢熸垚鍑虹幇閿欒"+err,
+ })
+
+ },
+ "POST"
+ )
+
+ },
+ //鎵撳嵃鎸夐挳
+ // 鐖剁粍浠朵腑鐨勬墦鍗版柟娉�
+ async PrintHBarCode() {
+ // 闃叉閲嶅鐐瑰嚮
+ if (this.isPrinting) {
+ uni.showToast({
+ title: '鎵撳嵃涓紝璇风◢鍊�...',
+ icon: 'none'
+ });
+ return;
+ }
+
+ this.isPrinting = true;
+
+ try {
+ let HBarCodeNoStr = `${this.barCodeSplitInfo[0]['HBarCode']}`;
+ console.log('鑾峰彇鏁版嵁', HBarCodeNoStr);
+
+ // 鏄剧ず鎵撳嵃涓姸鎬�
+ uni.showLoading({
+ title: '鎵撳嵃涓�...',
+ mask: true
+ });
+
+ // 鑾峰彇鎵撳嵃鏁版嵁
+ const printData = await new Promise((resolve, reject) => {
+ uni.request({
+ url: this.serverUrl + '/Sc_BarCode/GetSplitBarCode_SubList',
+ data: {
+ HBarCodeNo: HBarCodeNoStr
+ },
+ success: (res) => {
+ if (res.data.count == 1) {
+ resolve(res.data.data[0]);
+ } else {
+ reject(new Error(res.data.Message || '鏈壘鍒版墦鍗版暟鎹�'));
+ }
+ },
+ fail: (err) => {
+ reject(new Error('鎺ュ彛璇锋眰澶辫触'));
+ }
+ });
+ });
+
+ const item = printData;
+
+ // 绛夊緟鎵撳嵃缁勪欢鏇存柊
+ await this.$nextTick();
+
+
+ // 鎵撳嵃鎴愬姛鍚庨噸缃姸鎬�
+ uni.hideLoading();
+ //this.printerLabel();//鎵撳嵃
+ } catch (error) {
+ console.error('鎵撳嵃澶辫触:', error);
+ uni.hideLoading();
+ this.isPrinting = false;
+
+ uni.showToast({
+ title: error.message || '鎵撳嵃澶辫触',
+ icon: 'error',
+ duration: 2000
+ });
+ CommonUtils.playSound(0);
+ }
+ },
+ toScanCode() {
+ var mpaasScanModule = uni.requireNativePlugin("Mpaas-Scan-Module")
+ mpaasScanModule.mpaasScan({
+ 'hideAlbum': true,
+ 'timeoutInterval': '10', //瓒呮椂鏃堕棿
+ 'timeoutText': '鏈瘑鍒埌浜岀淮鐮�' //瓒呮椂鎻愰啋
+ }, (ret) => {
+ console.log(ret.resp_result)
+ if (this.CommonUtils.isEmpty(ret.resp_result) === false) {
+ console.log('鏉$爜鍐呭锛�' + ret.resp_result);
+ this.barCodeInfoMeta.barCodeNo = ret.resp_result
+
+ this.searchbarCodeInfo()
+ }
+ })
+ },
+ // 閲嶇疆鎸夐挳鐘舵�佹柟娉�
+ resetButtonState() {
+ this.cantSplit = false; // 鎷嗙爜鎸夐挳鍙敤
+ this.cantGenerate = true; // 鐢熸垚鎸夐挳绂佺敤
+ this.cantPrint = true; // 鎵撳嵃鎸夐挳绂佺敤
+ }
+ },
+ onLoad() {
+ this.HBarCodeFocus = true;
+ // 椤甸潰鍒濆鍖栨椂璁剧疆鎸夐挳鐘舵��
+ this.resetButtonState();
+ // 娣诲姞鎵撳嵃鐘舵�佺洃鍚�
+ if(!isPrinterInitialized){
+ globalEvent.addEventListener('onPrintCallback', function(e) {
+ uni.showToast({
+ title: 'state: ' + JSON.stringify(e),
+ duration: 2000
+ });
+ if (e.key == 0) {
+ uni.showToast({
+ title: '鎵撳嵃鎴愬姛',
+ duration: 2000
+ });
+ //鎴愬姛鍚庤缃姸鎬�
+ this.isPrinting = false;
+ //this.resetButtonState();
+ } else if (e.key == 3) {
+ this.isPrinting = false;
+ uni.showToast({
+ title: '缂虹焊',
+ duration: 2000
+ });
+ }
+ });
+ globalEvent.addEventListener('getsupportprint', function(e) {
+ console.log('key: ' + JSON.stringify(e));
+ uni.showToast({
+ title: 'key: ' + JSON.stringify(e),
+ duration: 2000
+ });
+ });
+ }
+ //鍒濆鍖栨墦鍗�
+ this.initPrinter();
+
+ },
+ onReady() {
+
+ }
+ }
+</script>
+
+<style lang="scss">
+ * {
+ box-sizing: border-box;
+ }
+
+ input {
+ padding: 8rpx 20rpx;
+ font-size: 30rpx;
+ line-height: 30rpx;
+ }
+
+ button {
+ padding: 0;
+ width: 150rpx;
+ font-size: 25rpx;
+ }
+
+ .uni-card {
+ margin: 0 !important;
+ }
+
+ .container {
+ .header {
+ padding: 20rpx 10rpx;
+ display: flex;
+ flex-direction: column;
+ gap: 20rpx;
+
+ .item {
+ display: flex;
+ flex-direction: row;
+ padding: 0 10rpx;
+ gap: 20rpx;
+ font-size: 30rpx;
+ // height: 1.5rem;
+ // justify-content: center;
+ align-items: center;
+
+ .left {
+ text-align: right;
+ width: 5rem;
+ }
+
+ .right {
+ flex: 1;
+ height: 100%;
+ padding: 6rpx 0;
+ border-radius: 22rpx;
+ border: 1px solid #e4e4e4;
+ //background-color: #e4e4e4;
+
+ >input {
+ height: auto;
+ }
+ }
+ }
+
+ .operation-zone {
+ display: flex;
+ flex-direction: row;
+ justify-content: space-evenly;
+
+ .btn-c {
+ background-color: #3a78ff;
+ color: #fff;
+ }
+ }
+ }
+
+ .divide {
+ width: 100%;
+ height: 16rpx;
+ background-color: #e5e5e5;
+ }
+
+ .content {
+ flex: 1;
+
+ .barcode-detail,
+ .barcode-split {
+ padding: 30rpx;
+ display: flex;
+ flex-direction: column;
+ gap: 30rpx;
+ }
+ }
+ }
+</style>
\ No newline at end of file
--
Gitblit v1.9.1