|
@@ -73,7 +73,7 @@
|
|
|
}
|
|
|
"
|
|
|
:min="0"
|
|
|
- :max="scope.row.max"
|
|
|
+ :max="scope.row.numberMax"
|
|
|
size="mini"
|
|
|
style="width: 100px"
|
|
|
></el-input-number> </template
|
|
@@ -89,7 +89,7 @@
|
|
|
}
|
|
|
"
|
|
|
:min="0"
|
|
|
- :max="scope.row.max"
|
|
|
+ :max="scope.row.weightMax"
|
|
|
size="mini"
|
|
|
style="width: 100px"
|
|
|
></el-input-number>
|
|
@@ -106,7 +106,7 @@
|
|
|
}
|
|
|
"
|
|
|
:min="0"
|
|
|
- :max="scope.row.max"
|
|
|
+ :max="scope.row.volumeMax"
|
|
|
size="mini"
|
|
|
style="width: 100px"
|
|
|
></el-input-number>
|
|
@@ -273,73 +273,98 @@ export default {
|
|
|
},
|
|
|
//数量改变
|
|
|
changeNumber(index, currentValue, oldValue) {
|
|
|
+ let orderForm = this.orderForm;
|
|
|
+ // const dList = _.cloneDeep(orderForm);
|
|
|
let list = this.splitList;
|
|
|
let count = 0;
|
|
|
+ // console.log(this.number);就是一直是订单的number
|
|
|
+ //拆分列表的总number
|
|
|
for (let item of list) {
|
|
|
count += item.number;
|
|
|
- if (this.orderForm.number === 1) {
|
|
|
- this.$set(item, `max`, item.number);
|
|
|
- } else {
|
|
|
- this.$set(item, `max`, item.number + this.orderForm.number + 1);
|
|
|
- }
|
|
|
}
|
|
|
if (currentValue > oldValue) {
|
|
|
- if (this.orderForm.number > 0) {
|
|
|
- let sum = this.number - count;
|
|
|
- this.$set(this.orderForm, `number`, sum);
|
|
|
+ let sum = this.number - count;
|
|
|
+ this.$set(orderForm, `number`, sum);
|
|
|
+ if (sum === 0) {
|
|
|
+ for (let item of list) {
|
|
|
+ this.$set(item, `numberMax`, item.number);
|
|
|
+ }
|
|
|
}
|
|
|
} else {
|
|
|
- if (this.orderForm.number >= 0) {
|
|
|
- let num = this.number - count;
|
|
|
- this.$set(this.orderForm, `number`, num);
|
|
|
+ let orderNum = this.number - count;
|
|
|
+ this.$set(orderForm, `number`, orderNum);
|
|
|
+ for (let item of list) {
|
|
|
+ this.$set(item, `numberMax`, item.number + orderNum);
|
|
|
}
|
|
|
}
|
|
|
+ // this.$set(this, `orderForm`, dList);
|
|
|
},
|
|
|
//重量改变
|
|
|
changeWeight(index, currentValue, oldValue) {
|
|
|
+ // let list = this.splitList;
|
|
|
+ // let count = 0;
|
|
|
+ // for (let item of list) {
|
|
|
+ // count += item.weight;
|
|
|
+ // if (this.orderForm.weight === 1) {
|
|
|
+ // this.$set(item, `max`, item.weight);
|
|
|
+ // } else {
|
|
|
+ // this.$set(item, `max`, item.weight + this.orderForm.weight + 1);
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // if (currentValue > oldValue) {
|
|
|
+ // if (this.orderForm.weight > 0) {
|
|
|
+ // let sum = this.weight - count;
|
|
|
+ // this.$set(this.orderForm, `weight`, sum);
|
|
|
+ // }
|
|
|
+ // } else {
|
|
|
+ // if (this.orderForm.weight >= 0) {
|
|
|
+ // let num = this.weight - count;
|
|
|
+ // this.$set(this.orderForm, `weight`, num);
|
|
|
+ // }
|
|
|
+ // }
|
|
|
let list = this.splitList;
|
|
|
+ let orderForm = this.orderForm;
|
|
|
let count = 0;
|
|
|
for (let item of list) {
|
|
|
count += item.weight;
|
|
|
- if (this.orderForm.weight === 1) {
|
|
|
- this.$set(item, `max`, item.weight);
|
|
|
- } else {
|
|
|
- this.$set(item, `max`, item.weight + this.orderForm.weight + 1);
|
|
|
- }
|
|
|
}
|
|
|
if (currentValue > oldValue) {
|
|
|
- if (this.orderForm.weight > 0) {
|
|
|
- let sum = this.weight - count;
|
|
|
- this.$set(this.orderForm, `weight`, sum);
|
|
|
+ let sum = this.weight - count;
|
|
|
+ this.$set(this.orderForm, `weight`, sum);
|
|
|
+ if (sum === 0) {
|
|
|
+ for (let item of list) {
|
|
|
+ this.$set(item, `weightMax`, item.weight);
|
|
|
+ }
|
|
|
}
|
|
|
} else {
|
|
|
- if (this.orderForm.weight >= 0) {
|
|
|
- let num = this.weight - count;
|
|
|
- this.$set(this.orderForm, `weight`, num);
|
|
|
+ let orderNum = this.weight - count;
|
|
|
+ this.$set(orderForm, `weight`, orderNum);
|
|
|
+ for (let item of list) {
|
|
|
+ this.$set(item, `weightMax`, item.number + orderNum);
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
//体积改变
|
|
|
changeVolume(index, currentValue, oldValue) {
|
|
|
let list = this.splitList;
|
|
|
+ let orderForm = this.orderForm;
|
|
|
let count = 0;
|
|
|
for (let item of list) {
|
|
|
count += item.volume;
|
|
|
- if (this.orderForm.volume === 1) {
|
|
|
- this.$set(item, `max`, item.volume);
|
|
|
- } else {
|
|
|
- this.$set(item, `max`, item.volume + this.orderForm.volume + 1);
|
|
|
- }
|
|
|
}
|
|
|
if (currentValue > oldValue) {
|
|
|
- if (this.orderForm.volume > 0) {
|
|
|
- let sum = this.volume - count;
|
|
|
- this.$set(this.orderForm, `volume`, sum);
|
|
|
+ let sum = this.volume - count;
|
|
|
+ this.$set(this.orderForm, `volume`, sum);
|
|
|
+ if (sum === 0) {
|
|
|
+ for (let item of list) {
|
|
|
+ this.$set(item, `volumeMax`, item.volume);
|
|
|
+ }
|
|
|
}
|
|
|
} else {
|
|
|
- if (this.orderForm.volume >= 0) {
|
|
|
- let num = this.volume - count;
|
|
|
- this.$set(this.orderForm, `volume`, num);
|
|
|
+ let orderNum = this.volume - count;
|
|
|
+ this.$set(orderForm, `volume`, orderNum);
|
|
|
+ for (let item of list) {
|
|
|
+ this.$set(item, `volumeMax`, item.number + orderNum);
|
|
|
}
|
|
|
}
|
|
|
},
|