|
|
@@ -25,7 +25,9 @@ export default {
|
|
|
customData: { bigCount: 0, smallCount: 0, userPrice: 0 },
|
|
|
globalItemList:[],
|
|
|
//当前页面默认使用的单位 0大单位 1小单位
|
|
|
- globalUnitType:0
|
|
|
+ globalUnitType:0,
|
|
|
+ globalAllProduct:[],
|
|
|
+ calc:'add'
|
|
|
};
|
|
|
},
|
|
|
onLoad(options) {
|
|
|
@@ -360,7 +362,7 @@ export default {
|
|
|
//添加删除和修改花材
|
|
|
//multiple 0一个一个加减 1弹框方式,多个加减
|
|
|
//calc 当multiple=0时,add表示加,sub表示减
|
|
|
- replaceItemFn(product,multiple=0,calc='add') {
|
|
|
+ replaceItemFn(product,multiple=0,calc='add',scan=0) {
|
|
|
let item = copyObject(product)
|
|
|
if(multiple == 0){
|
|
|
if(Number(item.smallCount)>0){
|
|
|
@@ -379,7 +381,22 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
const list = this.selectList
|
|
|
+
|
|
|
+ let index = list.findIndex(element => element.id == item.id)
|
|
|
+
|
|
|
+ //扫码数量累加
|
|
|
+ if(index != -1 && scan == 1){
|
|
|
+ item.bigCount = parseInt(Number(item.bigCount)+Number(list[index].bigCount))
|
|
|
+ item.smallCount = parseInt(Number(item.smallCount)+Number(list[index].smallCount))
|
|
|
+ }
|
|
|
+
|
|
|
+ //扫码会出现负数
|
|
|
+ if(Number(item.bigCount)<0 || Number(item.smallCount)<0){
|
|
|
+ return false
|
|
|
+ }
|
|
|
+
|
|
|
if(this.checkStock){
|
|
|
if ((Number(item.bigCount) * item.ratio + Number(item.smallCount)) > (Number(item.bigNum) * item.ratio + Number(item.smallNum))) {
|
|
|
this.$util.noStockRemind()
|
|
|
@@ -387,7 +404,7 @@ export default {
|
|
|
return
|
|
|
}
|
|
|
}
|
|
|
- let index = list.findIndex(element => element.id == item.id)
|
|
|
+
|
|
|
if(index == -1){
|
|
|
if(this.$util.isEmpty(item.userPrice) || Number(item.userPrice) == 0){
|
|
|
item.userPrice = item.bigPrice
|
|
|
@@ -414,6 +431,31 @@ export default {
|
|
|
this.itemNumPriceRefresh()
|
|
|
|
|
|
|
|
|
+ },
|
|
|
+ takeItem(code){
|
|
|
+ if(this.$util.isEmpty(code)){
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ let current = null
|
|
|
+ let unitPrice = 0
|
|
|
+ let unitName = ''
|
|
|
+ //花材
|
|
|
+ current = this.globalAllProduct.find(function(val){
|
|
|
+ return Number(val.itemId) == Number(code)
|
|
|
+ })
|
|
|
+ if(current == undefined){
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ if(this.$util.isEmpty(current)){
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ unitName = current.bigUnit
|
|
|
+ unitPrice = current.bigPrice
|
|
|
+ //this.$util.hitVoice()
|
|
|
+ let num = this.calc == 'add' ? 1 : -1
|
|
|
+ let params = {...current,unitName:unitName,userPrice:unitPrice,bigCount:num}
|
|
|
+ console.log(params)
|
|
|
+ this.replaceItemFn(params,1,'add',1)
|
|
|
},
|
|
|
//大小单位切换
|
|
|
switchGlobalUnitType(){
|