mirror of
https://gitee.com/java110/PropertyApp.git
synced 2026-06-11 06:07:28 +08:00
优化扫码问题
This commit is contained in:
parent
545e56af71
commit
6100ae71b3
@ -6,7 +6,12 @@
|
|||||||
<input type="text" placeholder="输入核销码" v-model="repairName" confirm-type="search"></input>
|
<input type="text" placeholder="输入核销码" v-model="repairName" confirm-type="search"></input>
|
||||||
</view>
|
</view>
|
||||||
<view class="action">
|
<view class="action">
|
||||||
|
<!-- #ifdef MP-WEIXIN -->
|
||||||
|
<button class="cu-btn bg-gradual-green shadow-blur round" @click="scanCodeHandler()">扫码</button>
|
||||||
|
<!-- #endif -->
|
||||||
|
<!-- #ifdef H5 -->
|
||||||
<button class="cu-btn bg-gradual-green shadow-blur round" @click="navigateToScan()">扫码</button>
|
<button class="cu-btn bg-gradual-green shadow-blur round" @click="navigateToScan()">扫码</button>
|
||||||
|
<!-- #endif -->
|
||||||
<button style="margin-left: 10px;" class="cu-btn bg-gradual-red shadow-blur round"
|
<button style="margin-left: 10px;" class="cu-btn bg-gradual-red shadow-blur round"
|
||||||
@click="comfirmTimeId(repairName)">核销</button>
|
@click="comfirmTimeId(repairName)">核销</button>
|
||||||
</view>
|
</view>
|
||||||
@ -133,6 +138,34 @@
|
|||||||
this._loadMyModify();
|
this._loadMyModify();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
scanCodeHandler() {
|
||||||
|
let that = this;
|
||||||
|
// 调起条码扫描
|
||||||
|
uni.scanCode({
|
||||||
|
onlyFromCamera: true, // 是否只能从相机扫码,不允许从相册选择图片
|
||||||
|
scanType: ['qrCode'], // 扫码类型 qrCode二维码
|
||||||
|
autoZoom: false, // 是否启用自动放大,默认启用
|
||||||
|
success: function(res) {
|
||||||
|
console.log(`扫码结果:${JSON.stringify(res,null,2)}`);
|
||||||
|
that.parseQRCode(res);
|
||||||
|
},
|
||||||
|
fail: function(err) {
|
||||||
|
console.log(`错误:${err}`);
|
||||||
|
},
|
||||||
|
complete: function(data) {
|
||||||
|
console.log('ok!');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
// 解析二维码,处理业务
|
||||||
|
parseQRCode(data) {
|
||||||
|
uni.vibrateShort(); // 震动提示
|
||||||
|
console.log({
|
||||||
|
title: data.result
|
||||||
|
});
|
||||||
|
this.comfirmTimeId(data.result);
|
||||||
|
//uni.showToast({title: data.result}); // 弹出提示
|
||||||
|
},
|
||||||
_searchRepair: function() {
|
_searchRepair: function() {
|
||||||
this.myOrders = [];
|
this.myOrders = [];
|
||||||
this.page = 1;
|
this.page = 1;
|
||||||
@ -227,7 +260,7 @@
|
|||||||
// debugger
|
// debugger
|
||||||
_that.repairName = timeId;
|
_that.repairName = timeId;
|
||||||
// debugger
|
// debugger
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
uni.showModal({
|
uni.showModal({
|
||||||
cancelText: "取消", // 取消按钮的文字
|
cancelText: "取消", // 取消按钮的文字
|
||||||
confirmText: "核销",
|
confirmText: "核销",
|
||||||
@ -250,7 +283,7 @@
|
|||||||
wx.hideLoading();
|
wx.hideLoading();
|
||||||
_that._loadMyModify();
|
_that._loadMyModify();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}, 1000);
|
}, 1000);
|
||||||
@ -262,4 +295,4 @@
|
|||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
Loading…
Reference in New Issue
Block a user