优化细节

This commit is contained in:
2025-07-23 14:15:50 +08:00
parent d3f39dab68
commit 3e315bf9ee
28 changed files with 2547 additions and 303 deletions

View File

@@ -0,0 +1,4 @@
export default definePageConfig({
navigationBarTitleText: '常见问题',
navigationBarTextStyle: 'black'
})

View File

@@ -0,0 +1,3 @@
:root {
}

43
src/user/about/index.tsx Normal file
View File

@@ -0,0 +1,43 @@
import {useEffect, useState} from "react";
import {CmsArticle} from "@/api/cms/cmsArticle/model";
import {listCmsArticle} from "@/api/cms/cmsArticle";
import {Collapse} from '@nutui/nutui-react-taro'
import {ArrowDown} from '@nutui/icons-react-taro'
const Helper = () => {
const [list, setList] = useState<CmsArticle[]>([])
const reload = () => {
listCmsArticle({model: 'help'}).then(res => {
setList(res)
}).catch(error => {
console.error("Failed to fetch goods detail:", error);
})
}
useEffect(() => {
reload()
}, []);
return (
<div className={'p-3'}>
{list.map((item, index) => (
<Collapse defaultActiveName={['1', '2']} expandIcon={<ArrowDown/>}>
<Collapse.Item
title={
<div className={'flex items-center'}>
<div className={'text-sm'}>{item.title}</div>
</div>
}
name={`${index}`}
>
<div className={'text-sm'}>{item.comments}</div>
</Collapse.Item>
</Collapse>
))}
</div>
);
};
export default Helper;

View File

@@ -0,0 +1,4 @@
export default definePageConfig({
navigationBarTitleText: '新增收货地址',
navigationBarTextStyle: 'black'
})

View File

194
src/user/address/add.tsx Normal file
View File

@@ -0,0 +1,194 @@
import {useEffect, useState} from "react";
import {Button, Cell, CellGroup, Input, TextArea, Form, Picker, Cascader} from '@nutui/nutui-react-taro'
import {Scan, ArrowRight} from '@nutui/icons-react-taro'
import Taro from '@tarojs/taro'
import {View} from '@tarojs/components'
import {ShopUserAddress} from "@/api/shop/shopUserAddress/model";
import {listShopUserAddress} from "@/api/shop/shopUserAddress";
import {updateUserInfo} from "@/api/layout";
import {getBszxClassForTree} from "@/api/bszx/bszxClass";
const pickerOptions = [
{value: 4, text: 'BeiJing'},
{value: 1, text: 'NanJing'},
{value: 2, text: 'WuXi'},
{value: 8, text: 'DaQing'},
{value: 9, text: 'SuiHua'},
{value: 10, text: 'WeiFang'},
{value: 12, text: 'ShiJiaZhuang'},
]
const OrderConfirm = () => {
const [list, setList] = useState<ShopUserAddress[]>([])
const [classList, setClassList] = useState<any[]>()
const [FormData, setFormData] = useState<ShopUserAddress>(
{
userId: undefined,
name: undefined,
phone: undefined,
country: undefined,
province: undefined,
city: undefined,
region: undefined,
address: undefined,
fullAddress: undefined,
lat: undefined,
lng: undefined,
gender: undefined,
type: undefined,
isDefault: undefined,
}
)
const [navBarState, setNavBarState] = useState({
visible: false
})
const changeNarBar = (visible) => {
setNavBarState({
visible
})
}
// 获取班级数据树
getBszxClassForTree().then(res => {
setClassList(res);
})
const change6 = (value: any, path: any) => {
const branch = path[0];
changeNarBar(false)
}
const reload = () => {
listShopUserAddress({userId: Taro.getStorageSync('UserId')}).then(res => {
setList(res)
}).catch(error => {
console.error("Failed to fetch goods detail:", error);
})
}
// 提交表单
const submitSucceed = (values: any) => {
console.log(values, 'values')
updateUserInfo(values).then(() => {
Taro.showToast({title: `保存成功`, icon: 'success'})
setTimeout(() => {
return Taro.navigateBack()
}, 1000)
}).catch(() => {
Taro.showToast({
title: '保存失败',
icon: 'error'
});
})
}
const submitFailed = (error: any) => {
console.log(error, 'err...')
}
useEffect(() => {
reload()
}, []);
return (
<>
<Form
divider
initialValues={FormData}
labelPosition="left"
onFinish={(values) => submitSucceed(values)}
onFinishFailed={(errors) => submitFailed(errors)}
footer={
<div
style={{
display: 'flex',
justifyContent: 'center',
width: '100%'
}}
>
<Button nativeType="submit" block type="info">
使
</Button>
</div>
}
>
<CellGroup className={'px-3'}>
<div
style={{
border: '1px dashed #22c55e',
display: 'flex',
alignItems: 'flex-end',
justifyContent: 'space-between',
padding: '4px',
position: 'relative'
}}>
<TextArea style={{height: '100px'}}
placeholder={'请粘贴或输入文本,点击"识别"自动识别收货人姓名、地址、电话'}/>
<Button icon={<Scan/>} style={{position: 'absolute', right: '10px', bottom: '10px'}} type="success"
size={'small'}
fill="dashed"></Button>
</div>
</CellGroup>
<View className={'bg-gray-100 h-3'}></View>
<CellGroup style={{padding: '4px 0'}}>
<Form.Item name="name" label="收货人" required>
<Input placeholder="请输入收货人姓名"/>
</Form.Item>
<Form.Item name="phone" label="手机号" required>
<Input placeholder="请输入手机号"/>
</Form.Item>
<Form.Item
label="所在地区"
name="region"
required
rules={[{message: '请输入您的所在地区'}]}
>
<div className={'flex justify-between items-center'} onClick={() => changeNarBar(true)}>
<Input placeholder="选择所在地区" disabled/>
<ArrowRight className={'text-gray-400'}/>
</div>
</Form.Item>
<Form.Item name="address" label="收货地址" required>
<Input placeholder="请输入详细收货地址"/>
</Form.Item>
</CellGroup>
</Form>
<Cascader
popupProps={{
className: 'cascader-popup',
}}
visible={navBarState.visible}
optionKey={{valueKey: 'name', textKey: 'name', childrenKey: 'children'}}
title="选择所在地区"
options={classList}
closeable
onChange={change6}
onClose={() => {
changeNarBar(false)
}}
/>
{/*<CellGroup>*/}
{/* <Cell>*/}
{/* <div className={'flex items-center'}>*/}
{/* <Image src={goods.image} width="80" height="80"/>*/}
{/* <div className={'ml-2'}>*/}
{/* <div className={'text-sm font-bold'}>{goods.name}</div>*/}
{/* <div className={'text-red-500 text-lg'}>¥{goods.price}</div>*/}
{/* </div>*/}
{/* </div>*/}
{/* </Cell>*/}
{/*</CellGroup>*/}
{/*<div className={'fixed-bottom'}>*/}
{/* <div className={'total-price'}>*/}
{/* 合计:<span className={'text-red-500 text-xl font-bold'}>¥{goods.price}</span>*/}
{/* </div>*/}
{/* <Button type="primary" size="large" className={'submit-btn'}>提交订单</Button>*/}
{/*</div>*/}
</>
);
};
export default OrderConfirm;

