diff --git a/.env b/.env index 0fb350eea..fa6576893 100644 --- a/.env +++ b/.env @@ -13,4 +13,5 @@ APP_IMAGE_CDN= APP_DIANWU_URL= APP_MERCHANT_URL= APP_ADAPAY= +APP_LIVE= APP_DEFAULT_LANGUAGE=zhcn diff --git a/CHANGELOG.md b/CHANGELOG.md index 87859db38..4dddc6d56 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,8 +4,6 @@ All notable changes to this project will be documented in this file. See [standa ## [4.8.0](https://ms-git.ishopex.cn/ecshopx/ecshopx-vshop/compare/v4.7.1...v4.8.0) (2026-07-03) -## [4.8.0](https://ms-git.ishopex.cn/ecshopx/ecshopx-vshop/compare/v4.7.1...v4.8.0) (2026-07-03) - ### [4.7.1](https://ms-git.ishopex.cn/ecshopx/ecshopx-vshop/compare/v4.7.0...v4.7.1) (2026-06-30) ## [4.7.0](https://ms-git.ishopex.cn/ecshopx/ecshopx-vshop/compare/v4.6.10...v4.7.0) (2026-06-26) diff --git a/README.md b/README.md index fb3dd2627..0584d6307 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ APP_COMPANY_ID=1 # System Business Model (b2c:standard/b2b2c:platform) APP_PLATFORM=standard -# Mobile Web App Payment Callback Domain,used for payment result notifications. +# H5 domain of the mobile web app, used for payment result callbacks. APP_CUSTOM_SERVER= # App Homepage Path @@ -59,6 +59,25 @@ APP_MERCHANT_URL= APP_ADAPAY= ``` +### Cloud Deployment: Backend API Base URL + +When deploying to a server or cloud host, requests fail until `APP_BASE_URL` points at your **own** backend instead of the default. + +- **Which variable / file?** Set `APP_BASE_URL` in `.env`, or in `.env.local` which overrides `.env`. +- **Do I need the port?** Only when the backend is reached directly on a non-standard port — the PHP API listens on `8005` by default. Behind a domain proxied by Nginx on 80/443, omit the port. +- **Rebuild after every change.** `APP_*` variables are baked in at build time. After editing the env file you must re-run the build. Run it from the project root (where `package.json` lives); inside a container, run it in that same directory. + +```shell +# Behind a domain (Nginx on 80/443) — no port needed, end with /api +APP_BASE_URL=https://your-domain.com/api +# Direct public IP on a non-standard port — include the port +APP_BASE_URL=http://1.2.3.4:8005/api + +# Rebuild after changing the value +npm run build:h5 # Mobile Web App (H5) +npm run build:weapp # WeChat Mini Program +``` + ### Run project ```shell # Compile Mobile Web App diff --git a/config/index.js b/config/index.js index 93744250e..967ac99f4 100644 --- a/config/index.js +++ b/config/index.js @@ -38,7 +38,7 @@ const IS_APP_SERVER = BUILD_APP_SERVER === 'server' const copyPatterns = [{ from: 'src/assets', to: `${DIST_PATH}/assets` }] const i18nResourceTransform = (content) => - content.toString().replace(/\.\/locales\/(zhcn|en|ar)\.json/g, './locales/$1.js') + content.toString().replace(/\.\/locales\/(zhcn|zhtw|en|ar)\.json/g, './locales/$1.js') const i18nLocaleTransform = (content) => `module.exports = ${content.toString()}\n` if (process.env.TARO_ENV == 'h5') { @@ -53,7 +53,7 @@ if (process.env.TARO_ENV == 'weapp') { to: `${DIST_PATH}/subpages/i18n/resources.js`, transform: i18nResourceTransform }) - ;['zhcn', 'en', 'ar'].forEach((lang) => { + ;['zhcn', 'zhtw', 'en', 'ar'].forEach((lang) => { copyPatterns.push({ from: `src/subpages/i18n/locales/${lang}.json`, to: `${DIST_PATH}/subpages/i18n/locales/${lang}.js`, diff --git a/package.json b/package.json index 83415dae2..9398bc202 100644 --- a/package.json +++ b/package.json @@ -136,9 +136,12 @@ } }, "lint-staged": { - "*.{js,jsx,scss}": [ - "npm run eslint", - "npm run prettier" + "*.{js,jsx}": [ + "eslint --fix --ignore-path .eslintignore", + "prettier --write" + ], + "*.scss": [ + "prettier --write" ] } } diff --git a/src/__tests__/doumenIntlPay.test.js b/src/__tests__/doumenIntlPay.test.js new file mode 100644 index 000000000..a52806c03 --- /dev/null +++ b/src/__tests__/doumenIntlPay.test.js @@ -0,0 +1,22 @@ +const fs = require('fs') +const path = require('path') + +const source = fs.readFileSync(path.resolve(process.cwd(), 'src/hooks/usePayment.js'), 'utf8') + +test('doumen_intl payment dispatches to the external cashier branch', () => { + expect(source).toMatch(/case 'doumen_intl':\s*doumenIntlPay\(params, orderInfo\)\s*break/) + expect(source).toMatch(/const doumenIntlPay = async \(params, orderInfo\) => \{/) +}) + +test('doumen_intl redirects through cashier result page when pay_url exists', () => { + expect(source).toMatch(/const res = await api\.cashier\.getPayment\(\{[\s\S]*return_url:/) + expect(source).toMatch(/if \(!res \|\| !res\.pay_url\) return payError\(orderInfo\)/) + expect(source).toMatch(/Taro\.redirectTo\(\{ url: `\$\{cashierResultUrl\}\?order_id=\$\{order_id\}` \}\)/) + expect(source).toMatch(/window\.location\.href = res\.pay_url/) +}) + +test('doumen_intl payment type has an i18n label mapping', () => { + expect(source).not.toMatch(/doumen_intl:\s*'斗门支付'/) + const constsSource = fs.readFileSync(path.resolve(process.cwd(), 'src/consts/index.js'), 'utf8') + expect(constsSource).toMatch(/doumen_intl:\s*\$t\('e3a5dbf4\.5833ba'\)/) +}) diff --git a/src/app.js b/src/app.js index c8a3e625d..7a7630f51 100644 --- a/src/app.js +++ b/src/app.js @@ -216,7 +216,8 @@ function App({ children }) { whitelist_status = false, nostores_status = false, distributor_param_status = false, - point_rule_name: pointRuleNameFromApi + point_rule_name: pointRuleNameFromApi, + currency } = homeRes const point_rule_name = pointRuleNameFromApi || $t('bd9c9dcd.9f68a8') @@ -272,6 +273,13 @@ function App({ children }) { meiqia, priceSetting, appLogo: appSettingInfo?.logo, + currency: currency || { + symbol: '¥', + currency: 'CNY', + title: '', + rate: 1, + is_default: true + }, // entryStoreByStoreCode: enterStoreRule?.distributor_code, // entryStoreByGuideMaterial: enterStoreRule?.shop_assistant, diff --git a/src/components/goods-buy-panel/index.js b/src/components/goods-buy-panel/index.js index e3955d33c..99c514150 100644 --- a/src/components/goods-buy-panel/index.js +++ b/src/components/goods-buy-panel/index.js @@ -549,16 +549,10 @@ export default class GoodsBuyPanel extends Component { )} {!isPointitem && ( - + {marketPrice !== 0 && marketPrice && ( - + )} diff --git a/src/components/sp-goods-cell/index.js b/src/components/sp-goods-cell/index.js index ca0f2ada6..09bfc75ff 100644 --- a/src/components/sp-goods-cell/index.js +++ b/src/components/sp-goods-cell/index.js @@ -62,8 +62,8 @@ function SpGoodsCell(props) { if (enPurActivityPrice) { return ( - - + + ) } diff --git a/src/components/sp-goods-item/index.js b/src/components/sp-goods-item/index.js index 648cf09bb..3841237a6 100644 --- a/src/components/sp-goods-item/index.js +++ b/src/components/sp-goods-item/index.js @@ -265,8 +265,8 @@ function SpGoodsItem(props) { <> {info.activityPrice && enPurActivityPrice ? ( - - + + ) : ( enPurActivityPrice && diff --git a/src/components/sp-goods-price/index.js b/src/components/sp-goods-price/index.js index 0ccf140ad..d5cf1aff4 100644 --- a/src/components/sp-goods-price/index.js +++ b/src/components/sp-goods-price/index.js @@ -39,7 +39,7 @@ function SpGoodsPrice(props) { {/* 内购 && !enPurActivityPrice 不展示,其他情况都展示 */} {!(isPurchase && !enPurActivityPrice) ? ( - + {/* ¥{activityPrice.toFixed(2)} */} diff --git a/src/components/sp-input/index.js b/src/components/sp-input/index.js index 1d01a7533..1bc0a3e7a 100644 --- a/src/components/sp-input/index.js +++ b/src/components/sp-input/index.js @@ -96,6 +96,10 @@ function SpInput(props) { } } + const isPasswordField = type === 'password' + // 微信小程序 Input 不支持 type=password,需 type=text + password 属性 + const inputType = isPasswordField && !isWeb ? 'text' : type + return ( @@ -112,7 +116,8 @@ function SpInput(props) { ref={inputRef} clear={props.clear} value={props.value} - type={type} + type={inputType} + password={isPasswordField && !isWeb} adjustPosition={props.adjustPosition} maxLength={props.maxLength} placeholder={props.placeholder} diff --git a/src/components/sp-order-item/index.js b/src/components/sp-order-item/index.js index 1a211abeb..6e4a39f14 100644 --- a/src/components/sp-order-item/index.js +++ b/src/components/sp-order-item/index.js @@ -100,7 +100,9 @@ function SpOrderItem(props) { - ¥{info.salePrice} + + + )} {!isPurchase && ( diff --git a/src/components/sp-price/index.js b/src/components/sp-price/index.js index 7684b6d73..ff4a11af5 100644 --- a/src/components/sp-price/index.js +++ b/src/components/sp-price/index.js @@ -4,6 +4,7 @@ */ import React, { Component } from 'react' import { Text, View } from '@tarojs/components' +import { connect } from 'react-redux' import { classNames, isNumber, isString, styleNames } from '@/utils' import './index.scss' @@ -19,6 +20,9 @@ import './index.scss' * @props sizePreset - card:'normal' | 'small' * @props digits - card:小数位数,默认 2 */ +@connect(({ sys }) => ({ + currencySymbol: sys.currency?.symbol +})) export default class SpPrice extends Component { static options = { addGlobalClass: true @@ -64,6 +68,11 @@ export default class SpPrice extends Component { return unit } + resolveSymbol() { + const { symbol, currencySymbol } = this.props + return symbol ?? currencySymbol ?? '¥' + } + renderCardVariant() { const { className, primary, discount, equal, sizePreset, digits, noSymbol, appendText, plus } = this.props @@ -79,7 +88,7 @@ export default class SpPrice extends Component { } const fixed = Number(priceVal).toFixed(digits) const [intPart, decimalPart] = fixed.split('.') - const symbol = this.props.symbol || '¥' + const symbol = this.resolveSymbol() const minus = num < 0 return ( @@ -149,7 +158,7 @@ export default class SpPrice extends Component { const formattedInt = int ? int.replace(/\B(?=(\d{3})+(?!\d))/g, ',') : '' int = formattedInt const minus = _value < 0 - const symbol = this.props.symbol + const symbol = this.resolveSymbol() const fontWeight = weight == 'blod' ? 600 : weight const fontFamily = family || (weight == 'blod' || weight >= 600 ? 'D-DIN-PRO' : 'D-DIN-PRO-Regular') @@ -181,7 +190,7 @@ export default class SpPrice extends Component { fontFamily: 'D-DIN-PRO-Medium' })} > - {symbol || '¥'} + {symbol} )} ({ + home: $t('1734e75c.db1c89'), + category: $t('e6f782b6.d0771a'), + cart: $t('a2d3a891.c017be'), + member: $t('e4bfc1bd.07b181') +}) + function SpTabbar() { const navipage = '/subpages/item/list?isTabBar=true' const [currentIndex, setCurrentIndex] = useState(-1) const { tabbar = {} } = useSelector((state) => state.sys) const { cartCount = 0 } = useSelector((state) => state.cart) const { color, backgroundColor, selectedColor } = tabbar?.config || {} + const inactiveColor = color || '#666666' + const activeColor = selectedColor || 'var(--color-primary)' const { data: tabList = [] } = tabbar || {} const pages = Taro.getCurrentPages() @@ -144,12 +154,12 @@ function SpTabbar() { )} - - {item.text} - + {item.text || TABBAR_TEXT()[item.name] || ''} + ) })} diff --git a/src/components/sp-tabbar/index.scss b/src/components/sp-tabbar/index.scss index 102dc7e16..623cd6e53 100755 --- a/src/components/sp-tabbar/index.scss +++ b/src/components/sp-tabbar/index.scss @@ -9,7 +9,7 @@ height: 124px; background-color: #fff; border-top: 1px solid #e5e5e5; - padding: 20px 36px 0px; + padding: 12px 36px 8px; box-sizing: border-box; .cart-count1 { @@ -48,9 +48,10 @@ display: flex; flex-direction: column; align-items: center; - justify-content: space-between; + justify-content: flex-start; + gap: 4px; width: 96px; - height: 86px; + min-height: 86px; &-cover-image { width: 86px; @@ -60,6 +61,7 @@ } &-text { + flex-shrink: 0; height: 28px; font-family: PingFang SC, PingFang SC; font-weight: 500; @@ -83,8 +85,14 @@ } &-image-wrapper { position: relative; + flex-shrink: 0; + height: 56px; + display: flex; + align-items: center; + justify-content: center; .iconfont { font-size: 56px; + line-height: 1; } } &-image { diff --git a/src/consts/index.js b/src/consts/index.js index 693ec4af0..1fa5d9a21 100644 --- a/src/consts/index.js +++ b/src/consts/index.js @@ -292,6 +292,7 @@ export const PAYMENT_TYPE = () => ({ wxpaypos: $t('e3a5dbf4.bffe28'), alipaypos: $t('e3a5dbf4.e3b206'), alipaymini: $t('e3a5dbf4.e3b206'), + doumen_intl: $t('e3a5dbf4.5833ba'), point: $t('e3a5dbf4.accd19'), offline_pay: $t('e3a5dbf4.2d8019') }) diff --git a/src/hooks/usePayment.js b/src/hooks/usePayment.js index 2ff3bfd99..c37c547c7 100644 --- a/src/hooks/usePayment.js +++ b/src/hooks/usePayment.js @@ -72,6 +72,9 @@ export default (props = {}) => { case 'alipayh5': alipayh5Pay(params, orderInfo) break + case 'doumen_intl': + doumenIntlPay(params, orderInfo) + break case 'wxpayjs': wxpayjsPay(params, orderInfo) break @@ -338,6 +341,23 @@ export default (props = {}) => { }, 1000) } + // 斗门国际支付:跳转外部收银台(仅 H5) + const doumenIntlPay = async (params, orderInfo) => { + const { pay_type, pay_channel } = params + const { order_id, order_type = 'normal' } = orderInfo + const { protocol, host } = window.location + const res = await api.cashier.getPayment({ + pay_type, + pay_channel, + order_id, + order_type, + return_url: `${protocol}//${host}${cashierResultUrl}?order_id=${order_id}` + }) + if (!res || !res.pay_url) return payError(orderInfo) + Taro.redirectTo({ url: `${cashierResultUrl}?order_id=${order_id}` }) + window.location.href = res.pay_url + } + // 汇付斗拱,支付宝H5 const bspayAliH5Pay = async (params, orderInfo) => { const { pay_type, pay_channel } = params diff --git a/src/i18n/config-t.js b/src/i18n/config-t.js index 57149f9ec..b11ff256f 100644 --- a/src/i18n/config-t.js +++ b/src/i18n/config-t.js @@ -8,6 +8,10 @@ const TABLES = { '95285d68.93f311': '您的位置信息将用于定位附近门店', '95285d68.0ed510': '小程序' }, + zhtw: { + '95285d68.93f311': '您的位置資訊將用於定位附近門店', + '95285d68.0ed510': '小程式' + }, en: { '95285d68.93f311': 'Your location is used to find nearby stores', '95285d68.0ed510': 'Mini Program' diff --git a/src/i18n/index.js b/src/i18n/index.js index f297ec354..1fe7bef45 100644 --- a/src/i18n/index.js +++ b/src/i18n/index.js @@ -25,11 +25,21 @@ export { export { useTranslation, Trans } from 'react-i18next' /** - * 当前存储侧语言码(zhcn | en | ar) + * 当前存储侧语言码(zhcn | zhtw | en | ar) */ export function getLocale() { const lng = i18n.resolvedLanguage || i18n.language || 'en' - return I18N_TO_STORAGE[lng] || (String(lng).toLowerCase().startsWith('zh') ? 'zhcn' : 'en') + if (I18N_TO_STORAGE[lng]) { + return I18N_TO_STORAGE[lng] + } + const lower = String(lng).toLowerCase() + if (lower.startsWith('zh-tw') || lower === 'zhtw') { + return 'zhtw' + } + if (lower.startsWith('zh')) { + return 'zhcn' + } + return 'en' } /** diff --git a/src/i18n/instance.js b/src/i18n/instance.js index c47b34cfb..6c57d4e09 100644 --- a/src/i18n/instance.js +++ b/src/i18n/instance.js @@ -11,6 +11,7 @@ import { initReactI18next } from 'react-i18next' /** Taro 存储 / Redux 使用的语言码 → i18next lng */ export const STORAGE_TO_I18N = { zhcn: 'zh-CN', + zhtw: 'zh-TW', en: 'en', ar: 'ar' } @@ -18,18 +19,24 @@ export const STORAGE_TO_I18N = { /** i18next lng → 存储用语言码 */ export const I18N_TO_STORAGE = { 'zh-CN': 'zhcn', + 'zh-TW': 'zhtw', en: 'en', ar: 'ar' } /** 可选语言顺序(与 Taro 存储 lang 一致) */ -export const SUPPORTED_STORAGE_LANGS = ['zhcn', 'en', 'ar'] +export const SUPPORTED_STORAGE_LANGS = ['zhcn', 'zhtw', 'en', 'ar'] const STORAGE_LANG_ALIASES = { 'zh-cn': 'zhcn', 'zh_cn': 'zhcn', zh: 'zhcn', zhcn: 'zhcn', + zhtw: 'zhtw', + 'zh-tw': 'zhtw', + 'zh_tw': 'zhtw', + 'zh-TW': 'zhtw', + tw: 'zhtw', en: 'en', 'en-us': 'en', 'en_cn': 'en', @@ -119,7 +126,7 @@ function loadLocalePackage() { ...(Taro.__i18nResources || {}), ...resources } - if (resources.zhcn || resources.en || resources.ar) { + if (resources.zhcn || resources.zhtw || resources.en || resources.ar) { resolve() } else { reject(new Error('i18n subPackage loaded without resources')) @@ -133,7 +140,7 @@ function loadLocalePackage() { const Taro = getTaro() try { const resources = require('../subpages/i18n/resources') - if (Taro && resources && (resources.zhcn || resources.en || resources.ar)) { + if (Taro && resources && (resources.zhcn || resources.zhtw || resources.en || resources.ar)) { Taro.__i18nResources = { ...(Taro.__i18nResources || {}), ...resources @@ -183,7 +190,7 @@ async function loadI18nResource(storageLang) { } /** - * 与 Taro 存储语言对齐(zhcn / en / ar) + * 与 Taro 存储语言对齐(zhcn / zhtw / en / ar) * @param {string} storageLang */ export async function syncI18nLanguage(storageLang) { diff --git a/src/lang/consts.js b/src/lang/consts.js index f0e77172e..70d45d96d 100644 --- a/src/lang/consts.js +++ b/src/lang/consts.js @@ -9,7 +9,7 @@ const i18n = { return $t('b660e930.d688a3') }, en: 'English', - // zhtw: '繁體中文', + zhtw: '繁體中文', ar: 'العربية' } diff --git a/src/marketing/pages/member/item-activity.js b/src/marketing/pages/member/item-activity.js index 69f76a38a..2eeef3d4b 100644 --- a/src/marketing/pages/member/item-activity.js +++ b/src/marketing/pages/member/item-activity.js @@ -26,28 +26,30 @@ const initialState = { function ItemActivity(props) { const { i18n } = useTranslation() const [state, setState] = useImmer(initialState) - const { status, recordList, isOpened, activityInfo, hasReFreash } = state - const recordRef = useRef() - const router = useRouter() - const filterActivityId = router.params?.activity_id + const { status, recordList, isOpened, activityInfo } = state const tradeStatus = useMemo( () => [ - { tag_name: $t('da5ae518.a8b0c2'), value: '' }, - { tag_name: $t('da5ae518.dd4e55'), value: '0' }, - { tag_name: $t('da5ae518.fb852f'), value: '1' }, - { tag_name: $t('da5ae518.047fab'), value: '2' } + { tag_name: $t('f330b238.a8b0c2'), value: '' }, + { tag_name: $t('f330b238.5cb424'), value: 'pending' }, + { tag_name: $t('f330b238.4166d8'), value: 'passed' }, + { tag_name: $t('f330b238.81233d'), value: 'rejected' }, + { tag_name: $t('f330b238.2111cc'), value: 'canceled' }, + { tag_name: $t('f330b238.77af84'), value: 'verified' } ], [i18n.language] ) const selectOptions = useMemo( () => [ - { label: $t('c012603a.1f8f1b'), value: '0' }, - { label: $t('c012603a.78206f'), value: '1' } + { label: $t('f330b238.1f8f1b'), value: '0' }, + { label: $t('f330b238.78206f'), value: '1' } ], [i18n.language] ) + const recordRef = useRef() + const router = useRouter() + const filterActivityId = router.params?.activity_id // useEffect(() => { // Taro.eventCenter.on('onEventRecordStatusChange', () => { @@ -120,7 +122,7 @@ function ItemActivity(props) { await api.user.joinActivity({ activity_id: activityId }) Taro.showToast({ icon: 'none', - title: $t('c012603a.b90d81') + title: $t('f330b238.b90d81') }) setTimeout(() => { Taro.navigateTo({ @@ -192,7 +194,7 @@ function ItemActivity(props) { auto={false} ref={recordRef} fetch={fetch} - emptyMsg={$t('11f15792.082a19')} + emptyMsg={$t('f330b238.082a19')} > {recordList.map((item, index) => ( diff --git a/src/marketing/pages/reservation/goods-reservate-result.js b/src/marketing/pages/reservation/goods-reservate-result.js index 7d9ed529b..0ee23252d 100644 --- a/src/marketing/pages/reservation/goods-reservate-result.js +++ b/src/marketing/pages/reservation/goods-reservate-result.js @@ -37,7 +37,8 @@ function GoodReservateResult(props) { const _info = pickBy(activity_info, { joinTips: 'join_tips', submitFormTips: 'submit_form_tips', - activityName: 'activity_name' + activityName: 'activity_name', + activity_id: 'activity_id' }) setNavigationBarTitle(_info.activityName) @@ -48,7 +49,7 @@ function GoodReservateResult(props) { } const handleRecord = () => { - Taro.reLaunch({ url: '/marketing/pages/member/item-activity' }) + Taro.reLaunch({ url: `/marketing/pages/member/item-activity?activity_id=${info.activity_id}` }) } return ( diff --git a/src/pages/cart/comps/comp-goodsitem.js b/src/pages/cart/comps/comp-goodsitem.js index ef4ffbeac..19e12e506 100644 --- a/src/pages/cart/comps/comp-goodsitem.js +++ b/src/pages/cart/comps/comp-goodsitem.js @@ -254,14 +254,8 @@ function CompGoodsItem(props) { <> {enPurActivityPrice ? ( - - + + ) : ( diff --git a/src/pages/home/wgts/goods/index.jsx b/src/pages/home/wgts/goods/index.jsx index 528bec6fd..a409c563e 100644 --- a/src/pages/home/wgts/goods/index.jsx +++ b/src/pages/home/wgts/goods/index.jsx @@ -5,8 +5,15 @@ import React, { useState, useEffect, useMemo, useContext, useCallback } from 'react' import Taro, { useDidShow } from '@tarojs/taro' import { View, Text } from '@tarojs/components' -import { SpImage, SpPoint } from '@/components' -import { classNames, styleNames, linkPage, pickBy, getDistributorId } from '@/utils' +import { SpImage, SpPoint, SpPrice } from '@/components' +import { + classNames, + styleNames, + linkPage, + pickBy, + getDistributorId, + getCurrencySymbol +} from '@/utils' import { getBrowseHistoryList } from '@/utils/browseHistory' import doc from '@/doc' import api from '@/api' @@ -221,13 +228,16 @@ export default function WgtGoods(props) { className='wgt-goods__activity-item-price__unit' style={{ marginLeft: '4px' }} > - +¥{(item.price || 0).toFixed(2)} + +{getCurrencySymbol()} + {(item.price || 0).toFixed(2)} )} ) : ( - + + {getCurrencySymbol()} + {item.mainPrice || (item.activityPrice diff --git a/src/pages/home/wgts/group/index.jsx b/src/pages/home/wgts/group/index.jsx index e1edb92c6..48500cf88 100644 --- a/src/pages/home/wgts/group/index.jsx +++ b/src/pages/home/wgts/group/index.jsx @@ -6,7 +6,14 @@ import React, { useState, useEffect, useMemo, useContext } from 'react' import Taro from '@tarojs/taro' import { View, Text } from '@tarojs/components' import { SpImage } from '@/components' -import { classNames, styleNames, linkPage, pickBy, getDistributorId } from '@/utils' +import { + classNames, + styleNames, + linkPage, + pickBy, + getDistributorId, + getCurrencySymbol +} from '@/utils' import doc from '@/doc' import api from '@/api' import { AtIcon } from 'taro-ui' @@ -182,7 +189,9 @@ export default function WgtGroup(props) { {$t('568eb830.35a576')} - + + {getCurrencySymbol()} + {item.mainPrice || (item.activityPrice diff --git a/src/pages/home/wgts/helper.js b/src/pages/home/wgts/helper.js index 21b3b4c3b..0c541865e 100644 --- a/src/pages/home/wgts/helper.js +++ b/src/pages/home/wgts/helper.js @@ -130,30 +130,28 @@ export function getGlobalBaseStyle(baseStyle) { const bgType = baseStyle.bgType const style = {} - style.padding = `${Taro.pxTransform(baseStyle.paddedt || 0)} ${Taro.pxTransform( - baseStyle.paddedr || 0 - )} ${Taro.pxTransform(baseStyle.paddedb || 0)} ${Taro.pxTransform(baseStyle.paddedl || 0)}` + style.padding = `${Taro.pxTransform(baseStyle.paddedt || 0)} ${Taro.pxTransform(baseStyle.paddedr || 0)} ${Taro.pxTransform(baseStyle.paddedb || 0)} ${Taro.pxTransform(baseStyle.paddedl || 0)}` if (bgType === 'color' && baseStyle.bgColor) { - if (isWeb) { + if(isWeb){ style['background-color'] = baseStyle.bgColor } else { style.backgroundColor = baseStyle.bgColor } } else if (bgType === 'pic' && baseStyle.bgPic) { - if (isWeb) { + if(isWeb){ style['background-image'] = `url('${baseStyle.bgPic}')` style['background-size'] = '100% 100%' style['background-position'] = 'center' style['background-repeat'] = 'no-repeat' } else { - style.backgroundImage = `url('${baseStyle.bgPic}')` - style.backgroundSize = '100% 100%' - style.backgroundPosition = 'center' - style.backgroundRepeat = 'no-repeat' + style.backgroundImage = `url('${baseStyle.bgPic}')` + style.backgroundSize = '100% 100%' + style.backgroundPosition = 'center' + style.backgroundRepeat = 'no-repeat' } } else if (bgType === 'gradient' && baseStyle.startColor) { const endColor = baseStyle.endColor || baseStyle.startColor - if (isWeb) { + if(isWeb){ style['background-image'] = `linear-gradient(${baseStyle.startColor}, ${endColor})` style['background-size'] = 'cover' } else { diff --git a/src/pages/home/wgts/hotranking/index.jsx b/src/pages/home/wgts/hotranking/index.jsx index b30529251..c3ad0c080 100644 --- a/src/pages/home/wgts/hotranking/index.jsx +++ b/src/pages/home/wgts/hotranking/index.jsx @@ -6,7 +6,14 @@ import React, { useState, useEffect, useMemo, useContext } from 'react' import Taro from '@tarojs/taro' import { View, Text } from '@tarojs/components' import { SpImage } from '@/components' -import { classNames, styleNames, linkPage, pickBy, getDistributorId } from '@/utils' +import { + classNames, + styleNames, + linkPage, + pickBy, + getDistributorId, + getCurrencySymbol +} from '@/utils' import doc from '@/doc' import api from '@/api' import { AtIcon } from 'taro-ui' @@ -191,7 +198,9 @@ export default function WgtHotranking(props) { {item.itemName || item.title} - + + {getCurrencySymbol()} + {item.mainPrice || (item.activityPrice diff --git a/src/pages/home/wgts/nearby-shop.js b/src/pages/home/wgts/nearby-shop.js index ba66dece7..e5836db09 100644 --- a/src/pages/home/wgts/nearby-shop.js +++ b/src/pages/home/wgts/nearby-shop.js @@ -11,7 +11,16 @@ import { useAsyncCallback } from '@/hooks' import doc from '@/doc' import api from '@/api' import { SpNoShop, SpImage, SpShopCoupon, SpPrice, SpGoodsItem, SpSkuSelect } from '@/components' -import { classNames, styleNames, isEmpty, entryLaunch, showToast, pickBy, isString } from '@/utils' +import { + classNames, + styleNames, + isEmpty, + entryLaunch, + showToast, + pickBy, + isString, + getCurrencySymbol +} from '@/utils' import { AtActivityIndicator } from 'taro-ui' import { useTranslation, $t, ti } from '@/i18n' import { WgtsContext } from './wgts-context' @@ -257,7 +266,10 @@ function WgtNearbyShop(props) { : ti('5eda2f64.9cdbde', [r1.full, r1.freight_fee]) })()} - ¥{item.selfDeliveryRule.freight_fee} + + {getCurrencySymbol()} + {item.selfDeliveryRule.freight_fee} + )} {base.show_coupon && ( @@ -308,7 +320,7 @@ function WgtNearbyShop(props) { > {goods.market_price > 0 && goods.pric > goods.market_price && ( - ¥{goods.market_price / 100} + )} diff --git a/src/pages/home/wgts/speedkill/index.jsx b/src/pages/home/wgts/speedkill/index.jsx index 01dfebce7..9e80d9748 100644 --- a/src/pages/home/wgts/speedkill/index.jsx +++ b/src/pages/home/wgts/speedkill/index.jsx @@ -6,7 +6,14 @@ import React, { useState, useEffect, useMemo, useContext } from 'react' import Taro from '@tarojs/taro' import { View, Text } from '@tarojs/components' import { SpImage } from '@/components' -import { classNames, styleNames, linkPage, pickBy, getDistributorId } from '@/utils' +import { + classNames, + styleNames, + linkPage, + pickBy, + getDistributorId, + getCurrencySymbol +} from '@/utils' import doc from '@/doc' import api from '@/api' import { AtIcon } from 'taro-ui' @@ -256,7 +263,9 @@ export default function WgtSpeedkill(props) { {$t('597601cb.c0a30e')} - + + {getCurrencySymbol()} + {item.mainPrice || (item.activityPrice diff --git a/src/pages/purchase/auth.js b/src/pages/purchase/auth.js index 6941f712f..6d9d4dd07 100644 --- a/src/pages/purchase/auth.js +++ b/src/pages/purchase/auth.js @@ -179,7 +179,8 @@ function PurchaseAuth() { const data = await api.purchase.getActivitydata({ activity_id: activity_id }) - const candidate = data?.pic || '' + // 海报图文件名常含中文/空格/括号,需编码后再写入 CSS url() + const candidate = data?.pic ? encodeURI(data.pic) : '' dispatch(updateCurActivityInfo(data || {})) setActivityBg(candidate) setPagesTemplateId(data?.pages_template_id || '') @@ -238,7 +239,7 @@ function PurchaseAuth() { draft.activity_id = _id || '' draft.enterprise_id = enterprise_id || '' }) - return { id: _id, enterprise_id, code } + return { id:_id, enterprise_id, code } } catch (error) { return {} } @@ -421,7 +422,7 @@ function PurchaseAuth() { className={classNames('purchase-passcode__landing', 'purchase-passcode__landing--plain', { 'purchase-passcode__landing--with-bg': Boolean(activityBg) })} - style={activityBg ? { backgroundImage: `url(${activityBg})` } : undefined} + style={activityBg ? { backgroundImage: `url("${activityBg}")` } : undefined} >