|
@@ -4,7 +4,11 @@
|
|
|
<view class="info-body">
|
|
|
<view class="info" v-if="productInfo">
|
|
|
<view>
|
|
|
- <view class="shelfPlaceCode">{{shelfPlaceCode}}</view>
|
|
|
+ <view class="shelfPlaceCode">
|
|
|
+ <text v-if="productInfo.shelfCartApi">{{productInfo.shelfCartApi.shelfPlaceCode}}</text>
|
|
|
+ <text v-else-if="productInfo.shelfProductApi">{{productInfo.shelfProductApi.shelfPlaceCode}}</text>
|
|
|
+ <text v-else>{{shelfPlaceCode}}</text>
|
|
|
+ </view>
|
|
|
<view class="flex flex_1 align_center">
|
|
|
<view class="pimgs">
|
|
|
<u-image :src="productInfo.images?productInfo.images:`../../static/${$config('themePath')}/def_img@2x.png`" width="128" height="128" border-radius="10"></u-image>
|
|
@@ -13,7 +17,10 @@
|
|
|
<view class="ptxt flex align_center justify_between">
|
|
|
<view>{{productInfo.code}}</view>
|
|
|
<view class="pcode">
|
|
|
- 可用库存:<text>{{productInfo.shelfCartApi?productInfo.shelfCartApi.qty:0}} </text> {{productInfo.unit}}
|
|
|
+ 可用库存:
|
|
|
+ <text v-if="productInfo.shelfCartApi">{{productInfo.shelfCartApi.qty}}</text>
|
|
|
+ <text v-else-if="productInfo.shelfProductApi">{{productInfo.shelfProductApi.qty}}</text>
|
|
|
+ {{productInfo.unit}}
|
|
|
</view>
|
|
|
</view>
|
|
|
<view class="pname">
|
|
@@ -23,12 +30,14 @@
|
|
|
</view>
|
|
|
</view>
|
|
|
<view class="product-nums">
|
|
|
- <view>本次上架数量</view>
|
|
|
+ <view>本次上架数量<text>(左右滑动选择)</text></view>
|
|
|
<view class="numsBox flex align_center justify_between">
|
|
|
<view class="a-left" @click="numsBoxScroll(0)"><u-icon name="arrow-left"></u-icon></view>
|
|
|
<scroll-view class="scroll-nums" scroll-x="true" :scroll-left="scleft">
|
|
|
<view class="ntabs-box flex align_center">
|
|
|
- <view class="ntabs" @click="saveData(item)" :class="curQty==item?'active':''" v-for="item in 100" :key="item">{{item}}</view>
|
|
|
+ <view :id="'nums'+item" class="ntabs" @click="saveData(item)" :class="curQty==item?'active':''" v-for="item in 99" :key="item">
|
|
|
+ {{item<10?(' '+item+' '):item}}
|
|
|
+ </view>
|
|
|
</view>
|
|
|
</scroll-view>
|
|
|
<view class="a-right" @click="numsBoxScroll(1)"><u-icon name="arrow-right"></u-icon></view>
|
|
@@ -71,7 +80,8 @@
|
|
|
curQty: '',
|
|
|
scleft: 0,
|
|
|
fromPage: null,
|
|
|
- qrCode: ''
|
|
|
+ qrCode: '',
|
|
|
+ numsWidth: 52
|
|
|
}
|
|
|
},
|
|
|
onReady() {
|
|
@@ -112,7 +122,7 @@
|
|
|
},
|
|
|
methods: {
|
|
|
numsBoxScroll(type){
|
|
|
- this.scleft = type ? (this.scleft+150) : (this.scleft-150)
|
|
|
+ this.scleft = type ? (this.scleft+this.numsWidth*3) : (this.scleft-this.numsWidth*3)
|
|
|
},
|
|
|
searchProduct(){
|
|
|
uni.redirectTo({
|
|
@@ -137,15 +147,18 @@
|
|
|
const ret = res.data.productList[0]
|
|
|
this.productInfo = ret
|
|
|
this.shelfPlaceCode = res.data.shelfPlaceCode
|
|
|
+ // 数量区域宽度
|
|
|
+ const query = uni.createSelectorQuery().in(_this);
|
|
|
+ query.select('#nums1').boundingClientRect(data => {
|
|
|
+ _this.numsWidth = data ? (data.width + 20) : 52
|
|
|
+ }).exec()
|
|
|
// 已录入
|
|
|
if(ret.shelfCartApi){
|
|
|
this.curQty = ret.shelfCartApi.qty
|
|
|
- this.scleft = this.curQty * 30
|
|
|
- this.shelfCartSn = ret.shelfCartApi.shelfCartSn
|
|
|
+ _this.scleft = (_this.curQty -1) * _this.numsWidth
|
|
|
}else{
|
|
|
this.curQty = ''
|
|
|
this.scleft = 0
|
|
|
- this.shelfCartSn =''
|
|
|
}
|
|
|
setTimeout(()=>{
|
|
|
this.barcode.start()
|
|
@@ -161,19 +174,20 @@
|
|
|
uni.showLoading({
|
|
|
title: '正在保存...'
|
|
|
})
|
|
|
- const a = this.productInfo.shelfCartApi || this.productInfo.shelfProductApi
|
|
|
+ const row = this.productInfo
|
|
|
+ const item = row.shelfCartApi || row.shelfProductApi
|
|
|
const params = {
|
|
|
shelfSn: this.shelfSn,
|
|
|
shelfName: this.shelfName,
|
|
|
- shelfTierCode: a ? a.shelfTierCode : this.layer,
|
|
|
- shelfPlaceSn: a ? a.shelfPlaceSn : undefined,
|
|
|
- shelfPlaceCode: a?a.shelfPlaceCode:this.shelfPlaceCode,
|
|
|
- productSn: this.productInfo.productSn,
|
|
|
- productCode: this.productInfo.code,
|
|
|
+ shelfTierCode: item?item.shelfTierCode:this.layer,
|
|
|
+ shelfPlaceSn: item?item.shelfPlaceSn:undefined,
|
|
|
+ shelfPlaceCode: item?item.shelfPlaceCode:this.shelfPlaceCode,
|
|
|
+ productSn: row.productSn,
|
|
|
+ productCode: row.code,
|
|
|
qty: nums,
|
|
|
- price: this.productInfo.price,
|
|
|
- cost: this.productInfo.terminalPrice,
|
|
|
- shelfCartSn: this.shelfCartSn
|
|
|
+ price: row.price,
|
|
|
+ cost: row.terminalPrice,
|
|
|
+ shelfCartSn: item?item.shelfCartSn:undefined
|
|
|
}
|
|
|
console.log(params)
|
|
|
shelfCartSave(params).then(res => {
|
|
@@ -181,7 +195,6 @@
|
|
|
if(res.status == 200){
|
|
|
this.toashMsg('保存成功,继续扫描')
|
|
|
this.curQty = nums
|
|
|
- this.shelfCartSn = res.data.shelfCartSn
|
|
|
this.scanResult()
|
|
|
}
|
|
|
setTimeout(()=>{
|
|
@@ -297,11 +310,14 @@
|
|
|
text-align: center;
|
|
|
color: #999;
|
|
|
margin-top: 20rpx;
|
|
|
+ text{
|
|
|
+ font-size: 24rpx;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
.numsBox{
|
|
|
.scroll-nums{
|
|
|
- width: 85%;
|
|
|
+ width: 80%;
|
|
|
padding: 10rpx 0;
|
|
|
.ntabs-box{
|
|
|
margin: 10rpx 0;
|
|
@@ -312,8 +328,7 @@
|
|
|
box-shadow: 2rpx 4rpx 6rpx #eee;
|
|
|
border-radius: 15rpx;
|
|
|
padding: 10rpx 15rpx;
|
|
|
- margin: 10rpx 2%;
|
|
|
- width: 100rpx;
|
|
|
+ margin: 10rpx 20rpx;
|
|
|
}
|
|
|
.active{
|
|
|
border-color: crimson;
|