s-goods-column.2324341a.js 14 KB

1
  1. import{v as s,c as l,a0 as t,aD as e,e as o,f as a,w as i,y as d,u as r,j as c,s as n,g as u,p as g,t as p,a8 as f,Q as y,k as m,F as _,r as h,P as w,q as x,i as k,C as b,ah as v}from"./index-9880b451.js";import{e as F,a as S,f as P}from"./useGoods.bdd1c2ea.js";/* empty css */import{_ as C}from"./_plugin-vue_export-helper.1b428a4d.js";import"./s-layout.dfc5b0b5.js";import"./uni-load-more.aac4524a.js";/* empty css *//* empty css */const O=C({__name:"s-goods-column",props:{goodsFields:{type:[Array,Object],default:()=>({price:{show:!0},stock:{show:!0},name:{show:!0},introduction:{show:!0},marketPrice:{show:!0},salesCount:{show:!0}})},tagStyle:{type:Object,default:{}},data:{type:Object,default:{}},size:{type:String,default:"sl"},background:{type:String,default:""},topRadius:{type:Number,default:0},bottomRadius:{type:Number,default:0},titleWidth:{type:Number,default:0},titleColor:{type:String,default:"#333"},priceColor:{type:String,default:""},originPriceColor:{type:String,default:"#C4C4C4"},priceUnit:{type:String,default:"¥"},subTitleColor:{type:String,default:"#999999"},subTitleBackground:{type:String,default:""},buttonShow:{type:Boolean,default:!0},seckillTag:{type:Boolean,default:!1},grouponTag:{type:Boolean,default:!1}},emits:["click","getHeight"],setup(C,{emit:O}){const U=C;s({});const $=l((()=>({background:U.background,"border-top-left-radius":U.topRadius+"px","border-top-right-radius":U.topRadius+"px","border-bottom-left-radius":U.bottomRadius+"px","border-bottom-right-radius":U.bottomRadius+"px"}))),A=l((()=>{var s,l;let t=[];return(null==(s=U.goodsFields.salesCount)?void 0:s.show)&&t.push(F(U.data.sales_show_type,U.data.salesCount)),(null==(l=U.goodsFields.stock)?void 0:l.show)&&t.push(S(U.data.stock_show_type,U.data.stock)),t.join(" | ")})),j=()=>{O("click")},{proxy:T}=v(),N=`sheep_${Math.ceil(1e6*Math.random()).toString(36)}`;return t((()=>{e((()=>{!function(){if("md"===U.size){const s=w().in(T);s.select(`#${N}`).fields({size:!0,scrollOffset:!0}),s.exec((s=>{let l=0;const t=s[0];l=U.data.image_wh?t.width/U.data.image_wh.w*U.data.image_wh.h+t.height:t.width,O("getHeight",l)}))}}()}))})),(s,l)=>{const t=x,e=k,w=b;return o(),a(e,{class:"ss-goods-wrap"},{default:i((()=>["xs"===C.size?(o(),a(e,{key:0,class:"xs-goods-card ss-flex ss-col-stretch",style:d([r($)]),onClick:j},{default:i((()=>{var s,l,y;return[C.tagStyle.show?(o(),a(e,{key:0,class:"tag-icon-box"},{default:i((()=>[c(t,{class:"tag-icon",src:r(n).$url.cdn(C.tagStyle.src||C.tagStyle.imgUrl)},null,8,["src"])])),_:1})):u("",!0),c(t,{class:"xs-img-box",src:r(n).$url.cdn(C.data.image||C.data.picUrl),mode:"aspectFit"},null,8,["src"]),(null==(s=C.goodsFields.title)?void 0:s.show)||(null==(l=C.goodsFields.name)?void 0:l.show)||(null==(y=C.goodsFields.price)?void 0:y.show)?(o(),a(e,{key:1,class:"xs-goods-content ss-flex-col ss-row-around"},{default:i((()=>{var s,l,t;return[(null==(s=C.goodsFields.title)?void 0:s.show)||(null==(l=C.goodsFields.name)?void 0:l.show)?(o(),a(e,{key:0,class:"xs-goods-title ss-line-1",style:d([{color:C.titleColor,width:C.titleWidth?C.titleWidth+"rpx":""}])},{default:i((()=>[g(p(C.data.title||C.data.name),1)])),_:1},8,["style"])):u("",!0),(null==(t=C.goodsFields.price)?void 0:t.show)?(o(),a(e,{key:1,class:"xs-goods-price font-OPPOSANS",style:d([{color:C.goodsFields.price.color}])},{default:i((()=>[c(w,{class:"price-unit ss-font-24"},{default:i((()=>[g(p(C.priceUnit),1)])),_:1}),g(" "+p(r(f.isArray)(C.data.price)?r(P)(C.data.price[0]):r(P)(C.data.price)),1)])),_:1},8,["style"])):u("",!0)]})),_:1})):u("",!0)]})),_:1},8,["style"])):u("",!0),"sm"===C.size?(o(),a(e,{key:1,class:"sm-goods-card ss-flex-col",style:d([r($)]),onClick:j},{default:i((()=>{var s,l,y;return[C.tagStyle.show?(o(),a(e,{key:0,class:"tag-icon-box"},{default:i((()=>[c(t,{class:"tag-icon",src:r(n).$url.cdn(C.tagStyle.src||C.tagStyle.imgUrl)},null,8,["src"])])),_:1})):u("",!0),c(t,{class:"sm-img-box",src:r(n).$url.cdn(C.data.image||C.data.picUrl),mode:"aspectFill"},null,8,["src"]),(null==(s=C.goodsFields.title)?void 0:s.show)||(null==(l=C.goodsFields.name)?void 0:l.show)||(null==(y=C.goodsFields.price)?void 0:y.show)?(o(),a(e,{key:1,class:"sm-goods-content",style:d([{color:C.titleColor,width:C.titleWidth?C.titleWidth+"rpx":""}])},{default:i((()=>{var s,l,t;return[(null==(s=C.goodsFields.title)?void 0:s.show)||(null==(l=C.goodsFields.name)?void 0:l.show)?(o(),a(e,{key:0,class:"sm-goods-title ss-line-1 ss-m-b-16"},{default:i((()=>[g(p(C.data.title||C.data.name),1)])),_:1})):u("",!0),(null==(t=C.goodsFields.price)?void 0:t.show)?(o(),a(e,{key:1,class:"sm-goods-price font-OPPOSANS",style:d([{color:C.goodsFields.price.color}])},{default:i((()=>[c(w,{class:"price-unit ss-font-24"},{default:i((()=>[g(p(C.priceUnit),1)])),_:1}),g(" "+p(r(f.isArray)(C.data.price)?r(P)(C.data.price[0]):r(P)(C.data.price)),1)])),_:1},8,["style"])):u("",!0)]})),_:1},8,["style"])):u("",!0)]})),_:1},8,["style"])):u("",!0),"md"===C.size?(o(),a(e,{key:2,class:"md-goods-card ss-flex-col",style:d([r($)]),onClick:j},{default:i((()=>[C.tagStyle.show?(o(),a(e,{key:0,class:"tag-icon-box"},{default:i((()=>[c(t,{class:"tag-icon",src:r(n).$url.cdn(C.tagStyle.src||C.tagStyle.imgUrl)},null,8,["src"])])),_:1})):u("",!0),c(t,{class:"md-img-box",src:r(n).$url.cdn(C.data.image||C.data.picUrl),mode:"widthFix"},null,8,["src"]),c(e,{class:"md-goods-content ss-flex-col ss-row-around ss-p-b-20 ss-p-t-20 ss-p-x-16",id:N},{default:i((()=>{var l,t,n,x;return[(null==(l=C.goodsFields.title)?void 0:l.show)||(null==(t=C.goodsFields.name)?void 0:t.show)?(o(),a(e,{key:0,class:"md-goods-title ss-line-1",style:d([{color:C.titleColor,width:C.titleWidth?C.titleWidth+"rpx":""}])},{default:i((()=>[g(p(C.data.title||C.data.name),1)])),_:1},8,["style"])):u("",!0),(null==(n=C.goodsFields.subtitle)?void 0:n.show)||(null==(x=C.goodsFields.introduction)?void 0:x.show)?(o(),a(e,{key:1,class:"md-goods-subtitle ss-m-t-16 ss-line-1",style:d([{color:C.subTitleColor,background:C.subTitleBackground}])},{default:i((()=>[g(p(C.data.subtitle||C.data.introduction),1)])),_:1},8,["style"])):u("",!0),y(s.$slots,"activity",{},(()=>{var s;return[(null==(s=C.data.promos)?void 0:s.length)?(o(),a(e,{key:0,class:"tag-box ss-flex-wrap ss-flex ss-col-center"},{default:i((()=>[(o(!0),m(_,null,h(C.data.promos,(s=>(o(),a(e,{class:"activity-tag ss-m-r-10 ss-m-t-16",key:s.id},{default:i((()=>[g(p(s.title),1)])),_:2},1024)))),128))])),_:1})):u("",!0)]}),!0),c(e,{class:"ss-flex ss-col-bottom"},{default:i((()=>{var s,l,t;return[(null==(s=C.goodsFields.price)?void 0:s.show)?(o(),a(e,{key:0,class:"md-goods-price ss-m-t-16 font-OPPOSANS ss-m-r-10",style:d([{color:C.goodsFields.price.color}])},{default:i((()=>[c(w,{class:"price-unit ss-font-24"},{default:i((()=>[g(p(C.priceUnit),1)])),_:1}),g(" "+p(r(f.isArray)(C.data.price)?r(P)(C.data.price[0]):r(P)(C.data.price)),1)])),_:1},8,["style"])):u("",!0),((null==(l=C.goodsFields.original_price)?void 0:l.show)||(null==(t=C.goodsFields.marketPrice)?void 0:t.show))&&(C.data.original_price>0||C.data.marketPrice>0)?(o(),a(e,{key:1,class:"goods-origin-price ss-m-t-16 font-OPPOSANS ss-flex",style:d([{color:C.originPriceColor}])},{default:i((()=>[c(w,{class:"price-unit ss-font-20"},{default:i((()=>[g(p(C.priceUnit),1)])),_:1}),c(e,{class:"ss-m-l-8"},{default:i((()=>[g(p(r(P)(C.data.marketPrice)),1)])),_:1})])),_:1},8,["style"])):u("",!0)]})),_:1}),c(e,{class:"ss-m-t-16 ss-flex ss-col-center ss-flex-wrap"},{default:i((()=>[c(e,{class:"sales-text"},{default:i((()=>[g(p(r(A)),1)])),_:1})])),_:1})]})),_:3}),y(s.$slots,"cart",{},(()=>[c(e,{class:"cart-box ss-flex ss-col-center ss-row-center"},{default:i((()=>[c(t,{class:"cart-icon",src:"./static/img/shop/tabbar/category2.png",mode:""})])),_:1})]),!0)])),_:3},8,["style"])):u("",!0),"lg"===C.size?(o(),a(e,{key:3,class:"lg-goods-card ss-flex ss-col-stretch",style:d([r($)]),onClick:j},{default:i((()=>[C.tagStyle.show?(o(),a(e,{key:0,class:"tag-icon-box"},{default:i((()=>[c(t,{class:"tag-icon",src:r(n).$url.cdn(C.tagStyle.src||C.tagStyle.imgUrl)},null,8,["src"])])),_:1})):u("",!0),C.seckillTag?(o(),a(e,{key:1,class:"seckill-tag ss-flex ss-row-center"},{default:i((()=>[g(" 秒杀 ")])),_:1})):u("",!0),C.grouponTag?(o(),a(e,{key:2,class:"groupon-tag ss-flex ss-row-center"},{default:i((()=>[c(e,{class:"tag-icon"},{default:i((()=>[g("拼团")])),_:1})])),_:1})):u("",!0),c(t,{class:"lg-img-box",src:r(n).$url.cdn(C.data.image||C.data.picUrl),mode:"aspectFill"},null,8,["src"]),c(e,{class:"lg-goods-content ss-flex-1 ss-flex-col ss-row-between ss-p-b-10 ss-p-t-20"},{default:i((()=>[c(e,null,{default:i((()=>{var s,l,t,r;return[(null==(s=C.goodsFields.title)?void 0:s.show)||(null==(l=C.goodsFields.name)?void 0:l.show)?(o(),a(e,{key:0,class:"lg-goods-title ss-line-2",style:d([{color:C.titleColor}])},{default:i((()=>[g(p(C.data.title||C.data.name),1)])),_:1},8,["style"])):u("",!0),(null==(t=C.goodsFields.subtitle)?void 0:t.show)||(null==(r=C.goodsFields.introduction)?void 0:r.show)?(o(),a(e,{key:1,class:"lg-goods-subtitle ss-m-t-10 ss-line-1",style:d([{color:C.subTitleColor,background:C.subTitleBackground}])},{default:i((()=>[g(p(C.data.subtitle||C.data.introduction),1)])),_:1},8,["style"])):u("",!0)]})),_:1}),c(e,null,{default:i((()=>[y(s.$slots,"activity",{},(()=>{var s;return[(null==(s=C.data.promos)?void 0:s.length)?(o(),a(e,{key:0,class:"tag-box ss-flex ss-col-center"},{default:i((()=>[(o(!0),m(_,null,h(C.data.promos,(s=>(o(),a(e,{class:"activity-tag ss-m-r-10",key:s.id},{default:i((()=>[g(p(s.title),1)])),_:2},1024)))),128))])),_:1})):u("",!0)]}),!0),c(e,{class:"ss-flex ss-col-bottom ss-m-t-10"},{default:i((()=>{var s,l,t;return[(null==(s=C.goodsFields.price)?void 0:s.show)?(o(),a(e,{key:0,class:"lg-goods-price ss-m-r-12 ss-flex ss-col-bottom font-OPPOSANS",style:d([{color:C.goodsFields.price.color}])},{default:i((()=>[c(w,{class:"ss-font-24"},{default:i((()=>[g(p(C.priceUnit),1)])),_:1}),g(" "+p(r(f.isArray)(C.data.price)?r(P)(C.data.price[0]):r(P)(C.data.price)),1)])),_:1},8,["style"])):u("",!0),((null==(l=C.goodsFields.original_price)?void 0:l.show)||(null==(t=C.goodsFields.marketPrice)?void 0:t.show))&&(C.data.original_price>0||C.data.marketPrice>0)?(o(),a(e,{key:1,class:"goods-origin-price ss-flex ss-col-bottom font-OPPOSANS",style:d([{color:C.originPriceColor}])},{default:i((()=>[c(w,{class:"price-unit ss-font-20"},{default:i((()=>[g(p(C.priceUnit),1)])),_:1}),c(e,{class:"ss-m-l-8"},{default:i((()=>[g(p(r(P)(C.data.marketPrice)),1)])),_:1})])),_:1},8,["style"])):u("",!0)]})),_:1}),c(e,{class:"ss-m-t-8 ss-flex ss-col-center ss-flex-wrap"},{default:i((()=>[c(e,{class:"sales-text"},{default:i((()=>[g(p(r(A)),1)])),_:1})])),_:1})])),_:3})])),_:3}),y(s.$slots,"cart",{},(()=>[C.buttonShow?(o(),a(e,{key:0,class:"buy-box ss-flex ss-col-center ss-row-center"},{default:i((()=>[g(" 去购买 ")])),_:1})):u("",!0)]),!0)])),_:3},8,["style"])):u("",!0),"sl"===C.size?(o(),a(e,{key:4,class:"sl-goods-card ss-flex-col",style:d([r($)]),onClick:j},{default:i((()=>[C.tagStyle.show?(o(),a(e,{key:0,class:"tag-icon-box"},{default:i((()=>[c(t,{class:"tag-icon",src:r(n).$url.cdn(C.tagStyle.src||C.tagStyle.imgUrl)},null,8,["src"])])),_:1})):u("",!0),c(t,{class:"sl-img-box",src:r(n).$url.cdn(C.data.image||C.data.picUrl),mode:"aspectFill"},null,8,["src"]),c(e,{class:"sl-goods-content"},{default:i((()=>[c(e,null,{default:i((()=>{var s,l,t,r;return[(null==(s=C.goodsFields.title)?void 0:s.show)||(null==(l=C.goodsFields.name)?void 0:l.show)?(o(),a(e,{key:0,class:"sl-goods-title ss-line-1",style:d([{color:C.titleColor}])},{default:i((()=>[g(p(C.data.title||C.data.name),1)])),_:1},8,["style"])):u("",!0),(null==(t=C.goodsFields.subtitle)?void 0:t.show)||(null==(r=C.goodsFields.introduction)?void 0:r.show)?(o(),a(e,{key:1,class:"sl-goods-subtitle ss-m-t-16",style:d([{color:C.subTitleColor,background:C.subTitleBackground}])},{default:i((()=>[g(p(C.data.subtitle||C.data.introduction),1)])),_:1},8,["style"])):u("",!0)]})),_:1}),c(e,null,{default:i((()=>{var l;return[y(s.$slots,"activity",{},(()=>{var s;return[(null==(s=C.data.promos)?void 0:s.length)?(o(),a(e,{key:0,class:"tag-box ss-flex ss-col-center ss-flex-wrap"},{default:i((()=>[(o(!0),m(_,null,h(C.data.promos,(s=>(o(),a(e,{class:"activity-tag ss-m-r-10 ss-m-t-16",key:s.id},{default:i((()=>[g(p(s.title),1)])),_:2},1024)))),128))])),_:1})):u("",!0)]}),!0),(null==(l=C.goodsFields.price)?void 0:l.show)?(o(),a(e,{key:0,class:"ss-flex ss-col-bottom font-OPPOSANS"},{default:i((()=>{var s,l;return[c(e,{class:"sl-goods-price ss-m-r-12",style:d([{color:C.goodsFields.price.color}])},{default:i((()=>[c(w,{class:"price-unit ss-font-24"},{default:i((()=>[g(p(C.priceUnit),1)])),_:1}),g(" "+p(r(f.isArray)(C.data.price)?r(P)(C.data.price[0]):r(P)(C.data.price)),1)])),_:1},8,["style"]),((null==(s=C.goodsFields.original_price)?void 0:s.show)||(null==(l=C.goodsFields.marketPrice)?void 0:l.show))&&(C.data.original_price>0||C.data.marketPrice>0)?(o(),a(e,{key:0,class:"goods-origin-price ss-m-t-16 font-OPPOSANS ss-flex",style:d([{color:C.originPriceColor}])},{default:i((()=>[c(w,{class:"price-unit ss-font-20"},{default:i((()=>[g(p(C.priceUnit),1)])),_:1}),c(e,{class:"ss-m-l-8"},{default:i((()=>[g(p(r(P)(C.data.marketPrice)),1)])),_:1})])),_:1},8,["style"])):u("",!0)]})),_:1})):u("",!0),c(e,{class:"ss-m-t-16 ss-flex ss-flex-wrap"},{default:i((()=>[c(e,{class:"sales-text"},{default:i((()=>[g(p(r(A)),1)])),_:1})])),_:1})]})),_:3})])),_:3}),y(s.$slots,"cart",{},(()=>[c(e,{class:"buy-box ss-flex ss-col-center ss-row-center"},{default:i((()=>[g("去购买")])),_:1})]),!0)])),_:3},8,["style"])):u("",!0)])),_:3})}}},[["__scopeId","data-v-f55c0593"]]);export{O as _};