|
|
@ -436,6 +436,7 @@ |
|
|
submit() { |
|
|
submit() { |
|
|
let that = this; |
|
|
let that = this; |
|
|
this.syncLunchBoxByMoreBuy() |
|
|
this.syncLunchBoxByMoreBuy() |
|
|
|
|
|
this.normalizeGroupBuyPrices() |
|
|
if (!this.validateProductSpecs()) { |
|
|
if (!this.validateProductSpecs()) { |
|
|
return |
|
|
return |
|
|
} |
|
|
} |
|
|
@ -531,6 +532,17 @@ |
|
|
} |
|
|
} |
|
|
return true |
|
|
return true |
|
|
}, |
|
|
}, |
|
|
|
|
|
normalizeGroupBuyPrices() { |
|
|
|
|
|
if (!Array.isArray(this.formData.productGroupBuyPrices)) { |
|
|
|
|
|
this.formData.productGroupBuyPrices = [] |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
this.formData.productGroupBuyPrices = this.formData.productGroupBuyPrices.filter((item) => { |
|
|
|
|
|
const groupCount = item && item.groupCount !== undefined && item.groupCount !== null ? String(item.groupCount).trim() : '' |
|
|
|
|
|
const groupPrice = item && item.groupPrice !== undefined && item.groupPrice !== null ? String(item.groupPrice).trim() : '' |
|
|
|
|
|
return groupCount !== '' || groupPrice !== '' |
|
|
|
|
|
}) |
|
|
|
|
|
}, |
|
|
isValidPrice(value) { |
|
|
isValidPrice(value) { |
|
|
return /^\d+(\.\d{1,2})?$/.test(value) && Number(value) > 0 |
|
|
return /^\d+(\.\d{1,2})?$/.test(value) && Number(value) > 0 |
|
|
}, |
|
|
}, |
|
|
|