From 42bf8e8f07c0ed4288e8c847978112af0615d041 Mon Sep 17 00:00:00 2001
From: 南骏 池 <chiffly@163.com>
Date: 星期四, 29 五月 2025 17:34:04 +0800
Subject: [PATCH] 1.生成表格
---
Scripts/config.js | 81 +++++++++++++++++++++++++++++++++++++---
1 files changed, 75 insertions(+), 6 deletions(-)
diff --git a/Scripts/config.js b/Scripts/config.js
index 8a55fd8..2d68190 100644
--- a/Scripts/config.js
+++ b/Scripts/config.js
@@ -1,5 +1,7 @@
-锘�//var APIURL = "http://192.168.1.145:83/api/";
-var APIURL = "http://localhost:55640/api/";
+锘�/*var APIURL = "http://192.168.1.145:83/api/";*/
+var APIURL = "http://localhost:5204/api/";
+var APIURL_PC = "http://192.168.1.145:81/";
+var APIURL_IMAGE = APIURL_PC+"upload/";
var ISNEEDLOGIN = true;
String.prototype.trim = function () {
return this.replace(/(^\s*)|(\s*$)/g, "");
@@ -70,13 +72,19 @@
* @param锛歿string} params 璇锋眰鍙傛暟,闈炲繀濉�
* @param锛歿string} variation 璇锋眰澶�,闈炲繀濉�
**/
-Vue.prototype.AxiosHttp = (method, url, params = {}, isToken = true) => {
- url = (APIURL + url);
+Vue.prototype.AxiosHttp = (method, url, params = {}, isToken = true, isPC =0) => {
+ if (isPC == 0)
+ {
+ url = (APIURL + url);
+ }
+ else{
+ url = (APIURL_PC + url);
+ }
let headers = { 'Content-Type': 'application/json', }
if (isToken) {
var timestamp = (new Date()).getTime();
- var token = "BasicAuth " + timestamp + "_" + Cookies.get('loginGuid');
- headers['Authorization'] = token;
+ var token = Cookies.get('loginGuid')
+ headers['token'] = token;
}
if (method == 'get') {
// console.log("params")
@@ -153,3 +161,64 @@
return;
window.history.back();
}
+
+
+// 鏂板鍏ㄥ眬鎵撳嵃鏂规硶
+Vue.prototype.sendPrintMessage = function (tbBillList) {
+ const cfDetails = tbBillList.cfBarInfo.map(item => {
+ return "! 0 200 200 210 1\r\n" +
+ "PAGE - WIDTH 700 \r\n" +
+ "GAP-SENSE \r\n" +
+/* "BOX 0 0 700 180 0 \r\n" +*/
+ `T 16 0 10 10 鐗╂枡缂栫爜锛歕r\n` +
+ `T 55 3 120 10 ${item.iteM_NO}\r\n` +
+ `T 16 0 310 10 ${item.item_name}\r\n` +
+ "T 55 2 10 42 鐗╂枡瑙勬牸锛歕r\n" +
+ `T 55 2 110 42 ${item.item_model}\r\n` +
+ "T 16 0 10 78 鏁伴噺锛歕r\n" +
+ `T 0 5 90 78 ${item.quantity}\r\n` +
+ `T 16 5 180 78 ${item.barType}\r\n` +
+ `BARCODE 128 1 25 35 350 130 ${item.iteM_BARCODE}\r\n` +
+/* `T 0 1 350 130 ${item.iteM_BARCODE}\r\n` +*/
+ "T 55 0 10 125 鍒涘缓鏃堕棿锛歕r\n" +
+ `T 55 0 120 125 ${item.creatE_DATE}\r\n` +
+ "T 55 0 10 150 鎵撳嵃鏃堕棿锛歕r\n" +
+ `T 55 0 120 150 ${item.print_date}\r\n` +
+ "B QR 580 12 M 2 U 4\r\n" +
+ `MA,${item.iteM_BARCODE}\r\n` +
+ "ENDQR\r\nFORM\r\nPRINT\r\n";
+ });
+
+ let sendData = {
+ Type: 'Bar',
+ Barcode: tbBillList.cfBarInfo[0].iteM_BARCODE,
+ Detail: cfDetails,
+ Ip: tbBillList.printInfo[0].ip,
+ Port: tbBillList.printInfo[0].port,
+ }
+
+ console.log('鎵撳嵃鏁版嵁锛�', sendData);
+ uni.webView.postMessage({
+ data: JSON.stringify(sendData)
+ })
+};
+
+// 鏂板闊抽鎾斁鏂规硶
+Vue.prototype.$playSound = function(type = 'success') {
+ try {
+ const audioMap = {
+ success: '/audio/OK.wav',
+ error: '/audio/NG.wav'
+ };
+ const audio = new Audio(audioMap[type]);
+ audio.play().catch(error => {
+ console.error('闊抽鎾斁澶辫触:', error);
+ this.$toast.fail('鎻愮ず闊冲姞杞藉け璐�');
+ });
+ } catch (e) {
+ console.error('闊抽鍒濆鍖栭敊璇�:', e);
+ }
+};
+
+
+
--
Gitblit v1.9.3