This commit is contained in:
tangping 2023-06-08 22:05:08 +08:00
parent 5be40135c3
commit bb36af3684
19 changed files with 126 additions and 67 deletions

BIN
mall.zip Normal file

Binary file not shown.

View File

@ -18,6 +18,7 @@ const Login = () => {
const [account, setAccount] = useState('') const [account, setAccount] = useState('')
const [user, setUser] = useState('') const [user, setUser] = useState('')
const [accountNumber, setAccountNumber] = useState() const [accountNumber, setAccountNumber] = useState()
const [disable, setDisable] = useState(false)
// //
@ -27,16 +28,19 @@ const Login = () => {
const submit = () => { const submit = () => {
setDisable(true)
if (!account || !accountNumber || !user) { if (!account || !accountNumber || !user) {
setDisable(false)
errorNotice('请完善银行卡信息') errorNotice('请完善银行卡信息')
return return
} }
if (account.length > 10) { if (account.length > 10) {
console.log(account.length, account, "dd") setDisable(false)
errorNotice('银行名称不能超过10个字符') errorNotice('银行名称不能超过10个字符')
return return
} }
if (accountNumber.length < 10) { if (accountNumber.length < 10) {
setDisable(false)
errorNotice('银行卡号不能小于10个字符') errorNotice('银行卡号不能小于10个字符')
return return
} }
@ -50,9 +54,7 @@ const Login = () => {
closeLoading() closeLoading()
if (!re) return if (!re) return
successNotice('银行卡添加成功') successNotice('银行卡添加成功')
setTimeout(() => { backFn()
backFn()
}, 1000)
} }
@ -101,7 +103,7 @@ const Login = () => {
</View> </View>
<View className="change-phone-footer flex flex-col justify-center"> <View className="change-phone-footer flex flex-col justify-center">
<Button className="login-btn" onClick={submit}>保存</Button> <Button className="login-btn" onClick={submit} disabled={disable}>保存</Button>
</View> </View>
</View> </View>

View File

@ -124,8 +124,13 @@ function Index() {
return return
} }
if (user.length < 2) {
errorNotice('收货人姓名不能小于2个字符')
return
}
if (addrInfo.length < 6) { if (addrInfo.length < 6) {
errorNotice('详细地址信息错误') errorNotice('详细地址信息不能小于6个字符')
return return
} }

View File

@ -39,6 +39,10 @@ function Index() {
} }
}, [id, ref]) }, [id, ref])
useDidShow(() => {
setRef(ref + 1)
})
// //
const navDetailFn = (id) => { const navDetailFn = (id) => {

View File

@ -40,9 +40,10 @@ const Login = () => {
} }
useEffect(() => { useEffect(() => {
if (total <= list.length && list.length > 0) return
let offset = (page - 1) * limit let offset = (page - 1) * limit
userLogs('score', offset, limit).then(rs => { userLogs('score', { offset, limit }).then(rs => {
if (!rs) return if (!rs || rs.items.length == 0) return
setList(it => [...it, ...rs.items]) setList(it => [...it, ...rs.items])
setTotal(rs.total) setTotal(rs.total)
}) })
@ -91,7 +92,7 @@ const Login = () => {
!!list.length && <Infiniteloading !!list.length && <Infiniteloading
containerId="balanceScroll" containerId="balanceScroll"
useWindow={false} useWindow={false}
loadTxt="loading" loadTxt="正在加载中,请稍后..."
loadMoreTxt="没有数据啦~" loadMoreTxt="没有数据啦~"
loadIcon='loading' loadIcon='loading'
hasMore={total >= list.length} hasMore={total >= list.length}

View File

@ -8,7 +8,7 @@ import { Button } from "@nutui/nutui-react-taro"
import { useState } from "react" import { useState } from "react"
import Taro from "@tarojs/taro" import Taro from "@tarojs/taro"
import backNav from '@/images/backNav.png' import backNav from '@/images/backNav.png'
import { phoneManage } from "../../utils/api" import { phoneManage, sendCode } from "../../utils/api"
import { closeLoading, errorNotice, loading, redirectTo, successNotice } from "../../utils/utils" import { closeLoading, errorNotice, loading, redirectTo, successNotice } from "../../utils/utils"
const activeEye = eye const activeEye = eye
@ -31,7 +31,7 @@ const Login = () => {
// //
const countDown = () => { const countDown = async () => {
if (!account) { if (!account) {
return return
} }
@ -49,6 +49,9 @@ const Login = () => {
setIntervalTime(start) setIntervalTime(start)
} }
}, 1000) }, 1000)
const re = await sendCode(account)
if (!re) return
Taro.showToast({ title: '验证码发送成功', icon: 'success' })
} }
const submit = async () => { const submit = async () => {

View File

@ -9,7 +9,7 @@ import { useState } from "react"
import Taro from "@tarojs/taro" import Taro from "@tarojs/taro"
import backNav from '@/images/backNav.png' import backNav from '@/images/backNav.png'
import { closeLoading, errorNotice, loading, successNotice } from "../../utils/utils" import { closeLoading, errorNotice, loading, successNotice } from "../../utils/utils"
import { pwdManage } from "../../utils/api" import { pwdManage, sendCode } from "../../utils/api"
const activeEye = eye const activeEye = eye
@ -30,7 +30,7 @@ const Login = () => {
} }
// //
const countDown = () => { const countDown = async () => {
if (!account) { if (!account) {
return return
} }
@ -48,6 +48,9 @@ const Login = () => {
setIntervalTime(start) setIntervalTime(start)
} }
}, 1000) }, 1000)
const re = await sendCode(account)
if (!re) return
Taro.showToast({ title: '验证码发送成功', icon: 'success' })
} }
const submit = async () => { const submit = async () => {

View File

@ -38,17 +38,6 @@ const Login = () => {
}) })
} }
//
const cleanFn = () => {
if (loginMode === 'account') {
setAccount('')
setPwd('')
return
}
setMobile('')
setSmsCode('')
}
// //
const countDown = async () => { const countDown = async () => {
if (!account) { if (!account) {
@ -68,7 +57,7 @@ const Login = () => {
setIntervalTime(start) setIntervalTime(start)
} }
}, 1000) }, 1000)
const re = await sendCode(mobile) const re = await sendCode(account)
if (!re) return if (!re) return
Taro.showToast({ title: '验证码发送成功', icon: 'success' }) Taro.showToast({ title: '验证码发送成功', icon: 'success' })
} }

