This commit is contained in:
@@ -2,6 +2,7 @@ import { View, Text, Image, ScrollView, Button } from '@tarojs/components'
|
||||
import Taro, { useDidShow } from '@tarojs/taro'
|
||||
import { useState, useMemo } from 'react'
|
||||
import { getCart, updateQuantity, removeItem, toggleSelect, toggleSelectAll, CartItem } from '../../utils/cart'
|
||||
import { checkLogin } from '../../utils/auth'
|
||||
import './cart.scss'
|
||||
|
||||
export default function Cart() {
|
||||
@@ -60,6 +61,7 @@ export default function Cart() {
|
||||
}, [cartItems])
|
||||
|
||||
const handleCheckout = () => {
|
||||
if (!checkLogin()) return
|
||||
if (selectedCount === 0) {
|
||||
Taro.showToast({ title: '请选择商品', icon: 'none' })
|
||||
return
|
||||
|
||||
@@ -2,6 +2,7 @@ import { View, Text, Button, Image, ScrollView, Video } from '@tarojs/components
|
||||
import Taro, { useLoad, useShareAppMessage, useShareTimeline } from '@tarojs/taro'
|
||||
import { useState } from 'react'
|
||||
import { getVBCourseDetail } from '../../api'
|
||||
import { checkLogin } from '../../utils/auth'
|
||||
import './detail.scss'
|
||||
|
||||
export default function CourseDetail() {
|
||||
@@ -33,6 +34,7 @@ export default function CourseDetail() {
|
||||
}
|
||||
|
||||
const handleLaunch = () => {
|
||||
if (!checkLogin()) return
|
||||
if (!detail) return
|
||||
Taro.navigateTo({
|
||||
url: `/pages/order/checkout?id=${detail.id}&type=course`
|
||||
|
||||
@@ -2,6 +2,7 @@ import { View, Text, Image, ScrollView, Button } from '@tarojs/components'
|
||||
import Taro, { useRouter, useLoad, useShareAppMessage, useShareTimeline } from '@tarojs/taro'
|
||||
import { useState } from 'react'
|
||||
import { getConfigDetail } from '../../api'
|
||||
import { checkLogin } from '../../utils/auth'
|
||||
import ParticleBackground from '../../components/ParticleBackground'
|
||||
import { addToCart } from '../../utils/cart'
|
||||
import './detail.scss'
|
||||
@@ -50,6 +51,7 @@ export default function Detail() {
|
||||
}
|
||||
|
||||
const buyNow = () => {
|
||||
if (!checkLogin()) return
|
||||
if (!product) return
|
||||
Taro.navigateTo({
|
||||
url: `/pages/order/checkout?id=${product.id}&quantity=1`
|
||||
|
||||
@@ -2,6 +2,7 @@ import { View, Text, Button, Image } from '@tarojs/components'
|
||||
import Taro, { useRouter, useLoad } from '@tarojs/taro'
|
||||
import { useState } from 'react'
|
||||
import { getOrder, prepayMiniprogram } from '../../api'
|
||||
import { checkLogin } from '../../utils/auth'
|
||||
import './detail.scss'
|
||||
|
||||
export default function OrderDetail() {
|
||||
@@ -27,6 +28,7 @@ export default function OrderDetail() {
|
||||
}
|
||||
|
||||
const handlePay = async () => {
|
||||
if (!checkLogin()) return
|
||||
if (!order) return
|
||||
setLoading(true)
|
||||
try {
|
||||
|
||||
@@ -2,6 +2,7 @@ import { View, Text, Image, Button, Input, Textarea } from '@tarojs/components'
|
||||
import Taro, { useLoad, useShareAppMessage, useShareTimeline } from '@tarojs/taro'
|
||||
import { useState } from 'react'
|
||||
import { getServiceDetail, createServiceOrder } from '../../api'
|
||||
import { checkLogin } from '../../utils/auth'
|
||||
import './detail.scss'
|
||||
|
||||
export default function ServiceDetail() {
|
||||
@@ -134,7 +135,11 @@ export default function ServiceDetail() {
|
||||
<Button
|
||||
className='btn-buy'
|
||||
style={{ background: service.color }}
|
||||
onClick={() => setModalVisible(true)}
|
||||
onClick={() => {
|
||||
if (checkLogin()) {
|
||||
setModalVisible(true)
|
||||
}
|
||||
}}
|
||||
>
|
||||
立即咨询 / 购买
|
||||
</Button>
|
||||
|
||||
Reference in New Issue
Block a user