fix: ensure purchase activity price displays across pages

This commit is contained in:
moyayu
2026-05-28 18:53:47 +08:00
parent 6f58fd030f
commit 7b40db8e66
7 changed files with 9 additions and 7 deletions

View File

@@ -24,7 +24,7 @@ function SpGoodsCell(props) {
const { userInfo = {}, vipInfo = {} } = useSelector((state) => state.user)
const { priceDisplayConfig = {} } = useSelector((state) => state.purchase)
const { checkout_page = {} } = priceDisplayConfig
const { activity_price: enPurActivityPrice, sale_price: enPurSalePrice } = checkout_page
const { activity_price: enPurActivityPrice = true, sale_price: enPurSalePrice } = checkout_page
if (!info) {
return null
}

View File

@@ -24,7 +24,7 @@ function SpGoodsPrice(props) {
const { priceDisplayConfig = {} } = useSelector((state) => state.purchase)
const { isLogin } = useLogin()
const { items_page = {} } = priceDisplayConfig
const { activity_price: enPurActivityPrice, sale_price: enPurSalePrice } = items_page
const { activity_price: enPurActivityPrice = true, sale_price: enPurSalePrice } = items_page
if (!info) {
return null

View File

@@ -29,7 +29,7 @@ function SpOrderItem(props) {
const { market_price: enMarketPrice } = order_page
const { priceDisplayConfig = {} } = useSelector((state) => state.purchase)
const { order_detail_page = {} } = priceDisplayConfig
const { activity_price: enPurActivityPrice, sale_price: enPurSalePrice } = order_detail_page
const { activity_price: enPurActivityPrice = true, sale_price: enPurSalePrice } = order_detail_page
if (!info) return null

View File

@@ -27,7 +27,7 @@ function SpGoodsCard(props) {
} = item_page
const { priceDisplayConfig = {} } = useSelector((state) => state.purchase)
const { items_page = {} } = priceDisplayConfig
const { activity_price: enPurActivityPrice, sale_price: enPurSalePrice } = items_page
const { activity_price: enPurActivityPrice = true, sale_price: enPurSalePrice } = items_page
const {
onClick,

View File

@@ -52,7 +52,7 @@ function CompGoodsItem(props) {
const { market_price: enMarketPrice } = cart_page
const { priceDisplayConfig = {} } = useSelector((state) => state.purchase)
const { cart_page: pcart_page = {} } = priceDisplayConfig
const { activity_price: enPurActivityPrice, sale_price: enPurSalePrice } = pcart_page
const { activity_price: enPurActivityPrice = true, sale_price: enPurSalePrice } = pcart_page
const [state, setState] = useImmer(initialState)
const { localNum } = state

View File

@@ -197,11 +197,12 @@ function PurchaseActivityList() {
const handlePriceConfig = (val) => {
if (!val) return {}
const priceConfig = JSON.parse(JSON.stringify(val))
const isEnabled = (value) => ![false, 'false', 0, '0'].includes(value)
Object.keys(priceConfig).forEach((key) => {
const c_config = priceConfig[key]
if (c_config) {
for (let ckey in c_config) {
c_config[ckey] = c_config[ckey] == 'true'
c_config[ckey] = isEnabled(c_config[ckey])
}
}
})

View File

@@ -25,11 +25,12 @@ import './select-identity.scss'
function handlePriceConfig(val) {
if (!val) return {}
const priceConfig = JSON.parse(JSON.stringify(val))
const isEnabled = (value) => ![false, 'false', 0, '0'].includes(value)
Object.keys(priceConfig).forEach((key) => {
const c_config = priceConfig[key]
if (c_config) {
for (const ckey in c_config) {
c_config[ckey] = c_config[ckey] == 'true'
c_config[ckey] = isEnabled(c_config[ckey])
}
}
})