Commit d53f01dc by 张立顺

fix bug

1 parent d8a8c63d
...@@ -363,20 +363,28 @@ Component({ ...@@ -363,20 +363,28 @@ Component({
if (currentType == 1) { if (currentType == 1) {
// 折扣比例 // 折扣比例
// 2:是折扣比例的话,最多只能输入1位整数和1个小数 // 2:是折扣比例的话,最多只能输入1位整数和1个小数
const dotIndex = value.indexOf('.') // 允许输入 10 (无折扣)
if (dotIndex !== -1) { if (value === '10') {
let integerPart = value.substring(0, dotIndex) // Allow '10'
let decimalPart = value.substring(dotIndex + 1) } else if (value.startsWith('10') && value !== '10') {
if (integerPart.length > 1) { // If starts with 10 but has more chars (e.g. 10.1), restrict to 10
integerPart = integerPart.slice(0, 1) value = '10'
}
if (decimalPart.length > 1) {
decimalPart = decimalPart.slice(0, 1)
}
value = integerPart + '.' + decimalPart
} else { } else {
if (value.length > 1) { const dotIndex = value.indexOf('.')
value = value.slice(0, 1) if (dotIndex !== -1) {
let integerPart = value.substring(0, dotIndex)
let decimalPart = value.substring(dotIndex + 1)
if (integerPart.length > 1) {
integerPart = integerPart.slice(0, 1)
}
if (decimalPart.length > 1) {
decimalPart = decimalPart.slice(0, 1)
}
value = integerPart + '.' + decimalPart
} else {
if (value.length > 1) {
value = value.slice(0, 1)
}
} }
} }
} else if (currentType == 2) { } else if (currentType == 2) {
......
...@@ -937,7 +937,12 @@ Page({ ...@@ -937,7 +937,12 @@ Page({
tableInfo.vdQuotationGoodsList = tableInfo.vdQuotationGoodsList.map( tableInfo.vdQuotationGoodsList = tableInfo.vdQuotationGoodsList.map(
item => { item => {
item.price = this.multipliedByHundred(item.goodsPrice) // 套餐商品单位是元,需要转分;其他商品(普通/多规格)单位是分,直接使用
if (item.packageName) {
item.price = this.multipliedByHundred(item.goodsPrice)
} else {
item.price = item.goodsPrice
}
return item return item
} }
) )
...@@ -952,8 +957,8 @@ Page({ ...@@ -952,8 +957,8 @@ Page({
basePrice: undefined, basePrice: undefined,
upgradeGoodsId: item.goodsId, upgradeGoodsId: item.goodsId,
merchantGoodsId: item.goodsId, merchantGoodsId: item.goodsId,
price: item.goodsPrice, price: item.price,
goodsPrice: item.goodsPrice, goodsPrice: item.price,
finalPrice: item.finalPrice, finalPrice: item.finalPrice,
minSellPrice: quotationGoodsList?.find( minSellPrice: quotationGoodsList?.find(
val => val?.goods?.merchantGoodsId == item.goodsId val => val?.goods?.merchantGoodsId == item.goodsId
...@@ -975,8 +980,8 @@ Page({ ...@@ -975,8 +980,8 @@ Page({
basePrice: undefined, basePrice: undefined,
upgradeGoodsId: item.goodsId, upgradeGoodsId: item.goodsId,
upgradeGoodsId: item.goodsId, upgradeGoodsId: item.goodsId,
price: item.goodsPrice, price: item.price,
goodsPrice: item.goodsPrice, goodsPrice: item.price,
finalPrice: item.finalPrice, finalPrice: item.finalPrice,
minSellPrice: quotationGoodsList minSellPrice: quotationGoodsList
?.find( ?.find(
...@@ -1010,10 +1015,10 @@ Page({ ...@@ -1010,10 +1015,10 @@ Page({
pre.push({ pre.push({
goods: null, goods: null,
goodsFlag: 3, goodsFlag: 3,
price: item.goodsPrice, price: item.price,
packageGoods: { packageGoods: {
...item, ...item,
goodsPrice: item.goodsPrice, goodsPrice: item.price,
finalPrice: item.finalPrice, finalPrice: item.finalPrice,
packageCode: item.packageId, packageCode: item.packageId,
goodsList: [ goodsList: [
...@@ -1085,8 +1090,8 @@ Page({ ...@@ -1085,8 +1090,8 @@ Page({
goods: temp, goods: temp,
baseGoodsName: item.goodsName baseGoodsName: item.goodsName
} }
temp.price = item.goodsPrice temp.price = item.price
temp.goodsPrice = item.goodsPrice temp.goodsPrice = item.price
temp.finalPrice = item.finalPrice temp.finalPrice = item.finalPrice
temp.basePrice = undefined temp.basePrice = undefined
temp.goodsId = item.goodsId temp.goodsId = item.goodsId
......
...@@ -143,7 +143,7 @@ ProductStrategy.prototype.applyDiscount = function () { ...@@ -143,7 +143,7 @@ ProductStrategy.prototype.applyDiscount = function () {
finalPrice = Math.round(finalPrice) finalPrice = Math.round(finalPrice)
} }
} else if (type == DISCOUNT_TYPE.AMOUNT && value) { } else if (type == DISCOUNT_TYPE.AMOUNT && value) {
finalPrice = NP.minus(basePrice, value) finalPrice = NP.minus(basePrice, NP.times(value, 100))
finalPrice = Math.round(finalPrice) finalPrice = Math.round(finalPrice)
if (finalPrice < 0) finalPrice = 0 if (finalPrice < 0) finalPrice = 0
} else if (type == DISCOUNT_TYPE.GIFT) { } else if (type == DISCOUNT_TYPE.GIFT) {
...@@ -376,7 +376,7 @@ PackageProductStrategy.prototype.applySubItemDiscount = function (subItem) { ...@@ -376,7 +376,7 @@ PackageProductStrategy.prototype.applySubItemDiscount = function (subItem) {
finalPrice = Math.round(finalPrice) finalPrice = Math.round(finalPrice)
} }
} else if (type == DISCOUNT_TYPE.AMOUNT && value) { } else if (type == DISCOUNT_TYPE.AMOUNT && value) {
finalPrice = NP.minus(basePrice, value) finalPrice = NP.minus(basePrice, NP.times(value, 100))
finalPrice = Math.round(finalPrice) finalPrice = Math.round(finalPrice)
if (finalPrice < 0) finalPrice = 0 if (finalPrice < 0) finalPrice = 0
} else if (type == DISCOUNT_TYPE.GIFT) { } else if (type == DISCOUNT_TYPE.GIFT) {
......
...@@ -267,20 +267,28 @@ Page({ ...@@ -267,20 +267,28 @@ Page({
if (currentType == 1) { if (currentType == 1) {
// 折扣比例 // 折扣比例
// 2:是折扣比例的话,最多只能输入1位整数和1个小数 // 2:是折扣比例的话,最多只能输入1位整数和1个小数
const dotIndex = value.indexOf('.') // 允许输入 10 (无折扣)
if (dotIndex !== -1) { if (value === '10') {
let integerPart = value.substring(0, dotIndex) // Allow '10'
let decimalPart = value.substring(dotIndex + 1) } else if (value.startsWith('10') && value !== '10') {
if (integerPart.length > 1) { // If starts with 10 but has more chars (e.g. 10.1), restrict to 10
integerPart = integerPart.slice(0, 1) value = '10'
}
if (decimalPart.length > 1) {
decimalPart = decimalPart.slice(0, 1)
}
value = integerPart + '.' + decimalPart
} else { } else {
if (value.length > 1) { const dotIndex = value.indexOf('.')
value = value.slice(0, 1) if (dotIndex !== -1) {
let integerPart = value.substring(0, dotIndex)
let decimalPart = value.substring(dotIndex + 1)
if (integerPart.length > 1) {
integerPart = integerPart.slice(0, 1)
}
if (decimalPart.length > 1) {
decimalPart = decimalPart.slice(0, 1)
}
value = integerPart + '.' + decimalPart
} else {
if (value.length > 1) {
value = value.slice(0, 1)
}
} }
} }
} else if (currentType == 2) { } else if (currentType == 2) {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!