|
|
@@ -29,7 +29,8 @@ export default {
|
|
|
top_list:'',
|
|
|
timeFun:"",
|
|
|
filterProductInfo:'',
|
|
|
-
|
|
|
+ //当前页面默认使用的单位 0大单位 1小单位
|
|
|
+ globalUnitType:0
|
|
|
};
|
|
|
},
|
|
|
onLoad(options) {
|
|
|
@@ -224,6 +225,18 @@ export default {
|
|
|
}
|
|
|
this.resetSelectInfoByType(this.pageType);
|
|
|
},
|
|
|
+ //大小单位切换
|
|
|
+ switchGlobalUnitType(){
|
|
|
+ if(this.globalUnitType == 0){
|
|
|
+ this.globalUnitType = 1
|
|
|
+ this.customData.userPrice = parseFloat(this.customData.smallPrice)
|
|
|
+ this.customData.bigCount = null
|
|
|
+ }else{
|
|
|
+ this.globalUnitType = 0
|
|
|
+ this.customData.userPrice = parseFloat(this.customData.bigPrice)
|
|
|
+ this.customData.smallCount = null
|
|
|
+ }
|
|
|
+ },
|
|
|
//采购时请求供应商花材
|
|
|
async initGhsData(id,shopId) {
|
|
|
//extendInfo调用时的扩展参数,如shopId
|
|
|
@@ -564,6 +577,11 @@ export default {
|
|
|
const element = list[index];
|
|
|
if (element.id == item.id && element.classId == item.classId) {
|
|
|
has = true;
|
|
|
+ if(Number(element.smallCount) > 0){
|
|
|
+ this.isSmallCount = true
|
|
|
+ }else{
|
|
|
+ this.isSmallCount = false
|
|
|
+ }
|
|
|
if(this.offVerifyRepertory){//去除库存验证
|
|
|
if(this.isSmallCount){
|
|
|
list[index] = { ...element, smallCount: ++element.smallCount };
|
|
|
@@ -581,10 +599,7 @@ export default {
|
|
|
const {bigCount, smallCount} = list[index];
|
|
|
//超过库存时 设置为库存最大值
|
|
|
const ratio = Number(item.ratio);
|
|
|
- if (
|
|
|
- Number(bigCount) * ratio + Number(smallCount) >
|
|
|
- Number(item.bigNum) * ratio + Number(item.smallNum)
|
|
|
- ) {
|
|
|
+ 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("库存还剩"+item.bigNum);
|
|
|
@@ -670,13 +685,17 @@ export default {
|
|
|
},
|
|
|
//减去商品
|
|
|
delEvent(item) {
|
|
|
-
|
|
|
const list = copyObject(this.selectList);
|
|
|
let has = false;
|
|
|
for (let index = 0; index < list.length; index++) {
|
|
|
let element = list[index];
|
|
|
if (element.id == item.id && element.classId == item.classId) {
|
|
|
has = true;
|
|
|
+ if(Number(element.smallCount) > 0){
|
|
|
+ this.isSmallCount = true
|
|
|
+ }else{
|
|
|
+ this.isSmallCount = false
|
|
|
+ }
|
|
|
if (element.bigCount > 0) {
|
|
|
if (!this.isSmallCount) {
|
|
|
list[index] = {...element, bigCount: --element.bigCount};
|