diff --git a/pages/appointment/appointment.vue b/pages/appointment/appointment.vue index 96dfbf1..cf543c5 100644 --- a/pages/appointment/appointment.vue +++ b/pages/appointment/appointment.vue @@ -6,7 +6,12 @@ + + + + + @@ -133,6 +138,34 @@ this._loadMyModify(); }, 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() { this.myOrders = []; this.page = 1; @@ -227,7 +260,7 @@ // debugger _that.repairName = timeId; // debugger - setTimeout(function() { + setTimeout(function() { uni.showModal({ cancelText: "取消", // 取消按钮的文字 confirmText: "核销", @@ -250,7 +283,7 @@ wx.hideLoading(); _that._loadMyModify(); }); - } + } } }); }, 1000); @@ -262,4 +295,4 @@ + \ No newline at end of file