Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
saas_plus
/
dj-car-boutique-work-wechat
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
1
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit e393abdd
authored
Dec 05, 2025
by
Lin
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
feat: 会员权益升级/权益提单-车架号动态校验
1 parent
e92ccbeb
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
55 additions
and
4 deletions
packageEquity/pages/carEquity/components/SecondStep/SecondStep.js
packageEquity/pages/carEquity/components/SecondStep/SecondStep.wxml
packageEquity/pages/carEquity/components/constant/secondStepData.js
packageEquity/pages/carQuotation/components/constant/stepData.js
packageEquity/pages/carEquity/components/SecondStep/SecondStep.js
View file @
e393abd
...
@@ -4,6 +4,7 @@ const IMG_URL = 'https://img02.glsx.com.cn/weapp/resource/dj-car-boutique-work-w
...
@@ -4,6 +4,7 @@ const IMG_URL = 'https://img02.glsx.com.cn/weapp/resource/dj-car-boutique-work-w
import
fn
from
'../constant/ruleFn'
import
fn
from
'../constant/ruleFn'
const
defaultLabelWidth
=
'var(--fontSize140)'
const
defaultLabelWidth
=
'var(--fontSize140)'
import
api
from
'~/api/api'
import
api
from
'~/api/api'
import
{
validateVin
,
formatVinInput
}
from
'~/utils/vinVaildate'
Component
({
Component
({
options
:
{
options
:
{
styleIsolation
:
'shared'
,
// 自定义覆盖vant样式
styleIsolation
:
'shared'
,
// 自定义覆盖vant样式
...
@@ -56,6 +57,7 @@ Component({
...
@@ -56,6 +57,7 @@ Component({
energyFormRule
:
constantData
.
energyFormRule
,
energyFormRule
:
constantData
.
energyFormRule
,
oilFormRule
:
constantData
.
oilFormRule
,
oilFormRule
:
constantData
.
oilFormRule
,
extendServiceFormRule
:
constantData
.
extendServiceFormRule
,
extendServiceFormRule
:
constantData
.
extendServiceFormRule
,
vinValid
:
null
,
// VIN 车架号校验结果
isShowObj
:
{
isShowObj
:
{
car
:
true
,
car
:
true
,
customer
:
true
,
customer
:
true
,
...
@@ -130,6 +132,46 @@ Component({
...
@@ -130,6 +132,46 @@ Component({
* 组件的方法列表
* 组件的方法列表
*/
*/
methods
:
{
methods
:
{
// 表单输入事件处理
inputEvent
(
e
)
{
console
.
log
(
e
,
'inputEvent'
)
let
{
attr
}
=
e
.
detail
// 车架号输入处理:实时转大写 + 实时校验
if
(
attr
==
'vin'
)
{
const
thisPage
=
wx
.
$router
.
getPageInstance
()
const
{
dataAttrName
}
=
this
.
data
// 从页面数据中获取刚刚更新的车架号值
const
value
=
thisPage
.
data
[
dataAttrName
]?.
vin
||
''
const
upperVin
=
formatVinInput
(
value
)
// 更新为大写
thisPage
.
setData
({
[
dataAttrName
+
'.vin'
]:
upperVin
})
// 当输入满17位时,进行实时校验(防抖500ms)
if
(
upperVin
.
length
===
17
)
{
validateVin
(
upperVin
).
then
(
res
=>
{
let
{
valid
}
=
res
.
data
.
data
console
.
log
(
"upperVinRes"
,
valid
)
// 保存 valid 值到组件 data 中
this
.
setData
({
vinValid
:
valid
})
}).
catch
(()
=>
{
console
.
log
(
"upperVinErr"
,
upperVin
)
// 校验失败时,设置为 false
this
.
setData
({
vinValid
:
false
})
})
}
else
{
// 长度不足17位时,重置校验状态
this
.
setData
({
vinValid
:
null
})
}
}
},
changeInclueType
(
e
){
changeInclueType
(
e
){
const
{
types
}
=
e
.
target
.
dataset
const
{
types
}
=
e
.
target
.
dataset
let
formData
=
this
.
getPageData
()
let
formData
=
this
.
getPageData
()
...
@@ -260,8 +302,13 @@ Component({
...
@@ -260,8 +302,13 @@ Component({
})
})
},
},
handleConfirm
(
e
)
{
handleConfirm
(
e
)
{
var
{
formRule
,
serviceInfo
,
imgObj
,
imgToInfo
,
energyFormRule
,
oilFormRule
,
retrofitInfo
,
extendServiceFormRule
}
=
this
.
data
var
{
formRule
,
serviceInfo
,
imgObj
,
imgToInfo
,
energyFormRule
,
oilFormRule
,
retrofitInfo
,
extendServiceFormRule
,
vinValid
}
=
this
.
data
let
formData
=
this
.
getPageData
()
let
formData
=
this
.
getPageData
()
// VIN 车架号校验检查
if
(
formData
.
vin
&&
vinValid
===
false
)
{
wx
.
$util
.
showToast
(
'车架号校验未通过,请重新输入'
)
return
}
let
validObj
=
fn
.
checkRequired
(
formData
,
formRule
)
let
validObj
=
fn
.
checkRequired
(
formData
,
formRule
)
if
(
validObj
)
{
if
(
validObj
)
{
wx
.
$util
.
showToast
(
validObj
.
message
)
wx
.
$util
.
showToast
(
validObj
.
message
)
...
...
packageEquity/pages/carEquity/components/SecondStep/SecondStep.wxml
View file @
e393abd
...
@@ -30,6 +30,7 @@
...
@@ -30,6 +30,7 @@
formData="{{ serviceInfo }}"
formData="{{ serviceInfo }}"
dataAttrName="{{ dataAttrName }}"
dataAttrName="{{ dataAttrName }}"
formDataList="{{ secondObj.carFormList }}"
formDataList="{{ secondObj.carFormList }}"
bind:inputEvent="inputEvent"
></gl-form>
></gl-form>
</view>
</view>
<view class="box">
<view class="box">
...
...
packageEquity/pages/carEquity/components/constant/secondStepData.js
View file @
e393abd
...
@@ -57,7 +57,10 @@ const formRule = {
...
@@ -57,7 +57,10 @@ const formRule = {
{
required
:
true
,
message
:
'车架号不能为空'
},
{
required
:
true
,
message
:
'车架号不能为空'
},
{
{
validator
:
(
rule
,
value
)
=>
{
validator
:
(
rule
,
value
)
=>
{
return
/^
[
a-zA-Z0-9
]{17}
$/
.
test
(
value
)
?
null
:
{
message
:
'车架号请输入17位数字和字母'
}
console
.
log
(
"validatorVlue"
,
value
)
// VIN 车架号格式校验:17位字符,支持大写 A-H/J-N/P-Z、0-9(排除 I、O、Q)
const
VALID_VIN_REG
=
/^
[
A-HJ-NPR-Z0-9
]{17}
$/i
return
VALID_VIN_REG
.
test
(
value
)
?
null
:
{
message
:
'请输入 17 位有效字符(支持大写 A-H/J-N/P-Z、0-9)'
}
}
}
}
}
],
],
...
...
packageEquity/pages/carQuotation/components/constant/stepData.js
View file @
e393abd
...
@@ -45,7 +45,7 @@ const formRule = {
...
@@ -45,7 +45,7 @@ const formRule = {
validator
:
(
rule
,
value
)
=>
{
validator
:
(
rule
,
value
)
=>
{
return
value
.
length
!=
17
return
value
.
length
!=
17
?
{
?
{
message
:
"请输入
正确的17位车架号
"
,
message
:
"请输入
17 位有效字符(支持大写 A-H/J-N/P-Z、0-9)
"
,
}
}
:
null
;
:
null
;
},
},
...
@@ -115,7 +115,7 @@ const formRuleSimple = {
...
@@ -115,7 +115,7 @@ const formRuleSimple = {
return
value
return
value
?
value
.
length
!=
17
?
value
.
length
!=
17
?
{
?
{
message
:
"请输入
正确的17位车架号
"
,
message
:
"请输入
17 位有效字符(支持大写 A-H/J-N/P-Z、0-9)
"
,
}
}
:
null
:
null
:
null
;
:
null
;
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment