From 8db03e723850304f2148164c6ad8e2855264b442 Mon Sep 17 00:00:00 2001 From: "97694732@qq.com" Date: Thu, 4 Jun 2026 10:34:43 +0800 Subject: [PATCH] =?UTF-8?q?Revert=20"=E6=97=A0ISBN:=E4=B9=A6=E5=8F=B7?= =?UTF-8?q?=E9=9D=9E978=E4=B8=80=E5=BE=8B678ISBN/=E5=94=AE=E4=BB=B7?= =?UTF-8?q?=E8=87=AA=E5=8A=A8=E5=A1=AB=E5=85=A5/=E7=89=88=E6=9D=83?= =?UTF-8?q?=E9=A1=B5=E6=AF=94=E4=BB=B7/=E5=8E=BB=E9=87=8D=E6=8F=90?= =?UTF-8?q?=E4=BA=A4=E6=8C=89=E9=92=AE/=E5=8E=BB=E4=BB=B7=E6=A0=BC?= =?UTF-8?q?=E5=BB=BA=E8=AE=AE=E6=9D=A1"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 1c2eaa3d7baafc2593d3fcf2cd2308d0aa59ab99. --- pages/upload/upload.vue | 258 +++++++++++++++++++--------------------- utils/kongfz.js | 8 +- 2 files changed, 126 insertions(+), 140 deletions(-) diff --git a/pages/upload/upload.vue b/pages/upload/upload.vue index 7cec5dd..298f735 100644 --- a/pages/upload/upload.vue +++ b/pages/upload/upload.vue @@ -286,6 +286,9 @@ + + 系统建议售价 ¥{{ calculatedNoIsbnPrice }}(点击填入) + @@ -418,13 +421,8 @@ - - - 在售商品 - - - 版权页比价 - + + 在售商品 @@ -465,6 +463,13 @@ + + + + 确认上传 + + + @@ -857,6 +862,7 @@ export default { noIsbnProductList: [], noIsbnHistoryList: [], noIsbnLoading: false, + noIsbnSubmitting: false, noIsbnDetailExpanded: false, // 筛选 @@ -1625,56 +1631,42 @@ 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 - let contentLines - if (this.currentTab === 'isbn') { - // 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 { - // 无ISBN页 - 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 + '张' - ] - } + const contentLines = [ + '📦 货区:' + locationText, + '📖 ISBN:' + isbn, + '📕 书名:' + bookName, + '💰 价格:' + price, + '📊 库存:' + stock, + '✍️ 作者:' + author, + '🏢 出版社:' + publisher, + '🏷️ 定价:' + fixPrice, + '📅 印刷时间:' + printTime, + '📷 图片:' + photoCount + '张' + ] uni.showModal({ title: '确认上传', @@ -1698,6 +1690,7 @@ export default { uni.hideLoading() this.isSubmitting = false uni.showToast({ title: '上传成功', icon: 'success' }) + // 清空表单待后续对接真实API }, 1500) }, @@ -1762,12 +1755,6 @@ 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 @@ -1775,70 +1762,57 @@ export default { }) }, - // 无ISBN - 版权页比价(带作者+出版社精确搜索) - searchNoIsbnCopyright() { - if (!this.isLoggedIn) { - uni.showToast({ title: '请先登录孔网账号', icon: 'none' }) + // 无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' }) return } if (!this.noIsbnBookName) { - uni.showToast({ title: '请输入书名', icon: 'none' }) + uni.showToast({ title: '书名不能为空', icon: 'none' }) return } - 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) - } - }) + + 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) + } } - }).catch(err => { - console.error('版权比价失败:', err) - this.noIsbnLoading = false - uni.showToast({ title: '比价失败', icon: 'none' }) }) }, @@ -1909,19 +1883,23 @@ 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')) { - // 978开头的13位数字 → 填入ISBN,书号清空 + // 978开头的13位数字 → 填入ISBN this.noIsbnIsbn = bookCode this.noIsbnUnifyIsbn = '' - } else { - // 其他情况 → 书号保留原值,ISBN生成678开头13位数字 - this.noIsbnUnifyIsbn = texts.书号 + } else if (bookCode.length === 13) { + // 非978的13位数字 → 填入书号,ISBN随机生成678开头 + this.noIsbnUnifyIsbn = bookCode this.noIsbnIsbn = '678' + String(Date.now()).slice(-10) + } else { + // 其他情况 → 直接填入书号 + this.noIsbnUnifyIsbn = texts.书号 } } if (texts.字数) this.noIsbnWordCount = this.processNoIsbnWordage(texts.字数) @@ -2351,20 +2329,23 @@ export default { background: transparent; } -/* ========== 版权页比价按钮 ========== */ -.copyright-btn { - padding: 8rpx 16rpx; - background-color: #409eff; - border-radius: 6rpx; - display: flex; - align-items: center; - justify-content: center; +/* ========== 价格建议提示 ========== */ +.price-suggest-hint { + margin-top: 10rpx; + padding: 12rpx 16rpx; + background-color: #f0f9eb; + border-radius: 8rpx; + border: 2rpx solid #e1f3d8; } -.copyright-btn-text { - font-size: 24rpx; - color: #ffffff; - font-weight: 500; +.price-suggest-hint .hint-text { + font-size: 26rpx; + color: #67c23a; +} + +.price-suggest-hint .hint-value { + font-weight: bold; + font-size: 28rpx; } /* ========== 扫描/搜索按钮 ========== */ @@ -2787,6 +2768,11 @@ export default { justify-content: center; } +.submit-area { + margin-top: 30rpx; + padding: 0 20rpx; +} + .submit-btn.disabled { opacity: 0.6; } @@ -2872,6 +2858,12 @@ export default { font-weight: 600; } +.submit-btn-text { + color: #ffffff; + font-size: 32rpx; + font-weight: 600; +} + /* ========== 筛选弹窗 ========== */ .filter-popup { position: fixed; diff --git a/utils/kongfz.js b/utils/kongfz.js index 679879d..4d75f2b 100644 --- a/utils/kongfz.js +++ b/utils/kongfz.js @@ -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 = '', publisher = '', author = '' } = options + const { phpsessid = '', page = 1, sortType = '', quality = '' } = options return new Promise((resolve, reject) => { const reqData = { dataType: 0, @@ -208,12 +208,6 @@ 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(',') }