main
王文龙 2024-03-06 10:36:24 +08:00
parent 0a2e723acf
commit bf9a9fb6e3
19 changed files with 208 additions and 54 deletions

View File

@ -41,7 +41,6 @@ function SpCoupon (props) {
status,
valid,
} = info
console.log("🚀 ~ info:", info)
const { tag, invalidBg, bg } = COUPON_TYPE[cardType]
const couponTagBg = info.tagClass === 'used' || info.tagClass === 'overdue' || !info.valid ? invalidBg : bg

View File

@ -60,6 +60,7 @@ function SpGoodsCell (props) {
}
// console.log('isNaN(memberPrice):', info.orderItemType)
const max = parseInt(info?.limitedBuy ? info?.limitedBuy?.limit_buy : info.store)
return (
<>
<View className='sp-goods-cell'>
@ -129,7 +130,7 @@ function SpGoodsCell (props) {
</View>}
<View className='item-ft'>
{info.num && <Text className='item-num'>数量{info.num}</Text>}
{info.num && <Text className='item-num'>数量{info.num} {max <= 5 && <Text style={{ marginLeft: '10px' }}>(库存紧张)</Text>}</Text>}
</View>
</View>
</View>

View File

@ -52,6 +52,7 @@ function SpPage (props, ref) {
showNavkfIcon = false,
showNavHomeIcon = false,
showNavSearchIcon = false,
showLogoLoading = false,
} = props
let { renderTitle } = props
const wrapRef = useRef(null)
@ -371,6 +372,10 @@ function SpPage (props, ref) {
{/* {loading && <SpNote img='loading.gif' />} */}
{loading && <SpLoading />}
{showLogoLoading && <View className='loading-box'>
<SpImage height={244} width={244} src='logo-load.jpg' isNew />
</View>}
{!isDefault && !loading && <View className='sp-page-body' style={styleNames({

View File

@ -212,4 +212,33 @@
}
}
}
.loading-box {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
z-index: 1100;
background: rgba(255, 255, 255, 0.6);
animation: fadeInAnimation 0.3s ease-in;
.sp-image {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 300px;
height: 300px;
display: flex;
justify-content: center;
align-items: center;
}
}
@keyframes fadeInAnimation {
from {
opacity: 0;
}
to {
opacity: 1;
}
}
}

View File

@ -31,7 +31,9 @@ const initialState = {
isClickNum: false,
isClickPattern: false,
showClickPattern: false,
skuTxtArr: []
skuTxtArr: [],
selSkuList: [],
isNotStore: false
}
function SpSkuSelect (props, ref) {
@ -47,9 +49,10 @@ function SpSkuSelect (props, ref) {
// console.log('SpSkuSelect:info', info)
// const [state, setState] = useImmer(initialState)
const [state, setState] = useAsyncCallback(initialState)
const { selection, curImage, disabledSet, curItem, skuText, num, loading, isClickSku, showClickPattern, skuTxtArr } = state
const { selection, curImage, disabledSet, curItem, skuText, num, loading, isClickSku, showClickPattern, skuTxtArr, isClickPattern, selSkuList, isNotStore } = state
const dispatch = useDispatch()
const skuDictRef = useRef({})
const selKey = selSkuList[0] + '_' + selSkuList[1]
useEffect(() => {
if (info && !info.nospec) {
@ -82,6 +85,9 @@ function SpSkuSelect (props, ref) {
}
calcDisabled(selection, -1)
setState((draft) => {
draft.selSkuList[0] = selection[0]
})
}
const calcDisabled = (selection, e = 0) => {
@ -156,37 +162,50 @@ function SpSkuSelect (props, ref) {
// console.log('disabledSet:', disabledSet)
const handleSelectSku = (spec, idx) => {
const handleSelectSku = async (spec, idx) => {
if (!isClickPattern && idx === 2) {
return showToast('请先选择版型')
}
const { specId } = spec
const _selection = [...selection]
_selection[idx] = specId
const key = _selection.join('_')
const row = skuDictRef.current[key] || {}
if (row?.store <= 0) {
if (disabledSet.has(specId) && idx !== 2) return
setState((draft) => {
draft.selection[idx] = specId //null
draft.curImage = 1
})
return showToast('该规格库存为空')
}
if (!state.isClickNum) {
setState((draft) => {
draft.isClickNum = idx === 2
})
}
if (!state.isClickPattern) {
setState((draft) => {
// if (row?.store <= 0 && isClickPattern) {
// if (disabledSet.has(specId) && idx !== 2) return
// setState((draft) => {
// draft.selection[idx] = specId //null
// draft.curImage = 1
// })
// return showToast('该规格库存为空')
// }
if (!isClickPattern) {
await setState((draft) => {
draft.isClickPattern = idx === 1
})
}
setState(
if (!state.isClickNum) {
await setState((draft) => {
draft.isClickNum = idx === 2
})
}
const _selKey = _selection.slice(0, 2).join('_')
const isNotStore = ((idx === 0 && isClickPattern) || idx === 1) && Object.keys(skuDictRef.current).every((key) => {
if (key.indexOf(_selKey) === 0) {
return skuDictRef.current[key].store <= 0 && ['onsale'].includes(skuDictRef.current[key].approveStatus)
} else {
return true
}
})
await setState(
(draft) => {
draft.selection[idx] = specId //null
draft.selSkuList[idx] = specId
draft.curImage = 1
draft.isClickSku = draft.isClickNum ? row.store > 0 : idx === 2
draft.showClickPattern = draft.isClickPattern ? row.store > 0 : idx === 1
draft.isNotStore = isNotStore
},
(row) => {
calcDisabled(row.selection, idx)
@ -428,7 +447,7 @@ function SpSkuSelect (props, ref) {
<View
className={classNames('sku-btn', {
'active': spec.specId == selection[index],
'disabled': disabledSet.has(spec.specId),
'disabled': isClickSku && disabledSet.has(spec.specId),
})}
onClick={handleSelectSku.bind(this, spec, index)}
key={`sku-values-item__${idx}`}
@ -438,21 +457,38 @@ function SpSkuSelect (props, ref) {
)
)}
</ScrollView>}
{index > 0 && (item.skuValue.length > 0 ? item.skuValue.map((spec, idx) => (
{/* {index > 0 && (item.skuValue.length > 0 ? item.skuValue.map((spec, idx) => (
<>
{index === 2 && (showClickPattern && disabledSet.has(spec.specId)) ? null : <View
className={classNames('sku-btn btn-noac', {
'active': spec.specId == selection[index],
'btn-primary': index !== 2 ? index === 1 ? spec.specId == selection[index] && showClickPattern : spec.specId == selection[index] : spec.specId == selection[index] && isClickSku,
'disabled': index === 1 && disabledSet.has(spec.specId),
'disabled': isClickPattern && index === 1 && disabledSet.has(spec.specId),
'sku-img': spec.specImgs.length > 0
})}
onClick={handleSelectSku.bind(this, spec, index)}
key={`sku-values-item__${idx}`}
>
<View className={classNames('spec-name', { 'pad': index === 2 })}>{spec.specName}</View>
</View>}
</>
)) : <View className="spec-name">暂无库存</View>)} */}
{/*
上面是备份下面为修改2024-03-05
窄版只显示35-39 库存0置灰常规版显示所有 库存0不显示
*/}
{index > 0 && (item.skuValue.length > 0 ? item.skuValue.map((spec, idx) => (
// index === 2 && isNotStore ? null :
<>
{(index === 1 || !isClickPattern || (selSkuList[1] === '5' && spec.specName < 40) || (selSkuList[1] === '6' && skuDictRef.current[selKey + '_' + spec.specId]?.store > 0)) && <View
className={classNames('sku-btn btn-noac', {
'btn-primary': spec.specId === selSkuList[index],
'disabled': selSkuList[1] === 5 && skuDictRef.current[selKey + '_' + spec.specId]?.store <= 0,
'sku-img': spec.specImgs.length > 0
})}
onClick={handleSelectSku.bind(this, spec, index)}
key={`sku-values-item__${idx}`}
>
{/* {spec.specImgs.length > 0 && (
<SpImage src={spec.specImgs[0]} width={260} height={260} />
)} */}
<View className={classNames('spec-name', { 'pad': index === 2 })}>{spec.specName}</View>
</View>}
</>
@ -460,6 +496,7 @@ function SpSkuSelect (props, ref) {
</View>
</View>
))}
{isNotStore && <View style={{ padding: '10rpx 0' }}>暂无库存</View>}
{/* {!hideInputNumber && renderLimitTip()} */}
<View className="select">
{/* {skuText.split(' ').map((item, index) => <Text key={`sku-text__${index}`} style={{ marginRight: '14px' }}>{item}</Text>)} */}

View File

@ -11,6 +11,7 @@ export const CHECKOUT_GOODS_ITEM = {
origincountry_name: 'origincountry_name',
point: 'point',
isPoint: 'is_point',
store: 'store',
item_point: 'item_point',
price: ({ price }) => price / 100, // 销售价
activityPrice: ({ activity_price }) => activity_price / 100, // 秒杀价

View File

@ -20,7 +20,8 @@ function CompGoodsItem (props) {
onDelete = () => { },
onChange = () => { },
onClickImgAndTitle = () => { },
onChangeGoodsIsCheck = () => { }
onChangeGoodsIsCheck = () => { },
showWarning = false
} = props
const { priceSetting } = useSelector((state) => state.sys)
const { userInfo = {}, vipInfo = {} } = useSelector((state) => state.user)
@ -68,7 +69,7 @@ function CompGoodsItem (props) {
limitTxt = `${info?.limitedBuy?.rule.day}天,限购${limitNum}`
}
}
const max = parseInt(info?.limitedBuy ? info?.limitedBuy?.limit_buy : info.store)
return (
<View>
{children}
@ -125,13 +126,14 @@ function CompGoodsItem (props) {
{isShowAddInput ? (
<SpInputNumber
value={localNum}
max={parseInt(info?.limitedBuy ? info?.limitedBuy?.limit_buy : info.store)}
max={max}
min={1}
onChange={onChangeInputNumber}
/>
) : (
<Text className='item-num'>x {info.num}</Text>
)}
{showWarning && max <= 5 && <Text style={{ marginLeft: '10px' }}>(库存紧张)</Text>}
</View>
<SpPrice value={_price / 100} noDecimal={false} size={20} showSeparator />
{info.market_price > 0 && enMarketPrice && (

View File

@ -880,7 +880,7 @@ function CartCheckout (props) {
<View className='goods-list'>
{detailInfo.map((item, idx) => (
<View className='sp-order-item__wrap' key={idx}>
<SpGoodsCell info={item} />
<SpGoodsCell info={item} showWarning />
{/* <SpOrderItem
key={`${idx}1`}
info={item}

View File

@ -35,7 +35,8 @@ import './espier-index.scss'
const initialState = {
recommendList: [], // 猜你喜欢
current: 0, // 0:普通商品 1:跨境商品
policyModal: false // 隐私弹框
policyModal: false, // 隐私弹框
loading: false
}
function CartIndex () {
@ -51,7 +52,7 @@ function CartIndex () {
const router = $instance.router
const [state, setState] = useImmer(initialState)
const { current, recommendList, policyModal } = state
const { current, recommendList, policyModal, loading } = state
const { colorPrimary, openRecommend } = useSelector((state) => state.sys)
const { validCart = [], invalidCart = [], cartCount } = useSelector((state) => state.cart)
@ -66,7 +67,6 @@ function CartIndex () {
}, [isLogin])
useDidShow(() => {
console.log('useDidShow', isLogin)
if (isLogin) fetch()
})
@ -80,14 +80,20 @@ function CartIndex () {
}
const getCartList = async () => {
Taro.showLoading({ title: '' })
// Taro.showLoading({ title: '', })
setState((draft) => {
draft.loading = true
})
const { type = 'distributor' } = router?.params || {}
const params = {
shop_type: type
}
await dispatch(fetchCartList(params))
await dispatch(updateCount(params))
Taro.hideLoading()
setState((draft) => {
draft.loading = false
})
}
const resolveActiveGroup = () => {
@ -166,7 +172,6 @@ function CartIndex () {
page: 1,
pageSize: 1000
})
console.log("🚀 ~ list:----169", list)
setState((draft) => {
draft.recommendList = list
})
@ -183,7 +188,10 @@ function CartIndex () {
// }
const onChangeGoodsIsCheck = async (item, type, checked) => {
Taro.showLoading({ title: '' })
// Taro.showLoading({ title: '' })
setState((draft) => {
draft.loading = true
})
let parmas = { is_checked: checked }
if (type === 'all') {
const cartIds = item.list.map((item) => item.cart_id)
@ -216,6 +224,9 @@ function CartIndex () {
const onChangeCartGoodsItem = useDebounce(async (item, num) => {
console.log(`onChangeCartGoodsItem:`, num)
setState((draft) => {
draft.loading = true
})
let { shop_id, cart_id } = item
const { type = 'distributor' } = router.params
await dispatch(updateCartItemNum({ shop_id, cart_id, num, type }))
@ -271,6 +282,7 @@ function CartIndex () {
'has-tabbar': tabbar == 1
})}
renderFooter={tabbar == 1 && <SpTabbar />}
showLogoLoading={loading}
showNavLogo isBlack showNavkfIcon
>
{/* {!isLogin && (
@ -353,6 +365,7 @@ function CartIndex () {
onChange={onChangeCartGoodsItem.bind(this, c_sitem)}
onChangeGoodsIsCheck={onChangeGoodsIsCheck.bind(this, c_sitem, 'single', !c_sitem.is_checked)}
onClickImgAndTitle={onClickImgAndTitle.bind(this, c_sitem)}
showWarning
/>
</View>
{/**组合商品开始 */}

View File

@ -69,7 +69,7 @@
padding: 26px 40px 26px 60px;
position: fixed;
bottom: calc(#{$page-ipx-footer-height} - 2px);
z-index: 1080;
z-index: 100;
left: 0;
right: 0;
border-top: 1px solid #d9d9d9;

View File

@ -76,6 +76,31 @@ page {
// &.swiper-narrow {
// height: calc(100vh - 620px - #{$tabbar-height} - var(--status-bar-height));
// }
position: relative;
}
.item-img-box {
position: absolute;
left: 50%;
transform: translate(-50%, 0%);
bottom: 0px;
z-index: 99;
animation: fadeInAnimation 0.35s ease-in;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
.item-img-txt {
font-size: 26px;
color: #fff;
position: absolute;
bottom: 74rpx;
}
}
.item-img {
width: 190px;
height: 120px;
object-fit: contain;
margin-bottom: 6px;
}
.swiper-narrow {
// height: calc(100vh - 620px - #{$tabbar-height} - var(--status-bar-height));
@ -119,10 +144,11 @@ page {
}
}
.spot-pagination {
animation: fadeInAnimation 0.35s ease-in;
position: absolute;
left: 50%;
transform: translateX(-50%);
bottom: 6%;
bottom: 10%;
display: flex;
justify-content: center;
width: 80%;

View File

@ -500,13 +500,17 @@ function Home () {
{/* {isUpOperation && <View className="item-btns">
<View className="item-tit">BOSTON</View>
<View className="item-btn">
<View className="item-btn-txt">立即预约</View>
<View className="item-btn-icon icon-my icon-arrow-right"></View>
<View className="item-btn-txt">立即预约</View>
<View className="item-btn-icon icon-my icon-arrow-right"></View>
</View>
</View>} */}
</SwiperItem>
))}
</Swiper>
{!isUpOperation && <View className="item-img-box">
<View className="item-img-txt"> </View>
<Image className="item-img" height="62" src={require('../assets/i-sou.gif')} isShowMenuByLongpress={false} lazyLoad isNew={false} />
</View>}
{!isUpOperation && <View className='spot-pagination'>
{swiperList.map((_, index) => (
<View key={index} className={'spot-pagination-bullet ' + ((state.currentIndex == index) ? 'spot-pagination-bullet-active' : "")} style={{ width: 1 / state.length * 100 + '%' }}></View>

View File

@ -64,8 +64,9 @@ function CompEvaluation (props) {
<View className="evaluation-content-line"></View>
</View>
))}
<View className="click-all" onClick={onViewMore}>查看全部 <Text className='iconfont icon-qianwang-01'></Text></View>
{list.length == 0 && <View className='default-msg'>暂无商品评价</View>}
{list.length == 0 ? <View className='default-msg'>暂无商品评价</View>
: <View className="click-all" onClick={onViewMore}>查看全部 <Text className='iconfont icon-qianwang-01'></Text></View>
}
</View>
</View>
)

View File

@ -12,7 +12,7 @@ import {
SpPage,
SpScrollView,
SpDrawer,
SpSelect
SpNote
} from '@/components'
import { fetchUserFavs } from '@/store/slices/user'
import doc from '@/doc'
@ -330,6 +330,12 @@ function ItemList () {
url
})
}
const renderEmpty = () => {
return (<SpNote className='sp-note-1' isUrl img={`${process.env.APP_IMAGE_CDN_NEW}/cart/logo-hui.png`} height={144} width={144}>
抱歉 没有搜索到结果
</SpNote>)
}
return (
<SpPage
scrollToTopBtn
@ -370,7 +376,7 @@ function ItemList () {
/>
</View>
<View className='item-list-head'>
{tagList.length > 0 && (
{false && tagList.length > 0 && (
<SpTagBar className='tag-list' list={tagList} value={curTagIdx} onChange={onChangeTag}>
{/* <View
className="filter-btn"
@ -390,7 +396,7 @@ function ItemList () {
onChange={handleFilterChange}
/>
</View>
<SpScrollView className='item-list-scroll' auto={false} ref={goodsRef} fetch={fetch}>
<SpScrollView className='item-list-scroll' auto={false} ref={goodsRef} fetch={fetch} renderEmpty={renderEmpty()}>
<View className='goods-list'>
<View className='left-container'>
{leftList.map((list, idx) => {

View File

@ -71,8 +71,19 @@
// /* #ifdef h5 */
// @include page-scroll($searchbar-height + $navigate-height + 16 * 2 + $tabs-height + 10, 0);
// /* #endif */
.sp-note {
margin-bottom: 50px;
// .sp-note {
// margin-bottom: 50px;
// }
.sp-note-1 {
.sp-image {
margin-top: 300px;
}
> .sp-note__text {
margin-top: 24px;
font-weight: bold;
font-size: 40px;
color: #000;
}
}
}
.filter-btn {

View File

@ -49,7 +49,6 @@ export default class ItemFav extends Component {
}
onShareTimeline (res) {
console.log("🚀 ~ ItemFav ~ res:", res)
return this.getAppShareInfo()
}
@ -358,7 +357,9 @@ export default class ItemFav extends Component {
{/* {page.isLoading ? <Loading>正在加载...</Loading> : null} */}
{/* !page.isLoading && */}
{!page.hasNext && !list.length && (
<SpNote img='trades_empty.png'>暂无数据~</SpNote>
<SpNote isUrl img={`${process.env.APP_IMAGE_CDN_NEW}/cart/logo-hui.png`} height={144} width={144}>
暂无收藏商品
</SpNote>
)}
</ScrollView>

View File

@ -84,6 +84,17 @@
/* #ifdef h5 */
top: $navigate-height-h5 + $tabs-height + 29px;
/* #endif */
.sp-note {
.sp-image {
margin-top: 400px;
}
&__text {
margin-top: 24px;
font-weight: bold;
font-size: 40px;
color: #000;
}
}
}
&__type-grid {
display: flex;

View File

@ -587,7 +587,7 @@ export default class RecommendList extends Component {
const height = windowWidth * 9 / 17
return (
<SpPage renderFooter={<SpTabbar />} className='has-nav' title="" isBlack>
<SpPage renderFooter={<SpTabbar />} loading={page.isLoading} className='has-nav' title="" isBlack>
<View className='page-recommend-list'>
{false && <>
<View className='recommend-list__toolbar'>

View File

@ -102,7 +102,8 @@ const initialState = {
finishNum: 0,
zitiNum: 0,
deposit: 0,
isOpen: false
isOpen: false,
loading: false
}
function MemberIndex (props) {
@ -132,12 +133,18 @@ function MemberIndex (props) {
})
useEffect(() => {
if (isLogin) {
setState((draft) => {
draft.loading = true
})
getMemberCenterData()
setMemberBackground()
const { redirect } = $instance.router.params
if (redirect) {
Taro.redirectTo({ url: decodeURIComponent(redirect) })
}
setState((draft) => {
draft.loading = false
})
}
}, [isLogin])
@ -459,7 +466,7 @@ function MemberIndex (props) {
// console.log('====config===', config.menu)
return (
<SpPage className='pages-member-index has-navbar' renderFooter={<SpTabbar />} isTop>
<SpPage loading={state.loading} className='pages-member-index has-navbar' renderFooter={<SpTabbar />} isTop>
<View
className='header-block'
style={styleNames({