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.
2 lines
5.6 KiB
2 lines
5.6 KiB
11 months ago
|
import{q as s,u as e,T as a,o,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 f,l as _,y as m,t as g,e as w,g as y}from"./index-4ddb689d.js";import{M as S,_ as k}from"./mescroll-mixins.a7931123.js";import{r as T}from"./uni-app.es.24af5d4f.js";import{W as v}from"./wxofficial.956096a5.js";import{l as x}from"./index.85d62ccb.js";import{S as V}from"./index.c375f920.js";import{_ as C}from"./_plugin-vue_export-helper.1b428a4d.js";const P=C({components:{Search:V},mixins:[S,v],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)=>{x(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,v,x){const V=f("search"),C=c,P=_,b=y,j=T(m("mescroll-body"),k);return o(),t(C,{class:"container",style:i(s.appThemeStyle)},{default:l((()=>[n(j,{ref:"mescrollRef",sticky:!0,onInit:s.mescrollInit,down:{native:!0},onDown:s.downCallback,up:v.upOption,onUp:x.upCallback},{default:l((()=>[n(C,{class:"header"},{default:l((()=>[n(C,{class:"search"},{default:l((()=>[n(V,{tips:v.options.search?v.options.search:"搜索商品",onEvent:x.handleSearch},null,8,["tips","onEvent"])])),_:1}),n(C,{class:"show-view",onClick:x.handleShowView},{default:l((()=>[v.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"===v.sortType}]),onClick:e[0]||(e[0]=s=>x.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=>x.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=>x.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((()=>[(o(!0),p(h,null,u(v.list.data,((s,e)=>(o(),t(C,{class:"goods-item",key:e,onClick:e=>x.onTargetDetail(s.goods_id)},{default:l((()=>[v.showView?(o(),t(C,{key:0,class:"dis-flex"},{default:l((()=>[n(C,{class:"goods-item-left"},{default:l((()=>[n(b,{class:"image",src:s.goods_image},null,8,["src"])])),_:2},1024),n(C,{class:"goods-item-righ
|