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.fen2yu
|