diff --git a/mall.zip b/mall.zip new file mode 100644 index 0000000..0ffd295 Binary files /dev/null and b/mall.zip differ diff --git a/src/pages/add-card/index.jsx b/src/pages/add-card/index.jsx index ae09f74..ff806fc 100644 --- a/src/pages/add-card/index.jsx +++ b/src/pages/add-card/index.jsx @@ -18,6 +18,7 @@ const Login = () => { const [account, setAccount] = useState('') const [user, setUser] = useState('') const [accountNumber, setAccountNumber] = useState() + const [disable, setDisable] = useState(false) // 返回页面 @@ -27,16 +28,19 @@ const Login = () => { const submit = () => { + setDisable(true) if (!account || !accountNumber || !user) { + setDisable(false) errorNotice('请完善银行卡信息') return } if (account.length > 10) { - console.log(account.length, account, "dd") + setDisable(false) errorNotice('银行名称不能超过10个字符') return } if (accountNumber.length < 10) { + setDisable(false) errorNotice('银行卡号不能小于10个字符') return } @@ -50,9 +54,7 @@ const Login = () => { closeLoading() if (!re) return successNotice('银行卡添加成功') - setTimeout(() => { - backFn() - }, 1000) + backFn() } @@ -101,7 +103,7 @@ const Login = () => { - + diff --git a/src/pages/address-create/index.jsx b/src/pages/address-create/index.jsx index d7682bb..089d818 100644 --- a/src/pages/address-create/index.jsx +++ b/src/pages/address-create/index.jsx @@ -124,8 +124,13 @@ function Index() { return } + if (user.length < 2) { + errorNotice('收货人姓名不能小于2个字符') + return + } + if (addrInfo.length < 6) { - errorNotice('详细地址信息错误') + errorNotice('详细地址信息不能小于6个字符') return } diff --git a/src/pages/address/index.jsx b/src/pages/address/index.jsx index f2b222a..05e1abf 100644 --- a/src/pages/address/index.jsx +++ b/src/pages/address/index.jsx @@ -39,6 +39,10 @@ function Index() { } }, [id, ref]) + useDidShow(() => { + setRef(ref + 1) + }) + // 跳转 const navDetailFn = (id) => { diff --git a/src/pages/balance/index.jsx b/src/pages/balance/index.jsx index 5332489..0444b54 100644 --- a/src/pages/balance/index.jsx +++ b/src/pages/balance/index.jsx @@ -40,9 +40,10 @@ const Login = () => { } useEffect(() => { + if (total <= list.length && list.length > 0) return let offset = (page - 1) * limit - userLogs('score', offset, limit).then(rs => { - if (!rs) return + userLogs('score', { offset, limit }).then(rs => { + if (!rs || rs.items.length == 0) return setList(it => [...it, ...rs.items]) setTotal(rs.total) }) @@ -91,7 +92,7 @@ const Login = () => { !!list.length && = list.length} diff --git a/src/pages/change-phone/index.jsx b/src/pages/change-phone/index.jsx index 0651bd2..b86d7d1 100644 --- a/src/pages/change-phone/index.jsx +++ b/src/pages/change-phone/index.jsx @@ -8,7 +8,7 @@ import { Button } from "@nutui/nutui-react-taro" import { useState } from "react" import Taro from "@tarojs/taro" 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" const activeEye = eye @@ -31,7 +31,7 @@ const Login = () => { // 倒计时 - const countDown = () => { + const countDown = async () => { if (!account) { return } @@ -49,6 +49,9 @@ const Login = () => { setIntervalTime(start) } }, 1000) + const re = await sendCode(account) + if (!re) return + Taro.showToast({ title: '验证码发送成功', icon: 'success' }) } const submit = async () => { diff --git a/src/pages/change-pwd/index.jsx b/src/pages/change-pwd/index.jsx index 08fcac8..6b8f210 100644 --- a/src/pages/change-pwd/index.jsx +++ b/src/pages/change-pwd/index.jsx @@ -9,7 +9,7 @@ import { useState } from "react" import Taro from "@tarojs/taro" import backNav from '@/images/backNav.png' import { closeLoading, errorNotice, loading, successNotice } from "../../utils/utils" -import { pwdManage } from "../../utils/api" +import { pwdManage, sendCode } from "../../utils/api" const activeEye = eye @@ -30,7 +30,7 @@ const Login = () => { } // 倒计时 - const countDown = () => { + const countDown = async () => { if (!account) { return } @@ -48,6 +48,9 @@ const Login = () => { setIntervalTime(start) } }, 1000) + const re = await sendCode(account) + if (!re) return + Taro.showToast({ title: '验证码发送成功', icon: 'success' }) } const submit = async () => { diff --git a/src/pages/forgot/index.jsx b/src/pages/forgot/index.jsx index bafd411..47b3202 100644 --- a/src/pages/forgot/index.jsx +++ b/src/pages/forgot/index.jsx @@ -38,17 +38,6 @@ const Login = () => { }) } - //清理数据 - const cleanFn = () => { - if (loginMode === 'account') { - setAccount('') - setPwd('') - return - } - setMobile('') - setSmsCode('') - } - // 倒计时 const countDown = async () => { if (!account) { @@ -68,7 +57,7 @@ const Login = () => { setIntervalTime(start) } }, 1000) - const re = await sendCode(mobile) + const re = await sendCode(account) if (!re) return Taro.showToast({ title: '验证码发送成功', icon: 'success' }) } diff --git a/src/pages/income/index.jsx b/src/pages/income/index.jsx index 7d1edda..18dbb44 100644 --- a/src/pages/income/index.jsx +++ b/src/pages/income/index.jsx @@ -39,9 +39,10 @@ const Login = () => { } useEffect(() => { + if (total <= list.length && list.length > 0) return let offset = (page - 1) * limit - userLogs('profit', offset, limit).then(rs => { - if (!rs) return + userLogs('profit', { offset, limit }).then(rs => { + if (!rs || rs.items.length == 0) return setList(it => [...it, ...rs.items]) setTotal(rs.total) }) diff --git a/src/pages/my-card/index.jsx b/src/pages/my-card/index.jsx index dbf28ca..91e364c 100644 --- a/src/pages/my-card/index.jsx +++ b/src/pages/my-card/index.jsx @@ -67,7 +67,7 @@ const Login = () => { }) } - + diff --git a/src/pages/my-card/index.scss b/src/pages/my-card/index.scss index 118382d..7bbb0fc 100644 --- a/src/pages/my-card/index.scss +++ b/src/pages/my-card/index.scss @@ -31,13 +31,12 @@ } -.change-phone-footer { +.my-card-footer { margin-top: 150px; display: flex; flex-direction: column; align-items: center; - position: fixed; - bottom: 60px; + } diff --git a/src/pages/order-detail/index.jsx b/src/pages/order-detail/index.jsx index b36abb3..bca81fe 100644 --- a/src/pages/order-detail/index.jsx +++ b/src/pages/order-detail/index.jsx @@ -95,7 +95,7 @@ function Index() { 总价: - ¥1{detail.amount} + ¥{detail.amount} diff --git a/src/pages/order/index.jsx b/src/pages/order/index.jsx index 0f35220..7f89300 100644 --- a/src/pages/order/index.jsx +++ b/src/pages/order/index.jsx @@ -36,11 +36,20 @@ const Login = () => { state = '' } 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) }) }, [tabKey, page]) + const changeTab = (key) => { + setPage(1) + setTabKey(key) + } + return @@ -51,10 +60,10 @@ const Login = () => { - setTabKey('0')}>全部 - setTabKey('paid')}>待发货 - setTabKey('sent')}>已发货 - setTabKey('received')}>已收货 + changeTab('0')}>全部 + changeTab('paid')}>待发货 + changeTab('sent')}>已发货 + changeTab('received')}>已收货 { diff --git a/src/pages/register/index.jsx b/src/pages/register/index.jsx index 6e0a497..df113d2 100644 --- a/src/pages/register/index.jsx +++ b/src/pages/register/index.jsx @@ -64,6 +64,7 @@ const Login = () => { } Taro.showLoading({ title: '正在注册中~', }) const inviteCode = GetData("inviteCode") + const c = inviteCode ? inviteCode : '' const re = await register({ nick_name: mobile, phone: mobile, @@ -72,8 +73,9 @@ const Login = () => { confirm_password: confirmPassword, pay_password: payPassword, confirm_pay_pwd: confirmPayPassword, - invite_code: inviteCode + invite_code: c }) + Taro.hideLoading() if (re) { Taro.showToast({ title: '注册成功', icon: 'success' }) diff --git a/src/pages/scope/index.jsx b/src/pages/scope/index.jsx index 23ae1ae..ed1a091 100644 --- a/src/pages/scope/index.jsx +++ b/src/pages/scope/index.jsx @@ -13,6 +13,7 @@ import { Tabs, TabPane } from "@nutui/nutui-react-taro" import { Infiniteloading } from "@nutui/nutui-react-taro" import { useEffect } from "react" import { userDetail, userLogs } from "../../utils/api" +import { formatDateByStr } from "../../utils/utils" const activeEye = eye @@ -37,9 +38,10 @@ const Login = () => { } useEffect(() => { + if (total <= list.length && list.length > 0) return let offset = (page - 1) * limit - userLogs('shopping_score', offset, limit).then(rs => { - if (!rs) return + userLogs('shopping_score', { offset, limit }).then(rs => { + if (!rs || rs.items.length == 0) return setList(it => [...it, ...rs.items]) setTotal(rs.total) }) diff --git a/src/pages/team/index.jsx b/src/pages/team/index.jsx index 35027ab..7db3459 100644 --- a/src/pages/team/index.jsx +++ b/src/pages/team/index.jsx @@ -1,6 +1,6 @@ import { Image, Input, Text, View } from "@tarojs/components" 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 eye from '@/images/eye.png' import './index.scss' @@ -12,6 +12,7 @@ import { Avatar } from "@nutui/nutui-react-taro" import { invitedAreas, invitedUser, userDetail } from "../../utils/api" import { useEffect } from "react" import { formatDateByStr } from "../../utils/utils" +import { Infiniteloading } from "@nutui/nutui-react-taro" const activeEye = eye @@ -20,22 +21,33 @@ const Login = () => { const [user, setUser] = useState({}) const [list, setList] = useState([]) const [areas, setAreas] = useState({}) + const [total, setTotal] = useState(0) + const [page, setPage] = useState(1) useEffect(() => { userDetail().then(rs => { if (!rs) return setUser(rs) }) - invitedUser().then(rs => { - if (!rs) return - setList(rs.items ?? []) - }) + invitedAreas().then(rs => { if (!rs) return 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 = () => { Taro.getCurrentPages().length > 0 && Taro.navigateBack() @@ -59,7 +71,7 @@ const Login = () => { 我的等级 - + {areas.largest} 大区业绩 @@ -73,23 +85,43 @@ const Login = () => { 我邀请的人 - { - list.map(item => { - return - - - - {item.nick_name} - {formatDateByStr(item.created_at)} - - - - {item.user_level?.name} - - - }) - } + + { + !!list.length && = list.length} + onLoadMore={(x) => { + setPage(p => p + 1) + x() + }} + > + { + list.map(item => { + return + + + + {item.nick_name} + {formatDateByStr(item.created_at)} + + + + {item.user_level?.name} + + + }) + } + + } + { + !list.length && + } + diff --git a/src/pages/team/index.scss b/src/pages/team/index.scss index 33e4926..e7a5e29 100644 --- a/src/pages/team/index.scss +++ b/src/pages/team/index.scss @@ -34,6 +34,7 @@ border-radius: 16px 16px 16px 16px; opacity: 1; margin-top: 16px; + padding: 10px 0; } .team-pre-item { @@ -63,7 +64,7 @@ width: 332px; height: 82px; 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; opacity: 1; margin-top: 16px; @@ -96,4 +97,10 @@ background: linear-gradient(297deg, #FCA12D 0%, #FEF9F8 100%); background-clip: text; color: transparent; +} + + +.invite-user-list { + background: none; + height: calc(100vh - 300px - 40px); } \ No newline at end of file diff --git a/src/pages/user-info/index.jsx b/src/pages/user-info/index.jsx index 0c370e3..71d8183 100644 --- a/src/pages/user-info/index.jsx +++ b/src/pages/user-info/index.jsx @@ -126,7 +126,7 @@ function Index() { - { navigateTo('/pages/my-card/index') }}> + { !user.is_city_partner && navigateTo('/pages/city-partant/index') }}> 申请城市合伙人 diff --git a/src/utils/api.js b/src/utils/api.js index 3752185..1cba1b1 100644 --- a/src/utils/api.js +++ b/src/utils/api.js @@ -104,8 +104,8 @@ export const modifyUser = async (field, value) => { return await put(`/users/profile/fields`, { field, value }) } -export const invitedUser = async () => { - return await g(`/users/teams/invited-users`) +export const invitedUser = async (data) => { + return await g(`/users/teams/invited-users`, data) } export const invitedAreas = async () => {