添加商品扫描共功能
parent
5362a7dd21
commit
a732ecffdd
|
|
@ -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: {
|
||||
|
|
|
|||
Loading…
Reference in New Issue