合伙人

This commit is contained in:
tangping 2023-05-31 00:52:28 +08:00
parent 1ceaf78fb7
commit df72bbfcdf
8 changed files with 407 additions and 1 deletions

View File

@ -33,6 +33,7 @@ export default defineAppConfig({
'pages/message-detail/index',
'/pages/login-quick/index',
'/pages/invite/index',
'/pages/city-partant/index',
],
window: {
backgroundTextStyle: 'light',

View File

@ -238,3 +238,12 @@
margin-left: calc((375px - 200px)/2);
margin-top: 100px;
}
.f12 {
font-size: 12px;
}
.f14 {
font-size: 14px;
}

View File

@ -0,0 +1,3 @@
export default definePageConfig({
navigationBarTitleText: '申请成为合伙人'
})

View 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

View 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;
}

View File

@ -66,7 +66,15 @@ const Index = () => {
</View>
<View className='flex-start my-id-box'>
<Image src={level1} className='my-id-icon' />
<Text className=''>{user.is_city_partner ? '区域合伙人' : ''}</Text>
{
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 File

@ -126,6 +126,12 @@ function Index() {
<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>
</View>
</View>

View File

@ -123,3 +123,8 @@ export const msgList = async (params) => {
export const msgDetail = async (id) => {
return await g(`/news/${id}`)
}
export const partners = async (data) => {
return await p('/partners', data)
}