Commit 03038b9a by 张立顺

feat: relax low-price minimum validation

1 parent e603820c
# 低价单客户档案导入与商品目录过滤设计 # 低价单客户档案导入与商品目录过滤设计
> 2026-08-13 更新:本文的“商品目录过滤”与逐商品最低价规则已被[低价单最低价格校验策略调整设计](./2026-08-13-low-price-minimum-validation-policy-design.md)替代;“客户档案导入”设计仍然有效。
## 目标 ## 目标
在低价单创建页补充两项交互约束:从客户档案选择客户时只导入客户信息,不覆盖当前订单中的商品、套餐、支付和门店上下文;展示可选商品时,只展示已开启最低价格校验的商品,其中套餐必须保证每个子商品都已开启,多规格商品按 SKU 分别过滤。 在低价单创建页补充两项交互约束:从客户档案选择客户时只导入客户信息,不覆盖当前订单中的商品、套餐、支付和门店上下文;展示可选商品时,只展示已开启最低价格校验的商品,其中套餐必须保证每个子商品都已开启,多规格商品按 SKU 分别过滤。
......
...@@ -74,7 +74,6 @@ import { ...@@ -74,7 +74,6 @@ import {
POSITION_BUCKET_DATA_KEYS POSITION_BUCKET_DATA_KEYS
} from './services/selectOrderCatalogClassification' } from './services/selectOrderCatalogClassification'
import { preprocessSelectOrderCatalogItem } from './services/selectOrderCatalogPreprocess' import { preprocessSelectOrderCatalogItem } from './services/selectOrderCatalogPreprocess'
import { filterLowPriceSelectOrderCatalog } from './services/lowPriceCatalogFilter.helpers.js'
import { import {
mergeSubOrderListForEcho, mergeSubOrderListForEcho,
findCatalogSingleGoodsItem, findCatalogSingleGoodsItem,
...@@ -83,8 +82,9 @@ import { ...@@ -83,8 +82,9 @@ import {
} from './services/goodsChooseEcho.helpers.js' } from './services/goodsChooseEcho.helpers.js'
import { isMarketingGoodsPriceLocked } from './services/goodsPriceEdit.helpers.js' import { isMarketingGoodsPriceLocked } from './services/goodsPriceEdit.helpers.js'
import { import {
applyLowPriceGoodsPresentation,
LOW_PRICE_NOT_TRIGGERED_MESSAGE, LOW_PRICE_NOT_TRIGGERED_MESSAGE,
applyLowPriceGoodsValidation validateLowPriceGoodsList
} from './services/lowPriceGoodsValidation.helpers.js' } from './services/lowPriceGoodsValidation.helpers.js'
import { import {
ensureCatalogUpgradePrice, ensureCatalogUpgradePrice,
...@@ -1027,21 +1027,13 @@ Page({ ...@@ -1027,21 +1027,13 @@ Page({
const selectedGoodsList = Array.isArray(e?.detail) const selectedGoodsList = Array.isArray(e?.detail)
? e.detail ? e.detail
: this.data.goodsList : this.data.goodsList
this.applyLowPriceGoodsRules(selectedGoodsList) if (this.isLowPriceOrder()) {
applyLowPriceGoodsPresentation(selectedGoodsList)
}
}, },
isLowPriceOrder() { isLowPriceOrder() {
return Number(this.data.orderObj?.lowPriceFlag) === 1 return Number(this.data.orderObj?.lowPriceFlag) === 1
}, },
applyLowPriceGoodsRules(goodsList = this.data.goodsList, options = {}) {
if (!this.isLowPriceOrder()) {
return { valid: true, invalidGoods: [], entries: [] }
}
const result = applyLowPriceGoodsValidation(goodsList)
if (options.notify && result.entries.length && !result.valid) {
wx.$util.showToast(LOW_PRICE_NOT_TRIGGERED_MESSAGE)
}
return result
},
//修改套餐价格 //修改套餐价格
changeMealPrice(e) { changeMealPrice(e) {
console.log(e) console.log(e)
...@@ -1102,7 +1094,6 @@ Page({ ...@@ -1102,7 +1094,6 @@ Page({
strategy.updateSubItemPrice(gindex, number) strategy.updateSubItemPrice(gindex, number)
this.setGoodsTotal(goodsList) this.setGoodsTotal(goodsList)
this.applyLowPriceGoodsRules(goodsList, { notify: true })
} }
return number return number
}, },
...@@ -1155,7 +1146,6 @@ Page({ ...@@ -1155,7 +1146,6 @@ Page({
strategy.setBasePrice(number) strategy.setBasePrice(number)
} }
this.setGoodsTotal(goodsList) this.setGoodsTotal(goodsList)
this.applyLowPriceGoodsRules(goodsList, { notify: true })
} }
return number return number
}, },
...@@ -1215,7 +1205,6 @@ Page({ ...@@ -1215,7 +1205,6 @@ Page({
if (!strategy) return if (!strategy) return
if (this.isLowPriceOrder()) { if (this.isLowPriceOrder()) {
this.applyLowPriceGoodsRules(goodsList)
this.setGoodsTotal(goodsList) this.setGoodsTotal(goodsList)
return return
} }
...@@ -1265,7 +1254,7 @@ Page({ ...@@ -1265,7 +1254,7 @@ Page({
}, },
setGoodsTotal(goodsList) { setGoodsTotal(goodsList) {
if (this.isLowPriceOrder()) { if (this.isLowPriceOrder()) {
applyLowPriceGoodsValidation(goodsList) applyLowPriceGoodsPresentation(goodsList)
} }
let total = 0 let total = 0
goodsList.forEach(item => { goodsList.forEach(item => {
...@@ -1348,9 +1337,8 @@ Page({ ...@@ -1348,9 +1337,8 @@ Page({
checkGoods(save, subOrderList, priceDisabled, goodsList, orderObj) { checkGoods(save, subOrderList, priceDisabled, goodsList, orderObj) {
if (save) return false if (save) return false
if (Number(orderObj?.lowPriceFlag) === 1) { if (Number(orderObj?.lowPriceFlag) === 1) {
const lowPriceValidation = applyLowPriceGoodsValidation(goodsList) const lowPriceValidation = validateLowPriceGoodsList(goodsList)
if (!lowPriceValidation.valid) { if (!lowPriceValidation.valid) {
this.setData({ goodsList })
return LOW_PRICE_NOT_TRIGGERED_MESSAGE return LOW_PRICE_NOT_TRIGGERED_MESSAGE
} }
} }
...@@ -1580,7 +1568,7 @@ Page({ ...@@ -1580,7 +1568,7 @@ Page({
} }
} }
if (errTargetNum) { if (Number(orderObj?.lowPriceFlag) !== 1 && errTargetNum) {
return '商品不能低于最低价格' return '商品不能低于最低价格'
} }
}, },
...@@ -2054,10 +2042,7 @@ Page({ ...@@ -2054,10 +2042,7 @@ Page({
normalizeMarketingMetaOnItem(val) normalizeMarketingMetaOnItem(val)
preprocessSelectOrderCatalogItem(val) preprocessSelectOrderCatalogItem(val)
}) })
const catalogData = filterLowPriceSelectOrderCatalog( const catalogData = rawCatalogData
rawCatalogData,
orderObj?.lowPriceFlag
)
const classified = classifySelectOrderCatalog(catalogData, { const classified = classifySelectOrderCatalog(catalogData, {
subOrderList subOrderList
}) })
......
/**
* @file 低价单可选商品目录过滤。
*/
import { SELECT_ORDER_GOODS_FLAG } from './selectOrderCatalogClassification.js'
function hasMinPriceValidation(goods) {
return goods?.validMinSellPrice === 'Y'
}
function filterSpecificationGoodsMap(specificationGoodsMap) {
return Object.entries(specificationGoodsMap).reduce(
(filteredMap, [specificationKey, goodsList]) => {
const enabledGoodsList = Array.isArray(goodsList)
? goodsList.filter(hasMinPriceValidation)
: []
if (enabledGoodsList.length) {
filteredMap[specificationKey] = enabledGoodsList
}
return filteredMap
},
{},
)
}
function filterSpecificationList(specificationList, specificationKeys) {
if (!Array.isArray(specificationList)) return specificationList
const allowedValuesByIndex = specificationKeys.reduce(
(allowedValues, specificationKey) => {
specificationKey.split(';~;').forEach((value, index) => {
if (!allowedValues[index]) allowedValues[index] = new Set()
allowedValues[index].add(value)
})
return allowedValues
},
[],
)
return specificationList.map((specification, index) => {
const allowedValues = allowedValuesByIndex[index] || new Set()
const filteredSpecification = { ...specification }
if (Array.isArray(specification.specificationSelectValueList)) {
filteredSpecification.specificationSelectValueList =
specification.specificationSelectValueList.filter((value) =>
allowedValues.has(value),
)
}
if (Array.isArray(specification.specificationValueList)) {
filteredSpecification.specificationValueList =
specification.specificationValueList.filter((value) =>
allowedValues.has(value?.specificationValue),
)
}
return filteredSpecification
})
}
/**
* 低价单只展示已开启最低价格校验的商品。
* @param {Array<object>} items
* @param {number|string} lowPriceFlag
* @returns {Array<object>}
*/
export function filterLowPriceSelectOrderCatalog(items, lowPriceFlag) {
const list = Array.isArray(items) ? items : []
if (Number(lowPriceFlag) !== 1) return list
return list.reduce((result, item) => {
if (item?.goodsFlag == SELECT_ORDER_GOODS_FLAG.SINGLE) {
if (hasMinPriceValidation(item.goods)) result.push(item)
return result
}
if (item?.goodsFlag == SELECT_ORDER_GOODS_FLAG.MULTI_SPEC) {
const root = item.multipleSpecificationsGoods
const skuGoodsList = Array.isArray(root?.skuGoodsList)
? root.skuGoodsList.filter(hasMinPriceValidation)
: []
const hasSpecificationGoodsMap =
root?.specificationGoodsMap &&
typeof root.specificationGoodsMap === 'object' &&
!Array.isArray(root.specificationGoodsMap)
const specificationGoodsMap = hasSpecificationGoodsMap
? filterSpecificationGoodsMap(root.specificationGoodsMap)
: undefined
const specificationKeys = specificationGoodsMap
? Object.keys(specificationGoodsMap)
: []
const hasSelectableSku = hasSpecificationGoodsMap
? specificationKeys.length > 0
: skuGoodsList.length > 0
if (hasSelectableSku) {
result.push({
...item,
multipleSpecificationsGoods: {
...root,
skuGoodsList,
...(hasSpecificationGoodsMap
? {
specificationGoodsMap,
specificationList: filterSpecificationList(
root.specificationList,
specificationKeys,
),
}
: {}),
},
})
}
return result
}
if (item?.goodsFlag == SELECT_ORDER_GOODS_FLAG.PACKAGE) {
const goodsList = item.packageGoods?.goodsList
if (
Array.isArray(goodsList) &&
goodsList.length > 0 &&
goodsList.every(hasMinPriceValidation)
) {
result.push(item)
}
}
return result
}, [])
}
...@@ -74,35 +74,41 @@ export function validateLowPriceGoods(goods = {}) { ...@@ -74,35 +74,41 @@ export function validateLowPriceGoods(goods = {}) {
/** /**
* @param {Array<object>} goodsList * @param {Array<object>} goodsList
* @returns {{valid:boolean, invalidGoods:Array<object>, entries:Array<object>}} * @returns {{valid:boolean, matchedGoods:Array<object>, invalidGoods:Array<object>, entries:Array<object>}}
*/ */
export function validateLowPriceGoodsList(goodsList = []) { export function validateLowPriceGoodsList(goodsList = []) {
const entries = resolveLowPriceGoodsEntries(goodsList) const entries = resolveLowPriceGoodsEntries(goodsList)
const invalidGoods = entries.filter(goods => !validateLowPriceGoods(goods).valid) const matchedGoods = []
const invalidGoods = []
entries.forEach(goods => {
if (validateLowPriceGoods(goods).valid) {
matchedGoods.push(goods)
} else {
invalidGoods.push(goods)
}
})
return { return {
valid: invalidGoods.length === 0, valid: matchedGoods.length > 0,
matchedGoods,
invalidGoods, invalidGoods,
entries entries
} }
} }
/** /**
* 同步商品行最低价文案和低价单错误态。 * 同步商品行最低价提示文案,不执行资格校验,也不改变输入错误态。
* 仅应由 lowPriceFlag=1 的页面分支调用。
* @param {Array<object>} goodsList * @param {Array<object>} goodsList
* @returns {{valid:boolean, invalidGoods:Array<object>, entries:Array<object>}} * @returns {Array<object>}
*/ */
export function applyLowPriceGoodsValidation(goodsList = []) { export function applyLowPriceGoodsPresentation(goodsList = []) {
const result = validateLowPriceGoodsList(goodsList) const entries = resolveLowPriceGoodsEntries(goodsList)
result.entries.forEach(goods => { entries.forEach(goods => {
const validation = validateLowPriceGoods(goods) const enabled = goods?.validMinSellPrice === 'Y'
const minPrice = toFiniteNumber(goods?.minSellPrice)
goods.lowPriceMinPriceText = goods.lowPriceMinPriceText =
validation.enabled && validation.minPrice !== null enabled && minPrice !== null
? `最低价:¥${validation.minPrice}` ? `最低价:¥${minPrice}`
: '最低价:未开启' : '最低价:未开启'
goods.errorTarget = !validation.valid
goods.checkError = !validation.valid
goods.basePriceError = !validation.valid
}) })
return result return entries
} }
import assert from 'node:assert/strict'
import { readFileSync } from 'node:fs'
import { describe, it } from 'node:test'
import { filterLowPriceSelectOrderCatalog } from '../services/lowPriceCatalogFilter.helpers.js'
const helperSource = readFileSync(
new URL('../services/lowPriceCatalogFilter.helpers.js', import.meta.url),
'utf8',
)
function single(testId, validMinSellPrice) {
return {
testId,
goodsFlag: 1,
goods: { validMinSellPrice },
}
}
function multi(testId, skuGoodsList, extra = {}) {
return {
testId,
goodsFlag: 2,
multipleSpecificationsGoods: { skuGoodsList, ...extra },
}
}
function packageItem(testId, goodsList) {
return {
testId,
goodsFlag: 3,
packageGoods: { goodsList },
}
}
describe('filterLowPriceSelectOrderCatalog', () => {
it('avoids logical assignment syntax unsupported by the mini-program loader', () => {
assert.doesNotMatch(helperSource, /\?\?=/)
})
it('keeps only single goods with minimum-price validation enabled', () => {
const enabled = single('enabled', 'Y')
const disabled = single('disabled', 'N')
const missing = single('missing')
assert.deepEqual(
filterLowPriceSelectOrderCatalog([enabled, disabled, missing], 1),
[enabled],
)
})
it('keeps only enabled SKUs without mutating the original multi-spec item', () => {
const enabledSku = { id: 'sku-enabled', validMinSellPrice: 'Y' }
const disabledSku = { id: 'sku-disabled', validMinSellPrice: 'N' }
const item = multi('mixed-multi', [enabledSku, disabledSku], {
specificationGoodsMap: {
red: [enabledSku],
blue: [disabledSku],
mixed: [enabledSku, disabledSku],
},
specificationList: [
{
specificationSelectValueList: ['red', 'blue'],
specificationValueList: [
{ show: true, specificationValue: 'red' },
{ show: true, specificationValue: 'blue' },
],
},
],
})
const [filtered] = filterLowPriceSelectOrderCatalog([item], '1')
assert.notEqual(filtered, item)
assert.notEqual(
filtered.multipleSpecificationsGoods,
item.multipleSpecificationsGoods,
)
assert.deepEqual(
filtered.multipleSpecificationsGoods.skuGoodsList.map((sku) => sku.id),
['sku-enabled'],
)
assert.deepEqual(
Object.keys(filtered.multipleSpecificationsGoods.specificationGoodsMap),
['red', 'mixed'],
)
assert.deepEqual(
filtered.multipleSpecificationsGoods.specificationGoodsMap.mixed.map(
(sku) => sku.id,
),
['sku-enabled'],
)
assert.deepEqual(
filtered.multipleSpecificationsGoods.specificationList[0]
.specificationSelectValueList,
['red'],
)
assert.equal(item.multipleSpecificationsGoods.skuGoodsList.length, 2)
assert.equal(
item.multipleSpecificationsGoods.specificationGoodsMap.blue.length,
1,
)
assert.deepEqual(
item.multipleSpecificationsGoods.specificationList[0]
.specificationSelectValueList,
['red', 'blue'],
)
})
it('uses the specification map as the selectable SKU source', () => {
const enabledSku = { id: 'map-enabled', validMinSellPrice: 'Y' }
const enabled = multi('map-enabled-multi', [], {
specificationGoodsMap: { red: [enabledSku] },
})
const disabled = multi('map-disabled-multi', [enabledSku], {
specificationGoodsMap: {
blue: [{ id: 'map-disabled', validMinSellPrice: 'N' }],
},
})
const filtered = filterLowPriceSelectOrderCatalog([enabled, disabled], 1)
assert.deepEqual(
filtered.map((item) => item.testId),
['map-enabled-multi'],
)
assert.equal(
filtered[0].multipleSpecificationsGoods.specificationGoodsMap.red[0].id,
'map-enabled',
)
})
it('hides a multi-spec item when no enabled SKU remains', () => {
const item = multi('disabled-multi', [
{ id: 'sku-disabled', validMinSellPrice: 'N' },
{ id: 'sku-missing' },
])
assert.deepEqual(filterLowPriceSelectOrderCatalog([item], 1), [])
})
it('keeps a package only when its non-empty child list is fully enabled', () => {
const allEnabled = packageItem('enabled-package', [
{ validMinSellPrice: 'Y' },
{ validMinSellPrice: 'Y' },
])
const mixed = packageItem('mixed-package', [
{ validMinSellPrice: 'Y' },
{ validMinSellPrice: 'N' },
])
const missing = packageItem('missing-package', [
{ validMinSellPrice: 'Y' },
{},
])
const empty = packageItem('empty-package', [])
assert.deepEqual(
filterLowPriceSelectOrderCatalog([allEnabled, mixed, missing, empty], 1),
[allEnabled],
)
})
it('keeps the complete original catalog for normal orders', () => {
const fullCatalog = [
single('disabled-single', 'N'),
multi('disabled-multi', [{ validMinSellPrice: 'N' }]),
packageItem('mixed-package', [
{ validMinSellPrice: 'Y' },
{ validMinSellPrice: 'N' },
]),
{ testId: 'unknown', goodsFlag: 99 },
]
assert.equal(filterLowPriceSelectOrderCatalog(fullCatalog, 0), fullCatalog)
})
it('treats invalid low-price input and unknown goods types as hidden', () => {
assert.deepEqual(filterLowPriceSelectOrderCatalog(null, 1), [])
assert.deepEqual(
filterLowPriceSelectOrderCatalog([{ goodsFlag: 99 }], 1),
[],
)
})
})
...@@ -144,42 +144,43 @@ async function loadCatalog( ...@@ -144,42 +144,43 @@ async function loadCatalog(
return page return page
} }
describe('createOrder low-price catalog filtering', () => { describe('createOrder low-price catalog display', () => {
it('filters low-price catalog before page classification', async () => { it('keeps the full catalog for low-price orders', async () => {
const pageConfig = await loadPageConfig() const pageConfig = await loadPageConfig()
const page = await loadCatalog(pageConfig, 1) const page = await loadCatalog(pageConfig, 1)
assert.deepEqual( assert.deepEqual(
page.data.goodsData.map((item) => item.testId), page.data.goodsData.map((item) => item.testId),
['enabled-single', 'mixed-multi'], ['enabled-single', 'disabled-single', 'mixed-multi', 'mixed-package'],
) )
assert.deepEqual( assert.deepEqual(
page.data.goodsData[1].multipleSpecificationsGoods.skuGoodsList.map( page.data.goodsData[2].multipleSpecificationsGoods.skuGoodsList.map(
(item) => item.id, (item) => item.id,
), ),
['sku-enabled'], ['sku-enabled', 'sku-disabled'],
) )
assert.deepEqual( assert.deepEqual(
Object.keys( Object.keys(
page.data.goodsData[1].multipleSpecificationsGoods page.data.goodsData[2].multipleSpecificationsGoods
.specificationGoodsMap, .specificationGoodsMap,
), ),
['red'], ['red', 'blue'],
) )
assert.deepEqual( assert.deepEqual(
page.data.goodsData[1].multipleSpecificationsGoods.specificationGoodsMap.red.map( page.data.goodsData[2].multipleSpecificationsGoods.specificationGoodsMap.blue.map(
(item) => item.id, (item) => item.id,
), ),
['sku-enabled'], ['sku-disabled'],
) )
assert.deepEqual( assert.deepEqual(
page.data.goodsData[1].multipleSpecificationsGoods.specificationList[0] page.data.goodsData[2].multipleSpecificationsGoods.specificationList[0]
.specificationSelectValueList, .specificationSelectValueList,
['red'], ['red', 'blue'],
) )
assert.equal(page.data.frontGearArr.length, 1) assert.equal(page.data.frontGearArr.length, 1)
assert.equal(page.data.sideBeforeRearGearArr.length, 1)
assert.equal(page.data.otherProduct.length, 1) assert.equal(page.data.otherProduct.length, 1)
assert.equal(page.data.packageList.length, 0) assert.equal(page.data.packageList.length, 1)
}) })
it('keeps the full catalog for normal orders', async () => { it('keeps the full catalog for normal orders', async () => {
......
import { describe, it } from 'node:test' import { describe, it } from 'node:test'
import assert from 'node:assert/strict' import assert from 'node:assert/strict'
import { import {
applyLowPriceGoodsPresentation,
LOW_PRICE_NOT_TRIGGERED_MESSAGE, LOW_PRICE_NOT_TRIGGERED_MESSAGE,
resolveLowPriceGoodsEntries, resolveLowPriceGoodsEntries,
validateLowPriceGoods, validateLowPriceGoods,
validateLowPriceGoodsList, validateLowPriceGoodsList
applyLowPriceGoodsValidation
} from '../services/lowPriceGoodsValidation.helpers.js' } from '../services/lowPriceGoodsValidation.helpers.js'
describe('lowPriceGoodsValidation.helpers', () => { describe('lowPriceGoodsValidation.helpers', () => {
...@@ -90,7 +90,7 @@ describe('lowPriceGoodsValidation.helpers', () => { ...@@ -90,7 +90,7 @@ describe('lowPriceGoodsValidation.helpers', () => {
) )
}) })
it('IT-WO-LPG-005: whole-order validation fails when any leaf does not trigger minimum price', () => { it('IT-WO-LPG-005: whole-order validation passes when any leaf triggers minimum price', () => {
const result = validateLowPriceGoodsList([ const result = validateLowPriceGoodsList([
{ {
goodsFlag: 1, goodsFlag: 1,
...@@ -114,44 +114,78 @@ describe('lowPriceGoodsValidation.helpers', () => { ...@@ -114,44 +114,78 @@ describe('lowPriceGoodsValidation.helpers', () => {
} }
]) ])
assert.equal(result.valid, false) assert.equal(result.valid, true)
assert.equal(result.matchedGoods.length, 1)
assert.equal(result.invalidGoods.length, 1) assert.equal(result.invalidGoods.length, 1)
}) })
it('IT-WO-LPG-006: applies minimum-price echo and clears stale normal-order errors for valid low-price goods', () => { it('IT-WO-LPG-006: whole-order validation fails when no leaf triggers minimum price', () => {
const valid = { const result = validateLowPriceGoodsList([
validMinSellPrice: 'Y', {
minSellPrice: 100, goodsFlag: 1,
sellPrice: 80, goods: {
errorTarget: true, validMinSellPrice: 'Y',
checkError: true, minSellPrice: 100,
basePriceError: true sellPrice: 100
} }
const disabled = { },
validMinSellPrice: 'N', {
minSellPrice: 60, goodsFlag: 1,
sellPrice: 30 goods: {
} validMinSellPrice: 'N',
const goodsList = [ minSellPrice: 60,
{ goodsFlag: 1, goods: valid }, sellPrice: 30
{ goodsFlag: 1, goods: disabled } }
] }
])
assert.equal(result.valid, false)
assert.deepEqual(result.matchedGoods, [])
assert.equal(result.invalidGoods.length, 2)
})
const result = applyLowPriceGoodsValidation(goodsList) it('IT-WO-LPG-007: empty goods cannot satisfy whole-order minimum price', () => {
const result = validateLowPriceGoodsList([])
assert.equal(result.valid, false) assert.equal(result.valid, false)
assert.equal(valid.lowPriceMinPriceText, '最低价:¥100') assert.deepEqual(result.matchedGoods, [])
assert.equal(valid.errorTarget, false) assert.deepEqual(result.invalidGoods, [])
assert.equal(valid.checkError, false)
assert.equal(valid.basePriceError, false)
assert.equal(disabled.lowPriceMinPriceText, '最低价:未开启')
assert.equal(disabled.errorTarget, true)
}) })
it('IT-WO-LPG-007: exposes the required reminder copy', () => { it('IT-WO-LPG-008: exposes the required reminder copy', () => {
assert.equal( assert.equal(
LOW_PRICE_NOT_TRIGGERED_MESSAGE, LOW_PRICE_NOT_TRIGGERED_MESSAGE,
'价格未触发最低价,其他正常单请到生意助手侧录单' '价格未触发最低价,其他正常单请到生意助手侧录单'
) )
}) })
it('IT-WO-LPG-009: presentation text never creates or changes input errors', () => {
const enabled = {
validMinSellPrice: 'Y',
minSellPrice: 100,
sellPrice: 120
}
const disabled = {
validMinSellPrice: 'N',
minSellPrice: 80,
sellPrice: 20,
errorTarget: false,
checkError: false,
basePriceError: false
}
applyLowPriceGoodsPresentation([
{ goodsFlag: 1, goods: enabled },
{ goodsFlag: 1, goods: disabled }
])
assert.equal(enabled.lowPriceMinPriceText, '最低价:¥100')
assert.equal(disabled.lowPriceMinPriceText, '最低价:未开启')
assert.equal(Object.hasOwn(enabled, 'errorTarget'), false)
assert.equal(Object.hasOwn(enabled, 'checkError'), false)
assert.equal(Object.hasOwn(enabled, 'basePriceError'), false)
assert.equal(disabled.errorTarget, false)
assert.equal(disabled.checkError, false)
assert.equal(disabled.basePriceError, false)
})
}) })
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!