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 43fdc4f6
authored
Dec 05, 2025
by
Lin
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
feat: 会员权益-新增工单-车架号校验
1 parent
c1db60f4
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
64 additions
and
11 deletions
packageEquity/pages/carQuotation/components/FirstStep/FirstStep.js
tabWorkOrder/pages/createOrder/createOrder.js
packageEquity/pages/carQuotation/components/FirstStep/FirstStep.js
View file @
43fdc4f
...
@@ -147,11 +147,17 @@ Component({
...
@@ -147,11 +147,17 @@ Component({
thisPage
.
setData
({
thisPage
.
setData
({
[
dataAttrName
+
'.carVin'
]:
upperVin
[
dataAttrName
+
'.carVin'
]:
upperVin
})
})
// 当输入满17位时,进行实时校验(防抖500ms)
// 当输入满17位时,进行实时校验(防抖500ms)
if
(
upperVin
.
length
===
17
)
{
if
(
upperVin
.
length
===
17
)
{
validateVin
(
upperVin
).
catch
(()
=>
{
validateVin
(
upperVin
).
then
(
res
=>
{
// 校验失败,validateVin 内部已经显示了错误提示
let
{
valid
}
=
res
.
data
.
data
;
console
.
log
(
"upperVinRes"
,
valid
);
// 保存 valid 值到组件 data 中
this
.
setData
({
vinValid
:
valid
});
}).
catch
(()
=>
{
console
.
log
(
"upperVinErr"
,
upperVin
);
})
})
}
}
}
}
...
@@ -251,8 +257,10 @@ Component({
...
@@ -251,8 +257,10 @@ Component({
var
{
var
{
dataAttrName
,
dataAttrName
,
formRule
,
formRule
,
pointsMultiRole
pointsMultiRole
,
vinValid
}
=
this
.
data
}
=
this
.
data
// let thisPage = this.$router.getCurrentPage()
// let thisPage = this.$router.getCurrentPage()
let
thisPage
=
wx
.
$router
.
getPageInstance
()
let
thisPage
=
wx
.
$router
.
getPageInstance
()
// console.log(thisPage.data['orderInfo']['actualSalesPersonId'])
// console.log(thisPage.data['orderInfo']['actualSalesPersonId'])
...
@@ -270,7 +278,21 @@ Component({
...
@@ -270,7 +278,21 @@ Component({
return
false
return
false
}
}
}
}
// 车架号校验
const
carVin
=
thisPage
.
data
[
dataAttrName
]?.
carVin
if
(
carVin
)
{
const
isCarVinRequired
=
formRule
?.
carVin
?.
some
(
rule
=>
rule
.
required
===
true
)
// 再次判断一下车架号是否必填项
// 前置判断
if
(
carVin
.
length
!==
17
&&
isCarVinRequired
)
{
wx
.
$util
.
showToast
(
'请输入 17 位有效字符(支持大写 A-H/J-N/P-Z、0-9)'
)
return
false
}
// 根据接口校验结果判断
if
(
carVin
.
length
===
17
&&
!
vinValid
)
{
wx
.
$util
.
showToast
(
'车架号校验不匹配,请核对后重新输入'
)
return
false
}
}
let
validObj
=
fn
.
checkRequired
(
thisPage
.
data
[
dataAttrName
],
formRule
)
let
validObj
=
fn
.
checkRequired
(
thisPage
.
data
[
dataAttrName
],
formRule
)
if
(
validObj
)
{
if
(
validObj
)
{
wx
.
$util
.
showToast
(
validObj
.
message
)
wx
.
$util
.
showToast
(
validObj
.
message
)
...
...
tabWorkOrder/pages/createOrder/createOrder.js
View file @
43fdc4f
...
@@ -26,6 +26,7 @@ let toastList = {
...
@@ -26,6 +26,7 @@ let toastList = {
payeeType
:
"收款方不能为空"
,
payeeType
:
"收款方不能为空"
,
selectPayType
:
"支付方式不能为空"
selectPayType
:
"支付方式不能为空"
};
};
import
{
validateVin
,
formatVinInput
}
from
'~/utils/vinVaildate'
const
phoneRex
=
/^
[
1
]([
3-9
])[
0-9
]{9}
$/
;
const
phoneRex
=
/^
[
1
]([
3-9
])[
0-9
]{9}
$/
;
// orderSource 订单来源(1后台录入,2移动端预录客户,3移动端升级下单,4再次下单)
// orderSource 订单来源(1后台录入,2移动端预录客户,3移动端升级下单,4再次下单)
...
@@ -253,10 +254,16 @@ Page({
...
@@ -253,10 +254,16 @@ Page({
let
{
let
{
orderObj
orderObj
}
=
this
.
data
;
}
=
this
.
data
;
orderObj
.
customer
[
type
]
=
data
;
// 车架号字段特殊处理
this
.
setData
({
if
(
type
===
'standNo'
)
{
orderObj
,
const
prop
=
`orderObj.customer[
${
type
}
]`
});
this
.
handleVinInput
(
data
,
prop
,
true
)
// 扫描时立即校验
}
else
{
orderObj
.
customer
[
type
]
=
data
;
this
.
setData
({
orderObj
,
});
}
},
},
navOcr
(
e
)
{
navOcr
(
e
)
{
let
{
let
{
...
@@ -321,6 +328,7 @@ Page({
...
@@ -321,6 +328,7 @@ Page({
let
{
let
{
name
name
}
=
e
.
currentTarget
.
dataset
;
}
=
e
.
currentTarget
.
dataset
;
let
prop
=
`orderObj.
${
name
}
`
if
(
name
==
"customer.customerPhone"
&&
phoneRex
.
test
(
value
))
{
if
(
name
==
"customer.customerPhone"
&&
phoneRex
.
test
(
value
))
{
// 如果手机号有变动 需清订单的空礼券和商品
// 如果手机号有变动 需清订单的空礼券和商品
let
deleteName
=
[
let
deleteName
=
[
...
@@ -343,6 +351,12 @@ Page({
...
@@ -343,6 +351,12 @@ Page({
});
});
this
.
setGoodsTotal
(
goodsList
);
this
.
setGoodsTotal
(
goodsList
);
}
}
// 车架号字段特殊处理
if
(
name
===
'customer.standNo'
)
{
console
.
log
(
"车架号校验"
,
prop
);
this
.
handleVinInput
(
value
,
prop
)
// 手动输入时需达到17位才校验
return
;
}
this
.
setData
({
this
.
setData
({
[
`orderObj.
${
name
}
`
]:
value
.
trim
(),
[
`orderObj.
${
name
}
`
]:
value
.
trim
(),
});
});
...
@@ -1589,6 +1603,24 @@ Page({
...
@@ -1589,6 +1603,24 @@ Page({
});
});
this
.
setGoodsTotal
(
chooseList
);
this
.
setGoodsTotal
(
chooseList
);
},
},
handleVinInput
(
value
,
prop
,
autoValidate
=
false
)
{
const
formattedValue
=
formatVinInput
(
value
||
''
)
this
.
setData
({
[
prop
]:
formattedValue
})
// 扫描时立即校验,手动输入时需达到17位才校验
if
(
formattedValue
&&
(
autoValidate
||
formattedValue
.
length
===
17
))
{
validateVin
(
formattedValue
)
.
then
(
result
=>
{
// 校验成功,所有提示已在公共方法中处理
console
.
log
(
'车架号校验成功:'
,
result
)
})
.
catch
(
error
=>
{
// 校验失败,所有提示已在公共方法中处理
console
.
log
(
'车架号校验失败:'
,
error
)
})
}
},
handleSpecificationsEcho
(
item
)
{
handleSpecificationsEcho
(
item
)
{
let
skuArr
=
[];
let
skuArr
=
[];
let
{
let
{
...
@@ -1658,7 +1690,6 @@ Page({
...
@@ -1658,7 +1690,6 @@ Page({
// app .
// app .
getYQorderInfo
()
getYQorderInfo
()
.
then
((
merchantSettingInfo
)
=>
{
.
then
((
merchantSettingInfo
)
=>
{
console
.
log
(
merchantSettingInfo
,
'merchantSettingInfo'
);
let
dictionaryObj
=
{
let
dictionaryObj
=
{
carTypeRequiredFlag
:
"carBrand"
,
carTypeRequiredFlag
:
"carBrand"
,
standNoRequiredFlag
:
"standNo"
,
standNoRequiredFlag
:
"standNo"
,
...
@@ -1867,7 +1898,7 @@ Page({
...
@@ -1867,7 +1898,7 @@ Page({
}
}
// 是订单补录跳转进来的
// 是订单补录跳转进来的
if
(
res
?.
orderCreateType
==
"additionRecordOrder"
)
{
if
(
res
?.
orderCreateType
==
"additionRecordOrder"
)
{
let
{
supplementId
,
selectOutTradeNoArr
}
=
res
let
{
supplementId
,
selectOutTradeNoArr
}
=
res
if
(
supplementId
)
{
if
(
supplementId
)
{
return
this
.
checkShowOrderInfo
()
return
this
.
checkShowOrderInfo
()
}
}
...
...
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