Commit d53f01dc by 张立顺

fix bug

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