Commit 837865b6 by 张立顺

Merge branch 'SAAS+V5.6.1' of http://192.168.3.233:8090/saas_plus/dj-car-boutiqu…

…e-work-wechat into SAAS+V5.6.1
2 parents 89c5458a ee354f1b
......@@ -22,7 +22,8 @@ Component({
imageList: [],
remarks: '',
otherIssues: '',
scrollTop: 0
scrollTop: 0,
isFormValid: false // 表单是否有效(任意字段有值)
},
lifetimes: {
......@@ -284,6 +285,11 @@ Component({
},
onConfirm() {
// 如果表单无效,直接返回
if (!this.data.isFormValid) {
return
}
// 防抖处理:如果已有定时器,清除它
if (this.confirmTimer) {
clearTimeout(this.confirmTimer)
......@@ -353,6 +359,16 @@ Component({
observers: {
'show'(show) {
if (!show) this.resetForm()
},
// 监听表单字段变化,判断是否有任意字段有值
'appealNum, imageList, remarks, otherIssues': function(appealNum, imageList, remarks, otherIssues) {
const hasValue = !!(
(appealNum && appealNum.trim()) ||
(imageList && imageList.length > 0) ||
(remarks && remarks.trim()) ||
(otherIssues && otherIssues.trim())
)
this.setData({ isFormValid: hasValue })
}
}
})
......@@ -214,4 +214,9 @@
.confirm-btn {
background: #347BFF;
color: #fff;
&.disabled {
background: #F4F5F7;
color: #323233;
cursor: not-allowed;
}
}
......@@ -66,7 +66,7 @@
<view class="popup-fixed-bottom">
<view class="popup-buttons">
<view class="cancel-btn" bindtap="onClose">取消</view>
<view class="confirm-btn" bindtap="onConfirm">确认</view>
<view class="confirm-btn {{ isFormValid ? '' : 'disabled' }}" bindtap="onConfirm">确认</view>
</view>
</view>
</view>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!