bug(custom): eCX-7515

This commit is contained in:
zhangjing1
2025-12-05 14:22:29 +08:00
parent 2f64a8332a
commit 32ec707122
15 changed files with 103 additions and 102 deletions

26
.env
View File

@@ -1,16 +1,16 @@
APP_BASE_URL=
APP_WEBSOCKET=
APP_COMPANY_ID=
APP_PLATFORM=
APP_CUSTOM_SERVER=
APP_HOME_PAGE=
APP_TRACK=
APP_YOUSHU_TOKEN=
APP_ID=
APP_MAP_KEY=
APP_MAP_NAME=
APP_IMAGE_CDN=
APP_DIANWU_URL=
APP_BASE_URL=https://demo-ecshopx.ishopex.cn/api/h5app/wxapp
APP_WEBSOCKET=wss://demo-ecshopx.ishopex.cn/ws
APP_COMPANY_ID=38
APP_PLATFORM=standard
APP_CUSTOM_SERVER=https://ecshopx-h5.ex-sandbox.com/
APP_HOME_PAGE=/pages/index
APP_TRACK=youshu
APP_YOUSHU_TOKEN=bi281e87ab2424481a
APP_ID=wx1e25e45145b70faa
APP_MAP_KEY=PSPBZ-KQ5CW-CSGRF-ON2S4-K2HQJ-XEBQG
APP_MAP_NAME=oneX新零售门店定位
APP_IMAGE_CDN=https://b-img-cdn.yuanyuanke.cn/ecshopx-vshop
APP_DIANWU_URL=https://demo-ecshopx-dianwu.shopex123.com
APP_MERCHANT_URL=
APP_ADAPAY=

View File

