个人中心页面相关
This commit is contained in:
parent
2353101453
commit
dad0452831
@ -223,3 +223,10 @@
|
|||||||
.nut-popup {
|
.nut-popup {
|
||||||
background: none !important;
|
background: none !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.order-empty {
|
||||||
|
width: 200px;
|
||||||
|
height: 200px;
|
||||||
|
margin-left: calc((375px - 200px)/2);
|
||||||
|
margin-top: 100px;
|
||||||
|
}
|
@ -8,18 +8,16 @@ 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 { createCard } from "../../utils/api"
|
||||||
|
import { closeLoading, errorNotice, loading, successNotice } from "../../utils/utils"
|
||||||
|
|
||||||
const activeEye = eye
|
const activeEye = eye
|
||||||
|
|
||||||
const Login = () => {
|
const Login = () => {
|
||||||
|
|
||||||
const [account, setAccount] = useState('')
|
const [account, setAccount] = useState('')
|
||||||
const [pwd, setPwd] = useState()
|
const [user, setUser] = useState('')
|
||||||
const [loginMode, setLoginMode] = useState('account')
|
const [accountNumber, setAccountNumber] = useState()
|
||||||
|
|
||||||
const [mobile, setMobile] = useState('')
|
|
||||||
const [smsCode, setSmsCode] = useState('')
|
|
||||||
const [interval, setIntervalTime] = useState(0)
|
|
||||||
|
|
||||||
|
|
||||||
// 返回页面
|
// 返回页面
|
||||||
@ -28,45 +26,36 @@ const Login = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// 去登陆
|
const submit = () => {
|
||||||
const loginFn = () => {
|
if (!account || !accountNumber || !user) {
|
||||||
Taro.redirectTo({
|
errorNotice('请完善银行卡信息')
|
||||||
url: '/pages/login/index'
|
return
|
||||||
|
}
|
||||||
|
if (account.length > 10) {
|
||||||
|
console.log(account.length, account, "dd")
|
||||||
|
errorNotice('银行名称不能超过10个字符')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (accountNumber.length < 10) {
|
||||||
|
errorNotice('银行卡号不能小于10个字符')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
loading('银行卡添加中,请稍后~')
|
||||||
|
const re = createCard({
|
||||||
|
bank_name: account,
|
||||||
|
account_number: accountNumber,
|
||||||
|
account_name: user,
|
||||||
|
bank_branch: account
|
||||||
})
|
})
|
||||||
}
|
closeLoading()
|
||||||
|
if (!re) return
|
||||||
//清理数据
|
successNotice('银行卡添加成功')
|
||||||
const cleanFn = () => {
|
setTimeout(() => {
|
||||||
if (loginMode === 'account') {
|
backFn()
|
||||||
setAccount('')
|
|
||||||
setPwd('')
|
|
||||||
return
|
|
||||||
}
|
|
||||||
setMobile('')
|
|
||||||
setSmsCode('')
|
|
||||||
}
|
|
||||||
|
|
||||||
// 倒计时
|
|
||||||
const countDown = () => {
|
|
||||||
if (!mobile) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
setIntervalTime(60)
|
|
||||||
if (interval > 0) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
let start = 60
|
|
||||||
const timer = setInterval(() => {
|
|
||||||
if (start > 0) {
|
|
||||||
start--
|
|
||||||
if (start <= 0) {
|
|
||||||
clearInterval(timer)
|
|
||||||
}
|
|
||||||
setIntervalTime(start)
|
|
||||||
}
|
|
||||||
}, 1000)
|
}, 1000)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return <View className="login-frame bg-slate-50 h-screen text-base">
|
return <View className="login-frame bg-slate-50 h-screen text-base">
|
||||||
<View className='addr-detail-title'>
|
<View className='addr-detail-title'>
|
||||||
<Image src={backNav} className="square-35 absolute left-10 nav-icon" onClick={backFn} />
|
<Image src={backNav} className="square-35 absolute left-10 nav-icon" onClick={backFn} />
|
||||||
@ -76,30 +65,43 @@ const Login = () => {
|
|||||||
<View className="change-pwd-container bg-slate-50 relative">
|
<View className="change-pwd-container bg-slate-50 relative">
|
||||||
<View>
|
<View>
|
||||||
<View className="form-item mt-22">
|
<View className="form-item mt-22">
|
||||||
<View className="form-label">银行卡号</View>
|
<View className="form-label">银行名称</View>
|
||||||
<View className="form-control relative">
|
<View className="form-control relative">
|
||||||
<Input className="form-input" placeholder="请输入银行卡号" onInput={(v) => {
|
<Input className="form-input" type='text' placeholder="请输入银行名称" onInput={(v) => {
|
||||||
setAccount(v.detail.value)
|
setAccount(v.detail.value)
|
||||||
}} />
|
}} />
|
||||||
{
|
{
|
||||||
account && <Image className="w-6 h-6 absolute right-0 bottom-16" src={checked} />
|
account && <Image className="w-6 h-6 absolute right-0 bottom-16" src={checked} />
|
||||||
}
|
}
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
<View className="form-item mt-22">
|
||||||
|
<View className="form-label">银行卡号</View>
|
||||||
|
<View className="form-control relative">
|
||||||
|
<Input className="form-input" placeholder="请输入银行卡号" onInput={(v) => {
|
||||||
|
setAccountNumber(v.detail.value)
|
||||||
|
}} />
|
||||||
|
{
|
||||||
|
accountNumber && <Image className="w-6 h-6 absolute right-0 bottom-16" src={checked} />
|
||||||
|
}
|
||||||
|
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
<View className="form-item mt-22">
|
<View className="form-item mt-22">
|
||||||
<View className="form-label">银行名称</View>
|
<View className="form-label">开户人名称</View>
|
||||||
<View className="form-control relative">
|
<View className="form-control relative">
|
||||||
<Input className="form-input" type='text' placeholder="请输入银行名称" onInput={(v) => {
|
<Input className="form-input" placeholder="请输入账户名" onInput={(v) => {
|
||||||
setPwd(v.detail.value)
|
setUser(v.detail.value)
|
||||||
}} />
|
}} />
|
||||||
{
|
{
|
||||||
pwd && <Image className="w-6 h-6 absolute right-0 bottom-16" src={checked} />
|
user && <Image className="w-6 h-6 absolute right-0 bottom-16" src={checked} />
|
||||||
}
|
}
|
||||||
|
|
||||||
</View>
|
</View>
|
||||||
</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">保存</Button>
|
<Button className="login-btn" onClick={submit}>保存</Button>
|
||||||
|
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
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 checked from '@/images/checked.png'
|
||||||
import eyeClose from '@/images/eyeClose.png'
|
import empty from '@/images/empty.png'
|
||||||
import eye from '@/images/eye.png'
|
import eye from '@/images/eye.png'
|
||||||
import './index.scss'
|
import './index.scss'
|
||||||
import { Button } from "@nutui/nutui-react-taro"
|
import { Button } from "@nutui/nutui-react-taro"
|
||||||
@ -12,20 +12,50 @@ import { Picker } from "@nutui/nutui-react-taro"
|
|||||||
import { Tabs, TabPane } from "@nutui/nutui-react-taro"
|
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 { formatDateByStr } from "../../utils/utils"
|
||||||
|
|
||||||
const activeEye = eye
|
const activeEye = eye
|
||||||
|
|
||||||
const Login = () => {
|
const Login = () => {
|
||||||
|
const limit = 20
|
||||||
const [tabKey, setTabKey] = useState('0')
|
const [tabKey, setTabKey] = useState('0')
|
||||||
const [page, setPage] = useState(1)
|
const [page, setPage] = useState(1)
|
||||||
|
const [user, setUser] = useState({})
|
||||||
|
const [list, setList] = useState([])
|
||||||
|
const [total, setTotal] = useState(0)
|
||||||
|
const [ref, setRef] = useState(0)
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
userDetail().then(rs => {
|
||||||
|
if (!rs) return
|
||||||
|
setUser(rs)
|
||||||
|
})
|
||||||
|
}, [])
|
||||||
|
|
||||||
|
|
||||||
// 返回页面
|
// 返回页面
|
||||||
const backFn = () => {
|
const backFn = () => {
|
||||||
Taro.getCurrentPages().length > 0 && Taro.navigateBack()
|
Taro.getCurrentPages().length > 0 && Taro.navigateBack()
|
||||||
}
|
}
|
||||||
|
|
||||||
useEffect(() => { }, [tabKey])
|
useEffect(() => {
|
||||||
|
let offset = (page - 1) * limit
|
||||||
|
userLogs('score', offset, limit).then(rs => {
|
||||||
|
if (!rs) return
|
||||||
|
setList(it => [...it, ...rs.items])
|
||||||
|
setTotal(rs.total)
|
||||||
|
})
|
||||||
|
|
||||||
|
}, [tabKey, page])
|
||||||
|
|
||||||
|
|
||||||
|
const switchTab = (key) => {
|
||||||
|
if (key != tabKey) {
|
||||||
|
setPage(1)
|
||||||
|
}
|
||||||
|
setTabKey(key)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
return <View className="cash-frame bg-slate-50 h-screen text-base">
|
return <View className="cash-frame bg-slate-50 h-screen text-base">
|
||||||
@ -38,7 +68,7 @@ const Login = () => {
|
|||||||
<View className="balance-amount flex-col ">
|
<View className="balance-amount flex-col ">
|
||||||
<View className="flex-between mt-22">
|
<View className="flex-between mt-22">
|
||||||
<Text>当前余额</Text>
|
<Text>当前余额</Text>
|
||||||
<Text className="balance-amount-price">50000</Text>
|
<Text className="balance-amount-price">{user.score}</Text>
|
||||||
</View>
|
</View>
|
||||||
<View className="flex-around mt-22">
|
<View className="flex-around mt-22">
|
||||||
<View className="balance-btn flex-center" onClick={() => {
|
<View className="balance-btn flex-center" onClick={() => {
|
||||||
@ -51,40 +81,41 @@ const Login = () => {
|
|||||||
</View>
|
</View>
|
||||||
|
|
||||||
<View className="amount-container">
|
<View className="amount-container">
|
||||||
<View className="amount-tabs flex-around">
|
<View className="amount-tabs flex-start">
|
||||||
<View className={'tab-pane ' + (tabKey == '0' ? 'tab-pane-active' : '')} onClick={() => setTabKey('0')}>余额流水</View>
|
<View className={'tab-pane ' + (tabKey == '0' ? 'tab-pane-active' : '')} onClick={() => switchTab('0')}>余额流水</View>
|
||||||
<View className={'tab-pane ' + (tabKey == '1' ? 'tab-pane-active' : '')} onClick={() => setTabKey('1')}>充值记录</View>
|
{/* <View className={'tab-pane ' + (tabKey == '1' ? 'tab-pane-active' : '')} onClick={() => switchTab('1')}>充值记录</View> */}
|
||||||
<View className={'tab-pane ' + (tabKey == '2' ? 'tab-pane-active' : '')} onClick={() => setTabKey('2')}>提现记录</View>
|
{/* <View className={'tab-pane ' + (tabKey == '2' ? 'tab-pane-active' : '')} onClick={() => switchTab('2')}>提现记录</View> */}
|
||||||
</View>
|
</View>
|
||||||
<View className="balanceScroll" id="balanceScroll">
|
<View className="balanceScroll" id="balanceScroll">
|
||||||
<Infiniteloading
|
{
|
||||||
containerId="balanceScroll"
|
!!list.length && <Infiniteloading
|
||||||
useWindow={false}
|
containerId="balanceScroll"
|
||||||
loadTxt="loading"
|
useWindow={false}
|
||||||
loadMoreTxt="没有数据啦~"
|
loadTxt="loading"
|
||||||
loadIcon='loading'
|
loadMoreTxt="没有数据啦~"
|
||||||
hasMore={false}
|
loadIcon='loading'
|
||||||
onLoadMore={(x) => {
|
hasMore={total >= list.length}
|
||||||
setPage(p => p + 1)
|
onLoadMore={(x) => {
|
||||||
x()
|
setPage(p => p + 1)
|
||||||
}}
|
x()
|
||||||
>
|
}}
|
||||||
<View className="amount-item flex-between">
|
>
|
||||||
<View className="amount-item-detail flex-col">
|
{
|
||||||
<View>完成每日登陆</View>
|
list.map(item => {
|
||||||
<View className="amount-item-time">2021/04/09 19:42:36</View>
|
return <View className="amount-item flex-between" key={item.id}>
|
||||||
</View>
|
<View className="amount-item-detail flex-col">
|
||||||
<View className="amount-item-log">+1.00</View>
|
<View>{item.memo}</View>
|
||||||
</View>
|
<View className="amount-item-time">{formatDateByStr(item.created_at)}</View>
|
||||||
|
</View>
|
||||||
<View className="amount-item flex-between">
|
<View className="amount-item-log">{item.amount > 0 ? `+${item.amount}` : `${item.amount}`}</View>
|
||||||
<View className="amount-item-detail flex-col">
|
</View>
|
||||||
<View>完成每日登陆</View>
|
})
|
||||||
<View className="amount-item-time">2021/04/09 19:42:36</View>
|
}
|
||||||
</View>
|
</Infiniteloading>
|
||||||
<View className="amount-item-log">+1.00</View>
|
}
|
||||||
</View>
|
{
|
||||||
</Infiniteloading>
|
!list.length && <Image src={empty} className="order-empty" />
|
||||||
|
}
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
|
|
||||||
|
@ -8,6 +8,8 @@ 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 { closeLoading, errorNotice, loading, redirectTo, successNotice } from "../../utils/utils"
|
||||||
|
|
||||||
const activeEye = eye
|
const activeEye = eye
|
||||||
|
|
||||||
@ -15,7 +17,7 @@ const Login = () => {
|
|||||||
|
|
||||||
const [account, setAccount] = useState('')
|
const [account, setAccount] = useState('')
|
||||||
const [pwd, setPwd] = useState()
|
const [pwd, setPwd] = useState()
|
||||||
const [loginMode, setLoginMode] = useState('account')
|
const [showPwd, setShowPwd] = useState(false)
|
||||||
|
|
||||||
const [mobile, setMobile] = useState('')
|
const [mobile, setMobile] = useState('')
|
||||||
const [smsCode, setSmsCode] = useState('')
|
const [smsCode, setSmsCode] = useState('')
|
||||||
@ -28,27 +30,9 @@ const Login = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// 去登陆
|
|
||||||
const loginFn = () => {
|
|
||||||
Taro.redirectTo({
|
|
||||||
url: '/pages/login/index'
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
//清理数据
|
|
||||||
const cleanFn = () => {
|
|
||||||
if (loginMode === 'account') {
|
|
||||||
setAccount('')
|
|
||||||
setPwd('')
|
|
||||||
return
|
|
||||||
}
|
|
||||||
setMobile('')
|
|
||||||
setSmsCode('')
|
|
||||||
}
|
|
||||||
|
|
||||||
// 倒计时
|
// 倒计时
|
||||||
const countDown = () => {
|
const countDown = () => {
|
||||||
if (!mobile) {
|
if (!account) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
setIntervalTime(60)
|
setIntervalTime(60)
|
||||||
@ -67,6 +51,25 @@ const Login = () => {
|
|||||||
}, 1000)
|
}, 1000)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const submit = async () => {
|
||||||
|
if (!account || !smsCode || !pwd) {
|
||||||
|
errorNotice('请完善信息')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
loading('手机号码修改中,请稍后~')
|
||||||
|
const re = await phoneManage({
|
||||||
|
new_phone: account,
|
||||||
|
password: pwd,
|
||||||
|
verification_code: smsCode
|
||||||
|
})
|
||||||
|
closeLoading()
|
||||||
|
if (!re) return
|
||||||
|
successNotice('手机号码修改成功')
|
||||||
|
setTimeout(() => {
|
||||||
|
backFn()
|
||||||
|
}, 1000)
|
||||||
|
}
|
||||||
|
|
||||||
return <View className="login-frame bg-slate-50 h-screen text-base">
|
return <View className="login-frame bg-slate-50 h-screen text-base">
|
||||||
<View className='addr-detail-title'>
|
<View className='addr-detail-title'>
|
||||||
<Image src={backNav} className="square-35 absolute left-10 nav-icon" onClick={backFn} />
|
<Image src={backNav} className="square-35 absolute left-10 nav-icon" onClick={backFn} />
|
||||||
@ -76,15 +79,25 @@ const Login = () => {
|
|||||||
<View className="change-pwd-container bg-slate-50 relative">
|
<View className="change-pwd-container bg-slate-50 relative">
|
||||||
<View>
|
<View>
|
||||||
<View className="form-item mt-22">
|
<View className="form-item mt-22">
|
||||||
<View className="form-label">验证原手机号</View>
|
<View className="form-label">密码</View>
|
||||||
<View className="form-control relative">
|
<View className="form-control relative">
|
||||||
<Input className="form-input" placeholder="请输入手机号" onInput={(v) => {
|
<Input className="form-input" type={showPwd ? 'text' : 'password'} placeholder="设置新密码" onInput={(v) => {
|
||||||
|
setPwd(v.detail.value)
|
||||||
|
}} />
|
||||||
|
<Image className="w-6 h-6 absolute right-0 bottom-16" src={showPwd ? activeEye : eyeClose} onClick={() => {
|
||||||
|
setShowPwd(v => !v)
|
||||||
|
}} />
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
<View className="form-item mt-22">
|
||||||
|
<View className="form-label">输入新手机号码</View>
|
||||||
|
<View className="form-control relative">
|
||||||
|
<Input className="form-input" type='text' placeholder="设置新手机号码" onInput={(v) => {
|
||||||
setAccount(v.detail.value)
|
setAccount(v.detail.value)
|
||||||
}} />
|
}} />
|
||||||
{
|
{
|
||||||
account && <Image className="w-6 h-6 absolute right-0 bottom-16" src={checked} />
|
account && <Image className="w-6 h-6 absolute right-0 bottom-16" src={checked} />
|
||||||
}
|
}
|
||||||
|
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
<View className="form-item mt-22">
|
<View className="form-item mt-22">
|
||||||
@ -96,19 +109,8 @@ const Login = () => {
|
|||||||
<Button className="code-btn" disabled={interval > 0} onClick={countDown}>{interval ? interval + 's' : '获取验证码'}</Button>
|
<Button className="code-btn" disabled={interval > 0} onClick={countDown}>{interval ? interval + 's' : '获取验证码'}</Button>
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
<View className="form-item mt-22">
|
|
||||||
<View className="form-label">输入新手机号码</View>
|
|
||||||
<View className="form-control relative">
|
|
||||||
<Input className="form-input" type='text' placeholder="设置新手机号码" onInput={(v) => {
|
|
||||||
setPwd(v.detail.value)
|
|
||||||
}} />
|
|
||||||
{
|
|
||||||
pwd && <Image className="w-6 h-6 absolute right-0 bottom-16" src={checked} />
|
|
||||||
}
|
|
||||||
</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">保存</Button>
|
<Button className="login-btn" onClick={submit}>保存</Button>
|
||||||
|
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
|
@ -8,6 +8,8 @@ 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 { closeLoading, errorNotice, loading, successNotice } from "../../utils/utils"
|
||||||
|
import { pwdManage } from "../../utils/api"
|
||||||
|
|
||||||
const activeEye = eye
|
const activeEye = eye
|
||||||
|
|
||||||
@ -15,10 +17,9 @@ const Login = () => {
|
|||||||
|
|
||||||
const [account, setAccount] = useState('')
|
const [account, setAccount] = useState('')
|
||||||
const [pwd, setPwd] = useState()
|
const [pwd, setPwd] = useState()
|
||||||
|
const [confirmPwd, setConfirmPwd] = useState()
|
||||||
const [showPwd, setShowPwd] = useState(false)
|
const [showPwd, setShowPwd] = useState(false)
|
||||||
const [loginMode, setLoginMode] = useState('account')
|
const [showConfirmPwd, setShowConfirmPwd] = useState(false)
|
||||||
|
|
||||||
const [mobile, setMobile] = useState('')
|
|
||||||
const [smsCode, setSmsCode] = useState('')
|
const [smsCode, setSmsCode] = useState('')
|
||||||
const [interval, setIntervalTime] = useState(0)
|
const [interval, setIntervalTime] = useState(0)
|
||||||
|
|
||||||
@ -28,28 +29,9 @@ const Login = () => {
|
|||||||
Taro.getCurrentPages().length > 0 && Taro.navigateBack()
|
Taro.getCurrentPages().length > 0 && Taro.navigateBack()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// 去登陆
|
|
||||||
const loginFn = () => {
|
|
||||||
Taro.redirectTo({
|
|
||||||
url: '/pages/login/index'
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
//清理数据
|
|
||||||
const cleanFn = () => {
|
|
||||||
if (loginMode === 'account') {
|
|
||||||
setAccount('')
|
|
||||||
setPwd('')
|
|
||||||
return
|
|
||||||
}
|
|
||||||
setMobile('')
|
|
||||||
setSmsCode('')
|
|
||||||
}
|
|
||||||
|
|
||||||
// 倒计时
|
// 倒计时
|
||||||
const countDown = () => {
|
const countDown = () => {
|
||||||
if (!mobile) {
|
if (!account) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
setIntervalTime(60)
|
setIntervalTime(60)
|
||||||
@ -68,6 +50,30 @@ const Login = () => {
|
|||||||
}, 1000)
|
}, 1000)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const submit = async () => {
|
||||||
|
if (!account || !smsCode || !pwd || !confirmPwd) {
|
||||||
|
errorNotice('请完善信息')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (pwd !== confirmPwd) {
|
||||||
|
errorNotice("两次密码不一致")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
loading('密码重置中,请稍后~')
|
||||||
|
const re = await pwdManage('login_password', {
|
||||||
|
confirm_password: confirmPwd,
|
||||||
|
password: pwd,
|
||||||
|
phone: account,
|
||||||
|
verification_code: smsCode
|
||||||
|
})
|
||||||
|
closeLoading()
|
||||||
|
if (!re) return
|
||||||
|
successNotice('密码重置成功')
|
||||||
|
setTimeout(() => {
|
||||||
|
backFn()
|
||||||
|
}, 1000)
|
||||||
|
}
|
||||||
|
|
||||||
return <View className="login-frame bg-slate-50 h-screen text-base">
|
return <View className="login-frame bg-slate-50 h-screen text-base">
|
||||||
<View className='addr-detail-title'>
|
<View className='addr-detail-title'>
|
||||||
<Image src={backNav} className="square-35 absolute left-10 nav-icon" onClick={backFn} />
|
<Image src={backNav} className="square-35 absolute left-10 nav-icon" onClick={backFn} />
|
||||||
@ -77,7 +83,7 @@ const Login = () => {
|
|||||||
<View className="change-pwd-container relative">
|
<View className="change-pwd-container relative">
|
||||||
<View>
|
<View>
|
||||||
<View className="form-item mt-22">
|
<View className="form-item mt-22">
|
||||||
<View className="form-label">账号</View>
|
<View className="form-label">手机号</View>
|
||||||
<View className="form-control relative">
|
<View className="form-control relative">
|
||||||
<Input className="form-input" placeholder="请输入手机号" onInput={(v) => {
|
<Input className="form-input" placeholder="请输入手机号" onInput={(v) => {
|
||||||
setAccount(v.detail.value)
|
setAccount(v.detail.value)
|
||||||
@ -109,18 +115,18 @@ const Login = () => {
|
|||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
<View className="form-item mt-22">
|
<View className="form-item mt-22">
|
||||||
<View className="form-label">密码</View>
|
<View className="form-label">确认密码</View>
|
||||||
<View className="form-control relative">
|
<View className="form-control relative">
|
||||||
<Input className="form-input" type={showPwd ? 'text' : 'password'} placeholder="再次确认新密码" onInput={(v) => {
|
<Input className="form-input" type={showConfirmPwd ? 'text' : 'password'} placeholder="再次确认新密码" onInput={(v) => {
|
||||||
setPwd(v.detail.value)
|
setConfirmPwd(v.detail.value)
|
||||||
}} />
|
}} />
|
||||||
<Image className="w-6 h-6 absolute right-0 bottom-16" src={showPwd ? activeEye : eyeClose} onClick={() => {
|
<Image className="w-6 h-6 absolute right-0 bottom-16" src={showConfirmPwd ? activeEye : eyeClose} onClick={() => {
|
||||||
setShowPwd(v => !v)
|
setShowConfirmPwd(v => !v)
|
||||||
}} />
|
}} />
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
<View className="change-pwd-footer flex flex-col justify-center">
|
<View className="change-pwd-footer flex flex-col justify-center">
|
||||||
<Button className="login-btn">保存</Button>
|
<Button className="login-btn" onClick={submit}>保存</Button>
|
||||||
|
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
|
@ -7,7 +7,8 @@ import './index.scss'
|
|||||||
import { Button } from "@nutui/nutui-react-taro"
|
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 { sendCode } from "../../utils/api"
|
import { pwdManage, sendCode } from "../../utils/api"
|
||||||
|
import { closeLoading, errorNotice, loading, successNotice } from "../../utils/utils"
|
||||||
|
|
||||||
const activeEye = eye
|
const activeEye = eye
|
||||||
|
|
||||||
@ -15,8 +16,9 @@ const Login = () => {
|
|||||||
|
|
||||||
const [account, setAccount] = useState('')
|
const [account, setAccount] = useState('')
|
||||||
const [pwd, setPwd] = useState()
|
const [pwd, setPwd] = useState()
|
||||||
|
const [confirmPwd, setConfirmPwd] = useState()
|
||||||
const [showPwd, setShowPwd] = useState(false)
|
const [showPwd, setShowPwd] = useState(false)
|
||||||
const [loginMode, setLoginMode] = useState('account')
|
const [showConfirmPwd, setShowConfirmPwd] = useState(false)
|
||||||
|
|
||||||
const [mobile, setMobile] = useState('')
|
const [mobile, setMobile] = useState('')
|
||||||
const [smsCode, setSmsCode] = useState('')
|
const [smsCode, setSmsCode] = useState('')
|
||||||
@ -49,7 +51,7 @@ const Login = () => {
|
|||||||
|
|
||||||
// 倒计时
|
// 倒计时
|
||||||
const countDown = async () => {
|
const countDown = async () => {
|
||||||
if (!mobile) {
|
if (!account) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
setIntervalTime(60)
|
setIntervalTime(60)
|
||||||
@ -71,6 +73,30 @@ const Login = () => {
|
|||||||
Taro.showToast({ title: '验证码发送成功', icon: 'success' })
|
Taro.showToast({ title: '验证码发送成功', icon: 'success' })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const submit = async () => {
|
||||||
|
if (!account || !smsCode || !pwd || !confirmPwd) {
|
||||||
|
errorNotice('请完善信息')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (pwd !== confirmPwd) {
|
||||||
|
errorNotice("两次密码不一致")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
loading('密码重置中,请稍后~')
|
||||||
|
const re = await pwdManage('login_password', {
|
||||||
|
confirm_password: confirmPwd,
|
||||||
|
password: pwd,
|
||||||
|
phone: account,
|
||||||
|
verification_code: smsCode
|
||||||
|
})
|
||||||
|
closeLoading()
|
||||||
|
if (!re) return
|
||||||
|
successNotice('密码重置成功,请重新登录')
|
||||||
|
setTimeout(() => {
|
||||||
|
backFn()
|
||||||
|
}, 2000)
|
||||||
|
}
|
||||||
|
|
||||||
return <View className="login-frame bg-slate-50 h-screen text-base">
|
return <View className="login-frame bg-slate-50 h-screen text-base">
|
||||||
<View className="login-header flex justify-center items-center text-lg font-bold">
|
<View className="login-header flex justify-center items-center text-lg font-bold">
|
||||||
<Image src={back} className="square-35 absolute left-7" onClick={backFn} />
|
<Image src={back} className="square-35 absolute left-7" onClick={backFn} />
|
||||||
@ -80,7 +106,7 @@ const Login = () => {
|
|||||||
<View className="relative font-bold text-lg block h-6 ">忘记密码</View>
|
<View className="relative font-bold text-lg block h-6 ">忘记密码</View>
|
||||||
<View>
|
<View>
|
||||||
<View className="form-item mt-58">
|
<View className="form-item mt-58">
|
||||||
<View className="form-label">账号</View>
|
<View className="form-label">手机号</View>
|
||||||
<View className="form-control relative">
|
<View className="form-control relative">
|
||||||
<Input className="form-input" placeholder="请输入手机号" onInput={(v) => {
|
<Input className="form-input" placeholder="请输入手机号" onInput={(v) => {
|
||||||
setAccount(v.detail.value)
|
setAccount(v.detail.value)
|
||||||
@ -112,13 +138,13 @@ const Login = () => {
|
|||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
<View className="form-item mt-22">
|
<View className="form-item mt-22">
|
||||||
<View className="form-label">密码</View>
|
<View className="form-label">确认密码</View>
|
||||||
<View className="form-control relative">
|
<View className="form-control relative">
|
||||||
<Input className="form-input" type={showPwd ? 'text' : 'password'} placeholder="再次确认新密码" onInput={(v) => {
|
<Input className="form-input" type={showConfirmPwd ? 'text' : 'password'} placeholder="再次确认新密码" onInput={(v) => {
|
||||||
setPwd(v.detail.value)
|
setConfirmPwd(v.detail.value)
|
||||||
}} />
|
}} />
|
||||||
<Image className="w-6 h-6 absolute right-0 bottom-16" src={showPwd ? activeEye : eyeClose} onClick={() => {
|
<Image className="w-6 h-6 absolute right-0 bottom-16" src={showConfirmPwd ? activeEye : eyeClose} onClick={() => {
|
||||||
setShowPwd(v => !v)
|
setShowConfirmPwd(v => !v)
|
||||||
}} />
|
}} />
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
@ -126,8 +152,7 @@ const Login = () => {
|
|||||||
<View className="forgot-password" onClick={loginFn}>已有账号,去登陆</View>
|
<View className="forgot-password" onClick={loginFn}>已有账号,去登陆</View>
|
||||||
</View>
|
</View>
|
||||||
<View className="login-footer flex flex-col justify-center">
|
<View className="login-footer flex flex-col justify-center">
|
||||||
<Button className="login-btn">找回密码</Button>
|
<Button className="login-btn" onClick={submit}>找回密码</Button>
|
||||||
|
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
|
|
||||||
|
@ -135,15 +135,22 @@ const Index = () => {
|
|||||||
我的钱包
|
我的钱包
|
||||||
</View>
|
</View>
|
||||||
<View className='flex-between mt-22'>
|
<View className='flex-between mt-22'>
|
||||||
<View className='bal-item-content flex-col items-center'>
|
<View className='bal-item-content flex-col items-center' onClick={() => {
|
||||||
|
navigateTo('/pages/balance/index')
|
||||||
|
}}>
|
||||||
<Text>{user.score}</Text>
|
<Text>{user.score}</Text>
|
||||||
<Text className='bal-item-helper'>余额</Text>
|
<Text className='bal-item-helper'>余额</Text>
|
||||||
</View>
|
</View>
|
||||||
<View className='bal-item-content flex-col items-center'>
|
<View className='bal-item-content flex-col items-center' onClick={() => {
|
||||||
|
navigateTo('/pages/income/index')
|
||||||
|
}
|
||||||
|
}>
|
||||||
<Text>{user.profit ?? 0}</Text>
|
<Text>{user.profit ?? 0}</Text>
|
||||||
<Text className='bal-item-helper'>收益</Text>
|
<Text className='bal-item-helper'>收益</Text>
|
||||||
</View>
|
</View>
|
||||||
<View className='bal-item-content flex-col items-center'>
|
<View className='bal-item-content flex-col items-center' onClick={() => {
|
||||||
|
navigateTo('/pages/scope/index')
|
||||||
|
}}>
|
||||||
<Text>{user.shopping_score}</Text>
|
<Text>{user.shopping_score}</Text>
|
||||||
<Text className='bal-item-helper'>购物金</Text>
|
<Text className='bal-item-helper'>购物金</Text>
|
||||||
</View>
|
</View>
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
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 checked from '@/images/checked.png'
|
||||||
import eyeClose from '@/images/eyeClose.png'
|
import empty from '@/images/empty.png'
|
||||||
import eye from '@/images/eye.png'
|
import eye from '@/images/eye.png'
|
||||||
import './index.scss'
|
import './index.scss'
|
||||||
import { Button } from "@nutui/nutui-react-taro"
|
import { Button } from "@nutui/nutui-react-taro"
|
||||||
@ -12,20 +12,47 @@ import { Picker } from "@nutui/nutui-react-taro"
|
|||||||
import { Tabs, TabPane } from "@nutui/nutui-react-taro"
|
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"
|
||||||
|
|
||||||
const activeEye = eye
|
const activeEye = eye
|
||||||
|
|
||||||
const Login = () => {
|
const Login = () => {
|
||||||
|
const limit = 20
|
||||||
const [tabKey, setTabKey] = useState('0')
|
const [tabKey, setTabKey] = useState('0')
|
||||||
const [page, setPage] = useState(1)
|
const [page, setPage] = useState(1)
|
||||||
|
const [user, setUser] = useState({})
|
||||||
|
const [list, setList] = useState([])
|
||||||
|
const [total, setTotal] = useState(0)
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
userDetail().then(rs => {
|
||||||
|
if (!rs) return
|
||||||
|
setUser(rs)
|
||||||
|
})
|
||||||
|
}, [])
|
||||||
|
|
||||||
|
|
||||||
// 返回页面
|
// 返回页面
|
||||||
const backFn = () => {
|
const backFn = () => {
|
||||||
Taro.getCurrentPages().length > 0 && Taro.navigateBack()
|
Taro.getCurrentPages().length > 0 && Taro.navigateBack()
|
||||||
}
|
}
|
||||||
|
|
||||||
useEffect(() => { }, [tabKey])
|
useEffect(() => {
|
||||||
|
let offset = (page - 1) * limit
|
||||||
|
userLogs('shopping_score', offset, limit).then(rs => {
|
||||||
|
if (!rs) return
|
||||||
|
setList(it => [...it, ...rs.items])
|
||||||
|
setTotal(rs.total)
|
||||||
|
})
|
||||||
|
}, [tabKey, page])
|
||||||
|
|
||||||
|
|
||||||
|
const switchTab = (key) => {
|
||||||
|
if (key != tabKey) {
|
||||||
|
setPage(1)
|
||||||
|
}
|
||||||
|
setTabKey(key)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
return <View className="profit-frame bg-slate-50 h-screen text-base">
|
return <View className="profit-frame bg-slate-50 h-screen text-base">
|
||||||
@ -43,46 +70,47 @@ const Login = () => {
|
|||||||
<View className="flex-around ">
|
<View className="flex-around ">
|
||||||
|
|
||||||
<View className="profit-btn flex-center" onClick={() => {
|
<View className="profit-btn flex-center" onClick={() => {
|
||||||
Taro.navigateTo({ url: '/pages/transfer/index' })
|
Taro.navigateTo({ url: '/pages/conversion/index' })
|
||||||
}}>转换余额</View>
|
}}>转换余额</View>
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
|
|
||||||
<View className="amount-container">
|
<View className="amount-container">
|
||||||
<View className="amount-tabs flex-around">
|
<View className="amount-tabs flex-start">
|
||||||
<View className={'tab-pane ' + (tabKey == '0' ? 'tab-pane-active' : '')} onClick={() => setTabKey('0')}>收益流水</View>
|
<View className={'tab-pane ' + (tabKey == '0' ? 'tab-pane-active' : '')} onClick={() => switchTab('0')}>收益流水</View>
|
||||||
<View className={'tab-pane ' + (tabKey == '1' ? 'tab-pane-active' : '')} onClick={() => setTabKey('1')}>提现记录</View>
|
{/* <View className={'tab-pane ' + (tabKey == '1' ? 'tab-pane-active' : '')} onClick={() => setTabKey('1')}>提现记录</View>
|
||||||
<View className={'tab-pane ' + (tabKey == '2' ? 'tab-pane-active' : '')} onClick={() => setTabKey('2')}>发放明细</View>
|
<View className={'tab-pane ' + (tabKey == '2' ? 'tab-pane-active' : '')} onClick={() => setTabKey('2')}>发放明细</View> */}
|
||||||
</View>
|
</View>
|
||||||
<View className="profitScroll" id="profitScroll">
|
<View className="profitScroll" id="profitScroll">
|
||||||
<Infiniteloading
|
{
|
||||||
containerId="profitScroll"
|
!!list.length && <Infiniteloading
|
||||||
useWindow={false}
|
containerId="profitScroll"
|
||||||
loadTxt="loading"
|
useWindow={false}
|
||||||
loadMoreTxt="没有数据啦~"
|
loadTxt="loading"
|
||||||
loadIcon='loading'
|
loadMoreTxt="没有数据啦~"
|
||||||
hasMore={false}
|
loadIcon='loading'
|
||||||
onLoadMore={(x) => {
|
hasMore={total >= list.length}
|
||||||
setPage(p => p + 1)
|
onLoadMore={(x) => {
|
||||||
x()
|
setPage(p => p + 1)
|
||||||
}}
|
x()
|
||||||
>
|
}}
|
||||||
<View className="amount-item flex-between">
|
>
|
||||||
<View className="amount-item-detail flex-col">
|
{
|
||||||
<View>完成每日登陆</View>
|
list.map(item => {
|
||||||
<View className="amount-item-time">2021/04/09 19:42:36</View>
|
return <View className="amount-item flex-between" key={item.id}>
|
||||||
</View>
|
<View className="amount-item-detail flex-col">
|
||||||
<View className="amount-item-log">+1.00</View>
|
<View>{item.memo}</View>
|
||||||
</View>
|
<View className="amount-item-time">{formatDateByStr(item.created_at)}</View>
|
||||||
|
</View>
|
||||||
<View className="amount-item flex-between">
|
<View className="amount-item-log">{item.amount > 0 ? `+${item.amount}` : `${item.amount}`}</View>
|
||||||
<View className="amount-item-detail flex-col">
|
</View>
|
||||||
<View>完成每日登陆</View>
|
})
|
||||||
<View className="amount-item-time">2021/04/09 19:42:36</View>
|
}
|
||||||
</View>
|
</Infiniteloading>
|
||||||
<View className="amount-item-log">+1.00</View>
|
}
|
||||||
</View>
|
{
|
||||||
</Infiniteloading>
|
!list.length && <Image src={empty} className="order-empty" />
|
||||||
|
}
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
|
|
||||||
|
@ -54,7 +54,6 @@ const Login = () => {
|
|||||||
|
|
||||||
|
|
||||||
const loginSubmit = async () => {
|
const loginSubmit = async () => {
|
||||||
console.log(mobile, smsCode, "code")
|
|
||||||
if (!mobile || !smsCode) {
|
if (!mobile || !smsCode) {
|
||||||
Taro.showToast({ title: '请完善登陆参数', icon: 'error' })
|
Taro.showToast({ title: '请完善登陆参数', icon: 'error' })
|
||||||
return
|
return
|
||||||
|
@ -31,6 +31,21 @@ const Login = () => {
|
|||||||
Taro.getCurrentPages().length > 0 && Taro.navigateBack()
|
Taro.getCurrentPages().length > 0 && Taro.navigateBack()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 注册页面
|
||||||
|
const registerFn = () => {
|
||||||
|
Taro.navigateTo({
|
||||||
|
url: '/pages/register/index'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 忘记密码
|
||||||
|
const forgotPasswordFn = () => {
|
||||||
|
Taro.navigateTo({
|
||||||
|
url: '/pages/forgot/index'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// 倒计时
|
// 倒计时
|
||||||
const countDown = async () => {
|
const countDown = async () => {
|
||||||
if (!mobile) {
|
if (!mobile) {
|
||||||
@ -103,7 +118,10 @@ const Login = () => {
|
|||||||
}} />
|
}} />
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
|
<View className="form-helper">
|
||||||
|
<View className="forgot-password" onClick={registerFn}>注册账号</View>
|
||||||
|
<View className="forgot-password" onClick={forgotPasswordFn}>忘记密码</View>
|
||||||
|
</View>
|
||||||
<View className="login-footer flex flex-col justify-center">
|
<View className="login-footer flex flex-col justify-center">
|
||||||
<Button className="login-btn" onClick={loginSubmit}>登录</Button>
|
<Button className="login-btn" onClick={loginSubmit}>登录</Button>
|
||||||
<View className="quick-login" onClick={() => {
|
<View className="quick-login" onClick={() => {
|
||||||
|
@ -4,12 +4,30 @@ 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 { useEffect } from "react"
|
||||||
|
import { cardList, deleteCard } from "../../utils/api"
|
||||||
|
import { closeLoading, loading, successNotice } from "../../utils/utils"
|
||||||
|
import { useDidShow } from "@tarojs/taro"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const Login = () => {
|
const Login = () => {
|
||||||
|
|
||||||
|
|
||||||
|
const [card, setCard] = useState([])
|
||||||
|
const [ref, setRef] = useState(1)
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
cardList().then(rs => {
|
||||||
|
if (!rs) return
|
||||||
|
setCard(rs.items)
|
||||||
|
})
|
||||||
|
}, [ref])
|
||||||
|
|
||||||
|
useDidShow(() => {
|
||||||
|
setRef(d => d + 1)
|
||||||
|
})
|
||||||
|
|
||||||
// 返回页面
|
// 返回页面
|
||||||
const backFn = () => {
|
const backFn = () => {
|
||||||
Taro.getCurrentPages().length > 0 && Taro.navigateBack()
|
Taro.getCurrentPages().length > 0 && Taro.navigateBack()
|
||||||
@ -22,6 +40,14 @@ const Login = () => {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const del = async (id) => {
|
||||||
|
loading('银行卡解绑中')
|
||||||
|
const re = await deleteCard(id)
|
||||||
|
closeLoading()
|
||||||
|
if (!re) return
|
||||||
|
setRef(d => d + 1)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
return <View className="login-frame bg-slate-50 h-screen text-base">
|
return <View className="login-frame bg-slate-50 h-screen text-base">
|
||||||
<View className='addr-detail-title'>
|
<View className='addr-detail-title'>
|
||||||
@ -30,13 +56,17 @@ const Login = () => {
|
|||||||
|
|
||||||
</View>
|
</View>
|
||||||
<View className="change-pwd-container bg-slate-50 relative flex flex-col items-center">
|
<View className="change-pwd-container bg-slate-50 relative flex flex-col items-center">
|
||||||
<View className="card-item flex-col justify-center">
|
{
|
||||||
<View className="flex-between">
|
card.map(item => {
|
||||||
<View className="bank-name">xxx银行</View>
|
return <View className="card-item flex-col justify-center" key={item.id}>
|
||||||
<View className="bank-number">123456789777</View>
|
<View className="flex-between">
|
||||||
</View>
|
<View className="bank-name">{item.account_name} {item.bank_name}</View>
|
||||||
<View className="card-item-des">解除绑定</View>
|
<View className="bank-number">{item.account_number}</View>
|
||||||
</View>
|
</View>
|
||||||
|
<View className="card-item-des" onClick={() => { del(item.id) }}>解除绑定</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={navCreate}>新增银行</Button>
|
<Button className="login-btn" onClick={navCreate}>新增银行</Button>
|
||||||
</View>
|
</View>
|
||||||
|
@ -53,11 +53,12 @@
|
|||||||
color: #FFFFFF;
|
color: #FFFFFF;
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
margin-top: 12px;
|
margin-top: 12px;
|
||||||
|
font-weight: 600;
|
||||||
}
|
}
|
||||||
|
|
||||||
.card-item-des {
|
.card-item-des {
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
margin-top: 10px;
|
margin-top: 14px;
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
word-spacing: 6px;
|
word-spacing: 6px;
|
||||||
}
|
}
|
@ -133,7 +133,7 @@ function Index() {
|
|||||||
</View>
|
</View>
|
||||||
<View className="flex-between order-detail-item">
|
<View className="flex-between order-detail-item">
|
||||||
<Text>提交时间</Text>
|
<Text>提交时间</Text>
|
||||||
<Text className='order-detail-item-right'>{formatDateByStr('YYYY-mm-dd HH:MM', detail.created_at)}</Text>
|
<Text className='order-detail-item-right'>{formatDateByStr(detail.created_at)}</Text>
|
||||||
</View>
|
</View>
|
||||||
<View className="flex-between order-detail-item">
|
<View className="flex-between order-detail-item">
|
||||||
<Text>支付方式</Text>
|
<Text>支付方式</Text>
|
||||||
|
@ -36,7 +36,7 @@ const Login = () => {
|
|||||||
state = ''
|
state = ''
|
||||||
}
|
}
|
||||||
orderList(chanel, { state, offset, limit }).then(re => {
|
orderList(chanel, { state, offset, limit }).then(re => {
|
||||||
setList(re.items)
|
setList(it => [...it, ...re.items])
|
||||||
setTotal(re.total)
|
setTotal(re.total)
|
||||||
})
|
})
|
||||||
}, [tabKey, page])
|
}, [tabKey, page])
|
||||||
|
@ -110,10 +110,3 @@
|
|||||||
border: 1px solid rgba(0, 0, 0, 0.5);
|
border: 1px solid rgba(0, 0, 0, 0.5);
|
||||||
color: #5E6272;
|
color: #5E6272;
|
||||||
}
|
}
|
||||||
|
|
||||||
.order-empty {
|
|
||||||
width: 200px;
|
|
||||||
height: 200px;
|
|
||||||
margin-left: calc((375px - 200px)/2);
|
|
||||||
margin-top: 100px;
|
|
||||||
}
|
|
@ -1,3 +1,3 @@
|
|||||||
export default definePageConfig({
|
export default definePageConfig({
|
||||||
navigationBarTitleText: '我的积分'
|
navigationBarTitleText: '我的购物金'
|
||||||
})
|
})
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
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 checked from '@/images/checked.png'
|
||||||
import eyeClose from '@/images/eyeClose.png'
|
import empty from '@/images/empty.png'
|
||||||
import eye from '@/images/eye.png'
|
import eye from '@/images/eye.png'
|
||||||
import './index.scss'
|
import './index.scss'
|
||||||
import { Button } from "@nutui/nutui-react-taro"
|
import { Button } from "@nutui/nutui-react-taro"
|
||||||
@ -12,71 +12,97 @@ import { Picker } from "@nutui/nutui-react-taro"
|
|||||||
import { Tabs, TabPane } from "@nutui/nutui-react-taro"
|
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"
|
||||||
|
|
||||||
const activeEye = eye
|
const activeEye = eye
|
||||||
|
|
||||||
const Login = () => {
|
const Login = () => {
|
||||||
|
const limit = 20
|
||||||
const [tabKey, setTabKey] = useState('0')
|
const [tabKey, setTabKey] = useState('0')
|
||||||
const [page, setPage] = useState(1)
|
const [page, setPage] = useState(1)
|
||||||
|
const [user, setUser] = useState({})
|
||||||
|
const [list, setList] = useState([])
|
||||||
|
const [total, setTotal] = useState(0)
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
userDetail().then(rs => {
|
||||||
|
if (!rs) return
|
||||||
|
setUser(rs)
|
||||||
|
})
|
||||||
|
}, [])
|
||||||
|
|
||||||
// 返回页面
|
// 返回页面
|
||||||
const backFn = () => {
|
const backFn = () => {
|
||||||
Taro.getCurrentPages().length > 0 && Taro.navigateBack()
|
Taro.getCurrentPages().length > 0 && Taro.navigateBack()
|
||||||
}
|
}
|
||||||
|
|
||||||
useEffect(() => { }, [tabKey])
|
useEffect(() => {
|
||||||
|
let offset = (page - 1) * limit
|
||||||
|
userLogs('shopping_score', offset, limit).then(rs => {
|
||||||
|
if (!rs) return
|
||||||
|
setList(it => [...it, ...rs.items])
|
||||||
|
setTotal(rs.total)
|
||||||
|
})
|
||||||
|
}, [tabKey, page])
|
||||||
|
|
||||||
|
const switchTab = (key) => {
|
||||||
|
if (key != tabKey) {
|
||||||
|
setPage(1)
|
||||||
|
}
|
||||||
|
setTabKey(key)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
return <View className="cash-frame bg-slate-50 h-screen text-base">
|
return <View className="cash-frame bg-slate-50 h-screen text-base">
|
||||||
<View className='addr-detail-title'>
|
<View className='addr-detail-title'>
|
||||||
<Image src={backNav} className="square-35 absolute left-10 nav-icon" onClick={backFn} />
|
<Image src={backNav} className="square-35 absolute left-10 nav-icon" onClick={backFn} />
|
||||||
我的积分
|
我的购物金
|
||||||
|
|
||||||
</View>
|
</View>
|
||||||
<View className="scope-container relative">
|
<View className="scope-container relative">
|
||||||
<View className="scope-amount flex-col ">
|
<View className="scope-amount flex-col ">
|
||||||
<View className="flex-between mt-22">
|
<View className="flex-between mt-22">
|
||||||
<Text>当前积分</Text>
|
<Text>我的余额</Text>
|
||||||
<Text className="scope-amount-price">50000</Text>
|
<Text className="scope-amount-price">{user.shopping_score}</Text>
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
|
|
||||||
<View className="amount-container">
|
<View className="amount-container">
|
||||||
<View className="amount-tabs flex-around">
|
<View className="amount-tabs flex-start">
|
||||||
<View className={'tab-pane ' + (tabKey == '0' ? 'tab-pane-active' : '')} onClick={() => setTabKey('0')}>余额流水</View>
|
<View className={'tab-pane ' + (tabKey == '0' ? 'tab-pane-active' : '')} onClick={() => switchTab('0')}>余额流水</View>
|
||||||
<View className={'tab-pane ' + (tabKey == '1' ? 'tab-pane-active' : '')} onClick={() => setTabKey('1')}>充值记录</View>
|
{/* <View className={'tab-pane ' + (tabKey == '1' ? 'tab-pane-active' : '')} onClick={() => setTabKey('1')}>充值记录</View>
|
||||||
<View className={'tab-pane ' + (tabKey == '2' ? 'tab-pane-active' : '')} onClick={() => setTabKey('2')}>提现记录</View>
|
<View className={'tab-pane ' + (tabKey == '2' ? 'tab-pane-active' : '')} onClick={() => setTabKey('2')}>提现记录</View> */}
|
||||||
</View>
|
</View>
|
||||||
<View className="scopeScroll" id="scopeScroll">
|
<View className="scopeScroll" id="scopeScroll">
|
||||||
<Infiniteloading
|
{
|
||||||
containerId="scopeScroll"
|
!!list.length && <Infiniteloading
|
||||||
useWindow={false}
|
containerId="scopeScroll"
|
||||||
loadTxt="loading"
|
useWindow={false}
|
||||||
loadMoreTxt="没有数据啦~"
|
loadTxt="loading"
|
||||||
loadIcon='loading'
|
loadMoreTxt="没有数据啦~"
|
||||||
hasMore={false}
|
loadIcon='loading'
|
||||||
onLoadMore={(x) => {
|
hasMore={total >= list.length}
|
||||||
setPage(p => p + 1)
|
onLoadMore={(x) => {
|
||||||
x()
|
setPage(p => p + 1)
|
||||||
}}
|
x()
|
||||||
>
|
}}
|
||||||
<View className="amount-item flex-between">
|
>
|
||||||
<View className="amount-item-detail flex-col">
|
{
|
||||||
<View>完成每日登陆</View>
|
list.map(item => {
|
||||||
<View className="amount-item-time">2021/04/09 19:42:36</View>
|
return <View className="amount-item flex-between" key={item.id}>
|
||||||
</View>
|
<View className="amount-item-detail flex-col">
|
||||||
<View className="amount-item-log">+1.00</View>
|
<View>{item.memo}</View>
|
||||||
</View>
|
<View className="amount-item-time">{formatDateByStr(item.created_at)}</View>
|
||||||
|
</View>
|
||||||
<View className="amount-item flex-between">
|
<View className="amount-item-log">{item.amount > 0 ? `+${item.amount}` : `${item.amount}`}</View>
|
||||||
<View className="amount-item-detail flex-col">
|
</View>
|
||||||
<View>完成每日登陆</View>
|
})
|
||||||
<View className="amount-item-time">2021/04/09 19:42:36</View>
|
}
|
||||||
</View>
|
</Infiniteloading>
|
||||||
<View className="amount-item-log">+1.00</View>
|
}
|
||||||
</View>
|
{
|
||||||
</Infiniteloading>
|
!list.length && <Image src={empty} className="order-empty" />
|
||||||
|
}
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
|
|
||||||
|
@ -9,19 +9,28 @@ 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 { Picker } from "@nutui/nutui-react-taro"
|
import { Picker } from "@nutui/nutui-react-taro"
|
||||||
|
import { useEffect } from "react"
|
||||||
|
import { transferAmount, userDetail } from "../../utils/api"
|
||||||
|
import { closeLoading, errorNotice, loading, navigateTo } from "../../utils/utils"
|
||||||
|
|
||||||
const activeEye = eye
|
const activeEye = eye
|
||||||
|
|
||||||
const Login = () => {
|
const Login = () => {
|
||||||
|
|
||||||
const [account, setAccount] = useState('')
|
const [account, setAccount] = useState('')
|
||||||
|
const [confirmAccount, setConfirmAccount] = useState('')
|
||||||
|
const [num, setNum] = useState(0)
|
||||||
const [pwd, setPwd] = useState('')
|
const [pwd, setPwd] = useState('')
|
||||||
const [showPwd, setShowPwd] = useState(false)
|
const [showPwd, setShowPwd] = useState(false)
|
||||||
|
|
||||||
const [visible, setVisible] = useState(false)
|
const [user, setUser] = useState({})
|
||||||
const [bank, setBank] = useState({ value: 0, text: '' })
|
|
||||||
|
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
userDetail().then(rs => {
|
||||||
|
if (!rs) return
|
||||||
|
setUser(rs)
|
||||||
|
})
|
||||||
|
}, [])
|
||||||
|
|
||||||
// 返回页面
|
// 返回页面
|
||||||
const backFn = () => {
|
const backFn = () => {
|
||||||
@ -29,6 +38,36 @@ const Login = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const submit = async () => {
|
||||||
|
if (!account || !confirmAccount || !num || !pwd) {
|
||||||
|
errorNotice("请确认转赠参数是否正确")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (account != confirmAccount) {
|
||||||
|
errorNotice("两次账号输入不一致")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (num == 0 || num > user.score) {
|
||||||
|
errorNotice("转赠数量不正确")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
loading("正在处理中,请稍后")
|
||||||
|
const re = await transferAmount({
|
||||||
|
amount: num,
|
||||||
|
to_phone: account,
|
||||||
|
password: pwd
|
||||||
|
})
|
||||||
|
closeLoading()
|
||||||
|
if (!re) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
errorNotice("转赠成功")
|
||||||
|
setTimeout(() => {
|
||||||
|
navigateTo('/pages/balance/index')
|
||||||
|
}, 1000)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
return <View className="transfer-frame bg-slate-50 h-screen text-base">
|
return <View className="transfer-frame bg-slate-50 h-screen text-base">
|
||||||
<View className='addr-detail-title'>
|
<View className='addr-detail-title'>
|
||||||
<Image src={backNav} className="square-35 absolute left-10 nav-icon" onClick={backFn} />
|
<Image src={backNav} className="square-35 absolute left-10 nav-icon" onClick={backFn} />
|
||||||
@ -38,7 +77,7 @@ const Login = () => {
|
|||||||
<View className="transfer-container relative">
|
<View className="transfer-container relative">
|
||||||
<View className="transfer-amount flex-col justify-center">
|
<View className="transfer-amount flex-col justify-center">
|
||||||
<Text>当前余额</Text>
|
<Text>当前余额</Text>
|
||||||
<Text className="transfer-amount-price">50000</Text>
|
<Text className="transfer-amount-price">{user.score}</Text>
|
||||||
</View>
|
</View>
|
||||||
<View>
|
<View>
|
||||||
<View className="form-item mt-22">
|
<View className="form-item mt-22">
|
||||||
@ -57,10 +96,10 @@ const Login = () => {
|
|||||||
<View className="form-label">确认对方账号</View>
|
<View className="form-label">确认对方账号</View>
|
||||||
<View className="form-control relative">
|
<View className="form-control relative">
|
||||||
<Input className="form-input" placeholder="再次确认对方账号" onInput={(v) => {
|
<Input className="form-input" placeholder="再次确认对方账号" onInput={(v) => {
|
||||||
setAccount(v.detail.value)
|
setConfirmAccount(v.detail.value)
|
||||||
}} />
|
}} />
|
||||||
{
|
{
|
||||||
account && <Image className="w-6 h-6 absolute right-0 bottom-16" src={checked} />
|
confirmAccount && <Image className="w-6 h-6 absolute right-0 bottom-16" src={checked} />
|
||||||
}
|
}
|
||||||
|
|
||||||
</View>
|
</View>
|
||||||
@ -69,10 +108,10 @@ const Login = () => {
|
|||||||
<View className="form-label">转赠数量</View>
|
<View className="form-label">转赠数量</View>
|
||||||
<View className="form-control relative">
|
<View className="form-control relative">
|
||||||
<Input className="form-input" type="digit" placeholder="请输入转赠数量" onInput={(v) => {
|
<Input className="form-input" type="digit" placeholder="请输入转赠数量" onInput={(v) => {
|
||||||
setAccount(v.detail.value)
|
setNum(v.detail.value)
|
||||||
}} />
|
}} />
|
||||||
{
|
{
|
||||||
account && <Image className="w-6 h-6 absolute right-0 bottom-16" src={checked} />
|
!!num && <Image className="w-6 h-6 absolute right-0 bottom-16" src={checked} />
|
||||||
}
|
}
|
||||||
|
|
||||||
</View>
|
</View>
|
||||||
@ -92,7 +131,7 @@ const Login = () => {
|
|||||||
{
|
{
|
||||||
account &&
|
account &&
|
||||||
<View className="transfer-footer ">
|
<View className="transfer-footer ">
|
||||||
<Button className="transfer-btn">立即赠送</Button>
|
<Button className="transfer-btn" onClick={submit}>立即赠送</Button>
|
||||||
</View>
|
</View>
|
||||||
}
|
}
|
||||||
</View>
|
</View>
|
||||||
|
@ -93,7 +93,7 @@ function Index() {
|
|||||||
<Image src={next} className='next-icon' />
|
<Image src={next} className='next-icon' />
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
<View className='addr-form' onClick={() => { navigateTo('/pages/change-password/index') }}>
|
<View className='addr-form' onClick={() => { navigateTo('/pages/change-pwd/index') }}>
|
||||||
<View className='addr-form-name'>修改密码</View>
|
<View className='addr-form-name'>修改密码</View>
|
||||||
<View className='flex justify-between items-center ' >
|
<View className='flex justify-between items-center ' >
|
||||||
|
|
||||||
|
@ -57,3 +57,35 @@ export const orderList = async (channel, params = {}) => {
|
|||||||
export const userDetail = async () => {
|
export const userDetail = async () => {
|
||||||
return await g(`/users/detail`)
|
return await g(`/users/detail`)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 我的银行卡
|
||||||
|
export const cardList = async () => {
|
||||||
|
return await g(`/users/bank-cards`)
|
||||||
|
}
|
||||||
|
|
||||||
|
export const createCard = async (data) => {
|
||||||
|
return await p(`/users/bank-cards`, data)
|
||||||
|
}
|
||||||
|
|
||||||
|
export const deleteCard = async (id) => {
|
||||||
|
return await d(`/users/bank-cards/${id}`)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
export const pwdManage = async (type, data) => {
|
||||||
|
return await put(`/users/profile/password/${type}`, data)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
export const phoneManage = async (data = {}) => {
|
||||||
|
return await put(`/users/profile/phone`, data)
|
||||||
|
}
|
||||||
|
|
||||||
|
export const userLogs = async (type, data = {}) => {
|
||||||
|
return await g(`/users/assets/logs/${type}`, data)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
export const transferAmount = async (data = {}) => {
|
||||||
|
return await p(`/users/assets/score-transfer`, data)
|
||||||
|
}
|
@ -70,7 +70,7 @@ export function dateFormat(fmt, date) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
export const formatDateByStr = (fmt, date) => {
|
export const formatDateByStr = (date) => {
|
||||||
const d = new Date(date)
|
const d = new Date(date)
|
||||||
return dateFormat(fmt, d)
|
return dateFormat('YYYY-mm-dd HH:MM', d)
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user