|
|
|
|
@ -10,11 +10,12 @@ import './index.scss'
@@ -10,11 +10,12 @@ import './index.scss'
|
|
|
|
|
|
|
|
|
|
const phoneIcon = require('./images/phone.png') |
|
|
|
|
|
|
|
|
|
// optionCode → 跳转路径映射
|
|
|
|
|
// ctrlType / optionCode → 跳转路径映射
|
|
|
|
|
// CtrlType: 1-押金 2-定时 3-信用 4-团购券
|
|
|
|
|
const OPTION_URL_MAP: Record<number, string> = { |
|
|
|
|
[CtrlType.DepositStart]: '/pageScan/selfStart/index', |
|
|
|
|
[CtrlType.TimedStart]: '/pageScan/timedStart/index', |
|
|
|
|
[CtrlType.CouponStart]: '/pageScan/couponStart/index', |
|
|
|
|
[CtrlType.DepositStart]: '/pageScan/selfStart/index', // 1
|
|
|
|
|
[CtrlType.TimedStart]: '/pageScan/timedStart/index', // 2
|
|
|
|
|
[CtrlType.CouponStart]: '/pageScan/couponStart/index', // 4
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const StartTable = observer(() => { |
|
|
|
|
@ -24,20 +25,25 @@ const StartTable = observer(() => {
@@ -24,20 +25,25 @@ const StartTable = observer(() => {
|
|
|
|
|
|
|
|
|
|
useLoad(() => { |
|
|
|
|
console.log('开台页面加载, grpSn:', grpSn) |
|
|
|
|
console.log('[DEBUG] openOptions:', JSON.stringify(tableStore.scanInfo?.openOptions)) |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
const handlePhoneCall = () => { |
|
|
|
|
Taro.makePhoneCall({ phoneNumber: '100-666-XXXX' }).catch(() => {}) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const handleStartTable = (optionCode: number, available: boolean) => { |
|
|
|
|
const handleStartTable = (option: { optionCode: number; type: number; title: string }, available: boolean) => { |
|
|
|
|
if (!available) { |
|
|
|
|
Taro.showToast({ title: '当前条件不满足,无法使用该开台方式', icon: 'none', duration: 2000 }) |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
const url = OPTION_URL_MAP[optionCode] |
|
|
|
|
// 先用 optionCode 匹配,匹配不到再用 type 匹配
|
|
|
|
|
const url = OPTION_URL_MAP[option.optionCode] ?? OPTION_URL_MAP[option.type] |
|
|
|
|
console.log(`[DEBUG] 点击开台方式 title=${option.title} optionCode=${option.optionCode} type=${option.type} → url=${url}`) |
|
|
|
|
if (url) { |
|
|
|
|
Taro.navigateTo({ url: `${url}?grpSn=${grpSn}` }) |
|
|
|
|
} else if (option.type === CtrlType.CreditStart) { |
|
|
|
|
Taro.showToast({ title: '信用开台功能开发中', icon: 'none', duration: 2000 }) |
|
|
|
|
} else { |
|
|
|
|
Taro.showToast({ title: '功能开发中', icon: 'none', duration: 2000 }) |
|
|
|
|
} |
|
|
|
|
@ -66,16 +72,16 @@ const StartTable = observer(() => {
@@ -66,16 +72,16 @@ const StartTable = observer(() => {
|
|
|
|
|
|
|
|
|
|
<View className="price-info"> |
|
|
|
|
<View className="price-item"> |
|
|
|
|
<Text className="price-value">¥{price ? price.currentPrice.toFixed(2) : '--'}</Text> |
|
|
|
|
<Text className="price-value">¥{price ? (price.currentPrice || price.standard || 0).toFixed(2) : '--'}</Text> |
|
|
|
|
<Text className="price-label">/小时</Text> |
|
|
|
|
</View> |
|
|
|
|
<View className="price-item"> |
|
|
|
|
<Text className="price-label">押金</Text> |
|
|
|
|
<Text className="price-value">¥{price ? price.deposit.toFixed(2) : '--'}</Text> |
|
|
|
|
</View> |
|
|
|
|
{price && price.memberPrice > 0 && ( |
|
|
|
|
{price && (price.memberPrice ?? 0) > 0 && ( |
|
|
|
|
<View className="vip-price"> |
|
|
|
|
<Text className="vip-text">VIP ¥{price.memberPrice.toFixed(2)}</Text> |
|
|
|
|
<Text className="vip-text">VIP ¥{price.memberPrice!.toFixed(2)}</Text> |
|
|
|
|
</View> |
|
|
|
|
)} |
|
|
|
|
</View> |
|
|
|
|
@ -100,7 +106,7 @@ const StartTable = observer(() => {
@@ -100,7 +106,7 @@ const StartTable = observer(() => {
|
|
|
|
|
<View className="method-right"> |
|
|
|
|
<View |
|
|
|
|
className={`start-btn ${!option.available ? 'disabled' : ''}`} |
|
|
|
|
onClick={() => handleStartTable(option.optionCode, option.available)} |
|
|
|
|
onClick={() => handleStartTable(option, option.available)} |
|
|
|
|
> |
|
|
|
|
<Text className="btn-text">{option.available ? option.actionText || '去开台' : '不可用'}</Text> |
|
|
|
|
</View> |
|
|
|
|
|