forked from gxwebsoft/mp-10550
feat(home): 更新首页配置和界面展示
- 修改开发环境API基础URL地址 - 移除门店选择相关功能组件和逻辑 - 调整页面背景渐变色和字体大小 - 优化轮播图触摸操作支持 - 更新分享标题为用户专属推荐 - 调整商品分类显示,隐藏部分分类入口 - 移除领券中心入口 - 简化配送时间选择,只选择日期不选择具体时间 - 移除门店选择界面元素 - 调整时间选择器为日期模式并修正时间格式化逻辑
This commit is contained in:
@@ -12,7 +12,7 @@ import {
|
||||
Popup,
|
||||
Space
|
||||
} from '@nutui/nutui-react-taro'
|
||||
import { ArrowRight, Location, Shop, Ticket } from '@nutui/icons-react-taro'
|
||||
import { ArrowRight, Location, Ticket } from '@nutui/icons-react-taro'
|
||||
import dayjs from 'dayjs'
|
||||
import type { ShopGoods } from '@/api/shop/shopGoods/model'
|
||||
import { getShopGoods } from '@/api/shop/shopGoods'
|
||||
@@ -35,7 +35,8 @@ const OrderConfirm = () => {
|
||||
const [address, setAddress] = useState<ShopUserAddress>()
|
||||
const [quantity, setQuantity] = useState<number>(MIN_START_QTY)
|
||||
const [orderRemark, setOrderRemark] = useState<string>('')
|
||||
const [sendTime, setSendTime] = useState<Date>(new Date())
|
||||
// Delivery date only (no hour/min selection).
|
||||
const [sendTime, setSendTime] = useState<Date>(() => dayjs().startOf('day').toDate())
|
||||
const [sendTimePickerVisible, setSendTimePickerVisible] = useState(false)
|
||||
const [loading, setLoading] = useState<boolean>(true)
|
||||
const [error, setError] = useState<string>('')
|
||||
@@ -119,7 +120,7 @@ const OrderConfirm = () => {
|
||||
}, [quantity, maxQuantity, canStartOrder])
|
||||
|
||||
const sendTimeText = useMemo(() => {
|
||||
return dayjs(sendTime).format('YYYY-MM-DD HH:mm')
|
||||
return dayjs(sendTime).format('YYYY-MM-DD')
|
||||
}, [sendTime])
|
||||
|
||||
const loadStores = async () => {
|
||||
@@ -137,6 +138,7 @@ const OrderConfirm = () => {
|
||||
}
|
||||
}
|
||||
|
||||
// @ts-ignore
|
||||
const openStorePopup = async () => {
|
||||
setStorePopupVisible(true)
|
||||
if (!stores.length) {
|
||||
@@ -239,7 +241,7 @@ const OrderConfirm = () => {
|
||||
addressId: address.id,
|
||||
totalNum: finalQty,
|
||||
buyerRemarks: orderRemark,
|
||||
sendTime: dayjs(sendTime).format('YYYY-MM-DD HH:mm:ss'),
|
||||
sendTime: dayjs(sendTime).startOf('day').format('YYYY-MM-DD HH:mm:ss'),
|
||||
// Backend may take userId from token; pass-through is harmless if backend ignores it.
|
||||
userId,
|
||||
comments: goods.name ? `立即送水:${goods.name}` : '立即送水'
|
||||
@@ -351,25 +353,25 @@ const OrderConfirm = () => {
|
||||
|
||||
return (
|
||||
<div className={'order-confirm-page'}>
|
||||
<CellGroup>
|
||||
<Cell
|
||||
title={(
|
||||
<View className="flex items-center gap-2">
|
||||
<Shop className={'text-gray-500'}/>
|
||||
<Text>选择门店</Text>
|
||||
</View>
|
||||
)}
|
||||
extra={(
|
||||
<View className={'flex items-center gap-2'}>
|
||||
<View className={'text-gray-900'}>
|
||||
{selectedStore?.name || '请选择门店'}
|
||||
</View>
|
||||
<ArrowRight className={'text-gray-400'} size={14}/>
|
||||
</View>
|
||||
)}
|
||||
onClick={openStorePopup}
|
||||
/>
|
||||
</CellGroup>
|
||||
{/*<CellGroup>*/}
|
||||
{/* <Cell*/}
|
||||
{/* title={(*/}
|
||||
{/* <View className="flex items-center gap-2">*/}
|
||||
{/* <Shop className={'text-gray-500'}/>*/}
|
||||
{/* <Text>选择门店</Text>*/}
|
||||
{/* </View>*/}
|
||||
{/* )}*/}
|
||||
{/* extra={(*/}
|
||||
{/* <View className={'flex items-center gap-2'}>*/}
|
||||
{/* <View className={'text-gray-900'}>*/}
|
||||
{/* {selectedStore?.name || '请选择门店'}*/}
|
||||
{/* </View>*/}
|
||||
{/* <ArrowRight className={'text-gray-400'} size={14}/>*/}
|
||||
{/* </View>*/}
|
||||
{/* )}*/}
|
||||
{/* onClick={openStorePopup}*/}
|
||||
{/* />*/}
|
||||
{/*</CellGroup>*/}
|
||||
<CellGroup>
|
||||
{
|
||||
address && (
|
||||
@@ -587,15 +589,15 @@ const OrderConfirm = () => {
|
||||
<DatePicker
|
||||
visible={sendTimePickerVisible}
|
||||
title="选择配送时间"
|
||||
type="datetime"
|
||||
startDate={new Date()}
|
||||
type="date"
|
||||
startDate={dayjs().startOf('day').toDate()}
|
||||
endDate={dayjs().add(30, 'day').toDate()}
|
||||
value={sendTime}
|
||||
onClose={() => setSendTimePickerVisible(false)}
|
||||
onCancel={() => setSendTimePickerVisible(false)}
|
||||
onConfirm={(_options, selectedValue) => {
|
||||
const [y, m, d, hh, mm] = (selectedValue || []).map(v => Number(v))
|
||||
const next = new Date(y, (m || 1) - 1, d || 1, hh || 0, mm || 0)
|
||||
const [y, m, d] = (selectedValue || []).map(v => Number(v))
|
||||
const next = new Date(y, (m || 1) - 1, d || 1, 0, 0, 0)
|
||||
setSendTime(next)
|
||||
setSendTimePickerVisible(false)
|
||||
}}
|
||||
|
||||
Reference in New Issue
Block a user