Files
xinlong-shop-taro/src/pages/apply.tsx
赵忠林 f3886664f7 fix(api): 替换所有接口请求的域名为 guilixu-api.websoft.top
- 将获取 STS Token 的接口地址由 paopao-api 改为 guilixu-api
- 更新图片上传接口地址为新的 guilixu-api 域名
- 修改用户推广页面中邀请码链接和二维码接口的域名
- 更改注册页微信登录接口请求的域名为 guilixu-api
2026-06-16 17:15:59 +08:00

152 lines
5.7 KiB
TypeScript

import { View, Text, Input, Textarea } from '@tarojs/components';
import { useState } from 'react';
import NavBar from '@/components/NavBar';
export default function InvoiceApplyPage() {
const [invoiceType, setInvoiceType] = useState<'personal' | 'company'>('personal');
const [formData, setFormData] = useState({
title: '',
taxNumber: '',
content: '商品明细',
amount: '',
email: '',
remark: ''
});
const handleSubmit = () => {
console.log('提交发票申请', formData);
};
return (
<View className="bg-gray-100 flex flex-col" style={{ minHeight: '100vh' }}>
<NavBar title="申请发票" />
<View className="flex-1 p-4">
{/* 发票类型 */}
<View className="bg-white rounded-lg p-4 mb-4">
<Text className="text-base font-medium mb-3 block"></Text>
<View className="flex" style={{ gap: '16px' }}>
<View
className={`flex-1 p-3 rounded-lg border-2 text-center ${
invoiceType === 'personal'
? 'border-red-500 bg-red-50'
: 'border-gray-300'
}`}
onClick={() => setInvoiceType('personal')}
>
<Text className={invoiceType === 'personal' ? 'text-red-500' : 'text-gray-600'}>
</Text>
</View>
<View
className={`flex-1 p-3 rounded-lg border-2 text-center ${
invoiceType === 'company'
? 'border-red-500 bg-red-50'
: 'border-gray-300'
}`}
onClick={() => setInvoiceType('company')}
>
<Text className={invoiceType === 'company' ? 'text-red-500' : 'text-gray-600'}>
</Text>
</View>
</View>
</View>
{/* 发票信息 */}
<View className="bg-white rounded-lg p-4 mb-4">
<Text className="text-base font-medium mb-3 block"></Text>
<View className="mb-4">
<Text className="text-sm text-gray-600 mb-2 block"></Text>
<Input
className="w-full p-3 bg-gray-100 rounded-lg text-sm"
placeholder="请输入发票抬头"
value={formData.title}
onInput={(e: any) => setFormData(prev => ({ ...prev, title: e.detail.value }))}
/>
</View>
{invoiceType === 'company' && (
<View className="mb-4">
<Text className="text-sm text-gray-600 mb-2 block"></Text>
<Input
className="w-full p-3 bg-gray-100 rounded-lg text-sm"
placeholder="请输入纳税人识别号"
value={formData.taxNumber}
onInput={(e: any) => setFormData(prev => ({ ...prev, taxNumber: e.detail.value }))}
/>
</View>
)}
<View className="mb-4">
<Text className="text-sm text-gray-600 mb-2 block"></Text>
<View className="flex" style={{ gap: '16px' }}>
<View
className={`px-4 py-2 rounded-lg ${
formData.content === '商品明细' ? 'bg-red-500 text-white' : 'bg-gray-100 text-gray-600'
}`}
onClick={() => setFormData(prev => ({ ...prev, content: '商品明细' }))}
>
<Text></Text>
</View>
<View
className={`px-4 py-2 rounded-lg ${
formData.content === '商品类别' ? 'bg-red-500 text-white' : 'bg-gray-100 text-gray-600'
}`}
onClick={() => setFormData(prev => ({ ...prev, content: '商品类别' }))}
>
<Text></Text>
</View>
</View>
</View>
<View className="mb-4">
<Text className="text-sm text-gray-600 mb-2 block"></Text>
<Input
className="w-full p-3 bg-gray-100 rounded-lg text-sm"
placeholder="请输入发票金额"
type="digit"
value={formData.amount}
onInput={(e: any) => setFormData(prev => ({ ...prev, amount: e.detail.value }))}
/>
</View>
</View>
{/* 接收方式 */}
<View className="bg-white rounded-lg p-4 mb-4">
<Text className="text-base font-medium mb-3 block"></Text>
<View className="mb-4">
<Text className="text-sm text-gray-600 mb-2 block"></Text>
<Input
className="w-full p-3 bg-gray-100 rounded-lg text-sm"
placeholder="请输入接收邮箱"
value={formData.email}
onInput={(e: any) => setFormData(prev => ({ ...prev, email: e.detail.value }))}
/>
</View>
<View className="mb-4">
<Text className="text-sm text-gray-600 mb-2 block"></Text>
<Textarea
className="w-full p-3 bg-gray-100 rounded-lg text-sm"
placeholder="选填,可填写备注信息"
value={formData.remark}
onInput={(e: any) => setFormData(prev => ({ ...prev, remark: e.detail.value }))}
/>
</View>
</View>
</View>
<View className="p-4 bg-white border-t border-gray-200" style={{ paddingBottom: '20px' }}>
<View
className="bg-red-500 text-white rounded-full w-full h-12 flex items-center justify-center"
onClick={handleSubmit}
>
<Text className="text-white font-medium"></Text>
</View>
</View>
</View>
);
}