From 22ef43510c9c2b816ffbebbb00022b7fa51cea4e Mon Sep 17 00:00:00 2001 From: "97694732@qq.com" Date: Thu, 4 Jun 2026 09:52:00 +0800 Subject: [PATCH] =?UTF-8?q?=E6=97=A0ISBN=E4=B8=8A=E4=BC=A0:=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E4=BD=9C=E8=80=85/=E6=90=9C=E7=B4=A2=E6=8C=89?= =?UTF-8?q?=E9=92=AE/=E5=B8=82=E5=9C=BA=E7=AB=9E=E4=BA=89/=E5=9C=A8?= =?UTF-8?q?=E5=94=AE=E5=95=86=E5=93=81/=E4=B8=8A=E4=B9=A6=E8=AE=B0?= =?UTF-8?q?=E5=BD=95/=E7=A1=AE=E8=AE=A4=E4=B8=8A=E4=BC=A0=20=E5=85=A8?= =?UTF-8?q?=E9=83=A8=E4=BD=BF=E7=94=A8ISBN=E9=A1=B5=E5=90=8C=E6=AC=BEkongf?= =?UTF-8?q?z=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/upload/upload.vue | 254 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 250 insertions(+), 4 deletions(-) diff --git a/pages/upload/upload.vue b/pages/upload/upload.vue index c8cd452..3712356 100644 --- a/pages/upload/upload.vue +++ b/pages/upload/upload.vue @@ -239,12 +239,29 @@ - + 书名 - + + + + + + + + + + + + + + + + 作者 + + @@ -363,6 +380,82 @@ + + + + 市场竞争 + + + + 在售 + {{ noIsbnMarketData.onSale }} + + + + {{ noIsbnMarketData.old }} + + + + {{ noIsbnMarketData.new }} + + + 已售 + {{ noIsbnMarketData.sold }} + + + + + + + + 在售商品 + + + + 正在比价... + + + + + {{ item.bookName || '未知书名' }} + {{ item.author || '' }} + ¥{{ item.totalPrice.toFixed(2) }} + 书¥{{ item.bookPrice.toFixed(2) }}+运¥{{ item.shippingFee.toFixed(2) }} + {{ item.condition || '' }} + {{ item.shopName || '' }} + + + 暂无在售商品 + + + + + + + + 上书记录 + + + + + {{ item.date }} + {{ item.condition }} + + + ¥{{ item.price }} + 库存{{ item.stock }}本 + + + + + + + + + 确认上传 + + + @@ -737,19 +830,27 @@ export default { // 无ISBN表单 noIsbnPrintTime: '', noIsbnBookName: '', + noIsbnAuthor: '', noIsbnPublisher: '', noIsbnSelectedCategory: '', noIsbnFormat: '', noIsbnOriginalPrice: '', noIsbnWordCount: '', noIsbnIsbn: '', - noIsbnSelectedCondition: '', + noIsbnSelectedCondition: '六品', noIsbnPrice: '', - noIsbnStock: '', + noIsbnStock: 1, noIsbnPhotoList: [], noIsbnSelectedArea: '', noIsbnWarehouseData: null, + // 无ISBN - 市场竞争/在售 + noIsbnMarketData: { onSale: 0, old: 0, new: 0, sold: 0 }, + noIsbnProductList: [], + noIsbnHistoryList: [], + noIsbnLoading: false, + noIsbnSubmitting: false, + // 分类 showCategoryPopup: false, categoryList: ['文学', '艺术', '历史', '哲学', '科学', '技术', '教育', '经济', '政治', '军事', '法律', '社会', '文化', '语言', '工具书', '其他'], @@ -858,6 +959,18 @@ export default { } return this.selectedCondition ? (map[this.selectedCondition] || '') : '' }, + noIsbnConditionValue() { + const map = { + '全新': '100~', + '九五品': '95~', + '九品': '90~', + '八五品': '85~', + '八品': '80~', + '七品': '70~', + '六品': '60~' + } + return this.noIsbnSelectedCondition ? (map[this.noIsbnSelectedCondition] || '') : '' + }, calculatedPrice() { const sorted = this.sortedProductList if (sorted.length === 0) return 0 @@ -1416,6 +1529,124 @@ export default { }, 1500) }, + // 无ISBN - 书名搜索(使用与ISBN相同的kongfz接口) + searchNoIsbn() { + if (!this.isLoggedIn) { + uni.showToast({ title: '请先登录孔网账号', icon: 'none' }) + return + } + if (!this.noIsbnBookName) { + uni.showToast({ title: '请输入书名', icon: 'none' }) + return + } + this.noIsbnLoading = true + this.noIsbnProductList = [] + const phpsessid = this.kongfzToken || uni.getStorageSync('kongfz_phpsessid') || '' + const keyword = this.noIsbnBookName + Promise.all([ + searchProducts(keyword, { phpsessid, sortType: '7', quality: this.noIsbnConditionValue }), + searchFacet(keyword, { phpsessid, dataType: 0 }), + searchFacet(keyword, { phpsessid, dataType: 1 }) + ]).then(([productsData, onSaleFacet, soldFacet]) => { + 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.noIsbnMarketData = { + onSale: onSaleFacet ? onSaleFacet.totalFound : (productsData ? productsData.total : 0), + old: onSaleFacet ? onSaleFacet.oldCount : 0, + new: onSaleFacet ? onSaleFacet.newCount : 0, + sold: soldFacet ? soldFacet.totalFound : 0 + } + }).catch(err => { + console.error('无ISBN搜索失败:', err) + this.noIsbnLoading = false + 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' }) + 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 || '-'), + '📅 印刷时间:' + (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) + } + } + }) + }, + // 登录 - 接入孔夫子真实登录 handleLogin() { if (!this.loginAccount) { @@ -2203,12 +2434,27 @@ export default { justify-content: center; } +.submit-area { + margin-top: 30rpx; + padding: 0 20rpx; +} + +.submit-btn.disabled { + opacity: 0.6; +} + .submit-text { color: #ffffff; font-size: 32rpx; font-weight: 600; } +.submit-btn-text { + color: #ffffff; + font-size: 32rpx; + font-weight: 600; +} + /* ========== 筛选弹窗 ========== */ .filter-popup { position: fixed;