diff --git a/src/app.scss b/src/app.scss index 3c9a405..ca8f36b 100644 --- a/src/app.scss +++ b/src/app.scss @@ -222,4 +222,11 @@ .nut-popup { background: none !important; +} + +.order-empty { + width: 200px; + height: 200px; + margin-left: calc((375px - 200px)/2); + margin-top: 100px; } \ No newline at end of file diff --git a/src/pages/add-card/index.jsx b/src/pages/add-card/index.jsx index 4584f38..ae09f74 100644 --- a/src/pages/add-card/index.jsx +++ b/src/pages/add-card/index.jsx @@ -8,18 +8,16 @@ import { Button } from "@nutui/nutui-react-taro" import { useState } from "react" import Taro from "@tarojs/taro" import backNav from '@/images/backNav.png' +import { createCard } from "../../utils/api" +import { closeLoading, errorNotice, loading, successNotice } from "../../utils/utils" const activeEye = eye const Login = () => { const [account, setAccount] = useState('') - const [pwd, setPwd] = useState() - const [loginMode, setLoginMode] = useState('account') - - const [mobile, setMobile] = useState('') - const [smsCode, setSmsCode] = useState('') - const [interval, setIntervalTime] = useState(0) + const [user, setUser] = useState('') + const [accountNumber, setAccountNumber] = useState() // 返回页面 @@ -28,45 +26,36 @@ const Login = () => { } - // 去登陆 - const loginFn = () => { - Taro.redirectTo({ - url: '/pages/login/index' + const submit = () => { + if (!account || !accountNumber || !user) { + errorNotice('请完善银行卡信息') + 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 }) - } - - //清理数据 - const cleanFn = () => { - if (loginMode === 'account') { - 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) - } + closeLoading() + if (!re) return + successNotice('银行卡添加成功') + setTimeout(() => { + backFn() }, 1000) } + return @@ -76,30 +65,43 @@ const Login = () => { - 银行卡号 + 银行名称 - { + { setAccount(v.detail.value) }} /> { account && } + + + + 银行卡号 + + { + setAccountNumber(v.detail.value) + }} /> + { + accountNumber && + } - 银行名称 + 开户人名称 - { - setPwd(v.detail.value) + { + setUser(v.detail.value) }} /> { - pwd && + user && } + + - + diff --git a/src/pages/balance/index.jsx b/src/pages/balance/index.jsx index 43a1d44..5332489 100644 --- a/src/pages/balance/index.jsx +++ b/src/pages/balance/index.jsx @@ -1,7 +1,7 @@ import { Image, Input, Text, View } from "@tarojs/components" import back from '@/images/back.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 './index.scss' 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 { Infiniteloading } from "@nutui/nutui-react-taro" import { useEffect } from "react" +import { userDetail, userLogs } from "../../utils/api" +import { formatDateByStr } from "../../utils/utils" const activeEye = eye const Login = () => { - + const limit = 20 const [tabKey, setTabKey] = useState('0') 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 = () => { 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 @@ -38,7 +68,7 @@ const Login = () => { 当前余额 - 50000 + {user.score} { @@ -51,40 +81,41 @@ const Login = () => { - - setTabKey('0')}>余额流水 - setTabKey('1')}>充值记录 - setTabKey('2')}>提现记录 + + switchTab('0')}>余额流水 + {/* switchTab('1')}>充值记录 */} + {/* switchTab('2')}>提现记录 */} - { - setPage(p => p + 1) - x() - }} - > - - - 完成每日登陆 - 2021/04/09 19:42:36 - - +1.00 - - - - - 完成每日登陆 - 2021/04/09 19:42:36 - - +1.00 - - + { + !!list.length && = list.length} + onLoadMore={(x) => { + setPage(p => p + 1) + x() + }} + > + { + list.map(item => { + return + + {item.memo} + {formatDateByStr(item.created_at)} + + {item.amount > 0 ? `+${item.amount}` : `${item.amount}`} + + }) + } + + } + { + !list.length && + } diff --git a/src/pages/change-phone/index.jsx b/src/pages/change-phone/index.jsx index fa41e6b..0651bd2 100644 --- a/src/pages/change-phone/index.jsx +++ b/src/pages/change-phone/index.jsx @@ -8,6 +8,8 @@ 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 { closeLoading, errorNotice, loading, redirectTo, successNotice } from "../../utils/utils" const activeEye = eye @@ -15,7 +17,7 @@ const Login = () => { const [account, setAccount] = useState('') const [pwd, setPwd] = useState() - const [loginMode, setLoginMode] = useState('account') + const [showPwd, setShowPwd] = useState(false) const [mobile, setMobile] = 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 = () => { - if (!mobile) { + if (!account) { return } setIntervalTime(60) @@ -67,6 +51,25 @@ const Login = () => { }, 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 @@ -76,15 +79,25 @@ const Login = () => { - 验证原手机号 + 密码 - { + { + setPwd(v.detail.value) + }} /> + { + setShowPwd(v => !v) + }} /> + + + + 输入新手机号码 + + { setAccount(v.detail.value) }} /> { account && } - @@ -96,19 +109,8 @@ const Login = () => { - - 输入新手机号码 - - { - setPwd(v.detail.value) - }} /> - { - pwd && - } - - - + diff --git a/src/pages/change-pwd/index.jsx b/src/pages/change-pwd/index.jsx index e430f71..08fcac8 100644 --- a/src/pages/change-pwd/index.jsx +++ b/src/pages/change-pwd/index.jsx @@ -8,6 +8,8 @@ import { Button } from "@nutui/nutui-react-taro" 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" const activeEye = eye @@ -15,10 +17,9 @@ const Login = () => { const [account, setAccount] = useState('') const [pwd, setPwd] = useState() + const [confirmPwd, setConfirmPwd] = useState() const [showPwd, setShowPwd] = useState(false) - const [loginMode, setLoginMode] = useState('account') - - const [mobile, setMobile] = useState('') + const [showConfirmPwd, setShowConfirmPwd] = useState(false) const [smsCode, setSmsCode] = useState('') const [interval, setIntervalTime] = useState(0) @@ -28,28 +29,9 @@ const Login = () => { 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 = () => { - if (!mobile) { + if (!account) { return } setIntervalTime(60) @@ -68,6 +50,30 @@ const Login = () => { }, 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 @@ -77,7 +83,7 @@ const Login = () => { - 账号 + 手机号 { setAccount(v.detail.value) @@ -109,18 +115,18 @@ const Login = () => { - 密码 + 确认密码 - { - setPwd(v.detail.value) + { + setConfirmPwd(v.detail.value) }} /> - { - setShowPwd(v => !v) + { + setShowConfirmPwd(v => !v) }} /> - + diff --git a/src/pages/forgot/index.jsx b/src/pages/forgot/index.jsx index f717b0f..bafd411 100644 --- a/src/pages/forgot/index.jsx +++ b/src/pages/forgot/index.jsx @@ -7,7 +7,8 @@ import './index.scss' import { Button } from "@nutui/nutui-react-taro" import { useState } from "react" 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 @@ -15,8 +16,9 @@ const Login = () => { const [account, setAccount] = useState('') const [pwd, setPwd] = useState() + const [confirmPwd, setConfirmPwd] = useState() const [showPwd, setShowPwd] = useState(false) - const [loginMode, setLoginMode] = useState('account') + const [showConfirmPwd, setShowConfirmPwd] = useState(false) const [mobile, setMobile] = useState('') const [smsCode, setSmsCode] = useState('') @@ -49,7 +51,7 @@ const Login = () => { // 倒计时 const countDown = async () => { - if (!mobile) { + if (!account) { return } setIntervalTime(60) @@ -71,6 +73,30 @@ const Login = () => { 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 @@ -80,7 +106,7 @@ const Login = () => { 忘记密码 - 账号 + 手机号 { setAccount(v.detail.value) @@ -112,13 +138,13 @@ const Login = () => { - 密码 + 确认密码 - { - setPwd(v.detail.value) + { + setConfirmPwd(v.detail.value) }} /> - { - setShowPwd(v => !v) + { + setShowConfirmPwd(v => !v) }} /> @@ -126,8 +152,7 @@ const Login = () => { 已有账号,去登陆 - - + diff --git a/src/pages/home/index.jsx b/src/pages/home/index.jsx index 9535596..1d0f7d4 100644 --- a/src/pages/home/index.jsx +++ b/src/pages/home/index.jsx @@ -135,15 +135,22 @@ const Index = () => { 我的钱包 - + { + navigateTo('/pages/balance/index') + }}> {user.score} 余额 - + { + navigateTo('/pages/income/index') + } + }> {user.profit ?? 0} 收益 - + { + navigateTo('/pages/scope/index') + }}> {user.shopping_score} 购物金 diff --git a/src/pages/income/index.jsx b/src/pages/income/index.jsx index 435e449..af8a572 100644 --- a/src/pages/income/index.jsx +++ b/src/pages/income/index.jsx @@ -1,7 +1,7 @@ import { Image, Input, Text, View } from "@tarojs/components" import back from '@/images/back.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 './index.scss' 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 { Infiniteloading } from "@nutui/nutui-react-taro" import { useEffect } from "react" +import { userDetail, userLogs } from "../../utils/api" const activeEye = eye const Login = () => { - + const limit = 20 const [tabKey, setTabKey] = useState('0') 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 = () => { 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 @@ -43,46 +70,47 @@ const Login = () => { { - Taro.navigateTo({ url: '/pages/transfer/index' }) + Taro.navigateTo({ url: '/pages/conversion/index' }) }}>转换余额 - - setTabKey('0')}>收益流水 - setTabKey('1')}>提现记录 - setTabKey('2')}>发放明细 + + switchTab('0')}>收益流水 + {/* setTabKey('1')}>提现记录 + setTabKey('2')}>发放明细 */} - { - setPage(p => p + 1) - x() - }} - > - - - 完成每日登陆 - 2021/04/09 19:42:36 - - +1.00 - - - - - 完成每日登陆 - 2021/04/09 19:42:36 - - +1.00 - - + { + !!list.length && = list.length} + onLoadMore={(x) => { + setPage(p => p + 1) + x() + }} + > + { + list.map(item => { + return + + {item.memo} + {formatDateByStr(item.created_at)} + + {item.amount > 0 ? `+${item.amount}` : `${item.amount}`} + + }) + } + + } + { + !list.length && + } diff --git a/src/pages/login-quick/index.jsx b/src/pages/login-quick/index.jsx index 297a39b..3d6ea9c 100644 --- a/src/pages/login-quick/index.jsx +++ b/src/pages/login-quick/index.jsx @@ -54,7 +54,6 @@ const Login = () => { const loginSubmit = async () => { - console.log(mobile, smsCode, "code") if (!mobile || !smsCode) { Taro.showToast({ title: '请完善登陆参数', icon: 'error' }) return diff --git a/src/pages/login/index.jsx b/src/pages/login/index.jsx index f5097ca..ef8c3d5 100644 --- a/src/pages/login/index.jsx +++ b/src/pages/login/index.jsx @@ -31,6 +31,21 @@ const Login = () => { 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 () => { if (!mobile) { @@ -103,7 +118,10 @@ const Login = () => { }} /> - + + 注册账号 + 忘记密码 + { diff --git a/src/pages/my-card/index.jsx b/src/pages/my-card/index.jsx index 30d6ed2..dbf28ca 100644 --- a/src/pages/my-card/index.jsx +++ b/src/pages/my-card/index.jsx @@ -4,12 +4,30 @@ import { Button } from "@nutui/nutui-react-taro" import { useState } from "react" import Taro from "@tarojs/taro" 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 [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 = () => { 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 @@ -30,13 +56,17 @@ const Login = () => { - - - xxx银行 - 123456789777 - - 解除绑定 - + { + card.map(item => { + return + + {item.account_name} {item.bank_name} + {item.account_number} + + { del(item.id) }}>解除绑定 + + }) + } diff --git a/src/pages/my-card/index.scss b/src/pages/my-card/index.scss index dde9269..118382d 100644 --- a/src/pages/my-card/index.scss +++ b/src/pages/my-card/index.scss @@ -53,11 +53,12 @@ color: #FFFFFF; font-size: 12px; margin-top: 12px; + font-weight: 600; } .card-item-des { font-size: 16px; - margin-top: 10px; + margin-top: 14px; font-weight: 400; word-spacing: 6px; } \ No newline at end of file diff --git a/src/pages/order-detail/index.jsx b/src/pages/order-detail/index.jsx index bf1b659..a2b033c 100644 --- a/src/pages/order-detail/index.jsx +++ b/src/pages/order-detail/index.jsx @@ -133,7 +133,7 @@ function Index() { 提交时间 - {formatDateByStr('YYYY-mm-dd HH:MM', detail.created_at)} + {formatDateByStr(detail.created_at)} 支付方式 diff --git a/src/pages/order/index.jsx b/src/pages/order/index.jsx index 1dc94c6..0f35220 100644 --- a/src/pages/order/index.jsx +++ b/src/pages/order/index.jsx @@ -36,7 +36,7 @@ const Login = () => { state = '' } orderList(chanel, { state, offset, limit }).then(re => { - setList(re.items) + setList(it => [...it, ...re.items]) setTotal(re.total) }) }, [tabKey, page]) diff --git a/src/pages/order/index.scss b/src/pages/order/index.scss index d13f710..8a9eb36 100644 --- a/src/pages/order/index.scss +++ b/src/pages/order/index.scss @@ -109,11 +109,4 @@ .order-btn-delete { border: 1px solid rgba(0, 0, 0, 0.5); color: #5E6272; -} - -.order-empty { - width: 200px; - height: 200px; - margin-left: calc((375px - 200px)/2); - margin-top: 100px; } \ No newline at end of file diff --git a/src/pages/scope/index.config.js b/src/pages/scope/index.config.js index 1723e6d..f11c14f 100644 --- a/src/pages/scope/index.config.js +++ b/src/pages/scope/index.config.js @@ -1,3 +1,3 @@ export default definePageConfig({ - navigationBarTitleText: '我的积分' + navigationBarTitleText: '我的购物金' }) diff --git a/src/pages/scope/index.jsx b/src/pages/scope/index.jsx index 3cda210..23ae1ae 100644 --- a/src/pages/scope/index.jsx +++ b/src/pages/scope/index.jsx @@ -1,7 +1,7 @@ import { Image, Input, Text, View } from "@tarojs/components" import back from '@/images/back.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 './index.scss' 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 { Infiniteloading } from "@nutui/nutui-react-taro" import { useEffect } from "react" +import { userDetail, userLogs } from "../../utils/api" const activeEye = eye const Login = () => { - + const limit = 20 const [tabKey, setTabKey] = useState('0') 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 = () => { 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 - 我的积分 + 我的购物金 - 当前积分 - 50000 + 我的余额 + {user.shopping_score} - - setTabKey('0')}>余额流水 - setTabKey('1')}>充值记录 - setTabKey('2')}>提现记录 + + switchTab('0')}>余额流水 + {/* setTabKey('1')}>充值记录 + setTabKey('2')}>提现记录 */} - { - setPage(p => p + 1) - x() - }} - > - - - 完成每日登陆 - 2021/04/09 19:42:36 - - +1.00 - - - - - 完成每日登陆 - 2021/04/09 19:42:36 - - +1.00 - - + { + !!list.length && = list.length} + onLoadMore={(x) => { + setPage(p => p + 1) + x() + }} + > + { + list.map(item => { + return + + {item.memo} + {formatDateByStr(item.created_at)} + + {item.amount > 0 ? `+${item.amount}` : `${item.amount}`} + + }) + } + + } + { + !list.length && + } diff --git a/src/pages/transfer/index.jsx b/src/pages/transfer/index.jsx index 2f62cbe..9d4b6d5 100644 --- a/src/pages/transfer/index.jsx +++ b/src/pages/transfer/index.jsx @@ -9,19 +9,28 @@ import { useState } from "react" import Taro from "@tarojs/taro" import backNav from '@/images/backNav.png' 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 Login = () => { const [account, setAccount] = useState('') + const [confirmAccount, setConfirmAccount] = useState('') + const [num, setNum] = useState(0) const [pwd, setPwd] = useState('') const [showPwd, setShowPwd] = useState(false) - const [visible, setVisible] = useState(false) - const [bank, setBank] = useState({ value: 0, text: '' }) - + const [user, setUser] = useState({}) + useEffect(() => { + userDetail().then(rs => { + if (!rs) return + setUser(rs) + }) + }, []) // 返回页面 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 @@ -38,7 +77,7 @@ const Login = () => { 当前余额 - 50000 + {user.score} @@ -57,10 +96,10 @@ const Login = () => { 确认对方账号 { - setAccount(v.detail.value) + setConfirmAccount(v.detail.value) }} /> { - account && + confirmAccount && } @@ -69,10 +108,10 @@ const Login = () => { 转赠数量 { - setAccount(v.detail.value) + setNum(v.detail.value) }} /> { - account && + !!num && } @@ -92,7 +131,7 @@ const Login = () => { { account && - + } diff --git a/src/pages/user-info/index.jsx b/src/pages/user-info/index.jsx index 48e8f00..8aa6f2e 100644 --- a/src/pages/user-info/index.jsx +++ b/src/pages/user-info/index.jsx @@ -93,7 +93,7 @@ function Index() { - { navigateTo('/pages/change-password/index') }}> + { navigateTo('/pages/change-pwd/index') }}> 修改密码 diff --git a/src/utils/api.js b/src/utils/api.js index 39c9d8f..c88ffde 100644 --- a/src/utils/api.js +++ b/src/utils/api.js @@ -56,4 +56,36 @@ export const orderList = async (channel, params = {}) => { // 当前用户信息 export const userDetail = async () => { 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) } \ No newline at end of file diff --git a/src/utils/utils.js b/src/utils/utils.js index 17b3951..c1ddc3c 100644 --- a/src/utils/utils.js +++ b/src/utils/utils.js @@ -70,7 +70,7 @@ export function dateFormat(fmt, date) { } -export const formatDateByStr = (fmt, date) => { +export const formatDateByStr = (date) => { const d = new Date(date) - return dateFormat(fmt, d) + return dateFormat('YYYY-mm-dd HH:MM', d) } \ No newline at end of file