You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1 lines
5.6 KiB
1 lines
5.6 KiB
import{p as s,q as e,U as a,o,c as t,w as l,n as i,i as c,a as n,j as r,f as d,b as p,d as h,F as u,r as f,k as _,x as m,t as g,e as w,g as y}from"./index-ae8bbb19.js";import{M as S,_ as k}from"./mescroll-mixins.7cda1bf3.js";import{r as T}from"./uni-app.es.ee1d5b08.js";import{W as x}from"./wxofficial.cfa745b7.js";import{l as v}from"./index.c0835ba6.js";import{S as V}from"./index.3e92a74e.js";import{_ as C}from"./_plugin-vue_export-helper.1b428a4d.js";const P=C({components:{Search:V},mixins:[S,x],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(),this.setWxofficialShareData()},methods:{upCallback(s){const e=this;e.getGoodsList(s.num).then((s=>{const a=s.data.length,o=s.data.total;e.mescroll.endBySize(a,o)})).catch((()=>e.mescroll.endErr()))},setShowView(){this.showView=uni.getStorageSync("GoodsList-ShowView")||!1},getGoodsList(s=1){const a=this;console.log(a.options);const o={sortType:a.sortType,sortPrice:Number(a.sortPrice),categoryId:a.options.categoryId||0,goodsName:a.options.search||"",page:s};return new Promise(((t,l)=>{v(o).then((o=>{const l=o.data.list;a.list.data=e(l,a.list,s),t(l)})).catch(l)}))},handleSortType(e){const a=this,o="price"!==e||!a.sortPrice;a.sortType=e,a.sortPrice=o,a.list=s(),a.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=a();e.length>1&&e[e.length-2].route===s?uni.navigateBack():this.$navTo(s)},setWxofficialShareData(){this.updateShareCardData({title:"商品列表"})}},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,a,S,x,v){const V=f("search"),C=c,P=_,j=y,b=T(m("mescroll-body"),k);return o(),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:x.upOption,onUp:v.upCallback},{default:l((()=>[n(C,{class:"header"},{default:l((()=>[n(C,{class:"search"},{default:l((()=>[n(V,{tips:x.options.search?x.options.search:"搜索商品",onEvent:v.handleSearch},null,8,["tips","onEvent"])])),_:1}),n(C,{class:"show-view",onClick:v.handleShowView},{default:l((()=>[x.showView?(o(),t(P,{key:0,class:"iconfont icon-view-tile"})):(o(),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"===x.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"===x.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"===x.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"===x.sortType&&!x.sortPrice}])},{default:l((()=>[n(P,{class:"iconfont icon-arrow-up"})])),_:1},8,["class"]),n(C,{class:r(["icon down",{active:"price"===x.sortType&&x.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-"+(x.showView?"1":"2")]])},{default:l((()=>[(o(!0),p(u,null,h(x.list.data,((s,e)=>(o(),t(C,{class:"goods-item",key:e,onClick:e=>v.onTargetDetail(s.goods_id)},{default:l((()=>[x.showView?(o(),t(C,{key:0,class:"dis-flex"},{default:l((()=>[n(C,{class:"goods-item-left"},{default:l((()=>[n(j,{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?(o(),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)):(o(),t(C,{key:1,class:""},{default:l((()=>[n(C,{class:"goods-image"},{default:l((()=>[n(j,{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?(o(),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-955e22fc"]]);export{P as default};
|
|
|