feat(pl): 调整加油登记列表排序、必填项和顶部汇总区。
按登记日期倒序列表并增加列统计,期初公里数改为必填,车辆统计卡片改为待开发。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
574e2d9b31
commit
af8d4d90fa
6 files changed
+155
-72
No files matched your search
@@ -80,13 +80,14 @@
|
||||
</view>
|
||||
|
||||
<view class="field">
|
||||
<text class="field-label">期初公里数/KM</text>
|
||||
<text class="field-label">期初公里数/KM<text class="req">*</text></text>
|
||||
<input
|
||||
class="form-input"
|
||||
type="digit"
|
||||
:class="{ error: fieldErr.odometerKm }"
|
||||
:value="form.odometerKm"
|
||||
:disabled="readonly"
|
||||
placeholder="选填"
|
||||
placeholder="请输入期初公里数"
|
||||
@input="onOdometerInput"
|
||||
/>
|
||||
</view>
|
||||
@@ -267,6 +268,7 @@ const form = reactive({
|
||||
const fieldErr = reactive({
|
||||
registerDate: false,
|
||||
licensePlate: false,
|
||||
odometerKm: false,
|
||||
fuelLiters: false
|
||||
})
|
||||
|
||||
@@ -334,6 +336,7 @@ function onDateChange(e) {
|
||||
|
||||
function onOdometerInput(e) {
|
||||
form.odometerKm = e.detail.value
|
||||
fieldErr.odometerKm = false
|
||||
}
|
||||
|
||||
function onLitersInput(e) {
|
||||
@@ -439,6 +442,7 @@ function previewAt(idx) {
|
||||
function validate() {
|
||||
fieldErr.registerDate = false
|
||||
fieldErr.licensePlate = false
|
||||
fieldErr.odometerKm = false
|
||||
fieldErr.fuelLiters = false
|
||||
if (!form.fuelCategory) {
|
||||
uni.showToast({ title: '请选择加油类别', icon: 'none' })
|
||||
@@ -454,6 +458,18 @@ function validate() {
|
||||
uni.showToast({ title: '请选择车牌号', icon: 'none' })
|
||||
return false
|
||||
}
|
||||
const odoRaw = String(form.odometerKm ?? '').trim()
|
||||
if (!odoRaw) {
|
||||
fieldErr.odometerKm = true
|
||||
uni.showToast({ title: '请输入期初公里数', icon: 'none' })
|
||||
return false
|
||||
}
|
||||
const odo = Number(odoRaw)
|
||||
if (Number.isNaN(odo) || odo < 0) {
|
||||
fieldErr.odometerKm = true
|
||||
uni.showToast({ title: '期初公里数须为非负数字', icon: 'none' })
|
||||
return false
|
||||
}
|
||||
const litersRaw = String(form.fuelLiters ?? '').trim()
|
||||
if (!litersRaw) {
|
||||
fieldErr.fuelLiters = true
|
||||
|
||||
Reference in new issue
Block a user