Commit d53f01dc by 张立顺

fix bug

1 parent d8a8c63d
...@@ -363,6 +363,13 @@ Component({ ...@@ -363,6 +363,13 @@ Component({
if (currentType == 1) { if (currentType == 1) {
// 折扣比例 // 折扣比例
// 2:是折扣比例的话,最多只能输入1位整数和1个小数 // 2:是折扣比例的话,最多只能输入1位整数和1个小数
// 允许输入 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 {
const dotIndex = value.indexOf('.') const dotIndex = value.indexOf('.')
if (dotIndex !== -1) { if (dotIndex !== -1) {
let integerPart = value.substring(0, dotIndex) let integerPart = value.substring(0, dotIndex)
...@@ -379,6 +386,7 @@ Component({ ...@@ -379,6 +386,7 @@ Component({
value = value.slice(0, 1) value = value.slice(0, 1)
} }
} }
}
} else if (currentType == 2) { } else if (currentType == 2) {
// 折扣金额 // 折扣金额
// 3:是折扣金额的话,最大值不能超过 item.goods.sellPrice 的值,超过取 item.goods.sellPrice,输入最多不超过两个小数 // 3:是折扣金额的话,最大值不能超过 item.goods.sellPrice 的值,超过取 item.goods.sellPrice,输入最多不超过两个小数
......
...@@ -937,7 +937,12 @@ Page({ ...@@ -937,7 +937,12 @@ Page({
tableInfo.vdQuotationGoodsList = tableInfo.vdQuotationGoodsList.map( tableInfo.vdQuotationGoodsList = tableInfo.vdQuotationGoodsList.map(
item => { item => {
// 套餐商品单位是元,需要转分;其他商品(普通/多规格)单位是分,直接使用
if (item.packageName) {
item.price = this.multipliedByHundred(item.goodsPrice) 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,6 +267,13 @@ Page({ ...@@ -267,6 +267,13 @@ Page({
if (currentType == 1) { if (currentType == 1) {
// 折扣比例 // 折扣比例
// 2:是折扣比例的话,最多只能输入1位整数和1个小数 // 2:是折扣比例的话,最多只能输入1位整数和1个小数
// 允许输入 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 {
const dotIndex = value.indexOf('.') const dotIndex = value.indexOf('.')
if (dotIndex !== -1) { if (dotIndex !== -1) {
let integerPart = value.substring(0, dotIndex) let integerPart = value.substring(0, dotIndex)
...@@ -283,6 +290,7 @@ Page({ ...@@ -283,6 +290,7 @@ Page({
value = value.slice(0, 1) value = value.slice(0, 1)
} }
} }
}
} else if (currentType == 2) { } else if (currentType == 2) {
// 折扣金额 // 折扣金额
// 3:是折扣金额的话,最大值不能超过 item.goods.sellPrice 的值,超过取 item.goods.sellPrice,输入最多不超过两个小数 // 3:是折扣金额的话,最大值不能超过 item.goods.sellPrice 的值,超过取 item.goods.sellPrice,输入最多不超过两个小数
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!