Compare commits
10 Commits
7db9999127
...
00b5cfe7e5
Author | SHA1 | Date | |
---|---|---|---|
|
00b5cfe7e5 | ||
|
965be530af | ||
|
df72bbfcdf | ||
|
1ceaf78fb7 | ||
|
6d62c87253 | ||
|
dad0452831 | ||
|
2353101453 | ||
|
d46dd16c36 | ||
|
eaee69667c | ||
|
64cb883ebb |
@ -32,7 +32,9 @@ const config = {
|
||||
alias: {
|
||||
'@/components': path.resolve(__dirname, '..', 'src/components'),
|
||||
'@/assets': path.resolve(__dirname, '..', 'src/assets'),
|
||||
'@/images': path.resolve(__dirname, '..', 'src/assets/images')
|
||||
'@/images': path.resolve(__dirname, '..', 'src/assets/images'),
|
||||
'@/config': path.resolve(__dirname, '..', 'src/config'),
|
||||
'@/utils': path.resolve(__dirname, '..', 'src/utils'),
|
||||
},
|
||||
mini: {
|
||||
postcss: {
|
||||
|
@ -54,6 +54,8 @@
|
||||
"@tarojs/shared": "3.6.5",
|
||||
"@tarojs/taro": "3.6.5",
|
||||
"autoprefixer": "^10.4.14",
|
||||
"html2canvas": "^1.4.1",
|
||||
"jr-qrcode": "^1.1.4",
|
||||
"react": "^18.0.0",
|
||||
"react-dom": "^18.0.0",
|
||||
"react-refresh": "^0.11.0"
|
||||
|
@ -55,6 +55,12 @@ dependencies:
|
||||
autoprefixer:
|
||||
specifier: ^10.4.14
|
||||
version: 10.4.14(postcss@8.4.18)
|
||||
html2canvas:
|
||||
specifier: ^1.4.1
|
||||
version: 1.4.1
|
||||
jr-qrcode:
|
||||
specifier: ^1.1.4
|
||||
version: 1.1.4
|
||||
react:
|
||||
specifier: ^18.0.0
|
||||
version: 18.0.0
|
||||
@ -4640,6 +4646,11 @@ packages:
|
||||
resolution: {integrity: sha512-1ugUSr8BHXRnK23KfuYS+gVMC3LB8QGH9W1iGtDPsNWoQbgtXSExkBu2aDR4epiGWZOjZsj6lDl/N/AqqTC3UA==}
|
||||
dev: true
|
||||
|
||||
/base64-arraybuffer@1.0.2:
|
||||
resolution: {integrity: sha512-I3yl4r9QB5ZRY3XuJVEPfc2XhZO6YweFPI+UovAzn+8/hb3oJ6lnysaFcjVpkCPfVWFUDvoZ8kmVDP7WyRtYtQ==}
|
||||
engines: {node: '>= 0.6.0'}
|
||||
dev: false
|
||||
|
||||
/base64-js@1.5.1:
|
||||
resolution: {integrity: sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==}
|
||||
|
||||
@ -5336,6 +5347,12 @@ packages:
|
||||
engines: {node: '>=12.22'}
|
||||
dev: true
|
||||
|
||||
/css-line-break@2.1.0:
|
||||
resolution: {integrity: sha512-FHcKFCZcAha3LwfVBhCQbW2nCNbkZXn7KVUJcsT5/P8YmfsVja0FMPJr0B903j/E69HUphKiV9iQArX8SDYA4w==}
|
||||
dependencies:
|
||||
utrie: 1.0.2
|
||||
dev: false
|
||||
|
||||
/css-loader@6.7.3(webpack@5.78.0):
|
||||
resolution: {integrity: sha512-qhOH1KlBMnZP8FzRO6YCH9UHXQhVMcEGLyNdb7Hv2cpcmJbW0YrddO+tG1ab5nT41KpHIYGsbeHqxB9xPu1pKQ==}
|
||||
engines: {node: '>= 12.13.0'}
|
||||
@ -7439,6 +7456,14 @@ packages:
|
||||
webpack: 5.78.0(@swc/core@1.3.42)
|
||||
dev: true
|
||||
|
||||
/html2canvas@1.4.1:
|
||||
resolution: {integrity: sha512-fPU6BHNpsyIhr8yyMpTLLxAbkaK8ArIBcmZIRiBLiDhjeqvXolaEmDGmELFuX9I4xDcaKKcJl+TKZLqruBbmWA==}
|
||||
engines: {node: '>=8.0.0'}
|
||||
dependencies:
|
||||
css-line-break: 2.1.0
|
||||
text-segmentation: 1.0.3
|
||||
dev: false
|
||||
|
||||
/htmlparser2@6.1.0:
|
||||
resolution: {integrity: sha512-gyyPk6rgonLFEDGoeRgQNaEUvdJ4ktTmmUh/h2t7s+M8oPpIPxgNACWa+6ESR57kXstwqPiCut0V8NRpcwgU7A==}
|
||||
dependencies:
|
||||
@ -8077,6 +8102,10 @@ packages:
|
||||
engines: {node: '>=10'}
|
||||
dev: true
|
||||
|
||||
/jr-qrcode@1.1.4:
|
||||
resolution: {integrity: sha512-041B7axC/tzKRFbCc4g5QCaPzga2IgyBGmUBkWQ+t4CMl83DBzFv9tq9XdJr7uIqe9X6zYZC7Cy5J9ttiBNxrw==}
|
||||
dev: false
|
||||
|
||||
/js-tokens@3.0.2:
|
||||
resolution: {integrity: sha512-RjTcuD4xjtthQkaWH7dFlH85L+QaVtSoOyGdZ3g6HFhS9dFNDfLyqgm2NFe2X6cQpeFmt0452FJjFG5UameExg==}
|
||||
dev: true
|
||||
@ -11405,6 +11434,12 @@ packages:
|
||||
commander: 2.20.3
|
||||
source-map-support: 0.5.21
|
||||
|
||||
/text-segmentation@1.0.3:
|
||||
resolution: {integrity: sha512-iOiPUo/BGnZ6+54OsWxZidGCsdU8YbE4PSpdPinp7DeMtUJNJBoJ/ouUSTJjHkh1KntHaltHl/gDs2FC4i5+Nw==}
|
||||
dependencies:
|
||||
utrie: 1.0.2
|
||||
dev: false
|
||||
|
||||
/text-table@0.2.0:
|
||||
resolution: {integrity: sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==}
|
||||
dev: true
|
||||
@ -11799,6 +11834,12 @@ packages:
|
||||
engines: {node: '>= 0.4.0'}
|
||||
dev: true
|
||||
|
||||
/utrie@1.0.2:
|
||||
resolution: {integrity: sha512-1MLa5ouZiOmQzUbjbu9VmjLzn1QLXBhwpUa7kdLUQK+KQ5KA9I1vk5U4YHe/X2Ch7PYnJfWuWT+VbuxbGwljhw==}
|
||||
dependencies:
|
||||
base64-arraybuffer: 1.0.2
|
||||
dev: false
|
||||
|
||||
/uuid@3.4.0:
|
||||
resolution: {integrity: sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==}
|
||||
deprecated: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.
|
||||
|
@ -2,7 +2,6 @@
|
||||
"miniprogramRoot": "dist/",
|
||||
"projectname": "mall",
|
||||
"description": "商城",
|
||||
"appid": "touristappid",
|
||||
"setting": {
|
||||
"urlCheck": true,
|
||||
"es6": false,
|
||||
@ -15,7 +14,8 @@
|
||||
"disablePlugins": [],
|
||||
"outputPath": ""
|
||||
},
|
||||
"condition": false
|
||||
"condition": false,
|
||||
"ignoreUploadUnusedFiles": true
|
||||
},
|
||||
"compileType": "miniprogram",
|
||||
"libVersion": "2.25.3",
|
||||
|
@ -25,6 +25,15 @@ export default defineAppConfig({
|
||||
'pages/scope/index',
|
||||
'pages/order/index',
|
||||
'pages/order-detail/index',
|
||||
'pages/setting/index',
|
||||
'pages/about-me/index',
|
||||
'pages/change-user/index',
|
||||
'pages/message/index',
|
||||
'pages/message-list/index',
|
||||
'pages/message-detail/index',
|
||||
'/pages/login-quick/index',
|
||||
'/pages/invite/index',
|
||||
'/pages/city-partant/index',
|
||||
],
|
||||
window: {
|
||||
backgroundTextStyle: 'light',
|
||||
@ -33,11 +42,5 @@ export default defineAppConfig({
|
||||
navigationBarTextStyle: 'black',
|
||||
navigationStyle: 'custom'
|
||||
},
|
||||
components: [
|
||||
'pages/index/index',
|
||||
'pages/login/index',
|
||||
'pages/register/index',
|
||||
'pages/forgot/index',
|
||||
'pages/goods-detail/index',
|
||||
]
|
||||
|
||||
})
|
||||
|
45
src/app.scss
@ -92,14 +92,26 @@
|
||||
margin-left: 30px;
|
||||
}
|
||||
|
||||
.ml12 {
|
||||
margin-left: 12px;
|
||||
}
|
||||
|
||||
.ml17 {
|
||||
margin-left: 17px;
|
||||
}
|
||||
|
||||
.mt6 {
|
||||
margin-top: 6px;
|
||||
}
|
||||
|
||||
.mt-8 {
|
||||
margin-top: 32px;
|
||||
}
|
||||
|
||||
.mt18 {
|
||||
margin-top: 18px;
|
||||
}
|
||||
|
||||
.mt20 {
|
||||
margin-top: 20px;
|
||||
}
|
||||
@ -112,6 +124,10 @@
|
||||
margin-top: 25px;
|
||||
}
|
||||
|
||||
.mt32 {
|
||||
margin-top: 32px;
|
||||
}
|
||||
|
||||
|
||||
.mt-58 {
|
||||
margin-top: 58px;
|
||||
@ -143,7 +159,7 @@
|
||||
|
||||
.next-icon {
|
||||
width: 6px;
|
||||
height: 10px;
|
||||
height: 12px;
|
||||
}
|
||||
|
||||
.bt-none {
|
||||
@ -203,4 +219,31 @@
|
||||
.flex-col {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.dialog-content {
|
||||
padding: 16px 24px;
|
||||
box-shadow: 0px 5px 10px 0px rgba(31, 35, 41, 0.1);
|
||||
border-radius: 8px;
|
||||
background: #FFFFFF;
|
||||
}
|
||||
|
||||
.nut-popup {
|
||||
background: none !important;
|
||||
}
|
||||
|
||||
.order-empty {
|
||||
width: 200px;
|
||||
height: 200px;
|
||||
margin-left: calc((375px - 200px)/2);
|
||||
margin-top: 100px;
|
||||
}
|
||||
|
||||
|
||||
.f12 {
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.f14 {
|
||||
font-size: 14px;
|
||||
}
|
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2.1 KiB |
BIN
src/assets/images/clock.png
Normal file
After Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 2.2 KiB |
BIN
src/assets/images/homeBg.png
Normal file
After Width: | Height: | Size: 59 KiB |
BIN
src/assets/images/inviteBg.png
Normal file
After Width: | Height: | Size: 10 KiB |
BIN
src/assets/images/ling.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 1.7 KiB |
BIN
src/assets/images/msg.png
Normal file
After Width: | Height: | Size: 1.0 KiB |
BIN
src/assets/images/qrcode.png
Normal file
After Width: | Height: | Size: 1.9 KiB |
BIN
src/assets/images/right.png
Normal file
After Width: | Height: | Size: 371 B |
BIN
src/assets/images/share.png
Normal file
After Width: | Height: | Size: 1.7 KiB |
BIN
src/assets/images/success.png
Normal file
After Width: | Height: | Size: 923 B |
Before Width: | Height: | Size: 2.7 KiB After Width: | Height: | Size: 2.3 KiB |
BIN
src/assets/images/teamIcon.png
Normal file
After Width: | Height: | Size: 9.5 KiB |
BIN
src/assets/images/tick.png
Normal file
After Width: | Height: | Size: 1.4 KiB |
BIN
src/assets/images/wechat.png
Normal file
After Width: | Height: | Size: 2.2 KiB |
6
src/config/config.js
Normal file
@ -0,0 +1,6 @@
|
||||
export default {
|
||||
api: "http://newstart-api.xbase.vip",
|
||||
debugApi: "http://newstart-api.xbase.vip",
|
||||
home: '',
|
||||
debug: false
|
||||
}
|
3
src/pages/about-me/index.config.js
Normal file
@ -0,0 +1,3 @@
|
||||
export default definePageConfig({
|
||||
navigationBarTitleText: '关于我们'
|
||||
})
|
56
src/pages/about-me/index.jsx
Normal file
@ -0,0 +1,56 @@
|
||||
import { Image, Text, View } from "@tarojs/components"
|
||||
import next from '@/images/next.png'
|
||||
import './index.scss'
|
||||
import Taro from "@tarojs/taro"
|
||||
import backNav from '@/images/backNav.png'
|
||||
import { useEffect, useState } from "react"
|
||||
import { configs } from "../../utils/api"
|
||||
|
||||
|
||||
const Login = () => {
|
||||
|
||||
|
||||
const [about, setAbout] = useState({})
|
||||
useEffect(() => {
|
||||
configs().then(rs => {
|
||||
if (!rs) return
|
||||
setAbout(rs.about)
|
||||
})
|
||||
}, [])
|
||||
|
||||
// 返回页面
|
||||
const backFn = () => {
|
||||
Taro.getCurrentPages().length > 0 && Taro.navigateBack()
|
||||
}
|
||||
|
||||
|
||||
const navAboutMe = () => {
|
||||
Taro.navigateTo({
|
||||
url: '/pages/about-me/index'
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
return <View className="about-frame h-screen text-base">
|
||||
<View className='addr-detail-title'>
|
||||
<Image src={backNav} className="square-35 absolute left-10 nav-icon" onClick={backFn} />
|
||||
关于我们
|
||||
</View>
|
||||
<View className="flex-center about-logo">
|
||||
<Image src={about.logo} className="about-img" />
|
||||
</View>
|
||||
<View className="about-container flex-col justify-center">
|
||||
<View className="about-item">
|
||||
<Text>客服邮箱</Text>
|
||||
<Text className="about-item-text">{about.email}</Text>
|
||||
</View>
|
||||
<View className="about-item">
|
||||
<Text>当前版本</Text>
|
||||
<Text className="about-item-text">{about.version}</Text>
|
||||
</View>
|
||||
</View>
|
||||
</View>
|
||||
}
|
||||
|
||||
|
||||
export default Login
|
42
src/pages/about-me/index.scss
Normal file
@ -0,0 +1,42 @@
|
||||
.about-frame {
|
||||
min-height: 100vh;
|
||||
height: auto;
|
||||
font-size: 14px;
|
||||
font-family: Source Han Sans CN-Bold, Source Han Sans CN;
|
||||
background-color: #FBFBFD;
|
||||
}
|
||||
|
||||
.about-container {
|
||||
width: 333px;
|
||||
box-sizing: border-box;
|
||||
padding: 0 40px;
|
||||
margin: 0 auto;
|
||||
margin-top: 18px;
|
||||
background: #FFFFFF;
|
||||
box-shadow: 4px 7px 9px 0px rgba(56, 63, 68, 0.03);
|
||||
border-radius: 10px 10px 10px 10px;
|
||||
opacity: 1;
|
||||
font-weight: 400;
|
||||
color: #181A20;
|
||||
height: 125px;
|
||||
|
||||
}
|
||||
|
||||
.about-item {
|
||||
font-weight: 400;
|
||||
color: #181A20;
|
||||
font-size: 15px;
|
||||
line-height: 28px;
|
||||
}
|
||||
|
||||
.about-item-text {
|
||||
font-weight: 400;
|
||||
color: rgba(0, 0, 0, 0.4);
|
||||
font-size: 14px;
|
||||
margin-left: 4px;
|
||||
}
|
||||
|
||||
.about-logo {
|
||||
margin-top: 40px;
|
||||
width: 100%;
|
||||
}
|
@ -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 <View className="login-frame bg-slate-50 h-screen text-base">
|
||||
<View className='addr-detail-title'>
|
||||
<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>
|
||||
<View className="form-item mt-22">
|
||||
<View className="form-label">银行卡号</View>
|
||||
<View className="form-label">银行名称</View>
|
||||
<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)
|
||||
}} />
|
||||
{
|
||||
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 className="form-item mt-22">
|
||||
<View className="form-label">银行名称</View>
|
||||
<View className="form-label">开户人名称</View>
|
||||
<View className="form-control relative">
|
||||
<Input className="form-input" type='text' placeholder="请输入银行名称" onInput={(v) => {
|
||||
setPwd(v.detail.value)
|
||||
<Input className="form-input" placeholder="请输入账户名" onInput={(v) => {
|
||||
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 className="change-phone-footer flex flex-col justify-center">
|
||||
<Button className="login-btn">保存</Button>
|
||||
<Button className="login-btn" onClick={submit}>保存</Button>
|
||||
|
||||
</View>
|
||||
</View>
|
||||
|
@ -11,6 +11,9 @@ import checked from '@/images/checked.png'
|
||||
import Taro from '@tarojs/taro';
|
||||
import { useRouter } from '@tarojs/taro';
|
||||
import { Button, Textarea, Address } from '@nutui/nutui-react-taro';
|
||||
import { cities, createAddress, getAddress, updateAddress } from '../../utils/api';
|
||||
import { useCallback } from 'react';
|
||||
import { backOrGo, closeLoading, errorNotice, loading, redirectTo } from '../../utils/utils';
|
||||
|
||||
|
||||
|
||||
@ -19,7 +22,7 @@ function Index() {
|
||||
const param = useRouter().params
|
||||
const [id] = useState(param.id)
|
||||
const [home] = useState(param.home)
|
||||
const [addrId, setAddrId] = useState(0)
|
||||
const [addrId, setAddrId] = useState([])
|
||||
const [isDefault, setIsDefault] = useState(false)
|
||||
const [user, setUser] = useState('')
|
||||
const [phone, setPhone] = useState('')
|
||||
@ -28,13 +31,8 @@ function Index() {
|
||||
|
||||
const [text, setText] = useState('请选择地址')
|
||||
const [normal, setNormal] = useState(false)
|
||||
const [province, setProvince] = useState([
|
||||
{ id: 1, name: '北京', title: 'B' },
|
||||
{ id: 2, name: '广西', title: 'G' },
|
||||
{ id: 3, name: '江西', title: 'J' },
|
||||
{ id: 4, name: '四川', title: 'S' },
|
||||
{ id: 5, name: '浙江', title: 'Z' },
|
||||
])
|
||||
const [cityList, setCityList] = useState([])
|
||||
const [province, setProvince] = useState([])
|
||||
|
||||
const [city, setCity] = useState([])
|
||||
|
||||
@ -46,27 +44,60 @@ function Index() {
|
||||
city,
|
||||
country,
|
||||
town,
|
||||
addressIdStr: '0_0_0_0',
|
||||
})
|
||||
|
||||
const onChange = (cal) => {
|
||||
useEffect(() => {
|
||||
cities().then(res => {
|
||||
if (!res) return
|
||||
setCityList(res.items)
|
||||
setProvince(res.items?.filter(item => item.deep == 0))
|
||||
})
|
||||
}, [])
|
||||
|
||||
useEffect(() => {
|
||||
if (!id) return
|
||||
getAddress().then(re => {
|
||||
if (!re) return
|
||||
const data = re.items.filter(item => item.id == id)
|
||||
if (data.length < 1) return
|
||||
const addr = data[0]
|
||||
console.log(addr)
|
||||
setAddrId([addr.province_id, addr.city_id, addr.county_id])
|
||||
setText(`${addr.province.name}${addr.city.name}${addr.county.name}`)
|
||||
setAddrInfo(addr.address)
|
||||
setUser(addr.recipient_name)
|
||||
setPhone(addr.recipient_phone)
|
||||
setAddress({ province: addr.province, city: addr.city, country: addr.county, town: [], addressIdStr: `${addr.province_id}_${addr.city_id}_${addr.county_id}_0` })
|
||||
if (addr.province_id && addr.city_id) {
|
||||
cities(addr.province_id).then(r => {
|
||||
setCity(r.items)
|
||||
})
|
||||
}
|
||||
if (addr.city_id && addr.county_id) {
|
||||
cities(addr.city_id).then(r => {
|
||||
console.log(r.items, addr, addrId)
|
||||
setCountry(r.items)
|
||||
})
|
||||
}
|
||||
})
|
||||
}, [id])
|
||||
|
||||
const onChange = async (cal) => {
|
||||
const re = await cities(cal.value.id)
|
||||
const d = re.items
|
||||
if (!d.length) {
|
||||
setNormal(false)
|
||||
return
|
||||
}
|
||||
setTimeout(() => {
|
||||
switch (cal.next) {
|
||||
case 'city':
|
||||
setCity([
|
||||
{ id: 7, name: '朝阳区', title: 'C' },
|
||||
{ id: 8, name: '崇文区', title: 'C' },
|
||||
{ id: 9, name: '昌平区', title: 'C' },
|
||||
{ id: 6, name: '石景山区', title: 'S' },
|
||||
{ id: 3, name: '八里庄街道', title: 'B' },
|
||||
{ id: 10, name: '北苑', title: 'B' },
|
||||
])
|
||||
|
||||
setCity(d)
|
||||
break;
|
||||
case 'country':
|
||||
setCountry([
|
||||
{ id: 3, name: '八里庄街道', title: 'B' },
|
||||
{ id: 9, name: '北苑', title: 'B' },
|
||||
{ id: 4, name: '常营乡', title: 'C' },
|
||||
])
|
||||
setCountry(d)
|
||||
break;
|
||||
default:
|
||||
setNormal(false)
|
||||
@ -74,35 +105,61 @@ function Index() {
|
||||
}, 200)
|
||||
}
|
||||
const close = (val) => {
|
||||
console.log(val, "Data")
|
||||
setNormal(false)
|
||||
|
||||
if (val.data && !!val.data.addressStr) {
|
||||
setText((val.data).addressStr)
|
||||
setAddress({ province: val.data.province, city: val.data.city, country: val.data.country, town: val.data.town })
|
||||
setAddress({ province: val.data.province, city: val.data.city, country: val.data.country, town: val.data.town, addressIdStr: val.data.addressIdStr })
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
useEffect(() => {
|
||||
|
||||
|
||||
}, [id])
|
||||
|
||||
|
||||
// 跳转
|
||||
const navDetailFn = (id) => {
|
||||
Taro.navigateTo({
|
||||
url: `/pages/pay-success/index?id=${id}`
|
||||
})
|
||||
}
|
||||
// 返回页面
|
||||
const backFn = () => {
|
||||
Taro.getCurrentPages().length > 0 && Taro.navigateBack()
|
||||
Taro.getCurrentPages().length > 0 && Taro.navigateBack({ delta: 1 })
|
||||
}
|
||||
|
||||
const submit = async () => {
|
||||
const addressId = address.addressIdStr.split('_')
|
||||
if (!phone || !user || !addrInfo || address.addressIdStr == '0_0_0_0') {
|
||||
errorNotice('请填写地址完整信息')
|
||||
return
|
||||
}
|
||||
|
||||
if (addrInfo.length < 6) {
|
||||
errorNotice('详细地址信息错误')
|
||||
return
|
||||
}
|
||||
|
||||
const data = {
|
||||
zipcode: '000000',
|
||||
recipient_phone: phone,
|
||||
recipient_name: user,
|
||||
address: addrInfo,
|
||||
province_id: Number(addressId[0]),
|
||||
city_id: Number(addressId[1]),
|
||||
county_id: Number(addressId[2]),
|
||||
is_default: isDefault
|
||||
}
|
||||
|
||||
if (id) {
|
||||
loading('地址编辑中...')
|
||||
const re = await updateAddress(id, data)
|
||||
closeLoading()
|
||||
if (re) {
|
||||
backOrGo('/pages/address/index')
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
loading('地址新增中...')
|
||||
const re = await createAddress(data)
|
||||
closeLoading()
|
||||
if (re) {
|
||||
backOrGo('/pages/address/index')
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<View className='addr-container'>
|
||||
<View className='addr-c-container'>
|
||||
<View className='addr-detail-title'>
|
||||
<Image src={backNav} className="square-35 absolute left-10 nav-icon" onClick={backFn} />
|
||||
{
|
||||
@ -111,36 +168,36 @@ function Index() {
|
||||
|
||||
</View>
|
||||
|
||||
<View className='addr-body' >
|
||||
<View className='addr-item'>
|
||||
<View className='addr-form'>
|
||||
<View className='addr-form-name'>收货人</View>
|
||||
<Input className='addr-form-input' placeholder='请输入收货人' value={user} onInput={(e) => {
|
||||
<View className='addr-c-body' >
|
||||
<View className='addr-c-item'>
|
||||
<View className='addr-c-form'>
|
||||
<View className='addr-c-form-name'>收货人</View>
|
||||
<Input className='addr-c-form-input' placeholder='请输入收货人' value={user} onInput={(e) => {
|
||||
setUser(e.detail.value)
|
||||
}} />
|
||||
</View>
|
||||
<View className='addr-form'>
|
||||
<View className='addr-form-name'>电话</View>
|
||||
<Input className='addr-form-input' placeholder='请输入收货人' value={phone} onInput={(e) => {
|
||||
<View className='addr-c-form'>
|
||||
<View className='addr-c-form-name'>电话</View>
|
||||
<Input className='addr-c-form-input' placeholder='请输入收货电话' value={phone} onInput={(e) => {
|
||||
setPhone(e.detail.value)
|
||||
}} />
|
||||
</View>
|
||||
<View className='addr-form'>
|
||||
<View className='addr-form-name'>所在地区</View>
|
||||
<View className='flex justify-between items-center addr-form-input' onClick={() => { setNormal(true) }}>
|
||||
<View className='addr-c-form'>
|
||||
<View className='addr-c-form-name'>所在地区</View>
|
||||
<View className='flex justify-between items-center addr-c-form-input' onClick={() => { setNormal(true) }}>
|
||||
<Label>{text}</Label>
|
||||
<Image src={next} className='next-icon' />
|
||||
</View>
|
||||
</View>
|
||||
<View className='addr-form bt-none'>
|
||||
<View className='addr-form-name '>详细地址</View>
|
||||
<View className='addr-c-form bt-none'>
|
||||
<View className='addr-c-form-name '>详细地址</View>
|
||||
</View>
|
||||
<Textarea placeholder='请输入详细地址' autosize rows="4" maxlength={100} defaultValue={addrInfo} onChange={(e) => {
|
||||
setAddrInfo(e)
|
||||
}} />
|
||||
</View>
|
||||
<View className=' mt-22 addr-item'>
|
||||
<View className='addr-form bt-none' onClick={() => {
|
||||
<View className=' mt-22 addr-c-item'>
|
||||
<View className='addr-c-form bt-none' onClick={() => {
|
||||
setIsDefault(x => !x)
|
||||
}}>
|
||||
<View className='text-black'>设为默认地址</View>
|
||||
@ -148,14 +205,14 @@ function Index() {
|
||||
</View>
|
||||
</View>
|
||||
</View>
|
||||
<Button className='addr-btn' >保存地址</Button>
|
||||
<Button className='addr-c-btn' onClick={submit} >保存地址</Button>
|
||||
|
||||
<Address
|
||||
modelValue={normal}
|
||||
modelSelect={addrId}
|
||||
province={province}
|
||||
city={city}
|
||||
country={country}
|
||||
town={town}
|
||||
customAddressTitle="请选择所在地区"
|
||||
onChange={onChange}
|
||||
onClose={close}
|
||||
|
@ -1,4 +1,4 @@
|
||||
.addr-container {
|
||||
.addr-c-container {
|
||||
font-family: Source Han Sans CN-Bold, Source Han Sans CN;
|
||||
font-size: 14px;
|
||||
background: #FBFBFD;
|
||||
@ -11,7 +11,7 @@
|
||||
border-radius: 16px 16px 16px 16px;
|
||||
}
|
||||
|
||||
.addr-detail-title {
|
||||
.addr-c-detail-title {
|
||||
width: 100vw;
|
||||
height: 60px;
|
||||
font-size: 18px;
|
||||
@ -24,7 +24,7 @@
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.addr-body {
|
||||
.addr-c-body {
|
||||
padding: 21px;
|
||||
height: auto;
|
||||
box-sizing: border-box;
|
||||
@ -34,7 +34,7 @@
|
||||
align-content: center;
|
||||
}
|
||||
|
||||
.addr-box {
|
||||
.addr-c-box {
|
||||
width: 333px;
|
||||
background: #FFFFFF;
|
||||
box-shadow: 4px 7px 9px 0px rgba(56, 63, 68, 0.03);
|
||||
@ -43,7 +43,7 @@
|
||||
padding: 0 12px;
|
||||
}
|
||||
|
||||
.addr-item {
|
||||
.addr-c-item {
|
||||
width: 333px;
|
||||
background: #FFFFFF;
|
||||
box-shadow: 4px 7px 9px 0px rgba(56, 63, 68, 0.03);
|
||||
@ -60,7 +60,7 @@
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.addr-form {
|
||||
.addr-c-form {
|
||||
width: 308px;
|
||||
box-sizing: border-box;
|
||||
height: 48px;
|
||||
@ -73,18 +73,18 @@
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.addr-form-name {
|
||||
.addr-c-form-name {
|
||||
font-weight: bold;
|
||||
color: #000000;
|
||||
font-size: 15px;
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
.addr-form-input {
|
||||
.addr-c-form-input {
|
||||
width: 230px;
|
||||
}
|
||||
|
||||
.addr-btn {
|
||||
.addr-c-btn {
|
||||
width: 233px;
|
||||
height: 55px;
|
||||
border-radius: 107px 107px 107px 107px;
|
||||
@ -98,12 +98,21 @@
|
||||
left: calc((100vw - 233px)/2);
|
||||
}
|
||||
|
||||
.addr-item>.nut-textarea {
|
||||
.addr-c-item>.nut-textarea {
|
||||
padding-left: 0;
|
||||
padding-right: 0;
|
||||
}
|
||||
|
||||
.addr-item .weui-input {
|
||||
.addr-c-item .weui-input {
|
||||
color: var(--nutui-textarea-text-color, var(--nutui-gray-1, #1a1a1a));
|
||||
|
||||
}
|
||||
|
||||
.addr-c-container .nut-popup {
|
||||
background-color: #FFFFFF !important;
|
||||
}
|
||||
|
||||
.addr-c-container textarea:-internal-autofill-selected,
|
||||
.addr-c-container input:-internal-autofill-selected {
|
||||
background-color: none !important;
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
import React from 'react'
|
||||
import { Image, Text, View } from '@tarojs/components'
|
||||
import { Image, Text, View, Button } from '@tarojs/components'
|
||||
import './index.scss'
|
||||
|
||||
import { useEffect } from 'react';
|
||||
@ -11,7 +11,10 @@ import checked from '@/images/checked.png'
|
||||
import edit from '@/images/edit.png'
|
||||
import Taro from '@tarojs/taro';
|
||||
import { useRouter } from '@tarojs/taro';
|
||||
import { Button } from '@nutui/nutui-react-taro';
|
||||
import { deleteAddress, getAddress } from '../../utils/api';
|
||||
import { backTo, closeLoading, loading, redirectTo, successNotice } from '../../utils/utils';
|
||||
import { SetData } from '../../utils/storage';
|
||||
import { useDidShow } from '@tarojs/taro';
|
||||
|
||||
|
||||
|
||||
@ -20,11 +23,21 @@ function Index() {
|
||||
const param = useRouter().params
|
||||
const [id] = useState(param.id)
|
||||
const [home] = useState(param.home)
|
||||
const [gid] = useState(param.gid)
|
||||
const [addrId, setAddrId] = useState(0)
|
||||
const [list, setList] = useState([])
|
||||
const [ref, setRef] = useState(0)
|
||||
|
||||
|
||||
useEffect(() => {
|
||||
}, [id])
|
||||
getAddress().then(re => {
|
||||
if (!re) return
|
||||
setList(re.items)
|
||||
})
|
||||
if (!!id) {
|
||||
setAddrId(id)
|
||||
}
|
||||
}, [id, ref])
|
||||
|
||||
|
||||
// 跳转
|
||||
@ -33,6 +46,26 @@ function Index() {
|
||||
url: `/pages/address-create/index?id=${id}`
|
||||
})
|
||||
}
|
||||
|
||||
const onSelect = (aid) => {
|
||||
if (!!gid && !!aid) {
|
||||
// redirectTo(`/pages/settle/index?id=${gid}&aid=${aid}`)
|
||||
SetData(gid, aid, 5)
|
||||
backTo()
|
||||
}
|
||||
}
|
||||
|
||||
// 删除
|
||||
const deleteAddr = async (id) => {
|
||||
if (!id) return
|
||||
loading('正在删除中')
|
||||
const re = await deleteAddress(id).finally(() => {
|
||||
closeLoading()
|
||||
})
|
||||
successNotice('删除成功')
|
||||
setRef(d => d + 1)
|
||||
}
|
||||
|
||||
// 返回页面
|
||||
const backFn = () => {
|
||||
Taro.getCurrentPages().length > 0 && Taro.navigateBack()
|
||||
@ -49,30 +82,37 @@ function Index() {
|
||||
</View>
|
||||
|
||||
<View className='addr-body' >
|
||||
<View className='addr-item'>
|
||||
<View className='addr-icon w-6 h-6' onClick={() => {
|
||||
setAddrId(1)
|
||||
}}>
|
||||
<Image src={addrId == 1 ? checked : uncheck} className="w-6 h-6" />
|
||||
</View>
|
||||
<View className='addr-item-content' onClick={() => {
|
||||
setAddrId(1)
|
||||
}}>
|
||||
<View className='addr-item-title'>
|
||||
<View className='addr-item-name'>李四 18080093730</View>
|
||||
<View className='addr-default'>默认地址</View>
|
||||
{
|
||||
list.map((item, index) => {
|
||||
return <View className='addr-item' key={item.id}>
|
||||
{
|
||||
!home && <View className='addr-icon w-6 h-6' onClick={() => {
|
||||
setAddrId(item.id)
|
||||
}}>
|
||||
<Image src={addrId == item.id ? checked : uncheck} className="w-6 h-6" />
|
||||
</View>
|
||||
}
|
||||
<View className='addr-item-content' onClick={() => {
|
||||
setAddrId(item.id)
|
||||
onSelect(item.id)
|
||||
}}>
|
||||
<View className='addr-item-title'>
|
||||
<View className='addr-item-name'>{item.recipient_name} {item.recipient_phone}</View>
|
||||
{item.id_default && <View className='addr-default'>默认地址</View>}
|
||||
</View>
|
||||
<View className='addr-item-info'>{item.province?.name}{item.city?.name}{item.county?.name}{item.address}</View>
|
||||
</View>
|
||||
<View className='addr-edit-icon' onClick={() => {
|
||||
navDetailFn(item.id)
|
||||
}}>
|
||||
<Image src={edit} />
|
||||
</View>
|
||||
</View>
|
||||
<View className='addr-item-info'>四川省成都市天府二街</View>
|
||||
</View>
|
||||
<View className='addr-edit-icon' onClick={() => {
|
||||
navDetailFn('')
|
||||
}}>
|
||||
<Image src={edit} />
|
||||
</View>
|
||||
</View>
|
||||
})
|
||||
}
|
||||
|
||||
</View>
|
||||
<Button className='addr-btn' onClick={() => {
|
||||
<Button className='addr-btn flex-center border-none' onClick={() => {
|
||||
navDetailFn('')
|
||||
}}>新增地址</Button>
|
||||
</View>
|
||||
|
@ -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 <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="flex-between mt-22">
|
||||
<Text>当前余额</Text>
|
||||
<Text className="balance-amount-price">50000</Text>
|
||||
<Text className="balance-amount-price">{user.score}</Text>
|
||||
</View>
|
||||
<View className="flex-around mt-22">
|
||||
<View className="balance-btn flex-center" onClick={() => {
|
||||
@ -51,40 +81,41 @@ const Login = () => {
|
||||
</View>
|
||||
|
||||
<View className="amount-container">
|
||||
<View className="amount-tabs flex-around">
|
||||
<View className={'tab-pane ' + (tabKey == '0' ? 'tab-pane-active' : '')} onClick={() => setTabKey('0')}>余额流水</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="amount-tabs flex-start">
|
||||
<View className={'tab-pane ' + (tabKey == '0' ? 'tab-pane-active' : '')} onClick={() => switchTab('0')}>余额流水</View>
|
||||
{/* <View className={'tab-pane ' + (tabKey == '1' ? 'tab-pane-active' : '')} onClick={() => switchTab('1')}>充值记录</View> */}
|
||||
{/* <View className={'tab-pane ' + (tabKey == '2' ? 'tab-pane-active' : '')} onClick={() => switchTab('2')}>提现记录</View> */}
|
||||
</View>
|
||||
<View className="balanceScroll" id="balanceScroll">
|
||||
<Infiniteloading
|
||||
containerId="balanceScroll"
|
||||
useWindow={false}
|
||||
loadTxt="loading"
|
||||
loadMoreTxt="没有数据啦~"
|
||||
loadIcon='loading'
|
||||
hasMore={false}
|
||||
onLoadMore={(x) => {
|
||||
setPage(p => p + 1)
|
||||
x()
|
||||
}}
|
||||
>
|
||||
<View className="amount-item flex-between">
|
||||
<View className="amount-item-detail flex-col">
|
||||
<View>完成每日登陆</View>
|
||||
<View className="amount-item-time">2021/04/09 19:42:36</View>
|
||||
</View>
|
||||
<View className="amount-item-log">+1.00</View>
|
||||
</View>
|
||||
|
||||
<View className="amount-item flex-between">
|
||||
<View className="amount-item-detail flex-col">
|
||||
<View>完成每日登陆</View>
|
||||
<View className="amount-item-time">2021/04/09 19:42:36</View>
|
||||
</View>
|
||||
<View className="amount-item-log">+1.00</View>
|
||||
</View>
|
||||
</Infiniteloading>
|
||||
{
|
||||
!!list.length && <Infiniteloading
|
||||
containerId="balanceScroll"
|
||||
useWindow={false}
|
||||
loadTxt="loading"
|
||||
loadMoreTxt="没有数据啦~"
|
||||
loadIcon='loading'
|
||||
hasMore={total >= list.length}
|
||||
onLoadMore={(x) => {
|
||||
setPage(p => p + 1)
|
||||
x()
|
||||
}}
|
||||
>
|
||||
{
|
||||
list.map(item => {
|
||||
return <View className="amount-item flex-between" key={item.id}>
|
||||
<View className="amount-item-detail flex-col">
|
||||
<View>{item.memo}</View>
|
||||
<View className="amount-item-time">{formatDateByStr(item.created_at)}</View>
|
||||
</View>
|
||||
<View className="amount-item-log">{item.amount > 0 ? `+${item.amount}` : `${item.amount}`}</View>
|
||||
</View>
|
||||
})
|
||||
}
|
||||
</Infiniteloading>
|
||||
}
|
||||
{
|
||||
!list.length && <Image src={empty} className="order-empty" />
|
||||
}
|
||||
</View>
|
||||
</View>
|
||||
|
||||
|
@ -9,6 +9,9 @@ import { useState } from "react"
|
||||
import Taro from "@tarojs/taro"
|
||||
import backNav from '@/images/backNav.png'
|
||||
import { Picker } from "@nutui/nutui-react-taro"
|
||||
import { cardList, scoreWithdraw, userDetail } from "../../utils/api"
|
||||
import { useEffect } from "react"
|
||||
import { closeLoading, errorNotice, loading, successNotice } from "../../utils/utils"
|
||||
|
||||
const activeEye = eye
|
||||
|
||||
@ -18,8 +21,23 @@ const Login = () => {
|
||||
|
||||
const [visible, setVisible] = useState(false)
|
||||
const [bank, setBank] = useState({ value: 0, text: '' })
|
||||
const [pwd, setPwd] = useState('')
|
||||
|
||||
const [user, setUser] = useState({})
|
||||
const [card, setCard] = useState([])
|
||||
const [bankList, setBankList] = useState([])
|
||||
|
||||
useEffect(() => {
|
||||
userDetail().then(rs => {
|
||||
if (!rs) return
|
||||
setUser(rs)
|
||||
})
|
||||
cardList().then(rs => {
|
||||
if (!rs) return
|
||||
setCard(rs.items)
|
||||
setBankList([rs.items.map(item => ({ value: item.id, text: `${item.bank_name} ${item.account_number}` }))])
|
||||
})
|
||||
}, [])
|
||||
|
||||
// 返回页面
|
||||
const backFn = () => {
|
||||
@ -29,39 +47,55 @@ const Login = () => {
|
||||
|
||||
const confirmPicker = (val, list) => {
|
||||
list.forEach(item => {
|
||||
console.log(item, "C")
|
||||
setBank(item)
|
||||
})
|
||||
}
|
||||
|
||||
const listData1 = [
|
||||
[
|
||||
{ value: 1, text: '南京市', },
|
||||
{ value: 2, text: '无锡市', },
|
||||
{ value: 3, text: '海北藏族自治区', },
|
||||
{ value: 4, text: '北京市', },
|
||||
{ value: 5, text: '连云港市', },
|
||||
{ value: 6, text: '浙江市', },
|
||||
{ value: 7, text: '江苏市', },
|
||||
{ value: 8, text: '大庆市', },
|
||||
{ value: 9, text: '绥化市', },
|
||||
{ value: 10, text: '潍坊市', },
|
||||
{ value: 11, text: '请按市', },
|
||||
{ value: 12, text: '乌鲁木齐市' },
|
||||
],
|
||||
]
|
||||
const submit = async () => {
|
||||
if (!account) {
|
||||
errorNotice("请输入转换金额")
|
||||
return
|
||||
}
|
||||
if (!bank) {
|
||||
errorNotice("请选择提现银行卡")
|
||||
return
|
||||
}
|
||||
if (!pwd) {
|
||||
errorNotice('请输入支付密码')
|
||||
return
|
||||
}
|
||||
if (user.score < 1) {
|
||||
errorNotice("余额不足")
|
||||
return
|
||||
}
|
||||
loading('提现申请中...')
|
||||
const data = card.filter(it => it.id == bank.value)
|
||||
const re = await scoreWithdraw({
|
||||
"account_name": data[0].account_name,
|
||||
"account_number": data[0].account_number,
|
||||
"amount": account,
|
||||
"bank_branch": data[0].bank_branch,
|
||||
"bank_name": data[0].bank_name,
|
||||
"password": pwd
|
||||
})
|
||||
closeLoading()
|
||||
if (!re) return
|
||||
successNotice('提现成功')
|
||||
setTimeout(() => {
|
||||
backFn()
|
||||
}, 1000)
|
||||
}
|
||||
|
||||
|
||||
return <View className="cash-frame bg-slate-50 h-screen text-base">
|
||||
<View className='addr-detail-title'>
|
||||
<Image src={backNav} className="square-35 absolute left-10 nav-icon" onClick={backFn} />
|
||||
立即提现
|
||||
|
||||
</View>
|
||||
<View className="cash-container relative">
|
||||
<View className="cash-amount flex-col justify-center">
|
||||
<Text>当前余额</Text>
|
||||
<Text className="cash-amount-price">50000</Text>
|
||||
<Text className="cash-amount-price">{user.score}</Text>
|
||||
</View>
|
||||
<View>
|
||||
<View className="form-item mt-22">
|
||||
@ -80,13 +114,27 @@ const Login = () => {
|
||||
<View className="form-label">银行卡</View>
|
||||
<View className="form-control relative">
|
||||
<Input className="form-input" disabled placeholder="选择提现银行卡" value={bank.text} />
|
||||
<Button className="code-btn" onClick={() => { setVisible(true) }}>选择银行卡</Button>
|
||||
<Button className="code-btn" onClick={() => {
|
||||
if (bankList.length < 1) {
|
||||
errorNotice('请先添加银行卡')
|
||||
return
|
||||
}
|
||||
setVisible(true)
|
||||
}}>选择银行卡</Button>
|
||||
</View>
|
||||
</View>
|
||||
<View className="form-item mt-22">
|
||||
<View className="form-label">支付密码</View>
|
||||
<View className="form-control relative">
|
||||
<Input className="form-input" type={'password'} placeholder="请输入支付密码" onInput={(v) => {
|
||||
setPwd(v.detail.value)
|
||||
}} />
|
||||
</View>
|
||||
</View>
|
||||
{
|
||||
account && !!bank.value &&
|
||||
<View className="cash-footer ">
|
||||
<Button className="cash-btn">立即提现</Button>
|
||||
<Button className="cash-btn" onClick={submit}>立即提现</Button>
|
||||
</View>
|
||||
}
|
||||
</View>
|
||||
@ -94,7 +142,7 @@ const Login = () => {
|
||||
</View>
|
||||
<Picker
|
||||
isVisible={visible}
|
||||
listData={listData1}
|
||||
listData={bankList}
|
||||
onConfirm={(values, list) => confirmPicker(values, list)}
|
||||
onClose={() => setVisible(false)}
|
||||
|
||||
|
@ -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 <View className="login-frame bg-slate-50 h-screen text-base">
|
||||
<View className='addr-detail-title'>
|
||||
<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>
|
||||
<View className="form-item mt-22">
|
||||
<View className="form-label">验证原手机号</View>
|
||||
<View className="form-label">密码</View>
|
||||
<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)
|
||||
}} />
|
||||
{
|
||||
account && <Image className="w-6 h-6 absolute right-0 bottom-16" src={checked} />
|
||||
}
|
||||
|
||||
</View>
|
||||
</View>
|
||||
<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>
|
||||
</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">
|
||||
<Button className="login-btn">保存</Button>
|
||||
<Button className="login-btn" onClick={submit}>保存</Button>
|
||||
|
||||
</View>
|
||||
</View>
|
||||
|
@ -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 <View className="login-frame bg-slate-50 h-screen text-base">
|
||||
<View className='addr-detail-title'>
|
||||
<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>
|
||||
<View className="form-item mt-22">
|
||||
<View className="form-label">账号</View>
|
||||
<View className="form-label">手机号</View>
|
||||
<View className="form-control relative">
|
||||
<Input className="form-input" placeholder="请输入手机号" onInput={(v) => {
|
||||
setAccount(v.detail.value)
|
||||
@ -109,18 +115,18 @@ const Login = () => {
|
||||
</View>
|
||||
</View>
|
||||
<View className="form-item mt-22">
|
||||
<View className="form-label">密码</View>
|
||||
<View className="form-label">确认密码</View>
|
||||
<View className="form-control relative">
|
||||
<Input className="form-input" type={showPwd ? 'text' : 'password'} placeholder="再次确认新密码" onInput={(v) => {
|
||||
setPwd(v.detail.value)
|
||||
<Input className="form-input" type={showConfirmPwd ? 'text' : 'password'} placeholder="再次确认新密码" onInput={(v) => {
|
||||
setConfirmPwd(v.detail.value)
|
||||
}} />
|
||||
<Image className="w-6 h-6 absolute right-0 bottom-16" src={showPwd ? activeEye : eyeClose} onClick={() => {
|
||||
setShowPwd(v => !v)
|
||||
<Image className="w-6 h-6 absolute right-0 bottom-16" src={showConfirmPwd ? activeEye : eyeClose} onClick={() => {
|
||||
setShowConfirmPwd(v => !v)
|
||||
}} />
|
||||
</View>
|
||||
</View>
|
||||
<View className="change-pwd-footer flex flex-col justify-center">
|
||||
<Button className="login-btn">保存</Button>
|
||||
<Button className="login-btn" onClick={submit}>保存</Button>
|
||||
|
||||
</View>
|
||||
</View>
|
||||
|
3
src/pages/change-user/index.config.js
Normal file
@ -0,0 +1,3 @@
|
||||
export default definePageConfig({
|
||||
navigationBarTitleText: '个人信息'
|
||||
})
|
97
src/pages/change-user/index.jsx
Normal file
@ -0,0 +1,97 @@
|
||||
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 eye from '@/images/eye.png'
|
||||
import './index.scss'
|
||||
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 { modifyUser, userDetail } from "../../utils/api"
|
||||
import { useEffect } from "react"
|
||||
|
||||
const activeEye = eye
|
||||
|
||||
const uinfo = () => {
|
||||
|
||||
const [account, setAccount] = useState('')
|
||||
const [user, setUser] = useState({})
|
||||
|
||||
|
||||
useEffect(() => {
|
||||
userDetail().then(rs => {
|
||||
if (!rs) return
|
||||
setUser(rs)
|
||||
setAccount(rs.nick_name)
|
||||
})
|
||||
|
||||
}, [])
|
||||
|
||||
|
||||
// 返回页面
|
||||
const backFn = () => {
|
||||
Taro.getCurrentPages().length > 0 && Taro.navigateBack()
|
||||
}
|
||||
|
||||
const submit = async () => {
|
||||
if (!account) {
|
||||
errorNotice("请输入要修改的昵称")
|
||||
return
|
||||
}
|
||||
loading('昵称修改中...')
|
||||
const re = await modifyUser('nick_name', account)
|
||||
closeLoading()
|
||||
if (!re) return
|
||||
successNotice('昵称修改成功')
|
||||
setTimeout(() => {
|
||||
backFn()
|
||||
}, 1000)
|
||||
}
|
||||
|
||||
|
||||
return <View className="uinfo-frame bg-slate-50 h-screen text-base">
|
||||
<View className='addr-detail-title'>
|
||||
<Image src={backNav} className="square-35 absolute left-10 nav-icon" onClick={backFn} />
|
||||
个人信息
|
||||
|
||||
</View>
|
||||
<View className="uinfo-container bg-slate-50 relative">
|
||||
<View>
|
||||
{/* <View className="form-item mt-22">
|
||||
<View className="form-label">用户名</View>
|
||||
<View className="form-control relative">
|
||||
<Input className="form-input" placeholder="请输入用户名" onInput={(v) => {
|
||||
setAccount(v.detail.value)
|
||||
}} />
|
||||
{
|
||||
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" type='text' placeholder="请输入昵称" value={account} onInput={(v) => {
|
||||
setAccount(v.detail.value)
|
||||
}} />
|
||||
{
|
||||
account && <Image className="w-6 h-6 absolute right-0 bottom-16" src={checked} />
|
||||
}
|
||||
</View>
|
||||
</View>
|
||||
<View className="uinfo-footer flex flex-col justify-center">
|
||||
<Button className="uinfo-btn" onClick={submit}>保存</Button>
|
||||
|
||||
</View>
|
||||
</View>
|
||||
|
||||
</View>
|
||||
|
||||
</View>
|
||||
}
|
||||
|
||||
|
||||
export default uinfo
|
116
src/pages/change-user/index.scss
Normal file
@ -0,0 +1,116 @@
|
||||
.uinfo-header {
|
||||
height: 86px;
|
||||
}
|
||||
|
||||
.uinfo-frame {
|
||||
height: auto;
|
||||
font-size: 14px;
|
||||
font-family: Source Han Sans CN-Bold, Source Han Sans CN;
|
||||
}
|
||||
|
||||
.uinfo-container {
|
||||
width: 375px;
|
||||
height: calc(100vh - 86px);
|
||||
border-radius: 20px 20px 0 0;
|
||||
box-shadow: 0px 8px 51px 0px rgba(230, 234, 238, 0.8);
|
||||
box-sizing: border-box;
|
||||
padding: 20px 30px;
|
||||
}
|
||||
|
||||
.form-item {
|
||||
height: 68px;
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.form-label {
|
||||
font-size: 12px;
|
||||
font-weight: bold;
|
||||
font-family: Source Han Sans CN-Bold, Source Han Sans CN;
|
||||
color: #2a2b2d;
|
||||
line-height: 16px;
|
||||
}
|
||||
|
||||
.form-input>.weui-input {
|
||||
border: none;
|
||||
height: 52px;
|
||||
line-height: 52px;
|
||||
border-bottom: 1px solid #262A34;
|
||||
position: relative;
|
||||
font-size: 16px;
|
||||
color: #000;
|
||||
}
|
||||
|
||||
.form-input>.weui-input:focus {
|
||||
border-bottom: 2px solid #F67952;
|
||||
}
|
||||
|
||||
.form-input-placeholder,
|
||||
.form-input>.weui-input::placeholder {
|
||||
font-size: 16px;
|
||||
font-family: Source Han Sans CN-Regular, Source Han Sans CN;
|
||||
font-weight: bold;
|
||||
color: #aeafb4;
|
||||
}
|
||||
|
||||
.form-control {
|
||||
height: 52px;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.forgot-password {
|
||||
height: 24px;
|
||||
font-size: 16px;
|
||||
font-family: Source Han Sans CN-Regular, Source Han Sans CN;
|
||||
font-weight: 400;
|
||||
color: #666;
|
||||
line-height: 24px;
|
||||
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
|
||||
.uinfo-btn {
|
||||
width: 253px;
|
||||
height: 55px;
|
||||
background: #F67952;
|
||||
border-radius: 68px 68px 68px 68px;
|
||||
opacity: 1;
|
||||
border: none;
|
||||
color: white;
|
||||
font-size: 16px;
|
||||
font-family: Source Han Sans CN-Bold, Source Han Sans CN;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.uinfo-footer {
|
||||
margin-top: 150px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.quick-uinfo {
|
||||
font-size: 16px;
|
||||
font-family: Source Han Sans CN-Regular, Source Han Sans CN;
|
||||
font-weight: 400;
|
||||
color: #000000;
|
||||
line-height: 24px;
|
||||
margin-top: 30px;
|
||||
}
|
||||
|
||||
.code-btn {
|
||||
width: 83px;
|
||||
height: 30px;
|
||||
background: #F67952;
|
||||
border-radius: 4px 4px 4px 4px;
|
||||
opacity: 1;
|
||||
font-size: 12px;
|
||||
font-family: Source Han Sans CN-Bold, Source Han Sans CN;
|
||||
font-weight: bold;
|
||||
color: #FFFFFF;
|
||||
border: none;
|
||||
padding: 0;
|
||||
position: absolute;
|
||||
right: 0;
|
||||
bottom: 12px;
|
||||
}
|
3
src/pages/city-partant/index.config.js
Normal file
@ -0,0 +1,3 @@
|
||||
export default definePageConfig({
|
||||
navigationBarTitleText: '申请成为合伙人'
|
||||
})
|
236
src/pages/city-partant/index.jsx
Normal file
@ -0,0 +1,236 @@
|
||||
import { Image, Input, Label, Text, View } from "@tarojs/components"
|
||||
import back from '@/images/back.png'
|
||||
import checked from '@/images/checked.png'
|
||||
import next from '@/images/next.png'
|
||||
import eye from '@/images/eye.png'
|
||||
import './index.scss'
|
||||
import { Button } from "@nutui/nutui-react-taro"
|
||||
import { useState } from "react"
|
||||
import Taro from "@tarojs/taro"
|
||||
import backNav from '@/images/backNav.png'
|
||||
import { Picker } from "@nutui/nutui-react-taro"
|
||||
import { cardList, cities, partners, scoreWithdraw, userDetail } from "../../utils/api"
|
||||
import { useEffect } from "react"
|
||||
import { closeLoading, errorNotice, loading, successNotice } from "../../utils/utils"
|
||||
import { Address } from "@nutui/nutui-react-taro"
|
||||
|
||||
const activeEye = eye
|
||||
|
||||
const Login = () => {
|
||||
|
||||
const [account, setAccount] = useState('')
|
||||
const [mobile, setMobile] = useState('')
|
||||
|
||||
const [visible, setVisible] = useState(false)
|
||||
const [bank, setBank] = useState({ value: 0, text: '' })
|
||||
const [pwd, setPwd] = useState('')
|
||||
|
||||
const [user, setUser] = useState({})
|
||||
const [card, setCard] = useState([])
|
||||
const [bankList, setBankList] = useState([])
|
||||
const [text, setText] = useState('请选择地址')
|
||||
const [normal, setNormal] = useState(false)
|
||||
const [cityList, setCityList] = useState([])
|
||||
const [province, setProvince] = useState([])
|
||||
|
||||
const [city, setCity] = useState([])
|
||||
|
||||
const [country, setCountry] = useState([])
|
||||
const [address, setAddress] = useState({
|
||||
province,
|
||||
city,
|
||||
country,
|
||||
addressIdStr: '0_0_0_0',
|
||||
})
|
||||
|
||||
|
||||
const areaOptions = [
|
||||
[
|
||||
{
|
||||
value: 'city', text: '城市合伙人',
|
||||
},
|
||||
{ value: 'county', text: '区县合伙人' }
|
||||
]
|
||||
]
|
||||
|
||||
useEffect(() => {
|
||||
userDetail().then(rs => {
|
||||
if (!rs) return
|
||||
setUser(rs)
|
||||
})
|
||||
cardList().then(rs => {
|
||||
if (!rs) return
|
||||
setCard(rs.items)
|
||||
setBankList([rs.items.map(item => ({ value: item.id, text: `${item.bank_name} ${item.account_number}` }))])
|
||||
})
|
||||
|
||||
cities().then(res => {
|
||||
if (!res) return
|
||||
setCityList(res.items)
|
||||
setProvince(res.items?.filter(item => item.deep == 0))
|
||||
})
|
||||
}, [])
|
||||
|
||||
|
||||
// 返回页面
|
||||
const backFn = () => {
|
||||
Taro.getCurrentPages().length > 0 && Taro.navigateBack()
|
||||
}
|
||||
|
||||
|
||||
const confirmPicker = (val, list) => {
|
||||
list.forEach(item => {
|
||||
setBank(item)
|
||||
})
|
||||
}
|
||||
|
||||
const onChange = async (cal) => {
|
||||
const re = await cities(cal.value.id)
|
||||
const d = re.items
|
||||
if (!d.length) {
|
||||
setNormal(false)
|
||||
return
|
||||
}
|
||||
setTimeout(() => {
|
||||
switch (cal.next) {
|
||||
case 'city':
|
||||
setCity(d)
|
||||
break;
|
||||
case 'country':
|
||||
if (bank.value == 'city') {
|
||||
setNormal(false)
|
||||
}
|
||||
setCountry(d)
|
||||
break;
|
||||
default:
|
||||
setNormal(false)
|
||||
}
|
||||
}, 200)
|
||||
}
|
||||
|
||||
const close = (val) => {
|
||||
setNormal(false)
|
||||
if (val.data && !!val.data.addressStr) {
|
||||
setText((val.data).addressStr)
|
||||
setAddress({ province: val.data.province, city: val.data.city, country: val.data.country, addressIdStr: val.data.addressIdStr })
|
||||
}
|
||||
}
|
||||
|
||||
const submit = async () => {
|
||||
if (!account) {
|
||||
errorNotice("请输入姓名")
|
||||
return
|
||||
}
|
||||
if (!mobile) {
|
||||
errorNotice("请输入电话")
|
||||
return
|
||||
}
|
||||
if (!bank) {
|
||||
errorNotice("请选择合作区域类型")
|
||||
return
|
||||
}
|
||||
if (!address == '0_0_0_0') {
|
||||
errorNotice('请选择地址')
|
||||
return
|
||||
}
|
||||
const addressId = address.addressIdStr.split('_')
|
||||
loading('区域合伙人申请中...')
|
||||
const data = {
|
||||
province_id: Number(addressId[0]),
|
||||
city_id: Number(addressId[1]),
|
||||
county_id: Number(addressId[2]),
|
||||
level: bank.value,
|
||||
real_name: account,
|
||||
phone: mobile
|
||||
}
|
||||
const re = await partners(data)
|
||||
closeLoading()
|
||||
if (!re) return
|
||||
successNotice('申请成功')
|
||||
setTimeout(() => {
|
||||
backFn()
|
||||
}, 1000)
|
||||
}
|
||||
|
||||
|
||||
return <View className="city-partant-frame bg-slate-50 h-screen text-base">
|
||||
<View className='addr-detail-title'>
|
||||
<Image src={backNav} className="square-35 absolute left-10 nav-icon" onClick={backFn} />
|
||||
申请城市合伙人
|
||||
</View>
|
||||
<View className="city-partant-container relative">
|
||||
<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)
|
||||
}} />
|
||||
{
|
||||
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" type="text" placeholder="请输入电话" onInput={(v) => {
|
||||
setMobile(v.detail.value)
|
||||
}} />
|
||||
{
|
||||
mobile && <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" disabled placeholder="请选择申请区域" value={bank.text} />
|
||||
<Button className="code-btn" onClick={() => {
|
||||
setVisible(true)
|
||||
}}>选择申请区域</Button>
|
||||
</View>
|
||||
</View>
|
||||
{
|
||||
!!bank.value && <View className="form-item mt-22">
|
||||
<View className="form-label">区域城市</View>
|
||||
<View className="form-control relative" onClick={() => {
|
||||
setNormal(true)
|
||||
}}>
|
||||
<Input className="form-input" disabled placeholder="请选择申请区域城市" value={text} />
|
||||
<Image src={next} className='next-icon form-item-icon' />
|
||||
</View>
|
||||
</View>
|
||||
}
|
||||
{
|
||||
|
||||
<View className="city-partant-footer ">
|
||||
<Button className="city-partant-btn" onClick={submit}>立即申请</Button>
|
||||
</View>
|
||||
}
|
||||
</View>
|
||||
|
||||
</View>
|
||||
<Picker
|
||||
isVisible={visible}
|
||||
listData={areaOptions}
|
||||
onConfirm={(values, list) => confirmPicker(values, list)}
|
||||
onClose={() => setVisible(false)}
|
||||
|
||||
/>
|
||||
<Address
|
||||
modelValue={normal}
|
||||
province={province}
|
||||
city={city}
|
||||
country={country}
|
||||
customAddressTitle="请选择所在地区"
|
||||
onChange={onChange}
|
||||
onClose={close}
|
||||
/>
|
||||
</View>
|
||||
}
|
||||
|
||||
|
||||
export default Login
|
138
src/pages/city-partant/index.scss
Normal file
@ -0,0 +1,138 @@
|
||||
.city-partant-frame {
|
||||
height: 100vh;
|
||||
font-size: 14px;
|
||||
font-family: Source Han Sans CN-Bold, Source Han Sans CN;
|
||||
background-color: #FBFBFD;
|
||||
}
|
||||
|
||||
.city-partant-container {
|
||||
width: 375px;
|
||||
box-sizing: border-box;
|
||||
padding: 20px 20px;
|
||||
}
|
||||
|
||||
.form-item {
|
||||
height: 68px;
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.form-label {
|
||||
font-size: 12px;
|
||||
font-weight: bold;
|
||||
font-family: Source Han Sans CN-Bold, Source Han Sans CN;
|
||||
color: #2a2b2d;
|
||||
line-height: 16px;
|
||||
}
|
||||
|
||||
.form-input>.weui-input {
|
||||
border: none;
|
||||
height: 52px;
|
||||
line-height: 52px;
|
||||
border-bottom: 1px solid #262A34;
|
||||
position: relative;
|
||||
font-size: 16px;
|
||||
color: #000;
|
||||
}
|
||||
|
||||
.form-input>.weui-input:focus {
|
||||
border-bottom: 2px solid #F67952;
|
||||
}
|
||||
|
||||
.form-input-placeholder,
|
||||
.form-input>.weui-input::placeholder {
|
||||
font-size: 16px;
|
||||
font-family: Source Han Sans CN-Regular, Source Han Sans CN;
|
||||
font-weight: bold;
|
||||
color: #aeafb4;
|
||||
}
|
||||
|
||||
.form-control {
|
||||
height: 52px;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.forgot-password {
|
||||
height: 24px;
|
||||
font-size: 16px;
|
||||
font-family: Source Han Sans CN-Regular, Source Han Sans CN;
|
||||
font-weight: 400;
|
||||
color: #666;
|
||||
line-height: 24px;
|
||||
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
|
||||
.city-partant-btn {
|
||||
width: 253px;
|
||||
height: 55px;
|
||||
background: #F67952;
|
||||
border-radius: 68px 68px 68px 68px;
|
||||
opacity: 1;
|
||||
border: none;
|
||||
color: white;
|
||||
font-size: 16px;
|
||||
font-family: Source Han Sans CN-Bold, Source Han Sans CN;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.city-partant-footer {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
position: fixed;
|
||||
bottom: 100px;
|
||||
justify-content: center;
|
||||
width: 315px;
|
||||
}
|
||||
|
||||
|
||||
.code-btn {
|
||||
width: 83px;
|
||||
height: 30px;
|
||||
background: #F67952;
|
||||
border-radius: 4px 4px 4px 4px;
|
||||
opacity: 1;
|
||||
font-size: 12px;
|
||||
font-family: Source Han Sans CN-Bold, Source Han Sans CN;
|
||||
font-weight: bold;
|
||||
color: #FFFFFF;
|
||||
border: none;
|
||||
padding: 0;
|
||||
position: absolute;
|
||||
right: 0;
|
||||
bottom: 12px;
|
||||
}
|
||||
|
||||
.city-partant-amount {
|
||||
width: 332px;
|
||||
height: 120px;
|
||||
background: #F67952;
|
||||
border-radius: 16px 16px 16px 16px;
|
||||
opacity: 1;
|
||||
margin-bottom: 36px;
|
||||
color: #FFFFFF;
|
||||
font-size: 12px;
|
||||
box-sizing: border-box;
|
||||
padding-left: 23px;
|
||||
padding-bottom: 10px;
|
||||
}
|
||||
|
||||
.city-partant-container .form-label {
|
||||
color: #5E6272 !important;
|
||||
}
|
||||
|
||||
.city-partant-amount-price {
|
||||
font-size: 26px;
|
||||
font-weight: bold;
|
||||
margin-top: 8px;
|
||||
}
|
||||
|
||||
.form-item-icon {
|
||||
position: absolute;
|
||||
right: 0;
|
||||
top: 20px;
|
||||
}
|
||||
|
||||
.city-partant-frame .nut-popup {
|
||||
background-color: #FFFFFF !important;
|
||||
}
|
@ -9,48 +9,50 @@ import { useState } from "react"
|
||||
import Taro from "@tarojs/taro"
|
||||
import backNav from '@/images/backNav.png'
|
||||
import { Picker } from "@nutui/nutui-react-taro"
|
||||
import { profitToScore, userDetail } from "../../utils/api"
|
||||
import { useEffect } from "react"
|
||||
import { closeLoading, errorNotice, loading, successNotice } from "../../utils/utils"
|
||||
|
||||
const activeEye = eye
|
||||
|
||||
const Login = () => {
|
||||
|
||||
const [account, setAccount] = useState('')
|
||||
|
||||
const [user, setUser] = useState({})
|
||||
const [visible, setVisible] = useState(false)
|
||||
const [bank, setBank] = useState({ value: 0, text: '' })
|
||||
|
||||
|
||||
useEffect(() => {
|
||||
userDetail().then(rs => {
|
||||
if (!rs) return
|
||||
setUser(rs)
|
||||
})
|
||||
}, [])
|
||||
|
||||
// 返回页面
|
||||
const backFn = () => {
|
||||
Taro.getCurrentPages().length > 0 && Taro.navigateBack()
|
||||
}
|
||||
|
||||
|
||||
const confirmPicker = (val, list) => {
|
||||
list.forEach(item => {
|
||||
console.log(item, "C")
|
||||
setBank(item)
|
||||
})
|
||||
const submit = async () => {
|
||||
if (!account) {
|
||||
errorNotice("请输入转换金额")
|
||||
return
|
||||
}
|
||||
if (user.profit < 1) {
|
||||
errorNotice("余额不足")
|
||||
return
|
||||
}
|
||||
loading('转换中...')
|
||||
const re = await profitToScore(account)
|
||||
closeLoading()
|
||||
if (!re) return
|
||||
successNotice('余额转换成功')
|
||||
setTimeout(() => {
|
||||
backFn()
|
||||
}, 1000)
|
||||
}
|
||||
|
||||
const listData1 = [
|
||||
[
|
||||
{ value: 1, text: '南京市', },
|
||||
{ value: 2, text: '无锡市', },
|
||||
{ value: 3, text: '海北藏族自治区', },
|
||||
{ value: 4, text: '北京市', },
|
||||
{ value: 5, text: '连云港市', },
|
||||
{ value: 6, text: '浙江市', },
|
||||
{ value: 7, text: '江苏市', },
|
||||
{ value: 8, text: '大庆市', },
|
||||
{ value: 9, text: '绥化市', },
|
||||
{ value: 10, text: '潍坊市', },
|
||||
{ value: 11, text: '请按市', },
|
||||
{ value: 12, text: '乌鲁木齐市' },
|
||||
],
|
||||
]
|
||||
|
||||
|
||||
return <View className="conversion-frame bg-slate-50 h-screen text-base">
|
||||
<View className='addr-detail-title'>
|
||||
@ -60,7 +62,7 @@ const Login = () => {
|
||||
<View className="conversion-container relative">
|
||||
<View className="conversion-amount flex-col justify-center">
|
||||
<Text>当前收益</Text>
|
||||
<Text className="conversion-amount-price">50000</Text>
|
||||
<Text className="conversion-amount-price">{user.profit}</Text>
|
||||
</View>
|
||||
<View>
|
||||
<View className="form-item mt-22">
|
||||
@ -78,7 +80,7 @@ const Login = () => {
|
||||
{
|
||||
|
||||
<View className="conversion-footer ">
|
||||
<Button className="conversion-btn">立即转换</Button>
|
||||
<Button className="conversion-btn" onClick={submit}>立即转换</Button>
|
||||
</View>
|
||||
}
|
||||
</View>
|
||||
|
@ -7,6 +7,8 @@ import './index.scss'
|
||||
import { Button } from "@nutui/nutui-react-taro"
|
||||
import { useState } from "react"
|
||||
import Taro from "@tarojs/taro"
|
||||
import { pwdManage, sendCode } from "../../utils/api"
|
||||
import { closeLoading, errorNotice, loading, successNotice } from "../../utils/utils"
|
||||
|
||||
const activeEye = eye
|
||||
|
||||
@ -14,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('')
|
||||
@ -47,8 +50,8 @@ const Login = () => {
|
||||
}
|
||||
|
||||
// 倒计时
|
||||
const countDown = () => {
|
||||
if (!mobile) {
|
||||
const countDown = async () => {
|
||||
if (!account) {
|
||||
return
|
||||
}
|
||||
setIntervalTime(60)
|
||||
@ -65,6 +68,33 @@ const Login = () => {
|
||||
setIntervalTime(start)
|
||||
}
|
||||
}, 1000)
|
||||
const re = await sendCode(mobile)
|
||||
if (!re) return
|
||||
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">
|
||||
@ -76,7 +106,7 @@ const Login = () => {
|
||||
<View className="relative font-bold text-lg block h-6 ">忘记密码</View>
|
||||
<View>
|
||||
<View className="form-item mt-58">
|
||||
<View className="form-label">账号</View>
|
||||
<View className="form-label">手机号</View>
|
||||
<View className="form-control relative">
|
||||
<Input className="form-input" placeholder="请输入手机号" onInput={(v) => {
|
||||
setAccount(v.detail.value)
|
||||
@ -108,13 +138,13 @@ const Login = () => {
|
||||
</View>
|
||||
</View>
|
||||
<View className="form-item mt-22">
|
||||
<View className="form-label">密码</View>
|
||||
<View className="form-label">确认密码</View>
|
||||
<View className="form-control relative">
|
||||
<Input className="form-input" type={showPwd ? 'text' : 'password'} placeholder="再次确认新密码" onInput={(v) => {
|
||||
setPwd(v.detail.value)
|
||||
<Input className="form-input" type={showConfirmPwd ? 'text' : 'password'} placeholder="再次确认新密码" onInput={(v) => {
|
||||
setConfirmPwd(v.detail.value)
|
||||
}} />
|
||||
<Image className="w-6 h-6 absolute right-0 bottom-16" src={showPwd ? activeEye : eyeClose} onClick={() => {
|
||||
setShowPwd(v => !v)
|
||||
<Image className="w-6 h-6 absolute right-0 bottom-16" src={showConfirmPwd ? activeEye : eyeClose} onClick={() => {
|
||||
setShowConfirmPwd(v => !v)
|
||||
}} />
|
||||
</View>
|
||||
</View>
|
||||
@ -122,8 +152,7 @@ const Login = () => {
|
||||
<View className="forgot-password" onClick={loginFn}>已有账号,去登陆</View>
|
||||
</View>
|
||||
<View className="login-footer flex flex-col justify-center">
|
||||
<Button className="login-btn">找回密码</Button>
|
||||
|
||||
<Button className="login-btn" onClick={submit}>找回密码</Button>
|
||||
</View>
|
||||
</View>
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
import React from 'react'
|
||||
import { Image, Swiper, SwiperItem, Text, View } from '@tarojs/components'
|
||||
import { Image, Swiper, SwiperItem, Text, View, Button } from '@tarojs/components'
|
||||
// import { Swiper, SwiperItem } from '@nutui/nutui-react-taro';
|
||||
import './index.scss'
|
||||
import TabbarAction from '@/components/action';
|
||||
@ -10,7 +10,8 @@ import backNav from '@/images/backNav.png'
|
||||
import Taro from '@tarojs/taro';
|
||||
import { useRouter } from '@tarojs/taro';
|
||||
import { useDidShow } from '@tarojs/taro';
|
||||
import { Button } from '@nutui/nutui-react-taro';
|
||||
import { mallDetail } from '../../utils/api';
|
||||
import { ImagePreview } from '@nutui/nutui-react-taro';
|
||||
|
||||
|
||||
|
||||
@ -20,25 +21,37 @@ function Index() {
|
||||
const [id] = useState(param.id)
|
||||
|
||||
const [swiperProgress, setSwiperProgress] = useState(1)
|
||||
const list = [
|
||||
'https://storage.360buyimg.com/jdc-article/NutUItaro34.jpg',
|
||||
'https://storage.360buyimg.com/jdc-article/NutUItaro2.jpg',
|
||||
'https://storage.360buyimg.com/jdc-article/welcomenutui.jpg'
|
||||
]
|
||||
|
||||
useDidShow(() => {
|
||||
console.log(12)
|
||||
|
||||
})
|
||||
const [thumbnails, setThumbnails] = useState([])
|
||||
const [info, setInfo] = useState({})
|
||||
const [showReview, setShowReview] = useState(false)
|
||||
const [imageNum, setImageNum] = useState(1)
|
||||
|
||||
|
||||
|
||||
useEffect(() => {
|
||||
|
||||
if (!id) {
|
||||
return
|
||||
}
|
||||
detail(id)
|
||||
|
||||
}, [id])
|
||||
|
||||
|
||||
const detail = async () => {
|
||||
const re = await mallDetail(id)
|
||||
if (!re) return
|
||||
setInfo(re)
|
||||
if (re.thumbnails?.length) {
|
||||
let images = re.thumbnails
|
||||
if (!!re.cover_image) {
|
||||
images.shift(re.cover_image)
|
||||
}
|
||||
setThumbnails(images)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// 跳转
|
||||
@ -53,7 +66,7 @@ function Index() {
|
||||
}
|
||||
|
||||
return (
|
||||
<View className='home-container'>
|
||||
<View className='home-container' catchMove>
|
||||
<View className='goods-detail-title'>
|
||||
<Image src={backNav} className="square-35 absolute left-10 " onClick={backFn} />
|
||||
商品详情
|
||||
@ -75,7 +88,7 @@ function Index() {
|
||||
setSwiperProgress(x => x % 3 + 1)
|
||||
}}
|
||||
>
|
||||
{list.map((item) => {
|
||||
{thumbnails.map((item) => {
|
||||
return (
|
||||
<SwiperItem key={item} className='goods-swiper-item'>
|
||||
<Image src={item} alt="" />
|
||||
@ -84,27 +97,37 @@ function Index() {
|
||||
})}
|
||||
</Swiper>
|
||||
<View className='goods-swiper-progress'>
|
||||
<View style={{ backgroundColor: '#F67952', height: '100%', width: list.length ? ((swiperProgress / list.length) > 1 ? 1 : (swiperProgress / list.length)) * 100 + '%' : 0 }}></View>
|
||||
<View style={{ backgroundColor: '#F67952', height: '100%', width: thumbnails.length ? ((swiperProgress / thumbnails.length) > 1 ? 1 : (swiperProgress / thumbnails.length)) * 100 + '%' : 0 }}></View>
|
||||
</View>
|
||||
</View>
|
||||
<View className='goods-content'>
|
||||
<View className='line-clamp-2 goods-name'>
|
||||
银美孚1号 全合成油5w全合成油 5W-30 SN级 4L
|
||||
</View>
|
||||
<View className='goods-desc line-clamp-2'>
|
||||
<View>规格</View>
|
||||
{info.name}
|
||||
</View>
|
||||
{/* <View className='goods-desc line-clamp-2'>
|
||||
<View>规格</View>
|
||||
</View> */}
|
||||
<View className='goods-item-price'>
|
||||
<Text className='goods-item-price-sale'>¥199</Text>
|
||||
<Text className='goods-item-price-origin'>原价888</Text>
|
||||
<Text className='goods-item-price-sale'>¥{info.price}</Text>
|
||||
{/* <Text className='goods-item-price-origin'>原价888</Text> */}
|
||||
</View>
|
||||
|
||||
<View className='goods-content-box'>
|
||||
图文内容专区
|
||||
{
|
||||
info.content_images?.map((item, index) => {
|
||||
return (
|
||||
<Image src={item} alt="" key={item} style={{ width: '100%' }} onClick={() => {
|
||||
setImageNum(index + 1)
|
||||
// setShowReview(true)
|
||||
}} />
|
||||
)
|
||||
})
|
||||
}
|
||||
</View>
|
||||
</View>
|
||||
</View>
|
||||
<Button className='buy-btn' onClick={navDetailFn}>立即购买</Button>
|
||||
<Button className='buy-btn flex-center border-none' onClick={navDetailFn}>立即购买</Button>
|
||||
|
||||
</View>
|
||||
)
|
||||
}
|
||||
|
@ -68,7 +68,7 @@
|
||||
|
||||
.goods-name {
|
||||
width: 100%;
|
||||
height: 48px;
|
||||
height: auto;
|
||||
font-size: 16px;
|
||||
font-weight: bold;
|
||||
color: #10254E;
|
||||
|
@ -5,7 +5,7 @@ import TabbarAction from '@/components/action';
|
||||
import message from '@/images/message.png'
|
||||
import setting from '@/images/setting.png'
|
||||
import level1 from '@/images/level1.png'
|
||||
import level2 from '@/images/level2.png'
|
||||
import homeBg from '@/images/homeBg.png'
|
||||
import bal from '@/images/bal.png'
|
||||
import income from '@/images/income.png'
|
||||
import scope from '@/images/scope.png'
|
||||
@ -18,139 +18,197 @@ import addr from '@/images/addr.png'
|
||||
import friend from '@/images/friend.png'
|
||||
import { Avatar } from '@nutui/nutui-react-taro';
|
||||
import next from '@/images/next.png'
|
||||
import { useEffect } from 'react';
|
||||
import { userDetail } from '../../utils/api';
|
||||
import { useState } from 'react';
|
||||
import { navigateTo } from '../../utils/utils';
|
||||
|
||||
|
||||
const Index = () => {
|
||||
const [user, setUser] = useState({})
|
||||
|
||||
return <View className='home-container'>
|
||||
<View className='home-title flex-center'>我的
|
||||
<View className='home-title-extra'>
|
||||
<Image src={setting} className='home-title-icon' />
|
||||
<Image src={message} className='home-title-icon' />
|
||||
useEffect(() => {
|
||||
userDetail().then(rs => {
|
||||
if (!rs) return
|
||||
setUser(rs)
|
||||
})
|
||||
}, [])
|
||||
|
||||
return <View className='user-container'>
|
||||
<View className='my-header-top relative'>
|
||||
<View className='user-title flex-center'>
|
||||
<View className='home-title-extra'>
|
||||
<Image src={setting} className='home-title-icon' onClick={() => { navigateTo('/pages/setting/index') }} />
|
||||
<Image src={message} className='home-title-icon' onClick={() => { navigateTo('/pages/message-list/index') }} />
|
||||
</View>
|
||||
</View>
|
||||
</View>
|
||||
|
||||
<View className='my-body'>
|
||||
<View className='my-header flex-between'>
|
||||
<View className='my-content flex-start'>
|
||||
|
||||
<View className='my-avatar flex-center'>
|
||||
<Avatar size={56} icon="https://img12.360buyimg.com/imagetools/jfs/t1/143702/31/16654/116794/5fc6f541Edebf8a57/4138097748889987.png"
|
||||
<Avatar size={50} icon={user.avatar} alt={user.nick_name}
|
||||
/>
|
||||
</View>
|
||||
|
||||
<View className='my-content-info flex-col'>
|
||||
<View className='my-info-name flex-start'>
|
||||
<Text>这个是姓名</Text>
|
||||
<Text>{user.nick_name}</Text>
|
||||
<View className='my-level'>
|
||||
<Text className='my-lev-text'>V5</Text>
|
||||
<Text className='my-lev-text'>{user.user_level?.name}</Text>
|
||||
</View>
|
||||
</View>
|
||||
<View className='my-id-box flex-start'>
|
||||
<Text>区域合伙人</Text>
|
||||
<Image className='my-id-icon' src={level1} />
|
||||
</View>
|
||||
</View>
|
||||
<View className='my-edit' onClick={() => {
|
||||
navigateTo('/pages/user-info/index')
|
||||
}}>
|
||||
<Text>编辑资料 {'>'} </Text>
|
||||
</View>
|
||||
</View>
|
||||
<View className='flex-start my-id-box'>
|
||||
<Image src={level1} className='my-id-icon' />
|
||||
{
|
||||
user.is_city_partner && <Text className=''>{user.city_partner_level == 'city' ? '城市合伙人' : '区域合伙人'}</Text>
|
||||
}
|
||||
{
|
||||
!user.is_city_partner && <Text className='f14' onClick={() => {
|
||||
navigateTo('/pages/city-partant/index')
|
||||
}}>申请城市合伙人</Text>
|
||||
}
|
||||
|
||||
</View>
|
||||
</View>
|
||||
<View className='my-container'>
|
||||
<View className="my-header-bottom">
|
||||
<Image src={homeBg} className="home-bg absolute" />
|
||||
<View className='my-order-container'>
|
||||
<View className='my-order-title flex-between'>
|
||||
<Text>我的订单</Text>
|
||||
<View className='my-order-more flex-center' onClick={() => {
|
||||
navigateTo('/pages/order/index')
|
||||
}}>
|
||||
<Text>全部订单</Text>
|
||||
<Image className='next-icon' src={next} />
|
||||
</View>
|
||||
</View>
|
||||
<View className='my-order-tool flex-between'>
|
||||
<View className='flex-col my-order-tool-item' onClick={() => {
|
||||
navigateTo('/pages/order/index?state=paid')
|
||||
}}>
|
||||
<View className="relative my-order-tool-box">
|
||||
<Image className='my-order-tool-icon' src={waitpay} />
|
||||
{/* <Text className='my-order-mark' style={{ fontSize: 4 }}>2</Text> */}
|
||||
</View>
|
||||
<Text>待发货</Text>
|
||||
</View>
|
||||
<View className='flex-col my-order-tool-item' onClick={() => {
|
||||
navigateTo('/pages/order/index?state=sent')
|
||||
}}>
|
||||
<View className="relative my-order-tool-box">
|
||||
<Image className='my-order-tool-icon' src={delivery} />
|
||||
{/* <Text className='my-order-mark' style={{ fontSize: 4 }}>2</Text> */}
|
||||
</View>
|
||||
<Text>待收货</Text>
|
||||
</View>
|
||||
<View className='flex-col my-order-tool-item' onClick={() => {
|
||||
navigateTo('/pages/order/index?state=received')
|
||||
}}>
|
||||
<View className="relative my-order-tool-box">
|
||||
<Image className='my-order-tool-icon' src={done} />
|
||||
{/* <Text className='my-order-mark' style={{ fontSize: 4 }}>2</Text> */}
|
||||
</View>
|
||||
<Text>已收货</Text>
|
||||
</View>
|
||||
</View>
|
||||
</View>
|
||||
<View className='my-edit'>
|
||||
<Text>编辑资料</Text>
|
||||
<Image className='next-icon' src={next} />
|
||||
</View>
|
||||
|
||||
<View className='my-tool-box flex-col'>
|
||||
<View className='my-tool-box-title'>
|
||||
我的属性
|
||||
</View>
|
||||
<View className='flex-around justify-center mt18'>
|
||||
<View className='bal-item-content flex-col items-center'>
|
||||
<Text>{user.contribution}</Text>
|
||||
<Text className='bal-item-helper'>贡献值</Text>
|
||||
</View>
|
||||
<View className='bal-item-content flex-col items-center'>
|
||||
<Text>{user.energy}</Text>
|
||||
<Text className='bal-item-helper'>能量值</Text>
|
||||
</View>
|
||||
</View>
|
||||
</View>
|
||||
|
||||
<View className='bal-container flex-between'>
|
||||
<View className='bal-item flex-start'>
|
||||
<Image src={bal} className='bal-icon' />
|
||||
<View className='bal-item-content flex-col'>
|
||||
<Text>12345</Text>
|
||||
<View className='mt18 my-tool-box flex-col'>
|
||||
<View className='my-tool-box-title'>
|
||||
我的钱包
|
||||
</View>
|
||||
<View className='flex-between mt18'>
|
||||
<View className='bal-item-content flex-col items-center' onClick={() => {
|
||||
navigateTo('/pages/balance/index')
|
||||
}}>
|
||||
<Text>{user.score}</Text>
|
||||
<Text className='bal-item-helper'>余额</Text>
|
||||
</View>
|
||||
</View>
|
||||
<View className='bal-item flex-start'>
|
||||
<Image src={income} className='bal-icon' />
|
||||
<View className='bal-item-content flex-col'>
|
||||
<Text>12345</Text>
|
||||
<View className='bal-item-content flex-col items-center' onClick={() => {
|
||||
navigateTo('/pages/income/index')
|
||||
}
|
||||
}>
|
||||
<Text>{user.profit ?? 0}</Text>
|
||||
<Text className='bal-item-helper'>收益</Text>
|
||||
</View>
|
||||
</View>
|
||||
<View className='bal-item flex-start'>
|
||||
<Image src={scope} className='bal-icon' />
|
||||
<View className='bal-item-content flex-col'>
|
||||
<Text>12345</Text>
|
||||
<Text className='bal-item-helper'>积分</Text>
|
||||
<View className='bal-item-content flex-col items-center' onClick={() => {
|
||||
navigateTo('/pages/scope/index')
|
||||
}}>
|
||||
<Text>{user.shopping_score}</Text>
|
||||
<Text className='bal-item-helper'>购物金</Text>
|
||||
</View>
|
||||
</View>
|
||||
</View>
|
||||
|
||||
<View className='my-order-container'>
|
||||
<View className='my-order-title flex-between'>
|
||||
<Text>我的订单</Text>
|
||||
<View className='my-order-more flex-center'>
|
||||
<Text>全部订单</Text>
|
||||
<Image className='next-icon' src={next} />
|
||||
</View>
|
||||
<View className='mt18 my-tool-box flex-col'>
|
||||
<View className='my-tool-box-title'>
|
||||
常用工具
|
||||
</View>
|
||||
<View className='my-order-tool flex-around'>
|
||||
<View className='flex-col my-order-tool-item'>
|
||||
<View className='flex-around mt18'>
|
||||
<View className='flex-col my-order-tool-item' onClick={() => {
|
||||
navigateTo('/pages/invite/index')
|
||||
}}>
|
||||
<View className="relative my-order-tool-box">
|
||||
<Image className='my-order-tool-icon' src={waitpay} />
|
||||
<Text className='my-order-mark' style={{ fontSize: 4 }}>2</Text>
|
||||
<Image className='my-tool-icon' src={friend} />
|
||||
</View>
|
||||
<Text>待付款</Text>
|
||||
<Text>邀请好友</Text>
|
||||
</View>
|
||||
<View className='flex-col my-order-tool-item'>
|
||||
<View className="relative my-order-tool-box">
|
||||
<Image className='my-order-tool-icon' src={delivery} />
|
||||
<Text className='my-order-mark' style={{ fontSize: 4 }}>2</Text>
|
||||
</View>
|
||||
<Text>待发货</Text>
|
||||
</View>
|
||||
<View className='flex-col my-order-tool-item'>
|
||||
<View className="relative my-order-tool-box">
|
||||
<Image className='my-order-tool-icon' src={done} />
|
||||
<Text className='my-order-mark' style={{ fontSize: 4 }}>2</Text>
|
||||
</View>
|
||||
<Text>已完成</Text>
|
||||
</View>
|
||||
</View>
|
||||
</View>
|
||||
<View className='my-order-container'>
|
||||
<View className='my-order-title flex-between'>
|
||||
<Text>常用工具</Text>
|
||||
|
||||
</View>
|
||||
<View className='my-order-tool flex-around'>
|
||||
<View className='flex-col my-order-tool-item'>
|
||||
<View className='flex-col my-order-tool-item' onClick={() => {
|
||||
navigateTo('/pages/shopping/index?source=shopping_score_mall')
|
||||
}}>
|
||||
<View className="relative my-order-tool-box">
|
||||
<Image className='my-tool-icon' src={mall} />
|
||||
</View>
|
||||
<Text>购物金商城</Text>
|
||||
</View>
|
||||
<View className='flex-col my-order-tool-item' onClick={() => {
|
||||
navigateTo('/pages/address/index?home=home')
|
||||
}}>
|
||||
<View className="relative my-order-tool-box">
|
||||
<Image className='my-tool-icon' src={addr} />
|
||||
</View>
|
||||
<Text>地址管理</Text>
|
||||
</View>
|
||||
<View className='flex-col my-order-tool-item' onClick={() => {
|
||||
navigateTo('/pages/team/index')
|
||||
}}>
|
||||
<View className="relative my-order-tool-box">
|
||||
<Image className='my-tool-icon' src={team} />
|
||||
|
||||
</View>
|
||||
<Text>我的团队</Text>
|
||||
</View>
|
||||
<View className='flex-col my-order-tool-item'>
|
||||
<View className="relative my-order-tool-box">
|
||||
<Image className='my-tool-icon' src={mall} />
|
||||
|
||||
</View>
|
||||
<Text>购物金商城</Text>
|
||||
</View>
|
||||
<View className='flex-col my-order-tool-item'>
|
||||
<View className="relative my-order-tool-box">
|
||||
<Image className='my-tool-icon' src={addr} />
|
||||
</View>
|
||||
<Text>地址管理</Text>
|
||||
</View>
|
||||
<View className='flex-col my-order-tool-item'>
|
||||
<View className="relative my-order-tool-box">
|
||||
<Image className='my-tool-icon' src={friend} />
|
||||
</View>
|
||||
<Text>邀请好友</Text>
|
||||
</View>
|
||||
</View>
|
||||
|
||||
</View>
|
||||
|
||||
</View>
|
||||
|
||||
|
||||
<TabbarAction index={2} />
|
||||
</View>
|
||||
}
|
||||
|
@ -1,16 +1,33 @@
|
||||
.home-container {
|
||||
.user-container {
|
||||
font-family: Source Han Sans CN-Bold, Source Han Sans CN;
|
||||
font-size: 14px;
|
||||
background: linear-gradient(#fdf3f1, #FCFCFE);
|
||||
font-weight: 400;
|
||||
// min-height: 100vh;
|
||||
// height: auto;
|
||||
}
|
||||
|
||||
.home-title {
|
||||
.my-header-top {
|
||||
height: 202px;
|
||||
width: 100vw;
|
||||
background: none;
|
||||
}
|
||||
|
||||
.my-header-top:after {
|
||||
width: 142%;
|
||||
height: 202px;
|
||||
position: absolute;
|
||||
left: -22.5%;
|
||||
top: 0;
|
||||
z-index: -1;
|
||||
content: '';
|
||||
border-radius: 0 0 50% 50%;
|
||||
background: linear-gradient(180deg, #FAE3DD 0%, #F8A489, #F67952 100%);
|
||||
}
|
||||
|
||||
|
||||
.user-title {
|
||||
width: 100vw;
|
||||
height: 60px;
|
||||
background: #FFFFFF;
|
||||
box-shadow: 0px 4px 13px 0px rgba(0, 0, 0, 0.12);
|
||||
border-radius: 0px 0px 0px 0px;
|
||||
opacity: 1;
|
||||
font-size: 18px;
|
||||
font-weight: bold;
|
||||
@ -34,43 +51,34 @@
|
||||
display: block;
|
||||
}
|
||||
|
||||
.my-body {
|
||||
height: calc(100vh - 60px - 66px);
|
||||
padding-bottom: 10px;
|
||||
box-sizing: border-box;
|
||||
overflow-y: auto;
|
||||
overflow-x: hidden;
|
||||
padding: 13px 20px;
|
||||
padding-right: 20px;
|
||||
.my-header {
|
||||
padding: 0 18px;
|
||||
}
|
||||
|
||||
.my-header {
|
||||
margin-top: 18px;
|
||||
}
|
||||
|
||||
.my-edit {
|
||||
color: rgba(0, 0, 0, 0.4);
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.my-edit text {
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
.my-content-info {
|
||||
margin-left: 9px;
|
||||
color: #000;
|
||||
color: #fff;
|
||||
font-weight: bold;
|
||||
font-size: 16px;
|
||||
|
||||
}
|
||||
|
||||
.my-avatar {
|
||||
width: 56px;
|
||||
height: 56px;
|
||||
width: 50px;
|
||||
height: 50px;
|
||||
border-radius: 50%;
|
||||
border: 3px solid #ffffffa3;
|
||||
}
|
||||
|
||||
.my-level {
|
||||
width: 25px;
|
||||
// width: 25px;
|
||||
padding: 0 6px;
|
||||
height: 16px;
|
||||
background: linear-gradient(117deg, #0F1732 0%, #2F3A58 100%);
|
||||
border-radius: 7px;
|
||||
@ -88,32 +96,42 @@
|
||||
color: transparent;
|
||||
}
|
||||
|
||||
.my-container {
|
||||
margin-bottom: 160px;
|
||||
}
|
||||
|
||||
.home-bg {
|
||||
top: -30px;
|
||||
z-index: -1;
|
||||
width: 100vw;
|
||||
}
|
||||
|
||||
.my-header-bottom {
|
||||
height: 126px;
|
||||
width: 100vw;
|
||||
}
|
||||
|
||||
|
||||
|
||||
.my-id-box {
|
||||
color: rgba(0, 0, 0, 0.4);
|
||||
font-weight: bold;
|
||||
color: #FFFFFF;
|
||||
font-size: 16px;
|
||||
margin-top: 2px;
|
||||
position: absolute;
|
||||
bottom: 32px;
|
||||
left: 30px;
|
||||
}
|
||||
|
||||
.my-id-icon {
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
width: 14px;
|
||||
height: 14px;
|
||||
margin-left: 8px;
|
||||
margin-right: 4px;
|
||||
}
|
||||
|
||||
|
||||
.bal-container {
|
||||
margin-top: 38px;
|
||||
}
|
||||
|
||||
.bal-item {
|
||||
width: 102px;
|
||||
height: 62px;
|
||||
background: #FFFFFF;
|
||||
box-shadow: -2px 8px 46px 0px rgba(37, 45, 50, 0.05);
|
||||
border-radius: 10px 10px 10px 10px;
|
||||
opacity: 1;
|
||||
box-sizing: border-box;
|
||||
padding-left: 8px;
|
||||
}
|
||||
|
||||
.bal-icon {
|
||||
width: 22px;
|
||||
@ -125,6 +143,7 @@
|
||||
color: #181A20;
|
||||
margin-left: 6px;
|
||||
line-height: 20px;
|
||||
font-size: 18px;
|
||||
}
|
||||
|
||||
.bal-item-helper {
|
||||
@ -135,12 +154,16 @@
|
||||
}
|
||||
|
||||
.my-order-container {
|
||||
margin-top: 38px;
|
||||
width: 290px;
|
||||
margin: 0 auto;
|
||||
|
||||
}
|
||||
|
||||
.my-order-title {
|
||||
font-weight: 600;
|
||||
color: #000000;
|
||||
position: relative;
|
||||
top: -4px;
|
||||
}
|
||||
|
||||
.my-order-more {
|
||||
@ -155,7 +178,7 @@
|
||||
}
|
||||
|
||||
.my-order-tool {
|
||||
margin-top: 20px;
|
||||
margin-top: 13px;
|
||||
}
|
||||
|
||||
.my-order-tool-item {
|
||||
@ -164,6 +187,7 @@
|
||||
font-weight: 400;
|
||||
color: rgba(0, 0, 0, 0.5);
|
||||
font-size: 12px;
|
||||
|
||||
}
|
||||
|
||||
.my-order-tool-icon {
|
||||
@ -194,4 +218,25 @@
|
||||
.my-tool-icon {
|
||||
width: 25px;
|
||||
height: 24px;
|
||||
}
|
||||
|
||||
|
||||
.my-tool-box {
|
||||
width: 333px;
|
||||
height: 118px;
|
||||
background: #fff;
|
||||
box-shadow: 4px 7px 26px 20px rgba(37, 45, 50, 0.05);
|
||||
border-radius: 16px 16px 16px 16px;
|
||||
opacity: 1;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
padding: 0 16px;
|
||||
color: #181A20;
|
||||
box-sizing: border-box;
|
||||
|
||||
}
|
||||
|
||||
.my-tool-box-title {
|
||||
font-weight: bold;
|
||||
margin-top: 14px;
|
||||
}
|
@ -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,77 +12,105 @@ 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)
|
||||
|
||||
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('profit', 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">
|
||||
<View className='addr-detail-title'>
|
||||
<Image src={backNav} className="square-35 absolute left-10 nav-icon" onClick={backFn} />
|
||||
我的收益
|
||||
|
||||
</View>
|
||||
<View className="profit-container relative">
|
||||
<View className="profit-amount flex-between ">
|
||||
<View className="flex-col justify-between profit-amount-left">
|
||||
<Text>当前余额</Text>
|
||||
<Text className="profit-amount-price">50000</Text>
|
||||
<Text className="profit-amount-price">{user.profit}</Text>
|
||||
</View>
|
||||
<View className="flex-around ">
|
||||
|
||||
<View className="profit-btn flex-center" onClick={() => {
|
||||
Taro.navigateTo({ url: '/pages/transfer/index' })
|
||||
Taro.navigateTo({ url: '/pages/conversion/index' })
|
||||
}}>转换余额</View>
|
||||
</View>
|
||||
</View>
|
||||
|
||||
<View className="amount-container">
|
||||
<View className="amount-tabs flex-around">
|
||||
<View className={'tab-pane ' + (tabKey == '0' ? 'tab-pane-active' : '')} onClick={() => setTabKey('0')}>收益流水</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="amount-tabs flex-start">
|
||||
<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 == '2' ? 'tab-pane-active' : '')} onClick={() => setTabKey('2')}>发放明细</View> */}
|
||||
</View>
|
||||
<View className="profitScroll" id="profitScroll">
|
||||
<Infiniteloading
|
||||
containerId="profitScroll"
|
||||
useWindow={false}
|
||||
loadTxt="loading"
|
||||
loadMoreTxt="没有数据啦~"
|
||||
loadIcon='loading'
|
||||
hasMore={false}
|
||||
onLoadMore={(x) => {
|
||||
setPage(p => p + 1)
|
||||
x()
|
||||
}}
|
||||
>
|
||||
<View className="amount-item flex-between">
|
||||
<View className="amount-item-detail flex-col">
|
||||
<View>完成每日登陆</View>
|
||||
<View className="amount-item-time">2021/04/09 19:42:36</View>
|
||||
</View>
|
||||
<View className="amount-item-log">+1.00</View>
|
||||
</View>
|
||||
|
||||
<View className="amount-item flex-between">
|
||||
<View className="amount-item-detail flex-col">
|
||||
<View>完成每日登陆</View>
|
||||
<View className="amount-item-time">2021/04/09 19:42:36</View>
|
||||
</View>
|
||||
<View className="amount-item-log">+1.00</View>
|
||||
</View>
|
||||
</Infiniteloading>
|
||||
{
|
||||
!!list.length && <Infiniteloading
|
||||
containerId="profitScroll"
|
||||
useWindow={false}
|
||||
loadTxt="loading"
|
||||
loadMoreTxt="没有数据啦~"
|
||||
loadIcon='loading'
|
||||
hasMore={total >= list.length}
|
||||
onLoadMore={(x) => {
|
||||
setPage(p => p + 1)
|
||||
x()
|
||||
}}
|
||||
>
|
||||
{
|
||||
list.map(item => {
|
||||
return <View className="amount-item flex-between" key={item.id}>
|
||||
<View className="amount-item-detail flex-col">
|
||||
<View>{item.memo}</View>
|
||||
<View className="amount-item-time">{formatDateByStr(item.created_at)}</View>
|
||||
</View>
|
||||
<View className="amount-item-log">{item.amount > 0 ? `+${item.amount}` : `${item.amount}`}</View>
|
||||
</View>
|
||||
})
|
||||
}
|
||||
</Infiniteloading>
|
||||
}
|
||||
{
|
||||
!list.length && <Image src={empty} className="order-empty" />
|
||||
}
|
||||
</View>
|
||||
</View>
|
||||
|
||||
|
@ -1,36 +1,47 @@
|
||||
import React from 'react'
|
||||
import { Image, Text, View } from '@tarojs/components'
|
||||
import {
|
||||
Button
|
||||
} from "@nutui/nutui-react-taro";
|
||||
import './index.scss'
|
||||
import TabbarAction from '@/components/action';
|
||||
import { Infiniteloading } from '@nutui/nutui-react-taro';
|
||||
import { useEffect } from 'react';
|
||||
import { useState } from 'react';
|
||||
|
||||
import { mallList } from '../../utils/api';
|
||||
import Taro from '@tarojs/taro';
|
||||
import { useRouter } from '@tarojs/taro';
|
||||
import { SetData } from '../../utils/storage';
|
||||
|
||||
|
||||
function Index() {
|
||||
|
||||
const param = useRouter().params
|
||||
const limit = 20
|
||||
const [list, setList] = useState([])
|
||||
const [total, setTotal] = useState(0)
|
||||
const [page, setPage] = useState(1)
|
||||
const [hasMore, setHasMore] = useState(true)
|
||||
|
||||
useEffect(() => {
|
||||
if (list.length > 50) {
|
||||
setHasMore(false)
|
||||
if (page < 1) {
|
||||
return
|
||||
}
|
||||
let l = []
|
||||
for (let i = list.length; i < 10 + list.length; i++) {
|
||||
l.push(i)
|
||||
fetchList(page)
|
||||
if (param.code) {
|
||||
SetData("inviteCode", param.code)
|
||||
}
|
||||
setList([...list, ...l])
|
||||
|
||||
}, [page])
|
||||
|
||||
const fetchList = async (page) => {
|
||||
const offset = (page - 1) * limit
|
||||
const res = await mallList('mall', offset, limit)
|
||||
|
||||
if (!res) return
|
||||
if (res.items?.length + list.length >= res.total) {
|
||||
setHasMore(false)
|
||||
}
|
||||
setList(it => [...it, ...res.items])
|
||||
setTotal(res.total)
|
||||
}
|
||||
|
||||
|
||||
// 跳转
|
||||
const navDetailFn = (id) => {
|
||||
@ -48,7 +59,7 @@ function Index() {
|
||||
containerId="customScroll"
|
||||
useWindow={false}
|
||||
loadTxt="loading"
|
||||
loadMoreTxt="没有数据啦~"
|
||||
loadMoreTxt={<View></View>}
|
||||
loadIcon='loading'
|
||||
hasMore={hasMore}
|
||||
onLoadMore={(x) => {
|
||||
@ -59,21 +70,21 @@ function Index() {
|
||||
<View className='goods-container '>
|
||||
{
|
||||
list.map(item => {
|
||||
return <View className='goods-item' key={item} onClick={() => {
|
||||
navDetailFn(item)
|
||||
return <View className='goods-item' key={item.id} onClick={() => {
|
||||
navDetailFn(item.id)
|
||||
}}>
|
||||
<View className='goods-item-image'>
|
||||
<Image src='https://img.yzcdn.cn/vant/cat.jpeg' />
|
||||
<Image src={item.cover_image} />
|
||||
</View>
|
||||
<View className='goods-item-name line-clamp-2'>
|
||||
这个是商品的名称,但是可能有一点点的长
|
||||
{item.name}
|
||||
</View>
|
||||
<View className='goods-item-desc line-clamp-2 '>
|
||||
{/* <View className='goods-item-desc line-clamp-2 '>
|
||||
这个是商品的介绍
|
||||
</View>
|
||||
</View> */}
|
||||
<View className='goods-item-price'>
|
||||
<Text className='goods-item-price-sale'>¥199</Text>
|
||||
<Text className='goods-item-price-origin'>原价888</Text>
|
||||
<Text className='goods-item-price-sale'>¥{item.price}</Text>
|
||||
{/* <Text className='goods-item-price-origin'>原价888</Text> */}
|
||||
</View>
|
||||
</View>
|
||||
})
|
||||
|
@ -33,8 +33,8 @@
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
flex-direction: row;
|
||||
justify-content: space-around;
|
||||
padding: 0 8px;
|
||||
justify-content: space-between;
|
||||
padding: 0 12px;
|
||||
margin-top: 24px;
|
||||
// column-count: 2;
|
||||
// column-gap: 10px;
|
||||
|
3
src/pages/invite/index.config.js
Normal file
@ -0,0 +1,3 @@
|
||||
export default definePageConfig({
|
||||
navigationBarTitleText: '邀请好友'
|
||||
})
|
109
src/pages/invite/index.jsx
Normal file
@ -0,0 +1,109 @@
|
||||
import { View, Image, Text } from "@tarojs/components"
|
||||
import backNav from '@/images/backNav.png'
|
||||
import inviteBg from '@/images/inviteBg.png'
|
||||
import share from '@/images/share.png'
|
||||
import wechat from '@/images/wechat.png'
|
||||
import qrcode from '@/images/qrcode.png'
|
||||
import './index.scss'
|
||||
import { backTo, errorNotice, successNotice } from "../../utils/utils"
|
||||
import { userDetail } from "../../utils/api"
|
||||
import { useState } from "react"
|
||||
import jrQrcode from 'jr-qrcode'
|
||||
import { useEffect } from "react"
|
||||
import { Button } from "@nutui/nutui-react-taro"
|
||||
import config from "../../config/config"
|
||||
import Taro from "@tarojs/taro"
|
||||
import html2canvas from 'html2canvas';
|
||||
|
||||
|
||||
const Index = () => {
|
||||
|
||||
const [user, setUser] = useState({})
|
||||
const [code, setCode] = useState('')
|
||||
|
||||
useEffect(() => {
|
||||
userDetail().then(rs => {
|
||||
if (!rs) return
|
||||
setUser(rs)
|
||||
const img = jrQrcode.getQrBase64(window.location.origin + '/#/pages/index/index?code=' + rs.invite_code)
|
||||
setCode(img)
|
||||
})
|
||||
|
||||
}, [])
|
||||
|
||||
const backFn = () => {
|
||||
backTo()
|
||||
}
|
||||
|
||||
const genImage = () => {
|
||||
const canvas = document.createElement("canvas")
|
||||
let canvasBox = document.getElementById('imageWrapper')
|
||||
const width = canvasBox.offsetWidth
|
||||
const height = canvasBox.offsetHeight
|
||||
canvas.width = width * 3
|
||||
canvas.height = height * 3
|
||||
|
||||
const options = {
|
||||
backgroundColor: '#F67952',
|
||||
canvas: canvas,
|
||||
useCORS: true,
|
||||
y: 66,
|
||||
allowTaint: true,
|
||||
onrendered: (x) => {
|
||||
console.log(x, "CCC")
|
||||
}
|
||||
};
|
||||
|
||||
html2canvas(canvasBox, options).then((canvas) => {
|
||||
let dataURL = canvas.toDataURL("image/png");
|
||||
//下载
|
||||
downloadImage(dataURL);
|
||||
//显示
|
||||
})
|
||||
}
|
||||
|
||||
const downloadImage = (url) => {
|
||||
let link = document.createElement("a");
|
||||
link.href = url;
|
||||
link.setAttribute("download", "邀请码.png");
|
||||
link.click();
|
||||
}
|
||||
|
||||
const shareFn = async () => {
|
||||
genImage()
|
||||
}
|
||||
|
||||
return <View className="invite-container" id="imageWrapper">
|
||||
<View className='addr-detail-title invite-header '>
|
||||
<Image src={backNav} className="square-35 absolute left-10 nav-icon" onClick={backFn} />
|
||||
邀请好友
|
||||
</View>
|
||||
<View className="invite-body relative flex-center" >
|
||||
|
||||
<View className="flex-col items-center invite-content">
|
||||
<Text className="invite-body-title">邀请好友,福利多多</Text>
|
||||
<Image src={code} className="invite-code-img mt18" />
|
||||
<View className="invite-code-help">邀请码:{user.invite_code}</View>
|
||||
<Button className="invite-btn" onClick={shareFn}>立即邀请</Button>
|
||||
</View>
|
||||
<Image src={inviteBg} className="invite-body-bg" id='invite-body-bg' />
|
||||
</View>
|
||||
<View className="invite-footer flex-between items-start ">
|
||||
<View className="invite-action flex-col items-center">
|
||||
<Image src={share} className="invite-action-icon" />
|
||||
<View>点击分享二维码</View>
|
||||
</View>
|
||||
<View className="invite-action flex-col items-center">
|
||||
<Image src={wechat} className="invite-action-icon" />
|
||||
<View className="mt6">分享至微信</View>
|
||||
</View>
|
||||
<View className="invite-action flex-col items-center">
|
||||
<Image src={qrcode} className="invite-action-icon" />
|
||||
<View>好友扫码加入</View>
|
||||
</View>
|
||||
</View>
|
||||
</View>
|
||||
}
|
||||
|
||||
|
||||
export default Index
|
79
src/pages/invite/index.scss
Normal file
@ -0,0 +1,79 @@
|
||||
.invite-container {
|
||||
width: 100vw;
|
||||
min-height: 100vh;
|
||||
height: auto;
|
||||
background: #F67952;
|
||||
}
|
||||
|
||||
.invite-header {
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
.invite-body {
|
||||
width: 100vw;
|
||||
margin-top: 60px;
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.invite-body-bg {
|
||||
width: 315px;
|
||||
position: absolute;
|
||||
top: 0px;
|
||||
z-index: -1;
|
||||
}
|
||||
|
||||
.invite-content {
|
||||
z-index: 10;
|
||||
}
|
||||
|
||||
.invite-body-title {
|
||||
font-size: 20px;
|
||||
color: #000;
|
||||
margin-top: 40px;
|
||||
|
||||
}
|
||||
|
||||
.invite-code-img {
|
||||
width: 168px;
|
||||
height: 168px;
|
||||
}
|
||||
|
||||
.invite-code-help {
|
||||
font-weight: 400;
|
||||
color: rgba(0, 0, 0, 0.5);
|
||||
font-size: 16px;
|
||||
margin-top: 6px;
|
||||
}
|
||||
|
||||
.invite-btn {
|
||||
width: 185px;
|
||||
height: 46px;
|
||||
border-radius: 123px 123px 123px 123px;
|
||||
background: #F67952;
|
||||
border: none;
|
||||
color: #FFFFFF;
|
||||
margin-top: 30px;
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
.invite-footer {
|
||||
width: 315px;
|
||||
margin: 0 auto;
|
||||
margin-top: 70px;
|
||||
align-content: flex-start;
|
||||
justify-items: flex-start;
|
||||
align-items: flex-start;
|
||||
}
|
||||
|
||||
.invite-action {
|
||||
font-size: 12px;
|
||||
color: #fff;
|
||||
width: 78px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.invite-action-icon {
|
||||
width: 24px;
|
||||
margin-bottom: 8px;
|
||||
}
|
3
src/pages/login-quick/index.config.js
Normal file
@ -0,0 +1,3 @@
|
||||
export default definePageConfig({
|
||||
navigationBarTitleText: '登录'
|
||||
})
|
115
src/pages/login-quick/index.jsx
Normal file
@ -0,0 +1,115 @@
|
||||
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 eye from '@/images/eye.png'
|
||||
import './index.scss'
|
||||
import { Button } from "@nutui/nutui-react-taro"
|
||||
import { useState } from "react"
|
||||
import Taro from "@tarojs/taro"
|
||||
import { useDidShow } from "@tarojs/taro"
|
||||
import { login, sendCode } from "../../utils/api"
|
||||
import { JWT, JWTEXPIRE, SetData, USERINFO } from "../../utils/storage"
|
||||
|
||||
|
||||
const activeEye = eye
|
||||
|
||||
const Login = () => {
|
||||
|
||||
|
||||
|
||||
const [mobile, setMobile] = useState('')
|
||||
const [smsCode, setSmsCode] = useState('')
|
||||
const [interval, setIntervalTime] = useState(0)
|
||||
|
||||
|
||||
// 返回页面
|
||||
const backFn = () => {
|
||||
Taro.getCurrentPages().length > 0 && Taro.navigateBack()
|
||||
}
|
||||
|
||||
// 倒计时
|
||||
const countDown = async () => {
|
||||
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)
|
||||
const re = await sendCode(mobile)
|
||||
if (!re) return
|
||||
Taro.showToast({ title: '验证码发送成功', icon: 'success' })
|
||||
}
|
||||
|
||||
|
||||
const loginSubmit = async () => {
|
||||
if (!mobile || !smsCode) {
|
||||
Taro.showToast({ title: '请完善登陆参数', icon: 'error' })
|
||||
return
|
||||
}
|
||||
Taro.showLoading({ title: '登陆中,请稍后' })
|
||||
const re = await login(mobile, '', smsCode)
|
||||
Taro.hideLoading()
|
||||
if (re) {
|
||||
SetData(JWT, re.token, JWTEXPIRE)
|
||||
SetData(USERINFO, re.user)
|
||||
Taro.redirectTo({ url: '/pages/index/index' })
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
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">
|
||||
<Image src={back} className="square-35 absolute left-7" onClick={backFn} />
|
||||
<View>新起点</View>
|
||||
</View>
|
||||
<View className="login-container relative">
|
||||
<View className="relative font-bold text-lg block h-6 ">登录</View>
|
||||
<View>
|
||||
<View className="form-item mt-58">
|
||||
<View className="form-label">手机号</View>
|
||||
<View className="form-control relative">
|
||||
<Input className="form-input" name="mobile" placeholder="请输手机号" id='mobile' onInput={(v) => {
|
||||
setMobile(v.detail.value)
|
||||
}} />
|
||||
{
|
||||
mobile && <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" name="smsCode" type="text" placeholder="请输入验证码" id='code' value={smsCode} onInput={(v) => {
|
||||
setSmsCode(v.detail.value)
|
||||
}} />
|
||||
<Button className="code-btn" disabled={interval > 0} onClick={countDown}>{interval ? interval + 's' : '获取验证码'}</Button>
|
||||
</View>
|
||||
</View>
|
||||
|
||||
<View className="login-footer flex flex-col justify-center">
|
||||
<Button className="login-btn" onClick={loginSubmit}>登录</Button>
|
||||
<View className="quick-login" onClick={() => {
|
||||
Taro.redirectTo({ url: '/pages/login/index' })
|
||||
}}>密码登录</View>
|
||||
</View>
|
||||
</View>
|
||||
</View>
|
||||
|
||||
</View>
|
||||
}
|
||||
|
||||
|
||||
export default Login
|
123
src/pages/login-quick/index.scss
Normal file
@ -0,0 +1,123 @@
|
||||
.login-header {
|
||||
height: 86px;
|
||||
}
|
||||
|
||||
.login-frame {
|
||||
height: auto;
|
||||
font-size: 14px;
|
||||
font-family: Source Han Sans CN-Bold, Source Han Sans CN;
|
||||
}
|
||||
|
||||
.login-container {
|
||||
width: 375px;
|
||||
height: calc(100vh - 86px);
|
||||
background: #FFFFFF;
|
||||
border-radius: 20px 20px 0 0;
|
||||
box-shadow: 0px 8px 51px 0px rgba(230, 234, 238, 0.8);
|
||||
box-sizing: border-box;
|
||||
padding: 38px 30px;
|
||||
}
|
||||
|
||||
.form-item {
|
||||
height: 68px;
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.form-label {
|
||||
font-size: 12px;
|
||||
font-weight: bold;
|
||||
font-family: Source Han Sans CN-Bold, Source Han Sans CN;
|
||||
color: #2a2b2d;
|
||||
line-height: 16px;
|
||||
}
|
||||
|
||||
.form-input>.weui-input {
|
||||
border: none;
|
||||
height: 52px;
|
||||
line-height: 52px;
|
||||
border-bottom: 1px solid #262A34;
|
||||
position: relative;
|
||||
font-size: 16px;
|
||||
color: #000;
|
||||
}
|
||||
|
||||
.form-input>.weui-input:focus {
|
||||
border-bottom: 2px solid #F67952;
|
||||
}
|
||||
|
||||
.form-input-placeholder,
|
||||
.form-input>.weui-input::placeholder {
|
||||
font-size: 16px;
|
||||
font-family: Source Han Sans CN-Regular, Source Han Sans CN;
|
||||
font-weight: bold;
|
||||
color: #aeafb4;
|
||||
}
|
||||
|
||||
.form-control {
|
||||
height: 52px;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.forgot-password {
|
||||
height: 24px;
|
||||
font-size: 16px;
|
||||
font-family: Source Han Sans CN-Regular, Source Han Sans CN;
|
||||
font-weight: 400;
|
||||
color: #666;
|
||||
line-height: 24px;
|
||||
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
|
||||
.form-helper {
|
||||
margin-top: 16px;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.login-btn {
|
||||
width: 253px;
|
||||
height: 55px;
|
||||
background: #F67952;
|
||||
border-radius: 68px 68px 68px 68px;
|
||||
opacity: 1;
|
||||
border: none;
|
||||
color: white;
|
||||
font-size: 16px;
|
||||
font-family: Source Han Sans CN-Bold, Source Han Sans CN;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.login-footer {
|
||||
margin-top: 50px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.quick-login {
|
||||
font-size: 16px;
|
||||
font-family: Source Han Sans CN-Regular, Source Han Sans CN;
|
||||
font-weight: 400;
|
||||
color: #000000;
|
||||
line-height: 24px;
|
||||
margin-top: 30px;
|
||||
}
|
||||
|
||||
.code-btn {
|
||||
width: 83px;
|
||||
height: 30px;
|
||||
background: #F67952;
|
||||
border-radius: 4px 4px 4px 4px;
|
||||
opacity: 1;
|
||||
font-size: 12px;
|
||||
font-family: Source Han Sans CN-Bold, Source Han Sans CN;
|
||||
font-weight: bold;
|
||||
color: #FFFFFF;
|
||||
border: none;
|
||||
padding: 0;
|
||||
position: absolute;
|
||||
right: 0;
|
||||
bottom: 12px;
|
||||
}
|
@ -8,23 +8,22 @@ import { Button } from "@nutui/nutui-react-taro"
|
||||
import { useState } from "react"
|
||||
import Taro from "@tarojs/taro"
|
||||
import { useDidShow } from "@tarojs/taro"
|
||||
import { login, sendCode } from "../../utils/api"
|
||||
import { JWT, JWTEXPIRE, SetData, USERINFO } from "../../utils/storage"
|
||||
import { successNotice } from "../../utils/utils"
|
||||
|
||||
|
||||
const activeEye = eye
|
||||
|
||||
const Login = () => {
|
||||
|
||||
const [account, setAccount] = useState('')
|
||||
const [pwd, setPwd] = useState()
|
||||
const [showPwd, setShowPwd] = useState(false)
|
||||
const [loginMode, setLoginMode] = useState('account')
|
||||
|
||||
|
||||
const [mobile, setMobile] = useState('')
|
||||
const [smsCode, setSmsCode] = useState('')
|
||||
const [pwd, setPwd] = useState('')
|
||||
const [interval, setIntervalTime] = useState(0)
|
||||
|
||||
useDidShow(() => {
|
||||
|
||||
})
|
||||
const [showPwd, setShowPwd] = useState()
|
||||
|
||||
|
||||
// 返回页面
|
||||
@ -46,19 +45,9 @@ const Login = () => {
|
||||
})
|
||||
}
|
||||
|
||||
//清理数据
|
||||
const cleanFn = () => {
|
||||
if (loginMode === 'account') {
|
||||
setAccount('')
|
||||
setPwd('')
|
||||
return
|
||||
}
|
||||
setMobile('')
|
||||
setSmsCode('')
|
||||
}
|
||||
|
||||
// 倒计时
|
||||
const countDown = () => {
|
||||
const countDown = async () => {
|
||||
if (!mobile) {
|
||||
return
|
||||
}
|
||||
@ -76,6 +65,26 @@ const Login = () => {
|
||||
setIntervalTime(start)
|
||||
}
|
||||
}, 1000)
|
||||
const re = await sendCode(mobile)
|
||||
if (!re) return
|
||||
Taro.showToast({ title: '验证码发送成功', icon: 'success' })
|
||||
}
|
||||
|
||||
|
||||
const loginSubmit = async () => {
|
||||
if (!mobile || !pwd) {
|
||||
Taro.showToast({ title: '请完善登陆参数', icon: 'error' })
|
||||
return
|
||||
}
|
||||
Taro.showLoading({ title: '登陆中,请稍后' })
|
||||
const re = await login(mobile, pwd)
|
||||
Taro.hideLoading()
|
||||
if (re) {
|
||||
SetData(JWT, re.token, JWTEXPIRE)
|
||||
SetData(USERINFO, re.user)
|
||||
Taro.redirectTo({ url: '/pages/index/index' })
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return <View className="login-frame bg-slate-50 h-screen text-base">
|
||||
@ -85,75 +94,41 @@ const Login = () => {
|
||||
</View>
|
||||
<View className="login-container relative">
|
||||
<View className="relative font-bold text-lg block h-6 ">登录</View>
|
||||
{
|
||||
loginMode === 'account' ? <View>
|
||||
<View className="form-item mt-58">
|
||||
<View className="form-label">账号</View>
|
||||
<View className="form-control relative">
|
||||
<Input className="form-input" placeholder="请输入账号" onInput={(v) => {
|
||||
setAccount(v.detail.value)
|
||||
}} />
|
||||
{
|
||||
!!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" 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-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">
|
||||
<Button className="login-btn">登录</Button>
|
||||
<View className="quick-login" onClick={() => {
|
||||
setLoginMode('mobile')
|
||||
cleanFn()
|
||||
}}>快捷登录</View>
|
||||
</View>
|
||||
</View> : <View>
|
||||
<View className="form-item mt-58">
|
||||
<View className="form-label">手机号</View>
|
||||
<View className="form-control relative">
|
||||
<Input className="form-input" placeholder="请输手机号" placeholderClass="form-input-placeholder" onInput={(v) => {
|
||||
setMobile(v.detail.value)
|
||||
}} />
|
||||
{
|
||||
mobile && <Image className="w-6 h-6 absolute right-0 bottom-16" src={checked} />
|
||||
}
|
||||
<View>
|
||||
<View className="form-item mt-58">
|
||||
<View className="form-label">手机号</View>
|
||||
<View className="form-control relative">
|
||||
<Input className="form-input" name="mobile" placeholder="请输手机号" id='mobile' onInput={(v) => {
|
||||
setMobile(v.detail.value)
|
||||
}} />
|
||||
{
|
||||
mobile && <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" maxlength={6} placeholder="请输入验证码" onInput={(v) => {
|
||||
setSmsCode(v.detail.value)
|
||||
}} />
|
||||
<Button className="code-btn" disabled={interval > 0} onClick={countDown}>{interval ? interval + 's' : '获取验证码'}</Button>
|
||||
</View>
|
||||
</View>
|
||||
|
||||
<View className="login-footer flex flex-col justify-center">
|
||||
<Button className="login-btn">登录</Button>
|
||||
<View className="quick-login" onClick={() => {
|
||||
setLoginMode('account')
|
||||
cleanFn()
|
||||
}}>密码登录</View>
|
||||
</View>
|
||||
</View>
|
||||
}
|
||||
|
||||
|
||||
<View className="form-item mt-22">
|
||||
<View className="form-label">密码</View>
|
||||
<View className="form-control relative">
|
||||
<Input className="form-input" name="pwd" type={showPwd ? 'text' : 'password'} id='pwd' placeholder="请输入密码" value={pwd} 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-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">
|
||||
<Button className="login-btn" onClick={loginSubmit}>登录</Button>
|
||||
<View className="quick-login" onClick={() => {
|
||||
Taro.redirectTo({ url: '/pages/login-quick/index' })
|
||||
}}>快捷登录</View>
|
||||
</View>
|
||||
</View>
|
||||
</View>
|
||||
|
||||
</View>
|
||||
|
3
src/pages/message-detail/index.config.js
Normal file
@ -0,0 +1,3 @@
|
||||
export default definePageConfig({
|
||||
navigationBarTitleText: '消息中心'
|
||||
})
|
49
src/pages/message-detail/index.jsx
Normal file
@ -0,0 +1,49 @@
|
||||
import { Image, Text, View } from "@tarojs/components"
|
||||
import next from '@/images/next.png'
|
||||
import './index.scss'
|
||||
import { useState } from "react"
|
||||
import Taro from "@tarojs/taro"
|
||||
import backNav from '@/images/backNav.png'
|
||||
import { useEffect } from "react"
|
||||
import { useRouter } from "@tarojs/taro"
|
||||
import { msgDetail } from "../../utils/api"
|
||||
import { formatDateByStr } from "../../utils/utils"
|
||||
|
||||
|
||||
const Login = () => {
|
||||
|
||||
const params = useRouter().params
|
||||
const [id] = useState(params.id)
|
||||
const [detail, setDetail] = useState({})
|
||||
|
||||
useEffect(() => {
|
||||
if (!id) return
|
||||
msgDetail(id).then(rs => {
|
||||
if (!rs) return
|
||||
setDetail(rs)
|
||||
})
|
||||
}, [id])
|
||||
|
||||
// 返回页面
|
||||
const backFn = () => {
|
||||
Taro.getCurrentPages().length > 0 && Taro.navigateBack()
|
||||
}
|
||||
|
||||
|
||||
return <View className="message-frame h-screen text-base">
|
||||
<View className='addr-detail-title'>
|
||||
<Image src={backNav} className="square-35 absolute left-10 nav-icon" onClick={backFn} />
|
||||
消息中心
|
||||
</View>
|
||||
<View className="message-detail-container flex-col items-center">
|
||||
<View className="message-detail-title">{detail.title}</View>
|
||||
<View className="message-detail-time">{formatDateByStr(detail.created_at)}</View>
|
||||
<View className="message-detail-content">
|
||||
{detail.content}
|
||||
</View>
|
||||
</View>
|
||||
</View>
|
||||
}
|
||||
|
||||
|
||||
export default Login
|
32
src/pages/message-detail/index.scss
Normal file
@ -0,0 +1,32 @@
|
||||
.message-frame {
|
||||
min-height: 100vh;
|
||||
height: auto;
|
||||
font-size: 14px;
|
||||
font-family: Source Han Sans CN-Bold, Source Han Sans CN;
|
||||
background-color: #FBFBFD;
|
||||
font-weight: 400;
|
||||
color: #000000;
|
||||
}
|
||||
|
||||
.message-detail-container {
|
||||
width: 100vw;
|
||||
padding: 24px;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.message-detail-title {
|
||||
font-size: 16px;
|
||||
color: #181A20;
|
||||
margin-top: 24px;
|
||||
}
|
||||
|
||||
.message-detail-time {
|
||||
color: rgba(94, 98, 114, 0.5);
|
||||
margin-top: 6px;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.message-detail-content {
|
||||
margin-top: 24px;
|
||||
color: #5E6272;
|
||||
}
|
3
src/pages/message-list/index.config.js
Normal file
@ -0,0 +1,3 @@
|
||||
export default definePageConfig({
|
||||
navigationBarTitleText: '消息中心'
|
||||
})
|
83
src/pages/message-list/index.jsx
Normal file
@ -0,0 +1,83 @@
|
||||
import { Image, Text, View } from "@tarojs/components"
|
||||
import next from '@/images/next.png'
|
||||
import './index.scss'
|
||||
import { useState } from "react"
|
||||
import Taro from "@tarojs/taro"
|
||||
import backNav from '@/images/backNav.png'
|
||||
import { useEffect } from "react"
|
||||
import { Infiniteloading } from "@nutui/nutui-react-taro"
|
||||
import empty from '@/images/empty.png'
|
||||
import { msgList } from "../../utils/api"
|
||||
import { formatDateByStr } from "../../utils/utils"
|
||||
|
||||
const Login = () => {
|
||||
const limit = 20
|
||||
const [page, setPage] = useState(1)
|
||||
const [list, setList] = useState([])
|
||||
const [total, setTotal] = useState(0)
|
||||
|
||||
useEffect(() => {
|
||||
const offset = (page - 1) * limit
|
||||
|
||||
msgList({ offset, limit }).then(re => {
|
||||
setList(it => [...it, ...re.items])
|
||||
setTotal(re.total)
|
||||
})
|
||||
}, [page])
|
||||
// 返回页面
|
||||
const backFn = () => {
|
||||
Taro.getCurrentPages().length > 0 && Taro.navigateBack()
|
||||
}
|
||||
|
||||
const navDetail = (id) => {
|
||||
Taro.navigateTo({
|
||||
url: '/pages/message-detail/index?id=' + id
|
||||
})
|
||||
}
|
||||
|
||||
return <View className="message-frame h-screen text-base">
|
||||
<View className='addr-detail-title'>
|
||||
<Image src={backNav} className="square-35 absolute left-10 nav-icon" onClick={backFn} />
|
||||
消息中心
|
||||
</View>
|
||||
<View className="message-list-container flex-col" id="newsScroll">
|
||||
|
||||
<Infiniteloading
|
||||
containerId="newsScroll"
|
||||
useWindow={false}
|
||||
loadTxt="loading"
|
||||
loadMoreTxt={<View></View>}
|
||||
loadIcon='loading'
|
||||
hasMore={total > list.length}
|
||||
onLoadMore={(x) => {
|
||||
setPage(p => p + 1)
|
||||
x()
|
||||
}}
|
||||
>
|
||||
{
|
||||
list.map(item => {
|
||||
return <View className="message-item flex-col items-center mt32" key={item.id}>
|
||||
<View className="message-time">{formatDateByStr(item.created_at)}</View>
|
||||
<View className="message-item-body mt-22">
|
||||
<View className="message-item-content">
|
||||
<View className="message-item-title">{item.title}</View>
|
||||
<View className="mt20">{item.summary}</View>
|
||||
</View>
|
||||
<View className="flex-between message-item-action" onClick={() => { navDetail(item.id) }}>
|
||||
<Text>查看详情</Text>
|
||||
<Image src={next} className="next-icon" />
|
||||
</View>
|
||||
</View>
|
||||
</View>
|
||||
})
|
||||
}
|
||||
</Infiniteloading>
|
||||
{
|
||||
!list.length && <Image src={empty} className="order-empty" />
|
||||
}
|
||||
</View>
|
||||
</View>
|
||||
}
|
||||
|
||||
|
||||
export default Login
|
46
src/pages/message-list/index.scss
Normal file
@ -0,0 +1,46 @@
|
||||
.message-frame {
|
||||
min-height: 100vh;
|
||||
height: auto;
|
||||
font-size: 14px;
|
||||
font-family: Source Han Sans CN-Bold, Source Han Sans CN;
|
||||
background-color: #FBFBFD;
|
||||
font-weight: 400;
|
||||
color: #000000;
|
||||
}
|
||||
|
||||
.message-list-container {
|
||||
padding: 21px;
|
||||
}
|
||||
|
||||
.message-item-body {
|
||||
width: 333px;
|
||||
background: #FFFFFF;
|
||||
border-radius: 10px 10px 10px 10px;
|
||||
opacity: 1;
|
||||
box-sizing: border-box;
|
||||
padding: 0 11px;
|
||||
}
|
||||
|
||||
.message-item-content {
|
||||
border-bottom: 1px solid rgba(0, 0, 0, 0.05);
|
||||
padding: 18px 0;
|
||||
color: #5E6272;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.message-item-action {
|
||||
height: 58px;
|
||||
font-weight: 400;
|
||||
color: rgba(0, 0, 0, 0.4);
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.message-time {
|
||||
color: #72778ac6;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.message-item-title {
|
||||
font-size: 16px;
|
||||
color: #000000;
|
||||
}
|
3
src/pages/message/index.config.js
Normal file
@ -0,0 +1,3 @@
|
||||
export default definePageConfig({
|
||||
navigationBarTitleText: '消息中心'
|
||||
})
|
49
src/pages/message/index.jsx
Normal file
@ -0,0 +1,49 @@
|
||||
import { Image, Text, View } from "@tarojs/components"
|
||||
import right from '@/images/right.png'
|
||||
import msg from '@/images/msg.png'
|
||||
import ling from '@/images/ling.png'
|
||||
import './index.scss'
|
||||
import { useState } from "react"
|
||||
import Taro from "@tarojs/taro"
|
||||
import backNav from '@/images/backNav.png'
|
||||
import { useEffect } from "react"
|
||||
|
||||
|
||||
const Login = () => {
|
||||
|
||||
// 返回页面
|
||||
const backFn = () => {
|
||||
Taro.getCurrentPages().length > 0 && Taro.navigateBack()
|
||||
}
|
||||
|
||||
|
||||
return <View className="message-frame h-screen text-base">
|
||||
<View className='addr-detail-title'>
|
||||
<Image src={backNav} className="square-35 absolute left-10 nav-icon" onClick={backFn} />
|
||||
消息中心
|
||||
</View>
|
||||
<View className="message-container">
|
||||
<View className="flex-between">
|
||||
<View className="flex-start">
|
||||
<View className="msg-icon-container flex-center">
|
||||
<Image src={msg} className="msg-icon" />
|
||||
</View>
|
||||
<Text className="message-title">消息中心</Text>
|
||||
</View>
|
||||
<Image src={right} className="msg-icon" />
|
||||
</View>
|
||||
<View className="flex-between mt25">
|
||||
<View className="flex-start">
|
||||
<View className="msg-icon-container flex-center">
|
||||
<Image src={ling} className="msg-icon" />
|
||||
</View>
|
||||
<Text className="message-title">系统消息</Text>
|
||||
</View>
|
||||
<Image src={right} className="msg-icon" />
|
||||
</View>
|
||||
</View>
|
||||
</View>
|
||||
}
|
||||
|
||||
|
||||
export default Login
|
35
src/pages/message/index.scss
Normal file
@ -0,0 +1,35 @@
|
||||
.message-frame {
|
||||
min-height: 100vh;
|
||||
height: auto;
|
||||
font-size: 14px;
|
||||
font-family: Source Han Sans CN-Bold, Source Han Sans CN;
|
||||
background-color: #FBFBFD;
|
||||
font-weight: 400;
|
||||
color: #000000;
|
||||
}
|
||||
|
||||
.message-container {
|
||||
box-sizing: border-box;
|
||||
padding: 0 20px;
|
||||
margin: 0 auto;
|
||||
margin-top: 18px;
|
||||
opacity: 1;
|
||||
font-weight: 400;
|
||||
color: #181A20;
|
||||
height: 125px;
|
||||
|
||||
}
|
||||
|
||||
.msg-icon-container {
|
||||
width: 43px;
|
||||
height: 42px;
|
||||
background: rgba(246, 121, 82, 0.07);
|
||||
border-radius: 10px 10px 10px 10px;
|
||||
opacity: 1;
|
||||
margin-right: 14px;
|
||||
}
|
||||
|
||||
.msg-icon {
|
||||
width: 24px;
|
||||
height: 24px;
|
||||
}
|
@ -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 <View className="login-frame bg-slate-50 h-screen text-base">
|
||||
<View className='addr-detail-title'>
|
||||
@ -30,13 +56,17 @@ const Login = () => {
|
||||
|
||||
</View>
|
||||
<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">
|
||||
<View className="bank-name">xxx银行</View>
|
||||
<View className="bank-number">123456789777</View>
|
||||
</View>
|
||||
<View className="card-item-des">解除绑定</View>
|
||||
</View>
|
||||
{
|
||||
card.map(item => {
|
||||
return <View className="card-item flex-col justify-center" key={item.id}>
|
||||
<View className="flex-between">
|
||||
<View className="bank-name">{item.account_name} {item.bank_name}</View>
|
||||
<View className="bank-number">{item.account_number}</View>
|
||||
</View>
|
||||
<View className="card-item-des" onClick={() => { del(item.id) }}>解除绑定</View>
|
||||
</View>
|
||||
})
|
||||
}
|
||||
<View className="change-phone-footer flex flex-col justify-center">
|
||||
<Button className="login-btn" onClick={navCreate}>新增银行</Button>
|
||||
</View>
|
||||
|
@ -53,9 +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;
|
||||
}
|
@ -1,14 +1,17 @@
|
||||
import React from 'react'
|
||||
import { Image, Swiper, SwiperItem, Text, View } from '@tarojs/components'
|
||||
import { Image, Text, View } from '@tarojs/components'
|
||||
import './index.scss'
|
||||
|
||||
import { useEffect } from 'react';
|
||||
import { useState } from 'react';
|
||||
import backNav from '@/images/backNav.png'
|
||||
import next from '@/images/next.png'
|
||||
import success from '@/images/success.png'
|
||||
import clock from '@/images/clock.png'
|
||||
import tick from '@/images/tick.png'
|
||||
import Taro from '@tarojs/taro';
|
||||
import { useRouter } from '@tarojs/taro';
|
||||
import { Button } from '@nutui/nutui-react-taro';
|
||||
import { Popup } from '@nutui/nutui-react-taro';
|
||||
import { formatDateByStr, navigateTo, orderState, orderStateNotice } from '../../utils/utils';
|
||||
import { orderList } from '../../utils/api';
|
||||
|
||||
|
||||
|
||||
@ -16,12 +19,20 @@ function Index() {
|
||||
|
||||
const param = useRouter().params
|
||||
const [id] = useState(param.id)
|
||||
const [chanel] = useState('all')
|
||||
const [actionVisible, setActionVisible] = useState(false)
|
||||
const [actionText, setActionText] = useState('')
|
||||
const [detail, setDetail] = useState({})
|
||||
|
||||
const [swiperProgress, setSwiperProgress] = useState(1)
|
||||
|
||||
|
||||
useEffect(() => {
|
||||
|
||||
if (!id) return
|
||||
orderList(chanel, { id }).then(re => {
|
||||
if (!re) return
|
||||
if (!re.items?.length) return
|
||||
setDetail(re.items[0])
|
||||
})
|
||||
|
||||
}, [id])
|
||||
|
||||
@ -52,17 +63,18 @@ function Index() {
|
||||
订单详情
|
||||
</View>
|
||||
<View className='order-detail-state flex-between'>
|
||||
<View>
|
||||
等待发货
|
||||
<View className='flex-center'>
|
||||
<Image src={detail.state == 'received' ? tick : clock} className='w-6 h-6 mr-1' />
|
||||
{orderState.get(detail.state)}
|
||||
</View>
|
||||
<Text>请耐心等待</Text>
|
||||
<Text>{orderStateNotice.get(detail.state)}</Text>
|
||||
</View>
|
||||
<View className='order-detail-body' >
|
||||
<View className='order-detail-address'>
|
||||
<View className='order-detail-address-area'>
|
||||
<View className='address-item'>
|
||||
<View className='address-item-name'>李四 18080093730</View>
|
||||
<View className='address-info'>四川省 成都市 天府二街</View>
|
||||
<View className='address-item-name'>{detail.recipient_name} {detail.recipient_phone}</View>
|
||||
<View className='address-info'>{`${detail.province?.name}${detail.city?.name}${detail.county?.name}${detail.address}`}</View>
|
||||
{/* <View className='address-item-name text-gold'>选择地址</View> */}
|
||||
</View>
|
||||
</View>
|
||||
@ -71,11 +83,11 @@ function Index() {
|
||||
<View className='order-detail-goods'>
|
||||
<View className='mt-22 order-detail-goods-title'>商品信息</View>
|
||||
<View className='order-detail-goods-info'>
|
||||
<Image className='order-detail-goods-img' />
|
||||
<Image className='order-detail-goods-img' src={detail.product?.cover_image} />
|
||||
<View className='order-detail-goods-content'>
|
||||
<View className='order-detail-goods-content-title line-clamp-1'>商品名称</View>
|
||||
<View className='order-detail-goods-content-title line-clamp-1'>{detail.product?.name}</View>
|
||||
<View className='order-detail-goods-content-price'>
|
||||
<View className='order-detail-goods-content-price-1'>¥199</View>
|
||||
<View className='order-detail-goods-content-price-1'>¥{detail.amount}</View>
|
||||
<View className='order-detail-goods-content-price-num'>x1</View>
|
||||
</View>
|
||||
</View>
|
||||
@ -83,7 +95,7 @@ function Index() {
|
||||
</View>
|
||||
<View className='order-detail-price-container'>
|
||||
<View>总价:</View>
|
||||
<View className='order-detail-price-p'>¥199</View>
|
||||
<View className='order-detail-price-p'>¥1{detail.amount}</View>
|
||||
</View>
|
||||
</View>
|
||||
|
||||
@ -91,19 +103,19 @@ function Index() {
|
||||
<View className='order-detail-title mt-22'>订单信息</View>
|
||||
<View className="flex-between order-detail-item">
|
||||
<Text>商品合计</Text>
|
||||
<Text className='order-detail-item-right'>¥199.00</Text>
|
||||
<Text className='order-detail-item-right'>¥{detail.amount}</Text>
|
||||
</View>
|
||||
<View className="flex-between order-detail-item">
|
||||
<Text>运费</Text>
|
||||
<Text className='order-detail-item-right'>¥199.00</Text>
|
||||
<Text className='order-detail-item-right'>¥0</Text>
|
||||
</View>
|
||||
<View className="flex-between order-detail-item">
|
||||
<Text>优惠券</Text>
|
||||
<Text className='order-detail-item-right'>¥199.00</Text>
|
||||
<Text className='order-detail-item-right'>¥0</Text>
|
||||
</View>
|
||||
<View className="flex-between order-detail-item">
|
||||
<Text>购物金折扣</Text>
|
||||
<Text className='order-detail-item-right'>¥199.00</Text>
|
||||
<Text className='order-detail-item-right'>¥{detail.channel == 'shopping_score_mall' ? detail.amount : 0}</Text>
|
||||
</View>
|
||||
</View>
|
||||
|
||||
@ -111,25 +123,29 @@ function Index() {
|
||||
<View className="flex-between order-detail-item">
|
||||
<Text>订单编号</Text>
|
||||
<View className='flex-center'>
|
||||
<Text className='order-detail-item-right'>32842942342</Text>
|
||||
<Text className='order-detail-item-right'>{detail.id}</Text>
|
||||
<View className='order-detail-copy flex-center' onClick={() => {
|
||||
Taro.setClipboardData({
|
||||
data: '32842942342'
|
||||
data: detail.id
|
||||
})
|
||||
}}>复制</View>
|
||||
</View>
|
||||
</View>
|
||||
<View className="flex-between order-detail-item">
|
||||
<Text>提交时间</Text>
|
||||
<Text className='order-detail-item-right'>2017-05-01 16:00</Text>
|
||||
<Text className='order-detail-item-right'>{formatDateByStr(detail.created_at)}</Text>
|
||||
</View>
|
||||
<View className="flex-between order-detail-item">
|
||||
<Text>支付方式</Text>
|
||||
<Text className='order-detail-item-right'>在线支付</Text>
|
||||
</View>
|
||||
</View>
|
||||
<View className='flex-end'>
|
||||
<View className='order-detail-algin-btn flex-center'>再次购买</View>
|
||||
<View className='flex-end order-detail-action'>
|
||||
{/* <View className='order-detail-btn flex-center order-btn-cancel'>取消订单</View>
|
||||
<View className='order-detail-btn flex-center order-btn-pay'>去支付</View> */}
|
||||
<View className='order-detail-algin-btn flex-center order-btn-algin' onClick={() => {
|
||||
navigateTo(`/pages/settle/index?id=${detail.product_id}`)
|
||||
}}>再次购买</View>
|
||||
</View>
|
||||
</View>
|
||||
)
|
||||
|
@ -207,13 +207,47 @@
|
||||
margin-left: 10px;
|
||||
}
|
||||
|
||||
.order-detail-algin-btn {
|
||||
.order-detail-btn {
|
||||
width: 145px;
|
||||
height: 55px;
|
||||
background: #FEEBE5;
|
||||
border-radius: 123px 123px 123px 123px;
|
||||
margin-left: 10px;
|
||||
}
|
||||
|
||||
.order-detail-btn:first {
|
||||
margin-left: 0;
|
||||
}
|
||||
|
||||
.order-detail-action {
|
||||
padding: 0 20px;
|
||||
}
|
||||
|
||||
.order-detail-algin-btn {
|
||||
@extend .order-detail-btn;
|
||||
background: #FEEBE5;
|
||||
opacity: 1;
|
||||
margin-top: 16px;
|
||||
color: #F67952;
|
||||
margin-right: 20px;
|
||||
|
||||
}
|
||||
|
||||
.order-btn-pay {
|
||||
background: #F67952;
|
||||
border: none;
|
||||
color: #FFFFFF;
|
||||
}
|
||||
|
||||
.order-btn-cancel {
|
||||
background: rgba(246, 121, 82, 0.15);
|
||||
border: none;
|
||||
color: #F67952
|
||||
}
|
||||
|
||||
.order-btn-algin {
|
||||
border: 1px solid #F67952;
|
||||
color: #F67952
|
||||
}
|
||||
|
||||
.order-btn-delete {
|
||||
border: 1px solid rgba(0, 0, 0, 0.5);
|
||||
color: #5E6272;
|
||||
}
|
@ -9,21 +9,37 @@ import backNav from '@/images/backNav.png'
|
||||
import { Picker } from "@nutui/nutui-react-taro"
|
||||
import { Infiniteloading } from "@nutui/nutui-react-taro"
|
||||
import { useEffect } from "react"
|
||||
import { orderList } from "../../utils/api"
|
||||
import { navigateTo, orderState } from "../../utils/utils"
|
||||
import { useRouter } from "@tarojs/taro"
|
||||
|
||||
|
||||
|
||||
const Login = () => {
|
||||
|
||||
const [tabKey, setTabKey] = useState('0')
|
||||
const param = useRouter().params
|
||||
const limit = 20
|
||||
const [tabKey, setTabKey] = useState(param.state ?? '0')
|
||||
const [chanel] = useState('all')
|
||||
const [page, setPage] = useState(1)
|
||||
const [list, setList] = useState([])
|
||||
const [total, setTotal] = useState(0)
|
||||
|
||||
// 返回页面
|
||||
const backFn = () => {
|
||||
Taro.getCurrentPages().length > 0 && Taro.navigateBack()
|
||||
}
|
||||
|
||||
useEffect(() => { }, [tabKey])
|
||||
useEffect(() => {
|
||||
const offset = (page - 1) * limit
|
||||
let state = tabKey
|
||||
if (tabKey == '0') {
|
||||
state = ''
|
||||
}
|
||||
orderList(chanel, { state, offset, limit }).then(re => {
|
||||
setList(it => [...it, ...re.items])
|
||||
setTotal(re.total)
|
||||
})
|
||||
}, [tabKey, page])
|
||||
|
||||
|
||||
return <View className="order-frame bg-slate-50 h-screen text-base">
|
||||
@ -36,9 +52,9 @@ const Login = () => {
|
||||
|
||||
<View className="order-tabs flex-around">
|
||||
<View className={'order-tab-pane ' + (tabKey == '0' ? 'order-tab-pane-active' : '')} onClick={() => setTabKey('0')}>全部</View>
|
||||
<View className={'order-tab-pane ' + (tabKey == '1' ? 'order-tab-pane-active' : '')} onClick={() => setTabKey('1')}>待付款</View>
|
||||
<View className={'order-tab-pane ' + (tabKey == '2' ? 'order-tab-pane-active' : '')} onClick={() => setTabKey('2')}>待发货</View>
|
||||
<View className={'order-tab-pane ' + (tabKey == '3' ? 'order-tab-pane-active' : '')} onClick={() => setTabKey('3')}>已完成</View>
|
||||
<View className={'order-tab-pane ' + (tabKey == 'paid' ? 'order-tab-pane-active' : '')} onClick={() => setTabKey('paid')}>待发货</View>
|
||||
<View className={'order-tab-pane ' + (tabKey == 'sent' ? 'order-tab-pane-active' : '')} onClick={() => setTabKey('sent')}>已发货</View>
|
||||
<View className={'order-tab-pane ' + (tabKey == 'received' ? 'order-tab-pane-active' : '')} onClick={() => setTabKey('received')}>已收货</View>
|
||||
</View>
|
||||
<View className="orderScroll" id="orderScroll">
|
||||
{
|
||||
@ -46,38 +62,45 @@ const Login = () => {
|
||||
containerId="orderScroll"
|
||||
useWindow={false}
|
||||
loadTxt="loading"
|
||||
loadMoreTxt="没有数据啦~"
|
||||
loadMoreTxt={<View></View>}
|
||||
loadIcon='loading'
|
||||
hasMore={false}
|
||||
hasMore={total > list.length}
|
||||
onLoadMore={(x) => {
|
||||
setPage(p => p + 1)
|
||||
x()
|
||||
}}
|
||||
>
|
||||
<View className="order-item-container mt20 flex-col">
|
||||
<View className="flex-between">
|
||||
<Text>订单号:1947034434</Text>
|
||||
<Text className="text-gold">等待付款</Text>
|
||||
</View>
|
||||
<View className="order-goods flex-between">
|
||||
<View className="order-goods-left flex-start">
|
||||
<Image src={'https://img.yzcdn.cn/vant/cat.jpeg'} className="order-goods-img" />
|
||||
<View className="flex-col ml17">
|
||||
<Text>商品名称</Text>
|
||||
<Text>¥199.00</Text>
|
||||
{
|
||||
list.map(item => {
|
||||
return <View className="order-item-container mt20 flex-col" key={item.id}>
|
||||
<View className="flex-between">
|
||||
<Text>订单号:{item.id}</Text>
|
||||
<Text className="text-gold">{orderState.get(item.state)}</Text>
|
||||
</View>
|
||||
<View className="order-goods flex-between" onClick={() => Taro.navigateTo({ url: `/pages/order-detail/index?id=${item.id}` })}>
|
||||
<View className="order-goods-left flex-start">
|
||||
<Image src={item.product.cover_image} className="order-goods-img" />
|
||||
<View className="flex-col ml17">
|
||||
<Text>{item.product.name}</Text>
|
||||
<Text>¥{item.amount}</Text>
|
||||
</View>
|
||||
</View>
|
||||
<View className="order-goods-num">X1</View>
|
||||
</View>
|
||||
<View className="order-goods-action flex-between">
|
||||
<View className="order-goods-settle">
|
||||
<Text>已付金额:</Text>
|
||||
<Text className="text-gold">¥{item.amount}</Text>
|
||||
</View>
|
||||
<Button className="order-goods-btn flex-center order-btn-algin" onClick={() => {
|
||||
navigateTo(`/pages/settle/index?id=${item.product_id}`)
|
||||
}}>再次购买</Button>
|
||||
{/* <Button className="order-goods-btn flex-center order-btn-pay">立即付款</Button> */}
|
||||
</View>
|
||||
</View>
|
||||
<View className="order-goods-num">X1</View>
|
||||
</View>
|
||||
<View className="order-goods-action flex-between">
|
||||
<View className="order-goods-settle">
|
||||
<Text>已付金额:</Text>
|
||||
<Text className="text-gold">¥19999.00</Text>
|
||||
</View>
|
||||
<Button className="order-goods-btn flex-center order-btn-cancel">取消订单</Button>
|
||||
<Button className="order-goods-btn flex-center order-btn-pay">立即付款</Button>
|
||||
</View>
|
||||
</View>
|
||||
})
|
||||
}
|
||||
|
||||
</Infiniteloading>
|
||||
}
|
||||
{
|
||||
|
@ -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;
|
||||
}
|
@ -15,7 +15,7 @@ function Index() {
|
||||
// 跳转
|
||||
const navDetailFn = (id) => {
|
||||
Taro.navigateTo({
|
||||
url: `/pages/goods-detail/index?id=${id}`
|
||||
url: `/pages/order/index`
|
||||
})
|
||||
}
|
||||
// 返回页面
|
||||
|
@ -7,6 +7,8 @@ import './index.scss'
|
||||
import { Button } from "@nutui/nutui-react-taro"
|
||||
import { useState } from "react"
|
||||
import Taro from "@tarojs/taro"
|
||||
import { register, sendCode } from "../../utils/api"
|
||||
import { GetData } from "../../utils/storage"
|
||||
|
||||
const activeEye = eye
|
||||
|
||||
@ -32,7 +34,7 @@ const Login = () => {
|
||||
|
||||
|
||||
// 倒计时
|
||||
const countDown = () => {
|
||||
const countDown = async () => {
|
||||
if (!mobile) {
|
||||
return
|
||||
}
|
||||
@ -50,6 +52,35 @@ const Login = () => {
|
||||
setIntervalTime(start)
|
||||
}
|
||||
}, 1000)
|
||||
const re = await sendCode(mobile)
|
||||
if (!re) return
|
||||
Taro.showToast({ title: '验证码发送成功', icon: 'success' })
|
||||
}
|
||||
|
||||
const registerFn = async () => {
|
||||
if (!mobile || !smsCode || !pwd || !confirmPassword || !payPassword || !confirmPayPassword) {
|
||||
Taro.showToast({ title: '请完善注册参数', icon: 'error' })
|
||||
return
|
||||
}
|
||||
Taro.showLoading({ title: '正在注册中~', })
|
||||
const inviteCode = GetData("inviteCode")
|
||||
const re = await register({
|
||||
nick_name: mobile,
|
||||
phone: mobile,
|
||||
verification_code: smsCode,
|
||||
password: pwd,
|
||||
confirm_password: confirmPassword,
|
||||
pay_password: payPassword,
|
||||
confirm_pay_pwd: confirmPayPassword,
|
||||
invite_code: inviteCode
|
||||
})
|
||||
Taro.hideLoading()
|
||||
if (re) {
|
||||
Taro.showToast({ title: '注册成功', icon: 'success' })
|
||||
setTimeout(() => {
|
||||
Taro.redirectTo({ url: '/pages/login/index' })
|
||||
}, 1000)
|
||||
}
|
||||
}
|
||||
|
||||
return <View className="login-frame bg-slate-50 h-screen text-base">
|
||||
@ -61,7 +92,7 @@ const Login = () => {
|
||||
<View className="form-item ">
|
||||
<View className="form-label">手机号</View>
|
||||
<View className="form-control relative">
|
||||
<Input className="form-input" placeholder="请输手机号" placeholderClass="form-input-placeholder" onInput={(v) => {
|
||||
<Input className="form-input" placeholder="请输手机号" required placeholderClass="form-input-placeholder" onInput={(v) => {
|
||||
setMobile(v.detail.value)
|
||||
}} />
|
||||
{
|
||||
@ -124,7 +155,7 @@ const Login = () => {
|
||||
</View>
|
||||
</View>
|
||||
<View className="login-footer flex flex-col justify-center">
|
||||
<Button className="login-btn">注册</Button>
|
||||
<Button className="login-btn" onClick={registerFn}>注册</Button>
|
||||
</View>
|
||||
</View>
|
||||
|
||||
|
@ -1,3 +1,3 @@
|
||||
export default definePageConfig({
|
||||
navigationBarTitleText: '我的积分'
|
||||
navigationBarTitleText: '我的购物金'
|
||||
})
|
||||
|
@ -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 <View className="cash-frame bg-slate-50 h-screen text-base">
|
||||
<View className='addr-detail-title'>
|
||||
<Image src={backNav} className="square-35 absolute left-10 nav-icon" onClick={backFn} />
|
||||
我的积分
|
||||
我的购物金
|
||||
|
||||
</View>
|
||||
<View className="scope-container relative">
|
||||
<View className="scope-amount flex-col ">
|
||||
<View className="flex-between mt-22">
|
||||
<Text>当前积分</Text>
|
||||
<Text className="scope-amount-price">50000</Text>
|
||||
<Text>我的余额</Text>
|
||||
<Text className="scope-amount-price">{user.shopping_score}</Text>
|
||||
</View>
|
||||
</View>
|
||||
|
||||
<View className="amount-container">
|
||||
<View className="amount-tabs flex-around">
|
||||
<View className={'tab-pane ' + (tabKey == '0' ? 'tab-pane-active' : '')} onClick={() => setTabKey('0')}>余额流水</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="amount-tabs flex-start">
|
||||
<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 == '2' ? 'tab-pane-active' : '')} onClick={() => setTabKey('2')}>提现记录</View> */}
|
||||
</View>
|
||||
<View className="scopeScroll" id="scopeScroll">
|
||||
<Infiniteloading
|
||||
containerId="scopeScroll"
|
||||
useWindow={false}
|
||||
loadTxt="loading"
|
||||
loadMoreTxt="没有数据啦~"
|
||||
loadIcon='loading'
|
||||
hasMore={false}
|
||||
onLoadMore={(x) => {
|
||||
setPage(p => p + 1)
|
||||
x()
|
||||
}}
|
||||
>
|
||||
<View className="amount-item flex-between">
|
||||
<View className="amount-item-detail flex-col">
|
||||
<View>完成每日登陆</View>
|
||||
<View className="amount-item-time">2021/04/09 19:42:36</View>
|
||||
</View>
|
||||
<View className="amount-item-log">+1.00</View>
|
||||
</View>
|
||||
|
||||
<View className="amount-item flex-between">
|
||||
<View className="amount-item-detail flex-col">
|
||||
<View>完成每日登陆</View>
|
||||
<View className="amount-item-time">2021/04/09 19:42:36</View>
|
||||
</View>
|
||||
<View className="amount-item-log">+1.00</View>
|
||||
</View>
|
||||
</Infiniteloading>
|
||||
{
|
||||
!!list.length && <Infiniteloading
|
||||
containerId="scopeScroll"
|
||||
useWindow={false}
|
||||
loadTxt="loading"
|
||||
loadMoreTxt="没有数据啦~"
|
||||
loadIcon='loading'
|
||||
hasMore={total >= list.length}
|
||||
onLoadMore={(x) => {
|
||||
setPage(p => p + 1)
|
||||
x()
|
||||
}}
|
||||
>
|
||||
{
|
||||
list.map(item => {
|
||||
return <View className="amount-item flex-between" key={item.id}>
|
||||
<View className="amount-item-detail flex-col">
|
||||
<View>{item.memo}</View>
|
||||
<View className="amount-item-time">{formatDateByStr(item.created_at)}</View>
|
||||
</View>
|
||||
<View className="amount-item-log">{item.amount > 0 ? `+${item.amount}` : `${item.amount}`}</View>
|
||||
</View>
|
||||
})
|
||||
}
|
||||
</Infiniteloading>
|
||||
}
|
||||
{
|
||||
!list.length && <Image src={empty} className="order-empty" />
|
||||
}
|
||||
</View>
|
||||
</View>
|
||||
|
||||
|
3
src/pages/setting/index.config.js
Normal file
@ -0,0 +1,3 @@
|
||||
export default definePageConfig({
|
||||
navigationBarTitleText: '设置'
|
||||
})
|
52
src/pages/setting/index.jsx
Normal file
@ -0,0 +1,52 @@
|
||||
import { Image, Text, View } from "@tarojs/components"
|
||||
import next from '@/images/next.png'
|
||||
import './index.scss'
|
||||
import { useState } from "react"
|
||||
import Taro from "@tarojs/taro"
|
||||
import backNav from '@/images/backNav.png'
|
||||
import { useEffect } from "react"
|
||||
import { CleanData, DelData } from "../../utils/storage"
|
||||
import { navigateTo, redirectTo } from "../../utils/utils"
|
||||
|
||||
|
||||
const Login = () => {
|
||||
|
||||
|
||||
|
||||
// 返回页面
|
||||
const backFn = () => {
|
||||
Taro.getCurrentPages().length > 0 && Taro.navigateBack()
|
||||
}
|
||||
|
||||
|
||||
const navAboutMe = () => {
|
||||
Taro.navigateTo({
|
||||
url: '/pages/about-me/index'
|
||||
})
|
||||
}
|
||||
|
||||
const loginOut = () => {
|
||||
CleanData()
|
||||
redirectTo('/pages/login/index')
|
||||
}
|
||||
|
||||
return <View className="setting-frame h-screen text-base">
|
||||
<View className='addr-detail-title'>
|
||||
<Image src={backNav} className="square-35 absolute left-10 nav-icon" onClick={backFn} />
|
||||
系统设置
|
||||
</View>
|
||||
<View className="setting-container">
|
||||
<View className="flex-between setting-item" onClick={navAboutMe}>
|
||||
<Text>关于我们</Text>
|
||||
<Image src={next} className="next-icon" />
|
||||
</View>
|
||||
<View className="flex-between setting-item" onClick={loginOut}>
|
||||
<Text>退出登陆</Text>
|
||||
<Image src={next} className="next-icon" />
|
||||
</View>
|
||||
</View>
|
||||
</View>
|
||||
}
|
||||
|
||||
|
||||
export default Login
|
26
src/pages/setting/index.scss
Normal file
@ -0,0 +1,26 @@
|
||||
.setting-frame {
|
||||
min-height: 100vh;
|
||||
height: auto;
|
||||
font-size: 14px;
|
||||
font-family: Source Han Sans CN-Bold, Source Han Sans CN;
|
||||
background-color: #FBFBFD;
|
||||
}
|
||||
|
||||
.setting-container {
|
||||
width: 333px;
|
||||
box-sizing: border-box;
|
||||
padding: 0 20px;
|
||||
margin: 0 auto;
|
||||
margin-top: 18px;
|
||||
background: #FFFFFF;
|
||||
box-shadow: 4px 7px 9px 0px rgba(56, 63, 68, 0.03);
|
||||
border-radius: 10px 10px 10px 10px;
|
||||
opacity: 1;
|
||||
font-weight: 400;
|
||||
color: #181A20;
|
||||
}
|
||||
|
||||
.setting-item {
|
||||
height: 56px;
|
||||
border-bottom: 1px solid #ededed6f;
|
||||
}
|
@ -9,6 +9,11 @@ import next from '@/images/next.png'
|
||||
import Taro from '@tarojs/taro';
|
||||
import { useRouter } from '@tarojs/taro';
|
||||
import { Button } from '@nutui/nutui-react-taro';
|
||||
import { getAddress, mallDetail, order } from '../../utils/api';
|
||||
import { GetData } from '../../utils/storage';
|
||||
import { useDidShow } from '@tarojs/taro';
|
||||
import { useLoad } from '@tarojs/taro';
|
||||
import { closeLoading, loading } from '../../utils/utils';
|
||||
|
||||
|
||||
|
||||
@ -16,26 +21,64 @@ function Index() {
|
||||
|
||||
const param = useRouter().params
|
||||
const [id] = useState(param.id)
|
||||
|
||||
const [swiperProgress, setSwiperProgress] = useState(1)
|
||||
const list = [
|
||||
'https://storage.360buyimg.com/jdc-article/NutUItaro34.jpg',
|
||||
'https://storage.360buyimg.com/jdc-article/NutUItaro2.jpg',
|
||||
'https://storage.360buyimg.com/jdc-article/welcomenutui.jpg'
|
||||
]
|
||||
const [aid, setAid] = useState(param.aid)
|
||||
const [scene] = useState('mall')
|
||||
const [addrData, setAddrData] = useState({})
|
||||
const [info, setInfo] = useState({})
|
||||
|
||||
|
||||
|
||||
useEffect(() => {
|
||||
console.log(id, "xxx")
|
||||
if (!id) return
|
||||
mallDetail(id).then(re => {
|
||||
if (!re) return
|
||||
setInfo(re)
|
||||
})
|
||||
if (!aid && !!addrData.id) {
|
||||
return
|
||||
}
|
||||
getAddress().then(re => {
|
||||
if (!re) return
|
||||
const addr = re.items.filter(item => {
|
||||
if (aid) {
|
||||
return item.id == aid
|
||||
}
|
||||
return item.is_default
|
||||
})
|
||||
if (!!addr.length) {
|
||||
setAddrData(addr[0])
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
}, [id])
|
||||
}, [id, aid])
|
||||
|
||||
useDidShow(() => {
|
||||
const aa = GetData(id)
|
||||
setAid(aa)
|
||||
})
|
||||
|
||||
|
||||
// 跳转
|
||||
const navDetailFn = (id) => {
|
||||
const navDetailFn = async () => {
|
||||
if (!id) return
|
||||
loading('订单生成中,请稍后...')
|
||||
const re = await order(scene, {
|
||||
product_id: Number(id),
|
||||
address: addrData.address,
|
||||
recipient_name: addrData.recipient_name,
|
||||
recipient_phone: addrData.recipient_phone,
|
||||
province_id: addrData.province_id,
|
||||
city_id: addrData.city_id,
|
||||
county_id: addrData.county_id,
|
||||
zipcode: addrData.zipcode
|
||||
})
|
||||
closeLoading()
|
||||
console.log(re, "order")
|
||||
if (!re) return
|
||||
Taro.navigateTo({
|
||||
url: `/pages/pay-success/index?id=${id}`
|
||||
url: `/pages/pay-success/index?id=${re.id}`
|
||||
})
|
||||
}
|
||||
|
||||
@ -45,9 +88,9 @@ function Index() {
|
||||
}
|
||||
|
||||
// 选择地址
|
||||
const goAddr = (id) => {
|
||||
const goAddr = (aid) => {
|
||||
Taro.navigateTo({
|
||||
url: '/pages/address/index?id=' + id
|
||||
url: `/pages/address/index?gid=${id}&id=` + aid
|
||||
})
|
||||
}
|
||||
|
||||
@ -63,9 +106,9 @@ function Index() {
|
||||
<View className='address-title'>选择收货地址</View>
|
||||
<View className='address-area' onClick={() => { goAddr('') }}>
|
||||
<View className='address-item'>
|
||||
<View className='address-item-name'>李四 18080093730</View>
|
||||
<View className='address-info'>四川省 成都市 天府二街</View>
|
||||
{/* <View className='address-item-name text-gold'>选择地址</View> */}
|
||||
{!!addrData.id && <View className='address-item-name'>{addrData.recipient_name} {addrData.recipient_phone}</View>}
|
||||
{!!addrData.id && <View className='address-info'>{addrData.province?.name}{addrData.city.name}{addrData.county.name}{addrData.address}</View>}
|
||||
{!addrData.id && <View className='address-item-name text-gold'>选择地址</View>}
|
||||
</View>
|
||||
<View className='address-next'>
|
||||
<Image src={next} />
|
||||
@ -76,11 +119,11 @@ function Index() {
|
||||
<View className='settle-goods'>
|
||||
<View className='settle-goods-title'>商品信息</View>
|
||||
<View className='settle-goods-info'>
|
||||
<Image className='settle-goods-img' />
|
||||
<Image className='settle-goods-img' src={info.cover_image} />
|
||||
<View className='settle-goods-content'>
|
||||
<View className='settle-goods-content-title line-clamp-1'>商品名称</View>
|
||||
<View className='settle-goods-content-title line-clamp-1'>{info.name}</View>
|
||||
<View className='settle-goods-content-price'>
|
||||
<View className='settle-goods-content-price-1'>¥199</View>
|
||||
<View className='settle-goods-content-price-1'>¥{info.price}</View>
|
||||
<View className='settle-goods-content-price-num'>x1</View>
|
||||
</View>
|
||||
</View>
|
||||
@ -89,7 +132,7 @@ function Index() {
|
||||
|
||||
<View className='settle-price-container'>
|
||||
<View>总价:</View>
|
||||
<View className='settle-price-p'>¥199</View>
|
||||
<View className='settle-price-p'>¥{info.price * 1}</View>
|
||||
</View>
|
||||
</View>
|
||||
<Button className='buy-btn' onClick={navDetailFn}>去支付</Button>
|
||||
|
@ -10,27 +10,41 @@ import { useEffect } from 'react';
|
||||
import { useState } from 'react';
|
||||
|
||||
import Taro from '@tarojs/taro';
|
||||
import { mallList } from '../../utils/api';
|
||||
import { useRouter } from '@tarojs/taro';
|
||||
|
||||
|
||||
function Index() {
|
||||
|
||||
const param = useRouter().params
|
||||
const limit = 20
|
||||
const [list, setList] = useState([])
|
||||
const [total, setTotal] = useState(0)
|
||||
const [page, setPage] = useState(1)
|
||||
const [hasMore, setHasMore] = useState(true)
|
||||
const [chan] = useState(param.source != 'shopping_score_mall' ? 'mall' : 'shopping_score_mall')
|
||||
|
||||
|
||||
|
||||
useEffect(() => {
|
||||
if (list.length > 50) {
|
||||
setHasMore(false)
|
||||
if (page < 1) {
|
||||
return
|
||||
}
|
||||
let l = []
|
||||
for (let i = list.length; i < 10 + list.length; i++) {
|
||||
l.push(i)
|
||||
}
|
||||
setList([...list, ...l])
|
||||
|
||||
fetchList(page)
|
||||
}, [page])
|
||||
|
||||
const fetchList = async (page) => {
|
||||
|
||||
const offset = (page - 1) * limit
|
||||
const res = await mallList(chan, offset, limit)
|
||||
|
||||
if (!res) return
|
||||
if (res.items?.length + list.length >= res.total) {
|
||||
setHasMore(false)
|
||||
}
|
||||
setList(it => [...it, ...res.items])
|
||||
setTotal(res.total)
|
||||
}
|
||||
|
||||
|
||||
// 跳转
|
||||
const navDetailFn = (id) => {
|
||||
@ -59,22 +73,22 @@ function Index() {
|
||||
<View className='shopping-container '>
|
||||
{
|
||||
list.map(item => {
|
||||
return <View className='shopping-item' key={item} onClick={() => {
|
||||
navDetailFn(item)
|
||||
return <View className='shopping-item' key={item.id} onClick={() => {
|
||||
navDetailFn(item.id)
|
||||
}}>
|
||||
<View className='shopping-item-image'>
|
||||
<Image src='https://img.yzcdn.cn/vant/cat.jpeg' />
|
||||
<Image src={item.cover_image} />
|
||||
</View>
|
||||
<View className='shopping-item-content'>
|
||||
<View className='shopping-item-name line-clamp-2'>
|
||||
这个是商品的名称,但是可能有一点点的长
|
||||
{item.name}
|
||||
</View>
|
||||
<View className='shopping-item-desc line-clamp-2 '>
|
||||
{/* <View className='shopping-item-desc line-clamp-2 '>
|
||||
这个是商品的介绍
|
||||
</View>
|
||||
<View className='shopping-item-price text-right'>
|
||||
<Text className='shopping-item-price-sale'>¥199</Text>
|
||||
<Text className='shopping-item-price-origin'>原价888</Text>
|
||||
</View> */}
|
||||
<View className='shopping-item-price text-left'>
|
||||
<Text className='shopping-item-price-sale'>¥{item.price}</Text>
|
||||
{/* <Text className='shopping-item-price-origin'>原价888</Text> */}
|
||||
</View>
|
||||
</View>
|
||||
|
||||
|
@ -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 level2 from '@/images/level2.png'
|
||||
import teamIcon from '@/images/teamIcon.png'
|
||||
import eye from '@/images/eye.png'
|
||||
import './index.scss'
|
||||
import { Button } from "@nutui/nutui-react-taro"
|
||||
@ -9,19 +9,32 @@ import { useState } from "react"
|
||||
import Taro from "@tarojs/taro"
|
||||
import backNav from '@/images/backNav.png'
|
||||
import { Avatar } from "@nutui/nutui-react-taro"
|
||||
import { invitedAreas, invitedUser, userDetail } from "../../utils/api"
|
||||
import { useEffect } from "react"
|
||||
import { formatDateByStr } 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 [list, setList] = useState([])
|
||||
const [areas, setAreas] = useState({})
|
||||
|
||||
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)
|
||||
})
|
||||
}, [])
|
||||
|
||||
// 返回页面
|
||||
const backFn = () => {
|
||||
@ -29,44 +42,7 @@ const Login = () => {
|
||||
}
|
||||
|
||||
|
||||
// 去登陆
|
||||
const loginFn = () => {
|
||||
Taro.redirectTo({
|
||||
url: '/pages/login/index'
|
||||
})
|
||||
}
|
||||
|
||||
//清理数据
|
||||
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)
|
||||
}
|
||||
}, 1000)
|
||||
}
|
||||
|
||||
return <View className="login-frame team-page h-screen text-base">
|
||||
<View className='addr-detail-title'>
|
||||
@ -76,50 +52,44 @@ const Login = () => {
|
||||
|
||||
<View className="team-container flex-col items-center">
|
||||
<View className="team-logo flex-col items-center">
|
||||
<Image src={level2} className="team-logo-img" />
|
||||
<Text>城市合伙人</Text>
|
||||
<Image src={teamIcon} className="team-logo-img" />
|
||||
{
|
||||
user.is_city_partner && <Text>城市合伙人</Text>
|
||||
}
|
||||
<Text className="team-logo-text">我的等级</Text>
|
||||
</View>
|
||||
|
||||
<View className="team-pre-container flex-around">
|
||||
<View className="team-pre-item flex-col justify-center">
|
||||
<Text className="team-pre-price">0.00</Text>
|
||||
<View className="team-pre-item flex-col justify-center items-center">
|
||||
<Text className="team-pre-price">{areas.largest}</Text>
|
||||
<Text>大区业绩</Text>
|
||||
</View>
|
||||
<View className="team-pre-item flex-col justify-center">
|
||||
<Text className="team-pre-price">0.00</Text>
|
||||
<View className="team-pre-item flex-col justify-center items-center">
|
||||
<Text className="team-pre-price">{areas.lesser}</Text>
|
||||
<Text>小区业绩</Text>
|
||||
</View>
|
||||
</View>
|
||||
|
||||
<View className="invite-container flex-col items-start">
|
||||
<View className="invite-title">我邀请的人</View>
|
||||
<View className="invite-item flex-between">
|
||||
<View className="invite-item-left flex-start items-center">
|
||||
<Avatar size={42} icon="https://img12.360buyimg.com/imagetools/jfs/t1/143702/31/16654/116794/5fc6f541Edebf8a57/4138097748889987.png"
|
||||
/>
|
||||
<View className="flex-col invite-item-content">
|
||||
<Text>PB-60635</Text>
|
||||
<Text className="team-pre-item">2021-04-09</Text>
|
||||
|
||||
{
|
||||
list.map(item => {
|
||||
return <View className="invite-item flex-between" key={item.id}>
|
||||
<View className="invite-item-left flex-start items-center">
|
||||
<Avatar size={42} icon={item.avatar} alt={item.nick_name}
|
||||
/>
|
||||
<View className="flex-col invite-item-content">
|
||||
<Text>{item.nick_name}</Text>
|
||||
<Text className="team-pre-item">{formatDateByStr(item.created_at)}</Text>
|
||||
</View>
|
||||
</View>
|
||||
<View className="invite-level">
|
||||
<Text className="invite-level-text">{item.user_level?.name}</Text>
|
||||
</View>
|
||||
</View>
|
||||
</View>
|
||||
<View className="invite-level">
|
||||
<Text className="invite-level-text">V5</Text>
|
||||
</View>
|
||||
</View>
|
||||
<View className="invite-item flex-between">
|
||||
<View className="invite-item-left flex-start items-center">
|
||||
<Avatar size={42} icon="https://img12.360buyimg.com/imagetools/jfs/t1/143702/31/16654/116794/5fc6f541Edebf8a57/4138097748889987.png"
|
||||
/>
|
||||
<View className="flex-col invite-item-content">
|
||||
<Text>PB-60635</Text>
|
||||
<Text className="team-pre-item">2021-04-09</Text>
|
||||
</View>
|
||||
</View>
|
||||
<View className="invite-level">
|
||||
<Text className="invite-level-text">V5</Text>
|
||||
</View>
|
||||
</View>
|
||||
})
|
||||
}
|
||||
</View>
|
||||
</View>
|
||||
</View>
|
||||
|
@ -1,7 +1,7 @@
|
||||
.team-page {
|
||||
height: 100vh;
|
||||
font-size: 14px;
|
||||
background: #FBFBFD;
|
||||
background: #ededef80;
|
||||
font-family: Source Han Sans CN-Bold, Source Han Sans CN;
|
||||
}
|
||||
|
||||
@ -16,8 +16,8 @@
|
||||
}
|
||||
|
||||
.team-logo-img {
|
||||
width: 80px;
|
||||
height: 80px;
|
||||
width: 86px;
|
||||
height: 86px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
@ -49,6 +49,7 @@
|
||||
|
||||
.invite-container {
|
||||
margin-top: 20px;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.invite-title {
|
||||
@ -62,6 +63,7 @@
|
||||
width: 332px;
|
||||
height: 82px;
|
||||
background: #FFFFFF;
|
||||
box-shadow: -2px 8px 46px 0px rgba(37, 45, 50, 0.05);
|
||||
border-radius: 16px 16px 16px 16px;
|
||||
opacity: 1;
|
||||
margin-top: 16px;
|
||||
@ -78,7 +80,7 @@
|
||||
}
|
||||
|
||||
.invite-level {
|
||||
width: 38px;
|
||||
padding: 0 8px;
|
||||
height: 24px;
|
||||
background: linear-gradient(117deg, #0F1732 0%, #2F3A58 100%);
|
||||
border-radius: 12px;
|
||||
|
@ -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 <View className="transfer-frame bg-slate-50 h-screen text-base">
|
||||
<View className='addr-detail-title'>
|
||||
<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-amount flex-col justify-center">
|
||||
<Text>当前余额</Text>
|
||||
<Text className="transfer-amount-price">50000</Text>
|
||||
<Text className="transfer-amount-price">{user.score}</Text>
|
||||
</View>
|
||||
<View>
|
||||
<View className="form-item mt-22">
|
||||
@ -57,10 +96,10 @@ const Login = () => {
|
||||
<View className="form-label">确认对方账号</View>
|
||||
<View className="form-control relative">
|
||||
<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>
|
||||
@ -69,10 +108,10 @@ const Login = () => {
|
||||
<View className="form-label">转赠数量</View>
|
||||
<View className="form-control relative">
|
||||
<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>
|
||||
@ -92,7 +131,7 @@ const Login = () => {
|
||||
{
|
||||
account &&
|
||||
<View className="transfer-footer ">
|
||||
<Button className="transfer-btn">立即赠送</Button>
|
||||
<Button className="transfer-btn" onClick={submit}>立即赠送</Button>
|
||||
</View>
|
||||
}
|
||||
</View>
|
||||
|
@ -13,6 +13,9 @@ import { useRouter } from '@tarojs/taro';
|
||||
import { Button, Textarea, Address } from '@nutui/nutui-react-taro';
|
||||
import { Avatar } from '@nutui/nutui-react-taro';
|
||||
import { Overlay } from '@nutui/nutui-react-taro';
|
||||
import { modifyUser, userDetail } from '../../utils/api';
|
||||
import { closeLoading, errorNotice, loading, navigateTo, successNotice } from '../../utils/utils';
|
||||
import { upload } from '../../utils/request';
|
||||
|
||||
|
||||
|
||||
@ -21,11 +24,14 @@ function Index() {
|
||||
const param = useRouter().params
|
||||
const [id] = useState(param.id)
|
||||
const [visible, setVisible] = useState(false)
|
||||
const [user, setUser] = useState({})
|
||||
|
||||
useEffect(() => {
|
||||
|
||||
|
||||
}, [id])
|
||||
userDetail().then(rs => {
|
||||
if (!rs) return
|
||||
setUser(rs)
|
||||
})
|
||||
}, [])
|
||||
|
||||
|
||||
// 跳转
|
||||
@ -49,28 +55,40 @@ function Index() {
|
||||
|
||||
Taro.chooseImage({
|
||||
sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图,默认二者都有
|
||||
count: 1,
|
||||
sourceType: [type], // 可以指定来源是相册还是相机,默认二者都有,在H5浏览器端支持使用 `user` 和 `environment`分别指定为前后摄像头
|
||||
success: function (res) {
|
||||
success: async function (res) {
|
||||
setVisible(false)
|
||||
loading('头像上传中, 请稍后')
|
||||
// 返回选定照片的本地文件路径列表,tempFilePath可以作为img标签的src属性显示图片
|
||||
var tempFilePaths = res.tempFilePaths
|
||||
console.log(tempFilePaths)
|
||||
try {
|
||||
const re = await upload(tempFilePaths[0])
|
||||
const r = await modifyUser('avatar', re.url)
|
||||
closeLoading()
|
||||
if (!r) return
|
||||
successNotice('头像上传成功')
|
||||
setUser({ ...user, avatar: re.url })
|
||||
} catch {
|
||||
errorNotice('头像上传失败')
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
return (
|
||||
<View className='addr-container'>
|
||||
<View className='addr-detail-title'>
|
||||
<View className='userInfo-container'>
|
||||
<View className='userInfo-detail-title'>
|
||||
<Image src={backNav} className="square-35 absolute left-10 nav-icon" onClick={backFn} />
|
||||
编辑资料
|
||||
</View>
|
||||
|
||||
<View className='addr-body' >
|
||||
<View className=' addr-item'>
|
||||
<View className='userInfo-body' >
|
||||
<View className=' userInfo-item'>
|
||||
<View className='item-bg' >
|
||||
<View className='my-order-title flex-between'>
|
||||
<Avatar size={46} icon="https://img12.360buyimg.com/imagetools/jfs/t1/143702/31/16654/116794/5fc6f541Edebf8a57/4138097748889987.png"
|
||||
<Avatar size={46} icon={user.avatar} alt={user.nick_name}
|
||||
/>
|
||||
<View className='my-order-more flex-center' onClick={editAvatarFn}>
|
||||
<Text>修改头像</Text>
|
||||
@ -80,31 +98,37 @@ function Index() {
|
||||
</View>
|
||||
</View>
|
||||
|
||||
<View className='addr-item mt-22'>
|
||||
<View className='addr-form'>
|
||||
<View className='addr-form-name'>个人信息</View>
|
||||
<View className='flex justify-between items-center ' onClick={() => { setNormal(true) }}>
|
||||
<View className='userInfo-item mt-22'>
|
||||
<View className='userInfo-form' onClick={() => { navigateTo('/pages/change-user/index') }}>
|
||||
<View className='userInfo-form-name'>个人信息</View>
|
||||
<View className='flex justify-between items-center ' >
|
||||
<Label />
|
||||
<Image src={next} className='next-icon' />
|
||||
</View>
|
||||
</View>
|
||||
<View className='addr-form'>
|
||||
<View className='addr-form-name'>修改密码</View>
|
||||
<View className='flex justify-between items-center ' onClick={() => { setNormal(true) }}>
|
||||
<View className='userInfo-form' onClick={() => { navigateTo('/pages/change-pwd/index') }}>
|
||||
<View className='userInfo-form-name'>修改密码</View>
|
||||
<View className='flex justify-between items-center ' >
|
||||
|
||||
<Image src={next} className='next-icon' />
|
||||
</View>
|
||||
</View>
|
||||
<View className='addr-form'>
|
||||
<View className='addr-form-name'>修改手机号</View>
|
||||
<View className='flex justify-between items-center ' onClick={() => { setNormal(true) }}>
|
||||
<Label>18080093730</Label>
|
||||
<View className='userInfo-form' onClick={() => { navigateTo('/pages/change-phone/index') }}>
|
||||
<View className='userInfo-form-name'>修改手机号</View>
|
||||
<View className='flex justify-between items-center ' >
|
||||
<Label>{user.phone}</Label>
|
||||
<Image src={next} className='next-icon ml-2' />
|
||||
</View>
|
||||
</View>
|
||||
<View className='addr-form'>
|
||||
<View className='addr-form-name'>我的银行卡</View>
|
||||
<View className='flex justify-between items-center ' onClick={() => { setNormal(true) }}>
|
||||
<View className='userInfo-form' onClick={() => { navigateTo('/pages/my-card/index') }}>
|
||||
<View className='userInfo-form-name'>我的银行卡</View>
|
||||
<View className='flex justify-between items-center ' >
|
||||
<Image src={next} className='next-icon' />
|
||||
</View>
|
||||
</View>
|
||||
<View className='userInfo-form' onClick={() => { navigateTo('/pages/my-card/index') }}>
|
||||
<View className='userInfo-form-name'>申请城市合伙人</View>
|
||||
<View className='flex justify-between items-center ' >
|
||||
<Image src={next} className='next-icon' />
|
||||
</View>
|
||||
</View>
|
||||
|
@ -1,4 +1,4 @@
|
||||
.addr-container {
|
||||
.userInfo-container {
|
||||
font-family: Source Han Sans CN-Bold, Source Han Sans CN;
|
||||
font-size: 14px;
|
||||
background: #FBFBFD;
|
||||
@ -11,7 +11,7 @@
|
||||
border-radius: 16px 16px 16px 16px;
|
||||
}
|
||||
|
||||
.addr-detail-title {
|
||||
.userInfo-detail-title {
|
||||
width: 100vw;
|
||||
height: 60px;
|
||||
font-size: 18px;
|
||||
@ -24,7 +24,7 @@
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.addr-body {
|
||||
.userInfo-body {
|
||||
padding: 21px;
|
||||
height: auto;
|
||||
box-sizing: border-box;
|
||||
@ -34,7 +34,7 @@
|
||||
align-content: center;
|
||||
}
|
||||
|
||||
.addr-box {
|
||||
.userInfo-box {
|
||||
width: 333px;
|
||||
background: #FFFFFF;
|
||||
box-shadow: 4px 7px 9px 0px rgba(56, 63, 68, 0.03);
|
||||
@ -43,7 +43,7 @@
|
||||
padding: 0 12px;
|
||||
}
|
||||
|
||||
.addr-item {
|
||||
.userInfo-item {
|
||||
width: 333px;
|
||||
background: #FFFFFF;
|
||||
box-shadow: 4px 7px 9px 0px rgba(56, 63, 68, 0.03);
|
||||
@ -60,7 +60,7 @@
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.addr-form {
|
||||
.userInfo-form {
|
||||
width: 308px;
|
||||
box-sizing: border-box;
|
||||
height: 48px;
|
||||
@ -73,18 +73,18 @@
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.addr-form-name {
|
||||
.userInfo-form-name {
|
||||
font-weight: bold;
|
||||
color: #000000;
|
||||
font-size: 15px;
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
.addr-form-input {
|
||||
.userInfo-form-input {
|
||||
width: 230px;
|
||||
}
|
||||
|
||||
.addr-btn {
|
||||
.userInfo-btn {
|
||||
width: 233px;
|
||||
height: 55px;
|
||||
border-radius: 107px 107px 107px 107px;
|
||||
@ -98,12 +98,12 @@
|
||||
left: calc((100vw - 233px)/2);
|
||||
}
|
||||
|
||||
.addr-item>.nut-textarea {
|
||||
.userInfo-item>.nut-textarea {
|
||||
padding-left: 0;
|
||||
padding-right: 0;
|
||||
}
|
||||
|
||||
.addr-item .weui-input {
|
||||
.userInfo-item .weui-input {
|
||||
color: var(--nutui-textarea-text-color, var(--nutui-gray-1, #1a1a1a));
|
||||
|
||||
}
|
||||
|
130
src/utils/api.js
Normal file
@ -0,0 +1,130 @@
|
||||
import { d, put } from './request'
|
||||
import { g, p } from './request'
|
||||
|
||||
export const mallList = async (channel = 'mall', offset = 0, limit = 10) => {
|
||||
return await g(`/products/${channel}`, { limit, offset })
|
||||
}
|
||||
|
||||
export const mallDetail = async (id) => {
|
||||
return await g(`/products/detail/${id}`)
|
||||
}
|
||||
|
||||
|
||||
|
||||
export const login = async (account, pwd, code) => {
|
||||
return await p(`/users/login`, { phone: account, password: pwd, verification_code: code })
|
||||
}
|
||||
|
||||
export const register = async (data = {}) => {
|
||||
return await p(`/users/register`, data)
|
||||
}
|
||||
|
||||
export const sendCode = async (phone) => {
|
||||
return await p('/users/sms-verification-code', { phone })
|
||||
}
|
||||
|
||||
// 创建地址
|
||||
export const createAddress = async (data = {}) => {
|
||||
return await p(`/users/addresses`, data)
|
||||
}
|
||||
export const updateAddress = async (id, data = {}) => {
|
||||
return await put(`/users/addresses/${id}`, data)
|
||||
}
|
||||
|
||||
export const deleteAddress = async (id) => {
|
||||
return await d(`/users/addresses/${id}`)
|
||||
}
|
||||
|
||||
|
||||
export const getAddress = async (data = {}) => {
|
||||
return await g(`/users/addresses`, data)
|
||||
}
|
||||
// 获取城市
|
||||
export const cities = async (pid = 0) => {
|
||||
return await g('/cities', { pid })
|
||||
}
|
||||
|
||||
// 下单
|
||||
export const order = async (channel, data = {}) => {
|
||||
return await p(`/orders/${channel}`, data)
|
||||
}
|
||||
|
||||
export const orderList = async (channel, params = {}) => {
|
||||
return await g(`/orders/${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)
|
||||
}
|
||||
|
||||
|
||||
export const profitToScore = async (amount) => {
|
||||
return await p(`/users/assets/profit-to-score`, { amount })
|
||||
}
|
||||
|
||||
export const scoreWithdraw = async (data) => {
|
||||
return await p(`/users/assets/score-withdraw`, data)
|
||||
}
|
||||
|
||||
//
|
||||
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 invitedAreas = async () => {
|
||||
return await g(`/users/teams/invitee-areas`)
|
||||
}
|
||||
|
||||
export const configs = async () => {
|
||||
return await g('/config')
|
||||
}
|
||||
|
||||
export const msgList = async (params) => {
|
||||
return await g('/news', params)
|
||||
}
|
||||
|
||||
export const msgDetail = async (id) => {
|
||||
return await g(`/news/${id}`)
|
||||
}
|
||||
|
||||
|
||||
export const partners = async (data) => {
|
||||
return await p('/partners', data)
|
||||
}
|
143
src/utils/request.js
Normal file
@ -0,0 +1,143 @@
|
||||
import Taro from '@tarojs/taro';
|
||||
import config from '../config/config';
|
||||
import {
|
||||
DelData,
|
||||
GetData,
|
||||
JWT
|
||||
} from './storage';
|
||||
|
||||
const loginPages = '/pages/login/index';
|
||||
|
||||
function RequestError(message, code) {
|
||||
this.name = 'RequestError'
|
||||
this.message = message || '请求失败'
|
||||
this.code = code
|
||||
}
|
||||
// 基础请求
|
||||
// api/user/center_show , get param == contribution , base
|
||||
export function baseRequest(
|
||||
url,
|
||||
method = 'GET',
|
||||
data = {},
|
||||
base = config.api // https://api.yidongpaidui.com/
|
||||
) {
|
||||
if (config.debug) { // false
|
||||
base = config.debugApi
|
||||
}
|
||||
let jwt = GetData(JWT);
|
||||
jwt = typeof jwt === 'string' ? jwt : ''
|
||||
let header = {
|
||||
'Content-Type': 'application/json',
|
||||
'Jwt': `Bearer ${jwt}`,
|
||||
'Authorization': 'Bearer ' + jwt
|
||||
}
|
||||
|
||||
return Taro.request({
|
||||
url: base + url,
|
||||
data: data,
|
||||
dataType: "json",
|
||||
method: method,
|
||||
header: header
|
||||
}).then(re => {
|
||||
if (config.debug) {
|
||||
console.log(`1、${method} debug request url is: ${url}\r\n2、request Data : `, data, '\r\n3、request header:', header, '\r\n4、response Data is :', re);
|
||||
}
|
||||
let msg = '请求失败'
|
||||
if (re.statusCode !== 200 || re.data.error.code != 0) {
|
||||
msg = re.data.error.message
|
||||
if (!!msg) {
|
||||
Taro.showModal({
|
||||
"title": "信息提示",
|
||||
showCancel: false,
|
||||
"content": msg,
|
||||
mask: true
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
if (re.data.error.code.toString() === '40101') {
|
||||
DelData(JWT)
|
||||
const current = Taro.getCurrentPages()
|
||||
const route = current[0].route
|
||||
if (route != 'pages/login/index') {
|
||||
Taro.navigateTo({
|
||||
url: loginPages
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
RequestError.prototype = Object.create(Error.prototype)
|
||||
RequestError.prototype.constructor = RequestError
|
||||
return null
|
||||
}
|
||||
return re.data.data
|
||||
})
|
||||
}
|
||||
|
||||
// post
|
||||
export function p(url, data, base) {
|
||||
return baseRequest(url, 'POST', data, base)
|
||||
}
|
||||
|
||||
// get
|
||||
export function g(url, data, base) {
|
||||
// api/user/center_show , get param == contribution , base
|
||||
return baseRequest(url, 'GET', data, base)
|
||||
}
|
||||
|
||||
// delete
|
||||
export function d(url, data, base) {
|
||||
return baseRequest(url, 'DELETE', data, base)
|
||||
}
|
||||
|
||||
//put
|
||||
export function put(url, data, base) {
|
||||
return baseRequest(url, 'PUT', data, base)
|
||||
}
|
||||
|
||||
|
||||
|
||||
// 上传图片
|
||||
export const upload = async (file) => {
|
||||
let base = config.api
|
||||
if (config.debug) {
|
||||
// base = config.debugApi
|
||||
}
|
||||
let jwt = GetData(JWT);
|
||||
jwt = typeof jwt === 'string' ? jwt : ''
|
||||
let header = {
|
||||
// 'Jwt': `Bearer ${jwt}`,
|
||||
'Authorization': 'Bearer ' + jwt
|
||||
}
|
||||
try {
|
||||
const re = await Taro.uploadFile({
|
||||
url: `${base}/files`,
|
||||
filePath: file,
|
||||
name: 'file',
|
||||
header: header,
|
||||
fileName: 'file',
|
||||
withCredentials: false
|
||||
})
|
||||
|
||||
if (re.statusCode == 200) {
|
||||
const resp = JSON.parse(re.data)
|
||||
if (resp.hasOwnProperty("data")) {
|
||||
return resp.data
|
||||
}
|
||||
}
|
||||
} catch {
|
||||
Taro.showModal({
|
||||
"title": "信息提示",
|
||||
showCancel: false,
|
||||
"content": "上传失败",
|
||||
mask: true
|
||||
})
|
||||
return null
|
||||
}
|
||||
|
||||
RequestError.prototype = Object.create(Error.prototype)
|
||||
RequestError.prototype.constructor = RequestError
|
||||
return null
|
||||
|
||||
}
|
||||
|
70
src/utils/storage.js
Normal file
@ -0,0 +1,70 @@
|
||||
import Taro from '@tarojs/taro';
|
||||
|
||||
// storage key
|
||||
export const JWT = '_jujwt'; // jwt
|
||||
export const JWTEXPIRE = 24 * 3600; // jwt 过期时间
|
||||
export const OPENDATA = '_d' // 微信开放数据 openid unionId sessionKey
|
||||
export const WXUSERINFO = '_wu' // 微信GetUserInfo 数据
|
||||
export const USERINFO = '_u' // 用户信息
|
||||
export const TASKKEY = "_task" // 任务key
|
||||
|
||||
// 同步设置缓存
|
||||
export function SetData(key, data, t = 0) {
|
||||
if (t > 0) {
|
||||
let time = (new Date()).getTime()
|
||||
time = Number(String(time).substr(0, 10))
|
||||
t = time + t
|
||||
}
|
||||
let storage = {
|
||||
expire: t,
|
||||
_data: data
|
||||
}
|
||||
return Taro.setStorageSync(key, storage)
|
||||
|
||||
}
|
||||
|
||||
// 异步设置缓存
|
||||
export function SetAsyncData(key, data, t = 0) {
|
||||
if (t > 0) {
|
||||
let time = (new Date()).getTime()
|
||||
time = Number(String(time).substr(0, 10))
|
||||
t = time + t
|
||||
}
|
||||
let storage = {
|
||||
expire: t,
|
||||
_data: data
|
||||
}
|
||||
return Taro.setStorage({
|
||||
key: key,
|
||||
data: storage
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
// 取出缓存 -- _jujwt
|
||||
export function GetData(key) {
|
||||
let storage = Taro.getStorageSync(key)
|
||||
if (!storage) {
|
||||
return {}
|
||||
}
|
||||
if (storage.expire > 0) {
|
||||
let time = (new Date()).getTime()
|
||||
time = Number(String(time).substr(0, 10))
|
||||
if (time > storage.expire) {
|
||||
DelData(key)
|
||||
return {}
|
||||
}
|
||||
}
|
||||
return storage._data
|
||||
}
|
||||
|
||||
// 删除缓存
|
||||
export function DelData(key) {
|
||||
return Taro.removeStorage({
|
||||
key: key
|
||||
})
|
||||
}
|
||||
|
||||
export function CleanData(key) {
|
||||
return Taro.clearStorage()
|
||||
}
|
76
src/utils/utils.js
Normal file
@ -0,0 +1,76 @@
|
||||
import Taro from "@tarojs/taro"
|
||||
|
||||
export const orderState = new Map([
|
||||
['paid', '待发货'],
|
||||
['sent', '已发货'],
|
||||
['received', '已收货'],
|
||||
])
|
||||
|
||||
export const orderStateNotice = new Map([
|
||||
['paid', '请耐心等待'],
|
||||
['sent', '请耐心等待'],
|
||||
['received', ''],
|
||||
])
|
||||
|
||||
|
||||
export const successNotice = (content) => {
|
||||
Taro.showToast({ title: content, icon: 'success' })
|
||||
}
|
||||
|
||||
export const errorNotice = (content) => {
|
||||
Taro.showToast({ title: content, icon: 'error' })
|
||||
}
|
||||
|
||||
|
||||
export const loading = (title = '加载中') => {
|
||||
Taro.showLoading({ title })
|
||||
}
|
||||
|
||||
export const closeLoading = () => {
|
||||
Taro.hideLoading()
|
||||
}
|
||||
|
||||
|
||||
export const redirectTo = (url) => {
|
||||
Taro.redirectTo({ url })
|
||||
}
|
||||
|
||||
export const navigateTo = (url) => {
|
||||
Taro.navigateTo({ url })
|
||||
}
|
||||
|
||||
export const backTo = () => {
|
||||
Taro.navigateBack({ delta: 1 })
|
||||
}
|
||||
|
||||
export const backOrGo = (url) => {
|
||||
Taro.getCurrentPages().length > 0 ? Taro.navigateBack() : redirectTo(url)
|
||||
|
||||
}
|
||||
|
||||
|
||||
export function dateFormat(fmt, date) {
|
||||
let ret;
|
||||
const opt = {
|
||||
"Y+": date.getFullYear().toString(), // 年
|
||||
"m+": (date.getMonth() + 1).toString(), // 月
|
||||
"d+": date.getDate().toString(), // 日
|
||||
"H+": date.getHours().toString(), // 时
|
||||
"M+": date.getMinutes().toString(), // 分
|
||||
"S+": date.getSeconds().toString() // 秒
|
||||
// 有其他格式化字符需求可以继续添加,必须转化成字符串
|
||||
};
|
||||
for (let k in opt) {
|
||||
ret = new RegExp("(" + k + ")").exec(fmt);
|
||||
if (ret) {
|
||||
fmt = fmt.replace(ret[1], (ret[1].length == 1) ? (opt[k]) : (opt[k].padStart(ret[1].length, "0")))
|
||||
};
|
||||
};
|
||||
return fmt;
|
||||
}
|
||||
|
||||
|
||||
export const formatDateByStr = (date) => {
|
||||
const d = new Date(date)
|
||||
return dateFormat('YYYY-mm-dd HH:MM', d)
|
||||
}
|