pages-goods-list.CVv9laL7.js 5.5 KB

1
  1. import{m as s,p as e,Q as o,r as a,q as t,c as l,w as i,n as c,i as n,o as r,a as d,k as p,f as u,b as h,d as _,F as f,l as m,t as g,e as w,g as y}from"./index-DVbFeFXr.js";import{M as S,_ as k}from"./mescroll-mixins.C_RnujM5.js";import{r as T}from"./uni-app.es.BZZrcWfv.js";import{l as v}from"./index.DJMsJV-b.js";import{S as V}from"./index.4cn5tZIm.js";import{_ as x}from"./_plugin-vue_export-helper.BCo6x5W8.js";const P=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.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=a("search"),P=n,C=m,b=y,I=T(t("mescroll-body"),k);return r(),l(P,{class:"container",style:c(s.appThemeStyle)},{default:i((()=>[d(I,{ref:"mescrollRef",sticky:!0,onInit:s.mescrollInit,down:{native:!0},onDown:s.downCallback,up:v.upOption,onUp:V.upCallback},{default:i((()=>[d(P,{class:"header"},{default:i((()=>[d(P,{class:"search"},{default:i((()=>[d(x,{tips:v.options.search?v.options.search:"搜索商品",onEvent:V.handleSearch},null,8,["tips","onEvent"])])),_:1}),d(P,{class:"show-view",onClick:V.handleShowView},{default:i((()=>[v.showView?(r(),l(C,{key:0,class:"iconfont icon-view-tile"})):(r(),l(C,{key:1,class:"iconfont icon-view-list"}))])),_:1},8,["onClick"])])),_:1}),d(P,{class:"store-sort"},{default:i((()=>[d(P,{class:p(["sort-item",{active:"all"===v.sortType}]),onClick:e[0]||(e[0]=s=>V.handleSortType("all"))},{default:i((()=>[d(C,null,{default:i((()=>[u("综合")])),_:1})])),_:1},8,["class"]),d(P,{class:p(["sort-item",{active:"sales"===v.sortType}]),onClick:e[1]||(e[1]=s=>V.handleSortType("sales"))},{default:i((()=>[d(C,null,{default:i((()=>[u("销量")])),_:1})])),_:1},8,["class"]),d(P,{class:p(["sort-item sort-item-price",{active:"price"===v.sortType}]),onClick:e[2]||(e[2]=s=>V.handleSortType("price"))},{default:i((()=>[d(C,null,{default:i((()=>[u("价格")])),_:1}),d(P,{class:"price-arrow"},{default:i((()=>[d(P,{class:p(["icon up",{active:"price"===v.sortType&&!v.sortPrice}])},{default:i((()=>[d(C,{class:"iconfont icon-arrow-up"})])),_:1},8,["class"]),d(P,{class:p(["icon down",{active:"price"===v.sortType&&v.sortPrice}])},{default:i((()=>[d(C,{class:"iconfont icon-arrow-down"})])),_:1},8,["class"])])),_:1})])),_:1},8,["class"])])),_:1}),d(P,{class:p(["goods-list clearfix",["column-"+(v.showView?"1":"2")]])},{default:i((()=>[(r(!0),h(f,null,_(v.list.data,((s,e)=>(r(),l(P,{class:"goods-item",key:e,onClick:e=>V.onTargetDetail(s.goods_id)},{default:i((()=>[v.showView?(r(),l(P,{key:0,class:"dis-flex"},{default:i((()=>[d(P,{class:"goods-item-left"},{default:i((()=>[d(b,{class:"image",src:s.goods_image},null,8,["src"])])),_:2},1024),d(P,{class:"goods-item-right"},{default:i((()=>[d(P,{class:"goods-name"},{default:i((()=>[d(C,{class:"twoline-hide"},{default:i((()=>[u(g(s.goods_name),1)])),_:2},1024)])),_:2},1024),d(P,{class:"goods-item-desc"},{default:i((()=>[d(P,{class:"desc-selling-point dis-flex"},{default:i((()=>[d(C,{class:"oneline-hide"},{default:i((()=>[u(g(s.selling_point),1)])),_:2},1024)])),_:2},1024),d(P,{class:"desc-goods-sales dis-flex"},{default:i((()=>[d(C,null,{default:i((()=>[u("已售"+g(s.goods_sales)+"件",1)])),_:2},1024)])),_:2},1024),d(P,{class:"desc-footer"},{default:i((()=>[d(C,{class:"price-x"},{default:i((()=>[u("¥"+g(s.goods_price_min),1)])),_:2},1024),s.line_price_min>0?(r(),l(C,{key:0,class:"price-y col-9"},{default:i((()=>[u("¥"+g(s.line_price_min),1)])),_:2},1024)):w("",!0)])),_:2},1024)])),_:2},1024)])),_:2},1024)])),_:2},1024)):(r(),l(P,{key:1,class:""},{default:i((()=>[d(P,{class:"goods-image"},{default:i((()=>[d(b,{class:"image",mode:"aspectFill",src:s.goods_image},null,8,["src"])])),_:2},1024),d(P,{class:"detail"},{default:i((()=>[d(P,{class:"goods-name"},{default:i((()=>[d(C,{class:"twoline-hide"},{default:i((()=>[u(g(s.goods_name),1)])),_:2},1024)])),_:2},1024),d(P,{class:"detail-price oneline-hide"},{default:i((()=>[d(C,{class:"goods-price f-30 col-m"},{default:i((()=>[u("¥"+g(s.goods_price_min),1)])),_:2},1024),s.line_price_min>0?(r(),l(C,{key:0,class:"line-price col-9 f-24"},{default:i((()=>[u("¥"+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-ba8baf00"]]);export{P as default};