6
0
Fork 0

添加商品扫描共功能

hui.zhou
h30830569 2022-06-07 13:09:58 +08:00
parent 5362a7dd21
commit a732ecffdd
1 changed files with 15 additions and 0 deletions

View File

@ -4,6 +4,7 @@
<view class="mr-15rpx">商品信息</view>
<u-search @search="searchGoods" class="flex-1" placeholder="货号或名称" v-model="keyword" :show-action="false">
</u-search>
<u-icon @tap="onQR" class="ml-20rpx" name="scan" color="#333333" size="48"></u-icon>
</view>
<!-- 有商品时 -->
<block v-if="!isShow">
@ -103,6 +104,20 @@
}
},
methods: {
//
onQR(){
uni.scanCode({
onlyFromCamera: true,
success: ({result})=>{
this.keyword=result
this.searchGoods()
},
fail:err=>{
this.$u.toast('扫码失败,请重新扫描')
}
});
},
async searchGoods() {
const resDate = await this.$api.get(`/v1/store/${this.id}/products`, {
params: {