v1.2.91 - 修复单条录入冠字号生成规则(7位→J0+0+数字,8位→J0+数字,9位→J0+后8位)

This commit is contained in:
甲辰生产 2026-04-14 08:02:45 +08:00
parent 2306e35dec
commit 9fe3f77d45
4 changed files with 62 additions and 25 deletions

View File

@ -1 +1 @@
1.2.90 1.2.91

View File

@ -1 +1 @@
VERSION=1.2.81 1.2.89

View File

@ -824,21 +824,32 @@ export default function Add() {
setSavingDeal(true) setSavingDeal(true)
try { try {
const token = localStorage.getItem('token') const token = localStorage.getItem('token')
const digits = dealForm.serial.replace('J', '').replace(/[^0-9]/g, '').slice(0, 9) //
let tailNumber = '', sizeType = '' // 7 J0 + 0 + ( J00123456)
if (dealForm.packaging === '标十' && digits.length >= 2) { // 8 J0 + ( J01234567)
tailNumber = digits.slice(-2) // 9 J0 + 8 ( J02345678)
sizeType = ['01','11','21','31','41','51'].includes(tailNumber) ? '小号' : '大号' const rawSerial = dealForm.serial.replace('J', '').replace(/\D/g, '')
} else if (dealForm.packaging === '标百' && digits.length >= 3) { let normalizedSerial = ''
tailNumber = digits.slice(-3) if (rawSerial.length === 7) {
sizeType = ['101','201','301','401','501'].includes(tailNumber) ? '小号' : '大号' normalizedSerial = 'J0' + '0' + rawSerial
} else if (rawSerial.length === 8) {
normalizedSerial = 'J0' + rawSerial
} else if (rawSerial.length >= 9) {
normalizedSerial = 'J0' + rawSerial.slice(1, 9) // 8
} else {
normalizedSerial = 'J0' + rawSerial
} }
const tailNumber = rawSerial.slice(-2)
const sizeType = (dealForm.packaging === '标十' && ['01','11','21','31','41','51','61','71','81','91'].includes(tailNumber)) ? '小号' :
(dealForm.packaging === '标百' && ['001','011','021','031','041','051','061','071','081','091'].includes(rawSerial.slice(-3))) ? '小号' : '大号'
const response = await fetch(`${API_BASE}/api/information/`, { const response = await fetch(`${API_BASE}/api/information/`, {
method: 'POST', method: 'POST',
headers: { 'Authorization': `Bearer ${token}`, 'Content-Type': 'application/json' }, headers: { 'Authorization': `Bearer ${token}`, 'Content-Type': 'application/json' },
body: JSON.stringify({ body: JSON.stringify({
info_type: 'deal', info_type: 'deal',
title: `J0${dealForm.serial.replace('J', '').slice(0, 8)}${dealForm.price}`, title: `${normalizedSerial}${dealForm.price}`,
content: `分类: ${dealForm.category || '未分类'}\n尾号: ${tailNumber || '-'}\n大小号: ${sizeType || '-'}\n包装: ${dealForm.packaging}\n平台: ${dealForm.platform}\n价格: ¥${dealForm.price}\n出售者: ${dealForm.seller || '-'}\n购买者: ${dealForm.buyer || '-'}\n日期: ${dealForm.date}\n评级: ${dealForm.gradingCompany ? dealForm.gradingCompany + ' ' + dealForm.gradingScore : '未评级'}`, content: `分类: ${dealForm.category || '未分类'}\n尾号: ${tailNumber || '-'}\n大小号: ${sizeType || '-'}\n包装: ${dealForm.packaging}\n平台: ${dealForm.platform}\n价格: ¥${dealForm.price}\n出售者: ${dealForm.seller || '-'}\n购买者: ${dealForm.buyer || '-'}\n日期: ${dealForm.date}\n评级: ${dealForm.gradingCompany ? dealForm.gradingCompany + ' ' + dealForm.gradingScore : '未评级'}`,
deal_price: parseFloat(dealForm.price), deal_price: parseFloat(dealForm.price),
deal_date: dealForm.date, deal_date: dealForm.date,

View File

@ -174,32 +174,58 @@ export default function Home() {
<div onClick={() => window.location.hash = '#/add?mode=ocr'} style={{ <div onClick={() => window.location.hash = '#/add?mode=ocr'} style={{
background: 'linear-gradient(135deg, #22c55e 0%, #16a34a 100%)', background: 'linear-gradient(135deg, #22c55e 0%, #16a34a 100%)',
borderRadius: '12px', borderRadius: '12px',
padding: '16px', padding: '12px 16px',
cursor: 'pointer', cursor: 'pointer',
display: 'flex', display: 'flex',
flexDirection: 'column',
alignItems: 'center', alignItems: 'center',
gap: '12px' justifyContent: 'center',
textAlign: 'center'
}}> }}>
<div style={{ fontSize: '24px' }}>📷</div> <div style={{ color: '#fff', fontSize: '14px', fontWeight: '600', whiteSpace: 'nowrap' }}>藏品录入</div>
<div> <div style={{ color: 'rgba(255,255,255,0.7)', fontSize: '10px', marginTop: '2px' }}>AI识别添加</div>
<div style={{ color: '#fff', fontSize: '15px', fontWeight: '600' }}>AI识别</div> </div>
<div style={{ color: 'rgba(255,255,255,0.7)', fontSize: '11px' }}>拍照识别藏品</div> <div onClick={() => window.location.hash = '#/add?mode=deal'} style={{
</div> background: 'linear-gradient(135deg, #ec4899 0%, #db2777 100%)',
borderRadius: '12px',
padding: '12px 16px',
cursor: 'pointer',
display: 'flex',
flexDirection: 'column',
alignItems: 'center',
justifyContent: 'center',
textAlign: 'center'
}}>
<div style={{ color: '#fff', fontSize: '14px', fontWeight: '600', whiteSpace: 'nowrap' }}>行情录入</div>
<div style={{ color: 'rgba(255,255,255,0.7)', fontSize: '10px', marginTop: '2px' }}>录入成交行情</div>
</div>
<div onClick={() => window.location.hash = '#/news?type=seek'} style={{
background: 'linear-gradient(135deg, #f59e0b 0%, #d97706 100%)',
borderRadius: '12px',
padding: '12px 16px',
cursor: 'pointer',
display: 'flex',
flexDirection: 'column',
alignItems: 'center',
justifyContent: 'center',
textAlign: 'center'
}}>
<div style={{ color: '#fff', fontSize: '14px', fontWeight: '600', whiteSpace: 'nowrap' }}>发布寻号</div>
<div style={{ color: 'rgba(255,255,255,0.7)', fontSize: '10px', marginTop: '2px' }}>发布寻配需求</div>
</div> </div>
<div onClick={() => window.location.hash = '#/add?mode=manual'} style={{ <div onClick={() => window.location.hash = '#/add?mode=manual'} style={{
background: 'linear-gradient(135deg, #3b82f6 0%, #2563eb 100%)', background: 'linear-gradient(135deg, #3b82f6 0%, #2563eb 100%)',
borderRadius: '12px', borderRadius: '12px',
padding: '16px', padding: '12px 16px',
cursor: 'pointer', cursor: 'pointer',
display: 'flex', display: 'flex',
flexDirection: 'column',
alignItems: 'center', alignItems: 'center',
gap: '12px' justifyContent: 'center',
textAlign: 'center'
}}> }}>
<div style={{ fontSize: '24px' }}></div> <div style={{ color: '#fff', fontSize: '14px', fontWeight: '600', whiteSpace: 'nowrap' }}>发布藏品</div>
<div> <div style={{ color: 'rgba(255,255,255,0.7)', fontSize: '10px', marginTop: '2px' }}>手动发布</div>
<div style={{ color: '#fff', fontSize: '15px', fontWeight: '600' }}>手动录入</div>
<div style={{ color: 'rgba(255,255,255,0.7)', fontSize: '11px' }}>添加新藏品</div>
</div>
</div> </div>
</div> </div>
</div> </div>