更新扫码入库功能,修复bug

This commit is contained in:
weipengfei 2023-11-04 16:55:55 +08:00
parent e53c0fffcc
commit 36b31d2852
4 changed files with 47 additions and 23 deletions

View File

@ -47,7 +47,7 @@
</view>
<view class="pos-order-goods" v-for="(val, key) in item.refundProduct" :key="key"
@click="toRefundDetail(item)">
<view class="goods acea-row row-between-wrapper">
<view v-if="val.product" class="goods acea-row row-between-wrapper">
<view class="picTxt acea-row row-between-wrapper">
<view class="pictrue">
<image :src="val.product.cart_info.product.image" />

View File

@ -13,7 +13,7 @@
<text>{{merchant_Data.unpaid_margin}}</text>
</view>
<view class="item">
<text>缴纳店铺账户</text>
<text>缴纳押金账户</text>
<text>{{merchant_Data.mer_name}}</text>
</view>
</view>

View File

@ -158,7 +158,7 @@
</view>
<view class="search_goods_btn">
<view class="cancel edit_btn" @click="addGoodsclose()">取消</view>
<view class="search edit_btn" @click="addGoodsopen()">确定</view>
<view class="search edit_btn" @click="$u.throttle(addGoodsopen, 1500)">确定</view>
</view>
</view>
</u-popup>
@ -171,7 +171,7 @@
</view>
</view>
</u-popup>
<u-modal :show="showModel" title="提示" content="没有找到该商品,是否添加?"></u-modal>
<u-modal :show="showModel" title="提示" content="没有找到该商品,是否手动添加?" show-cancel-button @cancel="showModel = false" @confirm="navToAdd"></u-modal>
</view>
</template>
@ -238,6 +238,7 @@
searchGoodsShow: false,
searchGoodsName: '',
showModel: false,
showModelCode: '',
goods: [
// {
// "id": 35,
@ -567,15 +568,27 @@
},
})
},
isStartsWith6Or06(str) {
const regex = /^(6|06)/;
return regex.test(str);
},
async seachBarCode(code) {
if(code.length<12){
return Toast('条形码长度不正确, 请重试!')
}
this.showModelCode = code;
console.log('扫码的值', code);
if(!this.isStartsWith6Or06(code)) {
Toast('暂不支持进口商品!');
this.$u.sleep(1200).then(()=>{
this.showModel = true;
})
return ;
}
uni.showLoading({
title: '加载中',
mask: true
})
console.log('扫码的值', code);
await seachBarCodeAPI({
code: code,
mer_id: this.mer_id
@ -590,9 +603,7 @@
});
} else {
if (res.data.list.length < 1) {
uni.navigateTo({
url: `/pages/product/addGoods/index?mer_id=${this.mer_id}&code=${code}`
})
this.showModel = true;
return
}
this.goods = JSON.parse(JSON.stringify(res.data.list));
@ -603,7 +614,10 @@
}
}).catch((err) => {
console.log('错误', err);
Toast('加载出错')
Toast(err);
this.$u.sleep(1200).then(()=>{
this.showModel = true;
})
})
},
@ -620,6 +634,17 @@
console.log(res.tempFilePaths[0]);
}
})
},
navToAdd(){
let url;
if(this.showModelCode) url = `/pages/product/addGoods/index?mer_id=${this.mer_id}&code=${this.showModelCode}`;
else url = `/pages/product/addGoods/index?mer_id=${this.mer_id}`;
uni.navigateTo({
url:url,
success:()=> {
this.showModel = false;
}
})
}
},
onPullDownRefresh() {

View File

@ -21,7 +21,7 @@
</image>
<text class="text">在售商品</text>
</navigator>
<navigator class="item"
<!-- <navigator class="item"
:url="`/pages/product/goodsOnSale/index?mer_id=${mer_id}&type=3`"
hover-class='none'>
<image mode='widthFix' class="image" src="../static/images/product_out.png">
@ -34,7 +34,7 @@
<image mode='widthFix' class="image" src="../static/images/product_recycle.png">
</image>
<text class="text">回收站</text>
</navigator>
</navigator> -->
<navigator class="item"
:url="`/pages/product/storeClassification/index?mer_id=${mer_id}`"
hover-class='none'>
@ -42,11 +42,6 @@
</image>
<text class="text">店铺分类</text>
</navigator>
</view>
</swiper-item>
<swiper-item :class="{ active: 1 == swiperCur }">
<view class="slide-navigator">
<!-- 隐藏暂时不需要 -->
<navigator class="item"
:url="`/pages/product/addGoods/freightTemplate?mer_id=${mer_id}`"
hover-class='none'>
@ -54,13 +49,6 @@
</image>
<text class="text">运费模板</text>
</navigator>
<navigator class="item"
:url="`/pages/product/addGoods/mulSpecification?mer_id=${mer_id}`"
hover-class='none'>
<image mode='widthFix' class="image"
src="../static/images/product_specification.png"></image>
<text class="text">规格模板</text>
</navigator>
<navigator class="item"
:url="`/pages/users/online_warehousing/index?mer_id=${mer_id}&product_id=${data.product_id}&unique=${data.unique}&type=${mer_info.type_code}`"
hover-class='none'>
@ -69,6 +57,17 @@
</navigator>
</view>
</swiper-item>
<!-- <swiper-item :class="{ active: 1 == swiperCur }">
<view class="slide-navigator">
<navigator class="item"
:url="`/pages/product/addGoods/mulSpecification?mer_id=${mer_id}`"
hover-class='none'>
<image mode='widthFix' class="image"
src="../static/images/product_specification.png"></image>
<text class="text">规格模板</text>
</navigator>
</view>
</swiper-item> -->
</block>
</swiper>
</div>