View File

@ -39,9 +39,10 @@ const Login = () => {
} }
useEffect(() => { useEffect(() => {
if (total <= list.length && list.length > 0) return
let offset = (page - 1) * limit let offset = (page - 1) * limit
userLogs('profit', offset, limit).then(rs => { userLogs('profit', { offset, limit }).then(rs => {
if (!rs) return if (!rs || rs.items.length == 0) return
setList(it => [...it, ...rs.items]) setList(it => [...it, ...rs.items])
setTotal(rs.total) setTotal(rs.total)
}) })

View File

@ -67,7 +67,7 @@ const Login = () => {
</View> </View>
}) })
} }
<View className="change-phone-footer flex flex-col justify-center"> <View className="my-card-footer flex flex-col justify-center">
<Button className="login-btn" onClick={navCreate}>新增银行</Button> <Button className="login-btn" onClick={navCreate}>新增银行</Button>
</View> </View>

View File

@ -31,13 +31,12 @@
} }
.change-phone-footer { .my-card-footer {
margin-top: 150px; margin-top: 150px;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
position: fixed;
bottom: 60px;
} }

View File

@ -95,7 +95,7 @@ function Index() {
</View> </View>
<View className='order-detail-price-container'> <View className='order-detail-price-container'>
<View>总价</View> <View>总价</View>
<View className='order-detail-price-p'>¥1{detail.amount}</View> <View className='order-detail-price-p'>¥{detail.amount}</View>
</View> </View>
</View> </View>

View File

@ -36,11 +36,20 @@ const Login = () => {
state = '' state = ''
} }
orderList(chanel, { state, offset, limit }).then(re => { orderList(chanel, { state, offset, limit }).then(re => {
setList(it => [...it, ...re.items]) let ls = [...list, ...re.items]
if (page == 1) {
ls = re.items
}
setList(ls)
setTotal(re.total) setTotal(re.total)
}) })
}, [tabKey, page]) }, [tabKey, page])
const changeTab = (key) => {
setPage(1)
setTabKey(key)
}
return <View className="order-frame bg-slate-50 h-screen text-base"> return <View className="order-frame bg-slate-50 h-screen text-base">
<View className='addr-detail-title'> <View className='addr-detail-title'>
@ -51,10 +60,10 @@ const Login = () => {
<View className="order-container relative"> <View className="order-container relative">
<View className="order-tabs flex-around"> <View className="order-tabs flex-around">
<View className={'order-tab-pane ' + (tabKey == '0' ? 'order-tab-pane-active' : '')} onClick={() => setTabKey('0')}>全部</View> <View className={'order-tab-pane ' + (tabKey == '0' ? 'order-tab-pane-active' : '')} onClick={() => changeTab('0')}>全部</View>
<View className={'order-tab-pane ' + (tabKey == 'paid' ? 'order-tab-pane-active' : '')} onClick={() => setTabKey('paid')}>待发货</View> <View className={'order-tab-pane ' + (tabKey == 'paid' ? 'order-tab-pane-active' : '')} onClick={() => changeTab('paid')}>待发货</View>
<View className={'order-tab-pane ' + (tabKey == 'sent' ? 'order-tab-pane-active' : '')} onClick={() => setTabKey('sent')}>已发货</View> <View className={'order-tab-pane ' + (tabKey == 'sent' ? 'order-tab-pane-active' : '')} onClick={() => changeTab('sent')}>已发货</View>
<View className={'order-tab-pane ' + (tabKey == 'received' ? 'order-tab-pane-active' : '')} onClick={() => setTabKey('received')}>已收货</View> <View className={'order-tab-pane ' + (tabKey == 'received' ? 'order-tab-pane-active' : '')} onClick={() => changeTab('received')}>已收货</View>
</View> </View>
<View className="orderScroll" id="orderScroll"> <View className="orderScroll" id="orderScroll">
{ {

View File

@ -64,6 +64,7 @@ const Login = () => {
} }
Taro.showLoading({ title: '正在注册中~', }) Taro.showLoading({ title: '正在注册中~', })
const inviteCode = GetData("inviteCode") const inviteCode = GetData("inviteCode")
const c = inviteCode ? inviteCode : ''
const re = await register({ const re = await register({
nick_name: mobile, nick_name: mobile,
phone: mobile, phone: mobile,
@ -72,8 +73,9 @@ const Login = () => {
confirm_password: confirmPassword, confirm_password: confirmPassword,
pay_password: payPassword, pay_password: payPassword,
confirm_pay_pwd: confirmPayPassword, confirm_pay_pwd: confirmPayPassword,
invite_code: inviteCode invite_code: c
}) })
Taro.hideLoading() Taro.hideLoading()
if (re) { if (re) {
Taro.showToast({ title: '注册成功', icon: 'success' }) Taro.showToast({ title: '注册成功', icon: 'success' })

View File

@ -13,6 +13,7 @@ import { Tabs, TabPane } from "@nutui/nutui-react-taro"
import { Infiniteloading } from "@nutui/nutui-react-taro" import { Infiniteloading } from "@nutui/nutui-react-taro"
import { useEffect } from "react" import { useEffect } from "react"
import { userDetail, userLogs } from "../../utils/api" import { userDetail, userLogs } from "../../utils/api"
import { formatDateByStr } from "../../utils/utils"
const activeEye = eye const activeEye = eye
@ -37,9 +38,10 @@ const Login = () => {
} }
useEffect(() => { useEffect(() => {
if (total <= list.length && list.length > 0) return
let offset = (page - 1) * limit let offset = (page - 1) * limit
userLogs('shopping_score', offset, limit).then(rs => { userLogs('shopping_score', { offset, limit }).then(rs => {
if (!rs) return if (!rs || rs.items.length == 0) return
setList(it => [...it, ...rs.items]) setList(it => [...it, ...rs.items])
setTotal(rs.total) setTotal(rs.total)
}) })

View File

@ -1,6 +1,6 @@
import { Image, Input, Text, View } from "@tarojs/components" import { Image, Input, Text, View } from "@tarojs/components"
import back from '@/images/back.png' import back from '@/images/back.png'
import checked from '@/images/checked.png' import empty from '@/images/empty.png'
import teamIcon from '@/images/teamIcon.png' import teamIcon from '@/images/teamIcon.png'
import eye from '@/images/eye.png' import eye from '@/images/eye.png'
import './index.scss' import './index.scss'
@ -12,6 +12,7 @@ import { Avatar } from "@nutui/nutui-react-taro"
import { invitedAreas, invitedUser, userDetail } from "../../utils/api" import { invitedAreas, invitedUser, userDetail } from "../../utils/api"
import { useEffect } from "react" import { useEffect } from "react"
import { formatDateByStr } from "../../utils/utils" import { formatDateByStr } from "../../utils/utils"
import { Infiniteloading } from "@nutui/nutui-react-taro"
const activeEye = eye const activeEye = eye
@ -20,22 +21,33 @@ const Login = () => {
const [user, setUser] = useState({}) const [user, setUser] = useState({})
const [list, setList] = useState([]) const [list, setList] = useState([])
const [areas, setAreas] = useState({}) const [areas, setAreas] = useState({})
const [total, setTotal] = useState(0)
const [page, setPage] = useState(1)
useEffect(() => { useEffect(() => {
userDetail().then(rs => { userDetail().then(rs => {
if (!rs) return if (!rs) return
setUser(rs) setUser(rs)
}) })
invitedUser().then(rs => {
if (!rs) return
setList(rs.items ?? [])
})
invitedAreas().then(rs => { invitedAreas().then(rs => {
if (!rs) return if (!rs) return
setAreas(rs) setAreas(rs)
}) })
}, []) }, [])
useEffect(() => {
console.log(page)
if (total <= list.length && list.length > 0) return
let offset = (page - 1) * 20
invitedUser({ offset, limit: 20 }).then(rs => {
if (!rs || rs.items.length == 0) return
setList(it => [...it, ...rs.items])
setTotal(rs.total)
})
}, [page])
// //
const backFn = () => { const backFn = () => {
Taro.getCurrentPages().length > 0 && Taro.navigateBack() Taro.getCurrentPages().length > 0 && Taro.navigateBack()
@ -59,7 +71,7 @@ const Login = () => {
<Text className="team-logo-text">我的等级</Text> <Text className="team-logo-text">我的等级</Text>
</View> </View>
<View className="team-pre-container flex-around"> <View className="team-pre-container flex-around">
<View className="team-pre-item flex-col justify-center items-center"> <View className="team-pre-item flex-col justify-center items-center">
<Text className="team-pre-price">{areas.largest}</Text> <Text className="team-pre-price">{areas.largest}</Text>
<Text>大区业绩</Text> <Text>大区业绩</Text>
@ -73,23 +85,43 @@ const Login = () => {
<View className="invite-container flex-col items-start"> <View className="invite-container flex-col items-start">
<View className="invite-title">我邀请的人</View> <View className="invite-title">我邀请的人</View>
{ <View id='invite-user' className="invite-user-list">
list.map(item => { {
return <View className="invite-item flex-between" key={item.id}> !!list.length && <Infiniteloading
<View className="invite-item-left flex-start items-center"> containerId="invite-user"
<Avatar size={42} icon={item.avatar} alt={item.nick_name} useWindow={false}
/> loadTxt="loading"
<View className="flex-col invite-item-content"> loadMoreTxt="没有数据啦~"
<Text>{item.nick_name}</Text> loadIcon='loading'
<Text className="team-pre-item">{formatDateByStr(item.created_at)}</Text> hasMore={total >= list.length}
</View> onLoadMore={(x) => {
</View> setPage(p => p + 1)
<View className="invite-level"> x()
<Text className="invite-level-text">{item.user_level?.name}</Text> }}
</View> >
</View> {
}) list.map(item => {
} return <View className="invite-item flex-between" key={item.id}>
<View className="invite-item-left flex-start items-center">
<Avatar size={42} icon={item.avatar} alt={item.nick_name}
/>
<View className="flex-col invite-item-content">
<Text>{item.nick_name}</Text>
<Text className="team-pre-item">{formatDateByStr(item.created_at)}</Text>
</View>
</View>
<View className="invite-level">
<Text className="invite-level-text">{item.user_level?.name}</Text>
</View>
</View>
})
}
</Infiniteloading>
}
{
!list.length && <Image src={empty} className="order-empty" />
}
</View>
</View> </View>
</View> </View>
</View> </View>

View File

@ -34,6 +34,7 @@
border-radius: 16px 16px 16px 16px; border-radius: 16px 16px 16px 16px;
opacity: 1; opacity: 1;
margin-top: 16px; margin-top: 16px;
padding: 10px 0;
} }
.team-pre-item { .team-pre-item {
@ -63,7 +64,7 @@
width: 332px; width: 332px;
height: 82px; height: 82px;
background: #FFFFFF; background: #FFFFFF;
box-shadow: -2px 8px 46px 0px rgba(37, 45, 50, 0.05); // box-shadow: -2px 8px 46px 0px rgba(37, 45, 50, 0.05);
border-radius: 16px 16px 16px 16px; border-radius: 16px 16px 16px 16px;
opacity: 1; opacity: 1;
margin-top: 16px; margin-top: 16px;
@ -96,4 +97,10 @@
background: linear-gradient(297deg, #FCA12D 0%, #FEF9F8 100%); background: linear-gradient(297deg, #FCA12D 0%, #FEF9F8 100%);
background-clip: text; background-clip: text;
color: transparent; color: transparent;
}
.invite-user-list {
background: none;
height: calc(100vh - 300px - 40px);
} }

View File

@ -126,7 +126,7 @@ function Index() {
<Image src={next} className='next-icon' /> <Image src={next} className='next-icon' />
</View> </View>
</View> </View>
<View className='userInfo-form' onClick={() => { navigateTo('/pages/my-card/index') }}> <View className='userInfo-form' onClick={() => { !user.is_city_partner && navigateTo('/pages/city-partant/index') }}>
<View className='userInfo-form-name'>申请城市合伙人</View> <View className='userInfo-form-name'>申请城市合伙人</View>
<View className='flex justify-between items-center ' > <View className='flex justify-between items-center ' >
<Image src={next} className='next-icon' /> <Image src={next} className='next-icon' />

View File

@ -104,8 +104,8 @@ export const modifyUser = async (field, value) => {
return await put(`/users/profile/fields`, { field, value }) return await put(`/users/profile/fields`, { field, value })
} }
export const invitedUser = async () => { export const invitedUser = async (data) => {
return await g(`/users/teams/invited-users`) return await g(`/users/teams/invited-users`, data)
} }
export const invitedAreas = async () => { export const invitedAreas = async () => {