2 lines
2.5 KiB
JavaScript
2 lines
2.5 KiB
JavaScript
"use strict";const e=require("../../../common/vendor.js"),o=require("../../index.js"),t=require("../../api/product/spu.js"),a=require("../../api/promotion/combination.js");if(!Array){e.resolveComponent("s-goods-column")()}Math;const r={__name:"s-groupon-block",props:{data:{type:Object,default:()=>({})},styles:{type:Object,default:()=>({})}},setup(r){const i=r,d=e.reactive({price:{show:!0},stock:{show:!0},name:{show:!0},introduction:{show:!0},marketPrice:{show:!0},salesCount:{show:!0}}),{layoutType:n,badge:u,btnBuy:s,space:l}=i.data;i.styles;const p=e.computed((()=>{const e=i.data.btnBuy;return"text"===(null==e?void 0:e.type)?{background:`linear-gradient(to right, ${e.bgBeginColor}, ${e.bgEndColor})`}:"img"===(null==e?void 0:e.type)?{width:"54rpx",height:"54rpx",background:`url(${o.sheep.$url.cdn(e.imgUrl)}) no-repeat`,backgroundSize:"100% 100%"}:void 0})),c=e.ref([]);return e.onMounted((()=>{return e=this,o=null,r=function*(){const{data:e}=yield a.CombinationApi.getCombinationActivity(i.data.activityId),{data:o}=yield t.SpuApi.getSpuDetail(e.spuId);e.products.forEach((e=>{o.price=Math.min(o.price,e.combinationPrice)})),c.value=[o]},new Promise(((t,a)=>{var i=e=>{try{n(r.next(e))}catch(o){a(o)}},d=e=>{try{n(r.throw(e))}catch(o){a(o)}},n=e=>e.done?t(e.value):Promise.resolve(e.value).then(i,d);n((r=r.apply(e,o)).next())}));var e,o,r})),(t,a)=>{var g;return e.e({a:"threeCol"===e.unref(n)},"threeCol"===e.unref(n)?{b:e.f(c.value,((t,a,n)=>{var s;return{a:e.o((t=>e.unref(o.sheep).$router.go("/modules/mall/goods/groupon",{id:i.data.activityId})),t.id),b:"e6b33b20-0-"+n,c:e.p({size:"sm",goodsFields:d,tagStyle:e.unref(u),data:t,titleColor:null==(s=r.data.fields.name)?void 0:s.color,topRadius:r.data.borderRadiusTop,bottomRadius:r.data.borderRadiusBottom}),d:t.id}})),c:e.s({padding:r.data.space+"rpx"}),d:e.s({margin:"-"+r.data.space+"rpx"})}:{},{e:"oneCol"===e.unref(n)},"oneCol"===e.unref(n)?{f:e.f(c.value,((t,a,n)=>{var s,l;return{a:e.o((t=>e.unref(o.sheep).$router.go("/modules/mall/goods/groupon",{id:i.data.activityId})),a),b:"e6b33b20-1-"+n,c:e.p({size:"lg",grouponTag:!0,goodsFields:d,tagStyle:e.unref(u),data:t,titleColor:null==(s=r.data.fields.name)?void 0:s.color,subTitleColor:null==(l=r.data.fields.introduction)?void 0:l.color,topRadius:r.data.borderRadiusTop,bottomRadius:r.data.borderRadiusBottom}),d:a}})),g:e.t("text"===(null==(g=e.unref(s))?void 0:g.type)?e.unref(s).text:"去拼团"),h:e.s(p.value),i:e.s({marginBottom:e.unref(l)+"px"})}:{})}}},i=e._export_sfc(r,[["__scopeId","data-v-e6b33b20"]]);wx.createComponent(i);
|