1 |
- import{q as s,u as e,T as o,o as a,c as t,w as l,n as i,i as c,a as n,k as r,f as d,b as p,d as u,F as h,r as _,l as f,y as m,t as g,e as w,g as y}from"./index-3b24b149.js";import{M as S,_ as k}from"./mescroll-mixins.57cfe76c.js";import{r as T}from"./uni-app.es.9206f90a.js";import{l as v}from"./index.5656217b.js";import{S as V}from"./index.5f0ebd57.js";import{_ as x}from"./_plugin-vue_export-helper.1b428a4d.js";const C=x({components:{Search:V},mixins:[S],data:()=>({showView:!1,sortType:"all",sortPrice:!1,options:{},list:s(),upOption:{auto:!0,page:{size:15},noMoreSize:4}}),onLoad(s){this.options=s,this.setShowView()},methods:{upCallback(s){const e=this;e.getGoodsList(s.num).then((s=>{const o=s.data.length,a=s.data.total;e.mescroll.endBySize(o,a)})).catch((()=>e.mescroll.endErr()))},setShowView(){this.showView=uni.getStorageSync("GoodsList-ShowView")||!1},getGoodsList(s=1){const o=this;console.log(o.options);const a={sortType:o.sortType,sortPrice:Number(o.sortPrice),categoryId:o.options.categoryId||0,goodsName:o.options.search||"",page:s};return new Promise(((t,l)=>{v(a).then((a=>{const l=a.data.list;o.list.data=e(l,o.list,s),t(l)})).catch(l)}))},handleSortType(e){const o=this,a="price"!==e||!o.sortPrice;o.sortType=e,o.sortPrice=a,o.list=s(),o.mescroll.resetUpScroll()},handleShowView(){const s=this;s.showView=!s.showView,uni.setStorageSync("GoodsList-ShowView",s.showView)},onTargetDetail(s){this.$navTo("pages/goods/detail",{goodsId:s})},handleSearch(){const s="pages/search/index";let e=o();e.length>1&&e[e.length-2].route===s?uni.navigateBack():this.$navTo(s)}},onShareAppMessage(){return{title:"商品列表",path:"/pages/goods/list?"+this.$getShareUrlParams(this.options)}},onShareTimeline(){return{title:"商品列表",path:"/pages/goods/list?"+this.$getShareUrlParams(this.options)}}},[["render",function(s,e,o,S,v,V){const x=_("search"),C=c,P=f,I=y,b=T(m("mescroll-body"),k);return a(),t(C,{class:"container",style:i(s.appThemeStyle)},{default:l((()=>[n(b,{ref:"mescrollRef",sticky:!0,onInit:s.mescrollInit,down:{native:!0},onDown:s.downCallback,up:v.upOption,onUp:V.upCallback},{default:l((()=>[n(C,{class:"header"},{default:l((()=>[n(C,{class:"search"},{default:l((()=>[n(x,{tips:v.options.search?v.options.search:"搜索商品",onEvent:V.handleSearch},null,8,["tips","onEvent"])])),_:1}),n(C,{class:"show-view",onClick:V.handleShowView},{default:l((()=>[v.showView?(a(),t(P,{key:0,class:"iconfont icon-view-tile"})):(a(),t(P,{key:1,class:"iconfont icon-view-list"}))])),_:1},8,["onClick"])])),_:1}),n(C,{class:"store-sort"},{default:l((()=>[n(C,{class:r(["sort-item",{active:"all"===v.sortType}]),onClick:e[0]||(e[0]=s=>V.handleSortType("all"))},{default:l((()=>[n(P,null,{default:l((()=>[d("综合")])),_:1})])),_:1},8,["class"]),n(C,{class:r(["sort-item",{active:"sales"===v.sortType}]),onClick:e[1]||(e[1]=s=>V.handleSortType("sales"))},{default:l((()=>[n(P,null,{default:l((()=>[d("销量")])),_:1})])),_:1},8,["class"]),n(C,{class:r(["sort-item sort-item-price",{active:"price"===v.sortType}]),onClick:e[2]||(e[2]=s=>V.handleSortType("price"))},{default:l((()=>[n(P,null,{default:l((()=>[d("价格")])),_:1}),n(C,{class:"price-arrow"},{default:l((()=>[n(C,{class:r(["icon up",{active:"price"===v.sortType&&!v.sortPrice}])},{default:l((()=>[n(P,{class:"iconfont icon-arrow-up"})])),_:1},8,["class"]),n(C,{class:r(["icon down",{active:"price"===v.sortType&&v.sortPrice}])},{default:l((()=>[n(P,{class:"iconfont icon-arrow-down"})])),_:1},8,["class"])])),_:1})])),_:1},8,["class"])])),_:1}),n(C,{class:r(["goods-list clearfix",["column-"+(v.showView?"1":"2")]])},{default:l((()=>[(a(!0),p(h,null,u(v.list.data,((s,e)=>(a(),t(C,{class:"goods-item",key:e,onClick:e=>V.onTargetDetail(s.goods_id)},{default:l((()=>[v.showView?(a(),t(C,{key:0,class:"dis-flex"},{default:l((()=>[n(C,{class:"goods-item-left"},{default:l((()=>[n(I,{class:"image",src:s.goods_image},null,8,["src"])])),_:2},1024),n(C,{class:"goods-item-right"},{default:l((()=>[n(C,{class:"goods-name"},{default:l((()=>[n(P,{class:"twoline-hide"},{default:l((()=>[d(g(s.goods_name),1)])),_:2},1024)])),_:2},1024),n(C,{class:"goods-item-desc"},{default:l((()=>[n(C,{class:"desc-selling-point dis-flex"},{default:l((()=>[n(P,{class:"oneline-hide"},{default:l((()=>[d(g(s.selling_point),1)])),_:2},1024)])),_:2},1024),n(C,{class:"desc-goods-sales dis-flex"},{default:l((()=>[n(P,null,{default:l((()=>[d("已售"+g(s.goods_sales)+"件",1)])),_:2},1024)])),_:2},1024),n(C,{class:"desc-footer"},{default:l((()=>[n(P,{class:"price-x"},{default:l((()=>[d("¥"+g(s.goods_price_min),1)])),_:2},1024),s.line_price_min>0?(a(),t(P,{key:0,class:"price-y col-9"},{default:l((()=>[d("¥"+g(s.line_price_min),1)])),_:2},1024)):w("",!0)])),_:2},1024)])),_:2},1024)])),_:2},1024)])),_:2},1024)):(a(),t(C,{key:1,class:""},{default:l((()=>[n(C,{class:"goods-image"},{default:l((()=>[n(I,{class:"image",mode:"aspectFill",src:s.goods_image},null,8,["src"])])),_:2},1024),n(C,{class:"detail"},{default:l((()=>[n(C,{class:"goods-name"},{default:l((()=>[n(P,{class:"twoline-hide"},{default:l((()=>[d(g(s.goods_name),1)])),_:2},1024)])),_:2},1024),n(C,{class:"detail-price oneline-hide"},{default:l((()=>[n(P,{class:"goods-price f-30 col-m"},{default:l((()=>[d("¥"+g(s.goods_price_min),1)])),_:2},1024),s.line_price_min>0?(a(),t(P,{key:0,class:"line-price col-9 f-24"},{default:l((()=>[d("¥"+g(s.line_price_min),1)])),_:2},1024)):w("",!0)])),_:2},1024)])),_:2},1024)])),_:2},1024))])),_:2},1032,["onClick"])))),128))])),_:1},8,["class"])])),_:1},8,["onInit","onDown","up","onUp"])])),_:1},8,["style"])}],["__scopeId","data-v-53b52da1"]]);export{C as default};
|