merge(custom): merge

This commit is contained in:
lukaijie
2025-08-04 11:35:57 +08:00
37 changed files with 694 additions and 1498 deletions

View File

@@ -1,16 +0,0 @@
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=

1
.gitignore vendored
View File

@@ -11,5 +11,4 @@ dist/
.history
.swc
.vscode
.env
.env.local

View File

@@ -1,15 +1,3 @@
[Ecshopx测试环境--生产标准测试版]
appid = wx5e27f0cc25fa9898
base_url = https://b.yuanyuanke.cn/api/h5app/wxapp
app_name = 通用小程序
websocket = wss://b-websocket.yuanyuanke.cn/ws
company_id = 1
platform = standard
custom_server = https://b.yuanyuanke.cn
home_page = /pages/index
map_key = PVUBZ-E24HK-7SXJY-AGQZC-DN3IT-6EB6V
map_name = oneX新零售门店定位
image_cdn = https://b-img-cdn.yuanyuanke.cn/ecshopx-vshop
[Ecshopx测试环境--标准版]
appid = wx912913df9fef6ddd
@@ -1059,4 +1047,32 @@ home_page = /pages/index
map_key = NWBBZ-NKJ6J-LMOFT-D3LBD-IEYKE-JRFOY
map_name = oneX新零售门店定位
image_cdn = https://b-img-cdn.yuanyuanke.cn/ecshopx-vshop
dianwu_url=
dianwu_url=
[辉绮-生产]
appid = wx27fc041381fe1e0d
base_url = https://dtc.amandax.com.cn/api/h5app/wxapp
app_name = 通用小程序
websocket = wss://dtc.amandax.com.cn/ws
company_id = 1
platform = standard
custom_server = https://dtc.amandax.com.cn
home_page = /pages/index
map_key = NWBBZ-NKJ6J-LMOFT-D3LBD-IEYKE-JRFOY
map_name = oneX新零售门店定位
image_cdn = https://b-img-cdn.yuanyuanke.cn/ecshopx-vshop
dianwu_url=
[辉绮-sit]
appid = wx27fc041381fe1e0d
base_url = https://test-dtc-sit.amandax.com.cn/api/h5app/wxapp
app_name = 通用小程序
websocket = wss://test-dtc.amandax.com.cn/ws
company_id = 1
platform = standard
custom_server = https://test-dtc-sit.amandax.com.cn
home_page = /pages/index
map_key = NWBBZ-NKJ6J-LMOFT-D3LBD-IEYKE-JRFOY
map_name = oneX新零售门店定位
image_cdn = https://b-img-cdn.yuanyuanke.cn/ecshopx-vshop

View File

