删除无用代码
This commit is contained in:
4
src/shop/orderConfirm/index.config.ts
Normal file
4
src/shop/orderConfirm/index.config.ts
Normal file
@@ -0,0 +1,4 @@
|
||||
export default definePageConfig({
|
||||
navigationBarTitleText: '订单确认',
|
||||
navigationBarTextStyle: 'black'
|
||||
})
|
||||
27
src/shop/orderConfirm/index.scss
Normal file
27
src/shop/orderConfirm/index.scss
Normal file
@@ -0,0 +1,27 @@
|
||||
.order-confirm-page {
|
||||
padding-bottom: 100px; // 留出底部固定按钮的空间
|
||||
|
||||
.fixed-bottom {
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 10px 20px;
|
||||
background-color: #fff;
|
||||
border-top: 1px solid #eee;
|
||||
box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
|
||||
|
||||
.total-price {
|
||||
flex: 1;
|
||||
text-align: right;
|
||||
margin-right: 20px;
|
||||
}
|
||||
|
||||
.submit-btn {
|
||||
width: 150px;
|
||||
}
|
||||
}
|
||||
}
|
||||
69
src/shop/orderConfirm/index.tsx
Normal file
69
src/shop/orderConfirm/index.tsx
Normal file
@@ -0,0 +1,69 @@
|
||||
import {useEffect, useState} from "react";
|
||||
import {Image, Button, Cell, CellGroup, Input, TextArea} from '@nutui/nutui-react-taro'
|
||||
import Taro from '@tarojs/taro'
|
||||
import {ShopGoods} from "@/api/shop/shopGoods/model";
|
||||
import {getShopGoods} from "@/api/shop/shopGoods";
|
||||
import './index.scss'
|
||||
|
||||
const OrderConfirm = () => {
|
||||
const [goods, setGoods] = useState<ShopGoods | null>(null);
|
||||
const router = Taro.getCurrentInstance().router;
|
||||
const goodsId = router?.params?.goodsId;
|
||||
|
||||
useEffect(() => {
|
||||
if (goodsId) {
|
||||
getShopGoods(Number(goodsId)).then(res => {
|
||||
setGoods(res);
|
||||
}).catch(error => {
|
||||
console.error("Failed to fetch goods detail:", error);
|
||||
});
|
||||
}
|
||||
}, [goodsId]);
|
||||
|
||||
if (!goods) {
|
||||
return <div>加载中...</div>;
|
||||
}
|
||||
|
||||
return (
|
||||
<div className={'order-confirm-page'}>
|
||||
<CellGroup title="商品信息">
|
||||
<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>
|
||||
|
||||
<CellGroup title="收货信息">
|
||||
<Cell title="收货人">
|
||||
<Input placeholder="请输入收货人姓名" />
|
||||
</Cell>
|
||||
<Cell title="手机号">
|
||||
<Input placeholder="请输入手机号" type="tel" />
|
||||
</Cell>
|
||||
<Cell title="收货地址">
|
||||
<TextArea placeholder="请输入详细收货地址" />
|
||||
</Cell>
|
||||
</CellGroup>
|
||||
|
||||
<CellGroup title="订单备注">
|
||||
<Cell>
|
||||
<TextArea placeholder="请输入订单备注" />
|
||||
</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>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default OrderConfirm;
|
||||
Reference in New Issue
Block a user