@@ -206,7 +206,7 @@ const SpPage = memo(
useDidShow(() => {
const { page, router } = getCurrentInstance()
const fidx = Object.values(TABBAR_PATH).findIndex((v) => v == router?.path.split('?')[0])
const fidx = Object.values(TABBAR_PATH()).findIndex((v) => v == router?.path.split('?')[0])
const isTabBarPage = fidx > -1
setState((draft) => {
draft.showLeftContainer = !['/subpages/guide/index', '/pages/index'].includes(

View File

@@ -24,8 +24,8 @@ function SpTabbar(props) {
return {
title: item.text,
name: item.name,
iconType: item.iconPath ? '' : TABBAR_ICON[item.name],
selectedIconType: item.selectedIconPath ? '' : `${TABBAR_ICON[item.name]}-fill`,
iconType: item.iconPath ? '' : TABBAR_ICON()[item.name],
selectedIconType: item.selectedIconPath ? '' : `${TABBAR_ICON()[item.name]}-fill`,
iconPrefixClass: 'iconfont icon',
image: item.iconPath,
selectedImage: item.selectedIconPath,
@@ -49,13 +49,13 @@ function SpTabbar(props) {
if (currentPage == '/pages/custom/custom-page') {
return tab.customPageId && customPageId == tab.customPageId
} else {
if (routerIntercept.routes?.[process.env.APP_PLATFORM]?.[TABBAR_PATH[tab.name]]) {
if (routerIntercept.routes?.[process.env.APP_PLATFORM]?.[TABBAR_PATH()[tab.name]]) {
return (
routerIntercept.routes?.[process.env.APP_PLATFORM]?.[TABBAR_PATH[tab.name]] ==
routerIntercept.routes?.[process.env.APP_PLATFORM]?.[TABBAR_PATH()[tab.name]] ==
currentPage
)
} else {
return TABBAR_PATH[tab.name] == currentPage
return TABBAR_PATH()[tab.name] == currentPage
}
}
})
@@ -70,20 +70,20 @@ function SpTabbar(props) {
// 如果是跳转自定义页面则判断id是否一致
let otherCustomPage =
path == '/pages/custom/custom-page' &&
path == TABBAR_PATH[tabItem.name] &&
path == TABBAR_PATH()[tabItem.name] &&
tabItem.customPageId != customPageId
if (path != TABBAR_PATH[tabItem.name] || otherCustomPage) {
if (path != TABBAR_PATH()[tabItem.name] || otherCustomPage) {
if (tabItem.name == 'purchase') {
dispatch(updateCurDistributorId(null))
}
if (TABBAR_PATH[tabItem.name] !== navipage) {
if (TABBAR_PATH()[tabItem.name] !== navipage) {
let url =
tabItem.name == 'customPage'
? `${TABBAR_PATH[tabItem.name]}?isTabBar=true&id=${tabItem.customPageId}`
: TABBAR_PATH[tabItem.name]
? `${TABBAR_PATH()[tabItem.name]}?isTabBar=true&id=${tabItem.customPageId}`
: TABBAR_PATH()[tabItem.name]
Taro.redirectTo({ url })
} else {
Taro.navigateTo({ url: TABBAR_PATH[tabItem.name] })
Taro.navigateTo({ url: TABBAR_PATH()[tabItem.name] })
}
}
}

View File

@@ -34,13 +34,13 @@ function SpTabbar() {
console.log('customPageId', customPageId, tab.customPageId)
return tab.customPageId && customPageId == tab.customPageId
} else {
if (routerIntercept.routes?.[process.env.APP_PLATFORM]?.[TABBAR_PATH[tab.name]]) {
if (routerIntercept.routes?.[process.env.APP_PLATFORM]?.[TABBAR_PATH()[tab.name]]) {
return (
routerIntercept.routes?.[process.env.APP_PLATFORM]?.[TABBAR_PATH[tab.name]] ==
routerIntercept.routes?.[process.env.APP_PLATFORM]?.[TABBAR_PATH()[tab.name]] ==
currentPage
)
} else {
return TABBAR_PATH[tab.name] == currentPage
return TABBAR_PATH()[tab.name] == currentPage
}
}
})
@@ -67,19 +67,19 @@ function SpTabbar() {
// 如果是跳转自定义页面则判断id是否一致
let otherCustomPage =
path == '/pages/custom/custom-page' &&
path == TABBAR_PATH[tabItem.name] &&
path == TABBAR_PATH()[tabItem.name] &&
tabItem.customPageId != customPageId
if (path != TABBAR_PATH[tabItem.name] || otherCustomPage) {
if (TABBAR_PATH[tabItem.name] !== navipage) {
if (path != TABBAR_PATH()[tabItem.name] || otherCustomPage) {
if (TABBAR_PATH()[tabItem.name] !== navipage) {
let url =
tabItem.name == 'customPage'
? `${TABBAR_PATH[tabItem.name]}?isTabBar=true&id=${
? `${TABBAR_PATH()[tabItem.name]}?isTabBar=true&id=${
tabItem.customPageId || tabItem.customPage.id
}`
: TABBAR_PATH[tabItem.name]
: TABBAR_PATH()[tabItem.name]
Taro.redirectTo({ url })
} else {
Taro.navigateTo({ url: TABBAR_PATH[tabItem.name] })
Taro.navigateTo({ url: TABBAR_PATH()[tabItem.name] })
}
}
}
@@ -116,8 +116,8 @@ function SpTabbar() {
<Text
className={`iconfont ${
index == currentIndex
? `icon-${TABBAR_ICON[item.name]}-fill`
: `icon-${TABBAR_ICON[item.name]}`
? `icon-${TABBAR_ICON()[item.name]}-fill`
: `icon-${TABBAR_ICON()[item.name]}`
}`}
></Text>
)}

View File

@@ -2,14 +2,14 @@
* Copyright © ShopeX http://www.shopex.cn. All rights reserved.
* See LICENSE file for license details.
*/
export const STATUS_TYPES_MAP = {
export const STATUS_TYPES_MAP = () => ({
NOTPAY: 'WAIT_BUYER_PAY',
PAYED: 'WAIT_SELLER_SEND_GOODS',
WAIT_BUYER_CONFIRM: 'WAIT_BUYER_CONFIRM_GOODS',
DONE: 'TRADE_SUCCESS',
CANCEL: 'TRADE_CLOSED',
PART_PAYMENT: 'WAIT_BUYER_PAY'
}
})
export const ORDER_STATUS_INFO = () => ({
NOTPAY: {
@@ -157,17 +157,17 @@ export const ACTIVITY_STATUS = () => ({
export const DEFAULT_POINT_NAME = () => '积分'
export const DEFAULT_THEME = {
export const DEFAULT_THEME = () => ({
colorPrimary: '#d42f29',
colorMarketing: '#fba629',
colorAccent: '#2e3030'
}
})
export const WGTS_NAV_MAP = {
export const WGTS_NAV_MAP = () => ({
luckdraw: '/pages/member/point-draw'
}
})
export const TABBAR_PATH = {
export const TABBAR_PATH = () => ({
home: '/pages/index',
category: '/pages/category/index',
cart: '/pages/cart/espier-index',
@@ -178,9 +178,9 @@ export const TABBAR_PATH = {
ugc: '/subpages/mdugc/index',
customPage: '/pages/custom/custom-page',
purchase: '/subpages/purchase/select-identity?is_redirt=1'
}
})
export const TABBAR_ICON = {
export const TABBAR_ICON = () => ({
home: 'shouye',
category: 'fenlei',
cart: 'gwche',
@@ -189,21 +189,21 @@ export const TABBAR_ICON = {
liveroom: 'zhibo',
allGoods: 'quanbushangpin',
ugc: 'shequ'
}
})
export const PURCHASE_TABBAR_PATH = {
export const PURCHASE_TABBAR_PATH = () => ({
home: '/subpages/purchase/index',
category: '/subpages/purchase/category',
cart: '/subpages/purchase/espier-index',
member: '/subpages/purchase/member'
}
})
export const PURCHASE_TABBAR_ICON = {
export const PURCHASE_TABBAR_ICON = () => ({
home: 'shouye',
category: 'fenlei',
cart: 'gwche',
member: 'huiyuan'
}
})
export const BUY_TOOL_BTNS = () => ({
NOTICE: { title: '到货通知', key: 'notice', btnStatus: 'active' },
@@ -250,13 +250,13 @@ export const COUPON_TYPE = () => ({
}
})
export const PAYTYPE = {
export const PAYTYPE = () => ({
/** h5环境下 */
WXH5: 'wxpayh5',
ALIH5: 'alipayh5',
/** 微信H5环境下 */
WXH5JS: 'wxpayjs'
}
})
export const PAYMENT_TYPE = () => ({
wxpay: '微信支付',
@@ -281,7 +281,7 @@ export const PAYMENT_TYPE = () => ({
offline_pay: '线下转账'
})
export const TRANSFORM_PAYTYPE = {
export const TRANSFORM_PAYTYPE = () => ({
'wxpayh5': 'wxpayh5',
'alipayh5': 'alipay',
'wxpayjs': 'wxpayjs',
@@ -290,7 +290,7 @@ export const TRANSFORM_PAYTYPE = {
'alipayapp': 'alipay',
'adapay': 'adapay',
'point': 'point'
}
})
export const POINT_TYPE = () => ({
1: '注册送积分',
@@ -307,7 +307,7 @@ export const POINT_TYPE = () => ({
12: '管理员手动调整积分'
})
export const FORM_COMP = {
export const FORM_COMP = () => ({
INPUT: 1,
NUMBER: 2,
DATE: 3,
@@ -315,13 +315,13 @@ export const FORM_COMP = {
CHECKBOX: 5,
MOBILE: 6,
IMAGE: 7
}
})
export const CHIEF_APPLY_STATUS = {
export const CHIEF_APPLY_STATUS = () => ({
WAITE: 0,
RESLOVE: 1,
REJECT: 2
}
})
export const GOODS_TYPE = () => ({
'normal': '普通商品',
@@ -354,13 +354,13 @@ export const enumdays = () => ({
2: '后天'
})
export const infotype = {
export const infotype = () => ({
SYSTEM: 'system',
REPLY: 'reply',
LIKE: 'like',
FAVORITEPOST: 'favoritePost',
FOLLOWERUSER: 'followerUser'
}
})
export const DELIVERY_PERSONNEL_INFORMATION = () => [
{

View File

@@ -266,7 +266,7 @@ export default (props = {}) => {
const { config: appPayConfig } = await api.cashier.getPayment(query)
try {
await Taro.SAPPPay.payment({
id: TRANSFORM_PAYTYPE[pay_type],
id: TRANSFORM_PAYTYPE()[pay_type],
order_params: appPayConfig
})
Taro.redirectTo({ url: `${cashierResultUrl}?order_id=${order_id}` })

View File

@@ -8,10 +8,10 @@ import { hex2rgb } from '@/utils'
//没有则获取正确的颜色
function getColor(field, value) {
return value ? value : DEFAULT_THEME[field]
return value ? value : DEFAULT_THEME()[field]
}
const { colorPrimary, colorMarketing, colorAccent } = DEFAULT_THEME
const { colorPrimary, colorMarketing, colorAccent } = DEFAULT_THEME()
const initialState = {
initState: false,

View File

@@ -28,7 +28,7 @@ export default class Cashier extends Component {
info: null,
env: '',
isHasAlipay: true,
payType: PAYTYPE.WXH5
payType: PAYTYPE().WXH5
}
componentDidShow() {
@@ -50,7 +50,7 @@ export default class Cashier extends Component {
}
async fetch() {
const { order_id, pay_type = PAYTYPE.WXH5, id } = this.$instance.router.params
const { order_id, pay_type = PAYTYPE().WXH5, id } = this.$instance.router.params
let env = ''
if (browser.weixin) {
@@ -120,10 +120,10 @@ export default class Cashier extends Component {
</View>
{!env ? (
<View>
{isHasAlipay && payType === PAYTYPE.ALIH5 && (
{isHasAlipay && payType === PAYTYPE().ALIH5 && (
<AlipayPay orderID={info.order_id} payType='alipayh5' orderType={info.order_type} />
)}
{payType === PAYTYPE.WXH5 && <WeH5Pay orderID={info.order_id} />}
{payType === PAYTYPE().WXH5 && <WeH5Pay orderID={info.order_id} />}
</View>
) : (
<View>

View File

@@ -75,16 +75,16 @@ function ApplyChief(props) {
_defaultMsg = '',
_defaultImg = ''
// 待审核
if (approve_status == CHIEF_APPLY_STATUS.WAITE) {
if (approve_status == CHIEF_APPLY_STATUS().WAITE) {
_isDefault = true
_defaultMsg = '申请审核中,请耐心等待~'
_defaultImg = 'apply_loading.png'
} else if (approve_status == CHIEF_APPLY_STATUS.RESLOVE) {
} else if (approve_status == CHIEF_APPLY_STATUS().RESLOVE) {
// 审核通过
_isDefault = true
_defaultMsg = '恭喜您审核通过!'
_defaultImg = 'apply_success.png'
} else if (approve_status == CHIEF_APPLY_STATUS.REJECT) {
} else if (approve_status == CHIEF_APPLY_STATUS().REJECT) {
// 审核拒绝
_isDefault = true
_defaultMsg = '很抱歉!您的审核未通过'
@@ -117,7 +117,7 @@ function ApplyChief(props) {
if (item.is_required) {
rules[item.key].push({ required: item.is_required, message: item.required_message })
}
if (item.field_type == FORM_COMP.MOBILE) {
if (item.field_type == FORM_COMP().MOBILE) {
rules[item.key].push({ validate: 'mobile', message: '请输入正确的手机号码' })
}
})
@@ -163,7 +163,7 @@ function ApplyChief(props) {
const renderFormComp = ({ field_type, required_message, is_edit, key }) => {
let formComp = null
switch (field_type) {
case FORM_COMP.INPUT:
case FORM_COMP().INPUT:
formComp = (
<AtInput
clear
@@ -177,8 +177,8 @@ function ApplyChief(props) {
/>
)
break
case FORM_COMP.NUMBER:
case FORM_COMP.MOBILE:
case FORM_COMP().NUMBER:
case FORM_COMP().MOBILE:
formComp = (
<AtInput
clear
@@ -191,7 +191,7 @@ function ApplyChief(props) {
/>
)
break
case FORM_COMP.DATE:
case FORM_COMP().DATE:
formComp = (
<Picker mode='date' onChange={onDateChange.bind(this, key)}>
<View
@@ -204,7 +204,7 @@ function ApplyChief(props) {
</Picker>
)
break
case FORM_COMP.IMAGE:
case FORM_COMP().IMAGE:
formComp = (
<SpUpload
value={form[key]}
@@ -250,11 +250,11 @@ function ApplyChief(props) {
}
const handleClickDefaultBtn = () => {
if (approveStatus == CHIEF_APPLY_STATUS.RESLOVE) {
if (approveStatus == CHIEF_APPLY_STATUS().RESLOVE) {
Taro.redirectTo({
url: '/subpages/community/index'
})
} else if (approveStatus == CHIEF_APPLY_STATUS.REJECT) {
} else if (approveStatus == CHIEF_APPLY_STATUS().REJECT) {
setState((draft) => {
draft.isDefault = false
})
@@ -271,15 +271,15 @@ function ApplyChief(props) {
renderDefault={
<View
className={classNames('default-view', {
reject: approveStatus == CHIEF_APPLY_STATUS.REJECT
reject: approveStatus == CHIEF_APPLY_STATUS().REJECT
})}
>
<SpNote img={defaultImg} title={defaultMsg} />
{approveStatus == CHIEF_APPLY_STATUS.REJECT && (
{approveStatus == CHIEF_APPLY_STATUS().REJECT && (
<View className='reject-reason'>{refuseReason}</View>
)}
{(approveStatus == CHIEF_APPLY_STATUS.RESLOVE ||
approveStatus == CHIEF_APPLY_STATUS.REJECT) && (
{(approveStatus == CHIEF_APPLY_STATUS().RESLOVE ||
approveStatus == CHIEF_APPLY_STATUS().REJECT) && (
<AtButton circle type='primary' onClick={handleClickDefaultBtn}>
{
{

View File

@@ -17,14 +17,14 @@ const initialState = {
infoList: [],
type: '',
filterList: [
{ tag_id: 1, tag_name: '系统', tag_type: infotype.SYSTEM, icon: 'icon-logo', num: 0 },
{ tag_id: 2, tag_name: '回复', tag_type: infotype.REPLY, icon: 'icon-sixin', num: 0 },
{ tag_id: 3, tag_name: '赞', tag_type: infotype.LIKE, icon: 'icon-aixin', num: 0 },
{ tag_id: 4, tag_name: '收藏', tag_type: infotype.FAVORITEPOST, icon: 'icon-redu', num: 0 },
{ tag_id: 1, tag_name: '系统', tag_type: infotype().SYSTEM, icon: 'icon-logo', num: 0 },
{ tag_id: 2, tag_name: '回复', tag_type: infotype().REPLY, icon: 'icon-sixin', num: 0 },
{ tag_id: 3, tag_name: '赞', tag_type: infotype().LIKE, icon: 'icon-aixin', num: 0 },
{ tag_id: 4, tag_name: '收藏', tag_type: infotype().FAVORITEPOST, icon: 'icon-redu', num: 0 },
{
tag_id: 5,
tag_name: '关注',
tag_type: infotype.FOLLOWERUSER,
tag_type: infotype().FOLLOWERUSER,
icon: 'icon-gerenzhongxin',
num: 0
}
@@ -102,9 +102,9 @@ function UgcFollowFans() {
const goToPage = (item) => {
console.log(item)
const { type, sub_type, postInfo, from_user_id } = item
if (type === infotype.SYSTEM && sub_type === 'refusePost') {
if (type === infotype().SYSTEM && sub_type === 'refusePost') {
Taro.navigateTo({ url: `/subpages/mdugc/note?post_id=${postInfo.post_id}` })
} else if (type === infotype.FOLLOWERUSER) {
} else if (type === infotype().FOLLOWERUSER) {
Taro.navigateTo({ url: `/subpages/mdugc/my?user_id=${from_user_id}` })
} else {
Taro.navigateTo({ url: `/subpages/mdugc/note-detail?post_id=${postInfo.post_id}` })

View File

@@ -44,12 +44,12 @@ function CompTabbar(props) {
return {
title: item.text,
name: item.name,
iconType: item.iconPath ? '' : PURCHASE_TABBAR_ICON[item.name],
selectedIconType: item.selectedIconPath ? '' : `${PURCHASE_TABBAR_ICON[item.name]}-fill`,
iconType: item.iconPath ? '' : PURCHASE_TABBAR_ICON()[item.name],
selectedIconType: item.selectedIconPath ? '' : `${PURCHASE_TABBAR_ICON()[item.name]}-fill`,
iconPrefixClass: 'iconfont icon',
image: item.iconPath,
selectedImage: item.selectedIconPath,
url: PURCHASE_TABBAR_PATH[item.name],
url: PURCHASE_TABBAR_PATH()[item.name],
urlRedirect: true,
text: item.text.indexOf('购物车') > -1 && cartCount > 0 ? cartCount : null,
max: item.max
@@ -61,13 +61,13 @@ function CompTabbar(props) {
if (pages.length > 0) {
const currentPage = pages[pages.length - 1].route
currentIndex = tabList?.findIndex((tab) => {
if (routerIntercept.routes?.[process.env.APP_PLATFORM]?.[PURCHASE_TABBAR_PATH[tab.name]]) {
if (routerIntercept.routes?.[process.env.APP_PLATFORM]?.[PURCHASE_TABBAR_PATH()[tab.name]]) {
return (
routerIntercept.routes?.[process.env.APP_PLATFORM]?.[PURCHASE_TABBAR_PATH[tab.name]] ==
routerIntercept.routes?.[process.env.APP_PLATFORM]?.[PURCHASE_TABBAR_PATH()[tab.name]] ==
`/${currentPage}`
)
} else {
return PURCHASE_TABBAR_PATH[tab.name] == `/${currentPage}`
return PURCHASE_TABBAR_PATH()[tab.name] == `/${currentPage}`
}
})
}

View File

@@ -272,7 +272,7 @@ function PurchaseCheckout(props) {
try {
const h5ResInfo = await api.trade.h5create({
...params,
pay_type: isAPP() ? payType : TRANSFORM_PAYTYPE[payType]
pay_type: isAPP() ? payType : TRANSFORM_PAYTYPE()[payType]
})
orderInfo = h5ResInfo
orderId = h5ResInfo.order_id

View File

@@ -58,6 +58,7 @@ function CompTradeCancel(props) {
className={classNames('reason-item', {
'active': index === reasonIndex
})}
key={`reason-item-${index}`}
onClick={() => {
setState((draft) => {
draft.reasonIndex = index

View File

@@ -309,7 +309,7 @@ function TradeDetail(props) {
const getTradeStatusIcon = () => {
if (info.receiptType == 'dada') {
// 达达同城配,订单状态单独处理
return `${ORDER_DADA_STATUS[info.dada?.dadaStatus]?.icon}.png` || ''
return `${ORDER_DADA_STATUS()[info.dada?.dadaStatus]?.icon}.png` || ''
}
if (squareRoot) {
@@ -323,13 +323,13 @@ function TradeDetail(props) {
if (info.cancelStatus == 'WAIT_PROCESS') {
return 'order_dengdai.png'
}
return `${ORDER_STATUS_INFO[info.orderStatus]?.icon}.png`
return `${ORDER_STATUS_INFO()[info.orderStatus]?.icon}.png`
}
const getTradeStatusDesc = () => {
if (info.receiptType == 'dada') {
// 达达同城配,订单状态单独处理
return ORDER_DADA_STATUS[info.dada?.dadaStatus]?.msg
return ORDER_DADA_STATUS()[info.dada?.dadaStatus]?.msg
} else if (squareRoot) {
return '待医生开方'
} else if (supplement) {
@@ -348,7 +348,7 @@ function TradeDetail(props) {
//展示线下审核的一些状态 0 待处理;1 已审核;2 已拒绝;9 已取消
return '待商家确认'
} else {
return ORDER_STATUS_INFO[info.orderStatus]?.msg
return ORDER_STATUS_INFO()[info.orderStatus]?.msg
}
}

View File

@@ -313,10 +313,10 @@ export function calcTimer(totalSec) {
export function resolveOrderStatus(status, isBackwards) {
if (isBackwards) {
return _findKey(STATUS_TYPES_MAP, (o) => o === status)
return _findKey(STATUS_TYPES_MAP(), (o) => o === status)
}
return STATUS_TYPES_MAP[status]
return STATUS_TYPES_MAP()[status]
}
export function goToPage(page) {