feat(scan): 添加手机扫码功能支持
- 在 FabricOutScanBar 组件中添加手机扫码图标和事件处理 - 更新工作台页面的扫码逻辑以支持手机扫码回退 - 在销售拣货详情页添加手机扫码按钮和处理方法 - 重构扫码设置页面以支持扫码方式选择 - 添加手机扫码配置和判断逻辑到扫码配置模块 - 扩展扫码混入模块以支持手机扫码模式和设备检测 - 在多个业务页面中集成手机扫码功能和界面元素 - 更新扫码配置存储和读取逻辑以兼容新配置结构
This commit is contained in:
@@ -31,6 +31,14 @@
|
||||
</view>
|
||||
<u-form-item label-width="150" label="条码资料:">
|
||||
<input type="text" maxlength="-1" v-model="QRBarCode" style="width:200px;" @confirm="GoodsCheckBillDetailScan" />
|
||||
<u-icon
|
||||
v-if="usePhoneScanFallback"
|
||||
name="scan"
|
||||
size="44"
|
||||
color="#2979ff"
|
||||
style="margin-left: 8px;"
|
||||
@click="handlePhoneScan"
|
||||
/>
|
||||
<checkbox-group @change="BarCodeDelChange">
|
||||
<checkbox ref="checkBoxRef" :checked="BarCodeDelStatus">删除</checkbox>
|
||||
</checkbox-group>
|
||||
@@ -193,28 +201,20 @@
|
||||
},
|
||||
|
||||
onUnload() {
|
||||
// #ifdef APP-PLUS
|
||||
this.isPageActive = false;
|
||||
this.unregisterScanBroadcast();
|
||||
// #endif
|
||||
},
|
||||
|
||||
onHide() {
|
||||
// 页面隐藏时
|
||||
this.isPageActive = false;
|
||||
// #ifdef APP-PLUS
|
||||
this.unregisterScanBroadcast();
|
||||
// #endif
|
||||
},
|
||||
|
||||
onShow() {
|
||||
// 页面显示时
|
||||
this.isPageActive = true;
|
||||
// #ifdef APP-PLUS
|
||||
this.registerScanBroadcast((scanResult) => {
|
||||
console.log("扫码结果:", scanResult);
|
||||
|
||||
// 处理扫描结果,按照原有逻辑
|
||||
if(!this.StoreName){
|
||||
this.showError('请先选择仓库');
|
||||
return;
|
||||
@@ -240,9 +240,11 @@
|
||||
return;
|
||||
}
|
||||
});
|
||||
// #endif
|
||||
},
|
||||
methods: {
|
||||
handlePhoneScan() {
|
||||
this.openPhoneScan();
|
||||
},
|
||||
|
||||
// 添加通用错误提示方法
|
||||
showError(message) {
|
||||
|
||||
@@ -12,6 +12,14 @@
|
||||
<u-form-item label-width="150" label="条码资料:">
|
||||
<input type="text" v-model="QRBarCode" maxlength="-1" style="width:200px;"
|
||||
@confirm="GoodsCheckBillDetailScan" />
|
||||
<u-icon
|
||||
v-if="usePhoneScanFallback"
|
||||
name="scan"
|
||||
size="44"
|
||||
color="#2979ff"
|
||||
style="margin-left: 8px;"
|
||||
@click="handlePhoneScan"
|
||||
/>
|
||||
<checkbox-group @change="BarCodeDelChange">
|
||||
<checkbox ref="checkBoxRef" :checked="BarCodeDelStatus">删除</checkbox>
|
||||
</checkbox-group>
|
||||
@@ -147,36 +155,30 @@ export default {
|
||||
},
|
||||
|
||||
onShow() {
|
||||
// 设置页面激活状态
|
||||
this.isPageActive = true;
|
||||
|
||||
// #ifdef APP-PLUS
|
||||
this.registerScanBroadcast((scanResult) => {
|
||||
console.log("扫码结果:", scanResult);
|
||||
|
||||
// 处理扫描结果
|
||||
this.QRBarCode = scanResult;
|
||||
this.$nextTick(() => {
|
||||
this.GoodsCheckBillDetailScan();
|
||||
});
|
||||
});
|
||||
// #endif
|
||||
},
|
||||
|
||||
onHide() {
|
||||
this.isPageActive = false;
|
||||
// #ifdef APP-PLUS
|
||||
this.unregisterScanBroadcast();
|
||||
// #endif
|
||||
},
|
||||
|
||||
onUnload() {
|
||||
this.isPageActive = false;
|
||||
// #ifdef APP-PLUS
|
||||
this.unregisterScanBroadcast();
|
||||
// #endif
|
||||
},
|
||||
methods: {
|
||||
handlePhoneScan() {
|
||||
this.openPhoneScan();
|
||||
},
|
||||
|
||||
// 添加通用错误提示方法
|
||||
showError(message) {
|
||||
this.playError();
|
||||
|
||||
@@ -26,6 +26,14 @@
|
||||
<u-form-item label-width="150" label="条码资料:" :class="{ 'input-highlight': shouldHighlightQR }">
|
||||
<input type="text" v-model="QRBarCode" maxlength="-1" style="width:150px;"
|
||||
@confirm="GoodsStoreStationMoveScan" />
|
||||
<u-icon
|
||||
v-if="usePhoneScanFallback"
|
||||
name="scan"
|
||||
size="44"
|
||||
color="#2979ff"
|
||||
style="margin-left: 8px;"
|
||||
@click="handlePhoneScan"
|
||||
/>
|
||||
</u-form-item>
|
||||
<u-form-item>
|
||||
<text class="title">{{ BillDataMessage }}</text>
|
||||
@@ -150,10 +158,8 @@ export default {
|
||||
this.StoreNameID = getApp().globalData.StoreNameID;
|
||||
this.StoreName = getApp().globalData.StoreName;
|
||||
};
|
||||
// #ifdef APP-PLUS
|
||||
// 使用 scanMixin 的方法注册扫码广播,传入自定义回调
|
||||
this.registerScanBroadcast(this.handleScanCode);
|
||||
// #endif
|
||||
},
|
||||
// onUnload, onHide, onShow 已由 scanMixin 自动处理
|
||||
/* onBackPress() {
|
||||
@@ -174,6 +180,10 @@ export default {
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
handlePhoneScan() {
|
||||
this.openPhoneScan();
|
||||
},
|
||||
|
||||
playSuccess() {
|
||||
util.playSuccessAudio();
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user