|
|
|
|
@ -31,13 +31,6 @@ if (uni.restoreGlobal) {
|
|
|
|
|
}
|
|
|
|
|
(function(vue) {
|
|
|
|
|
"use strict";
|
|
|
|
|
function formatAppLog(type, filename, ...args) {
|
|
|
|
|
if (uni.__log__) {
|
|
|
|
|
uni.__log__(type, filename, ...args);
|
|
|
|
|
} else {
|
|
|
|
|
console[type].apply(console, [...args, filename]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
const _export_sfc = (sfc, props) => {
|
|
|
|
|
const target = sfc.__vccOpts || sfc;
|
|
|
|
|
for (const [key, val] of props) {
|
|
|
|
|
@ -68,7 +61,11 @@ if (uni.restoreGlobal) {
|
|
|
|
|
status: "in-progress",
|
|
|
|
|
statusText: "进行中"
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
],
|
|
|
|
|
showH5Scan: false,
|
|
|
|
|
html5QrCode: null,
|
|
|
|
|
scanType: ""
|
|
|
|
|
// 'inventory' or 'view'
|
|
|
|
|
};
|
|
|
|
|
},
|
|
|
|
|
onLoad() {
|
|
|
|
|
@ -82,51 +79,44 @@ if (uni.restoreGlobal) {
|
|
|
|
|
const day = String(now.getDate()).padStart(2, "0");
|
|
|
|
|
this.currentDate = `${year}-${month}-${day}`;
|
|
|
|
|
},
|
|
|
|
|
scanInventory() {
|
|
|
|
|
handleScan(type) {
|
|
|
|
|
this.scanType = type;
|
|
|
|
|
uni.scanCode({
|
|
|
|
|
success: (res) => {
|
|
|
|
|
formatAppLog("log", "at pages/index/index.vue:65", "url:", res.result);
|
|
|
|
|
let url = res.result;
|
|
|
|
|
let id = "";
|
|
|
|
|
const match = url.match(/[?&]id=([^&]+)/);
|
|
|
|
|
if (match) {
|
|
|
|
|
id = match[1];
|
|
|
|
|
}
|
|
|
|
|
formatAppLog("log", "at pages/index/index.vue:73", "id:", id);
|
|
|
|
|
if (!id) {
|
|
|
|
|
uni.showToast({ title: "二维码无效", icon: "none" });
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
uni.navigateTo({
|
|
|
|
|
url: `/pages/inventory/inventory?code=${encodeURIComponent(id)}`
|
|
|
|
|
});
|
|
|
|
|
if (type === "inventory") {
|
|
|
|
|
uni.navigateTo({ url: `/pages/inventory/inventory?code=${encodeURIComponent(id)}` });
|
|
|
|
|
} else {
|
|
|
|
|
uni.navigateTo({ url: `/pages/inventory/inventory?code=${encodeURIComponent(id)}&view=1` });
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
fail: () => {
|
|
|
|
|
uni.showToast({ title: "扫码失败", icon: "none" });
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
scanInventory() {
|
|
|
|
|
this.handleScan("inventory");
|
|
|
|
|
},
|
|
|
|
|
scanView() {
|
|
|
|
|
uni.scanCode({
|
|
|
|
|
success: (res) => {
|
|
|
|
|
let url = res.result;
|
|
|
|
|
let id = "";
|
|
|
|
|
const match = url.match(/[?&]id=([^&]+)/);
|
|
|
|
|
if (match) {
|
|
|
|
|
id = match[1];
|
|
|
|
|
}
|
|
|
|
|
if (!id) {
|
|
|
|
|
uni.showToast({ title: "二维码无效", icon: "none" });
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
uni.navigateTo({
|
|
|
|
|
url: `/pages/inventory/inventory?code=${encodeURIComponent(id)}&view=1`
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
fail: () => {
|
|
|
|
|
uni.showToast({ title: "扫码失败", icon: "none" });
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
this.handleScan("view");
|
|
|
|
|
},
|
|
|
|
|
closeH5Scan() {
|
|
|
|
|
this.showH5Scan = false;
|
|
|
|
|
if (this.html5QrCode) {
|
|
|
|
|
this.html5QrCode.stop().then(() => {
|
|
|
|
|
this.html5QrCode.clear();
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
goTaskDetail(item) {
|
|
|
|
|
uni.navigateTo({
|
|
|
|
|
@ -191,11 +181,31 @@ if (uni.restoreGlobal) {
|
|
|
|
|
/* KEYED_FRAGMENT */
|
|
|
|
|
))
|
|
|
|
|
])
|
|
|
|
|
])
|
|
|
|
|
]),
|
|
|
|
|
vue.createCommentVNode(" H5扫码弹窗 "),
|
|
|
|
|
$data.showH5Scan ? (vue.openBlock(), vue.createElementBlock("div", {
|
|
|
|
|
key: 0,
|
|
|
|
|
class: "h5-scan-modal"
|
|
|
|
|
}, [
|
|
|
|
|
vue.createElementVNode("div", {
|
|
|
|
|
id: "reader",
|
|
|
|
|
style: { "width": "300px", "height": "300px", "margin": "0 auto" }
|
|
|
|
|
}),
|
|
|
|
|
vue.createElementVNode("button", {
|
|
|
|
|
onClick: _cache[2] || (_cache[2] = (...args) => $options.closeH5Scan && $options.closeH5Scan(...args))
|
|
|
|
|
}, "关闭")
|
|
|
|
|
])) : vue.createCommentVNode("v-if", true)
|
|
|
|
|
])
|
|
|
|
|
]);
|
|
|
|
|
}
|
|
|
|
|
const PagesIndexIndex = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["render", _sfc_render$4], ["__file", "D:/Lynn/Langye/stocktaking/pages/index/index.vue"]]);
|
|
|
|
|
function formatAppLog(type, filename, ...args) {
|
|
|
|
|
if (uni.__log__) {
|
|
|
|
|
uni.__log__(type, filename, ...args);
|
|
|
|
|
} else {
|
|
|
|
|
console[type].apply(console, [...args, filename]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
const BASE_API = "http://192.168.60.99:8004/";
|
|
|
|
|
const config = {
|
|
|
|
|
BASE_API
|
|
|
|
|
|