2 lines
9.4 KiB
JavaScript
2 lines
9.4 KiB
JavaScript
"use strict";const o=require("../../../../../common/vendor.js"),e=require("../../index.js"),i=require("../../hooks/useGoods.js"),t={__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(t,{emit:l}){o.reactive({});const d=t,s=o.computed((()=>({background:d.background,"border-top-left-radius":d.topRadius+"px","border-top-right-radius":d.topRadius+"px","border-bottom-left-radius":d.bottomRadius+"px","border-bottom-right-radius":d.bottomRadius+"px"}))),a=o.computed((()=>{var o,e;const t=[];return(null==(o=d.goodsFields.salesCount)?void 0:o.show)&&t.push(i.formatSales(d.data.sales_show_type,d.data.salesCount)),(null==(e=d.goodsFields.stock)?void 0:e.show)&&t.push(i.formatStock(d.data.stock_show_type,d.data.stock)),t.join(" | ")})),r=l,n=()=>{r("click")},{proxy:u}=o.getCurrentInstance(),c=`sheep_${Math.ceil(1e6*Math.random()).toString(36)}`;return o.onMounted((()=>{o.nextTick$1((()=>{!function(){if("md"===d.size){const e=o.index.createSelectorQuery().in(u);e.select(`#${c}`).fields({size:!0,scrollOffset:!0}),e.exec((o=>{let e=0;const i=o[0];e=d.data.image_wh?i.width/d.data.image_wh.w*d.data.image_wh.h+i.height:i.width,r("getHeight",e)}))}}()}))})),(l,d)=>{var r,u,g,h,p,w,v,m,F,f,y,b,k,S,_,C,P,U,x,$,T,z,j,B,W,A,R,O,q,M,N,H,I,G,Q,D,E,J,K,L,V,X,Y,Z,oo,eo,io,to,lo,so,ao,ro,no,uo,co,go,ho,po,wo,vo,mo,Fo,fo,yo,bo,ko,So,_o,Co,Po,Uo,xo;return o.e({a:"xs"===t.size},"xs"===t.size?o.e({b:t.tagStyle.show},t.tagStyle.show?{c:o.unref(e.sheep).$url.cdn(t.tagStyle.src||t.tagStyle.imgUrl)}:{},{d:o.unref(e.sheep).$url.cdn(t.data.image||t.data.picUrl),e:(null==(r=t.goodsFields.title)?void 0:r.show)||(null==(u=t.goodsFields.name)?void 0:u.show)||(null==(g=t.goodsFields.price)?void 0:g.show)},(null==(h=t.goodsFields.title)?void 0:h.show)||(null==(p=t.goodsFields.name)?void 0:p.show)||(null==(w=t.goodsFields.price)?void 0:w.show)?o.e({f:(null==(v=t.goodsFields.title)?void 0:v.show)||(null==(m=t.goodsFields.name)?void 0:m.show)},(null==(F=t.goodsFields.title)?void 0:F.show)||(null==(f=t.goodsFields.name)?void 0:f.show)?{g:o.t(t.data.title||t.data.name),h:o.s({color:t.titleColor,width:t.titleWidth?t.titleWidth+"rpx":""})}:{},{i:null==(y=t.goodsFields.price)?void 0:y.show},(null==(b=t.goodsFields.price)?void 0:b.show)?{j:o.t(t.priceUnit),k:o.t(o.unref(o.isArray$1)(t.data.price)?o.unref(i.fen2yuan)(t.data.price[0]):o.unref(i.fen2yuan)(t.data.price)),l:o.s({color:t.goodsFields.price.color})}:{}):{},{m:o.s(s.value),n:o.o(n)}):{},{o:"sm"===t.size},"sm"===t.size?o.e({p:t.tagStyle.show},t.tagStyle.show?{q:o.unref(e.sheep).$url.cdn(t.tagStyle.src||t.tagStyle.imgUrl)}:{},{r:o.unref(e.sheep).$url.cdn(t.data.image||t.data.picUrl),s:(null==(k=t.goodsFields.title)?void 0:k.show)||(null==(S=t.goodsFields.name)?void 0:S.show)||(null==(_=t.goodsFields.price)?void 0:_.show)},(null==(C=t.goodsFields.title)?void 0:C.show)||(null==(P=t.goodsFields.name)?void 0:P.show)||(null==(U=t.goodsFields.price)?void 0:U.show)?o.e({t:(null==(x=t.goodsFields.title)?void 0:x.show)||(null==($=t.goodsFields.name)?void 0:$.show)},(null==(T=t.goodsFields.title)?void 0:T.show)||(null==(z=t.goodsFields.name)?void 0:z.show)?{v:o.t(t.data.title||t.data.name)}:{},{w:null==(j=t.goodsFields.price)?void 0:j.show},(null==(B=t.goodsFields.price)?void 0:B.show)?{x:o.t(t.priceUnit),y:o.t(o.unref(o.isArray$1)(t.data.price)?o.unref(i.fen2yuan)(t.data.price[0]):o.unref(i.fen2yuan)(t.data.price)),z:o.s({color:t.goodsFields.price.color})}:{},{A:o.s({color:t.titleColor,width:t.titleWidth?t.titleWidth+"rpx":""})}):{},{B:o.s(s.value),C:o.o(n)}):{},{D:"md"===t.size},"md"===t.size?o.e({E:t.tagStyle.show},t.tagStyle.show?{F:o.unref(e.sheep).$url.cdn(t.tagStyle.src||t.tagStyle.imgUrl)}:{},{G:o.unref(e.sheep).$url.cdn(t.data.image||t.data.picUrl),H:(null==(W=t.goodsFields.title)?void 0:W.show)||(null==(A=t.goodsFields.name)?void 0:A.show)},(null==(R=t.goodsFields.title)?void 0:R.show)||(null==(O=t.goodsFields.name)?void 0:O.show)?{I:o.t(t.data.title||t.data.name),J:o.s({color:t.titleColor,width:t.titleWidth?t.titleWidth+"rpx":""})}:{},{K:(null==(q=t.goodsFields.subtitle)?void 0:q.show)||(null==(M=t.goodsFields.introduction)?void 0:M.show)},(null==(N=t.goodsFields.subtitle)?void 0:N.show)||(null==(H=t.goodsFields.introduction)?void 0:H.show)?{L:o.t(t.data.subtitle||t.data.introduction),M:o.s({color:t.subTitleColor,background:t.subTitleBackground})}:{},{N:null==(I=t.data.promos)?void 0:I.length},(null==(G=t.data.promos)?void 0:G.length)?{O:o.f(t.data.promos,((e,i,t)=>({a:o.t(e.title),b:e.id})))}:{},{P:null==(Q=t.goodsFields.price)?void 0:Q.show},(null==(D=t.goodsFields.price)?void 0:D.show)?{Q:o.t(t.priceUnit),R:o.t(o.unref(o.isArray$1)(t.data.price)?o.unref(i.fen2yuan)(t.data.price[0]):o.unref(i.fen2yuan)(t.data.price)),S:o.s({color:t.goodsFields.price.color})}:{},{T:((null==(E=t.goodsFields.original_price)?void 0:E.show)||(null==(J=t.goodsFields.marketPrice)?void 0:J.show))&&(t.data.original_price>0||t.data.marketPrice>0)},((null==(K=t.goodsFields.original_price)?void 0:K.show)||(null==(L=t.goodsFields.marketPrice)?void 0:L.show))&&(t.data.original_price>0||t.data.marketPrice>0)?{U:o.t(t.priceUnit),V:o.t(o.unref(i.fen2yuan)(t.data.marketPrice)),W:o.s({color:t.originPriceColor})}:{},{X:o.t(a.value),Y:c,Z:o.s(s.value),aa:o.o(n)}):{},{ab:"lg"===t.size},"lg"===t.size?o.e({ac:t.tagStyle.show},t.tagStyle.show?{ad:o.unref(e.sheep).$url.cdn(t.tagStyle.src||t.tagStyle.imgUrl)}:{},{ae:t.seckillTag},(t.seckillTag,{}),{af:t.grouponTag},(t.grouponTag,{}),{ag:o.unref(e.sheep).$url.cdn(t.data.image||t.data.picUrl),ah:(null==(V=t.goodsFields.title)?void 0:V.show)||(null==(X=t.goodsFields.name)?void 0:X.show)},(null==(Y=t.goodsFields.title)?void 0:Y.show)||(null==(Z=t.goodsFields.name)?void 0:Z.show)?{ai:o.t(t.data.title||t.data.name),aj:o.s({color:t.titleColor})}:{},{ak:(null==(oo=t.goodsFields.subtitle)?void 0:oo.show)||(null==(eo=t.goodsFields.introduction)?void 0:eo.show)},(null==(io=t.goodsFields.subtitle)?void 0:io.show)||(null==(to=t.goodsFields.introduction)?void 0:to.show)?{al:o.t(t.data.subtitle||t.data.introduction),am:o.s({color:t.subTitleColor,background:t.subTitleBackground})}:{},{an:null==(lo=t.data.promos)?void 0:lo.length},(null==(so=t.data.promos)?void 0:so.length)?{ao:o.f(t.data.promos,((e,i,t)=>({a:o.t(e.title),b:e.id})))}:{},{ap:null==(ao=t.goodsFields.price)?void 0:ao.show},(null==(ro=t.goodsFields.price)?void 0:ro.show)?{aq:o.t(t.priceUnit),ar:o.t(o.unref(o.isArray$1)(t.data.price)?o.unref(i.fen2yuan)(t.data.price[0]):o.unref(i.fen2yuan)(t.data.price)),as:o.s({color:t.goodsFields.price.color})}:{},{at:((null==(no=t.goodsFields.original_price)?void 0:no.show)||(null==(uo=t.goodsFields.marketPrice)?void 0:uo.show))&&(t.data.original_price>0||t.data.marketPrice>0)},((null==(co=t.goodsFields.original_price)?void 0:co.show)||(null==(go=t.goodsFields.marketPrice)?void 0:go.show))&&(t.data.original_price>0||t.data.marketPrice>0)?{av:o.t(t.priceUnit),aw:o.t(o.unref(i.fen2yuan)(t.data.marketPrice)),ax:o.s({color:t.originPriceColor})}:{},{ay:o.t(a.value),az:t.buttonShow},(t.buttonShow,{}),{aA:o.s(s.value),aB:o.o(n)}):{},{aC:"sl"===t.size},"sl"===t.size?o.e({aD:t.tagStyle.show},t.tagStyle.show?{aE:o.unref(e.sheep).$url.cdn(t.tagStyle.src||t.tagStyle.imgUrl)}:{},{aF:o.unref(e.sheep).$url.cdn(t.data.image||t.data.picUrl),aG:(null==(ho=t.goodsFields.title)?void 0:ho.show)||(null==(po=t.goodsFields.name)?void 0:po.show)},(null==(wo=t.goodsFields.title)?void 0:wo.show)||(null==(vo=t.goodsFields.name)?void 0:vo.show)?{aH:o.t(t.data.title||t.data.name),aI:o.s({color:t.titleColor})}:{},{aJ:(null==(mo=t.goodsFields.subtitle)?void 0:mo.show)||(null==(Fo=t.goodsFields.introduction)?void 0:Fo.show)},(null==(fo=t.goodsFields.subtitle)?void 0:fo.show)||(null==(yo=t.goodsFields.introduction)?void 0:yo.show)?{aK:o.t(t.data.subtitle||t.data.introduction),aL:o.s({color:t.subTitleColor,background:t.subTitleBackground})}:{},{aM:null==(bo=t.data.promos)?void 0:bo.length},(null==(ko=t.data.promos)?void 0:ko.length)?{aN:o.f(t.data.promos,((e,i,t)=>({a:o.t(e.title),b:e.id})))}:{},{aO:null==(So=t.goodsFields.price)?void 0:So.show},(null==(_o=t.goodsFields.price)?void 0:_o.show)?o.e({aP:o.t(t.priceUnit),aQ:o.t(o.unref(o.isArray$1)(t.data.price)?o.unref(i.fen2yuan)(t.data.price[0]):o.unref(i.fen2yuan)(t.data.price)),aR:o.s({color:t.goodsFields.price.color}),aS:((null==(Co=t.goodsFields.original_price)?void 0:Co.show)||(null==(Po=t.goodsFields.marketPrice)?void 0:Po.show))&&(t.data.original_price>0||t.data.marketPrice>0)},((null==(Uo=t.goodsFields.original_price)?void 0:Uo.show)||(null==(xo=t.goodsFields.marketPrice)?void 0:xo.show))&&(t.data.original_price>0||t.data.marketPrice>0)?{aT:o.t(t.priceUnit),aU:o.t(o.unref(i.fen2yuan)(t.data.marketPrice)),aV:o.s({color:t.originPriceColor})}:{}):{},{aW:o.t(a.value),aX:o.s(s.value),aY:o.o(n)}):{})}}},l=o._export_sfc(t,[["__scopeId","data-v-f704c824"]]);wx.createComponent(l);
|