@@ -2,7 +2,7 @@ import path from 'path'
import pkg from '../package.json'
const webpackPluginsAutoI18n = require('webpack-auto-i18n-plugin')
const { YoudaoTranslator } = require('webpack-auto-i18n-plugin')
const { YoudaoTranslator, EmptyTranslator } = require('webpack-auto-i18n-plugin')
const chalk = require('chalk')
const { getEnvs, getDefineConstants, getCacheIdentifier } = require('./utils')
@@ -82,8 +82,8 @@ const config = {
defineConstants: getDefineConstants(CONST_ENVS),
alias: {
'taro-ui$': 'taro-ui/lib/index',
'@': path.join(__dirname, '../src'),
'@lang': path.join(__dirname, '../lang')
'@': path.join(__dirname, '../src')
// '@lang': path.join(__dirname, '../lang')
// 'lodash': 'lodash-es'
},
copy: {
@@ -98,7 +98,6 @@ const config = {
}
},
plugins: [
// i18nPlugin
// '@shopex/taro-plugin-modules',
// path.join(__dirname, "../src/plugin/test.js")
// path.join(__dirname, "./modify-taro.js")
@@ -106,9 +105,25 @@ const config = {
mini: {
webpackChain(chain) {
if (process.env.APP_I18N_APP_ID && process.env.APP_I18N_APP_KEY) {
chain.plugin('auto-i18n').use(webpackPluginsAutoI18n.default, [AutoI18nOptions])
}
chain.plugin('auto-i18n').use(webpackPluginsAutoI18n.default, [
{
rewriteConfig: false, // 是否重写配置js 小程序需要魔改配置文件,所以不要重新生成,以现在的为准
excludedPath: [
path.resolve(__dirname, './../src/lang/index.js'),
path.resolve(__dirname, './../src/lang/consts.js')
],
globalPath: path.resolve(__dirname, './../src/subpages/i18n/lang'),
targetLangList: ['en', 'zh-tw'], // 目标语言
originLang: 'zh-cn', // 源语言
translator: process.env.APP_I18N_APP_KEY
? new YoudaoTranslator({
appId: process.env.APP_I18N_APP_ID,
appKey: process.env.APP_I18N_APP_KEY
})
: new EmptyTranslator(),
includePath: [/src/] // 仅扫描 src 目录
}
])
},
miniCssExtractPluginOption: {

693
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -8,13 +8,13 @@
"clean": "rm -rf node_modules/.cache",
"release:h5": "RELEASE=h5 npm run build:h5",
"lint": "prettier-eslint 'src/**/*.{js,jsx}' --write",
"build:weapp": "cross-env taro build --type weapp --trace-warnings",
"build:weapp": "taro build --type weapp --trace-warnings",
"build:weapp:live": "cross-env APP_LIVE=true taro build --type weapp --trace-warnings",
"build:swan": "cross-env taro build --type swan",
"build:alipay": "cross-env taro build --type alipay",
"build:tt": "cross-env taro build --type tt",
"build:h5": "cross-env taro build --type h5",
"build:rn": "cross-env taro build --type rn",
"build:swan": "taro build --type swan",
"build:alipay": "taro build --type alipay",
"build:tt": "taro build --type tt",
"build:h5": "taro build --type h5",
"build:rn": "taro build --type rn",
"build:app": "cross-env TARGET=app taro build --type h5",
"build:app:server": "cross-env TARGET=app SERVER=server taro build --type h5",
"dev:weapp": "npm run build:weapp -- --watch",

View File

@@ -70,6 +70,17 @@ function App({ children }) {
checkAppVersion()
}
// 导购参数缓存处理
const guideUpdateTime = Taro.getStorageSync(SG_GUIDE_PARAMS_UPDATETIME) || 0
if (guideUpdateTime != 0) {
const diffMilliseconds = dayjs().diff(dayjs(guideUpdateTime))
// 参数保存超过3天清除导购参数
if (diffMilliseconds > 3 * 86400000) {
Taro.removeStorageSync(SG_GUIDE_PARAMS)
Taro.removeStorageSync(SG_GUIDE_PARAMS_UPDATETIME)
}
}
const { show_time } = await api.promotion.getScreenAd()
let showAdv
if (show_time === 'always') {
@@ -79,34 +90,35 @@ function App({ children }) {
payload: showAdv
})
}
getSystemConfig()
// 导购参数缓存处理
const guideUpdateTime = Taro.getStorageSync(SG_GUIDE_PARAMS_UPDATETIME) || 0
const diffMilliseconds = dayjs().diff(dayjs(guideUpdateTime))
// 参数保存超过3天清除导购参数
if (diffMilliseconds > 3 * 86400000) {
Taro.removeStorageSync(SG_GUIDE_PARAMS)
Taro.removeStorageSync(SG_GUIDE_PARAMS_UPDATETIME)
}
}, [])
useLaunch((options) => {
console.log('useLaunch ***********', options)
// __non_webpack_require__ &&
// __non_webpack_require__('subpages/i18n/index', (res) => {
// const langJSON = Taro['langJSON']
// console.log('langJSON--------', langJSON)
// langObj.setLanguagePackage(langJSON)
// })
// 分包异步加载语言包
__non_webpack_require__ &&
__non_webpack_require__('subpages/i18n/index', (res) => {
const langJSON = Taro['langJSON']
console.log('langJSON--------', langJSON)
langObj.setLanguagePackage(langJSON)
})
})
useDidShow(async (options) => {
console.log('useDidShow &&&&&&&&&&&&', options)
entryLaunch.getRouteParams(isWeb ? { query: options } : options).then((params) => {
console.log(`app componentDidShow:`, options, params)
Taro.setStorageSync(SG_ROUTER_PARAMS, params)
if (params.gu || params.gu_user_id) {
Taro.setStorageSync(SG_GUIDE_PARAMS, {
...params,
gu_user_id: params.gu_user_id || params.gu.split('_')[0]
})
Taro.setStorageSync(SG_GUIDE_PARAMS_UPDATETIME, dayjs().unix() * 1000)
}
console.log(`app componentDidShow:`, params)
if (typeof params.runFlag === 'undefined') {
Taro.setStorageSync(SG_CHECK_STORE_RULE, 0)
@@ -115,11 +127,8 @@ function App({ children }) {
Taro.removeStorageSync(SG_GUIDE_PARAMS)
Taro.removeStorageSync(SG_GUIDE_PARAMS_UPDATETIME)
}
}
if (params.gu || params.gu_user_id) {
Taro.setStorageSync(SG_GUIDE_PARAMS, params)
Taro.setStorageSync(SG_GUIDE_PARAMS_UPDATETIME, dayjs().unix())
getSystemConfig()
}
})
})
@@ -182,7 +191,7 @@ function App({ children }) {
entryStoreByStoreCode: enterStoreRule?.distributor_code,
entryStoreByGuideMaterial: enterStoreRule?.shop_assistant,
enterStoreWhiteList: enterStoreRule?.white_list,
enterStoreWhiteList: enterStoreRule?.shop_white,
entryStoreByGuide: enterStoreRule?.shop_assistant_pro,
entryStoreByLBS: enterStoreRule?.shop_lbs,
entryDefalutStore: enterStoreRule?.radio_type,

View File

@@ -152,12 +152,14 @@ function SpGoodsItem(props) {
<View className='bd-block'>
{/* 商品价格、积分 */}
{info.point && (
{info.point && info.point > 0 ? (
<View className='goods-point'>
<SpPoint value={info.point} />
{info.price > 0 ? <Text style='margin: 0 4px;'>+</Text> : ''}
{info.price > 0 ? <SpPrice primary size={32} value={info.price} /> : ''}
</View>
) : (
''
)}
{!info.point && showPrice && (
@@ -231,13 +233,15 @@ function SpGoodsItem(props) {
</View>
)}
{showAddCart && (
{showAddCart ? (
<View onClick={(e) => onChangeToolBar(e)}>
<Text className='iconfont icon-gouwuche2' />
</View>
) : (
''
)}
{info.point && <View className='btn-exchange'>兑换</View>}
{info.point && info.point > 0 ? <View className='btn-exchange'>兑换</View> : ''}
</View>
</View>

View File

@@ -395,6 +395,25 @@ const SpPage = memo(
/>
)
}
if (citem.id == 'homeSearch') {
return (
<View
key={citem.id}
className='img-hotzone_zone'
style={styleNames({
width: `${citem.widthPer * 100}%`,
height: `${citem.heightPer * 100}%`,
top: `${citem.topPer * 100}%`,
left: `${citem.leftPer * 100}%`
})}
onClick={() => {
Taro.navigateTo({
url: '/pages/item/list'
})
}}
/>
)
}
return (
<View
key={citem.id}
@@ -437,6 +456,8 @@ const SpPage = memo(
)
}
console.log('customNavigation:', state.customNavigation)
return (
<View
className={classNames('sp-page', props.className)}

View File

@@ -405,7 +405,7 @@ export const ESPIER_DETAIL_GOODS_INFO = {
point: 'point',
isPoint: () => is_point,
price: ({ price }) => price / 100, // 销售价
activityPrice: ({ activity_price }) => activity_price / 100, // 秒杀价
activityPrice: ({ activity_price, act_price }) => (activity_price || act_price) / 100, // 秒杀价
marketPrice: ({ market_price }) => market_price / 100, // 原价
memberPrice: ({ member_price }) => member_price / 100, // 当前会员等级价
vipPrice: ({ vip_price }) => vip_price / 100, // vip价格

View File

@@ -29,7 +29,7 @@ const JOURNAL_TYPE = {
export const POINT_LIST_ITEM = {
journalType: ({ journal_type }) => JOURNAL_TYPE[journal_type],
outinType: 'outin_type',
outinType: ({ income, outcome }) => (income ? 'in' : outcome ? 'out' : ''),
point: ({ point }) => thousandthFormat(point),
orderId: 'order_id',
created: ({ created }) => formatDateTime(created)

View File

@@ -16,6 +16,7 @@ function withPageWrapper(Component) {
return function EnhancedComponent(props) {
const dispatch = useDispatch()
const { initState, entryDefalutStore, guidderTemplateId } = useSelector((state) => state.sys)
const { shopInfo } = useSelector((state) => state.shop)
const {
checkEnterStoreRule,
checkStoreWhiteList,
@@ -28,30 +29,44 @@ function withPageWrapper(Component) {
useEffectAsync(async () => {
if (initState) {
// 启动时(冷启动+热启动)执行云店进店规则
if (VERSION_STANDARD && Taro.getStorageSync(SG_CHECK_STORE_RULE) == 0) {
// 云店进店规则
try {
Taro.setStorageSync(SG_CHECK_STORE_RULE, 1)
await checkEnterStoreRule()
setState(true)
} catch (error) {
// 检查店铺开启了白名单,需要登录授权
if (error.message == 'AUTH_REQUIRED') {
await handleToLogin()
await handleStoreWhiteList()
setState(true)
} else if (error.message == 'CHECK_WHITE_LIST') {
await handleStoreWhiteList()
setState(true)
}
}
} else {
setState(true)
}
resolveInStoreRule()
}
}, [initState])
useEffect(() => {
if (state) {
setState(false)
setTimeout(() => {
resolveInStoreRule()
}, 1000)
}
}, [shopInfo])
const resolveInStoreRule = async () => {
// 启动时(冷启动+热启动)执行云店进店规则
if (VERSION_STANDARD && Taro.getStorageSync(SG_CHECK_STORE_RULE) == 0) {
// 云店进店规则
try {
Taro.setStorageSync(SG_CHECK_STORE_RULE, 1)
await checkEnterStoreRule()
setState(true)
} catch (error) {
// 检查店铺开启了白名单,需要登录授权
if (error.message == 'AUTH_REQUIRED') {
await handleToLogin()
await handleStoreWhiteList()
setState(true)
} else if (error.message == 'CHECK_WHITE_LIST') {
await handleStoreWhiteList()
setState(true)
}
}
} else {
setState(true)
}
}
const handleToLogin = async () => {
try {
await showLoinModal()
@@ -59,14 +74,27 @@ function withPageWrapper(Component) {
const res = await showModal({
title: '提示',
content: '你还未登录,请先登录!',
cancelText: '退出',
cancelText: '返回',
confirmText: '继续登录',
contentAlign: 'center'
})
if (res.confirm) {
await handleToLogin()
} else {
Taro.exitMiniProgram()
// 返回兜底店铺逻辑
if (entryDefalutStore == '1') {
try {
await checkStoreWhiteList(null, false)
} catch (err) {
await handleToLogin()
}
} else {
Taro.redirectTo({
url: `/pages/custom/custom-page?id=${guidderTemplateId}&fromConnect=davild`
})
throw new Error('TO_STORE_GUIDE_PAGE')
}
// Taro.exitMiniProgram()
}
}
}
@@ -85,11 +113,16 @@ function withPageWrapper(Component) {
})
if (res.confirm) {
if (entryDefalutStore == '1') {
await checkStoreWhiteList()
try {
await checkStoreWhiteList(null, false)
} catch (err) {
await handleStoreWhiteList()
}
} else {
Taro.redirectTo({
url: `/pages/custom/custom-page?id=${guidderTemplateId}&fromConnect=davild`
})
throw new Error('TO_STORE_GUIDE_PAGE')
}
// Taro.exitMiniProgram()
// throw new Error('EXIT_MINI_PROGRAM')
@@ -121,7 +154,6 @@ function withPageWrapper(Component) {
dispatch(updateShopInfo(myShopInfo))
}
}
if (state) {
return <Component {...props} />
} else {

View File

@@ -8,15 +8,13 @@ import S from '@/spx'
export default (props) => {
const dispatch = useDispatch()
const { location } = useSelector((state) => state.user)
const { open_divided } = useSelector((state) => state.sys)
/**
* 未登录状态 && 授权定位 == 定位
* 未登录状态 && 不授权定位 == 默认值
*/
const updateAddress = async () => {
// open_divided店铺隔离只取定位地址
if (S.getAuthToken() && !open_divided) {
if (S.getAuthToken()) {
await addressLogic()
} else {
const res1 = await fetchLocation()

View File

@@ -3,10 +3,11 @@ import { useSelector, useDispatch } from 'react-redux'
import Taro from '@tarojs/taro'
import api from '@/api'
import S from '@/spx'
import { pickBy, getDistributorId } from '@/utils'
import { pickBy, getDistributorId, entryLaunch, isEmpty } from '@/utils'
import doc from '@/doc'
import { useShopInfo } from '@/hooks'
import { updateShopInfo } from '@/store/slices/shop'
import { updateLocation } from '@/store/slices/user'
import { SG_ROUTER_PARAMS, SG_GUIDE_PARAMS } from '@/consts/localstorage'
import configStore from '@/store'
@@ -25,28 +26,35 @@ export default () => {
const shopInfoRef = useRef(null)
const checkStoreWhiteList = async (dtid) => {
const checkStoreWhiteList = async (dtid, isLocation = true) => {
const params = {}
if (dtid) {
params['distributor_id'] = dtid
} else if (entryStoreByLBS) {
params['lat'] = location?.lat
params['lng'] = location?.lng
} else if (entryStoreByLBS && isLocation) {
if (isEmpty(location)) {
const locationInfo = await entryLaunch.getLocationInfo()
dispatch(updateLocation(locationInfo))
params['lat'] = locationInfo?.lat
params['lng'] = locationInfo?.lng
} else {
params['lat'] = location?.lat
params['lng'] = location?.lng
}
}
// 开启店铺码进店
const currentShopInfo = await api.shop.getShop(params)
shopInfoRef.current = currentShopInfo
// 如果请求的店铺ID和接口返回的店铺ID不一致店铺可能关闭或禁用此时需要根据兜底策略来决定跳转到引导页和默认店铺页
if (
dtid > 0 &&
currentShopInfo.distributor_id !== 0 &&
currentShopInfo.distributor_id !== dtid &&
entryDefalutStore === '2'
entryDefalutStore == '2'
) {
Taro.redirectTo({
url: `/pages/custom/custom-page?id=${guidderTemplateId}&fromConnect=davild`
})
throw new Error('TO_STORE_GUIDE_PAGE')
}
if (currentShopInfo.distributor_id !== 0 && currentShopInfo.open_divided == '1') {
@@ -65,7 +73,6 @@ export default () => {
const checkEnterStoreRule = async () => {
const { dtid } = Taro.getStorageSync(SG_ROUTER_PARAMS)
const { gu_user_id } = Taro.getStorageSync(SG_GUIDE_PARAMS) // gu_user_id = 导购工号
// 路由带参
if (dtid) {
if (entryStoreByStoreCode) {
@@ -82,38 +89,42 @@ export default () => {
work_userid: gu_user_id
})
if (guideStoreInfo?.distributor_id) {
await checkStoreWhiteList(guideStoreInfo?.distributor_id)
await checkStoreWhiteList(guideStoreInfo?.distributor_id, false)
} else {
// 兜底策略
if (entryDefalutStore === '1') {
if (entryDefalutStore == '1') {
// 当前导购未绑定店铺
await checkStoreWhiteList()
} else if (entryDefalutStore === '2') {
await checkStoreWhiteList(null, false)
} else if (entryDefalutStore == '2') {
Taro.redirectTo({
url: `/pages/custom/custom-page?id=${guidderTemplateId}&fromConnect=davild`
})
throw new Error('TO_STORE_GUIDE_PAGE')
}
}
} else {
await checkStoreWhiteList()
}
} else {
// 进入专属导购所属店
if (entryStoreByGuide && S.getAuthToken()) {
const guideStoreInfo = await api.shop.checkStoreEnterRule()
if (guideStoreInfo?.distributor_id) {
await checkStoreWhiteList(guideStoreInfo?.distributor_id)
} else {
// 兜底策略
if (entryDefalutStore === '1') {
if (entryDefalutStore == '1') {
// 当前导购未绑定店铺
await checkStoreWhiteList()
} else if (entryDefalutStore === '2') {
await checkStoreWhiteList(null, false)
} else if (entryDefalutStore == '2') {
Taro.redirectTo({
url: `/pages/custom/custom-page?id=${guidderTemplateId}&fromConnect=davild`
})
throw new Error('TO_STORE_GUIDE_PAGE')
}
}
} else if (enterStoreWhiteList && S.getAuthToken()) {
// 进入白名单会员店
const myShopInfo = await getUserWhiteShop()
if (myShopInfo) {
dispatch(updateShopInfo(myShopInfo))
@@ -143,6 +154,7 @@ export default () => {
return {
checkEnterStoreRule,
checkStoreWhiteList,
checkUserInStoreWhiteList,
getUserWhiteShop
}

View File

@@ -317,9 +317,13 @@ function CartCheckout(props) {
draft.submitLoading = false
})
Taro.hideLoading()
Taro.showToast({
title: `${e?.message || '创建订单失败,请稍后再试'}`,
icon: 'none'
})
setTimeout(() => {
Taro.navigateBack()
}, 100)
}, 800)
return
}
Taro.hideLoading()

View File

@@ -42,7 +42,6 @@ function CustomPage(props) {
const MSpSkuSelect = React.memo(SpSkuSelect)
const pageRef = useRef()
const loginRef = useRef()
const { open_divided } = useSelector((state) => state.sys)
const router = useRouter()
useEffect(() => {
@@ -108,11 +107,8 @@ function CustomPage(props) {
const { id } = await entryLaunch.getRouteParams($instance.router.params)
const { userId } = Taro.getStorageSync('userinfo')
const query = userId ? `?uid=${userId}&id=${id}` : `?id=${id}`
let path = `/pages/custom/custom-page${query}`
if (open_divided) {
path += `&tdid=${getDistributorId() || 0}`
}
log.debug(`getAppShareInfo: ${path}`)
return {
title: shareInfo.page_share_title,

View File

@@ -146,36 +146,54 @@ function WgtFullSlider(props) {
if (!config) return null
const page = Number(curIdx + 1)
const { dotbottom, indicatorText, indicatorFontSize, indicatorColor } = config
const currentItem = localData[curIdx]
return (
<View
className='indicator-item'
style={{ color: indicatorColor, bottom: `${dotbottom || 0}px` }}
>
<View className='indicator-current' style={{ fontSize: indicatorFontSize + 'px' }}>
<View
className='indicator-current'
style={{ fontSize: indicatorFontSize + 'px' }}
onClick={() => {
if (currentItem?.moreLink) {
linkPage(currentItem?.moreLink)
}
}}
>
<Text style={{ fontSize: indicatorFontSize + 4 + 'px' }}>
{page < 10 ? '0' + page : page}
</Text>
<Text> / </Text>
<Text>{localData.length < 10 ? '0' + localData.length : localData.length}</Text>
</View>
<View className='indicator-text' style={{ fontSize: indicatorFontSize + 'px' }}>
{indicatorText}
</View>
<View
className='indicator-arrow'
style={{
marginRight: 4,
width: 0,
height: 0,
borderTop: '8px solid transparent',
borderBottom: '8px solid transparent',
borderLeft: `12px solid ${indicatorColor}`,
position: 'absolute',
right: '-22px',
top: indicatorText ? '40%' : '30%',
color: indicatorColor
}}
/>
{currentItem?.moreLink ? (
<View
className='indicator-text'
style={{ fontSize: indicatorFontSize + 'px' }}
onClick={() => linkPage(currentItem?.moreLink)}
>
{indicatorText}
</View>
) : null}
{currentItem?.moreLink ? (
<View
className='indicator-arrow'
onClick={() => linkPage(currentItem?.moreLink)}
style={{
marginRight: 4,
width: 0,
height: 0,
borderTop: '8px solid transparent',
borderBottom: '8px solid transparent',
borderLeft: `12px solid ${indicatorColor}`,
position: 'absolute',
right: '-22px',
top: indicatorText ? '40%' : '30%',
color: indicatorColor
}}
/>
) : null}
</View>
)
}
@@ -307,7 +325,7 @@ function WgtFullSlider(props) {
objectFit='cover'
showCenterPlayBtn={false}
showFullscreenBtn={false}
muted
muted={false}
id={`swiperVideo_${index}${props.index}`}
onEnded={(e) => handlePlayEnd(e, item)}
onPlay={(e) => handlePlayStart(e, item, index)}

View File

@@ -1,7 +1,6 @@
.wgt-imghot-zone {
.img-hotzone {
position: relative;
border-radius: 16px;
overflow: hidden;
&_zone {
position: absolute;

View File

@@ -166,8 +166,11 @@ function EspierDetail(props) {
fetch()
getPackageList()
getEvaluationList()
// 导购浏览记录
api.member.itemHistorySave(id)
if (S.getAuthToken()) {
// 导购浏览记录
api.member.itemHistorySave(id)
}
}
}, [id])
@@ -301,7 +304,7 @@ function EspierDetail(props) {
distributor_id: dtid
})
setNavigationBarTitle(data.itemName)
// setNavigationBarTitle(data.itemName)
console.log(ACTIVITY_LIST[data.activityType])
if (ACTIVITY_LIST[data.activityType]) {
@@ -354,11 +357,11 @@ function EspierDetail(props) {
.catch((error) => {
console.log('获取图片信息失败:', url, error)
// 返回一个默认高度或 null
return { width: 0, height: 750 }
return { width: 0, height: 650 }
})
)
const results = await Promise.all(promises)
return results.map((info) => info.height / 2)
return results.map((info) => (info.height / 2 > 650 ? 650 : info.height / 2))
}
const getRecommendList = async () => {
@@ -427,9 +430,10 @@ function EspierDetail(props) {
return {
height: '100%',
width: '100%',
backgroundSize: '100% auto',
backgroundSize: 'cover',
backgroundImage: `url(${item})`,
backgroundRepeat: 'no-repeat'
backgroundRepeat: 'no-repeat',
backgroundPosition: 'center'
}
}

View File

@@ -1,7 +1,6 @@
.wgt-imghot-zone {
.img-hotzone {
position: relative;
border-radius: 16px;
overflow: hidden;
&_zone {
position: absolute;

View File

@@ -428,7 +428,7 @@ function EspierDetail(props) {
<View className='goods-name-wrap'>
<View className='goods-name'>{info.itemName}</View>
{isWeixin && (
{/* {isWeixin && (
<View
className='btn-share'
onClick={() => {
@@ -440,7 +440,7 @@ function EspierDetail(props) {
<Text className='iconfont icon-fenxiang-01'></Text>
<Text className='share-txt'>分享</Text>
</View>
)}
)} */}
</View>
</View>

View File

@@ -12888,5 +12888,10 @@
"zh-cn": "取消1",
"en": "Cancel 1",
"zh-tw": "取消1"
},
"dai4x2c": {
"zh-cn": "创建订单失败,请稍后再试",
"en": "The order creation failed. Please try again later",
"zh-tw": "創建訂單失敗,請稍後再試"
}
}

View File

@@ -1,688 +0,0 @@
import Taro, {
useDidShow,
useShareAppMessage,
getCurrentPages,
getCurrentInstance
} from '@tarojs/taro'
import { useState, useEffect, useCallback, useRef } from 'react'
import { updateUserInfo, fetchUserFavs, updateCheckChief } from '@/store/slices/user'
import { View, ScrollView, Text, Image, Button } from '@tarojs/components'
import { SG_APP_CONFIG, MERCHANT_TOKEN, SG_TOKEN } from '@/consts'
import { useSelector, useDispatch } from 'react-redux'
import { useImmer } from 'use-immer'
import {
SpLogin,
SpImage,
SpPrice,
CouponModal,
SpPrivacyModal,
SpTabbar,
SpPage
} from '@/components'
import api from '@/api'
import {
navigateTo,
getThemeStyle,
styleNames,
classNames,
showToast,
showModal,
isWeixin,
normalizeQuerys,
log,
VERSION_PLATFORM,
VERSION_STANDARD,
getDistributorId
} from '@/utils'
import S from '@/spx'
import {
updatePurchaseShareInfo,
updateInviteCode,
updateCurDistributorId,
updateIsOpenPurchase
} from '@/store/slices/purchase'
import { useLogin, useLocation } from '@/hooks'
import { updateDeliveryPersonnel } from '@/store/slices/cart'
import CompVipCard from './comps/comp-vipcard'
import CompBanner from './comps/comp-banner'
import CompPanel from './comps/comp-panel'
import CompMenu from './comps/comp-menu'
import CompHelpCenter from './comps/comp-helpcenter'
import './index.scss'
const initialConfigState = {
banner: {
isShow: false,
loginBanner: '',
noLoginBanner: '',
pageUrl: '',
urlOpen: false,
appId: null
},
menu: {
pointMenu: false, // 积分菜单
activity: false, // 活动预约
offline_order: false, // 线下订单
boost_activity: false, // 助力活动
boost_order: false, // 助力订单
complaint: false, // 投诉记录
community_order: false, // 社区团购订单
community_group_enable: false, // 社区团购
ext_info: false,
group: false, // 我的拼团
member_code: false, // 会员二维码
recharge: false, // 储值
ziti_order: false, // 自提
share_enable: false, // 分享
memberinfo_enable: false, // 个人信息
tenants: true, //商家入驻
purchase: true, // 员工内购
dianwu: false, // 店务,
community: false, // 社区
salesman: true
},
infoAppId: '',
infoPage: '',
infoUrlIsOpen: true,
pointAppId: '',
pointPage: '',
pointUrlIsOpen: true,
memberConfig: {
// defaultImg: null,
vipImg: null
},
purchaseRes: {}
}
const initialState = {
favCount: 0,
point: 0,
couponCount: 0,
username: '',
avatar: '',
mobile: '',
waitPayNum: 0,
waitSendNum: 0,
waitRecevieNum: 0,
waitEvaluateNum: 0,
afterSalesNum: 0,
zitiNum: 0,
deposit: 0,
salesPersonList: {},
deliveryStaffList: [] //配送员
}
function MemberIndex(props) {
// console.log('===>getCurrentPages==>', getCurrentPages(), getCurrentInstance())
const $instance = getCurrentInstance()
const { updateAddress } = useLocation()
const { isLogin, isNewUser, login, getUserInfoAuth } = useLogin({
autoLogin: true,
// policyUpdateHook: (isUpdate) => {
// // isUpdate && setPolicyModal(true)
// if (isUpdate) {
// RefLogin.current._setPolicyModal()
// }
loginSuccess: () => {
updateAddress()
}
})
const [config, setConfig] = useImmer(initialConfigState)
const [state, setState] = useImmer(initialState)
const [policyModal, setPolicyModal] = useState(false)
const { userInfo = {}, vipInfo = {} } = useSelector((state) => state.user)
const { pointName, open_divided } = useSelector((state) => state.sys)
const {
shopInfo: { store_name }
} = useSelector((state) => state.shop)
log.debug(`store userInfo: ${JSON.stringify(userInfo)}`)
const dispatch = useDispatch()
useEffect(() => {
if (isLogin) {
getMemberCenterData()
setMemberBackground()
getEmployeeIsOpen()
const { redirect } = $instance.router.params
if (redirect) {
Taro.redirectTo({ url: decodeURIComponent(redirect) })
}
}
}, [isLogin])
useEffect(() => {
getMemberCenterConfig()
// 白名单
getSettings()
}, [])
useDidShow(() => {
if (isLogin) {
getMemberCenterData()
}
})
// useDidShow(() => {
// if (isLogin) {
// getMemberCenterData()
// setMemberBackground()
// }
// // if (S.get(MERCHANT_TOKEN, true)) {
// // S.delete(MERCHANT_TOKEN, true)
// // }
// // if (S.get(SG_TOKEN)) {
// // setHeaderBlock()
// // }
// })
async function getSettings() {
const { whitelist_status = false } = await api.shop.homeSetting()
// 白名单配置
Taro.setStorageSync(SG_APP_CONFIG, {
whitelist_status
})
}
// 分享
useShareAppMessage(async (res) => {
const { share_title, share_pic_wechatapp } = await api.member.getMemberShareConfig()
const { logo } = await api.distribution.getDistributorInfo({
distributor_id: 0
})
return {
title: share_title,
imageUrl: share_pic_wechatapp || logo,
path: '/pages/index'
}
})
const setHeaderBlock = async () => {
const resAssets = await api.member.memberAssets()
const { discount_total_count, fav_total_count, point_total_count } = resAssets
setState((draft) => {
draft.favCount = fav_total_count
draft.point = point_total_count
draft.couponCount = discount_total_count
})
}
const getEmployeeIsOpen = async () => {
const purchaseRes = await api.purchase.getEmployeeIsOpen()
setConfig((draft) => {
draft.purchaseRes = purchaseRes
})
dispatch(updateIsOpenPurchase(purchaseRes.is_open))
}
const getMemberCenterConfig = async () => {
const [bannerRes, menuRes, redirectRes, pointShopRes] = await Promise.all([
// 会员中心banner
await api.shop.getPageParamsConfig({
page_name: 'member_center_setting'
}),
// 菜单自定义
await api.shop.getPageParamsConfig({
page_name: 'member_center_menu_setting'
}),
// 积分跳转配置
await api.shop.getPageParamsConfig({
page_name: 'member_center_redirect_setting'
}),
// 积分商城
await api.pointitem.getPointitemSetting()
])
let banner,
menu,
redirectInfo = {}
if (bannerRes.list.length > 0) {
const { app_id, is_show, login_banner, no_login_banner, page, url_is_open } =
bannerRes.list[0].params.data
banner = {
isShow: is_show,
loginBanner: login_banner,
noLoginBanner: no_login_banner,
pageUrl: page,
urlOpen: url_is_open,
appId: app_id
}
}
if (menuRes.list.length > 0) {
menu = { ...menuRes.list[0].params.data }
}
if (S.getAuthToken() && (VERSION_PLATFORM || VERSION_STANDARD)) {
const { result, status } = await api.member.is_admin()
console.log('env:result', result)
console.log('env:status', status)
S.set('DIANWU_CONFIG', result, status)
menu = {
...menu,
dianwu: status
}
}
if (redirectRes.list.length > 0) {
const {
info_app_id,
info_page,
info_url_is_open,
point_app_id,
point_page,
point_url_is_open
} = redirectRes.list[0].params.data
redirectInfo = {
infoAppId: info_app_id,
infoPage: info_page,
infoUrlIsOpen: info_url_is_open,
pointAppId: point_app_id,
pointPage: point_page,
pointUrlIsOpen: point_url_is_open
}
}
setConfig((draft) => {
draft.banner = banner
draft.menu = {
...menu,
pointMenu: pointShopRes.entrance.mobile_openstatus
}
draft.infoAppId = redirectInfo.info_app_id
draft.infoPage = redirectInfo.info_page
draft.infoUrlIsOpen = redirectInfo.info_url_is_open
draft.pointAppId = redirectInfo.point_app_id
draft.pointPage = redirectInfo.point_page
draft.pointUrlIsOpen = redirectInfo.point_url_is_open
})
}
const setMemberBackground = async () => {
let memberRes = await api.member.memberInfo()
let deliveryPersonnel = memberRes?.deliveryStaffList?.list.map((item) => item.operator_id) ?? []
setConfig((draft) => {
draft.memberConfig = {
// defaultImg: memberRes?.cardInfo?.background_pic_url,
vipImg: memberRes?.vipgrade?.background_pic_url,
backgroundImg: memberRes?.memberInfo?.gradeInfo?.background_pic_url
}
})
setState((draft) => {
draft.deposit = memberRes.deposit / 100
draft.salesPersonList = memberRes?.salesPersonList
draft.deliveryStaffList = memberRes?.deliveryStaffList
})
dispatch(
updateDeliveryPersonnel({ self_delivery_operator_id: deliveryPersonnel, distributor_id: '' })
) //存配送员信息
dispatch(updateUserInfo(memberRes))
}
const getMemberCenterData = async () => {
// const resSales = await api.member.getSalesperson()
const resTrade = await api.trade.getCount()
// const resVip = await api.vip.getList()
// 大转盘
// const resTurntable = await api.wheel.getTurntableconfig()
const resAssets = await api.member.memberAssets()
const { discount_total_count, fav_total_count, point_total_count } = resAssets
const {
aftersales, // 待处理售后
normal_notpay_notdelivery, // 未付款未发货
normal_payed_daifahuo, // 待发货
normal_payed_daishouhuo, // 待收货
normal_payed_daiziti, // 待自提订单
normal_not_rate // 待评论
} = resTrade
setState((draft) => {
draft.favCount = fav_total_count
draft.point = point_total_count
draft.couponCount = discount_total_count
draft.waitPayNum = normal_notpay_notdelivery
draft.waitSendNum = normal_payed_daifahuo
draft.waitRecevieNum = normal_payed_daishouhuo
draft.afterSalesNum = aftersales
draft.zitiNum = normal_payed_daiziti
draft.waitEvaluateNum = normal_not_rate
})
}
const handleClickLink = async (link) => {
// await getUserInfoAuth()
Taro.navigateTo({ url: link })
}
const handleClickPoint = () => {
const { pointAppId, pointPage, pointUrlIsOpen } = config
if (pointUrlIsOpen) {
Taro.navigateToMiniProgram({
appId: pointAppId,
path: pointPage
})
}
}
const handleClickService = async (item) => {
const { link, key } = item
// await getUserInfoAuth(key !== 'tenants')
// 分销推广
if (key == 'popularize') {
// 已经是分销员
if (userInfo.isPromoter) {
Taro.navigateTo({ url: link })
} else {
const { confirm } = await Taro.showModal({
title: '邀请推广',
content: '确定申请成为推广员?',
showCancel: true,
cancel: '取消',
confirmText: '确认',
confirmColor: '#0b4137'
})
if (!confirm) return
const { status } = await api.distribution.become()
if (status) {
Taro.showModal({
title: '恭喜',
content: '已成为推广员',
showCancel: false,
confirmText: '好'
})
}
}
return
}
if (key == 'useinfo') {
const { infoAppId, infoPage, infoUrlIsOpen } = config
if (infoUrlIsOpen) {
Taro.navigateToMiniProgram({
appId: infoAppId,
path: infoPage
})
}
}
if (key == 'community') {
const res = await api.community.checkChief()
dispatch(updateCheckChief(res))
if (res.status) {
Taro.navigateTo({ url: link })
} else {
Taro.navigateTo({ url: `/subpages/community/order` })
}
}
if (key == 'purchase') {
const data = await api.purchase.getUserEnterprises({
disabled: 0,
distributor_id: getDistributorId()
})
if (data?.length > 0) {
Taro.navigateTo({ url: '/subpages/purchase/select-identity?is_redirt=1' })
} else {
Taro.navigateTo({ url: '/pages/purchase/auth' })
}
dispatch(updatePurchaseShareInfo())
dispatch(updateInviteCode())
dispatch(updateCurDistributorId(null))
return
}
if (link) {
Taro.navigateTo({ url: link })
}
}
const VipGradeDom = () => {
if (isLogin) {
return (
<View className='user-grade-name'>
<View className='username'>
{(userInfo && (userInfo.username || userInfo.mobile)) || '获取昵称'}
</View>
<View
className='gradename'
onClick={() => {
Taro.navigateTo({ url: '/subpages/member/member-level' })
}}
>
{
{
true: vipInfo.grade_name || '会员',
false: userInfo?.gradeInfo?.grade_name || ''
}[vipInfo.isVip]
}
</View>
</View>
)
} else {
return (
<SpLogin newUser={isNewUser}>
<Text className='join-us-txt'>登录查看全部订单</Text>
</SpLogin>
)
}
}
if (!config) {
return null
}
// console.log(`member page:`, state, config);
const { memberConfig } = config
console.log('====config===', config.menu)
return (
<SpPage className='pages-member-index' renderFooter={<SpTabbar />}>
<ScrollView scrollY style='height: 100%;'>
<View
className='header-block'
style={styleNames({
'background-image': `url(${`${process.env.APP_IMAGE_CDN}/m_bg.png`})`
})}
>
{VERSION_STANDARD && open_divided && (
<View
className='left-block'
onClick={() => {
Taro.navigateTo({
url: '/subpages/store/list'
})
}}
>
<View className='shop-name'>
<Text className='shop-name-text'>我的店铺</Text> {store_name || ''}
</View>
<Text className='iconfont icon-qianwang-01'></Text>
</View>
)}
<View className='header-hd'>
<View className='header-hd__header'>
<SpImage
className='usericon'
src={(userInfo && userInfo.avatar) || 'user_icon.png'}
width='110'
/>
</View>
<View className='header-hd__body'>
<View className='username-wrap'>
<View className='join-us'>{VipGradeDom()}</View>
</View>
</View>
<View className='header-hd__footer'>
{config.menu.member_code && (
<SpLogin
onChange={handleClickLink.bind(this, '/marketing/pages/member/member-code')}
>
<Text className='iconfont icon-erweima-01'></Text>
</SpLogin>
)}
<SpLogin
className='user-info__link'
onChange={handleClickLink.bind(this, '/subpages/member/user-info')}
>
<Text className='iconfont icon-qianwang-01'></Text>
</SpLogin>
</View>
</View>
<View className='header-hd__footer1'>
{/* {config.menu.member_code && (
<SpLogin onChange={handleClickLink.bind(this, '/marketing/pages/member/member-code')}>
<Text className='iconfont icon-erweima-01'></Text>
</SpLogin>
)}
<SpLogin
className='user-info__link'
onChange={handleClickLink.bind(this, '/subpages/member/user-info')}
>
<Text className='iconfont icon-qianwang-01'></Text>
</SpLogin> */}
<SpLogin
className='bd-item'
onChange={handleClickLink.bind(this, '/subpages/marketing/coupon')}
>
<View className='bd-item-label'>优惠券()</View>
<View className='bd-item-value'>{state.couponCount}</View>
</SpLogin>
<SpLogin
className='bd-item'
onChange={handleClickLink.bind(this, '/subpages/member/point-detail')}
>
<View className='bd-item-label'>{`${pointName}`}</View>
<View className='bd-item-value'>{state.point}</View>
</SpLogin>
{/* {process.env.NODE_ENV === 'development' && (
<View className='bd-item deposit-item'>
<View className='bd-item-label'>储值(¥)</View>
<View className='bd-item-value'>
<SpPrice noSymbol value={state.deposit} />
</View>
</View>
)} */}
<SpLogin
className='bd-item'
onChange={handleClickLink.bind(this, '/pages/member/item-fav')}
>
<View className='bd-item-label'>收藏()</View>
<View className='bd-item-value'>{state.favCount}</View>
</SpLogin>
</View>
<View className='header-ft'>
{/* 会员卡等级 */}
{vipInfo.isOpen && (
<SpLogin onChange={handleClickLink.bind(this, '/subpage/pages/vip/vipgrades')}>
<CompVipCard info={vipInfo} userInfo={userInfo} memberConfig={memberConfig} />
</SpLogin>
)}
</View>
</View>
<View className='body-block'>
{config.banner?.isShow && (
<CompBanner
info={config.banner}
src={isLogin ? config.banner.loginBanner : config.banner.noLoginBanner}
/>
)}
<CompPanel
title='订单'
extra={
<SpLogin onChange={handleClickLink.bind(this, '/subpages/trade/list?status=0')}>
查看全部订单
</SpLogin>
}
>
{config.menu.ziti_order && (
<SpLogin onChange={handleClickLink.bind(this, '/subpages/trade/ziti-list')}>
<View className='ziti-order'>
<View className='ziti-order-info'>
<View className='title'>自提订单</View>
<View className='ziti-txt'>
您有<Text className='ziti-num'>{state.zitiNum}</Text>
个等待自提的订单
</View>
</View>
<Text className='iconfont icon-qianwang-01'></Text>
</View>
</SpLogin>
)}
<View className='order-con'>
<SpLogin
className='order-item'
onChange={handleClickLink.bind(this, '/subpages/trade/list?status=5')}
>
<SpImage src='daizhifu.png' className='icon-style' />
{state.waitPayNum > 0 && (
<View className='order-bradge'>
<Text>{state.waitPayNum}</Text>
</View>
)}
<Text className='order-txt'>待支付</Text>
</SpLogin>
<SpLogin
className='order-item'
onChange={handleClickLink.bind(this, '/subpages/trade/list?status=1')}
>
<SpImage src='daishouhuo.png' className='icon-style' />
{state.waitRecevieNum + state.waitSendNum > 0 && (
<View className='order-bradge'>
<Text>{state.waitRecevieNum + state.waitSendNum}</Text>
</View>
)}
<Text className='order-txt'>待收货</Text>
</SpLogin>
<SpLogin
className='order-item'
onChange={handleClickLink.bind(this, '/subpages/trade/list?status=7')}
>
<SpImage src='pingjia.png' className='icon-style' />
{state.waitEvaluateNum > 0 && (
<View className='order-bradge'>
<Text>{state.waitEvaluateNum}</Text>
</View>
)}
<Text className='order-txt'>待评价</Text>
</SpLogin>
<SpLogin
className='order-item'
onChange={handleClickLink.bind(this, '/subpages/trade/after-sale-list')}
>
<SpImage src='shouhou.png' className='icon-style' />
{state.afterSalesNum > 0 && (
<View className='order-bradge'>
<Text>{state.afterSalesNum}</Text>
</View>
)}
<Text className='order-txt'>售后</Text>
</SpLogin>
</View>
</CompPanel>
<CompPanel>
<CompMenu
accessMenu={{
...config.menu,
purchase: config.purchaseRes.is_open,
popularize: userInfo ? userInfo.popularize : false,
salesPersonList: state.salesPersonList,
deliveryStaffList: state.deliveryStaffList
}}
isPromoter={userInfo ? userInfo.isPromoter : false}
onLink={handleClickService}
/>
</CompPanel>
<CompPanel>
<CompHelpCenter onLink={handleClickService} />
</CompPanel>
</View>
</ScrollView>
</SpPage>
)
}
export default MemberIndex

View File

@@ -7,7 +7,6 @@ import { SpPage, SpScrollView, SpImage } from '@/components'
import api from '@/api'
import doc from '@/doc'
import { classNames, pickBy, thousandthFormat } from '@/utils'
import { POINT_TYPE } from '@/consts'
import './point-detail.scss'
const btns = [

View File

@@ -10,7 +10,6 @@ import { SG_POLICY } from '@/consts'
import { classNames, showToast, formatTime, isWeixin, isWeb, VERSION_SHUYUN } from '@/utils'
import imgUploader from '@/utils/upload'
import { View, Input, Picker, Button } from '@tarojs/components'
import { updateLang } from '@/store/slices/user'
import i18n from '@/lang/consts'
import './user-info.scss'

View File

@@ -322,6 +322,19 @@ function PointShopEspierDetail(props) {
<View className='goods-contents'>
<View className='goods-pic-container'>
<Swiper className='goods-swiper' onChange={onChangeSwiper}>
{info.video && (
<SwiperItem key='swiperitem__video'>
<View className='video-container'>
<Video
id='goods-video'
className='item-video'
src={info.video}
autoplay
showCenterPlayBtn={false}
/>
</View>
</SwiperItem>
)}
{info.imgs.map((img, idx) => (
<SwiperItem key={`swiperitem__${idx}`}>
<SpImage
@@ -335,21 +348,12 @@ function PointShopEspierDetail(props) {
</Swiper>
{info.imgs.length > 1 && (
<View className='swiper-pagegation'>{`${curImgIdx + 1}/${info.imgs.length}`}</View>
<View className='swiper-pagegation'>{`${curImgIdx + 1}/${
info.imgs.length + (info.video ? 1 : 0)
}`}</View>
)}
{info.video && play && (
<View className='video-container'>
<Video
id='goods-video'
className='item-video'
src={info.video}
showCenterPlayBtn={false}
/>
</View>
)}
{info.video && (
{/* {info.video && (
<View
className={classNames('btn-video', {
playing: play
@@ -362,8 +366,8 @@ function PointShopEspierDetail(props) {
>
{!play && <SpImage className='play-icon' src='play2.png' width={50} height={50} />}
{play ? '退出视频' : '播放视频'}
</View>
)}
</View> */}
{/* )} */}
</View>
<View className='goods-info'>

View File

@@ -14,12 +14,7 @@
bottom: 0;
.item-video {
width: 100%;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
z-index: 100;
// height: auto;
height: 100%;
}
.btn-play {
position: absolute;
@@ -92,7 +87,7 @@
}
}
.goods-desc {
margin: 24px 16px;
margin: 24px 0px;
background-color: #fff;
box-shadow: 0px 2px 10px 0px #eae7e0;
.desc-hd {

View File

@@ -250,7 +250,15 @@ function PointShopList() {
<SpImage src={userInfo?.avatar || 'user_icon.png'} width={80} height={80} />
<Text className='user-name'>{userInfo?.username}</Text>
</View>
<View className='point-total'>
<View
className='point-total'
onClick={() => {
console.log('point-total')
Taro.navigateTo({
url: '/subpages/member/point-detail'
})
}}
>
<SpPoint value={point} />
</View>
</View>

View File

@@ -6,7 +6,6 @@ import './comp-shopitem.scss'
function CompShopItem(props) {
const { info } = props
const { open_divided } = useSelector((state) => state.sys)
if (!info) {
return null
@@ -19,7 +18,7 @@ function CompShopItem(props) {
</View> */}
<View className='shopitem-bd'>
<View className='shop-info'>
{!open_divided && <View className='distance'>{info.distance || '100km'}</View>}
<View className='distance'>{info.distance || '100km'}</View>
<View className='name'>{info.store_name}</View>
{info.isOpenDivided && (
<View className='shop-tag'>

View File

@@ -8,7 +8,7 @@ import { updateLocation, updateChooseAddress } from '@/store/slices/user'
import { updateShopInfo } from '@/store/slices/shop'
import api from '@/api'
import { useLogin } from '@/hooks'
import { SG_ROUTER_PARAMS } from '@/consts/localstorage'
import { SG_ROUTER_PARAMS, SG_CHECK_STORE_RULE } from '@/consts/localstorage'
import doc from '@/doc'
import { entryLaunch, pickBy, classNames, showToast, log, isArray, isObject } from '@/utils'
import CompShopItem from './comps/comp-shopitem'
@@ -61,7 +61,6 @@ function NearlyShop(props) {
const [policyModal, setPolicyModal] = useState(false)
const { location = {}, address } = useSelector((state) => state.user)
const { shopInfo } = useSelector((state) => state.shop)
const { open_divided } = useSelector((state) => state.sys)
const shopRef = useRef()
const pageRef = useRef()
const dispatch = useDispatch()
@@ -226,6 +225,7 @@ function NearlyShop(props) {
const handleClickShop = (info) => {
dispatch(updateShopInfo(info)) //新增非门店自提开启distributor_id 取值为store_id
Taro.setStorageSync(SG_CHECK_STORE_RULE, 0)
// 清空小程序启动时携带的参数
Taro.setStorageSync(SG_ROUTER_PARAMS, {})
setTimeout(() => {
@@ -250,87 +250,79 @@ function NearlyShop(props) {
return (
<SpPage className='page-store-list' ref={pageRef}>
{!open_divided && (
<>
<View className='search-block'>
<View className='search-bar'>
<View className='region-picker'>
<View
className='pick-title'
onClick={() => {
setState((draft) => {
draft.isSpAddressOpened = true
})
}}
>
<View className='iconfont icon-periscope'></View>
<Text className='pick-address'>{chooseValue.join('') || '选择地区'}</Text>
{/* <Text className='iconfont icon-arrowDown'></Text> */}
</View>
</View>
<View className='search-comp-wrap'>
<Text className='iconfont icon-sousuo-01'></Text>
<Input
className='search-comp'
placeholder='请输入想搜索的店铺'
confirmType='search'
value={state.keyword}
disabled={!location?.address}
onInput={onInputChange}
onConfirm={onConfirmSearch}
/>
{state.keyword && state.keyword.length > 0 && (
<View className='iconfont icon-close' onClick={onClearValueChange}></View>
)}
</View>
<View className='search-block'>
<View className='search-bar'>
<View className='region-picker'>
<View
className='pick-title'
onClick={() => {
setState((draft) => {
draft.isSpAddressOpened = true
})
}}
>
<View className='iconfont icon-periscope'></View>
<Text className='pick-address'>{chooseValue.join('') || '选择地区'}</Text>
{/* <Text className='iconfont icon-arrowDown'></Text> */}
</View>
</View>
{isRecommend && (
<View className='shop-logo'>
<Image className='img' src={headquarters.logo} mode='aspectFill' />
<View className='tip'>您想要地区的店铺暂时未入驻网上商城</View>
</View>
)}
<View className='location-block'>
<View className='block-title'>当前定位地址</View>
<View className='location-wrap'>
<Text className='location-address'>
{location?.address || '无法获取您的位置信息'}
</Text>
<View className='btn-location' onClick={getLocationInfo}>
<Text
className={classNames('iconfont icon-zhongxindingwei', {
active: state.locationIng
})}
></Text>
{location?.address ? (state.locationIng ? '定位中...' : '重新定位') : '开启定位'}
</View>
</View>
{address && (
<View className='block-title block-flex'>
<View>我的收货地址</View>
</View>
<View className='search-comp-wrap'>
<Text className='iconfont icon-sousuo-01'></Text>
<Input
className='search-comp'
placeholder='请输入想搜索的店铺'
confirmType='search'
value={state.keyword}
disabled={!location?.address}
onInput={onInputChange}
onConfirm={onConfirmSearch}
/>
{state.keyword && state.keyword.length > 0 && (
<View className='iconfont icon-close' onClick={onClearValueChange}></View>
)}
<View className='receive-address'>
{address && (
<View
className='address'
onClick={() => onLocationChange(address)}
>{`${address.province}${address.city}${address.county}${address.adrdetail}`}</View>
)}
</View>
</View>
</>
</View>
</View>
{isRecommend && (
<View className='shop-logo'>
<Image className='img' src={headquarters.logo} mode='aspectFill' />
<View className='tip'>您想要地区的店铺暂时未入驻网上商城</View>
</View>
)}
<View className='nearlyshop-list'>
<View className='list-title'>
{!open_divided ? (location?.address ? '附近门店' : '推荐门店') : ''}
<View className='location-block'>
<View className='block-title'>当前定位地址</View>
<View className='location-wrap'>
<Text className='location-address'>{location?.address || '无法获取您的位置信息'}</Text>
<View className='btn-location' onClick={getLocationInfo}>
<Text
className={classNames('iconfont icon-zhongxindingwei', {
active: state.locationIng
})}
></Text>
{location?.address ? (state.locationIng ? '定位中...' : '重新定位') : '开启定位'}
</View>
</View>
{address && (
<View className='block-title block-flex'>
<View>我的收货地址</View>
</View>
)}
<View className='receive-address'>
{address && (
<View
className='address'
onClick={() => onLocationChange(address)}
>{`${address.province}${address.city}${address.county}${address.adrdetail}`}</View>
)}
</View>
</View>
<View className='nearlyshop-list'>
<View className='list-title'>{location?.address ? '附近门店' : '推荐门店'}</View>
<SpScrollView ref={shopRef} auto={false} className='shoplist-block' fetch={fetchShop}>
{state.shopList.map((item, index) => (
<View
@@ -344,7 +336,7 @@ function NearlyShop(props) {
</SpScrollView>
</View>
{headquarters && !open_divided && (
{headquarters && (
<View className='shop-bottom' onClick={() => handleClickShop(headquarters)}>
<Image className='img' src={headquarters.logo} mode='aspectFill' />
{headquarters.store_name}
@@ -352,17 +344,15 @@ function NearlyShop(props) {
</View>
)}
{!open_divided && (
<SpAddress
isOpened={isSpAddressOpened}
onClose={() => {
setState((draft) => {
draft.isSpAddressOpened = false
})
}}
onChange={onPickerChange}
/>
)}
<SpAddress
isOpened={isSpAddressOpened}
onClose={() => {
setState((draft) => {
draft.isSpAddressOpened = false
})
}}
onChange={onPickerChange}
/>
</SpPage>
)
}

View File

@@ -471,6 +471,7 @@ function TradeAfterSale(props) {
value={description}
placeholder='请输入您的补充描述(选填)'
maxLength={200}
placeholderStyle='padding-left: 10px;'
onChange={(e) => {
setState((draft) => {
draft.description = e

View File

@@ -184,7 +184,6 @@
padding-bottom: 10px;
border-bottom: 1px solid #f5f5f5;
&::after {
content: '';
/* prettier-ignore */
@@ -209,7 +208,6 @@
margin-bottom: 40px;
}
.return-goods-type {
margin: 24px 16px 0;
border-radius: 6px;
@@ -249,19 +247,27 @@
margin: 0 32px;
display: flex;
overflow: hidden;
}
position: relative;
.icon-bianji1 {
color: #aaaaaa;
}
.icon-bianji1 {
color: #aaaaaa;
position: absolute;
z-index: 999;
top: 13px;
left: 10px;
}
.at-textarea {
border-width: 0;
padding: 0;
margin: 6px 0 0 10px;
.at-textarea {
border-width: 0;
padding: 0;
margin: 0;
width: 100%;
&__textarea {
font-size: 24px;
&__textarea {
font-size: 24px;
line-height: normal;
padding: 0px 10px 20px 40px;
}
}
}
@@ -390,7 +396,7 @@
margin-left: 30px;
}
}
.prescription-drug{
.prescription-drug {
font-size: 22px;
color: var(--color-primary);
padding: 0 4px;

View File

@@ -52,7 +52,7 @@ function CompTradeItem(props) {
<View className='comp-tradeitem'>
<View className='trade-item-hd' onClick={onViewTradeDetail}>
<View>
<View className='shop-info' onClick={onViewStorePage}>
{/* <View className='shop-info' onClick={onViewStorePage}>
<SpImage src={distributorInfo?.logo} width={100} height={100} />
<View className='shop-name'>
{distributorInfo?.name}

View File

@@ -11,7 +11,6 @@
.trade-no {
font-size: 24px;
color: #333;
margin-top: 24px;
}
.trade-time {

View File

@@ -1,13 +1,12 @@
import React, { useEffect } from 'react'
import { useSelector } from 'react-redux'
import { useImmer } from 'use-immer'
import Taro, { getCurrentInstance } from '@tarojs/taro'
import { AtButton } from 'taro-ui'
import api from '@/api'
import doc from '@/doc'
import S from '@/spx'
import { View, Picker } from '@tarojs/components'
import { LOGISTICS_CODE } from '@/consts'
import { SpPage, SpCell, SpInput as AtInput } from '@/components'
import { SpPage, SpCell, SpInput as AtInput, SpToast } from '@/components'
import { showToast } from '@/utils'
import './logistics-info.scss'
@@ -44,19 +43,25 @@ function TradeLogisticsInfo(props) {
showToast('请填写物流单号')
return
}
await api.aftersales.sendback({
item_id,
order_id,
aftersales_bn,
logi_no,
corp_code
})
showToast('操作成功')
setTimeout(() => {
Taro.navigateBack({
delta: 2
try {
await api.aftersales.sendback({
item_id,
order_id,
aftersales_bn,
logi_no,
corp_code,
showError: false
})
}, 1000)
showToast('操作成功')
setTimeout(() => {
Taro.navigateBack({
delta: 2
})
}, 1000)
} catch (error) {
console.log(error)
S.toast(error.message)
}
}
const onChangeExpress = (e) => {
@@ -109,6 +114,7 @@ function TradeLogisticsInfo(props) {
/>
}
></SpCell>
<SpToast />
</SpPage>
)
}

View File

@@ -379,7 +379,6 @@ class EntryLaunch {
async postGuideUV() {
const routerParams =
Taro.getStorageSync(SG_ROUTER_PARAMS) || Taro.getStorageSync(SG_GUIDE_PARAMS)
const { gu, gu_user_id } = routerParams || {}
let work_userid = ''
if (gu) {

101
src/utils/log copy.js Normal file
View File

@@ -0,0 +1,101 @@
const log = wx.getRealtimeLogManager ? wx.getRealtimeLogManager() : null // 手机端点击投诉可以在平台看到日志
const levels = {
DEBUG: 'debug', // 开发和调试阶段使用
INFO: 'info', // 记录程序正常运行情况
WARN: 'warn', // 记录程序运行出现的潜在问题
ERROR: 'error' // 程序运行过程出现严重错误
}
const prefixes = {
DEBUG: '[DEBUG]',
INFO: '[INFO]',
WARN: '[WARN]',
ERROR: '[ERROR]'
}
class Logger {
constructor(level = levels.INFO) {
this.level = level
}
setLevel(level) {
this.level = level
}
log(level, ...args) {
if (this.shouldLog(level)) {
const timestamp = new Date().toLocaleString()
const prefix = prefixes[level.toUpperCase()] || ''
const logMessage = `[${timestamp}] ${prefix} ${args.join(' ')}`
console.log(logMessage)
this.sendToRealtimeLog(level, ...args)
}
}
debug(...args) {
this.log(levels.DEBUG, ...args)
}
info(...args) {
this.log(levels.INFO, ...args)
}
warn(...args) {
this.log(levels.WARN, ...args)
}
error(...args) {
this.log(levels.ERROR, ...args)
}
shouldLog(level) {
const levelOrder = [levels.DEBUG, levels.INFO, levels.WARN, levels.ERROR]
return levelOrder.indexOf(level) >= levelOrder.indexOf(this.level)
}
sendToRealtimeLog(level, ...args) {
if (!log) {
return
}
switch (level) {
case levels.INFO:
log.info.apply(log, args)
break
case levels.WARN:
log.warn.apply(log, args)
break
case levels.ERROR:
log.error.apply(log, args)
break
default:
log.debug ? log.debug.apply(log, args) : log.info.apply(log, args)
break
}
}
setFilterMsg(msg) {
if (!log || !log.setFilterMsg) {
return
}
if (typeof msg !== 'string') {
return
}
log.setFilterMsg(msg)
}
addFilterMsg(msg) {
if (!log || !log.addFilterMsg) {
return
}
if (typeof msg !== 'string') {
return
}
log.addFilterMsg(msg)
}
}
const logger = new Logger(levels.DEBUG) // 默认日志级别为 DEBUG
export default logger
export { levels }