!function(){function t(e){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t(e)}function e(){"use strict";/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */e=function(){return r};var r={},o=Object.prototype,n=o.hasOwnProperty,i=Object.defineProperty||function(t,e,r){t[e]=r.value},a="function"==typeof Symbol?Symbol:{},c=a.iterator||"@@iterator",l=a.asyncIterator||"@@asyncIterator",s=a.toStringTag||"@@toStringTag";function u(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(I){u=function(t,e,r){return t[e]=r}}function d(t,e,r,o){var n=e&&e.prototype instanceof p?e:p,a=Object.create(n.prototype),c=new P(o||[]);return i(a,"_invoke",{value:j(t,r,c)}),a}function f(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(I){return{type:"throw",arg:I}}}r.wrap=d;var m={};function p(){}function h(){}function v(){}var g={};u(g,c,(function(){return this}));var _=Object.getPrototypeOf,y=_&&_(_(z([])));y&&y!==o&&n.call(y,c)&&(g=y);var b=v.prototype=p.prototype=Object.create(g);function k(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function w(e,r){function o(i,a,c,l){var s=f(e[i],e,a);if("throw"!==s.type){var u=s.arg,d=u.value;return d&&"object"==t(d)&&n.call(d,"__await")?r.resolve(d.__await).then((function(t){o("next",t,c,l)}),(function(t){o("throw",t,c,l)})):r.resolve(d).then((function(t){u.value=t,c(u)}),(function(t){return o("throw",t,c,l)}))}l(s.arg)}var a;i(this,"_invoke",{value:function(t,e){function n(){return new r((function(r,n){o(t,e,r,n)}))}return a=a?a.then(n,n):n()}})}function j(t,e,r){var o="suspendedStart";return function(n,i){if("executing"===o)throw new Error("Generator is already running");if("completed"===o){if("throw"===n)throw i;return C()}for(r.method=n,r.arg=i;;){var a=r.delegate;if(a){var c=x(a,r);if(c){if(c===m)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===o)throw o="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o="executing";var l=f(t,e,r);if("normal"===l.type){if(o=r.done?"completed":"suspendedYield",l.arg===m)continue;return{value:l.arg,done:r.done}}"throw"===l.type&&(o="completed",r.method="throw",r.arg=l.arg)}}}function x(t,e){var r=e.method,o=t.iterator[r];if(void 0===o)return e.delegate=null,"throw"===r&&t.iterator.return&&(e.method="return",e.arg=void 0,x(t,e),"throw"===e.method)||"return"!==r&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+r+"' method")),m;var n=f(o,t.iterator,e.arg);if("throw"===n.type)return e.method="throw",e.arg=n.arg,e.delegate=null,m;var i=n.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,m):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,m)}function S(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function L(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function P(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(S,this),this.reset(!0)}function z(t){if(t){var e=t[c];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,o=function e(){for(;++r=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return r("end");if(i.tryLoc<=this.prev){var c=n.call(i,"catchLoc"),l=n.call(i,"finallyLoc");if(c&&l){if(this.prev=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),L(r),m}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var o=r.completion;if("throw"===o.type){var n=o.arg;L(r)}return n}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:z(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),m}},r}function r(t,e,r,o,n,i,a){try{var c=t[i](a),l=c.value}catch(s){return void r(s)}c.done?e(l):Promise.resolve(l).then(o,n)}function o(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var o,n,i,a,c=[],l=!0,s=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;l=!1}else for(;!(l=(o=i.call(r)).done)&&(c.push(o.value),c.length!==e);l=!0);}catch(u){s=!0,n=u}finally{try{if(!l&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(s)throw n}}return c}}(t,e)||function(t,e){if(!t)return;if("string"==typeof t)return n(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return n(t,e)}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function n(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,o=new Array(e);r1)){var t,e=P.offsetX,o=P.offsetY,n=Date.now()-j;e.value1?1:2,N(t,2===t||T.value?{x:P.startX.value,y:P.startY.value}:void 0)):l=setTimeout((function(){x("close"),l=null}),250):n>w&&x("longPress"))}},Z=function(e){var r=!1;if((L.moving||L.zooming)&&(r=!0,L.moving&&o===L.moveX&&n===L.moveY&&(r=!1),!e.touches.length)){L.zooming&&(L.moveX=g(L.moveX,-W.value,W.value),L.moveY=g(L.moveY,-B.value,B.value),L.zooming=!1),L.moving=!1,o=0,n=0,i=1,L.scale<1&&D();var a=+t.maxZoom;L.scale>a&&N(a,c)}v(e,r),A(),P.reset()},G=function(){var e=t.rootWidth,r=t.rootHeight,o=r/e,n=L.imageRatio;I.value=L.imageRatio>o&&n<2.6,T.value=L.imageRatio>o&&n>=2.6,T.value&&(E=(n*e-r)/2,L.moveY=E,L.initializing=!0,_((function(){L.initializing=!1}))),D()},X=function(t){var e=t.target,r=e.naturalWidth,o=e.naturalHeight;L.imageRatio=o/r,G()};return m((function(){return t.active}),D),m((function(){return t.show}),(function(t){t||D()})),m((function(){return[t.rootWidth,t.rootHeight]}),G),p("touchmove",(function(t){var e=t.touches;if(P.move(t),L.moving){var r=P.deltaX,l=P.deltaY,s=r.value+o,u=l.value+n;if((s>W.value||s<-W.value)&&!H&&P.isHorizontal())return void(L.moving=!1);H=!0,v(t,!0),L.moveX=g(s,-W.value,W.value),L.moveY=g(u,-B.value,B.value)}if(L.zooming&&(v(t,!0),2===e.length)){var d=ft(e),f=i*d/a;c=function(t){return{x:(t[0].clientX+t[1].clientX)/2,y:(t[0].clientY+t[1].clientY)/2}}(e),N(f,c)}}),{target:f((function(){var t;return null==(t=C.value)?void 0:t.$el}))}),function(){var e={loading:function(){return h(y,{type:"spinner"},null)}};return h(et,{ref:C,class:mt("swipe-item"),onTouchstartPassive:Y,onTouchend:Z,onTouchcancel:Z},{default:function(){return[S.image?h("div",{class:mt("image-wrap")},[S.image({src:t.src})]):h(ot,{ref:z,src:t.src,fit:"contain",class:mt("image",{vertical:I.value}),style:O.value,onLoad:X},e)]}})}}}),ht=o(i("image-preview"),2),vt=ht[0],gt=ht[1],_t=["show","teleport","transition","overlayStyle","closeOnPopstate"],yt={show:Boolean,loop:j,images:x(),minZoom:S(1/3),maxZoom:S(3),overlay:j,closeable:Boolean,showIndex:j,className:L,closeIcon:P("clear"),transition:String,beforeClose:Function,overlayClass:L,overlayStyle:Object,swipeDuration:S(300),startPosition:S(0),showIndicators:Boolean,closeOnPopstate:j,closeIconPosition:P("top-right"),teleport:[String,Object]},bt=a({name:vt,props:yt,emits:["scale","close","closed","change","longPress","update:show"],setup:function(t,e){var r=e.emit,o=e.slots,n=d(),i=s({active:0,rootWidth:0,rootHeight:0,disableZoom:!1}),a=function(){if(n.value){var t=b(n.value.$el);i.rootWidth=t.width,i.rootHeight=t.height,n.value.resize()}},c=function(t){return r("scale",t)},l=function(t){return r("update:show",t)},u=function(){H(t.beforeClose,{args:[i.active],done:function(){return l(!1)}})},f=function(t){t!==i.active&&(i.active=t,r("change",t))},p=function(){if(t.showIndex)return h("div",{class:gt("index")},[o.index?o.index({index:i.active}):"".concat(i.active+1," / ").concat(t.images.length)])},v=function(){if(o.cover)return h("div",{class:gt("cover")},[o.cover()])},g=function(){i.disableZoom=!0},_=function(){i.disableZoom=!1},y=function(){if(t.closeable)return h(D,{role:"button",name:t.closeIcon,class:[gt("close-icon",t.closeIconPosition),N],onClick:u},null)},k=function(){return r("closed")},w=function(t,e){var r;return null==(r=n.value)?void 0:r.swipeTo(t,e)};return z({swipeTo:w}),C(a),m([I,T],a),m((function(){return t.startPosition}),(function(t){return f(+t)})),m((function(){return t.show}),(function(e){var o=t.images,n=t.startPosition;e?(f(+n),E((function(){a(),w(+n,{immediate:!0})}))):r("close",{index:i.active,url:o[i.active]})})),function(){return h(B,O({class:[gt(),t.className],overlayClass:[gt("overlay"),t.overlayClass],onClosed:k,"onUpdate:show":l},W(t,_t)),{default:function(){return[y(),h(rt,{ref:n,lazyRender:!0,loop:t.loop,class:gt("swipe"),duration:t.swipeDuration,initialSwipe:t.startPosition,showIndicators:t.showIndicators,indicatorColor:"white",onChange:f,onDragEnd:_,onDragStart:g},{default:function(){return[t.images.map((function(e,n){return h(pt,{src:e,show:t.show,active:i.active,maxZoom:t.maxZoom,minZoom:t.minZoom,rootWidth:i.rootWidth,rootHeight:i.rootHeight,disableZoom:i.disableZoom,onScale:c,onClose:u,onLongPress:function(){return r("longPress",{index:n})}},{image:o.image})}))]}}),p(),v()]}})}}}),kt={loop:!0,images:[],maxZoom:3,minZoom:1/3,onScale:void 0,onClose:void 0,onChange:void 0,teleport:"body",className:"",showIndex:!0,closeable:!1,closeIcon:"clear",transition:void 0,beforeClose:void 0,overlayStyle:void 0,overlayClass:void 0,startPosition:0,swipeDuration:300,showIndicators:!1,closeOnPopstate:!0,closeIconPosition:"top-right"};var wt=function(t){var e,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(Y)return dt||(e=Z({setup:function(){var t=G(),e=t.state,r=t.toggle,o=function(){e.images=[]};return function(){return h(bt,O(e,{onClosed:o,"onUpdate:show":r}),null)}}}),dt=e.instance),t=Array.isArray(t)?{images:t,startPosition:r}:t,dt.open(A({},kt,t)),dt};X(bt);var jt=o(i("submit-bar"),3),xt=jt[0],St=jt[1],Lt=jt[2],Pt={tip:String,label:String,price:Number,tipIcon:String,loading:Boolean,currency:P("¥"),disabled:Boolean,textAlign:String,buttonText:String,buttonType:P("danger"),buttonColor:String,suffixLabel:String,placeholder:Boolean,decimalLength:S(2),safeAreaInsetBottom:j},zt=a({name:xt,props:Pt,emits:["submit"],setup:function(t,e){var r=e.emit,o=e.slots,n=d(),i=R(n,St),a=function(){var e=t.price,r=t.label,o=t.currency,n=t.textAlign,i=t.suffixLabel,a=t.decimalLength;if("number"==typeof e){var c=(e/100).toFixed(+a).split("."),l=a?".".concat(c[1]):"";return h("div",{class:St("text"),style:{textAlign:n}},[h("span",null,[r||Lt("label")]),h("span",{class:St("price")},[o,h("span",{class:St("price-integer")},[c[0]]),l]),i&&h("span",{class:St("suffix-label")},[i])])}},c=function(){var e,r=t.tip,n=t.tipIcon;if(o.tip||r)return h("div",{class:St("tip")},[n&&h(D,{class:St("tip-icon"),name:n},null),r&&h("span",{class:St("tip-text")},[r]),null==(e=o.tip)?void 0:e.call(o)])},l=function(){return r("submit")},s=function(){var e,r;return h("div",{ref:n,class:[St(),{"van-safe-area-bottom":t.safeAreaInsetBottom}]},[null==(e=o.top)?void 0:e.call(o),c(),h("div",{class:St("bar")},[null==(r=o.default)?void 0:r.call(o),a(),o.button?o.button():h(M,{round:!0,type:t.buttonType,text:t.buttonText,class:St("button",t.buttonType),color:t.buttonColor,loading:t.loading,disabled:t.disabled,onClick:l},null)])])};return function(){return t.placeholder?i(s):s()}}}),Ct=X(zt),It="_swipeItemImg_tka2j_1",Tt="_swipe_tka2j_1",Et="_custom-indicator_tka2j_7",Ot="_goodsHead_tka2j_17",Wt="_priceGroup_tka2j_24",Bt="_price_tka2j_24",Nt="_goodsName_tka2j_47",Dt="_row_tka2j_53",Ht="_col_tka2j_57",Yt="_radio-group_tka2j_61",At="_radio_tka2j_61",Zt="_badge_tka2j_96",Gt="_section_tka2j_100",Xt="_detail_tka2j_104",Rt="_photoDetail_tka2j_129",Mt="_goodsDetail_tka2j_133",Ft="_actionBar_tka2j_136",Jt="_addCertBtn_tka2j_163",$t="_buyGroup_tka2j_172",qt="_selectWrap_tka2j_178",Ut="_imagesOverlayWrap_tka2j_242";var Vt=tt();t("default",a({name:"goods-detail",data:function(){return{id:this.$route.query.id,albumPics:[],product:{},radio:0,skuStockListTemp:[],detailMobileHtml:"",loading:!1}},computed:{skuStockList:function(){var t=this.product,e=this.skuStockListTemp.length>0?this.skuStockListTemp:[{id:-1,price:t.price,pic:t.pic,stock:t.stock,spData:null}];return e.forEach((function(t){if(t.spData){var e=JSON.parse(t.spData);t.spDataJson=e.reduce((function(t,e){return t+=e.value}),""),t.sku=e.reduce((function(t,e){return t.push("".concat(e.key,": ").concat(e.value)),t}),[]).join(",")}else t.spDataJson="默认"})),e},getPrice:function(){var t=this,e=this.skuStockList.filter((function(e){return e.id==t.radio}));return e&&Array.isArray(e)&&e.length?e[0].price:0}},mounted:function(){var t,o=this;return(t=e().mark((function t(){var r,n,i,a,c;return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,o.loading=!0,t.next=4,F.get("/edu-app/open/mall/product/detail/".concat(o.id));case 4:if(r=t.sent,o.loading=!1,n=r.data||{},o.albumPics=[n.product.pic].concat(n.product.albumPics.split(",")).filter((function(t){return t})),o.product=n.product,o.skuStockListTemp=n.skuStockList||[],!o.skuStockListTemp.length){t.next=21;break}i=o.skuStockListTemp.length,a=0;case 13:if(!(a=0)){t.next=18;break}return o.radio=c.id,t.abrupt("break",21);case 18:a++,t.next=13;break;case 21:o.detailMobileHtml=n.product.detailMobileHtml,t.next=26;break;case 24:t.prev=24,t.t0=t.catch(0);case 26:case"end":return t.stop()}}),t,null,[[0,24]])})),function(){var e=this,o=arguments;return new Promise((function(n,i){var a=t.apply(e,o);function c(t){r(a,n,i,c,l,"next",t)}function l(t){r(a,n,i,c,l,"throw",t)}c(void 0)}))})()},methods:{onPreview:function(t){wt({images:this.albumPics,startPosition:t,closeable:!0,className:Ut})},onShowImg:function(t){if("img"===t.srcElement.localName){var e=0,r=document.querySelectorAll(".msgWrap img"),o=Array.from(r).map((function(r,o){return t.srcElement==r&&(e=o),r.src}));wt({images:o,startPosition:e,closeable:!0,className:Ut})}},onShowCart:function(){var t=this,e={price:this.product.price,originalPrice:this.product.originalPrice,pic:this.product.pic,stock:this.product.stock,skuStockList:this.skuStockListTemp.length?this.skuStockListTemp:void 0,brandName:this.product.brandName,productCategoryId:this.product.productCategoryId,name:this.product.name,productSn:this.product.productSn,productSubTitle:this.product.subTitle,count:1,id:this.product.id},r=!1;Vt.getGoods.forEach((function(e){e.id===t.product.id&&(r=!0,e.count+=1)})),r||Vt.setGoods(e),J("添加成功")}},render:function(){var t,e=this,r=this.product,o=this.skuStockList.find((function(t){return t.id===e.radio}));return h("div",{class:Mt},[h(rt,{class:Tt,lazyRender:!0},{default:function(){return[e.albumPics.map((function(t,r){return h(et,null,{default:function(){return[h(ot,{class:It,src:t,onClick:function(){return e.onPreview(r)},fit:"cover"},null)]}})}))]},indicator:function(t){return t.total>1&&h("div",{class:Et},[(t.active||0)+1,$(" / "),t.total])}}),h(nt,{border:!1,class:[Ot,"mb12"]},{default:function(){return[h(it,{center:!0,border:!1},{title:function(){return h("div",{class:Wt},[h("span",{class:Bt},[h("i",null,[$("¥")]),q(e.getPrice)])])}}),h(it,{center:!0,border:!1,title:r.name,titleClass:[Nt,"van-ellipsis"]},null)]}}),h(at,{class:[Dt,"mb12"]},{default:function(){return[h(ct,{span:4,class:Ht},{default:function(){return[$("规格")]}}),h(ct,{span:20},{default:function(){return[o?h("div",{class:qt},[o.stock<=0?"当前款式暂时缺货":"已选择 ".concat(o.spDataJson)]):h("div",null,[$("请选择 规格")]),h(lt,{class:Yt,modelValue:e.radio,"onUpdate:modelValue":function(t){return e.radio=t}},(r=t=e.skuStockList.map((function(t){var r=t.id===e.radio,o=r?"primary":"default";return h(U,{position:"top-right",content:t.stock<=0?"缺货":"",color:"#999999",class:Zt,offset:[-20,0]},{default:function(){return[h(st,{class:At,name:t.id,disabled:t.stock<=0,onClick:function(){t.stock<=0||(e.radio=t.id)}},{default:function(){return[h(ut,{size:"large",plain:r,type:o},{default:function(){return[t.spDataJson]}})]}})]}})})),"function"==typeof r||"[object Object]"===Object.prototype.toString.call(r)&&!Q(r)?t:{default:function(){return[t]}}))];var r}})]}}),this.detailMobileHtml&&h("div",{class:[Gt]},[h("div",{class:Xt},[h("span",null,[$("图文详情")])]),h("div",{class:[Rt,"msgWrap"],onClick:this.onShowImg,innerHTML:this.detailMobileHtml},null)]),!this.loading&&h(V,null,[h(Ct,{class:Ft,"safe-area-inset-bottom":!0},{button:function(){return h("div",{class:$t},[h(K,{type:"primary",class:Jt,text:"添加购买",onClick:function(){return e.onShowCart()}},null)])}})])])}}))}}}))}();