daShangDao_miniProgram/unpackage/dist/build/mp-weixin/pages/index/index.js
2025-11-24 10:25:20 +08:00

1 line
37 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

(global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["pages/index/index"],{"0f3c":function(e,t,o){"use strict";o.r(t);var n=o("e86a"),a=o.n(n);for(var r in n)["default"].indexOf(r)<0&&function(e){o.d(t,e,(function(){return n[e]}))}(r);t["default"]=a.a},"42cb":function(e,t,o){"use strict";(function(e,t){var n=o("47a9");o("4058");n(o("3240"));var a=n(o("f3b0"));e.__webpack_require_UNI_MP_PLUGIN__=o,t(a.default)}).call(this,o("3223")["default"],o("df3c")["createPage"])},"61b7":function(e,t,o){"use strict";o.d(t,"b",(function(){return a})),o.d(t,"c",(function(){return r})),o.d(t,"a",(function(){return n}));var n={uPicker:function(){return Promise.all([o.e("common/vendor"),o.e("uni_modules/uview-ui/components/u-picker/u-picker")]).then(o.bind(null,"c804"))},uTag:function(){return Promise.all([o.e("common/vendor"),o.e("uni_modules/uview-ui/components/u-tag/u-tag")]).then(o.bind(null,"485e"))},uUpload:function(){return Promise.all([o.e("common/vendor"),o.e("uni_modules/uview-ui/components/u-upload/u-upload")]).then(o.bind(null,"1915"))},bcodeCamera:function(){return o.e("uni_modules/bcode-camera/components/bcode-camera/bcode-camera").then(o.bind(null,"acbe"))},uPopup:function(){return Promise.all([o.e("common/vendor"),o.e("uni_modules/uview-ui/components/u-popup/u-popup")]).then(o.bind(null,"c866"))},uButton:function(){return Promise.all([o.e("common/vendor"),o.e("uni_modules/uview-ui/components/u-button/u-button")]).then(o.bind(null,"825f"))}},a=function(){var e=this,t=e.$createElement,o=(e._self._c,"isbn"===e.currentTab?(e.isFiltered?e.filteredOnSaleProducts:e.displayOnSaleProducts).length:null),n="title"===e.currentTab?(e.isFiltered?e.filteredOnSaleProducts:e.displayOnSaleProducts).length:null;e._isMounted||(e.e0=function(t){e.currentTab="isbn"},e.e1=function(t){e.currentTab="title"},e.e2=function(t){e.show=!0},e.e3=function(t){e.showCamera=!1},e.e4=function(t){e.popupShow=!0},e.e5=function(t){e.popupDialog.showPicker=!0},e.e6=function(t){e.popupDialog.showPicker=!1},e.e7=function(t){e.show=!0},e.e8=function(t){e.showCamera=!1},e.e9=function(t){e.popupShow=!0}),e.$mp.data=Object.assign({},{$root:{g0:o,g1:n}})},r=[]},"9b39":function(e,t,o){"use strict";var n=o("f748"),a=o.n(n);a.a},e86a:function(e,t,o){"use strict";(function(e){var n=o("47a9"),a=o("3b2d");Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r,s=n(o("7eb4")),i=n(o("34cf")),c=n(o("3b2d")),l=n(o("ee10")),u=n(o("af34")),h=n(o("7ca3")),f=o("8f59"),d=n(o("87b7")),p=g(o("e8ac")),m=g(o("6718"));function b(e){if("function"!==typeof WeakMap)return null;var t=new WeakMap,o=new WeakMap;return(b=function(e){return e?o:t})(e)}function g(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!==a(e)&&"function"!==typeof e)return{default:e};var o=b(t);if(o&&o.has(e))return o.get(e);var n={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in e)if("default"!==s&&Object.prototype.hasOwnProperty.call(e,s)){var i=r?Object.getOwnPropertyDescriptor(e,s):null;i&&(i.get||i.set)?Object.defineProperty(n,s,i):n[s]=e[s]}return n.default=e,o&&o.set(e,n),n}function v(e,t){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),o.push.apply(o,n)}return o}function k(e){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{};t%2?v(Object(o),!0).forEach((function(t){(0,h.default)(e,t,o[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):v(Object(o)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(o,t))}))}return e}var w={computed:k({},(0,f.mapState)(["priceMode","priceType","averageRange","selectedPosition"])),components:{"bcode-camera":function(){o.e("uni_modules/bcode-camera/components/bcode-camera/bcode-camera").then(function(){return resolve(o("acbe"))}.bind(null,o)).catch(o.oe)}},created:function(){this.$selectBookImage=p},data:function(){var e;return e={lowestBookPrice:0,lowestTotalPrice:0,currentTab:"isbn",retype:!1,scanResult:null,isSaving:!1,saveSuccess:!1,saveError:null,show:!1,popupShow:!1,isbn:"",value4:1,value3:1,fileList1:[],uploadedImages:[],selectedStorage:"",warehouse:"",shelf:"",location:"",bookPicPath:null,searchResults:[],showSearchDropdown:!1,fixPrice:1,cameraRatio:"1:1",showCameraRatioPopup:!1,compareType:"isbn",titleCompareResults:[],showCamera:!1,searchBoxRef:null,onSaleProducts:[],displayOnSaleProducts:[],soldProducts:[],publisherOptions:[],formattedData:[],authorOptions:[],filteredOnSaleProducts:[],filteredSoldProducts:[],isFiltered:!1,publisherAuthorMap:new Map,authorPublisherMap:new Map,title:"uni-fab",directionStr:"水平",horizontal:"right",vertical:"bottom",direction:"horizontal",pattern:{color:"#7A7E83",backgroundColor:"#fff",selectedColor:"#007AFF",buttonColor:"#007AFF",iconColor:"#fff"},is_color_type:!1},(0,h.default)(e,"selectedStorage",""),(0,h.default)(e,"shelves",[]),(0,h.default)(e,"locations",[]),(0,h.default)(e,"selectedWarehouse",null),(0,h.default)(e,"selectedSheId",null),(0,h.default)(e,"selectedFreId",null),(0,h.default)(e,"formData",{isbn:"",sku:"",title:"",art_no:"",more:"",bookName:""}),(0,h.default)(e,"formData2",{isbn:"",sku:"",title:"",art_no:"",more:"",bookName:""}),(0,h.default)(e,"columns",[[],[],[]]),(0,h.default)(e,"warehouseShelvesData",{}),(0,h.default)(e,"shelfLocationsData",{}),(0,h.default)(e,"conditions",[{name:"六品",checked:!1},{name:"七品",checked:!1},{name:"八品",checked:!1},{name:"八五品",checked:!1},{name:"九品",checked:!1},{name:"九五品",checked:!1},{name:"全新",checked:!1}]),(0,h.default)(e,"marketTags",[{label:"在售:",value:0},{label:"旧:",value:0},{label:"新:",value:0},{label:"已售:",value:0}]),(0,h.default)(e,"popupDialog",{show:!1,title:"",content:"",confirmText:"",cancelText:"",imgSrc:"",count:0,subFormData:null,showPicker:!1,selectedSeries:""}),e},watch:{displayOnSaleProducts:{handler:function(e){e&&e.length>0&&(this.lowestBookPrice=Math.min.apply(Math,(0,u.default)(e.map((function(e){return parseFloat(e.bookPrice)||0})))),this.lowestTotalPrice=Math.min.apply(Math,(0,u.default)(e.map((function(e){return parseFloat(e.totalPrice)||0})))),this.calculateReferencePrice())},immediate:!0},priceMode:{handler:function(){this.calculateReferencePrice()}},priceType:{handler:function(){this.calculateReferencePrice()}},averageRange:{handler:function(){this.calculateReferencePrice()}}},onLoad:function(){var t=this;return(0,l.default)(s.default.mark((function o(){var n,a,r,i;return s.default.wrap((function(o){while(1)switch(o.prev=o.next){case 0:if(e.getStorageSync("phoneNumber"),n=e.getStorageSync("selectedWarehouse"),!n){o.next=15;break}return t.selectedWarehouse=n,t.columns[0]=[n.name],t.selectedStorage=n.name,o.next=8,t.fetchShelves(n.id);case 8:if(a=o.sent,!(a.length>0)){o.next=15;break}return r=a[0].id,o.next=13,t.fetchLocations(r);case 13:i=o.sent,t.columns[2]=i.map((function(e){return e.code}));case 15:case"end":return o.stop()}}),o)})))()},onReady:function(){},onUnload:function(){},onBackPress:function(){return!!this.$refs.fab.isShow&&(this.$refs.fab.close(),!0)},methods:(r={getBookRecords:function(){return(0,l.default)(s.default.mark((function t(){var o,n;return s.default.wrap((function(t){while(1)switch(t.prev=t.next){case 0:if(t.prev=0,o=e.getStorageSync("phoneNumber"),o){t.next=5;break}return e.showToast({title:"请先登录",icon:"none"}),t.abrupt("return");case 5:return e.showLoading({title:"加载中..."}),t.next=8,m.fetchBookRecords(o);case 8:if(n=t.sent,e.hideLoading(),0!==n.length){t.next=13;break}return e.showToast({title:"暂无上书记录",icon:"none"}),t.abrupt("return");case 13:e.navigateTo({url:"/pages/scan/book-records",success:function(e){e.eventChannel.emit("bookRecordsData",{records:n})}}),t.next=21;break;case 16:t.prev=16,t.t0=t["catch"](0),console.error("获取上书记录失败:",t.t0),e.hideLoading(),e.showToast({title:"获取上书记录失败",icon:"none"});case 21:case"end":return t.stop()}}),t,null,[[0,16]])})))()},cancel:function(){this.show=!1},open:function(){console.log("弹出层打开"),this.popupShow=!0},close:function(){this.popupShow=!1,console.log("弹出层关闭")},togglePublisherTag:function(e){this.publisherTags[e].checked=!this.publisherTags[e].checked},toggleAuthorTag:function(e){this.authorTags[e].checked=!this.authorTags[e].checked},resetFilters:function(){this.publisherTags.forEach((function(e){return e.checked=!1})),this.authorTags.forEach((function(e){return e.checked=!1}))},applyFilters:function(){var e=this.publisherTags.map((function(e,t){return e.checked?t:-1})).filter((function(e){return-1!==e})),t=this.authorTags.map((function(e,t){return e.checked?t:-1})).filter((function(e){return-1!==e}));console.log("选中的出版社:",e),console.log("选中的作者:",t),this.popupShow=!1},onSeriesConfirm:function(e){this.popupDialog.selectedSeries=e.value[0],this.popupDialog.showPicker=!1},submitForm:function(){var t,o,n=this,a=this.warehouse;console.log("warehouse",a);var r=this.shelf;console.log("shelf",r);var s=this.location;if(console.log("location",s),"isbn"===this.currentTab){if(!this.scanResult)return void e.showToast({title:"请扫码获取ISBN",icon:"none"});if(!this.formData.bookName)return void e.showToast({title:"请输入书名",icon:"none"});if(!a&&!r&&!s)return void e.showToast({title:"请选择仓库/货架/货位",icon:"none"})}else{if(!this.formData2.bookName)return void e.showToast({title:"请输入书名",icon:"none"});if(!a)return void e.showToast({title:"请选择仓库/货架/货位",icon:"none"});if(!r)return void e.showToast({title:"请选择仓库/货架/货位",icon:"none"});if(!s)return void e.showToast({title:"请选择仓库/货架/货位",icon:"none"})}var i=this.conditions.find((function(e){return e.checked}));if(i){var c={barcode:this.scanResult,name:this.formData.bookName,recommendation:this.formData.recommendation,conditionCode:null===(t=this.conditions.find((function(e){return e.checked})))||void 0===t?void 0:t.name,price:100*this.value4,inventory:this.value3||1,files:this.uploadedImages.length>0?this.uploadedImages:this.fileList1.map((function(e){return k(k({},e),{},{num:e.num||"1"})})),marketTags:this.marketTags,fixPrice:100*this.fixPrice,selectedStorage:this.selectedStorage,depotName:this.warehouse,shelvesName:this.shelf,freightName:this.location,userName:e.getStorageSync("username"),passWord:e.getStorageSync("password"),tenantId:e.getStorageSync("tenantId"),phoneNumber:e.getStorageSync("phoneNumber")},l={barcode:this.formData2.isbn,name:this.formData2.bookName,recommendation:this.formData.recommendation,conditionCode:null===(o=this.conditions.find((function(e){return e.checked})))||void 0===o?void 0:o.name,price:100*this.value4,inventory:this.value3||1,files:this.uploadedImages.length>0?this.uploadedImages:this.fileList1.map((function(e){return k(k({},e),{},{num:e.num||"1"})})),fixPrice:100*this.fixPrice,marketTags:this.marketTags,selectedStorage:this.selectedStorage,depotName:this.warehouse,shelvesName:this.shelf,freightName:this.location,userName:e.getStorageSync("username"),passWord:e.getStorageSync("password"),tenantId:e.getStorageSync("tenantId"),phoneNumber:e.getStorageSync("phoneNumber")},u="isbn"===this.currentTab?c:l;console.log("提交的表单数据:",u),e.request({url:"https://api.buzhiyushu.cn/zhishu/shopGoods/repeatBook",method:"POST",data:u,header:{"Content-Type":"application/json"},success:function(e){if(0!=e.data.data.count){var t=e.data.data.name.trim(),o=d.default.MD5(t).toString(),a=t?o.charAt(0).toUpperCase():"";console.log("原始书名:",t),console.log("MD5加密后32位小写:",o),console.log("加密后字符串的首字母大写:",a);var r=e.data.data.image;console.log("图片",r);var s="https://img.buzhiyushu.cn/zhishu1/".concat(a,"/").concat(r);console.log("fullImageUrl",s),n.popupDialog.title="提示",n.popupDialog.content="请仔细核对此书是否为套装书,一号多书等情况?请选择",n.popupDialog.confirmText="是",n.popupDialog.cancelText="否",n.popupDialog.imgSrc=s,n.popupDialog.show=!0,n.popupDialog.count=e.data.data.count,n.popupDialog.subFormData=u}else n.submitToServer(u)},fail:function(t){console.error("检查重复书籍失败:",t),e.showToast({title:"网络错误,请稍后重试",icon:"none"})}})}else e.showToast({title:"请选择品相",icon:"none"})},onPopupConfirm:function(){this.popupDialog.subFormData.series=this.popupDialog.selectedSeries,this.submitToServer(this.popupDialog.subFormData),this.popupDialog.show=!1},onPopupCancel:function(){this.submitToServer(this.popupDialog.subFormData),this.popupDialog.show=!1},submitToServer:function(t){var o=this;e.request({url:"https://api.buzhiyushu.cn/zhishu/shopGoods/submit",method:"POST",data:t,header:{"Content-Type":"application/json"},success:function(t){console.log("请求成功1111:",t),e.setStorageSync("lastSelectedStorage",o.selectedStorage),e.setStorageSync("lastSelectedWarehouse",o.warehouse),e.setStorageSync("lastSelectedShelf",o.shelf),e.setStorageSync("lastSelectedLocation",o.location),"isbn"===o.currentTab?(o.formData={bookName:"",recommendation:""},o.scanResult=""):o.formData2={isbn:"",bookName:"",recommendation:""},o.value4=o.value4,o.value3=o.value3,o.fileList1=[],o.uploadedImages=[],o.marketTags=[],e.showToast({title:"提交成功",icon:"success"}),console.log("请求成功,表单已清空")},fail:function(t){console.error("请求失败:",t),e.showToast({title:"网络错误,请稍后重试",icon:"none"})}}),e.showToast({title:"数据已打印到控制台",icon:"none"})},validateValue3:function(){var e=parseFloat(this.value3);isNaN(e)?this.value3=0:this.value3=e>99?99:e<-99?-99:parseFloat(e.toFixed(2))},validateValue4:function(){var e=parseFloat(this.value4);isNaN(e)?this.value4=0:this.value4=e>99?99:e<-99?-99:parseFloat(e.toFixed(2))},deletePic:function(e){this["fileList".concat(e.name)].splice(e.index,1),this.uploadedImages.length>e.index&&this.uploadedImages.splice(e.index,1)},setCameraRatio:function(t){this.cameraRatio=t,e.showToast({title:"已设置拍照比例为".concat(t),icon:"none"})},openCamera:function(){this.showCamera=!0},onCameraConfirm:function(e){var t=this;return(0,l.default)(s.default.mark((function o(){var n;return s.default.wrap((function(o){while(1)switch(o.prev=o.next){case 0:console.log("相机拍照确认",e),t.showCamera=!1,n={url:e.url},t.afterRead({file:n,name:"1"});case 4:case"end":return o.stop()}}),o)})))()},afterRead:function(t){var o=this;return(0,l.default)(s.default.mark((function n(){var a,r,i,c,l,u,h;return s.default.wrap((function(n){while(1)switch(n.prev=n.next){case 0:if(a=[].concat(t.file),console.log("lists",a),!(o["fileList".concat(t.name)].length+a.length>9)){n.next=8;break}if(e.showToast({title:"最多只能上传9张图片",icon:"none"}),r=9-o["fileList".concat(t.name)].length,!(r<=0)){n.next=7;break}return n.abrupt("return");case 7:a=a.slice(0,r);case 8:i=o["fileList".concat(t.name)].length,a.map((function(e){o["fileList".concat(t.name)].push(k(k({},e),{},{status:"uploading",message:"上传中"}))})),c=0;case 11:if(!(c<a.length)){n.next=29;break}return n.prev=12,n.next=15,o.uploadFilePromise(a[c].url,i);case 15:l=n.sent,u=o["fileList".concat(t.name)][i],o["fileList".concat(t.name)].splice(i,1,Object.assign(u,{status:"success",message:"",url:l,num:(i+1).toString()})),n.next=25;break;case 20:n.prev=20,n.t0=n["catch"](12),console.error("处理或上传图片失败:",n.t0),h=o["fileList".concat(t.name)][i],o["fileList".concat(t.name)].splice(i,1,Object.assign(h,{status:"error",message:"上传失败"}));case 25:i++;case 26:c++,n.next=11;break;case 29:case"end":return n.stop()}}),n,null,[[12,20]])})))()},uploadFilePromise:function(t,o){var n=this;return new Promise((function(a,r){var s="isbn"===n.currentTab?n.formData.bookName:n.formData2.bookName,i="isbn"===n.currentTab?n.scanResult:n.formData2.isbn;if(!i||""===i.trim()){i="";for(var c=0;c<13;c++)i+=Math.floor(10*Math.random())}var l=(o+1).toString();e.uploadFile({url:"https://api.buzhiyushu.cn/zhishu/shopGoods/uploadImages",filePath:t,name:"file",formData:{bookName:s,isbn:i,num:l},success:function(e){console.log("图片上传成功:",e);var o=JSON.parse(e.data),r=o.url||t;n.uploadedImages.push({url:r,bookName:s,isbn:i,num:l,originalUrl:t}),a(r)},fail:function(e){console.error("图片上传失败:",e),r(e)}})}))},valChange:function(e){console.log("当前值为: "+e.value)},previewImage:function(t,o){var n=[];n=o&&Array.isArray(o)?o.map((function(e){return e.imageUrl})):[t],n.length&&n[0]?e.previewImage({current:t,urls:n,longPressActions:{itemList:["保存图片","分享图片"],success:function(e){console.log("选择了第"+(e.tapIndex+1)+"个按钮")},fail:function(e){console.log(e.errMsg)}},success:function(){},fail:function(e){console.error("预览失败:",e)}}):console.error("没有有效的图片URL可预览")},valChange1:function(e){console.log("当前值为: "+e.value)},radioClick:function(e){this.conditions=this.conditions.map((function(t,o){return k(k({},t),{},{checked:o===e})}))},populateForm:function(e){var t=this;return(0,l.default)(s.default.mark((function o(){var n,a,r;return s.default.wrap((function(o){while(1)switch(o.prev=o.next){case 0:console.log("data2",e),t.formData.bookName=e.bookName,t.fixPrice=e.fixPrice,t.formData.recommendation="权威认证 立即购买",t.value=e.price,t.value1=e.stock,t.formData.isbn=e.isbn,n=parseInt(e.sellCount.replace("条",""),10),a=parseInt(e.buyCount.replace("人买过",""),10),r=t.conditions.some((function(e){return e.checked})),r||(t.conditions=t.conditions.map((function(t){return k(k({},t),{},{checked:t.name===e.condition})}))),t.marketTags=t.marketTags.map((function(e){return"在售:"===e.label?k(k({},e),{},{value:n}):"已售:"===e.label?k(k({},e),{},{value:a}):e})),e.bookPic&&(e.bookPic.split(".")[0],e.bookPic.split(".")[1]);case 13:case"end":return o.stop()}}),o)})))()},populateForm2:function(e){console.log("选中的数据",e),this.formData2.isbn=e.isbn,this.formData2.bookName=e.bookName,this.formData.recommendation="权威认证 立即购买",this.value=e.fixPrice||0,this.value1=e.stock||1;var t=e.sellCount?parseInt(e.sellCount.replace("条",""),10):0,o=e.buyCount?parseInt(e.buyCount.replace("人买过",""),10):0;this.conditions=this.conditions.map((function(t){return k(k({},t),{},{checked:t.name===e.condition})})),this.marketTags=this.marketTags.map((function(e){return"在售:"===e.label?k(k({},e),{},{value:t}):"已售:"===e.label?k(k({},e),{},{value:o}):e})),this.bookPicPath=e.bookPic?"http://your-image-domain/".concat(e.bookPic):null},selectBook:function(e){this.showSearchDropdown=!1,this.populateForm2(e),e.isbn&&this.fetchOnSaleProducts(e.isbn)},switchCompareType:function(t){if(this.compareType=t,"title"===t){if(!this.formData.bookName)return void e.showToast({title:"请先输入书名",icon:"none"});this.fetchOnSaleProducts(this.formData.bookName,"title")}else if("isbn"===t){if(!this.formData.isbn)return void e.showToast({title:"请先扫码获取ISBN",icon:"none"});this.fetchOnSaleProducts(this.formData.isbn,"isbn")}},calculateReferencePrice:function(){if(this.displayOnSaleProducts&&0!==this.displayOnSaleProducts.length){var t=(0,u.default)(this.displayOnSaleProducts),o=0===this.priceType?"bookPrice":"totalPrice";switch(t.sort((function(e,t){return parseFloat(e[o])-parseFloat(t[o])})),this.priceMode){case 0:var n=this.selectedPosition||0,a=Math.min(n,t.length-1);if(console.log("使用第"+(a+1)+"条数据的价格"),0===this.priceType)this.value4=parseFloat(t[a].bookPrice),this.lowestBookPrice=parseFloat(t[0].bookPrice);else{var r=parseFloat(e.getStorageSync("value3")||0),s=parseFloat(e.getStorageSync("value4")||.01),i=parseFloat(t[a].totalPrice);this.lowestTotalPrice=parseFloat(t[0].totalPrice);var c=i-r-s;this.value4=c<=0?s:parseFloat(c.toFixed(2))}break;case 1:for(var l=Math.min(this.averageRange,t.length),h=0,f=0;f<l;f++)h+=parseFloat(t[f][o]);if(0===this.priceType)this.value4=parseFloat((h/l).toFixed(2));else{var d=parseFloat(e.getStorageSync("value3")||0),p=parseFloat(e.getStorageSync("value4")||.01),m=h/l-d-p;this.value4=m<=0?p:parseFloat(m.toFixed(2))}break;case 2:0===this.priceType?this.value4=parseFloat(t[0].bookPrice):this.value4=parseFloat(t[0].totalPrice);break}}else this.value4=1},switchCompareType1:function(t){if(this.compareType=t,"title"===t){if(!this.formData2.bookName)return void e.showToast({title:"请先输入书名",icon:"none"});this.fetchOnSaleProducts(this.formData2.bookName,"title")}else if("isbn"===t){if(!this.formData2.isbn)return void e.showToast({title:"请先扫码获取ISBN",icon:"none"});this.fetchOnSaleProducts(this.formData2.isbn,"isbn")}},closeDropdown:function(){this.showSearchDropdown&&(this.showSearchDropdown=!1),this.popupShow&&(this.popupShow=!1)},handleSearchBoxClick:function(e){e.stopPropagation()},handleDropdownClick:function(e){e.stopPropagation()},fetchOnSaleProducts:function(t,o){var n=this;return(0,l.default)(s.default.mark((function o(){var a,r,i,c,l;return s.default.wrap((function(o){while(1)switch(o.prev=o.next){case 0:return o.prev=0,a=e.getStorageSync("conditionValue"),console.log("品相",a),r=e.getStorageSync("sortType"),console.log("类型",r),i=e.getStorageSync("cookies"),console.log("cookies",i),o.next=9,n.$selectBookImage.fetchOnSaleProducts(t,r,a,i);case 9:c=o.sent,console.log("总价",c),n.onSaleProducts=(0,u.default)(c),l=(0,u.default)(c).sort((function(e,t){var o=parseFloat(e.totalPrice)||0,n=parseFloat(t.totalPrice)||0;return o-n})),n.displayOnSaleProducts=l.slice(0,12),n.filteredOnSaleProducts=(0,u.default)(n.onSaleProducts),console.log("获取在售商品信息成功(已获取全部数据展示按价格排序的前10条):",n.displayOnSaleProducts),n.extractPublishersAndAuthors(),n.calculateReferencePrice(),o.next=24;break;case 20:o.prev=20,o.t0=o["catch"](0),console.error("获取在售商品信息失败:",o.t0),e.showToast({title:"获取在售商品信息失败",icon:"none"});case 24:case"end":return o.stop()}}),o,null,[[0,20]])})))()},extractPublishersAndAuthors:function(){var e=new Map,t=new Map;this.onSaleProducts.forEach((function(o){o.publisher&&o.author&&(e.has(o.publisher)||e.set(o.publisher,new Set),e.get(o.publisher).add(o.author),t.has(o.author)||t.set(o.author,new Set),t.get(o.author).add(o.publisher))})),this.publisherAuthorMap=e,this.authorPublisherMap=t;var o=new Set;this.onSaleProducts.forEach((function(e){e.publisher&&o.add(e.publisher)}));var n=new Set;this.onSaleProducts.forEach((function(e){e.author&&n.add(e.author)})),this.publisherOptions=Array.from(o).map((function(e){return{publisher:e,checked:!1,visible:!0}})),this.authorOptions=Array.from(n).map((function(e){return{author:e,checked:!1,visible:!0}})),console.log("提取的出版社选项:",this.publisherOptions),console.log("提取的作者选项:",this.authorOptions),console.log("出版社-作者映射:",this.publisherAuthorMap),console.log("作者-出版社映射:",this.authorPublisherMap)},togglePublisherFilter:function(e){var t=this;this.publisherOptions[e].checked=!this.publisherOptions[e].checked;var o=this.publisherOptions.filter((function(e){return e.checked})).map((function(e){return e.publisher}));if(0===o.length)this.authorOptions.forEach((function(e){e.visible=!0}));else{var n=this.publisherOptions[e].publisher;this.publisherOptions[e].checked?this.authorOptions.forEach((function(e){if(t.publisherAuthorMap.has(n)){var o=t.publisherAuthorMap.get(n);e.visible=o.has(e.author)}else e.visible=!1})):(this.authorOptions.forEach((function(e){e.visible=!1})),o.forEach((function(e){if(t.publisherAuthorMap.has(e)){var o=t.publisherAuthorMap.get(e);t.authorOptions.forEach((function(e){o.has(e.author)&&(e.visible=!0)}))}})))}this.authorOptions.forEach((function(e){e.visible||(e.checked=!1)}))},toggleAuthorFilter:function(e){var t=this;this.authorOptions[e].checked=!this.authorOptions[e].checked;var o=this.authorOptions.filter((function(e){return e.checked})).map((function(e){return e.author}));if(0===o.length)this.publisherOptions.forEach((function(e){e.visible=!0}));else{var n=this.authorOptions[e].author;this.authorOptions[e].checked?this.publisherOptions.forEach((function(e){if(t.authorPublisherMap.has(n)){var o=t.authorPublisherMap.get(n);e.visible=o.has(e.publisher)}else e.visible=!1})):(this.publisherOptions.forEach((function(e){e.visible=!1})),o.forEach((function(e){if(t.authorPublisherMap.has(e)){var o=t.authorPublisherMap.get(e);t.publisherOptions.forEach((function(e){o.has(e.publisher)&&(e.visible=!0)}))}})))}this.publisherOptions.forEach((function(e){e.visible||(e.checked=!1)}))}},(0,h.default)(r,"resetFilters",(function(){this.publisherOptions.forEach((function(e){e.checked=!1,e.visible=!0})),this.authorOptions.forEach((function(e){e.checked=!1,e.visible=!0})),this.isFiltered=!1,this.filteredOnSaleProducts=(0,u.default)(this.displayOnSaleProducts),this.filteredSoldProducts=(0,u.default)(this.soldProducts),this.popupShow=!1})),(0,h.default)(r,"applyFilters",(function(){var e=this.publisherOptions.filter((function(e){return e.checked})).map((function(e){return e.publisher})),t=this.authorOptions.filter((function(e){return e.checked})).map((function(e){return e.author}));if(0===e.length&&0===t.length)this.filteredOnSaleProducts=(0,u.default)(this.displayOnSaleProducts),this.filteredSoldProducts=(0,u.default)(this.soldProducts),this.isFiltered=!1;else{var o=this.onSaleProducts.filter((function(o){var n=0===e.length||o.publisher&&e.includes(o.publisher),a=0===t.length||o.author&&t.includes(o.author);return n&&a}));o=o.sort((function(e,t){var o=parseFloat(e.totalPrice)||0,n=parseFloat(t.totalPrice)||0;return o-n})),this.filteredOnSaleProducts=o.slice(0,10);var n=this.soldProducts.filter((function(o){var n=0===e.length||o.publisher&&e.includes(o.publisher),a=0===t.length||o.author&&t.includes(o.author);return n&&a}));n=n.sort((function(e,t){var o=parseFloat(e.price)||0,n=parseFloat(t.price)||0;return o-n})),this.filteredSoldProducts=n.slice(0,10),this.isFiltered=!0}console.log("筛选后的在售商品(已限制为价格最低的10条):",this.filteredOnSaleProducts),console.log("筛选后的已售商品(已限制为价格最低的10条):",this.filteredSoldProducts),this.popupShow=!1})),(0,h.default)(r,"increaseValue3",(function(){parseFloat(this.value3)<99&&(this.value3=parseFloat((parseFloat(this.value3)+1).toFixed(2)))})),(0,h.default)(r,"decreaseValue3",(function(){parseFloat(this.value3)>-99&&(this.value3=parseFloat((parseFloat(this.value3)-1).toFixed(2)))})),(0,h.default)(r,"increaseValue4",(function(){parseFloat(this.value4)<999&&(this.value4=parseFloat((parseFloat(this.value4)+.01).toFixed(2)))})),(0,h.default)(r,"decreaseValue4",(function(){parseFloat(this.value4)>.01&&(this.value4=parseFloat((parseFloat(this.value4)-.01).toFixed(2)))})),(0,h.default)(r,"startScanning",(function(){var t=this;e.scanCode({onlyFromCamera:!0,scanType:["barcode"],success:function(o){console.log("res",o),13!=o.result.length?(console.error("扫码失败:"),e.showToast({title:"扫码失败,请重试",icon:"none"})):(t.scanResult=o.result,t.fetchBookInfo(o.result))},fail:function(t){console.error("扫码失败:",t.errMsg),e.showToast({title:"扫码失败,请重试",icon:"none"})}})})),(0,h.default)(r,"fetchBookInfo",(function(t){var o=this;return(0,l.default)(s.default.mark((function n(){var a,r,i,c,l,u;return s.default.wrap((function(n){while(1)switch(n.prev=n.next){case 0:return console.log("123123",t),n.prev=1,n.next=4,e.request({url:"https://api.buzhiyushu.cn/zhishu/baseInfo/getIsbn/".concat(t),method:"POST",header:{"Content-Type":"application/json"}});case 4:if(a=n.sent,console.log("完整响应:",a),r=Array.isArray(a)?a[1]:a,console.log("响应:",r),200!==r.statusCode||!r.data.data){n.next=16;break}return console.log("data",a[1].data),i=r.data.data,o.bookInfo=i,o.populateForm(i),console.log("isbn",t),o.fetchOnSaleProducts(t),n.abrupt("return");case 16:return console.log("尝试使用Python接口查询"),n.next=19,e.request({url:"https://api.buzhiyushu.cn/zhishu/shopGoods/python/".concat(t),method:"POST",header:{"Content-Type":"application/json"}});case 19:if(c=n.sent,l=Array.isArray(c)?c[1]:c,200!==l.statusCode||!l.data.data){n.next=27;break}return u=l.data.data,o.bookInfo=u,o.populateForm(u),o.fetchOnSaleProducts(t),n.abrupt("return");case 27:o.fetchOnSaleProducts(t),e.showToast({title:"暂无当前书籍信息",icon:"none"}),n.next=35;break;case 31:n.prev=31,n.t0=n["catch"](1),console.error("请求异常:",n.t0),e.showToast({title:"网络请求失败",icon:"none"});case 35:case"end":return n.stop()}}),n,null,[[1,31]])})))()})),(0,h.default)(r,"getBookName",(function(){var t=this;return(0,l.default)(s.default.mark((function o(){var n,a,r,i;return s.default.wrap((function(o){while(1)switch(o.prev=o.next){case 0:if(t.selectedStorage){o.next=3;break}return e.showToast({title:"请选择仓库",icon:"none"}),o.abrupt("return");case 3:if(n=t.formData2.bookName,console.log("11111",n),n){o.next=8;break}return e.showToast({title:"请输入书名",icon:"none"}),o.abrupt("return");case 8:return o.prev=8,o.next=11,e.request({url:"https://api.buzhiyushu.cn/zhishu/baseInfo/getBookByName",method:"POST",headers:{"Content-Type":"application/json"},data:{bookName:n}});case 11:if(a=o.sent,console.log("完整响应:",a),r=Array.isArray(a)?a[1]:a,r.data&&r.data.data){o.next=18;break}return e.showToast({title:"暂无书籍数据",icon:"none",duration:2e3}),t.clearForm(),o.abrupt("return");case 18:i=r.data.data,Array.isArray(i)?0===i.length?t.showEmptyTips():1===i.length?t.populateForm2(i[0]):(t.searchResults=i,t.showResultPopup=!0):"object"===(0,c.default)(i)?t.populateForm2(i):t.showEmptyTips(),200===r.data.code?(t.searchResults=r.data.data,t.showSearchDropdown=!0):e.showToast({title:"请求失败: 1".concat(a.statusCode),icon:"none"}),o.next=27;break;case 23:o.prev=23,o.t0=o["catch"](8),console.error("请求异常:",o.t0),e.showToast({title:"网络请求失败",icon:"none"});case 27:case"end":return o.stop()}}),o,null,[[8,23]])})))()})),(0,h.default)(r,"showEmptyTips",(function(){e.showToast({title:"暂无相关书籍数据",icon:"none",duration:2e3}),this.clearForm()})),(0,h.default)(r,"clearForm",(function(){this.formData2={isbn:"",bookName:this.formData2.bookName,recommendation:""},this.value=0,this.value1=1,this.fileList1=[],this.marketTags=this.marketTags.map((function(e){return k(k({},e),{},{value:0})})),this.bookPicPath=null})),(0,h.default)(r,"fetchShelves",(function(t){var o=this;return(0,l.default)(s.default.mark((function n(){var a,r,c,l;return s.default.wrap((function(n){while(1)switch(n.prev=n.next){case 0:return n.prev=0,n.next=3,e.request({url:"https://api.buzhiyushu.cn/shelves/shelves/sheNamelist",data:{depotId:t}});case 3:if(r=n.sent,c=(0,i.default)(r,2),c[0],l=c[1],null!==l&&void 0!==l&&null!==(a=l.data)&&void 0!==a&&a.rows){n.next=9;break}return n.abrupt("return",[]);case 9:return o.shelves=l.data.rows,o.columns[1]=o.shelves.map((function(e){return e.code})),n.abrupt("return",o.shelves);case 14:return n.prev=14,n.t0=n["catch"](0),console.error("获取货架失败:",n.t0),n.abrupt("return",[]);case 18:case"end":return n.stop()}}),n,null,[[0,14]])})))()})),(0,h.default)(r,"fetchLocations",(function(t){var o=this;return(0,l.default)(s.default.mark((function n(){var a,r,c,l,u;return s.default.wrap((function(n){while(1)switch(n.prev=n.next){case 0:if(t){n.next=3;break}return console.error("获取货位列表失败未提供货架ID"),n.abrupt("return",[]);case 3:return n.prev=3,console.log("开始获取货位数据货架ID:",t),n.next=7,e.request({url:"https://api.buzhiyushu.cn/shelves/shelves/freNamelist",method:"GET",data:{sheId:t}});case 7:if(a=n.sent,r=(0,i.default)(a,2),c=r[0],l=r[1],!c){n.next=14;break}return console.error("获取货位请求错误:",c),n.abrupt("return",[]);case 14:if(console.log("货位API响应:",l),l&&l.data&&l.data.rows){n.next=18;break}return console.error("货位响应数据格式不正确"),n.abrupt("return",[]);case 18:return u=l.data.rows,console.log("解析后的货位数据:",u),o.locations=u,o.columns[2]=u.map((function(e){return e.code||"未知货位"})),console.log("更新后的货位列:",o.columns[2]),n.abrupt("return",u);case 26:return n.prev=26,n.t0=n["catch"](3),console.error("获取货位列表失败:",n.t0),n.abrupt("return",[]);case 30:case"end":return n.stop()}}),n,null,[[3,26]])})))()})),(0,h.default)(r,"changeHandler",(function(e){var t=this;if(e){console.log("changeHandler 事件:",JSON.stringify(e));var o=e.columnIndex,n=e.index,a=e.indexes,r=void 0===a?[]:a;if(console.log("列索引:",o,"选中索引:",n,"indexes数组:",r),0===o){var s=this.columns[0][n],i=this.selectedWarehouse||{id:null,name:s};console.log("选中的仓库:",s,"仓库对象:",i),i.id&&(console.log("开始获取货架数据仓库ID:",i.id),this.fetchShelves(i.id).then((function(e){console.log("获取到货架数据:",e),t.columns[2]=[],t.$nextTick((function(){t.$refs.uPicker&&t.$refs.uPicker.setColumnValues(2,[])}))})))}if(1===o){var c=n;if(console.log("选中的货架索引:",c),Array.isArray(this.shelves)&&this.shelves.length>0&&c>=0&&c<this.shelves.length){var l=this.shelves[c];console.log("选中的货架对象:",l),this.selectedSheId=l.id,null!==l&&void 0!==l&&l.id?(console.log("开始获取货位数据货架ID:",l.id),this.fetchLocations(l.id).then((function(e){console.log("获取到货位数据:",e),Array.isArray(e)&&e.length>0?(t.columns[2]=e.map((function(e){return e.code||"未知货位"})),console.log("更新后的货位列:",t.columns[2]),t.$nextTick((function(){t.$refs.uPicker&&(console.log("更新货位选择器UI"),t.$refs.uPicker.setColumnValues(2,t.columns[2]))}))):(console.warn("获取到的货位数据为空"),t.columns[2]=["暂无货位"],t.$nextTick((function(){t.$refs.uPicker&&t.$refs.uPicker.setColumnValues(2,t.columns[2])})))})).catch((function(e){console.error("获取货位数据失败:",e),t.columns[2]=["获取失败"],t.$nextTick((function(){t.$refs.uPicker&&t.$refs.uPicker.setColumnValues(2,t.columns[2])}))}))):console.warn("货架ID无效")}else{var u;console.warn("无效的货架索引或数据未准备好",{shelfIndex:c,shelvesLength:null===(u=this.shelves)||void 0===u?void 0:u.length}),this.columns[2]=["请先选择有效货架"],this.$nextTick((function(){t.$refs.uPicker&&t.$refs.uPicker.setColumnValues(2,t.columns[2])}))}}}else console.warn("changeHandler: 事件对象为空")})),(0,h.default)(r,"confirm",(function(e){var t=e.value,o=(0,i.default)(t,3),n=o[0],a=o[1],r=o[2];this.warehouse=n,this.shelf=a,this.location=r,this.selectedStorage="".concat(n," / ").concat(a," / ").concat(r),this.show=!1;var s=this.shelves.find((function(e){return e.code===a})),c=this.locations.find((function(e){return e.code===r}));this.selectedSheId=null===s||void 0===s?void 0:s.id,this.selectedFreId=null===c||void 0===c?void 0:c.id,console.log("已选择:",{warehouse:this.warehouse,shelf:this.shelf,location:this.location,selectedSheId:this.selectedSheId,selectedFreId:this.selectedFreId})})),r),fetchWarehouses:function(t){var o=this;return(0,l.default)(s.default.mark((function n(){var a,r,c,l,u;return s.default.wrap((function(n){while(1)switch(n.prev=n.next){case 0:return n.prev=0,console.log("开始获取仓库列表,手机号:",t),n.next=4,e.request({url:"https://api.buzhiyushu.cn/shelves/shelves/namelist",method:"GET",data:{phone:t}});case 4:if(a=n.sent,r=(0,i.default)(a,2),c=r[0],l=r[1],!c){n.next=11;break}return console.error("请求发生错误:",c),n.abrupt("return",[]);case 11:if(console.log("API响应完整数据:",l),l&&l.data){n.next=15;break}return console.error("响应数据为空"),n.abrupt("return",[]);case 15:if(console.log("响应数据:",l.data),l.data.rows){n.next=19;break}return console.error("rows数据为空"),n.abrupt("return",[]);case 19:return u=l.data.rows||[],console.log("解析后的仓库数据:",u),o.columns[0]=u.map((function(e){return e.code||"未命名仓库"})),console.log("更新后的仓库列表:",o.columns[0]),n.abrupt("return",u);case 26:return n.prev=26,n.t0=n["catch"](0),console.error("获取仓库列表失败:",n.t0),n.abrupt("return",[]);case 30:case"end":return n.stop()}}),n,null,[[0,26]])})))()},getWarehouseId:function(e){var t=Object.values(this.warehouseShelvesData).flat(),o=t.find((function(t){return t.code===e}));return o?o.id:null},getShelfId:function(e){var t=Object.values(this.warehouseShelvesData).flat(),o=t.find((function(t){return t.code===e}));return o?o.id:null},close:function(){this.show=!1,console.log("弹窗已关闭")},open:function(){this.show=!0,console.log("弹窗已打开")},trigger:function(t){console.log(t),this.content[t.index].active=!t.item.active,e.showModal({title:"提示",content:"您".concat(this.content[t.index].active?"选中了":"取消了").concat(t.item.text),success:function(e){e.confirm?console.log("用户点击确定"):e.cancel&&console.log("用户点击取消")}})},fabClick:function(){e.showToast({title:"点击了悬浮按钮",icon:"none"})},switchBtn:function(e,t){0===e?(this.direction="horizontal"===this.direction?"vertical":"horizontal",this.directionStr="horizontal"===this.direction?"垂直":"水平"):(this.horizontal=e,this.vertical=t),this.$forceUpdate()},switchColor:function(){this.is_color_type=!this.is_color_type,this.is_color_type?(this.pattern.iconColor="#aaa",this.pattern.buttonColor="#fff"):(this.pattern.iconColor="#fff",this.pattern.buttonColor="#007AFF")}};t.default=w}).call(this,o("df3c")["default"])},f3b0:function(e,t,o){"use strict";o.r(t);var n=o("61b7"),a=o("0f3c");for(var r in a)["default"].indexOf(r)<0&&function(e){o.d(t,e,(function(){return a[e]}))}(r);o("9b39");var s=o("828b"),i=Object(s["a"])(a["default"],n["b"],n["c"],!1,null,"6ec1c7ea",null,!1,n["a"],void 0);t["default"]=i.exports},f748:function(e,t,o){}},[["42cb","common/runtime","common/vendor"]]]);