diff --git a/src/views/business/components/waybill-manage-page.vue b/src/views/business/components/waybill-manage-page.vue index 4715c05..569ba3a 100644 --- a/src/views/business/components/waybill-manage-page.vue +++ b/src/views/business/components/waybill-manage-page.vue @@ -2271,6 +2271,13 @@ 体积 {{ record.volume }}方 数量 {{ record.quantity }} + +
+ 里程 {{ record.mileage }} 公里 +
+ + + + + + + + 0 ? String(record.mileage) : '', remark: record.remark || '', photos: (record.photos || []) .filter(photo => photo?.url) @@ -6037,10 +6069,22 @@ export default { photos.splice(index, 1); this.waybillPunchEditForm.photos = photos; }, + // 里程只收整数:非数字直接丢掉,长度与「维护里程」一致(≤10 位) + handleWaybillPunchMileageInput(value) { + this.waybillPunchEditForm.mileage = String(value || '') + .replace(/\D/g, '') + .slice(0, 10); + }, async submitWaybillPunchRecordEdit() { await this.$refs.waybillPunchRecordEditFormRef.validate(); const record = this.waybillPunchEditRecord; const form = this.waybillPunchEditForm; + // 管理端里程选填:留空表示不改动运单里程,所以只校验填了值的情况 + const mileageText = String(form.mileage || '').trim(); + if (this.waybillPunchEditMileageVisible && mileageText && !/^[1-9]\d{0,9}$/.test(mileageText)) { + this.$message.warning('里程必须为不超过10位的正整数'); + return; + } const submit = typeof this.api?.savePunchRecord === 'function' ? this.api.savePunchRecord : savePunchRecord; this.waybillPunchRecordEditDialog.submitting = true; @@ -6059,6 +6103,8 @@ export default { weight: form.weight, volume: form.volume, quantity: form.quantity, + // 不传代表不改;后端按 null 处理 + mileage: mileageText ? Number(mileageText) : undefined, remark: form.remark, photos: form.photos.map(photo => ({ url: photo.url, type: photo.type })), });