新增:余额支付、微信支付、下单确认功能

This commit is contained in:
2025-07-28 11:17:41 +08:00
parent 469e020df5
commit 1fdec4b807
14 changed files with 145 additions and 37 deletions

View File

@@ -6,7 +6,7 @@ import {RichText, View} from '@tarojs/components'
import {ShopGoods} from "@/api/shop/shopGoods/model";
import {getShopGoods} from "@/api/shop/shopGoods";
import {Swiper} from '@nutui/nutui-react-taro'
import {wxParse} from "@/utils/common";
import navTo, {wxParse} from "@/utils/common";
import "./index.scss";
import {useCart} from "@/hooks/useCart";
@@ -23,6 +23,14 @@ const GoodsDetail = () => {
const handleAddToCart = () => {
if (!goods) return;
if(!Taro.getStorageSync('UserId')){
return Taro.showToast({
title: '请先登录',
icon: 'none',
duration: 2000
});
}
addToCart({
goodsId: goods.goodsId!,
name: goods.name || '',
@@ -117,7 +125,7 @@ const GoodsDetail = () => {
top: "50px",
right: "110px",
}}
onClick={() => Taro.navigateTo({url: '/pages/cart/cart'})}>
onClick={() => navTo(`/pages/cart/cart`,true)}>
<Badge value={cartCount} top="-2" right="2">
<div style={{display: 'flex', alignItems: 'center'}}>
<Cart size={16}/>
@@ -201,7 +209,7 @@ const GoodsDetail = () => {
onClick={() => handleAddToCart()}>
</div>
<div className={'cart-buy pl-4 pr-5 text-sm'}
onClick={() => Taro.navigateTo({url: `/shop/orderConfirm/index?goodsId=${goods?.goodsId}`})}>
onClick={() => navTo(`/shop/orderConfirm/index?goodsId=${goods?.goodsId}`,true)}>
</div>
</div>
</View>