暂时完成相关接口
This commit is contained in:
parent
dad0452831
commit
6d62c87253
@ -86,11 +86,13 @@ function Index() {
|
||||
{
|
||||
list.map((item, index) => {
|
||||
return <View className='addr-item' key={item.id}>
|
||||
<View className='addr-icon w-6 h-6' onClick={() => {
|
||||
setAddrId(item.id)
|
||||
}}>
|
||||
<Image src={addrId == item.id ? checked : uncheck} className="w-6 h-6" />
|
||||
</View>
|
||||
{
|
||||
!home && <View className='addr-icon w-6 h-6' onClick={() => {
|
||||
setAddrId(item.id)
|
||||
}}>
|
||||
<Image src={addrId == item.id ? checked : uncheck} className="w-6 h-6" />
|
||||
</View>
|
||||
}
|
||||
<View className='addr-item-content' onClick={() => {
|
||||
setAddrId(item.id)
|
||||
onSelect(item.id)
|
||||
|
@ -118,7 +118,7 @@ const Index = () => {
|
||||
<View className='my-tool-box-title'>
|
||||
我的属性
|
||||
</View>
|
||||
<View className='flex-around justify-center mt-22'>
|
||||
<View className='flex-around justify-center mt18'>
|
||||
<View className='bal-item-content flex-col items-center'>
|
||||
<Text>{user.contribution}</Text>
|
||||
<Text className='bal-item-helper'>贡献值</Text>
|
||||
@ -134,7 +134,7 @@ const Index = () => {
|
||||
<View className='my-tool-box-title'>
|
||||
我的钱包
|
||||
</View>
|
||||
<View className='flex-between mt-22'>
|
||||
<View className='flex-between mt18'>
|
||||
<View className='bal-item-content flex-col items-center' onClick={() => {
|
||||
navigateTo('/pages/balance/index')
|
||||
}}>
|
||||
@ -169,19 +169,25 @@ const Index = () => {
|
||||
<Text>邀请好友</Text>
|
||||
</View>
|
||||
|
||||
<View className='flex-col my-order-tool-item'>
|
||||
<View className='flex-col my-order-tool-item' onClick={() => {
|
||||
navigateTo('/pages/shopping/index?source=shopping_score_mall')
|
||||
}}>
|
||||
<View className="relative my-order-tool-box">
|
||||
<Image className='my-tool-icon' src={mall} />
|
||||
</View>
|
||||
<Text>购物金商城</Text>
|
||||
</View>
|
||||
<View className='flex-col my-order-tool-item'>
|
||||
<View className='flex-col my-order-tool-item' onClick={() => {
|
||||
navigateTo('/pages/address/index?home=home')
|
||||
}}>
|
||||
<View className="relative my-order-tool-box">
|
||||
<Image className='my-tool-icon' src={addr} />
|
||||
</View>
|
||||
<Text>地址管理</Text>
|
||||
</View>
|
||||
<View className='flex-col my-order-tool-item'>
|
||||
<View className='flex-col my-order-tool-item' onClick={() => {
|
||||
navigateTo('/pages/team/index')
|
||||
}}>
|
||||
<View className="relative my-order-tool-box">
|
||||
<Image className='my-tool-icon' src={team} />
|
||||
|
||||
|
@ -10,7 +10,7 @@ import Taro from '@tarojs/taro';
|
||||
|
||||
|
||||
function Index() {
|
||||
const limit = 10
|
||||
const limit = 20
|
||||
const [list, setList] = useState([])
|
||||
const [total, setTotal] = useState(0)
|
||||
const [page, setPage] = useState(1)
|
||||
@ -32,7 +32,7 @@ function Index() {
|
||||
if (res.items?.length + list.length >= res.total) {
|
||||
setHasMore(false)
|
||||
}
|
||||
setList(res.items)
|
||||
setList(it => [...it, ...res.items])
|
||||
setTotal(res.total)
|
||||
}
|
||||
|
||||
|
@ -10,27 +10,41 @@ import { useEffect } from 'react';
|
||||
import { useState } from 'react';
|
||||
|
||||
import Taro from '@tarojs/taro';
|
||||
import { mallList } from '../../utils/api';
|
||||
import { useRouter } from '@tarojs/taro';
|
||||
|
||||
|
||||
function Index() {
|
||||
|
||||
const param = useRouter().params
|
||||
const limit = 20
|
||||
const [list, setList] = useState([])
|
||||
const [total, setTotal] = useState(0)
|
||||
const [page, setPage] = useState(1)
|
||||
const [hasMore, setHasMore] = useState(true)
|
||||
const [chan] = useState(param.source != 'shopping_score_mall' ? 'mall' : 'shopping_score_mall')
|
||||
|
||||
|
||||
|
||||
useEffect(() => {
|
||||
if (list.length > 50) {
|
||||
setHasMore(false)
|
||||
if (page < 1) {
|
||||
return
|
||||
}
|
||||
let l = []
|
||||
for (let i = list.length; i < 10 + list.length; i++) {
|
||||
l.push(i)
|
||||
}
|
||||
setList([...list, ...l])
|
||||
|
||||
fetchList(page)
|
||||
}, [page])
|
||||
|
||||
const fetchList = async (page) => {
|
||||
|
||||
const offset = (page - 1) * limit
|
||||
const res = await mallList(chan, offset, limit)
|
||||
|
||||
if (!res) return
|
||||
if (res.items?.length + list.length >= res.total) {
|
||||
setHasMore(false)
|
||||
}
|
||||
setList(it => [...it, ...res.items])
|
||||
setTotal(res.total)
|
||||
}
|
||||
|
||||
|
||||
// 跳转
|
||||
const navDetailFn = (id) => {
|
||||
@ -59,22 +73,22 @@ function Index() {
|
||||
<View className='shopping-container '>
|
||||
{
|
||||
list.map(item => {
|
||||
return <View className='shopping-item' key={item} onClick={() => {
|
||||
navDetailFn(item)
|
||||
return <View className='shopping-item' key={item.id} onClick={() => {
|
||||
navDetailFn(item.id)
|
||||
}}>
|
||||
<View className='shopping-item-image'>
|
||||
<Image src='https://img.yzcdn.cn/vant/cat.jpeg' />
|
||||
<Image src={item.cover_image} />
|
||||
</View>
|
||||
<View className='shopping-item-content'>
|
||||
<View className='shopping-item-name line-clamp-2'>
|
||||
这个是商品的名称,但是可能有一点点的长
|
||||
{item.name}
|
||||
</View>
|
||||
<View className='shopping-item-desc line-clamp-2 '>
|
||||
{/* <View className='shopping-item-desc line-clamp-2 '>
|
||||
这个是商品的介绍
|
||||
</View>
|
||||
<View className='shopping-item-price text-right'>
|
||||
<Text className='shopping-item-price-sale'>¥199</Text>
|
||||
<Text className='shopping-item-price-origin'>原价888</Text>
|
||||
</View> */}
|
||||
<View className='shopping-item-price text-left'>
|
||||
<Text className='shopping-item-price-sale'>¥{item.price}</Text>
|
||||
{/* <Text className='shopping-item-price-origin'>原价888</Text> */}
|
||||
</View>
|
||||
</View>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user