refactor(user/gift): 修复 CSS 兼容性问题并优化礼品卡功能
- 移除了不兼容的 CSS 类名,解决了 WXSS 编译错误 - 优化了礼品卡详细页面,添加了二维码弹窗功能 - 简化了礼品卡统计组件,提高了页面加载速度 - 修复了 SimpleQRCodeModal组件中的样式问题 - 优化了验证页面中的布局结构
This commit is contained in:
@@ -119,37 +119,6 @@ const StoreVerification: React.FC = () => {
|
||||
}
|
||||
}
|
||||
|
||||
// 模拟验证核销码
|
||||
const mockVerifyCode = async (code: string) => {
|
||||
// 模拟API调用延迟
|
||||
await new Promise(resolve => setTimeout(resolve, 1000))
|
||||
|
||||
// 模拟验证逻辑
|
||||
if (code.length === 6 && /^\d+$/.test(code)) {
|
||||
setVerificationResult('success')
|
||||
setGiftInfo({
|
||||
id: 1,
|
||||
name: '礼品卡',
|
||||
goodsName: '星巴克咖啡券',
|
||||
faceValue: '100',
|
||||
type: 20,
|
||||
status: 0,
|
||||
expireTime: '2024-12-31 23:59:59',
|
||||
code: 'SB2024001234567890'
|
||||
})
|
||||
Taro.showToast({
|
||||
title: '验证成功',
|
||||
icon: 'success'
|
||||
})
|
||||
} else {
|
||||
setVerificationResult('failed')
|
||||
Taro.showToast({
|
||||
title: '核销码无效',
|
||||
icon: 'error'
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// 确认核销
|
||||
const handleConfirmVerification = async () => {
|
||||
if (!giftInfo) return
|
||||
@@ -243,13 +212,13 @@ const StoreVerification: React.FC = () => {
|
||||
{/* 手动输入区域 */}
|
||||
<View className="bg-white mx-4 mt-4 p-4 rounded-lg">
|
||||
<Text className="font-bold mb-3">手动输入核销码</Text>
|
||||
<View className="flex gap-2">
|
||||
<View className="flex">
|
||||
<Input
|
||||
placeholder="请输入8位核销码"
|
||||
placeholder="请输入6位核销码"
|
||||
value={verificationCode}
|
||||
onChange={setVerificationCode}
|
||||
maxLength={8}
|
||||
className="flex-1"
|
||||
maxLength={6}
|
||||
className="flex-1 mr-2"
|
||||
/>
|
||||
<Button
|
||||
type="primary"
|
||||
@@ -257,7 +226,7 @@ const StoreVerification: React.FC = () => {
|
||||
loading={loading}
|
||||
onClick={handleManualVerification}
|
||||
>
|
||||
核销
|
||||
验证
|
||||
</Button>
|
||||
</View>
|
||||
</View>
|
||||
@@ -268,40 +237,38 @@ const StoreVerification: React.FC = () => {
|
||||
<View className="flex justify-between items-center mb-3">
|
||||
<Text className="font-bold">礼品卡信息</Text>
|
||||
{verificationResult === 'success' && (
|
||||
<Tag type="success" size="small">
|
||||
<CheckCircle className="mr-1" />
|
||||
<Tag type="success">
|
||||
验证成功
|
||||
</Tag>
|
||||
)}
|
||||
{verificationResult === 'failed' && (
|
||||
<Tag type="danger" size="small">
|
||||
<CloseCircle className="mr-1" />
|
||||
<Tag type="danger">
|
||||
验证失败
|
||||
</Tag>
|
||||
)}
|
||||
</View>
|
||||
|
||||
<View className="space-y-3">
|
||||
<View className="flex justify-between">
|
||||
<View>
|
||||
<View className="flex justify-between mb-3">
|
||||
<Text className="text-gray-600">商品名称</Text>
|
||||
<Text className="font-medium">
|
||||
{giftInfo.goodsName || giftInfo.name}
|
||||
</Text>
|
||||
</View>
|
||||
|
||||
<View className="flex justify-between">
|
||||
<View className="flex justify-between mb-3">
|
||||
<Text className="text-gray-600">面值</Text>
|
||||
<Text className="text-lg font-bold text-red-500">
|
||||
¥{giftInfo.faceValue}
|
||||
</Text>
|
||||
</View>
|
||||
|
||||
<View className="flex justify-between">
|
||||
<View className="flex justify-between mb-3">
|
||||
<Text className="text-gray-600">类型</Text>
|
||||
<Text>{getTypeText(giftInfo.type)}</Text>
|
||||
</View>
|
||||
|
||||
<View className="flex justify-between">
|
||||
<View className="flex justify-between mb-3">
|
||||
<Text className="text-gray-600">兑换码</Text>
|
||||
<Text className="font-mono text-sm">{giftInfo.code}</Text>
|
||||
</View>
|
||||
@@ -335,10 +302,11 @@ const StoreVerification: React.FC = () => {
|
||||
{/* 使用说明 */}
|
||||
<View className="bg-blue-50 mx-4 mb-4 p-4 rounded-lg">
|
||||
<Text className="font-bold mb-2 text-gray-500">操作说明:</Text>
|
||||
<View className="space-y-1">
|
||||
<Text className="text-sm text-gray-500">1. 用户出示礼品卡二维码</Text>
|
||||
<Text className="text-sm text-gray-500 ml-2">2. 点击"扫描二维码"进行扫码</Text>
|
||||
<Text className="text-sm text-gray-500 ml-2">3. 或手动输入用户提供的核销码</Text>
|
||||
<View>
|
||||
<Text className="text-sm text-gray-500 block mb-1">1. 用户出示礼品卡二维码</Text>
|
||||
<Text className="text-sm text-gray-500 block mb-1">2. 点击"扫描二维码"进行扫码</Text>
|
||||
<Text className="text-sm text-gray-500 block mb-1">3. 或手动输入用户提供的核销码</Text>
|
||||
<Text className="text-sm text-gray-500 block">4. 验证成功后点击"确认核销"完成</Text>
|
||||
</View>
|
||||
</View>
|
||||
</View>
|
||||
|
||||
Reference in New Issue
Block a user