印刷时间:空时默认今年/01月,有值时定位对应年/月

This commit is contained in:
97694732@qq.com 2026-06-04 14:50:49 +08:00
parent 12d35ec642
commit eacbdcd012

View File

@ -935,6 +935,8 @@ export default {
this.loadPriceConfig()
//
this.loadNoIsbnCategory()
//
this.syncNoIsbnPrintTimeIndexes()
//
const savedWhData = uni.getStorageSync('selectedWarehouseData')
if (savedWhData) {
@ -1110,6 +1112,9 @@ export default {
if (this.productList.length > 0 && this.isbn && this.isLoggedIn) {
this.searchISBN()
}
},
noIsbnPrintTime() {
this.syncNoIsbnPrintTimeIndexes()
}
},
@ -1658,6 +1663,22 @@ export default {
}
},
// /
syncNoIsbnPrintTimeIndexes() {
if (this.noIsbnPrintTime) {
const parts = this.noIsbnPrintTime.split('/')
const yearIdx = this.noIsbnYearOptions.indexOf(parts[0])
const monthIdx = parts[1] ? this.noIsbnMonthOptions.indexOf(parts[1].padStart(2, '0')) : -1
if (yearIdx >= 0) this.noIsbnPrintTimeIndexes[0] = yearIdx
if (monthIdx >= 0) this.noIsbnPrintTimeIndexes[1] = monthIdx
} else {
const curYear = String(new Date().getFullYear())
const curYearIdx = this.noIsbnYearOptions.indexOf(curYear)
if (curYearIdx >= 0) this.noIsbnPrintTimeIndexes[0] = curYearIdx
this.noIsbnPrintTimeIndexes[1] = 0
}
},
//
previewProductImage(index) {
const urls = this.productList.map(item => item.image).filter(Boolean)