mirror of
https://gitee.com/ShopeX/ECShopX_mobile-frontend
synced 2026-08-13 06:35:41 +08:00
Fix H5 home widget padding and promotion dashboard infinite loading, add nearby-store widget support, and improve employee purchase (drop distributor_id on enterprise APIs, activity covers, cart add-on grouping, checkout delivery UI) plus Alipay already-paid handling.
This commit is contained in:
@@ -31,6 +31,7 @@ export const ACTIVITY_ITEM = {
|
||||
id: 'id',
|
||||
name: 'name',
|
||||
pic: 'pic',
|
||||
list_pic: 'list_pic',
|
||||
pages_template_id: 'pages_template_id',
|
||||
role: ({ is_employee, is_relative }) => {
|
||||
if (is_employee == 1) {
|
||||
|
||||
@@ -300,13 +300,19 @@ export default (props = {}) => {
|
||||
query['pay_channel'] = pay_channel
|
||||
}
|
||||
|
||||
const { payment } = await api.cashier.getPayment(query)
|
||||
const res = await api.cashier.getPayment(query)
|
||||
if (res.pay_status) {
|
||||
paySuccess(params, orderInfo)
|
||||
return
|
||||
}
|
||||
const payment = res.payment
|
||||
if (!payment) {
|
||||
payError(orderInfo)
|
||||
return
|
||||
}
|
||||
const el = document.createElement('div')
|
||||
el.setAttribute('class', 'alipay_submit_div')
|
||||
//el.innerHTML='<form id="a" name="test"></form>'
|
||||
el.innerHTML = payment
|
||||
// .replace(/<form/, '<form target="_blank"') // 加_blank ios会拦截
|
||||
.replace(/<script>(.*)?<\/script>/, '')
|
||||
el.innerHTML = payment.replace(/<script>(.*)?<\/script>/, '')
|
||||
document.body.appendChild(el)
|
||||
document.getElementById('alipay_submit').submit()
|
||||
}
|
||||
|
||||
@@ -29,17 +29,29 @@ class DistributionDashboard extends Component {
|
||||
showPoster: false,
|
||||
poster: null,
|
||||
posterImgs: null,
|
||||
adapay_status_key: null
|
||||
adapay_status_key: null,
|
||||
loadError: null
|
||||
}
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
getMarketingColor() {
|
||||
const { colors } = this.props
|
||||
return colors?.data?.[0]?.marketing || '#fba629'
|
||||
}
|
||||
|
||||
/** 拉取页面数据;须在 componentDidMount 调用(H5 下 connect/i18n 包裹后 componentDidShow 可能不触发) */
|
||||
initPage = () => {
|
||||
this.getAdapayInfo()
|
||||
this.fetch()
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
Taro.setNavigationBarColor({
|
||||
frontColor: '#ffffff',
|
||||
backgroundColor: colors.data[0].marketing
|
||||
backgroundColor: this.getMarketingColor()
|
||||
})
|
||||
this.syncNavTitle()
|
||||
this.initPage()
|
||||
}
|
||||
|
||||
componentDidUpdate(prevProps) {
|
||||
@@ -53,68 +65,82 @@ class DistributionDashboard extends Component {
|
||||
}
|
||||
|
||||
componentDidShow() {
|
||||
this.getAdapayInfo()
|
||||
this.fetch()
|
||||
// 从子页返回时刷新;首进依赖 componentDidMount(与首页 useDidShow + useEffect 兜底同理)
|
||||
this.initPage()
|
||||
}
|
||||
|
||||
async fetch() {
|
||||
const resUser = Taro.getStorageSync('userinfo')
|
||||
const { username, avatar } = resUser
|
||||
this.setState({ loadError: null })
|
||||
try {
|
||||
const resUser = Taro.getStorageSync('userinfo') || {}
|
||||
const { username = '', avatar = '' } = resUser
|
||||
|
||||
const res = await api.distribution.dashboard()
|
||||
const base = pickBy(res, {
|
||||
itemTotalPrice: 'itemTotalPrice',
|
||||
cashWithdrawalRebate: 'cashWithdrawalRebate',
|
||||
promoter_order_count: 'promoter_order_count',
|
||||
promoter_grade_order_count: 'promoter_grade_order_count',
|
||||
rebateTotal: 'rebateTotal',
|
||||
isbuy_promoter: 'isbuy_promoter',
|
||||
notbuy_promoter: 'notbuy_promoter',
|
||||
taskBrokerageItemTotalFee: 'taskBrokerageItemTotalFee',
|
||||
pointTotal: 'pointTotal',
|
||||
taskBrokerageItemTotalPoint: 'taskBrokerageItemTotalPoint'
|
||||
})
|
||||
const res = await api.distribution.dashboard()
|
||||
const base = pickBy(res, {
|
||||
itemTotalPrice: 'itemTotalPrice',
|
||||
cashWithdrawalRebate: 'cashWithdrawalRebate',
|
||||
promoter_order_count: 'promoter_order_count',
|
||||
promoter_grade_order_count: 'promoter_grade_order_count',
|
||||
rebateTotal: 'rebateTotal',
|
||||
isbuy_promoter: 'isbuy_promoter',
|
||||
notbuy_promoter: 'notbuy_promoter',
|
||||
taskBrokerageItemTotalFee: 'taskBrokerageItemTotalFee',
|
||||
pointTotal: 'pointTotal',
|
||||
taskBrokerageItemTotalPoint: 'taskBrokerageItemTotalPoint'
|
||||
})
|
||||
|
||||
const promoter = await api.distribution.info()
|
||||
const pInfo = pickBy(promoter, {
|
||||
shop_name: 'shop_name',
|
||||
shop_pic: 'shop_pic',
|
||||
is_open_promoter_grade: 'is_open_promoter_grade',
|
||||
promoter_grade_name: 'promoter_grade_name',
|
||||
isOpenShop: 'isOpenShop',
|
||||
shop_status: 'shop_status',
|
||||
reason: 'reason',
|
||||
qrcode_bg_img: 'qrcode_bg_img',
|
||||
disabled: 'disabled'
|
||||
})
|
||||
const res2 = await api.member.hfpayUserApply()
|
||||
const userInfo = pickBy(res2, {
|
||||
applyStatus: 'status'
|
||||
})
|
||||
const res3 = await api.member.getIsHf()
|
||||
let isHf = res3.hfpay_version_status
|
||||
const info = { username, avatar, ...base, ...pInfo, ...userInfo, isHf }
|
||||
const promoter = await api.distribution.info()
|
||||
const pInfo = pickBy(promoter, {
|
||||
shop_name: 'shop_name',
|
||||
shop_pic: 'shop_pic',
|
||||
is_open_promoter_grade: 'is_open_promoter_grade',
|
||||
promoter_grade_name: 'promoter_grade_name',
|
||||
isOpenShop: 'isOpenShop',
|
||||
shop_status: 'shop_status',
|
||||
reason: 'reason',
|
||||
qrcode_bg_img: 'qrcode_bg_img',
|
||||
disabled: 'disabled'
|
||||
})
|
||||
const res2 = await api.member.hfpayUserApply()
|
||||
const userInfo = pickBy(res2, {
|
||||
applyStatus: 'status'
|
||||
})
|
||||
const res3 = await api.member.getIsHf()
|
||||
const isHf = res3?.hfpay_version_status
|
||||
const info = { username, avatar, ...base, ...pInfo, ...userInfo, isHf }
|
||||
|
||||
this.setState({ info })
|
||||
this.setState({ info, loadError: null })
|
||||
} catch (e) {
|
||||
console.error('[distribution/index] fetch failed', e)
|
||||
this.setState({
|
||||
info: null,
|
||||
loadError: e?.message || e?.res?.data?.data?.message || $t('c2581d4c.866b79')
|
||||
})
|
||||
Taro.showToast({ title: $t('c2581d4c.866b79'), icon: 'none' })
|
||||
}
|
||||
}
|
||||
|
||||
async getAdapayInfo() {
|
||||
const { cert_status } = await api.distribution.adapayCert()
|
||||
let adapay_status_key = null
|
||||
if (isArray(cert_status)) {
|
||||
adapay_status_key = 'unverified'
|
||||
} else if (cert_status.audit_state == 'A') {
|
||||
adapay_status_key = 'auditing'
|
||||
} else if (
|
||||
cert_status.audit_state == 'B' ||
|
||||
cert_status.audit_state == 'C' ||
|
||||
cert_status.audit_state == 'D'
|
||||
) {
|
||||
adapay_status_key = 'failed'
|
||||
} else if (cert_status.audit_state == 'E') {
|
||||
adapay_status_key = 'verified'
|
||||
try {
|
||||
const { cert_status } = await api.distribution.adapayCert()
|
||||
let adapay_status_key = null
|
||||
if (isArray(cert_status)) {
|
||||
adapay_status_key = 'unverified'
|
||||
} else if (cert_status.audit_state == 'A') {
|
||||
adapay_status_key = 'auditing'
|
||||
} else if (
|
||||
cert_status.audit_state == 'B' ||
|
||||
cert_status.audit_state == 'C' ||
|
||||
cert_status.audit_state == 'D'
|
||||
) {
|
||||
adapay_status_key = 'failed'
|
||||
} else if (cert_status.audit_state == 'E') {
|
||||
adapay_status_key = 'verified'
|
||||
}
|
||||
this.setState({ adapay_status_key })
|
||||
} catch (e) {
|
||||
console.error('[distribution/index] getAdapayInfo failed', e)
|
||||
}
|
||||
this.setState({ adapay_status_key })
|
||||
}
|
||||
|
||||
handleOpenApply() {
|
||||
@@ -158,14 +184,26 @@ class DistributionDashboard extends Component {
|
||||
}
|
||||
|
||||
render() {
|
||||
const { colors } = this.props
|
||||
const { info, showPoster, adapay_status_key } = this.state
|
||||
const { info, showPoster, adapay_status_key, loadError } = this.state
|
||||
const marketingColor = this.getMarketingColor()
|
||||
if (loadError) {
|
||||
return (
|
||||
<SpPage className='page-distribution-index'>
|
||||
<View className='distribution-load-error'>
|
||||
<Text>{loadError}</Text>
|
||||
<View className='distribution-load-error__retry' onClick={this.initPage}>
|
||||
{$t('c7a229df.132c5c')}
|
||||
</View>
|
||||
</View>
|
||||
</SpPage>
|
||||
)
|
||||
}
|
||||
if (!info) {
|
||||
return <Loading />
|
||||
}
|
||||
return (
|
||||
<SpPage className='page-distribution-index'>
|
||||
<View className='header' style={'background: ' + colors.data[0].marketing}>
|
||||
<View className='header' style={'background: ' + marketingColor}>
|
||||
<View className='view-flex view-flex-middle'>
|
||||
<Image
|
||||
className='header-avatar'
|
||||
|
||||
@@ -197,4 +197,17 @@
|
||||
.icon-right {
|
||||
font-size: 30px;
|
||||
}
|
||||
|
||||
.distribution-load-error {
|
||||
padding: 80px 32px;
|
||||
text-align: center;
|
||||
font-size: 28px;
|
||||
color: #666;
|
||||
|
||||
&__retry {
|
||||
margin-top: 32px;
|
||||
color: #00c3ff;
|
||||
font-size: 28px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -161,7 +161,9 @@ function CartIndex() {
|
||||
exchange_item = pickBy(plus_item, { ...doc.cart.PLUS_BUY_ITEM, activity_id })
|
||||
}
|
||||
all_plus_itemid_list.push(activity_item_ids)
|
||||
const general_goods = list.filter((k) => activity_item_ids.indexOf(k.item_id) > -1)
|
||||
const general_goods = list.filter((k) =>
|
||||
(activity_item_ids || []).some((id) => String(id) === String(k.item_id))
|
||||
)
|
||||
return {
|
||||
...plusitem,
|
||||
cus_general_goods_list: general_goods,
|
||||
@@ -171,7 +173,7 @@ function CartIndex() {
|
||||
all_plus_itemid_list = all_plus_itemid_list.toString().split(',')
|
||||
const goodsMap = reduceTransform(list, 'cart_id')
|
||||
for (const key in goodsMap) {
|
||||
if (all_plus_itemid_list.indexOf(goodsMap[key].item_id) < 0) {
|
||||
if (!all_plus_itemid_list.includes(String(goodsMap[key].item_id))) {
|
||||
no_active_item.push(goodsMap[key])
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
* See LICENSE file for license details.
|
||||
*/
|
||||
import Taro from '@tarojs/taro'
|
||||
import { isWeb } from '@/utils'
|
||||
// import { WGTS_NAV_MAP } from '@/consts'
|
||||
|
||||
/** 配置里可能是数字或字符串,保证 pxTransform 入参为数字 */
|
||||
@@ -129,36 +128,6 @@ export function getGlobalBaseStyle(baseStyle) {
|
||||
}
|
||||
|
||||
const bgType = baseStyle.bgType
|
||||
|
||||
// H5:`taro-view-core` 上对象 style 由 React 与 attachProps 协同,动态 padding 易不生效;
|
||||
// 使用「整段 CSS 字符串」走 attachProps.setAttribute('style', …),与 Taro 注释中 string style 路径一致。
|
||||
if (isWeb) {
|
||||
const chunks = []
|
||||
const pt = toDesignPx(baseStyle.paddedt)
|
||||
if (pt !== null) chunks.push(`padding-top:${Taro.pxTransform(pt)}`)
|
||||
const pb = toDesignPx(baseStyle.paddedb)
|
||||
if (pb !== null) chunks.push(`padding-bottom:${Taro.pxTransform(pb)}`)
|
||||
const pl = toDesignPx(baseStyle.paddedl)
|
||||
if (pl !== null) chunks.push(`padding-left:${Taro.pxTransform(pl)}`)
|
||||
const pr = toDesignPx(baseStyle.paddedr)
|
||||
if (pr !== null) chunks.push(`padding-right:${Taro.pxTransform(pr)}`)
|
||||
|
||||
if (bgType === 'color' && baseStyle.bgColor) {
|
||||
chunks.push(`background-color:${baseStyle.bgColor}`)
|
||||
} else if (bgType === 'pic' && baseStyle.bgPic) {
|
||||
chunks.push(`background-image:url(${baseStyle.bgPic})`)
|
||||
chunks.push('background-size:100% 100%')
|
||||
chunks.push('background-position:center')
|
||||
chunks.push('background-repeat:no-repeat')
|
||||
} else if (bgType === 'gradient' && baseStyle.startColor) {
|
||||
const endColor = baseStyle.endColor || baseStyle.startColor
|
||||
chunks.push(`background-image:linear-gradient(${baseStyle.startColor}, ${endColor})`)
|
||||
chunks.push('background-size:cover')
|
||||
}
|
||||
|
||||
return chunks.length ? { style: chunks.join(';') } : {}
|
||||
}
|
||||
|
||||
const style = {}
|
||||
|
||||
if (baseStyle.paddedt !== undefined && baseStyle.paddedt !== null) {
|
||||
@@ -190,7 +159,6 @@ export function getGlobalBaseStyle(baseStyle) {
|
||||
style.backgroundImage = `linear-gradient(${baseStyle.startColor}, ${endColor})`
|
||||
style.backgroundSize = 'cover'
|
||||
}
|
||||
|
||||
return style
|
||||
}
|
||||
|
||||
|
||||
@@ -1,36 +1,73 @@
|
||||
import React, { useMemo, useState, useEffect, useCallback } from 'react'
|
||||
import Taro from '@tarojs/taro'
|
||||
import { View, Swiper, SwiperItem } from '@tarojs/components'
|
||||
import { View, Swiper, SwiperItem, Text } from '@tarojs/components'
|
||||
import { useSelector } from 'react-redux'
|
||||
import { classNames } from '@/utils'
|
||||
import { SpShop } from '@/components'
|
||||
import api from '@/api'
|
||||
import isArray from 'lodash/isArray'
|
||||
import { useSelector } from 'react-redux'
|
||||
import { $t } from '@/i18n'
|
||||
import { getGlobalBaseStyle } from '../helper'
|
||||
import './index.scss'
|
||||
|
||||
function WgtShop(props) {
|
||||
const { info, id } = props
|
||||
const { base = {}, data = [], noRegionauth = false, pagetype } = info || {} //是否不限制区域
|
||||
const { displayType } = base || {}
|
||||
const { base = {}, data: configData = [], noRegionauth = false, pagetype } = info || {}
|
||||
const dataType = base?.dataType || 'specify'
|
||||
const [currentIndex, setCurrentIndex] = useState(0)
|
||||
const [nearbyList, setNearbyList] = useState([])
|
||||
const [nearbyLoading, setNearbyLoading] = useState(false)
|
||||
const { location = {}, address } = useSelector((state) => state.user)
|
||||
|
||||
const fetchNearbyShops = useCallback(async () => {
|
||||
setNearbyLoading(true)
|
||||
try {
|
||||
const params = {
|
||||
show_discount: 1,
|
||||
type: location?.lat ? 0 : 1,
|
||||
sort_type: 1,
|
||||
lat: location?.lat || address?.lat,
|
||||
lng: location?.lng || address?.lng,
|
||||
province: location?.province || address?.province,
|
||||
city: location?.city || address?.city,
|
||||
district: location?.district || address?.district
|
||||
}
|
||||
const { list = [] } = await api.shop.getNearbyShop(params)
|
||||
setNearbyList(Array.isArray(list) ? list : [])
|
||||
} catch (e) {
|
||||
setNearbyList([])
|
||||
} finally {
|
||||
setNearbyLoading(false)
|
||||
}
|
||||
}, [location, address])
|
||||
|
||||
useEffect(() => {
|
||||
if (dataType !== 'nearby') return
|
||||
fetchNearbyShops()
|
||||
}, [dataType, fetchNearbyShops])
|
||||
|
||||
const displayData = useMemo(() => {
|
||||
if (dataType === 'nearby') {
|
||||
const limit = Number(base.merchantsNumber) > 0 ? Number(base.merchantsNumber) : 3
|
||||
return nearbyList.slice(0, limit)
|
||||
}
|
||||
return configData
|
||||
}, [dataType, nearbyList, configData, base.merchantsNumber])
|
||||
|
||||
useEffect(() => {
|
||||
setCurrentIndex(0)
|
||||
}, [data])
|
||||
}, [displayData])
|
||||
|
||||
// 获取外层样式(包含 outerMargin)
|
||||
const outStyle = useCallback(() => {
|
||||
return getGlobalBaseStyle(base?.outerMargin || {})
|
||||
}, [base])
|
||||
|
||||
// 获取内层样式(包含 innerPadding)
|
||||
const innerStyle = useMemo(() => {
|
||||
return getGlobalBaseStyle(base?.innerPadding || {})
|
||||
}, [base])
|
||||
|
||||
const SwiperHeight = useMemo(() => {
|
||||
const { innerPadding = {} } = base || {}
|
||||
// 勿在 inline style 里写 rpx:H5 浏览器不识别 rpx,height 会失效;用 pxTransform 按端输出 rem/rpx
|
||||
const paddedt =
|
||||
innerPadding?.paddedt != null && innerPadding?.paddedt !== ''
|
||||
? Taro.pxTransform(innerPadding.paddedt)
|
||||
@@ -47,32 +84,38 @@ function WgtShop(props) {
|
||||
setCurrentIndex(e.detail.current)
|
||||
}
|
||||
|
||||
const handleClickItem = async (name, index) => {
|
||||
// 点击事件处理
|
||||
const handleMoreNearby = () => {
|
||||
Taro.navigateTo({ url: '/subpages/store/nearby-list' })
|
||||
}
|
||||
|
||||
console.log(data, 'data')
|
||||
const showEmpty = dataType === 'nearby' && !nearbyLoading && displayData.length === 0
|
||||
const showMore = dataType === 'nearby' && base.show_nearby_merchants
|
||||
|
||||
return (
|
||||
<View
|
||||
className={classNames('wgt-shop', {
|
||||
'wgt-shop--single': data.length == 1
|
||||
'wgt-shop--single': displayData.length === 1
|
||||
})}
|
||||
style={outStyle()}
|
||||
id={`wgt-shop-${id}`}
|
||||
>
|
||||
<View className='wgt-shop__content'>
|
||||
{isArray(data) && data.length > 0 && (
|
||||
<Swiper
|
||||
nextMargin={data.length > 1 ? '24rpx' : 0}
|
||||
previousMargin={data.length > 1 ? '24rpx' : 0}
|
||||
style={{ height: SwiperHeight }}
|
||||
onChange={handleChange}
|
||||
current={currentIndex}
|
||||
className='wgt-shop__content-swiper'
|
||||
>
|
||||
{isArray(data) &&
|
||||
data?.map((item, index) => {
|
||||
{showEmpty ? (
|
||||
<View className='wgt-shop__empty'>
|
||||
<Text className='wgt-shop__empty-txt'>{$t('5eda2f64.d17ff7')}</Text>
|
||||
</View>
|
||||
) : (
|
||||
isArray(displayData) &&
|
||||
displayData.length > 0 && (
|
||||
<Swiper
|
||||
nextMargin={displayData.length > 1 ? '24rpx' : 0}
|
||||
previousMargin={displayData.length > 1 ? '24rpx' : 0}
|
||||
style={{ height: SwiperHeight }}
|
||||
onChange={handleChange}
|
||||
current={currentIndex}
|
||||
className='wgt-shop__content-swiper'
|
||||
>
|
||||
{displayData.map((item, index) => {
|
||||
const slideKey =
|
||||
item?.id != null && item.id !== ''
|
||||
? `shop-${id}-${item.id}`
|
||||
@@ -81,14 +124,13 @@ function WgtShop(props) {
|
||||
<SwiperItem
|
||||
key={slideKey}
|
||||
className={classNames({
|
||||
'wgt-shop__content-swiper-item': data.length > 1
|
||||
'wgt-shop__content-swiper-item': displayData.length > 1
|
||||
})}
|
||||
>
|
||||
<SpShop
|
||||
info={item}
|
||||
style={innerStyle}
|
||||
isActive={currentIndex == index}
|
||||
handleClickItem={() => handleClickItem(item.name, index)}
|
||||
isActive={currentIndex === index}
|
||||
moduleName={base?.track}
|
||||
id={index}
|
||||
noRegionauth={noRegionauth}
|
||||
@@ -97,7 +139,15 @@ function WgtShop(props) {
|
||||
</SwiperItem>
|
||||
)
|
||||
})}
|
||||
</Swiper>
|
||||
</Swiper>
|
||||
)
|
||||
)}
|
||||
{showMore && (
|
||||
<View className='wgt-shop__more' onClick={handleMoreNearby}>
|
||||
<Text className='iconfont icon-spiritling-dingwei' />
|
||||
<Text className='wgt-shop__more-txt'>{$t('5eda2f64.77f8be')}</Text>
|
||||
<Text className='iconfont icon-qianwang-01' />
|
||||
</View>
|
||||
)}
|
||||
</View>
|
||||
</View>
|
||||
|
||||
@@ -31,4 +31,29 @@
|
||||
margin-left: -24px;
|
||||
}
|
||||
}
|
||||
|
||||
&__empty {
|
||||
padding: 48px 32px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
&__empty-txt {
|
||||
font-size: 28px;
|
||||
color: #999;
|
||||
}
|
||||
|
||||
&__more {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 8px;
|
||||
padding: 24px 32px 8px;
|
||||
font-size: 28px;
|
||||
color: #1a1a1a;
|
||||
}
|
||||
|
||||
&__more-txt {
|
||||
flex: 1;
|
||||
text-align: center;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,9 +34,7 @@ const Slider = (props) => {
|
||||
const data = params.data || []
|
||||
// 获取外层样式(包含 outerMargin)
|
||||
const outerStyle = useMemo(() => {
|
||||
return {
|
||||
...getGlobalBaseStyle(base.outerMargin)
|
||||
}
|
||||
return getGlobalBaseStyle(base.outerMargin || {})
|
||||
}, [base, config.firstScreenHeight])
|
||||
|
||||
useEffect(() => {
|
||||
|
||||
@@ -6,7 +6,7 @@ import Taro from '@tarojs/taro'
|
||||
import React, { useState, useEffect, useRef } from 'react'
|
||||
import { View, Text, Button } from '@tarojs/components'
|
||||
import { SpPrivacyModal, SpPage } from '@/components'
|
||||
import { showToast, classNames, VERSION_IN_PURCHASE, getDistributorId } from '@/utils'
|
||||
import { showToast, classNames, VERSION_IN_PURCHASE } from '@/utils'
|
||||
import { useLogin } from '@/hooks'
|
||||
import S from '@/spx'
|
||||
import entryLaunch from '@/utils/entryLaunch'
|
||||
@@ -261,8 +261,7 @@ function PurchaseAuth() {
|
||||
if (VERSION_IN_PURCHASE) {
|
||||
// 纯内购如果有企业则进入选身份页面
|
||||
const data = await api.purchase.getUserEnterprises({
|
||||
disabled: 0,
|
||||
distributor_id: getDistributorId()
|
||||
disabled: 0
|
||||
})
|
||||
const validIdentityLen = data.filter((item) => item.disabled == 0).length
|
||||
if (validIdentityLen) {
|
||||
|
||||
@@ -51,10 +51,22 @@ export default class AlipayBtn extends Component {
|
||||
return_url: `${protocol}//${host}/subpage/pages/cashier/cashier-result?payStatus=fail&order_id=${this.props.orderID}`
|
||||
}
|
||||
try {
|
||||
const { payment } = await api.cashier.getPayment(query)
|
||||
const res = await api.cashier.getPayment(query)
|
||||
if (res.pay_status) {
|
||||
Taro.redirectTo({
|
||||
url: `/subpage/pages/cashier/cashier-result?order_id=${this.props.orderID}`
|
||||
})
|
||||
return
|
||||
}
|
||||
const payment = res.payment
|
||||
if (!payment) {
|
||||
Taro.redirectTo({
|
||||
url: `/subpage/pages/cashier/cashier-result?payStatus=fail&order_id=${this.props.orderID}`
|
||||
})
|
||||
return
|
||||
}
|
||||
const el = document.createElement('div')
|
||||
el.setAttribute('class', SYMBOL)
|
||||
//el.innerHTML='<form id="a" name="test"></form>'
|
||||
el.innerHTML = payment.replace(/<script>(.*)?<\/script>/, '')
|
||||
document.body.appendChild(el)
|
||||
|
||||
|
||||
@@ -87,7 +87,9 @@ function CartIndex() {
|
||||
exchange_item = pickBy(plus_item, { ...doc.cart.CART_GOODS_ITEM, activity_id })
|
||||
}
|
||||
all_plus_itemid_list.push(activity_item_ids)
|
||||
const general_goods = list.filter((k) => activity_item_ids.indexOf(k.item_id) > -1)
|
||||
const general_goods = list.filter((k) =>
|
||||
(activity_item_ids || []).some((id) => String(id) === String(k.item_id))
|
||||
)
|
||||
return {
|
||||
...plusitem,
|
||||
cus_general_goods_list: general_goods,
|
||||
@@ -97,7 +99,7 @@ function CartIndex() {
|
||||
all_plus_itemid_list = all_plus_itemid_list.toString().split(',')
|
||||
const goodsMap = reduceTransform(list, 'cart_id')
|
||||
for (const key in goodsMap) {
|
||||
if (all_plus_itemid_list.indexOf(goodsMap[key].item_id) < 0) {
|
||||
if (!all_plus_itemid_list.includes(String(goodsMap[key].item_id))) {
|
||||
no_active_item.push(goodsMap[key])
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ import { buildSharePath, getMemberLevel } from '@/utils'
|
||||
import { SpLogin, SpImage, SpTabbar, SpPage, SpPoweredBy } from '@/components'
|
||||
import api from '@/api'
|
||||
import * as communityApi from '@/api/community'
|
||||
import { log, VERSION_PLATFORM, VERSION_STANDARD, getDistributorId } from '@/utils'
|
||||
import { log, VERSION_PLATFORM, VERSION_STANDARD } from '@/utils'
|
||||
import {
|
||||
updatePurchaseShareInfo,
|
||||
updateInviteCode,
|
||||
@@ -389,8 +389,7 @@ function MemberIndex(props) {
|
||||
|
||||
if (key == 'purchase') {
|
||||
const data = await api.purchase.getUserEnterprises({
|
||||
disabled: 0,
|
||||
distributor_id: getDistributorId()
|
||||
disabled: 0
|
||||
})
|
||||
if (data?.length > 0) {
|
||||
Taro.navigateTo({ url: '/subpages/purchase/select-identity' })
|
||||
|
||||
@@ -9,7 +9,7 @@ import { useImmer } from 'use-immer'
|
||||
import { View, Text, ScrollView } from '@tarojs/components'
|
||||
import dayjs from 'dayjs'
|
||||
import api from '@/api'
|
||||
import { classNames, pickBy, getDistributorId, VERSION_IN_PURCHASE, showToast } from '@/utils'
|
||||
import { classNames, pickBy, VERSION_IN_PURCHASE, showToast } from '@/utils'
|
||||
import { updateUserInfo } from '@/store/slices/user'
|
||||
import { updateActivityInfo, updateCount, updateIsPasscodeLogin } from '@/store/slices/purchase'
|
||||
import doc from '@/doc'
|
||||
@@ -80,7 +80,6 @@ function PurchaseActivityList() {
|
||||
if (VERSION_IN_PURCHASE) {
|
||||
const data = await api.purchase.getUserEnterprises({
|
||||
disabled: 0,
|
||||
distributor_id: getDistributorId()
|
||||
})
|
||||
const validIdentityLen = data.filter((item) => item.disabled == 0).length
|
||||
if (!validIdentityLen) {
|
||||
@@ -265,7 +264,7 @@ function PurchaseActivityList() {
|
||||
return (
|
||||
<View key={item.id} className='activity-card'>
|
||||
<View className='activity-card__cover'>
|
||||
<SpImage className='activity-card__img' mode='aspectFill' src={item.pic} />
|
||||
<SpImage className='activity-card__img' mode='aspectFill' src={item.list_pic} />
|
||||
<View
|
||||
className={classNames(
|
||||
'activity-card__badge',
|
||||
|
||||
@@ -10,42 +10,61 @@
|
||||
|
||||
.switch-box {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
align-items: center;
|
||||
align-items: stretch;
|
||||
box-sizing: border-box;
|
||||
width: 100%;
|
||||
padding-bottom: 40px;
|
||||
}
|
||||
|
||||
/* Figma 169:750 配送方式分段条 */
|
||||
.switch-tab {
|
||||
display: flex;
|
||||
font-size: 24px;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
background: #f3f4f6;
|
||||
border-radius: 24px;
|
||||
width: 100%;
|
||||
box-sizing: border-box;
|
||||
padding: 0;
|
||||
overflow: hidden;
|
||||
|
||||
.switch-item {
|
||||
flex: 1;
|
||||
text-align: center;
|
||||
height: 100%;
|
||||
line-height: 100%;
|
||||
color: #4A5565;
|
||||
min-width: 0;
|
||||
height: 110px;
|
||||
border-radius: 24px;
|
||||
color: #4a5565;
|
||||
background: transparent;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 8px;
|
||||
.switch-item__ico{
|
||||
font-size: 48px;
|
||||
gap: 10px;
|
||||
box-sizing: border-box;
|
||||
|
||||
.switch-item__ico {
|
||||
font-size: 44px;
|
||||
flex-shrink: 0;
|
||||
color: #999999;
|
||||
}
|
||||
|
||||
.switch-item__txt {
|
||||
font-size: 24px;
|
||||
line-height: 32px;
|
||||
font-weight: 400;
|
||||
}
|
||||
|
||||
&.active {
|
||||
height: 90px;
|
||||
flex: 1.3;
|
||||
font-size: 30px;
|
||||
font-weight: 500;
|
||||
color: var(--color-primary);
|
||||
// background: rgba(var(--color-rgb), 0.4);
|
||||
background: #fff;
|
||||
box-shadow: 0 -5px 10px 0 #eaeaea;
|
||||
z-index: 999;
|
||||
background: #0a0a0a;
|
||||
color: #ffffff;
|
||||
|
||||
.switch-item__ico {
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
.switch-item__txt {
|
||||
font-weight: 400;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,7 +14,6 @@ import {
|
||||
isObjectsValue,
|
||||
isWeixin,
|
||||
pickBy,
|
||||
getDistributorId,
|
||||
merchantIsvaild,
|
||||
showToast,
|
||||
isWeb,
|
||||
@@ -142,7 +141,6 @@ function PurchaseCheckout(props) {
|
||||
try {
|
||||
const data = await api.purchase.getUserEnterprises({
|
||||
disabled: 0,
|
||||
distributor_id: getDistributorId()
|
||||
})
|
||||
const found = data?.find((x) => x.enterprise_id == eid)
|
||||
setEnterpriseName(found?.name || found?.enterprise_name || '')
|
||||
|
||||
@@ -46,6 +46,11 @@
|
||||
white-space: pre-line;
|
||||
}
|
||||
|
||||
&__deliver-wrap {
|
||||
box-sizing: border-box;
|
||||
width: 100%;
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
|
||||
/* 白卡片:左右 32 仅作用在卡片上(与 SpPurchaseDeliver 内边距对齐),不占满顶栏 */
|
||||
&__card {
|
||||
|
||||
@@ -236,7 +236,6 @@ function EspierDetail(props) {
|
||||
try {
|
||||
const data = await api.purchase.getUserEnterprises({
|
||||
disabled: 0,
|
||||
distributor_id: getDistributorId()
|
||||
})
|
||||
const found = data?.find((x) => x.enterprise_id == eid)
|
||||
setEnterpriseName(found?.name || found?.enterprise_name || '')
|
||||
|
||||
@@ -155,7 +155,6 @@ function CartIndex() {
|
||||
try {
|
||||
const data = await api.purchase.getUserEnterprises({
|
||||
disabled: 0,
|
||||
distributor_id: getDistributorId()
|
||||
})
|
||||
const found = data?.find((x) => x.enterprise_id == eid)
|
||||
setEnterpriseName(found?.name || found?.enterprise_name || '')
|
||||
@@ -258,7 +257,9 @@ function CartIndex() {
|
||||
exchange_item = pickBy(plus_item, { ...doc.cart.PLUS_BUY_ITEM, activity_id })
|
||||
}
|
||||
all_plus_itemid_list.push(activity_item_ids)
|
||||
const general_goods = list.filter((k) => activity_item_ids.indexOf(k.item_id) > -1)
|
||||
const general_goods = list.filter((k) =>
|
||||
(activity_item_ids || []).some((id) => String(id) === String(k.item_id))
|
||||
)
|
||||
return {
|
||||
...plusitem,
|
||||
cus_general_goods_list: general_goods,
|
||||
@@ -268,7 +269,7 @@ function CartIndex() {
|
||||
all_plus_itemid_list = all_plus_itemid_list.toString().split(',')
|
||||
const goodsMap = reduceTransform(list, 'cart_id')
|
||||
for (const key in goodsMap) {
|
||||
if (all_plus_itemid_list.indexOf(goodsMap[key].item_id) < 0) {
|
||||
if (!all_plus_itemid_list.includes(String(goodsMap[key].item_id))) {
|
||||
no_active_item.push(goodsMap[key])
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,24 +9,13 @@ import { useSelector, useDispatch } from 'react-redux'
|
||||
import { SpPage, SpPrivacyModal, SpPoster, SpImage, SpPurchaseEnterpriseBar } from '@/components'
|
||||
import { SharePurchase } from '@/subpages/components'
|
||||
import api from '@/api'
|
||||
import {
|
||||
isWeixin,
|
||||
VERSION_STANDARD,
|
||||
VERSION_PLATFORM,
|
||||
classNames,
|
||||
pickBy,
|
||||
showToast,
|
||||
log,
|
||||
buildSharePath,
|
||||
navigateTo
|
||||
} from '@/utils'
|
||||
import { pickBy, showToast, log, buildSharePath, navigateTo } from '@/utils'
|
||||
import { updatePurchaseShareInfo, updatePersistPurchaseShareInfo } from '@/store/slices/purchase'
|
||||
import doc from '@/doc'
|
||||
import { useImmer } from 'use-immer'
|
||||
import { useLogin, useNavigation } from '@/hooks'
|
||||
import { useTranslation, $t } from '@/i18n'
|
||||
import HomeWgts from '@/pages/home/comps/home-wgts'
|
||||
import { WgtHomeHeader } from '@/pages/home/wgts'
|
||||
import CompPurchaseNav from '@/pages/purchase/comps/comp-purchase-nav'
|
||||
import configStore from '@/store'
|
||||
import { WgtsContext } from '@/pages/home/wgts/wgts-context'
|
||||
@@ -56,7 +45,7 @@ const { store } = configStore()
|
||||
function Home() {
|
||||
useTranslation()
|
||||
const [state, setState] = useImmer(initialState)
|
||||
const { initState, entryStoreByLBS, appName } = useSelector((state) => state.sys)
|
||||
const { initState, appName } = useSelector((state) => state.sys)
|
||||
const { purchase_share_info = {}, persist_purchase_share_info = {} } = useSelector(
|
||||
(state) => state.purchase
|
||||
)
|
||||
@@ -73,7 +62,6 @@ function Home() {
|
||||
|
||||
const [policyModal, setPolicyModal] = useState(false)
|
||||
const [quotaSheetOpen, setQuotaSheetOpen] = useState(false)
|
||||
const { openScanQrcode } = useSelector((state) => state.sys)
|
||||
const { setNavigationBarTitle } = useNavigation()
|
||||
|
||||
const {
|
||||
@@ -316,9 +304,6 @@ function Home() {
|
||||
/* 顶栏搜索为固定稿样式,不读装修;若模板仍下发 search 组件则从正文排除避免重复 */
|
||||
let filterWgts = wgts.filter((wgt) => wgt.name != 'page' && wgt.name !== 'search')
|
||||
|
||||
const isShowHomeHeader =
|
||||
VERSION_PLATFORM || (openScanQrcode == 1 && isWeixin) || (VERSION_STANDARD && entryStoreByLBS)
|
||||
|
||||
const onAddToCart = async ({ itemId, distributorId }) => {
|
||||
Taro.showLoading()
|
||||
try {
|
||||
@@ -405,19 +390,8 @@ function Home() {
|
||||
}
|
||||
loading={loading}
|
||||
>
|
||||
<ScrollView
|
||||
className={classNames('purchase-page__scroll', 'home-body', {
|
||||
'has-home-header': isShowHomeHeader && isWeixin
|
||||
})}
|
||||
scrollY
|
||||
>
|
||||
<ScrollView className='purchase-page__scroll home-body' scrollY>
|
||||
<View className='purchase-page'>
|
||||
{isShowHomeHeader && process.env.APP_PLATFORM === 'platform' && (
|
||||
<View className='purchase-page__toolbar'>
|
||||
<WgtHomeHeader />
|
||||
</View>
|
||||
)}
|
||||
|
||||
<View className='purchase-page__head'>
|
||||
<SpPurchaseEnterpriseBar showSearch />
|
||||
</View>
|
||||
|
||||
@@ -36,19 +36,6 @@ $page-bg: #eef1f7;
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
|
||||
/* 平台顶栏(地区 / 扫码)与下方企业抬头区分 */
|
||||
.purchase-page__toolbar {
|
||||
margin: 0 16px 12px;
|
||||
padding: 0 4px;
|
||||
border-radius: 16px;
|
||||
background: #fff;
|
||||
box-shadow: 0 4px 18px rgba(21, 34, 56, 0.06);
|
||||
}
|
||||
|
||||
.purchase-page__toolbar .home-header {
|
||||
border-radius: 16px;
|
||||
}
|
||||
|
||||
.float-share {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
|
||||
@@ -142,7 +142,6 @@ function ItemList() {
|
||||
try {
|
||||
const data = await api.purchase.getUserEnterprises({
|
||||
disabled: 0,
|
||||
distributor_id: getDistributorId()
|
||||
})
|
||||
const found = data?.find((x) => x.enterprise_id == eid)
|
||||
setEnterpriseName(found?.name || found?.enterprise_name || '')
|
||||
|
||||
@@ -80,7 +80,6 @@ function PurchaseAuthEmail() {
|
||||
try {
|
||||
const list = await api.purchase.getUserEnterprises({
|
||||
disabled: 0,
|
||||
distributor_id: getDistributorId()
|
||||
})
|
||||
const found = (list || []).find(
|
||||
(item) => String(item?.id ?? item?.enterprise_id) === String(enterprise_id)
|
||||
|
||||
@@ -82,7 +82,6 @@ function SelectIdentity(props) {
|
||||
if (VERSION_IN_PURCHASE) {
|
||||
const pdata = await api.purchase.getUserEnterprises({
|
||||
disabled: 0,
|
||||
distributor_id: getDistributorId()
|
||||
})
|
||||
const validIdentityLen = pdata.filter((item) => item.disabled == 0).length
|
||||
if (!validIdentityLen) {
|
||||
|
||||
@@ -11,7 +11,7 @@ import { SharePurchase } from '@/subpages/components'
|
||||
import api from '@/api'
|
||||
import { connect } from 'react-redux'
|
||||
import { withPager } from '@/hocs'
|
||||
import { formatDateTime, getDistributorId, log } from '@/utils'
|
||||
import { formatDateTime, log } from '@/utils'
|
||||
import { $t, i18n } from '@/i18n'
|
||||
import './share.scss'
|
||||
|
||||
@@ -63,7 +63,6 @@ export default class PurchaseIndex extends Component {
|
||||
try {
|
||||
const data = await api.purchase.getUserEnterprises({
|
||||
disabled: 0,
|
||||
distributor_id: getDistributorId()
|
||||
})
|
||||
const found = data?.find((x) => x.enterprise_id == eid)
|
||||
this.setState({
|
||||
|
||||
Reference in New Issue
Block a user