|
@@ -11,7 +11,10 @@
|
|
|
size="30px"
|
|
|
@click="showFlag = false"/>
|
|
|
<div class="input-type">
|
|
|
- <van-button type="default">扫码桌号</van-button>
|
|
|
+ <van-button
|
|
|
+ type="default"
|
|
|
+ @click="handleScanQRCode">扫码桌号
|
|
|
+ </van-button>
|
|
|
<van-button class="active" type="default">手动输入</van-button>
|
|
|
</div>
|
|
|
<van-field
|
|
@@ -32,6 +35,7 @@
|
|
|
|
|
|
<script>
|
|
|
import { Form, Button, Field, Icon } from 'vant'
|
|
|
+import wx from 'weixin-js-sdk'
|
|
|
|
|
|
export default {
|
|
|
name: 'index',
|
|
@@ -51,6 +55,16 @@ export default {
|
|
|
init () {
|
|
|
this.showFlag = true
|
|
|
},
|
|
|
+ handleScanQRCode () {
|
|
|
+ wx.scanQRCode({
|
|
|
+ needResult: 0, // 默认为0,扫描结果由微信处理,1则直接返回扫描结果,
|
|
|
+ scanType: ['qrCode', 'barCode'], // 可以指定扫二维码还是一维码,默认二者都有
|
|
|
+ success: function (res) {
|
|
|
+ var result = res.resultStr // 当needResult 为 1 时,扫码返回的结果
|
|
|
+ alert(result)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
onsubmit () {
|
|
|
|
|
|
}
|