View File

@@ -0,0 +1,4 @@
export default definePageConfig({
navigationBarTitleText: '地址管理',
navigationBarTextStyle: 'black'
})

View File

@@ -0,0 +1,3 @@
:root {
}

124
src/user/address/index.tsx Normal file
View File

@@ -0,0 +1,124 @@
import {useEffect, useState} from "react";
import {Button, Cell, CellGroup, Space, Empty, ConfigProvider, Divider} from '@nutui/nutui-react-taro'
import {Dongdong, ArrowRight, CheckNormal, Checked} from '@nutui/icons-react-taro'
import Taro from '@tarojs/taro'
import {View} from '@tarojs/components'
import {ShopUserAddress} from "@/api/shop/shopUserAddress/model";
import {listShopUserAddress} from "@/api/shop/shopUserAddress";
const Address = () => {
const [list, setList] = useState<ShopUserAddress[]>([{},{},{},{}])
const reload = () => {
listShopUserAddress({userId: Taro.getStorageSync('UserId')}).then(res => {
// setList(res)
}).catch(error => {
console.error("Failed to fetch goods detail:", error);
})
}
useEffect(() => {
reload()
}, []);
if (list.length == 0) {
return (
<ConfigProvider>
<div className={'h-full flex flex-col justify-center items-center'} style={{
height: 'calc(100vh - 300px)',
}}>
<Empty
style={{
backgroundColor: 'transparent'
}}
description="您还没有地址哦"
/>
<Space>
<Button onClick={() => Taro.navigateTo({url: '/user/address/add'})}></Button>
<Button type="success" fill="dashed"></Button>
</Space>
</div>
</ConfigProvider>
)
}
if (list.length == 0) {
return (
<CellGroup>
<Cell className={''}>
<Space>
<Button></Button>
<Button></Button>
</Space>
</Cell>
</CellGroup>
)
}
return (
<>
<CellGroup>
<Cell
onClick={() => Taro.navigateTo({url: '/user/address/wxAddress'})}
>
<div className={'flex justify-between items-center w-full'}>
<div className={'flex items-center gap-3'}>
<Dongdong className={'text-green-600'}/>
<div></div>
</div>
<ArrowRight className={'text-gray-400'}/>
</div>
</Cell>
</CellGroup>
{list.map((item,index) => (
// <CellGroup key={item.id}>
// <Cell title={item.name}
// extra={
// <Button
// type="primary"
// size="small"
// >
// 修改
// </Button>
// }
// >
// <div className={'text-sm'}>{item.fullAddress}</div>
//
// </Cell>
// </CellGroup>
<Cell.Group>
<Cell className={'flex flex-col gap-1'}>
<View>
<View className={'font-medium text-sm'}> 13800010001</View>
</View>
<View className={'text-xs'}>
广西13
</View>
</Cell>
<Cell
align="center"
title={
<View className={'flex items-center gap-1'}>
{index == 0 ? <Checked className={'text-green-600'} size={16}/> : <CheckNormal size={16} />}
<View className={'text-gray-400'}></View>
</View>
}
extra={
<>
<View className={'text-gray-400'}>
</View>
<Divider direction={'vertical'}/>
<View className={'text-gray-400'}>
</View>
</>
}
/>
</Cell.Group>
))}
</>
);
};
export default Address;

