acdr-ui/dist/build/mp-weixin/modules/mall/goods/index.js
2024-10-01 09:15:35 +08:00

2 lines
5.0 KiB
JavaScript

"use strict";var o=(o,e,t)=>new Promise(((s,n)=>{var i=o=>{try{a(t.next(o))}catch(e){n(e)}},d=o=>{try{a(t.throw(o))}catch(e){n(e)}},a=o=>o.done?s(o.value):Promise.resolve(o.value).then(i,d);a((t=t.apply(o,e)).next())}));const e=require("../../../common/vendor.js"),t=require("../sheep/index.js"),s=require("../sheep/api/promotion/coupon.js"),n=require("../sheep/api/promotion/activity.js"),i=require("../sheep/api/product/favorite.js"),d=require("../sheep/hooks/useGoods.js"),a=require("../sheep/api/product/spu.js");if(!Array){(e.resolveComponent("s-empty")+e.resolveComponent("su-swiper")+e.resolveComponent("s-select-sku")+e.resolveComponent("s-coupon-get")+e.resolveComponent("s-activity-pop")+e.resolveComponent("s-layout")+e.resolveComponent("layout-default-uni"))()}Math||(c+r+(()=>"../sheep/components/s-empty/s-empty.js")+(()=>"../sheep/ui/su-swiper/su-swiper.js")+p+(()=>"../sheep/components/s-select-sku/s-select-sku.js")+u+g+f+l+(()=>"../sheep/components/s-coupon-get/s-coupon-get.js")+(()=>"../sheep/components/s-activity-pop/s-activity-pop.js")+(()=>"../sheep/components/s-layout/s-layout.js"))();const c=()=>"./components/detail/detail-navbar.js",p=()=>"./components/detail/detail-cell-sku.js",l=()=>"./components/detail/detail-tabbar.js",r=()=>"./components/detail/detail-skeleton.js",u=()=>"./components/detail/detail-comment-card.js",g=()=>"./components/detail/detail-content-card.js",f=()=>"./components/detail/detail-activity-tip.js",m={__name:"index",setup(c){e.onPageScroll((()=>{}));const p=e.computed((()=>t.sheep.$store("user").isLogin)),l=e.reactive({goodsId:0,skeletonLoading:!0,goodsInfo:{},showSelectSku:!1,selectedSku:{},showModel:!1,couponInfo:[],showActivityModel:!1,activityInfo:[],activityList:[]});function r(o){l.selectedSku=o}function u(o){o.id?t.sheep.$store("cart").add(o):t.sheep.$helper.toast("请选择商品规格")}function g(o){l.selectedSku.id?t.sheep.$router.go("/modules/mall/order/confirm",{data:JSON.stringify({items:[{skuId:o.id,count:o.goods_num,categoryId:l.goodsInfo.categoryId}]})}):t.sheep.$helper.toast("请选择商品规格")}function f(){l.showActivityModel=!0}function m(t){return o(this,null,(function*(){const{code:o}=yield s.CouponApi.takeCoupon(t);0===o&&(e.index.showToast({title:"领取成功"}),setTimeout((()=>{I()}),1e3))}))}const h=e.computed((()=>e.isEmpty(l.goodsInfo)?{}:t.sheep.$platform.share.getShareInfo({title:l.goodsInfo.name,image:t.sheep.$url.cdn(l.goodsInfo.picUrl),desc:l.goodsInfo.introduction,params:{page:"2",query:l.goodsInfo.id}},{type:"goods",title:l.goodsInfo.name,image:t.sheep.$url.cdn(l.goodsInfo.picUrl),price:d.fen2yuan(l.goodsInfo.price),original_price:d.fen2yuan(l.goodsInfo.marketPrice)})));function I(){return o(this,null,(function*(){const{code:o,data:e}=yield s.CouponApi.getCouponTemplateList(l.goodsId,2,10);0===o&&(l.couponInfo=e)}))}return e.onLoad((o=>{o.id?(l.goodsId=o.id,a.SpuApi.getSpuDetail(l.goodsId).then((o=>{0===o.code&&o.data?(l.skeletonLoading=!1,l.goodsInfo=o.data,p.value&&i.FavoriteApi.isFavoriteExists(l.goodsId,"goods").then((o=>{0===o.code&&(l.goodsInfo.favorite=o.data)}))):l.goodsInfo=null})),I(),n.ActivityApi.getActivityListBySpuId(l.goodsId).then((o=>{0===o.code&&o.data.forEach((o=>{[1,2,3].includes(o.type)?l.activityList.push(o):5===o.type&&l.activityInfo.push(o)}))}))):l.goodsInfo=null})),(o,t)=>e.e({a:l.skeletonLoading},l.skeletonLoading?{}:null===l.goodsInfo?{c:e.p({text:"商品不存在或已下架",icon:"/static/soldout-empty.png",showAction:!0,actionText:"再逛逛",actionUrl:"/modules/mall/goods/list"})}:e.e({d:e.p({isPreview:!0,list:e.unref(d.formatGoodsSwiper)(l.goodsInfo.sliderPicUrls),otStyle:"tag",imageMode:"widthFix",dotCur:"bg-mask-40",seizeHeight:750}),e:e.t(e.unref(d.fen2yuan)(l.selectedSku.price||l.goodsInfo.price)),f:l.goodsInfo.marketPrice>0},l.goodsInfo.marketPrice>0?{g:e.t(e.unref(d.fen2yuan)(l.selectedSku.marketPrice||l.goodsInfo.marketPrice))}:{},{h:e.t(e.unref(d.formatSales)("exact",l.goodsInfo.salesCount)),i:e.f(l.activityInfo,((o,t,s)=>({a:e.t(o.name),b:o.id,c:e.o(f,o.id)}))),j:l.couponInfo.length},l.couponInfo.length?{k:e.o((o=>l.showModel=!0))}:{},{l:e.t(l.goodsInfo.name),m:e.t(l.goodsInfo.introduction),n:e.o((o=>l.showSelectSku=!0)),o:e.o((o=>l.selectedSku.goods_sku_text=o)),p:e.p({sku:l.selectedSku,modelValue:l.selectedSku.goods_sku_text}),q:e.o(u),r:e.o(g),s:e.o(r),t:e.o((o=>l.showSelectSku=!1)),v:e.p({goodsInfo:l.goodsInfo,show:l.showSelectSku}),w:e.p({goodsId:l.goodsId}),x:e.p({content:l.goodsInfo.description}),y:l.activityList.length>0},l.activityList.length>0?{z:e.p({"activity-list":l.activityList})}:{},{A:l.goodsInfo.stock>0},l.goodsInfo.stock>0?{B:e.o((o=>l.showSelectSku=!0)),C:e.o((o=>l.showSelectSku=!0))}:{},{D:e.o((o=>l.goodsInfo=o)),E:e.p({modelValue:l.goodsInfo}),F:e.o((o=>l.showModel=!1)),G:e.o(m),H:e.o((o=>l.couponInfo=o)),I:e.p({show:l.showModel,modelValue:l.couponInfo}),J:e.o((o=>l.showActivityModel=!1)),K:e.o((o=>l.activityInfo=o)),L:e.p({show:l.showActivityModel,modelValue:l.activityInfo})}),{b:null===l.goodsInfo,M:e.p({onShareAppMessage:h.value,navbar:"goods"})})}},h=e._export_sfc(m,[["__scopeId","data-v-8f35e608"]]);m.__runtimeHooks=3,wx.createPage(h);