无ISBN:书号非978一律678ISBN/售价自动填入/版权页比价/单提交按钮/双tab确认弹窗

This commit is contained in:
97694732@qq.com 2026-06-04 10:38:59 +08:00
parent 8db03e7238
commit 6bd7d902f5
2 changed files with 137 additions and 126 deletions

View File

@ -286,9 +286,6 @@
<input class="form-input" v-model="noIsbnStock" type="number" placeholder="库存" style="flex:1;" />
</view>
</view>
<view v-if="noIsbnProductList.length > 0 && calculatedNoIsbnPrice > 0" class="price-suggest-hint" @click="noIsbnPrice = String(calculatedNoIsbnPrice)">
<text class="hint-text">系统建议售价 <text class="hint-value">¥{{ calculatedNoIsbnPrice }}</text>点击填入</text>
</view>
</view>
<!-- ===== 图书详情 ===== -->
@ -421,8 +418,13 @@
<!-- ===== 在售商品 ===== -->
<view class="form-section" v-if="noIsbnProductList.length > 0">
<view class="section-title">
<text class="title-text">在售商品</text>
<view class="section-header-row">
<view class="section-title">
<text class="title-text">在售商品</text>
</view>
<view class="copyright-btn" @click="searchNoIsbnCopyright">
<text class="copyright-btn-text">版权页比价</text>
</view>
</view>
<view class="loading-box" v-if="noIsbnLoading">
<view class="loading-spinner"></view>
@ -463,13 +465,6 @@
</view>
</view>
<!-- ===== 确认上传 ===== -->
<view class="submit-area">
<view class="submit-btn" @click="submitNoIsbnUpload" :class="{ disabled: noIsbnSubmitting }">
<text class="submit-btn-text">确认上传</text>
</view>
</view>
<view class="bottom-placeholder"></view>
</scroll-view>
</view>
@ -862,7 +857,6 @@ export default {
noIsbnProductList: [],
noIsbnHistoryList: [],
noIsbnLoading: false,
noIsbnSubmitting: false,
noIsbnDetailExpanded: false,
//
@ -1631,42 +1625,54 @@ export default {
return
}
// ISBN
if (!this.isbn) {
uni.showToast({ title: 'ISBN不能为空', icon: 'none' })
return
}
if (!this.price) {
uni.showToast({ title: '售价不能为空', icon: 'none' })
return
}
//
const warehouseName = warehouseData.warehouseName || warehouseData.name || ''
const locCode = warehouseData.locationCode || warehouseData.code || ''
const locationText = warehouseName + (locCode ? ' - ' + locCode : '')
const isbn = this.isbn || '-'
const bookName = this.bookName || '-'
const price = this.price || '-'
const stock = this.stock ?? '-'
const author = this.author || '-'
const publisher = this.publisher || '-'
const fixPrice = this.fixPrice || '-'
const printTime = this.printTime || '-'
const photoCount = this.photoList.length
const contentLines = [
'📦 货区:' + locationText,
'📖 ISBN' + isbn,
'📕 书名:' + bookName,
'💰 价格:' + price,
'📊 库存:' + stock,
'✍️ 作者:' + author,
'🏢 出版社:' + publisher,
'🏷️ 定价:' + fixPrice,
'📅 印刷时间:' + printTime,
'📷 图片:' + photoCount + '张'
]
let contentLines
if (this.currentTab === 'isbn') {
if (!this.isbn) {
uni.showToast({ title: 'ISBN不能为空', icon: 'none' })
return
}
if (!this.price) {
uni.showToast({ title: '售价不能为空', icon: 'none' })
return
}
contentLines = [
'📦 货区:' + locationText,
'📖 ISBN' + (this.isbn || '-'),
'📕 书名:' + (this.bookName || '-'),
'💰 价格:' + (this.price || '-'),
'📊 库存:' + (this.stock ?? '-'),
'✍️ 作者:' + (this.author || '-'),
'🏢 出版社:' + (this.publisher || '-'),
'🏷️ 定价:' + (this.fixPrice || '-'),
'📅 印刷时间:' + (this.printTime || '-'),
'📷 图片:' + this.photoList.length + '张'
]
} else {
if (!this.noIsbnPrice) {
uni.showToast({ title: '售价不能为空', icon: 'none' })
return
}
if (!this.noIsbnBookName) {
uni.showToast({ title: '书名不能为空', icon: 'none' })
return
}
contentLines = [
'📦 货区:' + locationText,
'📕 书名:' + (this.noIsbnBookName || '-'),
'✍️ 作者:' + (this.noIsbnAuthor || '-'),
'🏢 出版社:' + (this.noIsbnPublisher || '-'),
'🏷️ 定价:' + (this.noIsbnOriginalPrice || '-'),
'📖 ISBN' + (this.noIsbnIsbn || this.noIsbnUnifyIsbn || '-'),
'📅 印刷时间:' + (this.noIsbnPrintTime || '-'),
'💰 价格:' + (this.noIsbnPrice || '-'),
'📊 库存:' + (this.noIsbnStock ?? '-'),
'📷 图片:' + this.noIsbnPhotoList.length + '张'
]
}
uni.showModal({
title: '确认上传',
@ -1755,6 +1761,12 @@ export default {
//
this.noIsbnAuthorOptions = Array.from(authorSet).filter(Boolean).slice(0, 10)
this.noIsbnPublisherOptions = Array.from(publisherSet).filter(Boolean).slice(0, 10)
//
this.$nextTick(() => {
if (this.calculatedNoIsbnPrice > 0) {
this.noIsbnPrice = String(this.calculatedNoIsbnPrice)
}
})
}).catch(err => {
console.error('无ISBN搜索失败:', err)
this.noIsbnLoading = false
@ -1762,57 +1774,70 @@ export default {
})
},
// ISBN -
submitNoIsbnUpload() {
if (this.noIsbnSubmitting) return
const warehouseData = this.currentTab === 'no-isbn' ? this.noIsbnWarehouseData : null
if (!warehouseData) {
uni.showToast({ title: '请选择货区', icon: 'none' })
return
}
if (!this.noIsbnPrice) {
uni.showToast({ title: '售价不能为空', icon: 'none' })
// ISBN - +
searchNoIsbnCopyright() {
if (!this.isLoggedIn) {
uni.showToast({ title: '请先登录孔网账号', icon: 'none' })
return
}
if (!this.noIsbnBookName) {
uni.showToast({ title: '书名不能为空', icon: 'none' })
uni.showToast({ title: '请输入书名', icon: 'none' })
return
}
const warehouseName = warehouseData.warehouseName || warehouseData.name || ''
const locCode = warehouseData.locationCode || warehouseData.code || ''
const locationText = warehouseName + (locCode ? ' - ' + locCode : '')
const contentLines = [
'📦 货区:' + locationText,
'📕 书名:' + (this.noIsbnBookName || '-'),
'✍️ 作者:' + (this.noIsbnAuthor || '-'),
'🏢 出版社:' + (this.noIsbnPublisher || '-'),
'🏷️ 定价:' + (this.noIsbnOriginalPrice || '-'),
'📖 ISBN' + (this.noIsbnIsbn || this.noIsbnUnifyIsbn || '-'),
'📅 印刷时间:' + (this.noIsbnPrintTime || '-'),
'💰 价格:' + (this.noIsbnPrice || '-'),
'📊 库存:' + (this.noIsbnStock ?? '-'),
'📷 图片:' + this.noIsbnPhotoList.length + '张'
]
uni.showModal({
title: '确认上传',
content: contentLines.join('\n'),
confirmText: '确认上传',
cancelText: '取消',
success: (res) => {
if (res.confirm) {
this.noIsbnSubmitting = true
uni.showLoading({ title: '上传中...' })
setTimeout(() => {
uni.hideLoading()
this.noIsbnSubmitting = false
uni.showToast({ title: '上传成功', icon: 'success' })
}, 1500)
}
this.noIsbnLoading = true
this.noIsbnProductList = []
const phpsessid = this.kongfzToken || uni.getStorageSync('kongfz_phpsessid') || ''
const keyword = this.noIsbnBookName
searchProducts(keyword, {
phpsessid,
sortType: '7',
quality: this.noIsbnConditionValue,
publisher: this.noIsbnPublisher,
author: this.noIsbnAuthor
}).then((productsData) => {
this.noIsbnLoading = false
if (productsData && productsData.total > 0) {
const list = (productsData.list || []).slice(0, 12)
this.noIsbnProductList = list.map(item => {
const cleanPrice = parseFloat((item.priceText || '0').replace(/[^\d.]/g, ''))
let shippingFee = 0
if (item.postage) {
if (typeof item.postage === 'number' || typeof item.postage === 'string') {
shippingFee = parseFloat(item.postage) || 0
} else if (item.postage.shippingList && item.postage.shippingList.length > 0) {
shippingFee = parseFloat(item.postage.shippingList[0].shippingFee || 0)
} else if (item.postage.shippingFee) {
shippingFee = parseFloat(item.postage.shippingFee || 0)
}
}
if (shippingFee === 0 && item.shippingFee) {
shippingFee = parseFloat(item.shippingFee) || 0
}
const totalPrice = Number((cleanPrice + shippingFee).toFixed(2))
return {
image: item.imgBigUrl || '',
totalPrice: totalPrice,
bookPrice: cleanPrice,
shippingFee: shippingFee,
condition: item.qualityText || '',
shopName: item.shopName || '',
bookName: item.title || '',
author: item.author || '',
pubDate: item.pubDateText || '',
bookId: item.id || ''
}
})
//
this.$nextTick(() => {
if (this.calculatedNoIsbnPrice > 0) {
this.noIsbnPrice = String(this.calculatedNoIsbnPrice)
}
})
}
}).catch(err => {
console.error('版权比价失败:', err)
this.noIsbnLoading = false
uni.showToast({ title: '比价失败', icon: 'none' })
})
},
@ -1883,23 +1908,17 @@ export default {
this.noIsbnFormat = this.noIsbnFormatOptions.includes(fmt) ? fmt : fmt + '开'
}
if (texts.ISBN && /^\d/.test(texts.ISBN)) {
// ISBN
this.noIsbnIsbn = texts.ISBN
this.noIsbnUnifyIsbn = ''
}
if (texts.书号) {
const bookCode = texts.书号.replace(/\D/g, '')
if (bookCode.length === 13 && bookCode.startsWith('978')) {
// 97813 ISBN
this.noIsbnIsbn = bookCode
this.noIsbnUnifyIsbn = ''
} else if (bookCode.length === 13) {
// 97813 ISBN678
this.noIsbnUnifyIsbn = bookCode
this.noIsbnIsbn = '678' + String(Date.now()).slice(-10)
} else {
//
this.noIsbnUnifyIsbn = texts.书号
this.noIsbnIsbn = '678' + String(Date.now()).slice(-10)
}
}
if (texts.字数) this.noIsbnWordCount = this.processNoIsbnWordage(texts.字数)
@ -2329,23 +2348,20 @@ export default {
background: transparent;
}
/* ========== 价格建议提示 ========== */
.price-suggest-hint {
margin-top: 10rpx;
padding: 12rpx 16rpx;
background-color: #f0f9eb;
border-radius: 8rpx;
border: 2rpx solid #e1f3d8;
/* ========== 版权页比价按钮 ========== */
.copyright-btn {
padding: 8rpx 16rpx;
background-color: #409eff;
border-radius: 6rpx;
display: flex;
align-items: center;
justify-content: center;
}
.price-suggest-hint .hint-text {
font-size: 26rpx;
color: #67c23a;
}
.price-suggest-hint .hint-value {
font-weight: bold;
font-size: 28rpx;
.copyright-btn-text {
font-size: 24rpx;
color: #ffffff;
font-weight: 500;
}
/* ========== 扫描/搜索按钮 ========== */
@ -2768,15 +2784,6 @@ export default {
justify-content: center;
}
.submit-area {
margin-top: 30rpx;
padding: 0 20rpx;
}
.submit-btn.disabled {
opacity: 0.6;
}
/* ========== 折叠详情 ========== */
.detail-section-header {
display: flex;
@ -2858,10 +2865,8 @@ export default {
font-weight: 600;
}
.submit-btn-text {
color: #ffffff;
font-size: 32rpx;
font-weight: 600;
.submit-btn.disabled {
opacity: 0.6;
}
/* ========== 筛选弹窗 ========== */

View File

@ -190,7 +190,7 @@ export function fetchItems(token, params = {}, onProgress) {
* list中每项: {id, title, author, press, priceText, imgBigUrl, shopName, qualityText, pubDateText, postage}
*/
export function searchProducts(keyword, options = {}) {
const { phpsessid = '', page = 1, sortType = '', quality = '' } = options
const { phpsessid = '', page = 1, sortType = '', quality = '', publisher = '', author = '' } = options
return new Promise((resolve, reject) => {
const reqData = {
dataType: 0,
@ -208,6 +208,12 @@ export function searchProducts(keyword, options = {}) {
reqData.quaSelect = '2'
actionPaths.push('quality')
}
if (publisher) {
reqData.press = publisher
}
if (author) {
reqData.author = author
}
if (actionPaths.length > 0) {
reqData.actionPath = actionPaths.join(',')
}