|
|
@@ -11,7 +11,6 @@ export default {
|
|
|
py: "", //拼音搜索条件
|
|
|
type: "", //库存预警时,固定为waring,其他情况不传或者传空
|
|
|
autoLoad: true, //自动获取商品信息
|
|
|
- isLimit: true, //选择数量不能大于库存限制
|
|
|
allFilterProductInfo:'',
|
|
|
filterProductInfo:'',
|
|
|
top_list:'',
|
|
|
@@ -117,14 +116,14 @@ export default {
|
|
|
//修改花材
|
|
|
if(this.option.modifyProductKey){
|
|
|
if(uni.getStorageSync('selectList'+this.option.modifyProductKey)){
|
|
|
- //this.setSelectInfoByType({ type: this.pageType, info: uni.getStorageSync('selectList'+this.option.modifyProductKey) })
|
|
|
- //uni.removeStorageSync('selectList'+this.option.modifyProductKey)
|
|
|
+ //由于价格会变化,所以在initData()重新载入已经选择的花材
|
|
|
}
|
|
|
}else if(this.pageType == 'bill' && !this.$util.isEmpty(this.option.customId)){
|
|
|
if(uni.getStorageSync('selectList'+this.pageType+'_custom_'+this.option.customId)){
|
|
|
- //this.setSelectInfoByType({ type: this.pageType, info: uni.getStorageSync('selectList'+this.pageType+'_custom_'+this.option.customId) })
|
|
|
+ //由于价格会变化,所以在initData()重新载入已经选择的花材
|
|
|
}
|
|
|
}else{
|
|
|
+ //盘点和报损等不需要考虑价格
|
|
|
if(uni.getStorageSync('selectList'+this.pageType)){
|
|
|
this.setSelectInfoByType({ type: this.pageType, info: uni.getStorageSync('selectList'+this.pageType) })
|
|
|
}
|
|
|
@@ -198,19 +197,13 @@ export default {
|
|
|
if(uni.getStorageSync('selectList'+this.option.modifyProductKey)){
|
|
|
let currentInfo = uni.getStorageSync('selectList'+this.option.modifyProductKey)
|
|
|
if(!this.$util.isEmpty(currentInfo)){
|
|
|
-
|
|
|
currentInfo.forEach((currentItem,currentIndex,currentArray)=>{
|
|
|
let currentId = currentItem.id
|
|
|
if(directList[currentId]){
|
|
|
currentArray[currentIndex].bigPrice = directList[currentId].bigPrice
|
|
|
currentArray[currentIndex].smallPrice = directList[currentId].smallPrice
|
|
|
- let bPrice = currentItem.bigCount * Number(directList[currentId].bigPrice)
|
|
|
- let sPrice = currentItem.smallCount * Number(directList[currentId].smallPrice)
|
|
|
- let currentUserPrice = (bPrice+sPrice).toFixed(2)
|
|
|
- //currentArray[currentIndex].userPrice = currentUserPrice
|
|
|
}
|
|
|
})
|
|
|
-
|
|
|
this.setSelectInfoByType({ type: this.pageType, info: currentInfo})
|
|
|
uni.removeStorageSync('selectList'+this.option.modifyProductKey)
|
|
|
}
|
|
|
@@ -224,10 +217,6 @@ export default {
|
|
|
if(directList[currentId]){
|
|
|
currentArray[currentIndex].bigPrice = directList[currentId].bigPrice
|
|
|
currentArray[currentIndex].smallPrice = directList[currentId].smallPrice
|
|
|
- let bPrice = currentItem.bigCount * Number(directList[currentId].bigPrice)
|
|
|
- let sPrice = currentItem.smallCount * Number(directList[currentId].smallPrice)
|
|
|
- let currentUserPrice = (bPrice+sPrice).toFixed(2)
|
|
|
- //currentArray[currentIndex].userPrice = currentUserPrice
|
|
|
}
|
|
|
})
|
|
|
this.setSelectInfoByType({ type: this.pageType, info: currentInfo })
|
|
|
@@ -235,7 +224,6 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
this.classIndex = 0;
|
|
|
this.scroll_into_view = 'class_0';
|
|
|
this.scrollPushList();
|
|
|
@@ -322,26 +310,31 @@ export default {
|
|
|
}
|
|
|
return info;
|
|
|
},
|
|
|
-
|
|
|
- /**
|
|
|
- * 添加花材
|
|
|
- */
|
|
|
+ //添加花材
|
|
|
addEvent(item) {
|
|
|
console.log('新增花材',item)
|
|
|
const list = this.selectList;
|
|
|
let has = false;
|
|
|
+ //这一段代码的意思将重复花材数量合在一起,代码需要优化
|
|
|
for (let index = 0; index < list.length; index++) {
|
|
|
const element = list[index];
|
|
|
if (element.id == item.id && element.classId == item.classId) {
|
|
|
has = true;
|
|
|
if(this.checkStock){
|
|
|
- if(this.isSmallCount){
|
|
|
- list[index] = { ...element, smallCount: ++element.smallCount };
|
|
|
+ console.log(1109988)
|
|
|
+ if (element.bigCount < item.bigNum) {
|
|
|
+ if(this.isSmallCount){
|
|
|
+ list[index] = { ...element, smallCount: ++element.smallCount };
|
|
|
+ }else{
|
|
|
+ list[index] = { ...element, bigCount: ++element.bigCount };
|
|
|
+ }
|
|
|
}else{
|
|
|
- list[index] = { ...element, bigCount: ++element.bigCount };
|
|
|
+ this.$util.noStockRemind()
|
|
|
+ this.$msg("库存不足!");
|
|
|
+ return;
|
|
|
}
|
|
|
}else{
|
|
|
- if (this.isLimit) {
|
|
|
+ if (this.checkStock) {
|
|
|
if (element.bigCount < item.bigNum) {
|
|
|
if(this.isSmallCount){
|
|
|
list[index] = { ...element, smallCount: ++element.smallCount };
|
|
|
@@ -349,9 +342,7 @@ export default {
|
|
|
list[index] = { ...element, bigCount: ++element.bigCount };
|
|
|
}
|
|
|
}else{
|
|
|
-
|
|
|
this.$util.noStockRemind()
|
|
|
-
|
|
|
this.$msg("库存不足!");
|
|
|
return;
|
|
|
}
|
|
|
@@ -362,50 +353,34 @@ export default {
|
|
|
list[index] = { ...element, bigCount: ++element.bigCount };
|
|
|
}
|
|
|
}
|
|
|
- if (this.isLimit) {
|
|
|
+ if (this.checkStock) {
|
|
|
const { bigCount, smallCount } = list[index];
|
|
|
- //超过库存时 设置为库存最大值
|
|
|
const ratio = Number(item.ratio);
|
|
|
if (Number(bigCount) * ratio + Number(smallCount) >Number(item.bigNum) * ratio + Number(item.smallNum)) {
|
|
|
- list[index].bigCount = Number(item.bigNum);
|
|
|
- list[index].smallCount = Number(item.smallNum);
|
|
|
- this.$msg("库存不足。");
|
|
|
+ this.$util.noStockRemind()
|
|
|
+ this.$msg("库存不足!!");
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
+ //没有在selectList添加过的花材直接添加
|
|
|
if (!has) {
|
|
|
- let info = { classId: item.classId, id: item.id };
|
|
|
-
|
|
|
+ let info = {}
|
|
|
if(this.kdType == 'notPDA'){
|
|
|
-
|
|
|
- const classInfo =
|
|
|
- this.productInfoList &&
|
|
|
- this.productInfoList.find(element => {
|
|
|
- return element.classId == item.classId && element.child;
|
|
|
- });
|
|
|
+ const classInfo = this.productInfoList && this.productInfoList.find(element => { return element.classId == item.classId && element.child })
|
|
|
if (classInfo) {
|
|
|
- info = classInfo.child.find(ele => {
|
|
|
- return ele.id == item.id;
|
|
|
- });
|
|
|
+ info = classInfo.child.find(ele => { return ele.id == item.id });
|
|
|
}
|
|
|
-
|
|
|
}else if(this.kdType == 'PDA'){
|
|
|
info = item
|
|
|
}
|
|
|
-
|
|
|
- let params = {
|
|
|
- ...info,
|
|
|
- bigCount: this.isSmallCount?0:1, //扎数
|
|
|
- smallCount: this.isSmallCount?1:0, //支数
|
|
|
- autoPrice: 0 //调价价格
|
|
|
- };
|
|
|
- if (info.bigNum && info.bigNum > 0) {
|
|
|
+ let params = { ...info, bigCount: 1, smallCount: 0 }
|
|
|
+ if (info.bigNum && info.bigNum >= 1) {
|
|
|
list.push(params);
|
|
|
} else {
|
|
|
- if(this.checkStock){
|
|
|
+ if(this.checkStock == false){
|
|
|
list.push(params);
|
|
|
}else{
|
|
|
this.$msg("库存不足..");
|
|
|
@@ -413,6 +388,7 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
//点加号时增加花材补充userPrice字段 shish 20210728
|
|
|
list.forEach(function(product,index,array){
|
|
|
if(product.id == item.id){
|
|
|
@@ -420,7 +396,7 @@ export default {
|
|
|
array[index].userPrice = Number(product.bigPrice)
|
|
|
}
|
|
|
}
|
|
|
- });
|
|
|
+ })
|
|
|
|
|
|
this.setSelectInfoByType({ type: this.pageType, info: list });
|
|
|
|
|
|
@@ -535,7 +511,7 @@ export default {
|
|
|
const { bigCount, smallCount } = list[index];
|
|
|
//超过库存时 设置为库存最大值
|
|
|
const ratio = Number(item.ratio);
|
|
|
- if (this.isLimit) {
|
|
|
+ if (this.checkStock) {
|
|
|
if (
|
|
|
Number(bigCount) * ratio + Number(smallCount) >
|
|
|
Number(item.bigNum) * ratio + Number(item.smallNum)
|
|
|
@@ -711,4 +687,4 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-}
|
|
|
+}
|