forked from gxwebsoft/mp-10550
优化下单流程
This commit is contained in:
@@ -17,13 +17,13 @@ const GoodsDetail = () => {
|
||||
const goodsId = router?.params?.id;
|
||||
|
||||
// 使用购物车Hook
|
||||
const { cartCount, addToCart } = useCart();
|
||||
const {cartCount, addToCart} = useCart();
|
||||
|
||||
// 处理加入购物车
|
||||
const handleAddToCart = () => {
|
||||
if (!goods) return;
|
||||
|
||||
if(!Taro.getStorageSync('UserId')){
|
||||
if (!Taro.getStorageSync('UserId')) {
|
||||
return Taro.showToast({
|
||||
title: '请先登录',
|
||||
icon: 'none',
|
||||
@@ -125,7 +125,7 @@ const GoodsDetail = () => {
|
||||
top: "50px",
|
||||
right: "110px",
|
||||
}}
|
||||
onClick={() => navTo(`/pages/cart/cart`,true)}>
|
||||
onClick={() => navTo(`/pages/cart/cart`, true)}>
|
||||
<Badge value={cartCount} top="-2" right="2">
|
||||
<div style={{display: 'flex', alignItems: 'center'}}>
|
||||
<Cart size={16}/>
|
||||
@@ -209,7 +209,7 @@ const GoodsDetail = () => {
|
||||
onClick={() => handleAddToCart()}>加入购物车
|
||||
</div>
|
||||
<div className={'cart-buy pl-4 pr-5 text-sm'}
|
||||
onClick={() => navTo(`/shop/orderConfirm/index?goodsId=${goods?.goodsId}`,true)}>立即购买
|
||||
onClick={() => navTo(`/shop/orderConfirm/index?goodsId=${goods?.goodsId}`, true)}>立即购买
|
||||
</div>
|
||||
</div>
|
||||
</View>
|
||||
|
||||
Reference in New Issue
Block a user