forked from gxwebsoft/mp-10550
优化细节
This commit is contained in:
@@ -39,6 +39,7 @@
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.26.0",
|
||||
"@nutui/icons-react-taro": "^2.0.1",
|
||||
"@nutui/nutui-react": "^3.0.16",
|
||||
"@nutui/nutui-react-taro": "^2.7.4",
|
||||
"@tarojs/components": "4.0.8",
|
||||
"@tarojs/helper": "4.0.8",
|
||||
|
||||
1914
pnpm-lock.yaml
generated
1914
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
@@ -22,9 +22,7 @@ export async function pageCmsArticle(params: CmsArticleParam) {
|
||||
export async function listCmsArticle(params?: CmsArticleParam) {
|
||||
const res = await request.get<ApiResult<CmsArticle[]>>(
|
||||
'/cms/cms-article',
|
||||
{
|
||||
params
|
||||
}
|
||||
);
|
||||
if (res.code === 0 && res.data) {
|
||||
return res.data;
|
||||
|
||||
101
src/api/shop/shopUserAddress/index.ts
Normal file
101
src/api/shop/shopUserAddress/index.ts
Normal file
@@ -0,0 +1,101 @@
|
||||
import request from '@/utils/request';
|
||||
import type { ApiResult, PageResult } from '@/api/index';
|
||||
import type { ShopUserAddress, ShopUserAddressParam } from './model';
|
||||
|
||||
/**
|
||||
* 分页查询收货地址
|
||||
*/
|
||||
export async function pageShopUserAddress(params: ShopUserAddressParam) {
|
||||
const res = await request.get<ApiResult<PageResult<ShopUserAddress>>>(
|
||||
'/shop/shop-user-address/page',
|
||||
params
|
||||
);
|
||||
if (res.code === 0) {
|
||||
return res.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询收货地址列表
|
||||
*/
|
||||
export async function listShopUserAddress(params?: ShopUserAddressParam) {
|
||||
const res = await request.get<ApiResult<ShopUserAddress[]>>(
|
||||
'/shop/shop-user-address',
|
||||
params
|
||||
);
|
||||
if (res.code === 0 && res.data) {
|
||||
return res.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加收货地址
|
||||
*/
|
||||
export async function addShopUserAddress(data: ShopUserAddress) {
|
||||
const res = await request.post<ApiResult<unknown>>(
|
||||
'/shop/shop-user-address',
|
||||
data
|
||||
);
|
||||
if (res.code === 0) {
|
||||
return res.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改收货地址
|
||||
*/
|
||||
export async function updateShopUserAddress(data: ShopUserAddress) {
|
||||
const res = await request.put<ApiResult<unknown>>(
|
||||
'/shop/shop-user-address',
|
||||
data
|
||||
);
|
||||
if (res.code === 0) {
|
||||
return res.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除收货地址
|
||||
*/
|
||||
export async function removeShopUserAddress(id?: number) {
|
||||
const res = await request.del<ApiResult<unknown>>(
|
||||
'/shop/shop-user-address/' + id
|
||||
);
|
||||
if (res.code === 0) {
|
||||
return res.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除收货地址
|
||||
*/
|
||||
export async function removeBatchShopUserAddress(data: (number | undefined)[]) {
|
||||
const res = await request.del<ApiResult<unknown>>(
|
||||
'/shop/shop-user-address/batch',
|
||||
{
|
||||
data
|
||||
}
|
||||
);
|
||||
if (res.code === 0) {
|
||||
return res.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据id查询收货地址
|
||||
*/
|
||||
export async function getShopUserAddress(id: number) {
|
||||
const res = await request.get<ApiResult<ShopUserAddress>>(
|
||||
'/shop/shop-user-address/' + id
|
||||
);
|
||||
if (res.code === 0 && res.data) {
|
||||
return res.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.message));
|
||||
}
|
||||
51
src/api/shop/shopUserAddress/model/index.ts
Normal file
51
src/api/shop/shopUserAddress/model/index.ts
Normal file
@@ -0,0 +1,51 @@
|
||||
import type { PageParam } from '@/api/index';
|
||||
|
||||
/**
|
||||
* 收货地址
|
||||
*/
|
||||
export interface ShopUserAddress {
|
||||
// 主键ID
|
||||
id?: number;
|
||||
// 姓名
|
||||
name?: string;
|
||||
// 手机号码
|
||||
phone?: string;
|
||||
// 所在国家
|
||||
country?: string;
|
||||
// 所在省份
|
||||
province?: string;
|
||||
// 所在城市
|
||||
city?: string;
|
||||
// 所在辖区
|
||||
region?: string;
|
||||
// 收货地址
|
||||
address?: string;
|
||||
// 收货地址
|
||||
fullAddress?: string;
|
||||
//
|
||||
lat?: string;
|
||||
//
|
||||
lng?: string;
|
||||
// 1先生 2女士
|
||||
gender?: number;
|
||||
// 家、公司、学校
|
||||
type?: string;
|
||||
// 默认收货地址
|
||||
isDefault?: boolean;
|
||||
// 用户ID
|
||||
userId?: number;
|
||||
// 租户id
|
||||
tenantId?: number;
|
||||
// 注册时间
|
||||
createTime?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* 收货地址搜索条件
|
||||
*/
|
||||
export interface ShopUserAddressParam extends PageParam {
|
||||
id?: number;
|
||||
userId?: number;
|
||||
isDefault?: boolean;
|
||||
keywords?: string;
|
||||
}
|
||||
@@ -32,7 +32,11 @@ export default defineAppConfig({
|
||||
"company/company",
|
||||
"profile/profile",
|
||||
"setting/setting",
|
||||
"userVerify/index"
|
||||
"userVerify/index",
|
||||
"address/index",
|
||||
"address/add",
|
||||
"address/wxAddress",
|
||||
"help/index",
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
@@ -146,7 +146,7 @@ function UserCard() {
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className={'header-bg pt-36'}>
|
||||
<div className={'p-4'}>
|
||||
<div
|
||||
className={'user-card w-full flex flex-col justify-around rounded-xl shadow-sm'}
|
||||
@@ -201,7 +201,7 @@ function UserCard() {
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</>
|
||||
</div>
|
||||
|
||||
)
|
||||
}
|
||||
|
||||
@@ -1,17 +1,10 @@
|
||||
import {Cell, InfiniteLoading} from '@nutui/nutui-react-taro'
|
||||
import {Cell} from '@nutui/nutui-react-taro'
|
||||
import navTo from "@/utils/common";
|
||||
import UserFooter from "./UserFooter";
|
||||
import Taro from '@tarojs/taro'
|
||||
import {ArrowRight, ShieldCheck, Truck, LogisticsError, Presentation, Coupon, PickedUp} from '@nutui/icons-react-taro'
|
||||
import {CSSProperties} from "react";
|
||||
import {ArrowRight, ShieldCheck, LogisticsError, Location, Reward, Tips, Ask} from '@nutui/icons-react-taro'
|
||||
|
||||
const UserCell = () => {
|
||||
const InfiniteUlStyle: CSSProperties = {
|
||||
height: '88vh',
|
||||
padding: '16px',
|
||||
overflowY: 'auto',
|
||||
overflowX: 'hidden',
|
||||
}
|
||||
|
||||
const onLogout = () => {
|
||||
Taro.showModal({
|
||||
title: '提示',
|
||||
@@ -33,15 +26,22 @@ const UserCell = () => {
|
||||
return (
|
||||
<>
|
||||
<div className={'px-4'}>
|
||||
{/*<Cell*/}
|
||||
{/* className="nutui-cell-clickable"*/}
|
||||
{/* title={*/}
|
||||
{/* <div style={{display: 'inline-flex', alignItems: 'center'}}>*/}
|
||||
{/* <Truck size={16}/>*/}
|
||||
{/* <span className={'pl-3 text-sm'}>开通会员</span>*/}
|
||||
{/* </div>*/}
|
||||
{/* }*/}
|
||||
{/*/>*/}
|
||||
<Cell
|
||||
className="nutui-cell-clickable"
|
||||
style={{
|
||||
backgroundImage: 'linear-gradient(to right bottom, #54a799, #177b73)',
|
||||
}}
|
||||
title={
|
||||
<div style={{display: 'inline-flex', alignItems: 'center'}}>
|
||||
<Reward className={'text-orange-100 '} size={16}/>
|
||||
<div>
|
||||
<span style={{ fontSize: '16px'}} className={'pl-3 text-orange-100 font-medium'}>开通会员</span>
|
||||
</div>
|
||||
<span className={'text-white opacity-80 pl-3'}>享优惠</span>
|
||||
</div>
|
||||
}
|
||||
extra={<ArrowRight color="#cccccc" size={18}/>}
|
||||
/>
|
||||
<Cell.Group divider={true} description={
|
||||
<div style={{display: 'inline-flex', alignItems: 'center'}}>
|
||||
<span style={{marginTop: '12px'}}>我的服务</span>
|
||||
@@ -49,17 +49,9 @@ const UserCell = () => {
|
||||
}>
|
||||
<Cell
|
||||
className="nutui-cell-clickable"
|
||||
title={
|
||||
<div style={{display: 'inline-flex', alignItems: 'center'}}>
|
||||
<Truck size={16}/>
|
||||
<span className={'pl-3 text-sm'}>我的券包</span>
|
||||
</div>
|
||||
}
|
||||
align="center"
|
||||
extra={<ArrowRight color="#cccccc" size={18}/>}
|
||||
/>
|
||||
<Cell
|
||||
className="nutui-cell-clickable"
|
||||
style={{
|
||||
display: 'none'
|
||||
}}
|
||||
title={
|
||||
<div style={{display: 'inline-flex', alignItems: 'center'}}>
|
||||
<LogisticsError size={16}/>
|
||||
@@ -68,17 +60,23 @@ const UserCell = () => {
|
||||
}
|
||||
align="center"
|
||||
extra={<ArrowRight color="#cccccc" size={18}/>}
|
||||
onClick={() => {
|
||||
navTo('/user/wallet/index', true)
|
||||
}}
|
||||
/>
|
||||
<Cell
|
||||
className="nutui-cell-clickable"
|
||||
title={
|
||||
<div style={{display: 'inline-flex', alignItems: 'center'}}>
|
||||
<LogisticsError size={16}/>
|
||||
<Location size={16}/>
|
||||
<span className={'pl-3 text-sm'}>收货地址</span>
|
||||
</div>
|
||||
}
|
||||
align="center"
|
||||
extra={<ArrowRight color="#cccccc" size={18}/>}
|
||||
onClick={() => {
|
||||
navTo('/user/address/index', true)
|
||||
}}
|
||||
/>
|
||||
<Cell
|
||||
className="nutui-cell-clickable"
|
||||
@@ -94,86 +92,35 @@ const UserCell = () => {
|
||||
navTo('/user/userVerify/index', true)
|
||||
}}
|
||||
/>
|
||||
<Cell
|
||||
className="nutui-cell-clickable"
|
||||
title={
|
||||
<div style={{display: 'inline-flex', alignItems: 'center'}}>
|
||||
<Ask size={16}/>
|
||||
<span className={'pl-3 text-sm'}>常见问题</span>
|
||||
</div>
|
||||
}
|
||||
align="center"
|
||||
extra={<ArrowRight color="#cccccc" size={18}/>}
|
||||
onClick={() => {
|
||||
navTo('/user/help/index')
|
||||
}}
|
||||
/>
|
||||
<Cell
|
||||
className="nutui-cell-clickable"
|
||||
title={
|
||||
<div style={{display: 'inline-flex', alignItems: 'center'}}>
|
||||
<Tips size={16}/>
|
||||
<span className={'pl-3 text-sm'}>关于我们</span>
|
||||
</div>
|
||||
}
|
||||
align="center"
|
||||
extra={<ArrowRight color="#cccccc" size={18}/>}
|
||||
onClick={() => {
|
||||
navTo('/user/about/index')
|
||||
}}
|
||||
/>
|
||||
</Cell.Group>
|
||||
{/*<Cell.Group divider={true} description={*/}
|
||||
{/* <div style={{display: 'inline-flex', alignItems: 'center'}}>*/}
|
||||
{/* <span style={{marginTop: '12px'}}>管理</span>*/}
|
||||
{/* </div>*/}
|
||||
{/*}>*/}
|
||||
{/* <Cell*/}
|
||||
{/* className="nutui-cell-clickable"*/}
|
||||
{/* title={*/}
|
||||
{/* <div style={{display: 'inline-flex', alignItems: 'center'}}>*/}
|
||||
{/* <Presentation size={18}/>*/}
|
||||
{/* <span style={{marginLeft: '5px'}}>分析</span>*/}
|
||||
{/* </div>*/}
|
||||
{/* }*/}
|
||||
{/* align="center"*/}
|
||||
{/* extra={<ArrowRight color="#cccccc" size={18}/>}*/}
|
||||
{/* onClick={() => {*/}
|
||||
{/* navTo('/bszx/bm-cert/bm-cert', true)*/}
|
||||
{/* }}*/}
|
||||
{/* />*/}
|
||||
{/* <Cell*/}
|
||||
{/* className="nutui-cell-clickable"*/}
|
||||
{/* title={*/}
|
||||
{/* <div style={{display: 'inline-flex', alignItems: 'center'}}>*/}
|
||||
{/* <PickedUp size={18}/>*/}
|
||||
{/* <span style={{marginLeft: '5px'}}>客户</span>*/}
|
||||
{/* </div>*/}
|
||||
{/* }*/}
|
||||
{/* align="center"*/}
|
||||
{/* extra={<ArrowRight color="#cccccc" size={18}/>}*/}
|
||||
{/* onClick={() => {*/}
|
||||
{/* navTo('/bszx/pay-log/pay-log', true)*/}
|
||||
{/* }}*/}
|
||||
{/* />*/}
|
||||
{/* <Cell*/}
|
||||
{/* className="nutui-cell-clickable"*/}
|
||||
{/* title={*/}
|
||||
{/* <div style={{display: 'inline-flex', alignItems: 'center'}}>*/}
|
||||
{/* <Coupon size={18}/>*/}
|
||||
{/* <span style={{marginLeft: '5px'}}>折扣</span>*/}
|
||||
{/* </div>*/}
|
||||
{/* }*/}
|
||||
{/* align="center"*/}
|
||||
{/* extra={<ArrowRight color="#cccccc" size={18}/>}*/}
|
||||
{/* onClick={() => {*/}
|
||||
{/* navTo('/user/profile/profile', true)*/}
|
||||
{/* }}*/}
|
||||
{/* />*/}
|
||||
{/*</Cell.Group>*/}
|
||||
{/*<Cell.Group divider={true} description={*/}
|
||||
{/* <div style={{display: 'inline-flex', alignItems: 'center'}}>*/}
|
||||
{/* <span style={{marginTop: '12px'}}>设置与帮助</span>*/}
|
||||
{/* </div>*/}
|
||||
{/*}>*/}
|
||||
{/* <Cell*/}
|
||||
{/* className="nutui-cell-clickable"*/}
|
||||
{/* title="店铺设置"*/}
|
||||
{/* align="center"*/}
|
||||
{/* extra={<ArrowRight color="#cccccc" size={18}/>}*/}
|
||||
{/* onClick={() => Taro.navigateTo({url: '/website/modify'})}*/}
|
||||
{/* />*/}
|
||||
{/* <Cell*/}
|
||||
{/* className="nutui-cell-clickable"*/}
|
||||
{/* title="帮助中心"*/}
|
||||
{/* align="center"*/}
|
||||
{/* extra={<ArrowRight color="#cccccc" size={18}/>}*/}
|
||||
{/* onClick={() => {*/}
|
||||
{/* navTo('/user/profile/profile', true)*/}
|
||||
{/* }}*/}
|
||||
{/* />*/}
|
||||
{/* <Cell*/}
|
||||
{/* className="nutui-cell-clickable"*/}
|
||||
{/* title="问题反馈"*/}
|
||||
{/* align="center"*/}
|
||||
{/* extra={<ArrowRight color="#cccccc" size={18}/>}*/}
|
||||
{/* onClick={() => {*/}
|
||||
{/* navTo('/user/profile/profile', true)*/}
|
||||
{/* }}*/}
|
||||
{/* />*/}
|
||||
{/*</Cell.Group>*/}
|
||||
<Cell.Group divider={true} description={
|
||||
<div style={{display: 'inline-flex', alignItems: 'center'}}>
|
||||
<span style={{marginTop: '12px'}}>账号管理</span>
|
||||
@@ -195,7 +142,6 @@ const UserCell = () => {
|
||||
/>
|
||||
</Cell.Group>
|
||||
</div>
|
||||
<UserFooter/>
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ const UserFooter = () => {
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className={'text-center bg-gray-50 py-4 w-full text-gray-300'} onClick={onLoginByPhone}>
|
||||
<div className={'text-center py-4 w-full text-gray-300'} onClick={onLoginByPhone}>
|
||||
<div className={'text-xs text-gray-400 py-1'}>当前版本:{Version}</div>
|
||||
<div className={'text-xs text-gray-400 py-1'}>Copyright © { new Date().getFullYear() } {Copyright}</div>
|
||||
</div>
|
||||
|
||||
@@ -1,7 +1,3 @@
|
||||
page {
|
||||
background: linear-gradient(to bottom, #e9fff2, #f9fafb);
|
||||
background-size: 100%;
|
||||
}
|
||||
.header-bg{
|
||||
background: url('https://oss.wsdns.cn/20250621/edb5d4da976b4d97ba185cb7077d2858.jpg') no-repeat top center;
|
||||
background-size: 100%;
|
||||
|
||||
@@ -2,15 +2,19 @@ import {useEffect} from 'react'
|
||||
import UserCard from "./components/UserCard";
|
||||
import UserCell from "./components/UserCell";
|
||||
import './user.scss'
|
||||
import UserFooter from "./components/UserFooter";
|
||||
function User() {
|
||||
|
||||
useEffect(() => {
|
||||
}, []);
|
||||
return (
|
||||
<>
|
||||
<div className={'w-full header-bg pt-36'}>
|
||||
<div className={'w-full'} style={{
|
||||
background: 'linear-gradient(to bottom, #e9fff2, #f9fafb)'
|
||||
}}>
|
||||
<UserCard />
|
||||
<UserCell />
|
||||
<UserFooter/>
|
||||
</div>
|
||||
</>
|
||||
)
|
||||
|
||||
@@ -201,7 +201,7 @@ const GoodsDetail = () => {
|
||||
onClick={() => handleAddToCart()}>加入购物车
|
||||
</div>
|
||||
<div className={'cart-buy pl-4 pr-5 text-sm'}
|
||||
onClick={() => Taro.navigateTo({url: '/shop/orderConfirm/index'})}>立即购买
|
||||
onClick={() => Taro.navigateTo({url: `/shop/orderConfirm/index?goodsId=${goods?.goodsId}`})}>立即购买
|
||||
</div>
|
||||
</div>
|
||||
</View>
|
||||
|
||||
@@ -1,15 +1,27 @@
|
||||
import {useEffect, useState} from "react";
|
||||
import {Image, Button, Cell, CellGroup, Input, TextArea} from '@nutui/nutui-react-taro'
|
||||
import {Image, Button, Cell, CellGroup, Input, TextArea, Space} from '@nutui/nutui-react-taro'
|
||||
import {Location} from '@nutui/icons-react-taro'
|
||||
import Taro from '@tarojs/taro'
|
||||
import {ShopGoods} from "@/api/shop/shopGoods/model";
|
||||
import {getShopGoods} from "@/api/shop/shopGoods";
|
||||
import {View} from '@tarojs/components';
|
||||
import {listShopUserAddress} from "@/api/shop/shopUserAddress";
|
||||
import {ShopUserAddress} from "@/api/shop/shopUserAddress/model";
|
||||
import './index.scss'
|
||||
|
||||
const OrderConfirm = () => {
|
||||
const [goods, setGoods] = useState<ShopGoods | null>(null);
|
||||
const [address, setAddress] = useState<ShopUserAddress>()
|
||||
const router = Taro.getCurrentInstance().router;
|
||||
const goodsId = router?.params?.goodsId;
|
||||
|
||||
const reload = async () => {
|
||||
const address = await listShopUserAddress({isDefault: true});
|
||||
if(address.length > 0){
|
||||
setAddress(address[0])
|
||||
}
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
if (goodsId) {
|
||||
getShopGoods(Number(goodsId)).then(res => {
|
||||
@@ -18,6 +30,7 @@ const OrderConfirm = () => {
|
||||
console.error("Failed to fetch goods detail:", error);
|
||||
});
|
||||
}
|
||||
reload().then()
|
||||
}, [goodsId]);
|
||||
|
||||
if (!goods) {
|
||||
@@ -26,7 +39,29 @@ const OrderConfirm = () => {
|
||||
|
||||
return (
|
||||
<div className={'order-confirm-page'}>
|
||||
<CellGroup title="商品信息">
|
||||
<CellGroup>
|
||||
{
|
||||
address && (
|
||||
<Cell>
|
||||
<Space>
|
||||
<Location/>
|
||||
<View>送至</View>
|
||||
<View>{address.fullAddress}</View>
|
||||
</Space>
|
||||
</Cell>
|
||||
)
|
||||
}
|
||||
{!address && (
|
||||
<Cell className={''} onClick={() => Taro.navigateTo({url: '/user/address/index'})}>
|
||||
<Space>
|
||||
<Location/>
|
||||
添加收货地址
|
||||
</Space>
|
||||
</Cell>
|
||||
)}
|
||||
</CellGroup>
|
||||
|
||||
<CellGroup>
|
||||
<Cell>
|
||||
<div className={'flex items-center'}>
|
||||
<Image src={goods.image} width="80" height="80"/>
|
||||
|
||||
4
src/user/about/index.config.ts
Normal file
4
src/user/about/index.config.ts
Normal file
@@ -0,0 +1,4 @@
|
||||
export default definePageConfig({
|
||||
navigationBarTitleText: '常见问题',
|
||||
navigationBarTextStyle: 'black'
|
||||
})
|
||||
3
src/user/about/index.scss
Normal file
3
src/user/about/index.scss
Normal file
@@ -0,0 +1,3 @@
|
||||
:root {
|
||||
|
||||
}
|
||||
43
src/user/about/index.tsx
Normal file
43
src/user/about/index.tsx
Normal 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;
|
||||
4
src/user/address/add.config.ts
Normal file
4
src/user/address/add.config.ts
Normal file
@@ -0,0 +1,4 @@
|
||||
export default definePageConfig({
|
||||
navigationBarTitleText: '新增收货地址',
|
||||
navigationBarTextStyle: 'black'
|
||||
})
|
||||
0
src/user/address/add.scss
Normal file
0
src/user/address/add.scss
Normal file
194
src/user/address/add.tsx
Normal file
194
src/user/address/add.tsx
Normal 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;
|
||||
4
src/user/address/index.config.ts
Normal file
4
src/user/address/index.config.ts
Normal file
@@ -0,0 +1,4 @@
|
||||
export default definePageConfig({
|
||||
navigationBarTitleText: '地址管理',
|
||||
navigationBarTextStyle: 'black'
|
||||
})
|
||||
3
src/user/address/index.scss
Normal file
3
src/user/address/index.scss
Normal file
@@ -0,0 +1,3 @@
|
||||
:root {
|
||||
|
||||
}
|
||||
124
src/user/address/index.tsx
Normal file
124
src/user/address/index.tsx
Normal 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;
|
||||
4
src/user/address/wxAddress.config.ts
Normal file
4
src/user/address/wxAddress.config.ts
Normal file
@@ -0,0 +1,4 @@
|
||||
export default definePageConfig({
|
||||
navigationBarTitleText: '我的地址',
|
||||
navigationBarTextStyle: 'black'
|
||||
})
|
||||
92
src/user/address/wxAddress.tsx
Normal file
92
src/user/address/wxAddress.tsx
Normal 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;
|
||||
4
src/user/help/index.config.ts
Normal file
4
src/user/help/index.config.ts
Normal file
@@ -0,0 +1,4 @@
|
||||
export default definePageConfig({
|
||||
navigationBarTitleText: '常见问题',
|
||||
navigationBarTextStyle: 'black'
|
||||
})
|
||||
3
src/user/help/index.scss
Normal file
3
src/user/help/index.scss
Normal file
@@ -0,0 +1,3 @@
|
||||
:root {
|
||||
|
||||
}
|
||||
40
src/user/help/index.tsx
Normal file
40
src/user/help/index.tsx
Normal 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;
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user