diff --git a/src/app.config.ts b/src/app.config.ts index bf025e5..7bb193d 100644 --- a/src/app.config.ts +++ b/src/app.config.ts @@ -14,6 +14,7 @@ export default defineAppConfig({ name: 'store-package', pages: [ 'mapStore/index', // 地图找店页面 + 'reservation/index', // 预定页面 ] }, { @@ -27,6 +28,7 @@ export default defineAppConfig({ 'goodsCons/index', // 商品消费 'goodsOrderDetail/index', // 商品消费详情 (已支付,未支付) 'goodsRefundResult/index', // 商品退款结果(成功,失败) + 'historyCoupons/index', // 历史优惠券 'helpCenter/index', // 帮助中心 'agreement/index', // 协议 'editProfile/index', // 编辑资料 @@ -43,6 +45,7 @@ export default defineAppConfig({ 'timedStart/index', // 定时开台页面 'couponStart/index', // 团购券开台页面 'myCoupons/index', // 我的卡券(持有卡券) + 'couponUse/index', // 卡券使用页面 'closeTable/index', // 关台页面 'renewFee/index', // 续费页面 'turnOffRestart/index', // 关灯重开页面 diff --git a/src/pageScan/couponUse/index.scss b/src/pageScan/couponUse/index.scss new file mode 100644 index 0000000..dcf1dd9 --- /dev/null +++ b/src/pageScan/couponUse/index.scss @@ -0,0 +1,292 @@ +/** + * 卡券使用页面样式 + */ +.coupon_use_page { + min-height: 100vh; + background-color: #121212; + padding-bottom: 180px; + + // 卡券信息区域 + .coupon_info_section { + padding: 30px; + background-color: #121212; + + .coupon_header { + display: flex; + justify-content: space-between; + align-items: flex-start; + + .coupon_title_area { + flex: 1; + display: flex; + flex-direction: column; + gap: 12px; + padding-right: 30px; + + .coupon_title { + font-size: 33px; + color: #FEFEFE; + font-weight: 500; + line-height: 1.4; + } + + .coupon_valid { + font-size: 25px; + color: #A8A8A8; + line-height: 1.4; + } + + .coupon_method { + font-size: 25px; + color: #A8A8A8; + line-height: 1.4; + } + } + + .coupon_duration_area { + flex-shrink: 0; + display: flex; + align-items: baseline; + + .duration_value { + font-size: 60px; + color: #A8A8A8; + font-weight: bold; + line-height: 1; + } + + .duration_unit { + font-size: 25px; + color: #A8A8A8; + margin-left: 4px; + } + } + } + } + + // 选择门店区域 + .store_select_section { + padding: 30px; + padding-top: 0; + + .section_title_row { + display: flex; + align-items: center; + margin-bottom: 15px; + + .section_title { + font-size: 31px; + color: #FFFFFF; + font-weight: 500; + } + + .partial_tip { + font-size: 25px; + color: #A8A8A8; + margin-left: 10px; + } + } + + .selected_store { + font-size: 27px; + color: #A8A8A8; + margin-bottom: 25px; + display: block; + } + + // 搜索栏 + .search_row { + display: flex; + align-items: center; + background-color: #21212A; + border: 1PX solid #444444; + border-radius: 8px; + height: 80px; + overflow: hidden; + + .city_dropdown { + flex-shrink: 0; + width: 160px; + height: 100%; + display: flex; + align-items: center; + justify-content: center; + border-right: 1PX solid #444444; + padding: 0 15px; + gap: 8px; + + .city_text { + font-size: 27px; + color: #FFFFFF; + } + + .city_arrow { + font-size: 20px; + color: #FFFFFF; + transform: rotate(90deg); + } + } + + .search_input { + flex: 1; + display: flex; + align-items: center; + padding: 0 20px; + height: 100%; + + .search_field { + flex: 1; + font-size: 27px; + color: #FFFFFF; + background-color: #21212A; + } + + .search_placeholder { + color: #999999; + } + + .search_icon { + flex-shrink: 0; + font-size: 36px; + color: #FFFFFF; + } + } + } + + // 城市选择弹窗 + .city_picker { + background-color: #21212A; + padding: 30px; + padding-bottom: calc(30px + env(safe-area-inset-bottom)); + + .picker_header { + text-align: center; + margin-bottom: 30px; + + .picker_title { + font-size: 33px; + color: #FFFFFF; + font-weight: 500; + } + } + + .picker_options { + .picker_option { + display: flex; + align-items: center; + justify-content: space-between; + padding: 30px 20px; + border-bottom: 1PX solid #2A2A2A; + + &:last-child { + border-bottom: none; + } + + &.selected { + .option_text { + color: #03C175; + } + } + + .option_text { + font-size: 29px; + color: #FFFFFF; + } + + .check_icon { + font-size: 29px; + color: #03C175; + } + } + } + } + } + + // 门店列表 + .store_list { + padding: 0 30px; + + .store_card { + background-color: #21212A; + border-radius: 12px; + padding: 30px; + margin-bottom: 20px; + display: flex; + justify-content: space-between; + align-items: flex-start; + position: relative; + overflow: hidden; + transition: all 0.2s ease; + border: 1px solid #21212A; + // 选中状态 - 边框 + &.selected { + border: 1px solid #03C175; + } + + .store_info { + flex: 1; + display: flex; + flex-direction: column; + gap: 12px; + padding-right: 20px; + + .store_name { + font-size: 30px; + color: #FFFFFF; + font-weight: 500; + line-height: 1.4; + } + + .store_address { + font-size: 25px; + color: #E5E5E5; + line-height: 1.5; + } + } + + .store_distance { + flex-shrink: 0; + + .distance_text { + font-size: 25px; + color: #E5E5E5; + } + } + } + } + + // 到底提示 + .end_tip { + display: block; + text-align: center; + font-size: 25px; + color: #999999; + margin: 40px 0; + } + + // 页脚 + .footer { + position: fixed; + bottom: 0; + left: 0; + right: 0; + background-color: #121212; + padding: 20px 30px; + padding-bottom: calc(20px + env(safe-area-inset-bottom)); + border-top: 1PX solid #2A2A2A; + + .use_btn { + width: 100%; + height: 88px; + background-color: #03C175; + border-radius: 44px; + border: none; + display: flex; + align-items: center; + justify-content: center; + font-size: 31px; + color: #FFFFFF; + font-weight: 500; + } + } +} diff --git a/src/pageScan/couponUse/index.tsx b/src/pageScan/couponUse/index.tsx new file mode 100644 index 0000000..e17b177 --- /dev/null +++ b/src/pageScan/couponUse/index.tsx @@ -0,0 +1,236 @@ +/** + * 卡券使用页面 + */ +import { View, Text, Input } from '@tarojs/components' +import Taro, { useLoad, useRouter } from '@tarojs/taro' +import { useState } from 'react' +import { Popup, Button } from '@taroify/core' +import { Arrow, Search as SearchIcon } from '@taroify/icons' +import './index.scss' + +// 门店数据接口 +interface Store { + id: number + name: string + address: string + distance: string +} + +// 城市选项 +const cityOptions = [ + { title: '选城市', value: 'all' }, + { title: '北京', value: 'beijing' }, + { title: '上海', value: 'shanghai' }, + { title: '广州', value: 'guangzhou' }, + { title: '深圳', value: 'shenzhen' }, +] + +const CouponUse = () => { + const router = useRouter() + const { couponId } = router.params + + // 卡券信息(从路由参数或上一页面传递,实际应根据couponId获取) + const [couponInfo] = useState({ + title: '豪华自助台球厅20分钟通用券(体验券)', + duration: '20', + validPeriod: '2025.10.01 - 2025.10.07(有效7天)', + useMethod: '自动抵扣,单次使用', + partialUsable: true, // 部分门店不可用 + }) + + // 城市选择 + const [selectedCity, setSelectedCity] = useState('all') + const [showCityPicker, setShowCityPicker] = useState(false) + + // 搜索关键词 + const [searchValue, setSearchValue] = useState('') + + // 已选门店 + const [selectedStoreId, setSelectedStoreId] = useState(1) + + // 门店列表(模拟数据) + const [storeList] = useState([ + { + id: 1, + name: '北京黑八大师联盟球厅店', + address: '北京市XXX区XXX街道XXXXXXXXXXXXXXXXXXXXXXX路19号606', + distance: '0.05km' + }, + { + id: 2, + name: '北京晶彩桌球世界店', + address: '北京市XXX区XXX街道XXX路19号606', + distance: '0.1km' + }, + { + id: 3, + name: '北京球坛风云店', + address: '北京市XXX区XXXXXXXXXXX街道XXX路19号606', + distance: '0.2km' + }, + ]) + + useLoad(() => { + console.log('卡券使用页面加载') + Taro.setNavigationBarTitle({ title: '' }) + }) + + // 获取已选门店名称 + const getSelectedStoreName = () => { + const store = storeList.find(s => s.id === selectedStoreId) + return store ? store.name : '' + } + + // 选择门店 + const handleSelectStore = (storeId: number) => { + setSelectedStoreId(storeId) + } + + // 搜索 + const handleSearch = () => { + console.log('搜索', searchValue) + Taro.showToast({ + title: `搜索: ${searchValue}`, + icon: 'none' + }) + } + + // 获取当前城市名称 + const getCityName = () => { + const city = cityOptions.find(c => c.value === selectedCity) + return city ? city.title : '选城市' + } + + // 选择城市 + const handleSelectCity = (value: string) => { + setSelectedCity(value) + setShowCityPicker(false) + } + + // 去使用 + const handleUse = () => { + if (!selectedStoreId) { + Taro.showToast({ + title: '请选择门店', + icon: 'none' + }) + return + } + console.log('使用卡券', selectedStoreId) + Taro.showToast({ + title: '卡券使用成功', + icon: 'success' + }) + } + + return ( + + {/* 卡券信息区域 */} + + + + {couponInfo.title} + 有效期限:{couponInfo.validPeriod} + 使用方法:{couponInfo.useMethod} + + + {couponInfo.duration} + 分钟 + + + + +
+ + {/* 选择门店区域 */} + + + 选择门店 + {couponInfo.partialUsable && ( + (部分门店不可用) + )} + + 已选门店:{getSelectedStoreName()} + + {/* 搜索栏 */} + + setShowCityPicker(true)}> + {getCityName()} + + + + setSearchValue(e.detail.value)} + onConfirm={handleSearch} + /> + + + + + {/* 城市选择弹窗 */} + setShowCityPicker(false)} + > + + + 选择城市 + + + {cityOptions.map((city) => ( + handleSelectCity(city.value)} + > + {city.title} + {selectedCity === city.value && } + + ))} + + + + + + {/* 门店列表 */} + + {storeList.map((store) => ( + handleSelectStore(store.id)} + > + + {store.name} + {store.address} + + + 距离{store.distance} + + + ))} + + + {/* 到底提示 */} + 到底了~ + + {/* 页脚按钮 */} + + + +
+ ) +} + +export default CouponUse diff --git a/src/pageScan/myCoupons/index.scss b/src/pageScan/myCoupons/index.scss index 1ef2b80..8cf5f7d 100644 --- a/src/pageScan/myCoupons/index.scss +++ b/src/pageScan/myCoupons/index.scss @@ -86,6 +86,7 @@ display: flex; padding: 30px; gap: 20px; + align-items: center; // 左侧:时长和券类型 .coupon_left { @@ -123,8 +124,8 @@ } } - // 右侧:信息区域 - .coupon_right { + // 中间:信息区域 + .coupon_center { flex: 1; display: flex; flex-direction: column; @@ -133,24 +134,11 @@ // 标题行 .title_row { - display: flex; - align-items: center; - justify-content: space-between; - gap: 12px; - .coupon_title { - flex: 1; font-size: 29px; color: #FFFFFF; font-weight: 500; line-height: 1.4; - min-width: 0; - } - - .coupon_price { - font-size: 25px; - color: #FFFFFF; - flex-shrink: 0; } } @@ -166,6 +154,43 @@ white-space: pre-line; } } + + // 右侧:按钮区域 + .coupon_action { + flex-shrink: 0; + + .action_btn { + min-width: 120px; + height: 60px; + border-radius: 30px; + display: flex; + align-items: center; + justify-content: center; + + .btn_text { + font-size: 25px; + font-weight: 500; + } + + // 去使用按钮 - 橙色 + &.use_btn { + background-color: #FF6B00; + + .btn_text { + color: #FFFFFF; + } + } + + // 购买按钮 - 可以用不同颜色 + &.buy_btn { + background-color: #FF6B00; + + .btn_text { + color: #FFFFFF; + } + } + } + } } // 详情区域 @@ -173,7 +198,12 @@ padding: 0 30px 30px; border-top: 1px dashed #3A3A3A; padding-top: 20px; - + .detail_text { + flex: 1; + font-size: 23px; + color: #999999; + line-height: 1.8; + } .detail_row { display: flex; align-items: center; diff --git a/src/pageScan/myCoupons/index.tsx b/src/pageScan/myCoupons/index.tsx index 382c3d9..76cf6cc 100644 --- a/src/pageScan/myCoupons/index.tsx +++ b/src/pageScan/myCoupons/index.tsx @@ -26,6 +26,7 @@ interface Coupon { details: string[] expanded: boolean price?: string // 价格(活动券可能有) + buttonType?: 'use' | 'buy' // 按钮类型:去使用 | 购买 } const MyCoupons = () => { @@ -43,6 +44,7 @@ const MyCoupons = () => { description: '', details: ['不限时段,全天可用'], expanded: false, + buttonType: 'use' }, { id: 2, @@ -54,7 +56,8 @@ const MyCoupons = () => { description: '需要交押金,超时扣押金', details: ['不限时段,全天可用', '适用类型:中八', '适用门店:北京球场风云店'], expanded: false, - price: '¥9.9' + price: '¥9.9', + buttonType: 'use' }, { id: 3, @@ -66,7 +69,8 @@ const MyCoupons = () => { description: '', details: ['不限时段,全天可用', '适用类型:棋牌室', '适用门店:北京黑八大师联盟球厅店'], expanded: false, - price: '¥59.9' + price: '¥59.9', + buttonType: 'buy' }, ]) @@ -113,12 +117,28 @@ const MyCoupons = () => { // 跳转到历史优惠券 const handleGoHistoryCoupons = () => { console.log('历史优惠券') - Taro.showToast({ - title: '跳转历史优惠券', - icon: 'none' + Taro.navigateTo({ + url: '/pagesUser/historyCoupons/index' }) } + // 点击卡券按钮 + const handleCouponAction = (coupon: Coupon) => { + if (coupon.buttonType === 'use') { + console.log('去使用', coupon.id) + // 跳转到卡券使用页面 + Taro.navigateTo({ + url: `/pageScan/couponUse/index?couponId=${coupon.id}` + }) + } else if (coupon.buttonType === 'buy') { + console.log('购买', coupon.id) + Taro.showToast({ + title: '跳转购买页面', + icon: 'none' + }) + } + } + return ( {/* 券类型选项卡 */} @@ -153,14 +173,11 @@ const MyCoupons = () => { {coupon.couponType} - {/* 右侧:信息区域 */} - - {/* 标题行:标题 + 价格或使用按钮 */} + {/* 中间:信息区域 */} + + {/* 标题行 */} {coupon.title} - {coupon.price && ( - {coupon.price} - )} {/* 有效期 */} @@ -169,6 +186,23 @@ const MyCoupons = () => { {/* 描述 */} {coupon.description && {coupon.description}} + + {/* 右侧:按钮区域 */} + {coupon.buttonType && ( + + { + e.stopPropagation() + handleCouponAction(coupon) + }} + > + + {coupon.buttonType === 'use' ? '去使用' : '购买'} + + + + )} {/* 详情区域 */} diff --git a/src/pageScan/useCoupon/index.tsx b/src/pageScan/useCoupon/index.tsx new file mode 100644 index 0000000..e69de29 diff --git a/src/pageStore/reservation/index.scss b/src/pageStore/reservation/index.scss new file mode 100644 index 0000000..e720cd6 --- /dev/null +++ b/src/pageStore/reservation/index.scss @@ -0,0 +1,295 @@ +/** + * 预定页面样式 + */ +.reservation_page { + min-height: 100vh; + background-color: #121212; + padding-bottom: 130px; // 为底部固定区域留空间 + + // 内容区域 + .content_area { + padding: 30px 30px 0; + + // 台球桌信息卡片 + .table_card { + background-image: url('../../pageScan/startTable/images/startBiliardCardBg.png'); + background-size: cover; + background-position: center; + border-radius: 12px; + padding: 24px; + margin-bottom: 30px; + display: flex; + flex-direction: column; + justify-content: space-between; + + // 顶部:店名和电话 + .card_header { + display: flex; + justify-content: space-between; + align-items: center; + margin-bottom: 20px; + + .store_name { + font-size: 25px; + color: #FFFFFF; + } + + .phone_box { + display: flex; + align-items: center; + gap: 8px; + + .phone_icon { + width: 29px; + height: 29px; + } + + .phone_text { + font-size: 25px; + color: #FFFFFF; + } + } + } + + // 台球桌标题 + .table_title { + font-weight: bold; + font-size: 42px; + color: #FFFFFF; + line-height: 1.4; + margin: 24px 0 26px; + } + + // 价格信息 + .price_info { + display: flex; + align-items: center; + gap: 10px; + margin-bottom: 24px; + + .price_item { + display: flex; + align-items: baseline; + gap: 2px; + + .price_label { + font-size: 25px; + color: #FFFFFF; + } + + .price_value { + font-size: 22px; + color: #FFFFFF; + font-weight: bold; + // 文字渐变色 + background: linear-gradient(0deg, #F6AE54 0%, #FBE49E 50%, #F6AE54 100%); + -webkit-background-clip: text; + -webkit-text-fill-color: transparent; + } + } + + .vip_price { + background: linear-gradient(90deg, #333333 0%, #000000 100%); + border-radius: 8px; + padding: 7px 9px; + + .vip_text { + font-size: 22px; + color: #FFFFFF; + } + } + } + + // 价格时段 + .time_period { + font-size: 25px; + color: #fFF; + } + } + + // 费用信息卡片 + .fee_card { + background-color: #21212A; + border-radius: 13px; + padding: 30px; + margin-bottom: 30px; + + // 费用行 + .fee_row { + display: flex; + align-items: center; + justify-content: space-between; + + .fee_label { + font-size: 31px; + color: #E6E6E6; + } + + .fee_value { + font-size: 31px; + color: #E6E6E6; + } + } + + // 分割线 + .divider { + height: 1PX; + background-color: #3A3D42; + margin: 30px 0; + } + + // 收费标准行 + .fee_standard_row { + display: flex; + align-items: center; + justify-content: space-between; + + .fee_label { + font-size: 31px; + color: #E6E6E6; + } + + .fee_right { + display: flex; + align-items: center; + gap: 10px; + + .fee_value { + font-size: 31px; + color: #E6E6E6; + } + + .arrow_icon { + font-size: 28px; + color: #E6E6E6; + transition: transform 0.3s ease; + transform: rotate(90deg); // 默认向下 + + &.expanded { + transform: rotate(-90deg); // 展开时向上 + } + } + } + } + + // 收费标准详情 + .fee_detail { + margin-top: 20px; + padding: 20px; + background-color: #2A2A35; + border-radius: 8px; + + .detail_text { + display: block; + font-size: 25px; + color: #999999; + line-height: 1.6; + margin-bottom: 12px; + } + + .detail_item { + display: block; + font-size: 25px; + color: #999999; + line-height: 1.8; + } + } + } + + // 支付方式单元格 + .payment_cell { + height: 100px; + background-color: #21212A; + margin-bottom: 30px; + border-radius: 13px; + padding: 0 30px; + display: flex; + align-items: center; + justify-content: space-between; + + .payment_label { + font-size: 31px; + color: #E6E6E6; + } + + .payment_right { + display: flex; + align-items: center; + gap: 8px; + + .payment_value { + font-size: 31px; + color: #E6E6E6; + } + + .payment_arrow { + font-size: 28px; + color: #E6E6E6; + } + } + } + + // 温馨提示 + .tips_section { + padding: 0 10px; + + .tips_text { + display: block; + font-size: 25px; + color: #666666; + line-height: 1.8; + } + } + } + + // 底部固定区域 + .footer_bar { + position: fixed; + bottom: 0; + left: 0; + right: 0; + height: 130px; + background-color: #1A1A1A; + display: flex; + align-items: center; + justify-content: space-between; + padding: 0 30px; + box-shadow: 0px -2px 10px rgba(0, 0, 0, 0.3); + + // 支付信息 + .payment_info { + display: flex; + align-items: baseline; + gap: 8px; + + .payment_label { + font-size: 28px; + color: #FFFFFF; + } + + .payment_symbol { + font-size: 28px; + color: #FFFFFF; + } + + .payment_amount { + font-size: 45px; + color: #FFFFFF; + font-weight: bold; + } + } + + // 立即预定按钮 + .confirm_btn { + background-color: #01CA68; + border-radius: 50px; + padding: 20px 60px; + + .confirm_text { + font-size: 31px; + color: #FFFFFF; + font-weight: bold; + } + } + } +} diff --git a/src/pageStore/reservation/index.tsx b/src/pageStore/reservation/index.tsx new file mode 100644 index 0000000..9584284 --- /dev/null +++ b/src/pageStore/reservation/index.tsx @@ -0,0 +1,158 @@ +/** + * 预定页面 + */ +import { View, Text, Image } from '@tarojs/components' +import Taro, { useLoad } from '@tarojs/taro' +import { useState } from 'react' +import { Arrow } from '@taroify/icons' +import './index.scss' + +// 使用本地图片资源 +const phoneIcon = require('../../pageScan/startTable/images/phone.png') + +const Reservation = () => { + const [paymentMethod] = useState('微信支付') // 支付方式 + const [showFeeDetail, setShowFeeDetail] = useState(true) // 是否展示收费标准详情 + + useLoad(() => { + console.log('预定页面加载') + }) + + // 拨打电话 + const handlePhoneCall = () => { + Taro.makePhoneCall({ + phoneNumber: '100-666-XXXX', + }).catch((err) => { + console.error('拨打电话失败:', err) + }) + } + + // 选择支付方式 + const handleSelectPayment = () => { + Taro.showToast({ + title: '暂时只支持微信支付', + icon: 'none', + duration: 2000 + }) + } + + // 切换收费标准展开/收起 + const toggleFeeDetail = () => { + setShowFeeDetail(!showFeeDetail) + } + + // 立即预定 + const handleConfirmReservation = () => { + console.log('立即预定') + Taro.showToast({ + title: '功能开发中', + icon: 'none', + duration: 2000 + }) + } + + return ( + + {/* 内容区域 */} + + {/* 台球桌信息卡片 */} + + {/* 顶部:店名和电话 */} + + 北京黑八大师联盟球厅店 + + + 联系店长 + + + + {/* 台球桌标题 */} + + [台球]来力黑金刚03 + + + {/* 价格信息 */} + + + ¥60.00 + /小时, + + + 押金 + ¥100.00 + + + VIP ¥50.00 + + + + {/* 价格时段 */} + + 价格时段:00:00-24:00 + + + + {/* 费用信息卡片 */} + + {/* 预定金 */} + + 预定金 + 30元 + + + {/* 分割线 */} + + + {/* 收费标准 */} + + 收费标准 + + 80元/小时 + + + + + {/* 收费标准详情 */} + {showFeeDetail && ( + + 1分钟以内不计费,超过1分钟按6.67元/5分钟计费 + • 00:00-11:00 原价90元/小时,折扣价80元/小时 + • 11:00-24:00 原价100元/小时,折扣价90元/小时 + + )} + + + {/* 支付方式 */} + + 支付方式 + + {paymentMethod} + + + + + {/* 温馨提示 */} + + 温馨提示:(预定桌台时间:10分钟) + 1. 预定桌台成功后,3分钟内取消可退回预定金,3分钟后无法取消; + 2. 预定10分钟内开台成功,预定金原路退回; + 3. 未在预定时间内开台,则扣除预定金(预定金自动充值至账户余额)。 + + + + {/* 底部固定区域 */} + + + 需支付 + ¥ + 30.00 + + + 立即预定 + + + + ) +} + +export default Reservation diff --git a/src/pages/scan/index.tsx b/src/pages/scan/index.tsx index 754687d..ecf872f 100644 --- a/src/pages/scan/index.tsx +++ b/src/pages/scan/index.tsx @@ -72,14 +72,24 @@ const ScanIndex = observer(() => { }) } + // 预定 + const handleReservation = () => { + Taro.navigateTo({ + url: '/pageStore/reservation/index' + }) + } + return ( 扫码开台 - */} +