wangfukang 1 month ago
parent
commit
c3ad5e7a21
  1. 12
      package2/myCenter/addGoods.vue

12
package2/myCenter/addGoods.vue

@ -436,6 +436,7 @@
submit() {
let that = this;
this.syncLunchBoxByMoreBuy()
this.normalizeGroupBuyPrices()
if (!this.validateProductSpecs()) {
return
}
@ -531,6 +532,17 @@
}
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) {
return /^\d+(\.\d{1,2})?$/.test(value) && Number(value) > 0
},

Loading…
Cancel
Save