|
@@ -803,17 +803,17 @@ export default {
|
|
|
//保存某一行
|
|
|
async checkRow(rowIndex) {
|
|
|
const { sale_price ,new_sale_price , cost_fee , new_cost_fee } = this.addrForm.good_ladder[rowIndex] || {}
|
|
|
- const _salePrice = Number(sale_price)
|
|
|
- const _systemSalePrice = Number(new_sale_price)
|
|
|
- const _costFee = Number(cost_fee)
|
|
|
- const _systemCostFee = Number(new_cost_fee)
|
|
|
+ const _salePrice = Number(sale_price) || 0
|
|
|
+ const _systemSalePrice = Number(new_sale_price) || 0
|
|
|
+ const _costFee = Number(cost_fee) || 0
|
|
|
+ const _systemCostFee = Number(new_cost_fee) || 0
|
|
|
|
|
|
- if(_salePrice && _salePrice < _systemSalePrice){
|
|
|
+ if(_systemSalePrice && (_salePrice < _systemSalePrice)){
|
|
|
this.$message.warning('售价不能小于系统售价!')
|
|
|
return
|
|
|
}
|
|
|
|
|
|
- if(_costFee && _costFee < _systemCostFee) {
|
|
|
+ if(_systemCostFee && (_costFee < _systemCostFee)) {
|
|
|
this.$message.warning('工艺费不能小于系统工艺费!')
|
|
|
return
|
|
|
}
|
|
@@ -955,28 +955,50 @@ export default {
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
+ set_ladder_item(i, price, new_cost_fee) {
|
|
|
+ this.addrForm.good_ladder[i].new_sale_price = price;
|
|
|
+ // this.addrForm.good_ladder[i].sale_price = price;
|
|
|
+ this.addrForm.good_ladder[i].new_cost_fee = new_cost_fee;
|
|
|
+ this.addrForm.good_ladder[i].cost_fee = new_cost_fee;
|
|
|
+ this.addrForm.good_ladder[i].newTime = new Date().valueOf() + Math.random();
|
|
|
+ this.$set(this.addrForm.good_ladder, i, this.addrForm.good_ladder[i]);
|
|
|
+ },
|
|
|
async submitForm() {
|
|
|
+
|
|
|
await this.$refs.ruleForm.validate(async (valid) => {
|
|
|
if (valid) {
|
|
|
if (!this.loading) {
|
|
|
let model = JSON.parse(JSON.stringify(this.ruleForm));
|
|
|
const { state } = model;
|
|
|
- if (state + "" === "1") {
|
|
|
- this.loading = true;
|
|
|
- if (this.addrForm.good_ladder.length === 0) {
|
|
|
- this.$message.warning("至少存在一条销售价信息!");
|
|
|
- this.loading = false;
|
|
|
- return;
|
|
|
+ this.loading = true;
|
|
|
+ if (this.addrForm.good_ladder.length === 0) {
|
|
|
+ this.$message.warning("至少存在一条销售价信息!");
|
|
|
+ this.loading = false;
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ let list = JSON.parse(JSON.stringify(this.addrForm.good_ladder));
|
|
|
+
|
|
|
+ for(let index = 0; index< list.length;index ++){
|
|
|
+ const item = list[index]
|
|
|
+ if(item.edit){
|
|
|
+ this.$message.warning(`请保存第 ${index + 1} 行的阶梯售价信息`)
|
|
|
+ this.loading = false
|
|
|
+ return
|
|
|
}
|
|
|
- let list = JSON.parse(JSON.stringify(this.addrForm.good_ladder));
|
|
|
+ }
|
|
|
+
|
|
|
+ if (state + "" === "1") {
|
|
|
let all_is_ok = true;
|
|
|
let isok = true;
|
|
|
- for (let i = 0; i < this.addrForm.good_ladder; i++) {
|
|
|
+
|
|
|
+ for (let i = 0; i < this.addrForm.good_ladder.length; i++) {
|
|
|
this.addrForm.good_ladder[i].search_loading = true;
|
|
|
const { market_platform } = this.addrForm.good_ladder[i];
|
|
|
+
|
|
|
if (market_platform == "") {
|
|
|
isok = false;
|
|
|
}
|
|
|
+
|
|
|
let { isok, price, new_cost_fee } = await this.get_new(i);
|
|
|
if (isok === 0) {
|
|
|
this.set_ladder_item(i, price, new_cost_fee);
|
|
@@ -987,6 +1009,27 @@ export default {
|
|
|
this.set_ladder_item(i, price, new_cost_fee);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ for (let index = 0; index < this.addrForm.good_ladder.length; index++){
|
|
|
+ const { sale_price ,new_sale_price , cost_fee , new_cost_fee } = this.addrForm.good_ladder[index] || {}
|
|
|
+ const _salePrice = Number(sale_price)
|
|
|
+ const _systemSalePrice = Number(new_sale_price)
|
|
|
+ const _costFee = Number(cost_fee)
|
|
|
+ const _systemCostFee = Number(new_cost_fee)
|
|
|
+
|
|
|
+ if(_systemSalePrice &&( _salePrice < _systemSalePrice)){
|
|
|
+ this.$message.warning(`第 ${index + 1} 行的售价不能小于系统售价!`)
|
|
|
+ this.loading = false
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ if(_systemCostFee && (_costFee < _systemCostFee)) {
|
|
|
+ this.$message.warning('第 ${index + 1} 行的售价不能工艺费不能小于系统工艺费!')
|
|
|
+ this.loading = false
|
|
|
+ return
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
if (!isok) {
|
|
|
this.$message.warning("比价平台不能为空!");
|
|
|
this.loading = false;
|