--增加判断对象为空方法
--增加表单检索方法 --增加公司资料编辑页面 --增加码单管理页面 --增加码单添加页面 --编辑个人资料、地址管理、码单管理引入图标
This commit is contained in:
parent
fa9a6b5d98
commit
c6c3b8e21c
@ -1,3 +1,4 @@
|
||||
const path = require('path')
|
||||
module.exports = {
|
||||
env: {
|
||||
NODE_ENV: '"production"'
|
||||
@ -14,5 +15,11 @@ module.exports = {
|
||||
* .use(require('webpack-bundle-analyzer').BundleAnalyzerPlugin, [])
|
||||
* }
|
||||
*/
|
||||
},
|
||||
alias: {
|
||||
'@': path.resolve(__dirname, '..', 'src'),
|
||||
},
|
||||
sass: {
|
||||
resource: path.resolve(__dirname, '..', 'src/styles/common.scss')
|
||||
}
|
||||
}
|
||||
|
@ -67,7 +67,25 @@ export default {
|
||||
]
|
||||
},
|
||||
{
|
||||
root: "pages/addAddress",
|
||||
root: "pages/addressAdd",
|
||||
pages: [
|
||||
"index"
|
||||
]
|
||||
},
|
||||
{
|
||||
root: "pages/company",
|
||||
pages: [
|
||||
"index"
|
||||
]
|
||||
},
|
||||
{
|
||||
root: "pages/weightList",
|
||||
pages: [
|
||||
"index"
|
||||
]
|
||||
},
|
||||
{
|
||||
root: "pages/weightListAdd",
|
||||
pages: [
|
||||
"index"
|
||||
]
|
||||
|
@ -23,3 +23,67 @@ export const goLink = (path = '', params = {}, type:false|true = false) => {
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
* 判断对象为空
|
||||
* @param object
|
||||
* @returns
|
||||
*/
|
||||
export const isEmptyObject = (object: any)=>{
|
||||
if(object==undefined||object==null||Number.isNaN(object)){
|
||||
return true;
|
||||
}else{
|
||||
if(object.constructor==Object){
|
||||
return Reflect.ownKeys(object).length==0;
|
||||
}else if(object.constructor==Array){
|
||||
return object.length==0;
|
||||
}else if(object.constructor==String){
|
||||
return object=="";
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 表单检索
|
||||
* @param data
|
||||
* @param rules
|
||||
* @param message
|
||||
* @returns
|
||||
*/
|
||||
export const retrieval = (data: any, message: string="请填写完信息", rules?: Object)=>{
|
||||
return new Promise((resolve, reject)=>{
|
||||
if(rules){
|
||||
const keys = Reflect.ownKeys(rules);
|
||||
const result = keys.some((key:any)=>{
|
||||
for(let item of (rules as any)[key]){
|
||||
|
||||
let _res = false;
|
||||
if(item.validator){
|
||||
if(item.validator(data[key],item)){
|
||||
_res=true;
|
||||
}
|
||||
}else if(item.regex){
|
||||
if(!item.regex.test(data[key])){
|
||||
_res=true;
|
||||
}
|
||||
}else{
|
||||
if(isEmptyObject(data[key])){
|
||||
_res=true;
|
||||
}
|
||||
}
|
||||
message = item.message;
|
||||
return _res;
|
||||
}
|
||||
});
|
||||
if(result){
|
||||
reject(message);
|
||||
}
|
||||
}else{
|
||||
const keys = Reflect.ownKeys(data);
|
||||
if(keys.some((key:any)=>isEmptyObject(data[key]))){
|
||||
reject(message);
|
||||
}
|
||||
}
|
||||
resolve(null);
|
||||
})
|
||||
}
|
@ -16,6 +16,7 @@
|
||||
padding: 30px;
|
||||
box-sizing: border-box;
|
||||
margin: 18px auto 0;
|
||||
border: 1px solid #ffffff;
|
||||
}
|
||||
.address-list:hover{
|
||||
border: 1px solid #68b4ff;
|
||||
@ -50,8 +51,8 @@
|
||||
color: #ababab;
|
||||
margin-left: 30px;
|
||||
}
|
||||
.address-edit{
|
||||
font-size: 26px;
|
||||
.address-edit .icon-bianji{
|
||||
font-size: 40px;
|
||||
}
|
||||
|
||||
.address-list-info{
|
||||
@ -75,4 +76,13 @@
|
||||
position: absolute;bottom: 8%;left: 50%;
|
||||
transform: translateX(-50%);
|
||||
}
|
||||
.address-no-data{
|
||||
font-size: 24px;
|
||||
font-weight: 400;
|
||||
text-align: center;
|
||||
color: #707070;
|
||||
height: 100%;
|
||||
padding-top: 40%;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
|
||||
import { Button, Navigator, ScrollView, Text, View } from "@tarojs/components"
|
||||
import { useState } from "react"
|
||||
import { memo, useState } from "react"
|
||||
import "./index.scss"
|
||||
|
||||
interface Params{
|
||||
@ -10,22 +10,23 @@ interface Params{
|
||||
}
|
||||
|
||||
// 地址列表
|
||||
const AddressList = (props:Params)=>{
|
||||
const AddressList = memo((props:Params)=>{
|
||||
// 处理刷新
|
||||
const [refreshState, setRefreshState] = useState(false);
|
||||
const handleRefresh = ()=>{
|
||||
setRefreshState(true);
|
||||
setTimeout(()=>{
|
||||
setRefreshState(false);
|
||||
},3000)
|
||||
|
||||
},500)
|
||||
}
|
||||
const data = Array.from({length:15});
|
||||
|
||||
return (
|
||||
<View className="address-scroll-view">
|
||||
<ScrollView scrollY refresherEnabled={props.refresherEnabled} enhanced refresherTriggered={refreshState} onRefresherRefresh={handleRefresh}>
|
||||
{
|
||||
Array.from({length:15}).map((item,index)=>{
|
||||
data.length>0?
|
||||
data.map((item,index)=>{
|
||||
return(
|
||||
<View onClick={()=>props.onSelect&&props.onSelect(item,index)} className="address-list">
|
||||
<View className="address-user">
|
||||
@ -38,16 +39,19 @@ const AddressList = (props:Params)=>{
|
||||
**省**市**区**街道****仓库
|
||||
<Text className="address-list-phone">181****9790</Text>
|
||||
</View>
|
||||
<Navigator url="/pages/addAddress/index" hoverClass="none" className="address-edit">编辑</Navigator>
|
||||
<Navigator url="/pages/addressAdd/index?type=edit" hoverClass="none" className="address-edit">
|
||||
<Text className="iconfont icon-bianji"></Text>
|
||||
</Navigator>
|
||||
</View>
|
||||
</View>
|
||||
);
|
||||
})
|
||||
}):
|
||||
<View className="address-no-data">暂未添加地址</View>
|
||||
}
|
||||
</ScrollView>
|
||||
<Navigator url="/pages/addAddress/index" hoverClass="none" className="add-address">添加收货地址</Navigator>
|
||||
<Navigator url="/pages/addressAdd/index?type=add" hoverClass="none" className="add-address">添加收货地址</Navigator>
|
||||
</View>
|
||||
)
|
||||
}
|
||||
})
|
||||
|
||||
export default AddressList;
|
@ -1,10 +1,8 @@
|
||||
.add-address{
|
||||
|
||||
.form-list{
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
margin: 30px 30px 0;
|
||||
}
|
||||
|
||||
.form-list-label{
|
||||
font-size: 28px;
|
||||
font-weight: 700;
|
||||
@ -13,13 +11,16 @@
|
||||
}
|
||||
.form-list-right{
|
||||
width: 506px;
|
||||
min-height: 80px;
|
||||
background: #f6f6f6;
|
||||
border-radius: 20px;
|
||||
padding: 10px 20px;
|
||||
box-sizing: border-box;
|
||||
font-size: 26px;
|
||||
font-weight: 400;
|
||||
}
|
||||
.form-list-right-meet{
|
||||
background: #f6f6f6;
|
||||
width: 506px;
|
||||
min-height: 80px;
|
||||
border-radius: 20px;
|
||||
box-sizing: border-box;
|
||||
padding: 10px 20px;
|
||||
display: flex;justify-content: space-between;
|
||||
align-items: center;
|
||||
}
|
||||
@ -32,6 +33,7 @@
|
||||
.form-list-right textarea{
|
||||
height: 186px;
|
||||
border-radius: 10px;
|
||||
padding: 10px 0;
|
||||
}
|
||||
.form-list-right .phcolor{
|
||||
color: #ababab;
|
||||
@ -39,8 +41,8 @@
|
||||
.form-list-right-placeholder{
|
||||
color: #ababab;
|
||||
}
|
||||
.form-list-right-enter{
|
||||
|
||||
.form-list-right-enter .icon-a-moreback{
|
||||
font-size: 28px;
|
||||
}
|
||||
.add-address-default{
|
||||
display: flex;align-items: center;justify-content: space-between;
|
46
src/components/FromList/index.tsx
Normal file
46
src/components/FromList/index.tsx
Normal file
@ -0,0 +1,46 @@
|
||||
|
||||
import { Input, Text, Textarea, View } from "@tarojs/components"
|
||||
import { memo } from "react"
|
||||
import "./index.scss"
|
||||
|
||||
interface ListParams{
|
||||
label: string, //左边label
|
||||
onInput?: ()=>any, // 输入框输入
|
||||
onClick?:()=>any, //点击列表
|
||||
placeholder?:string, // 提示文本
|
||||
children?: any, // 插槽
|
||||
type?: string // 类型:1.input,2.textarea,3.select
|
||||
value?: any
|
||||
}
|
||||
|
||||
// 表单列表
|
||||
const FromList = memo((props:ListParams)=>{
|
||||
const {type="input",value=""} = props;
|
||||
|
||||
return (
|
||||
<View className="form-list">
|
||||
<View className="form-list-label">{props.label}</View>
|
||||
<View onClick={props?.onClick} className="form-list-right">
|
||||
{
|
||||
props.children??
|
||||
<View onClick={props?.onClick} className="form-list-right-meet">
|
||||
{
|
||||
type=="input"?<Input value={value} placeholder-class="phcolor" onInput={props?.onInput} placeholder={props.placeholder} />:
|
||||
type=="textarea"?<Textarea value={value} placeholder-class="phcolor" onInput={props?.onInput} placeholder={props.placeholder} />:
|
||||
<>
|
||||
{
|
||||
props.value?<View>{value}</View>:
|
||||
<View className="form-list-right-placeholder">
|
||||
{props.placeholder}
|
||||
</View>
|
||||
}
|
||||
<View className="form-list-right-enter"><Text className="iconfont icon-a-moreback"></Text></View>
|
||||
</>
|
||||
}
|
||||
</View>
|
||||
}
|
||||
</View>
|
||||
</View>
|
||||
)
|
||||
})
|
||||
export default FromList;
|
@ -1,3 +0,0 @@
|
||||
export default {
|
||||
navigationBarTitleText: '新增收货地址'
|
||||
}
|
@ -1,76 +0,0 @@
|
||||
|
||||
import Address from "@/components/address"
|
||||
import { Button, Input, Text, Textarea, View } from "@tarojs/components"
|
||||
import { useState } from "react"
|
||||
import "./index.scss"
|
||||
|
||||
export default ()=>{
|
||||
const [showSiteModal, setShowSiteModal] = useState(false);
|
||||
const handleSelectSite = ()=>{
|
||||
setShowSiteModal(true);
|
||||
}
|
||||
|
||||
// 保存
|
||||
const [formData, setFormData] = useState({
|
||||
aa: "",
|
||||
bb:"",
|
||||
cc:"",
|
||||
dd:""
|
||||
})
|
||||
const handleSave = ()=>{
|
||||
|
||||
}
|
||||
|
||||
return (
|
||||
<View className="add-address">
|
||||
<FromList value={formData["aa"]} label="联系人" placeholder="请输入收货人姓名"/>
|
||||
<FromList value={formData["bb"]} label="联系方式" placeholder="请输入收货人姓名"/>
|
||||
<FromList value={formData["cc"]} onClick={handleSelectSite} label="收地址" type="select" placeholder="请选择/省/市/区"/>
|
||||
<FromList value={formData["dd"]} label="详细地址" type="textarea" placeholder="请输入详细地址(街道、门牌号等)"/>
|
||||
<View className="add-address-default">
|
||||
<Text>设为默认地址</Text>
|
||||
<View>1</View>
|
||||
</View>
|
||||
|
||||
<Button hoverClass="none" className="add-address-save" onClick={handleSave}>保存</Button>
|
||||
<Address addressOnClose={()=>setShowSiteModal(false)} show={showSiteModal}/>
|
||||
</View>
|
||||
)
|
||||
}
|
||||
|
||||
// 表单列表
|
||||
const FromList = (props:ListParams)=>{
|
||||
const {type="input",value=""} = props;
|
||||
|
||||
return (
|
||||
<View className="form-list">
|
||||
<View className="form-list-label">{props.label}</View>
|
||||
<View onClick={props?.onClick} className="form-list-right">
|
||||
{
|
||||
props.children??(
|
||||
type=="input"?<Input value={value} placeholder-class="phcolor" onInput={props?.onInput} placeholder={props.placeholder} />:
|
||||
type=="textarea"?<Textarea value={value} placeholder-class="phcolor" onInput={props?.onInput} placeholder={props.placeholder} />:
|
||||
<>
|
||||
{
|
||||
props.value?<View>{value}</View>:
|
||||
<View className="form-list-right-placeholder">
|
||||
{props.placeholder}
|
||||
</View>
|
||||
}
|
||||
<View className="form-list-right-enter">1</View>
|
||||
</>
|
||||
)
|
||||
}
|
||||
</View>
|
||||
</View>
|
||||
)
|
||||
}
|
||||
interface ListParams{
|
||||
label: string, //左边label
|
||||
onInput?: ()=>any, // 输入框输入
|
||||
onClick?:()=>any, //点击列表
|
||||
placeholder?:string, // 提示文本
|
||||
children?: any, // 插槽
|
||||
type?: string // 类型:1.input,2.textarea,3.select
|
||||
value?: any
|
||||
}
|
3
src/pages/addressAdd/index.config.ts
Normal file
3
src/pages/addressAdd/index.config.ts
Normal file
@ -0,0 +1,3 @@
|
||||
export default {
|
||||
navigationBarTitleText: ''
|
||||
}
|
23
src/pages/addressAdd/index.scss
Normal file
23
src/pages/addressAdd/index.scss
Normal file
@ -0,0 +1,23 @@
|
||||
.add-address{
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
.add-address-default{
|
||||
display: flex;align-items: center;justify-content: space-between;
|
||||
margin: 70px 30px 0;
|
||||
font-size: 26px;
|
||||
font-weight: 700;
|
||||
color: #000000;
|
||||
}
|
||||
|
||||
.add-address-save{
|
||||
width: 668px;
|
||||
height: 82px;
|
||||
background: #68b4ff;
|
||||
border-radius: 40px;
|
||||
font-size: 32px;
|
||||
font-weight: 400;
|
||||
color: #ffffff;
|
||||
display: flex;align-items: center;justify-content: center;
|
||||
margin: 620px auto 0;
|
||||
}
|
||||
}
|
59
src/pages/addressAdd/index.tsx
Normal file
59
src/pages/addressAdd/index.tsx
Normal file
@ -0,0 +1,59 @@
|
||||
|
||||
import { retrieval } from "@/common/common"
|
||||
import Address from "@/components/address"
|
||||
import FromList from "@/components/FromList"
|
||||
import { Button, Input, Text, Textarea, View } from "@tarojs/components"
|
||||
import Taro, { setNavigationBarTitle, useRouter } from "@tarojs/taro"
|
||||
import { useEffect, useState } from "react"
|
||||
import "./index.scss"
|
||||
|
||||
export default ()=>{
|
||||
const [showSiteModal, setShowSiteModal] = useState(false);
|
||||
const {type} = useRouter().params;
|
||||
useEffect(()=>{
|
||||
if(type=="add"){
|
||||
setNavigationBarTitle({title:"新增收货地址"})
|
||||
}else{
|
||||
setNavigationBarTitle({title:"编辑收货地址"})
|
||||
}
|
||||
},[])
|
||||
|
||||
const handleSelectSite = ()=>{
|
||||
setShowSiteModal(true);
|
||||
}
|
||||
|
||||
// 保存
|
||||
const [formData, setFormData] = useState({
|
||||
aa: "1",
|
||||
bb:"2",
|
||||
cc:"aa",
|
||||
dd:"d"
|
||||
})
|
||||
const handleSave = ()=>{
|
||||
Taro.navigateBack();
|
||||
}
|
||||
const [hozon, setHozon] = useState(false);
|
||||
useEffect(()=>{
|
||||
if(retrieval){
|
||||
retrieval(formData).then(()=>setHozon(true)).catch(()=>setHozon(false))
|
||||
}
|
||||
},[formData])
|
||||
|
||||
return (
|
||||
<View className="add-address">
|
||||
<FromList value={formData["aa"]} label="联系人" placeholder="请输入收货人姓名"/>
|
||||
<FromList value={formData["bb"]} label="联系方式" placeholder="请输入收货人姓名"/>
|
||||
<FromList value={formData["cc"]} onClick={handleSelectSite} label="收地址" type="select" placeholder="请选择/省/市/区"/>
|
||||
<FromList value={formData["dd"]} label="详细地址" type="textarea" placeholder="请输入详细地址(街道、门牌号等)"/>
|
||||
<View className="add-address-default">
|
||||
<Text>设为默认地址</Text>
|
||||
<View>1</View>
|
||||
</View>
|
||||
|
||||
<Button style={{"background": hozon?'#007aff':''}} hoverClass="none" className={`add-address-save`} onClick={handleSave}>
|
||||
保存
|
||||
</Button>
|
||||
<Address addressOnClose={()=>setShowSiteModal(false)} show={showSiteModal}/>
|
||||
</View>
|
||||
)
|
||||
}
|
3
src/pages/company/index.config.ts
Normal file
3
src/pages/company/index.config.ts
Normal file
@ -0,0 +1,3 @@
|
||||
export default {
|
||||
navigationBarTitleText: '公司资料'
|
||||
}
|
44
src/pages/company/index.scss
Normal file
44
src/pages/company/index.scss
Normal file
@ -0,0 +1,44 @@
|
||||
.company{
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
.save-button{
|
||||
width: 668px;
|
||||
height: 82px;
|
||||
background: #007aff;
|
||||
border-radius: 40px;
|
||||
font-size: 32px;
|
||||
font-weight: 400;
|
||||
color: #ffffff;
|
||||
display: flex;align-items: center;justify-content: center;
|
||||
margin: 320px auto 0;
|
||||
}
|
||||
|
||||
.form-radio{
|
||||
display: flex;
|
||||
flex-wrap: wrap;align-items: center;
|
||||
}
|
||||
.form-radio view{
|
||||
height: 54px;
|
||||
background: #f0f0f0;
|
||||
border-radius: 28px;
|
||||
font-size: 24px;
|
||||
font-weight: 400;
|
||||
color: #707070;
|
||||
padding: 10px 28px;
|
||||
box-sizing: border-box;
|
||||
display: flex;align-items: center;justify-content: center;
|
||||
margin: 10px;
|
||||
border: 2px solid #f0f0f0;
|
||||
max-width: 100%;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
display: -webkit-box;
|
||||
-webkit-box-orient: vertical;
|
||||
-webkit-line-clamp: 1;
|
||||
overflow: hidden;
|
||||
}
|
||||
.form-radio .form-radio-active{
|
||||
background: #ecf5ff;
|
||||
border: 2px solid #cde5ff;
|
||||
}
|
||||
}
|
61
src/pages/company/index.tsx
Normal file
61
src/pages/company/index.tsx
Normal file
@ -0,0 +1,61 @@
|
||||
|
||||
import Address from "@/components/address"
|
||||
import FromList from "@/components/FromList"
|
||||
import { Button, Input, Text, Textarea, View } from "@tarojs/components"
|
||||
import Taro, { getCurrentPages, useRouter } from "@tarojs/taro"
|
||||
import { useEffect, useState } from "react"
|
||||
import "./index.scss"
|
||||
|
||||
export default ()=>{
|
||||
const [showSiteModal, setShowSiteModal] = useState(false);
|
||||
|
||||
const handleSelectSite = ()=>{
|
||||
setShowSiteModal(true);
|
||||
}
|
||||
|
||||
|
||||
// 保存
|
||||
const [formData, setFormData] = useState({
|
||||
aa: "",
|
||||
bb:"",
|
||||
cc:"",
|
||||
dd:""
|
||||
})
|
||||
const handleSave = ()=>{
|
||||
const pages = getCurrentPages();
|
||||
const prevPage = pages[pages.length-2];
|
||||
Taro.eventCenter.trigger('message:detail', { text: 'test' })
|
||||
|
||||
Taro.navigateBack();
|
||||
}
|
||||
// 单选
|
||||
const radioData = ['布行','二批','制衣厂'];
|
||||
const [radioActive, setRadioActive] = useState(0);
|
||||
const handleActiveRadio = (index:number)=>{
|
||||
setRadioActive(index);
|
||||
}
|
||||
|
||||
return (
|
||||
<View className="company">
|
||||
<FromList value={formData["aa"]} label="公司名称" placeholder="请输入收货人姓名"/>
|
||||
<FromList value={formData["bb"]} label="公司全称" placeholder="请输入收货人姓名"/>
|
||||
<FromList value={formData["bb"]} label="公司类型" placeholder="请输入收货人姓名">
|
||||
<View className="form-radio">
|
||||
{
|
||||
radioData.map((item,index)=>{
|
||||
return <View onClick={()=>handleActiveRadio(index)} className={radioActive==index?'form-radio-active':''} key={index}>{item}</View>
|
||||
})
|
||||
}
|
||||
</View>
|
||||
</FromList>
|
||||
<FromList value={formData["bb"]} label="联系人" placeholder="请输入收货人姓名"/>
|
||||
<FromList value={formData["bb"]} label="联系方式" placeholder="请输入收货人姓名"/>
|
||||
<FromList value={formData["cc"]} onClick={handleSelectSite} label="收地址" type="select" placeholder="请选择/省/市/区"/>
|
||||
<FromList value={formData["dd"]} label="详细地址" type="textarea" placeholder="请输入详细地址(街道、门牌号等)"/>
|
||||
|
||||
|
||||
<Button hoverClass="none" className="save-button" onClick={handleSave}>保存</Button>
|
||||
<Address addressOnClose={()=>setShowSiteModal(false)} show={showSiteModal}/>
|
||||
</View>
|
||||
)
|
||||
}
|
@ -43,7 +43,7 @@ const Header = memo(()=>{
|
||||
return (
|
||||
<View className={styles['card-main-title-content-item']}>
|
||||
<Image src="https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fimg.jj20.com%2Fup%2Fallimg%2F1113%2F052420110515%2F200524110515-2-1200.jpg&refer=http%3A%2F%2Fimg.jj20.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1652840455&t=6d2fd53931578ef6e213a929a77d059c"/>
|
||||
<View>待配布</View>
|
||||
<View>{item.text}</View>
|
||||
</View>
|
||||
)
|
||||
})
|
||||
|
@ -50,6 +50,9 @@
|
||||
.user-edit-list-right-placeholder{
|
||||
color: #cccccc;
|
||||
}
|
||||
.user-edit-list-right .icon-a-moreback{
|
||||
font-size: 30px;
|
||||
}
|
||||
|
||||
.user-edit-logout{
|
||||
width: 668px;
|
||||
@ -67,6 +70,7 @@
|
||||
.user-edit-popup-content{
|
||||
margin: 0 auto;
|
||||
width: 658px;
|
||||
padding-bottom: 50px;
|
||||
}
|
||||
.user-edit-popup-input{
|
||||
width: 658px;
|
||||
|
@ -1,6 +1,8 @@
|
||||
|
||||
import { goLink } from "@/common/common";
|
||||
import Popup from "@/components/popup";
|
||||
import { Button, Image, Text, Textarea, View } from "@tarojs/components"
|
||||
import Taro, { chooseMedia } from "@tarojs/taro";
|
||||
import { memo, useCallback, useState } from "react"
|
||||
import "./index.scss"
|
||||
|
||||
@ -20,24 +22,40 @@ export default ()=>{
|
||||
const handleTextareaSave = ()=>{
|
||||
|
||||
}
|
||||
Taro.eventCenter.on('message:detail', (message) => console.log(message))
|
||||
// 面面跳转
|
||||
const onNavigate = (url:string)=>{
|
||||
goLink(url);
|
||||
}
|
||||
// 肖像编辑
|
||||
const handleSelectRortrait = ()=>{
|
||||
chooseMedia({
|
||||
count: 1,
|
||||
mediaType: ["image"],
|
||||
success(ev){
|
||||
console.log(ev);
|
||||
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
return (
|
||||
<View className="user-edit">
|
||||
<View className="user-edit-portrait">
|
||||
<View onClick={handleSelectRortrait} className="user-edit-portrait">
|
||||
<Image src="https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fimg.jj20.com%2Fup%2Fallimg%2F1113%2F052420110515%2F200524110515-2-1200.jpg&refer=http%3A%2F%2Fimg.jj20.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1652840455&t=6d2fd53931578ef6e213a929a77d059c"/>
|
||||
<View>点击编辑头像</View>
|
||||
</View>
|
||||
<View className="user-edit-content">
|
||||
<UserEditList onClick={()=>triggerList('nickname')} data={formData} label="昵称" placeholder="请输入" icon=""/>
|
||||
<UserEditList label="公司/组织" placeholder="请输入" icon=""/>
|
||||
<UserEditList label="地址管理" placeholder="添加 / 修改收货地址" icon=""/>
|
||||
<UserEditList label="码单管理" placeholder="修改码单抬头 / 客户 / 电话等显示信息" icon=""/>
|
||||
<UserEditList onClick={()=>onNavigate("/pages/company/index")} label="公司/组织" placeholder="请输入" icon=""/>
|
||||
<UserEditList onClick={()=>onNavigate("/pages/addressManager/index")} label="地址管理" placeholder="添加 / 修改收货地址" icon=""/>
|
||||
<UserEditList onClick={()=>onNavigate("/pages/weightList/index")} label="码单管理" placeholder="修改码单抬头 / 客户 / 电话等显示信息" icon=""/>
|
||||
<UserEditList label="完善资料" placeholder="完善资料加入会员,申请更多优惠" icon=""/>
|
||||
<UserEditList label="账号解绑" placeholder="解除账号与所属公司/组织的绑定关系" icon=""/>
|
||||
</View>
|
||||
<Button hoverClass="none" className="user-edit-logout">退出当前账号</Button>
|
||||
|
||||
<PopupContent show={popupShow} setPopupShow={setPopupShow} save={handleTextareaSave}/>
|
||||
<PopupContent value="123" show={popupShow} setPopupShow={setPopupShow} save={handleTextareaSave}/>
|
||||
</View>
|
||||
)
|
||||
}
|
||||
@ -54,7 +72,7 @@ const UserEditList = memo((props:any)=>{
|
||||
<View className="user-edit-list-right-placeholder">{props.placeholder}</View>
|
||||
{/* 请输入 */}
|
||||
</View>
|
||||
<Text>1</Text>
|
||||
<Text className="iconfont icon-a-moreback"></Text>
|
||||
</View>
|
||||
</View>
|
||||
)
|
||||
@ -63,9 +81,7 @@ const UserEditList = memo((props:any)=>{
|
||||
// popup内容
|
||||
const PopupContent = memo((props:any)=>{
|
||||
// popup输入长度
|
||||
const [inputLength, setInputLength] = useState(0);
|
||||
const handleTextareaInput = (ev:any)=>{
|
||||
setInputLength(ev.detail.value.length);
|
||||
}
|
||||
// 重置
|
||||
const handleTextareaReset = ()=>{
|
||||
@ -75,8 +91,8 @@ const PopupContent = memo((props:any)=>{
|
||||
<Popup onClose={()=>props.setPopupShow(false)} title="修改昵称" show={props.show}>
|
||||
<View className="user-edit-popup-content">
|
||||
<View className="user-edit-popup-input">
|
||||
<Textarea onInput={handleTextareaInput} maxlength={20}/>
|
||||
<Text>{inputLength}/20</Text>
|
||||
<Textarea value={props.value} onInput={handleTextareaInput} maxlength={20}/>
|
||||
<Text>{props.value.length}/20</Text>
|
||||
</View>
|
||||
<Text className="user-edit-popup-tips">请设置2-20个字符,由中文、英文、数字、-和_组成</Text>
|
||||
<View className="user-edit-popup-operation">
|
||||
|
3
src/pages/weightList/index.config.ts
Normal file
3
src/pages/weightList/index.config.ts
Normal file
@ -0,0 +1,3 @@
|
||||
export default {
|
||||
navigationBarTitleText: '码单管理'
|
||||
}
|
92
src/pages/weightList/index.scss
Normal file
92
src/pages/weightList/index.scss
Normal file
@ -0,0 +1,92 @@
|
||||
.weight-list-manager{
|
||||
height: 100vh;
|
||||
|
||||
.weight-list-scroll-view{
|
||||
height: 100%;
|
||||
box-sizing: border-box;
|
||||
position: relative;
|
||||
scroll-view{
|
||||
height: 100%;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.weight-list-list{
|
||||
width: 704px;
|
||||
height: 156px;
|
||||
background: #ffffff;
|
||||
border-radius: 20px;
|
||||
box-shadow: 2px 4px 12px 0px rgba(0,0,0,0.16);
|
||||
padding: 30px;
|
||||
box-sizing: border-box;
|
||||
margin: 18px auto 0;
|
||||
border: 1px solid #ffffff;
|
||||
}
|
||||
.weight-list-list:hover{
|
||||
border: 1px solid #68b4ff;
|
||||
box-shadow: 0px 0px 10px 0px rgba(0,122,255,0.27);
|
||||
}
|
||||
.weight-list-list:last-child{
|
||||
margin-bottom: 300px;
|
||||
}
|
||||
.weight-list-user{
|
||||
font-size: 28px;
|
||||
font-family: Microsoft YaHei, Microsoft YaHei-Bold;
|
||||
font-weight: 700;
|
||||
text-align: left;
|
||||
color: #000000;
|
||||
display: flex;align-items: center;
|
||||
}
|
||||
.weight-list-list-default{
|
||||
width: 58px;
|
||||
height: 28px;
|
||||
background: #cde5ff;
|
||||
border-radius: 6px;
|
||||
font-size: 20px;
|
||||
font-weight: 400;
|
||||
text-align: center;
|
||||
color: #007aff;
|
||||
margin-left: 30px;
|
||||
|
||||
}
|
||||
.weight-list-list-phone{
|
||||
font-size: 24px;
|
||||
font-weight: 400;
|
||||
color: #ababab;
|
||||
margin-left: 30px;
|
||||
}
|
||||
.weight-list-edit .icon-bianji{
|
||||
font-size: 40px;
|
||||
}
|
||||
|
||||
.weight-list-list-info{
|
||||
font-size: 24px;
|
||||
font-weight: 400;
|
||||
color: #3c3c3c;
|
||||
}
|
||||
.weight-list-list-bottom{
|
||||
display: flex;justify-content: space-between;
|
||||
margin-top: 18px;
|
||||
}
|
||||
.add-weight-list{
|
||||
width: 668px;
|
||||
height: 82px;
|
||||
background: #007aff;
|
||||
border-radius: 40px;
|
||||
font-size: 32px;
|
||||
font-weight: 400;
|
||||
color: #ffffff;
|
||||
display: flex;align-items: center;justify-content: center;
|
||||
position: absolute;bottom: 8%;left: 50%;
|
||||
transform: translateX(-50%);
|
||||
}
|
||||
.weight-list-no-data{
|
||||
font-size: 24px;
|
||||
font-weight: 400;
|
||||
text-align: center;
|
||||
color: #707070;
|
||||
height: 100%;
|
||||
padding-top: 40%;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
}
|
||||
}
|
65
src/pages/weightList/index.tsx
Normal file
65
src/pages/weightList/index.tsx
Normal file
@ -0,0 +1,65 @@
|
||||
|
||||
import { Button, Navigator, ScrollView, Text, View } from "@tarojs/components"
|
||||
import { memo, useState } from "react"
|
||||
import "./index.scss"
|
||||
|
||||
const weightListManager = ()=>{
|
||||
|
||||
return(
|
||||
<View className="weight-list-manager">
|
||||
<WeightList />
|
||||
</View>
|
||||
)
|
||||
}
|
||||
|
||||
interface Params{
|
||||
refresherEnabled?: boolean,//是否开启刷新
|
||||
onSelect?: (item:any,index:number)=>void,//列表选择
|
||||
|
||||
}
|
||||
// 码单列表
|
||||
const WeightList = memo((props:Params)=>{
|
||||
// 处理刷新
|
||||
const [refreshState, setRefreshState] = useState(false);
|
||||
const handleRefresh = ()=>{
|
||||
setRefreshState(true);
|
||||
setTimeout(()=>{
|
||||
setRefreshState(false);
|
||||
},500)
|
||||
}
|
||||
const data = Array.from({length:15});
|
||||
|
||||
return (
|
||||
<View className="weight-list-scroll-view">
|
||||
<ScrollView scrollY refresherEnabled={props.refresherEnabled} enhanced refresherTriggered={refreshState} onRefresherRefresh={handleRefresh}>
|
||||
{
|
||||
data.length>0?
|
||||
data.map((item,index)=>{
|
||||
return(
|
||||
<View onClick={()=>props.onSelect&&props.onSelect(item,index)} className="weight-list-list">
|
||||
<View className="weight-list-user">
|
||||
XL纺织
|
||||
<Text className="weight-list-list-default">默认</Text>
|
||||
{/* <Text className="weight-list-list-phone">1656488999</Text> */}
|
||||
</View>
|
||||
<View className="weight-list-list-bottom">
|
||||
<View className="weight-list-list-info">
|
||||
**省**市**区**街道****仓库
|
||||
<Text className="weight-list-list-phone">181****9790</Text>
|
||||
</View>
|
||||
<Navigator url="/pages/weightListAdd/index?type=edit" hoverClass="none" className="weight-list-edit">
|
||||
<Text className="iconfont icon-bianji"></Text>
|
||||
</Navigator>
|
||||
</View>
|
||||
</View>
|
||||
);
|
||||
}):
|
||||
<View className="weight-list-no-data">暂未添加地址</View>
|
||||
}
|
||||
</ScrollView>
|
||||
<Navigator url="/pages/weightListAdd/index?type=add" hoverClass="none" className="add-weight-list">添加新码单信息</Navigator>
|
||||
</View>
|
||||
)
|
||||
})
|
||||
|
||||
export default weightListManager;
|
3
src/pages/weightListAdd/index.config.ts
Normal file
3
src/pages/weightListAdd/index.config.ts
Normal file
@ -0,0 +1,3 @@
|
||||
export default {
|
||||
navigationBarTitleText: ''
|
||||
}
|
23
src/pages/weightListAdd/index.scss
Normal file
23
src/pages/weightListAdd/index.scss
Normal file
@ -0,0 +1,23 @@
|
||||
.add-address{
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
.add-address-default{
|
||||
display: flex;align-items: center;justify-content: space-between;
|
||||
margin: 70px 30px 0;
|
||||
font-size: 26px;
|
||||
font-weight: 700;
|
||||
color: #000000;
|
||||
}
|
||||
|
||||
.add-address-save{
|
||||
width: 668px;
|
||||
height: 82px;
|
||||
background: #68b4ff;
|
||||
border-radius: 40px;
|
||||
font-size: 32px;
|
||||
font-weight: 400;
|
||||
color: #ffffff;
|
||||
display: flex;align-items: center;justify-content: center;
|
||||
margin: 620px auto 0;
|
||||
}
|
||||
}
|
42
src/pages/weightListAdd/index.tsx
Normal file
42
src/pages/weightListAdd/index.tsx
Normal file
@ -0,0 +1,42 @@
|
||||
|
||||
import FromList from "@/components/FromList"
|
||||
import { Button, Input, Text, Textarea, View } from "@tarojs/components"
|
||||
import Taro, { setNavigationBarTitle, useRouter } from "@tarojs/taro"
|
||||
import { useEffect, useState } from "react"
|
||||
import "./index.scss"
|
||||
|
||||
export default ()=>{
|
||||
const {type} = useRouter().params;
|
||||
useEffect(()=>{
|
||||
if(type=="add"){
|
||||
setNavigationBarTitle({title:"添加码单信息"})
|
||||
}else{
|
||||
setNavigationBarTitle({title:"修改码单信息"})
|
||||
}
|
||||
},[])
|
||||
|
||||
// 保存
|
||||
const [formData, setFormData] = useState({
|
||||
aa: "",
|
||||
bb:"",
|
||||
cc:"",
|
||||
dd:""
|
||||
})
|
||||
const handleSave = ()=>{
|
||||
Taro.navigateBack();
|
||||
}
|
||||
|
||||
return (
|
||||
<View className="add-address">
|
||||
<FromList value={formData["aa"]} label="抬头" placeholder="请输入码单显示抬头信息"/>
|
||||
<FromList value={formData["bb"]} label="客户" placeholder="请输入码单显示客户名称"/>
|
||||
<FromList value={formData["bb"]} label="联系方式" placeholder="请输入码单显示联系号码"/>
|
||||
<View className="add-address-default">
|
||||
<Text>设为默认地址</Text>
|
||||
<View>1</View>
|
||||
</View>
|
||||
|
||||
<Button hoverClass="none" className="add-address-save" onClick={handleSave}>保存</Button>
|
||||
</View>
|
||||
)
|
||||
}
|
@ -12,8 +12,80 @@
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
}
|
||||
|
||||
.icon-tick-pressed:before {
|
||||
content: "\e652";
|
||||
}
|
||||
|
||||
.icon-wode-pressed:before {
|
||||
content: "\e655";
|
||||
}
|
||||
|
||||
.icon-fenlei-pressed:before {
|
||||
content: "\e656";
|
||||
}
|
||||
|
||||
.icon-sousuo:before {
|
||||
content: "\e647";
|
||||
}
|
||||
|
||||
.icon-fenxiang:before {
|
||||
content: "\e648";
|
||||
}
|
||||
|
||||
.icon-shaixuan:before {
|
||||
content: "\e689";
|
||||
content: "\e649";
|
||||
}
|
||||
|
||||
.icon-gouwuche:before {
|
||||
content: "\e64a";
|
||||
}
|
||||
|
||||
.icon-baoguo:before {
|
||||
content: "\e64b";
|
||||
}
|
||||
|
||||
.icon-qingkong:before {
|
||||
content: "\e64c";
|
||||
}
|
||||
|
||||
.icon-jia:before {
|
||||
content: "\e64d";
|
||||
}
|
||||
|
||||
.icon-jian:before {
|
||||
content: "\e64e";
|
||||
}
|
||||
|
||||
.icon-shoucang-pressed:before {
|
||||
content: "\e64f";
|
||||
}
|
||||
|
||||
.icon-shoucang:before {
|
||||
content: "\e650";
|
||||
}
|
||||
|
||||
.icon-phone:before {
|
||||
content: "\e651";
|
||||
}
|
||||
|
||||
.icon-tick:before {
|
||||
content: "\e653";
|
||||
}
|
||||
|
||||
.icon-a-moreback:before {
|
||||
content: "\e654";
|
||||
}
|
||||
|
||||
.icon-fenlei:before {
|
||||
content: "\e657";
|
||||
}
|
||||
|
||||
.icon-bianji:before {
|
||||
content: "\e658";
|
||||
}
|
||||
|
||||
.icon-wode:before {
|
||||
content: "\e659";
|
||||
}
|
||||
|
||||
.icon-sort-up-full:before {
|
||||
@ -23,76 +95,3 @@
|
||||
.icon-sort-down-full:before {
|
||||
content: "\ea4d";
|
||||
}
|
||||
|
||||
.icon-shoucang:before {
|
||||
content: "\e63e";
|
||||
}
|
||||
|
||||
.icon-fenxiang:before {
|
||||
content: "\e63d";
|
||||
}
|
||||
|
||||
.icon-cuo:before {
|
||||
content: "\e6c9";
|
||||
}
|
||||
|
||||
.icon-jiantou:before {
|
||||
content: "\e63c";
|
||||
}
|
||||
|
||||
.icon-fenlei-pressed-41:before {
|
||||
content: "\e63b";
|
||||
}
|
||||
|
||||
.icon-gouxuan:before {
|
||||
content: "\e63a";
|
||||
}
|
||||
|
||||
.icon-a-wode-pressed_wodefuben:before {
|
||||
content: "\e637";
|
||||
}
|
||||
|
||||
.icon-sousuo:before {
|
||||
content: "\e633";
|
||||
}
|
||||
|
||||
.icon-wode-copy:before {
|
||||
content: "\e6cb";
|
||||
}
|
||||
|
||||
.icon-fenlei-copy:before {
|
||||
content: "\e6ca";
|
||||
}
|
||||
|
||||
.icon-tick_gou:before {
|
||||
content: "\e62e";
|
||||
}
|
||||
|
||||
.icon-bianji_bianji:before {
|
||||
content: "\e630";
|
||||
}
|
||||
|
||||
.icon-jian:before {
|
||||
content: "\e632";
|
||||
}
|
||||
|
||||
.icon-lajixiang:before {
|
||||
content: "\e634";
|
||||
}
|
||||
|
||||
.icon-jia:before {
|
||||
content: "\e635";
|
||||
}
|
||||
|
||||
.icon-gouwuche:before {
|
||||
content: "\e636";
|
||||
}
|
||||
|
||||
.icon-fenlei:before {
|
||||
content: "\e638";
|
||||
}
|
||||
|
||||
.icon-wode:before {
|
||||
content: "\e639";
|
||||
}
|
||||
|
||||
|
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user