detail-content-card.14f775e9.js 10 KB

1
  1. import{c as e,s,z as t,e as a,aa as l,m as c,n as o,f as r,g as n,w as i,k as u,B as d,x as f,l as m,F as b,r as p,E as _,u as x,v as y,ab as g,ac as w,i as v,ad as h,ae as k,af as $,ag as I,t as V,a6 as C,I as T,j as L,y as j,J as S,ah as B,O as F,ai as O}from"./index-ba48620e.js";import{c as N,a as R}from"./s-layout.04b95866.js";import{_ as z}from"./_plugin-vue_export-helper.1b428a4d.js";import{_ as E}from"./s-empty.a75760f9.js";import{c as H}from"./comment-item.f8c71369.js";import{_ as M}from"./mp-html.c71b528b.js";const P=z({__name:"detail-navbar",props:{modelValue:{type:Object,default(){}},collectIcon:{type:Boolean,default:!0},shareIcon:{type:Boolean,default:!0}},emits:["clickLeft"],setup(S,{emit:B}){const F=e((()=>s.$store("user").isLogin)),O=s.$platform.device.statusBarHeight,z=s.$platform.navbar;s.$platform.capsule.width,s.$platform.capsule.height;const E=t({tabOpacityVal:0,curTab:"goods",tabList:[{label:"商品",value:"goods",to:"detail-swiper-selector"},{label:"评价",value:"comment",to:"detail-comment-selector"},{label:"详情",value:"detail",to:"detail-content-selector"}]}),H=S,M=B,P=s.$router.hasHistory();function U(){P?s.$router.back():s.$router.go("/pages/index/index"),M("clickLeft")}function q(){k()}let A={top:0,bottom:0};async function J(){if(F.value)if(H.modelValue.favorite){const{code:e}=await C.deleteFavorite(H.modelValue.id);if(0!==e)return;s.$helper.toast("取消收藏"),H.modelValue.favorite=!1}else{const{code:e}=await C.createFavorite(H.modelValue.id);if(await C.createCollectBefore(H.modelValue.id),0!==e)return;s.$helper.toast("收藏成功"),H.modelValue.favorite=!0}else V()}return a((e=>{E.tabOpacityVal=e.scrollTop>s.$platform.navbar?1:.01*e.scrollTop,0===A.top&&l((()=>{new Promise(((e,s)=>{$().select(".detail-comment-selector").boundingClientRect((s=>{s?(A.top=s.top,A.bottom=s.top+s.height,e(s)):e(null)})).exec()}))}),50),e.scrollTop<A.top-z?E.curTab="goods":e.scrollTop>=A.top-z&&e.scrollTop<=A.bottom-z?E.curTab="comment":E.curTab="detail"})),(e,t)=>{const a=c(o("su-status-bar"),N),l=T,k=L,$=j,V=c(o("su-fixed"),R);return r(),n(V,{alway:"",bgStyles:{background:"#fff"},val:0,noNav:"",opacity:"",placeholder:!1},{default:i((()=>[u(a),u(k,{class:"ui-bar ss-flex ss-col-center ss-row-between ss-p-x-20",style:d([{height:f(z)-f(O)+"px"}])},{default:i((()=>[u(k,{class:"icon-box ss-flex"},{default:i((()=>[u(k,{class:"icon-button icon-button-left ss-flex ss-row-center",onClick:U},{default:i((()=>[f(P)?(r(),n(l,{key:0,class:"sicon-back"})):(r(),n(l,{key:1,class:"sicon-home"}))])),_:1}),u(k,{class:"line"}),u(k,{class:"icon-button icon-button-right ss-flex ss-row-center",onClick:q},{default:i((()=>[u(l,{class:"sicon-more"})])),_:1})])),_:1}),u(k,{class:"detail-tab-card ss-flex-1",style:d([{opacity:E.tabOpacityVal}])},{default:i((()=>[u(k,{class:"tab-box ss-flex ss-col-center ss-row-around"},{default:i((()=>[(r(!0),m(b,null,p(E.tabList,(e=>(r(),n(k,{class:"tab-item ss-flex-1 ss-flex ss-row-center ss-col-center",key:e.value,onClick:s=>function(e){let s=0;"comment"===e.value?s=A.top-z+1:"detail"===e.value&&(s=A.bottom-z+1),I({scrollTop:s,duration:200})}(e)},{default:i((()=>[u(k,{class:_(["tab-title",E.curTab===e.value?"cur-tab-title":""])},{default:i((()=>[x(y(e.label),1)])),_:2},1032,["class"]),g(u(k,{class:"tab-line"},null,512),[[w,E.curTab===e.value]])])),_:2},1032,["onClick"])))),128))])),_:1})])),_:1},8,["style"]),u(k,{class:"ui-tabbar-box",style:d([{opacity:E.tabOpacityVal}])},{default:i((()=>[u(k,{class:"ui-tabbar ss-flex ss-col-center ss-row-between"},{default:i((()=>[u(k,{class:"ss-flex ss-col-center ss-row-between"},{default:i((()=>[S.collectIcon?(r(),n(k,{key:0,class:"detail-tabbar-item ss-flex ss-flex-col ss-row-center ss-col-center",onClick:J},{default:i((()=>[S.modelValue.favorite?(r(),n($,{key:0,class:"item-icon",src:f(s).$url.static("/static/images/collect_1.gif"),mode:"aspectFit"},null,8,["src"])):(r(),n($,{key:1,class:"item-icon",src:f(s).$url.static("/static/images/collect_0.png"),mode:"aspectFit"},null,8,["src"]))])),_:1})):v("",!0),S.shareIcon?(r(),n(k,{key:1,class:"detail-tabbar-item ss-flex ss-flex-col ss-row-center ss-col-center",onClick:t[0]||(t[0]=e=>f(h)(S.modelValue.id))},{default:i((()=>[u($,{class:"item-icon",src:f(s).$url.static("/static/images/share.png"),mode:"aspectFit"},null,8,["src"])])),_:1})):v("",!0)])),_:1})])),_:1})])),_:1},8,["style"])])),_:1},8,["style"])])),_:1})}}},[["__scopeId","data-v-a461b514"]]),U=z({__name:"detail-cell",props:{label:{type:String,default:""},value:{type:String,default:""}},emits:["click"],setup(e,{emit:s}){const t=s,a=()=>{t("click")};return(s,t)=>{const l=L,c=T,o=S;return r(),n(l,{class:"detail-cell-wrap ss-flex ss-col-center ss-row-between",onClick:a},{default:i((()=>[u(l,{class:"label-text"},{default:i((()=>[x(y(e.label),1)])),_:1}),u(l,{class:"cell-content ss-line-1 ss-flex-1"},{default:i((()=>[x(y(e.value),1)])),_:1}),u(o,{class:"ss-reset-button"},{default:i((()=>[u(c,{class:"_icon-forward right-forwrad-icon"})])),_:1})])),_:1})}}},[["__scopeId","data-v-879372e1"]]),q={__name:"detail-cell-sku",props:{modelValue:{type:Array,default:()=>[]},sku:{type:Object}},setup(s){const t=s,a=e((()=>{var e;if(!(null==(e=t.sku)?void 0:e.id))return"请选择商品规格";let s="";return t.sku.properties.forEach((e=>{s+=e.propertyName+":"+e.valueName+" "})),s}));return(e,s)=>(r(),n(U,{label:"选择",value:a.value},null,8,["value"]))}},A=""+new URL("index-53a28843.png",import.meta.url).href,J=""+new URL("cart-ed457535.png",import.meta.url).href,D=z({__name:"detail-tabbar",props:{modelValue:{type:Object,default(){}},bg:{type:String,default:"bg-white"},bgStyles:{type:Object,default(){}},ui:{type:String,default:""},noFixed:{type:Boolean,default:!1},topRadius:{type:Number,default:0},collectIcon:{type:Boolean,default:!0},serviceIcon:{type:Boolean,default:!0},shareIcon:{type:Boolean,default:!0}},setup(e){t({});const a=()=>{s.$router.go("/pages/index/index")};return(t,l)=>{const d=j,m=L,b=c(o("su-fixed"),R);return r(),n(b,{bottom:"",placeholder:"",bg:"bg-white"},{default:i((()=>[u(m,{class:"ui-tabbar-box"},{default:i((()=>[u(m,{class:"ui-tabbar ss-flex ss-col-center ss-row-between"},{default:i((()=>[e.serviceIcon?(r(),n(m,{key:0,class:"detail-tabbar-item ss-flex ss-flex-col ss-row-center ss-col-center",onClick:a},{default:i((()=>[u(d,{class:"item-icon",src:A,mode:"aspectFit"}),u(m,{class:"item-title"},{default:i((()=>[x("首页")])),_:1})])),_:1})):v("",!0),e.shareIcon?(r(),n(m,{key:1,class:"detail-tabbar-item ss-flex ss-flex-col ss-row-center ss-col-center",onClick:l[0]||(l[0]=e=>{f(s).$router.go("/pages/index/cart")})},{default:i((()=>[u(d,{class:"item-icon",src:J,mode:"aspectFit"}),u(m,{class:"item-title"},{default:i((()=>[x("购物车")])),_:1})])),_:1})):v("",!0),B(t.$slots,"default",{},void 0,!0)])),_:3})])),_:3})])),_:3})}}},[["__scopeId","data-v-169918cd"]]),G=z({__name:"detail-skeleton",setup(t){const a=e((()=>s.$store("sys")));return(e,s)=>{const t=L,l=S,d=c(o("su-fixed"),R);return r(),n(t,{class:_(["skeleton-wrap",["theme-"+a.value.mode,"main-"+a.value.theme,"font-"+a.value.fontSize]])},{default:i((()=>[u(t,{class:"skeleton-banner"}),u(t,{class:"container-box"},{default:i((()=>[u(t,{class:"container-box-strip title ss-m-b-58"}),u(t,{class:"container-box-strip ss-m-b-20"}),u(t,{class:"container-box-strip ss-m-b-20"}),u(t,{class:"container-box-strip w-364"})])),_:1}),u(t,{class:"container-box"},{default:i((()=>[u(t,{class:"ss-flex ss-row-between ss-m-b-34"},{default:i((()=>[u(t,{class:"container-box-strip w-380"}),u(t,{class:"circle"})])),_:1}),u(t,{class:"ss-flex ss-row-between ss-m-b-34"},{default:i((()=>[u(t,{class:"container-box-strip w-556"}),u(t,{class:"circle"})])),_:1}),u(t,{class:"ss-flex ss-row-between"},{default:i((()=>[u(t,{class:"container-box-strip w-556"}),u(t,{class:"circle"})])),_:1})])),_:1}),u(t,{class:"container-box"},{default:i((()=>[u(t,{class:"container-box-strip w-198 ss-m-b-42"}),u(t,{class:"ss-flex"},{default:i((()=>[u(t,{class:"circle ss-m-r-12"}),u(t,{class:"container-box-strip w-252"})])),_:1})])),_:1}),u(d,{bottom:"",placeholder:"",bg:"bg-white"},{default:i((()=>[u(t,{class:"ui-tabbar-box"},{default:i((()=>[u(t,{class:"foot ss-flex ss-col-center"},{default:i((()=>[u(t,{class:"ss-m-r-54 ss-m-l-32"},{default:i((()=>[u(t,{class:"rec ss-m-b-8"}),u(t,{class:"oval"})])),_:1}),u(t,{class:"ss-m-r-54"},{default:i((()=>[u(t,{class:"rec ss-m-b-8"}),u(t,{class:"oval"})])),_:1}),u(t,{class:"ss-m-r-50"},{default:i((()=>[u(t,{class:"rec ss-m-b-8"}),u(t,{class:"oval"})])),_:1}),u(l,{class:"ss-reset-button add-btn ui-Shadow-Main"}),u(l,{class:"ss-reset-button buy-btn ui-Shadow-Main"})])),_:1})])),_:1})])),_:1})])),_:1},8,["class"])}}},[["__scopeId","data-v-fc3678c9"]]),K=z({__name:"detail-comment-card",props:{goodsId:{type:[Number,String],default:0}},setup(e){const a=e,l=t({commentList:[],total:0});return F((()=>{!async function(e){const{data:s}=await O.getCommentPage(e,1,3,0);l.commentList=s.list,l.total=s.total}(a.goodsId)})),(t,a)=>{const d=L,_=S,g=T,w=c(o("s-empty"),E);return r(),n(d,{class:"detail-comment-card bg-white"},{default:i((()=>[u(d,{class:"card-header ss-flex ss-col-center ss-row-between ss-p-b-30"},{default:i((()=>[u(d,{class:"ss-flex ss-col-center"},{default:i((()=>[u(d,{class:"line"}),u(d,{class:"title ss-m-l-20 ss-m-r-10"},{default:i((()=>[x("评价")])),_:1}),u(d,{class:"des"},{default:i((()=>[x("("+y(l.total)+")",1)])),_:1})])),_:1}),l.commentList.length>0?(r(),n(d,{key:0,class:"ss-flex ss-col-center",onClick:a[0]||(a[0]=t=>f(s).$router.go("/pages/goods/comment/list",{id:e.goodsId}))},{default:i((()=>[u(_,{class:"ss-reset-button more-btn"},{default:i((()=>[x("查看全部")])),_:1}),u(g,{class:"cicon-forward"})])),_:1})):v("",!0)])),_:1}),u(d,{class:"card-content"},{default:i((()=>[(r(!0),m(b,null,p(l.commentList,(e=>(r(),n(d,{class:"comment-box ss-p-y-30",key:e.id},{default:i((()=>[u(H,{item:e},null,8,["item"])])),_:2},1024)))),128)),0===l.commentList.length?(r(),n(w,{key:0,paddingTop:"0",icon:"/static/comment-empty.png",text:"期待您的第一个评价"})):v("",!0)])),_:1})])),_:1})}}},[["__scopeId","data-v-f2cb4fc6"]]),Q=z({__name:"detail-content-card",props:{content:{type:String,default:""}},setup:e=>(s.$platform.device,(s,t)=>{const a=L,l=c(o("mp-html"),M);return r(),n(a,{class:"detail-content-card bg-white ss-m-x-20 ss-p-t-20"},{default:i((()=>[u(a,{class:"card-header ss-flex ss-col-center ss-m-b-30 ss-m-l-20"},{default:i((()=>[u(a,{class:"line"}),u(a,{class:"title ss-m-l-20 ss-m-r-20"},{default:i((()=>[x("详情")])),_:1})])),_:1}),u(a,{class:"card-content"},{default:i((()=>[u(l,{content:e.content},null,8,["content"])])),_:1})])),_:1})})},[["__scopeId","data-v-05c8b18d"]]);export{q as _,G as a,K as b,Q as c,P as d,D as e};