View File

@@ -0,0 +1,4 @@
export default definePageConfig({
navigationBarTitleText: '我的地址',
navigationBarTextStyle: 'black'
})

View File

@@ -0,0 +1,92 @@
import {useEffect, useState} from "react";
import {Button, Cell, CellGroup, Space, Empty, ConfigProvider} from '@nutui/nutui-react-taro'
import {Dongdong} from '@nutui/icons-react-taro'
import Taro from '@tarojs/taro'
import {ShopUserAddress} from "@/api/shop/shopUserAddress/model";
import {listShopUserAddress} from "@/api/shop/shopUserAddress";
const Address = () => {
const [list, setList] = useState<ShopUserAddress[]>([{
id: 1,
name: '张三',
phone: '13800138000',
country: '中国',
province: '广东省',
city: '广州市',
region: '天河区',
address: '黄埔大道西10号',
fullAddress: '广东省广州市天河区黄埔大道西10号',
lat: '23.129163',
lng: '113.382391',
gender: 1,
type: 'home',
isDefault: true,
userId: 1,
tenantId: 1,
createTime: '2021-09-01 10:10:10',
},
{
id: 2,
name: '李四',
phone: '13800138000',
country: '中国',
province: '广西壮族自治区',
city: '南宁市',
region: '青秀区',
address: '青秀区民族大道100号',
fullAddress: '广西壮族自治区南宁市青秀区民族大道100号',
lat: '23.129163',
lng: '113.382391',
gender: 1,
type: 'home',
isDefault: true,
userId: 1,
tenantId: 1,
createTime: '2021-09-01 10:10:10',
},
{
id: 3,
name: '张三',
phone: '13800138000',
country: '中国',
province: '广西',
city: '南宁市',
region: '青秀区',
address: '青秀区民族大道100号',
fullAddress: '广西壮族自治区南宁市青秀区民族大道100号',
lat: '23.129163',
lng: '113.382391',
gender: 1,
type: 'home',
isDefault: true,
userId: 1,
tenantId: 1,
createTime: '2021-09-01 10:10:10',
}])
const reload = () => {
listShopUserAddress({userId: Taro.getStorageSync('UserId')}).then(res => {
// setList(res)
}).catch(error => {
console.error("Failed to fetch goods detail:", error);
})
}
useEffect(() => {
reload()
}, []);
return (
<>
{list.map((item) => (
<div className={'flex flex-col bg-white my-3 py-1 px-4'}>
<div className={'py-1'}>{item.province}{item.city}{item.region}</div>
<div className={'py-1'}>{item.address}</div>
<div className={'text-gray-500 py-1'}>{item.name} {item.phone}</div>
</div>
))}
</>
);
};
export default Address;

View File

@@ -0,0 +1,4 @@
export default definePageConfig({
navigationBarTitleText: '常见问题',
navigationBarTextStyle: 'black'
})

3
src/user/help/index.scss Normal file
View File

@@ -0,0 +1,3 @@
:root {
}

40
src/user/help/index.tsx Normal file
View File

@@ -0,0 +1,40 @@
import {useEffect, useState} from "react";
import {CmsArticle} from "@/api/cms/cmsArticle/model";
import {listCmsArticle} from "@/api/cms/cmsArticle";
import {Collapse} from '@nutui/nutui-react-taro'
import {ArrowDown} from '@nutui/icons-react-taro'
const Helper = () => {
const [list, setList] = useState<CmsArticle[]>([])
const [category, setCategory] = useState();
const getData = () => {
fetch("https://storage.360buyimg.com/nutui/3x/new-categoryData.js")
.then((response) => response.json())
.then((res) => {
setCategory(res.categoryInfo.category)
})
.catch((err) => console.log("Oh, error", err));
};
const reload = () => {
listCmsArticle({model: 'help'}).then(res => {
setList(res)
}).catch(error => {
console.error("Failed to fetch goods detail:", error);
})
}
useEffect(() => {
reload()
getData();
}, []);
return (
<>
{/*<Category category={category} showSecondLevelQuickNav={true}></Category>*/}
</>
);
};
export default Helper;

View File

@@ -293,20 +293,6 @@ function Index() {
</>
)
}
<Form.Item
label={'真实姓名'}
name="realName"
required
initialValue={FormData.realName}
rules={[{message: '请输入真实姓名'}]}
>
<Input
placeholder={'请输入真实姓名'}
type="text"
value={FormData?.realName}
onChange={(value) => setFormData({...FormData, realName: value})}
/>
</Form.Item>
{
FormData.status != undefined && (
<Form.Item