forked from gxwebsoft/mp-10550
新增:余额支付、微信支付、下单确认功能
This commit is contained in:
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user