1 line
16 KiB
JavaScript
1 line
16 KiB
JavaScript
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["pages-mall-mall"],{"22f2":function(t,e,i){"use strict";i.d(e,"b",(function(){return s})),i.d(e,"c",(function(){return o})),i.d(e,"a",(function(){return a}));var a={uniIcons:i("f01b").default},s=function(){var t=this,e=t.$createElement,i=t._self._c||e;return i("v-uni-view",{staticClass:"container"},[i("v-uni-view",{staticClass:"filter-bar"},[i("v-uni-view",{staticClass:"filter-item",on:{click:function(e){arguments[0]=e=t.$handleEvent(e),t.showSortMenu("default")}}},[i("v-uni-text",{staticClass:"filter-text",class:{active:"default"===t.sortType}},[t._v("默认")]),i("uni-icons",{attrs:{type:"arrowdown",size:"12",color:"#999"}})],1),i("v-uni-view",{staticClass:"filter-item",on:{click:function(e){arguments[0]=e=t.$handleEvent(e),t.showSortMenu("price")}}},[i("v-uni-text",{staticClass:"filter-text",class:{active:"price"===t.sortType}},[t._v("价格")]),i("uni-icons",{attrs:{type:"arrowdown",size:"12",color:"#999"}})],1),i("v-uni-view",{staticClass:"filter-item",on:{click:function(e){arguments[0]=e=t.$handleEvent(e),t.showSortMenu("quantity")}}},[i("v-uni-text",{staticClass:"filter-text",class:{active:"quantity"===t.sortType}},[t._v("库存")]),i("uni-icons",{attrs:{type:"arrowdown",size:"12",color:"#999"}})],1),i("v-uni-view",{staticClass:"filter-item",on:{click:function(e){arguments[0]=e=t.$handleEvent(e),t.showAddressFilter.apply(void 0,arguments)}}},[i("v-uni-text",{staticClass:"filter-text",class:{active:t.selectedRegion}},[t._v(t._s(t.selectedRegion||"地区"))]),i("uni-icons",{attrs:{type:"location",size:"12",color:"#999"}})],1),i("v-uni-view",{staticClass:"filter-item",on:{click:function(e){arguments[0]=e=t.$handleEvent(e),t.resetAllFilters.apply(void 0,arguments)}}},[i("v-uni-text",{staticClass:"filter-text"},[t._v("重置")]),i("uni-icons",{attrs:{type:"reload",size:"12",color:"#999"}})],1),i("v-uni-view",{staticClass:"filter-item",on:{click:function(e){arguments[0]=e=t.$handleEvent(e),t.showFilterPanel.apply(void 0,arguments)}}},[i("uni-icons",{attrs:{type:"bars",size:"16",color:"#999"}})],1)],1),i("v-uni-view",{staticClass:"product-list"},t._l(t.productList,(function(e,a){return i("v-uni-view",{key:a,staticClass:"product-item",class:{disabled:!e.can_purchase},on:{click:function(i){arguments[0]=i=t.$handleEvent(i),t.goToDetail(e)}}},[i("v-uni-view",{staticClass:"product-image-container"},[e.product_images?i("v-uni-image",{class:["product-image",{"image-disabled":!e.can_purchase}],attrs:{src:t.getFullImageUrl(t.getFirstImage(e.product_images)),mode:"aspectFill"}}):i("v-uni-view",{staticClass:"default-image"},[i("uni-icons",{attrs:{type:"image",size:"40",color:"#ccc"}})],1),e.can_purchase?t._e():i("v-uni-view",{staticClass:"purchase-limit-overlay"})],1),i("v-uni-view",{staticClass:"product-info"},[i("v-uni-text",{staticClass:"product-title",class:{"text-disabled":!e.can_purchase}},[t._v(t._s(e.product_name))]),i("v-uni-view",{staticClass:"product-stats"},[i("v-uni-text",{staticClass:"stats-text"},[t._v("销量 "+t._s(e.sales_count||0))]),i("v-uni-text",{staticClass:"stats-text"},[t._v("库存 "+t._s(e.quantity||0))])],1),i("v-uni-view",{staticClass:"product-price"},[i("v-uni-text",{staticClass:"current-price",class:{"price-disabled":!e.can_purchase}},[t._v("¥"+t._s(e.selling_price||e.current_price))])],1),e.seller?i("v-uni-view",{staticClass:"seller-info"},[i("v-uni-text",{staticClass:"seller-text",class:{"text-disabled":!e.can_purchase}},[t._v("卖家:"+t._s(e.seller.real_name||e.seller.phone))])],1):t._e()],1)],1)})),1),t.hasMore?i("v-uni-view",{staticClass:"load-more"},[i("v-uni-text",[t._v("加载更多...")])],1):t.productList.length>0?i("v-uni-view",{staticClass:"no-more"},[i("v-uni-text",[t._v("没有更多了")])],1):t._e(),t.showAddressModal?i("v-uni-view",{staticClass:"address-modal",on:{click:function(e){arguments[0]=e=t.$handleEvent(e),t.hideAddressFilter.apply(void 0,arguments)}}},[i("v-uni-view",{staticClass:"modal-content",on:{click:function(e){e.stopPropagation(),arguments[0]=e=t.$handleEvent(e)}}},[i("v-uni-view",{staticClass:"modal-header"},[i("v-uni-text",{staticClass:"modal-title"},[t._v("选择地区")]),i("v-uni-text",{staticClass:"modal-close",on:{click:function(e){arguments[0]=e=t.$handleEvent(e),t.hideAddressFilter.apply(void 0,arguments)}}},[t._v("×")])],1),i("v-uni-view",{staticClass:"modal-body"},[i("v-uni-view",{staticClass:"region-options"},[i("v-uni-view",{staticClass:"k-region-container"},[i("Region",{attrs:{width:300,height:92,showAllDistrict:!0,isRevise:!1},on:{region:function(e){arguments[0]=e=t.$handleEvent(e),t.onRegionChange.apply(void 0,arguments)}}})],1)],1),i("v-uni-view",{staticClass:"filter-actions"},[i("v-uni-button",{staticClass:"reset-btn",on:{click:function(e){arguments[0]=e=t.$handleEvent(e),t.resetRegionFilter.apply(void 0,arguments)}}},[t._v("重置")]),i("v-uni-button",{staticClass:"confirm-btn",on:{click:function(e){arguments[0]=e=t.$handleEvent(e),t.confirmRegionFilter.apply(void 0,arguments)}}},[t._v("确定")])],1)],1)],1)],1):t._e()],1)},o=[]},"27ae":function(t,e,i){var a=i("f9bd");a.__esModule&&(a=a.default),"string"===typeof a&&(a=[[t.i,a,""]]),a.locals&&(t.exports=a.locals);var s=i("967d").default;s("7c34d847",a,!0,{sourceMap:!1,shadowMode:!1})},"30f7":function(t,e,i){"use strict";i("6a54"),Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")},i("7a76"),i("c9b5")},47333:function(t,e,i){"use strict";i("6a54"),Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(t){if(Array.isArray(t))return(0,a.default)(t)};var a=function(t){return t&&t.__esModule?t:{default:t}}(i("8d0b"))},"5f04":function(t,e,i){"use strict";i.r(e);var a=i("22f2"),s=i("b706");for(var o in s)["default"].indexOf(o)<0&&function(t){i.d(e,t,(function(){return s[t]}))}(o);i("92e6");var n=i("828b"),r=Object(n["a"])(s["default"],a["b"],a["c"],!1,null,"11a1dfd4",null,!1,a["a"],void 0);e["default"]=r.exports},"92e6":function(t,e,i){"use strict";var a=i("27ae"),s=i.n(a);s.a},b706:function(t,e,i){"use strict";i.r(e);var a=i("d307"),s=i.n(a);for(var o in a)["default"].indexOf(o)<0&&function(t){i.d(e,t,(function(){return a[t]}))}(o);e["default"]=s.a},b7c7:function(t,e,i){"use strict";i("6a54"),Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(t){return(0,a.default)(t)||(0,s.default)(t)||(0,o.default)(t)||(0,n.default)()};var a=r(i("47333")),s=r(i("d14d")),o=r(i("5d6b")),n=r(i("30f7"));function r(t){return t&&t.__esModule?t:{default:t}}},d14d:function(t,e,i){"use strict";i("6a54"),Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(t){if("undefined"!==typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)},i("01a2"),i("e39c"),i("bf0f"),i("844d"),i("18f7"),i("de6c"),i("08eb")},d307:function(t,e,i){"use strict";i("6a54");var a=i("f5bd").default;Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var s=a(i("2634")),o=a(i("b7c7")),n=a(i("2fdc"));i("c223"),i("0c26");var r=a(i("95a3")),c=a(i("e4ec")),d={components:{Region:c.default},data:function(){return{productList:[],sortType:"default",currentPage:1,pageSize:10,hasMore:!0,loading:!1,categoryId:"",showAddressModal:!1,selectedProvince:"",selectedCity:"",selectedDistrict:"",tempProvince:"",tempCity:"",tempDistrict:"",showAllDistrict:!1}},onPullDownRefresh:function(){var t=this;uni.getStorage({key:"categoryId",success:function(e){t.categoryId=e.data,t.currentPage=1,t.loadProducts(),uni.setStorage({key:"categoryId",data:0,success:function(){}})},fail:function(){t.loadProducts()}})},computed:{selectedRegion:function(){return this.selectedProvince&&this.selectedCity?this.selectedDistrict?"".concat(this.selectedProvince," ").concat(this.selectedCity," ").concat(this.selectedDistrict):"".concat(this.selectedProvince," ").concat(this.selectedCity," 全部区"):""},regionText:function(){return this.tempProvince&&this.tempCity?this.tempDistrict?"".concat(this.tempProvince," ").concat(this.tempCity," ").concat(this.tempDistrict):this.showAllDistrict?"".concat(this.tempProvince," ").concat(this.tempCity," 全部区"):"".concat(this.tempProvince," ").concat(this.tempCity):""}},onShow:function(){var t=uni.getStorageSync("token");if(t){var e=this;e.currentPage=1,uni.getStorage({key:"categoryId",success:function(t){e.categoryId=t.data,e.loadProducts(),uni.setStorage({key:"categoryId",data:0,success:function(){}})},fail:function(){e.loadProducts()}})}else uni.reLaunch({url:"/pages/login/login"})},onLoad:function(t){},onReachBottom:function(){this.hasMore&&!this.loading&&this.loadMore()},methods:{getFullImageUrl:function(t){return r.default.getImageUrl(t)},getFirstImage:function(t){return t?"string"===typeof t?t.split(",")[0].trim():Array.isArray(t)&&t.length>0?t[0]:"":""},loadProducts:function(){var t=this;return(0,n.default)((0,s.default)().mark((function e(){var i,a,n;return(0,s.default)().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return t.loading=!0,e.prev=1,i={page:t.currentPage,page_size:t.pageSize,sort:t.sortType},t.categoryId&&(i.category_id=t.categoryId),t.selectedProvince&&(i.province=t.selectedProvince),t.selectedCity&&(i.city=t.selectedCity),t.selectedDistrict&&(i.district=t.selectedDistrict),e.next=9,r.default.get("/back/user/products/secondary",i);case 9:a=e.sent,a.success&&(n=a.data,1===t.currentPage?t.productList=n.list||[]:t.productList=[].concat((0,o.default)(t.productList),(0,o.default)(n.list||[])),t.hasMore=t.productList.length<n.total),e.next=17;break;case 13:e.prev=13,e.t0=e["catch"](1),console.error("加载商品失败:",e.t0),uni.showToast({title:"加载失败",icon:"none"});case 17:return e.prev=17,t.loading=!1,e.finish(17);case 20:case"end":return e.stop()}}),e,null,[[1,13,17,20]])})))()},loadMore:function(){this.currentPage++,this.loadProducts()},showSortMenu:function(t){this.sortType=t,this.currentPage=1,this.loadProducts()},showFilterPanel:function(){var t=this;uni.showActionSheet({itemList:["价格升序","价格降序","销量排序","库存排序"],success:function(e){t.sortType=["price_asc","price_desc","sales","quantity"][e.tapIndex],t.currentPage=1,t.loadProducts()}})},goToDetail:function(t){t.can_purchase?uni.navigateTo({url:"/pages/product/detail?id=".concat(t.id,"&type=secondary")}):uni.showToast({title:t.purchase_limit_message||"暂时无法购买",icon:"none",duration:2e3})},showAddressFilter:function(){this.showAddressModal=!0,this.tempProvince=this.selectedProvince,this.tempCity=this.selectedCity,this.tempDistrict=this.selectedDistrict,this.showAllDistrict=this.selectedProvince&&this.selectedCity&&!this.selectedDistrict},hideAddressFilter:function(){this.showAddressModal=!1},onRegionChange:function(t){console.log("选择的地区:",t),this.tempProvince=t[0]||"",this.tempCity=t[1]||"",this.tempDistrict=t[2]||"",this.showAllDistrict=this.tempProvince&&this.tempCity&&!this.tempDistrict},resetRegionFilter:function(){this.tempProvince="",this.tempCity="",this.tempDistrict="",this.showAllDistrict=!1,this.selectedProvince="",this.selectedCity="",this.selectedDistrict="",this.currentPage=1,this.loadProducts(),this.hideAddressFilter()},confirmRegionFilter:function(){this.selectedProvince=this.tempProvince,this.selectedCity=this.tempCity,this.selectedDistrict=this.showAllDistrict?"":this.tempDistrict,this.currentPage=1,this.loadProducts(),this.hideAddressFilter()},selectAllRegion:function(){this.tempProvince="",this.tempCity="",this.tempDistrict="",this.showAllDistrict=!1},selectAllDistrict:function(){this.tempDistrict="",this.showAllDistrict=!0},resetAllFilters:function(){var t=this;uni.showModal({title:"提示",content:"确定要重置所有筛选条件吗?",success:function(e){e.confirm&&(t.sortType="default",t.selectedProvince="",t.selectedCity="",t.selectedDistrict="",t.tempProvince="",t.tempCity="",t.tempDistrict="",t.showAllDistrict=!1,t.categoryId="",t.currentPage=1,t.loadProducts(),uni.showToast({title:"已重置",icon:"success"}))}})}}};e.default=d},f9bd:function(t,e,i){var a=i("c86c");e=a(!1),e.push([t.i,".container[data-v-11a1dfd4]{background-color:#f5f5f5;min-height:100vh}\n\n/* 筛选栏样式 */.filter-bar[data-v-11a1dfd4]{background-color:#fff;display:flex;padding:%?20?% %?30?%;border-bottom:%?1?% solid #eee}.filter-item[data-v-11a1dfd4]{flex:1;display:flex;align-items:center;justify-content:center}.filter-text[data-v-11a1dfd4]{font-size:%?28?%;color:#333;margin-right:%?10?%}.filter-text.active[data-v-11a1dfd4]{color:#f44}\n\n/* 商品列表样式 */.product-list[data-v-11a1dfd4]{padding:%?20?%;display:flex;flex-wrap:wrap;justify-content:space-between}.product-item[data-v-11a1dfd4]{background-color:#fff;border-radius:%?12?%;margin-bottom:%?20?%;overflow:hidden;box-shadow:0 %?2?% %?8?% rgba(0,0,0,.1);width:48%}.product-item.disabled[data-v-11a1dfd4]{opacity:.6;background-color:#f5f5f5}.product-image-container[data-v-11a1dfd4]{width:100%;height:%?200?%;position:relative}.product-image[data-v-11a1dfd4]{width:100%;height:100%}.product-image.image-disabled[data-v-11a1dfd4]{-webkit-filter:grayscale(100%);filter:grayscale(100%);opacity:.5}.purchase-limit-overlay[data-v-11a1dfd4]{position:absolute;top:0;left:0;right:0;bottom:0;background-color:rgba(0,0,0,.5);display:flex;align-items:center;justify-content:center;z-index:10}.limit-text[data-v-11a1dfd4]{color:#fff;font-size:%?24?%;text-align:center;padding:%?10?% %?20?%;background-color:rgba(0,0,0,.6);border-radius:%?8?%}.default-image[data-v-11a1dfd4]{width:100%;height:100%;display:flex;align-items:center;justify-content:center;background-color:#f0f0f0}.product-info[data-v-11a1dfd4]{padding:%?20?%}.product-title[data-v-11a1dfd4]{display:block;font-size:%?26?%;font-weight:700;color:#333;margin-bottom:%?8?%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.product-title.text-disabled[data-v-11a1dfd4]{color:#999}.product-stats[data-v-11a1dfd4]{display:flex;margin-bottom:%?10?%;justify-content:space-between}.stats-text[data-v-11a1dfd4]{font-size:%?20?%;color:#999}.product-price[data-v-11a1dfd4]{display:flex;align-items:center;margin-bottom:%?8?%}.current-price[data-v-11a1dfd4]{font-size:%?28?%;font-weight:700;color:#f44}.current-price.price-disabled[data-v-11a1dfd4]{color:#999}.original-price[data-v-11a1dfd4]{font-size:%?20?%;color:#999;text-decoration:line-through;margin-left:%?10?%}.seller-info[data-v-11a1dfd4]{margin-top:%?8?%;padding-top:%?8?%;border-top:%?1?% solid #f0f0f0}.seller-text[data-v-11a1dfd4]{font-size:%?20?%;color:#666;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.seller-text.text-disabled[data-v-11a1dfd4]{color:#999}\n\n/* 加载更多样式 */.load-more[data-v-11a1dfd4], .no-more[data-v-11a1dfd4]{text-align:center;padding:%?40?%;color:#999;font-size:%?24?%}\n\n/* 地址筛选弹窗样式 */.address-modal[data-v-11a1dfd4]{position:fixed;top:0;left:0;right:0;bottom:0;background-color:rgba(0,0,0,.5);z-index:999;display:flex;align-items:center;justify-content:center}.modal-content[data-v-11a1dfd4]{background-color:#fff;border-radius:%?20?%;width:%?600?%;max-height:80vh;overflow:hidden}.modal-header[data-v-11a1dfd4]{display:flex;align-items:center;justify-content:space-between;padding:%?30?%;border-bottom:%?1?% solid #eee}.modal-title[data-v-11a1dfd4]{font-size:%?32?%;font-weight:700;color:#333}.modal-close[data-v-11a1dfd4]{font-size:%?40?%;color:#999;width:%?40?%;height:%?40?%;display:flex;align-items:center;justify-content:center}.modal-body[data-v-11a1dfd4]{padding:%?30?%}.region-options[data-v-11a1dfd4]{margin-bottom:%?30?%}.region-option[data-v-11a1dfd4]{display:flex;align-items:center;justify-content:space-between;padding:%?30?% %?20?%;background-color:#f8f8f8;border-radius:%?12?%;margin-bottom:%?20?%}.region-option.active[data-v-11a1dfd4]{background-color:#e3f2fd;border:%?2?% solid #2196f3}.option-text[data-v-11a1dfd4]{font-size:%?28?%;color:#333}.option-check[data-v-11a1dfd4]{font-size:%?28?%;color:#2196f3;font-weight:700}.region-picker[data-v-11a1dfd4]{display:flex;align-items:center;justify-content:space-between;padding:%?30?% %?20?%;background-color:#f8f8f8;border-radius:%?12?%}.k-region-container[data-v-11a1dfd4]{background-color:#f8f8f8;border-radius:%?12?%;padding:%?20?%;margin-bottom:%?20?%}.region-text[data-v-11a1dfd4]{font-size:%?28?%;color:#333}.region-placeholder[data-v-11a1dfd4]{font-size:%?28?%;color:#999}.filter-actions[data-v-11a1dfd4]{display:flex;gap:%?20?%}.reset-btn[data-v-11a1dfd4], .confirm-btn[data-v-11a1dfd4]{flex:1;height:%?80?%;border-radius:%?40?%;font-size:%?28?%;border:none;display:flex;align-items:center;justify-content:center}.reset-btn[data-v-11a1dfd4]{background-color:#f5f5f5;color:#666}.confirm-btn[data-v-11a1dfd4]{background:linear-gradient(135deg,#f44,#f66);color:#fff}",""]),t.exports=e}}]); |