!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 o};var o={},r=Object.prototype,n=r.hasOwnProperty,i=Object.defineProperty||function(t,e,o){t[e]=o.value},a="function"==typeof Symbol?Symbol:{},u=a.iterator||"@@iterator",c=a.asyncIterator||"@@asyncIterator",s=a.toStringTag||"@@toStringTag";function l(t,e,o){return Object.defineProperty(t,e,{value:o,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{l({},"")}catch(I){l=function(t,e,o){return t[e]=o}}function d(t,e,o,r){var n=e&&e.prototype instanceof p?e:p,a=Object.create(n.prototype),u=new C(r||[]);return i(a,"_invoke",{value:k(t,o,u)}),a}function f(t,e,o){try{return{type:"normal",arg:t.call(e,o)}}catch(I){return{type:"throw",arg:I}}}o.wrap=d;var m={};function p(){}function h(){}function g(){}var v={};l(v,u,(function(){return this}));var b=Object.getPrototypeOf,_=b&&b(b(j([])));_&&_!==r&&n.call(_,u)&&(v=_);var y=g.prototype=p.prototype=Object.create(v);function w(t){["next","throw","return"].forEach((function(e){l(t,e,(function(t){return this._invoke(e,t)}))}))}function x(e,o){function r(i,a,u,c){var s=f(e[i],e,a);if("throw"!==s.type){var l=s.arg,d=l.value;return d&&"object"==t(d)&&n.call(d,"__await")?o.resolve(d.__await).then((function(t){r("next",t,u,c)}),(function(t){r("throw",t,u,c)})):o.resolve(d).then((function(t){l.value=t,u(l)}),(function(t){return r("throw",t,u,c)}))}c(s.arg)}var a;i(this,"_invoke",{value:function(t,e){function n(){return new o((function(o,n){r(t,e,o,n)}))}return a=a?a.then(n,n):n()}})}function k(t,e,o){var r="suspendedStart";return function(n,i){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===n)throw i;return z()}for(o.method=n,o.arg=i;;){var a=o.delegate;if(a){var u=S(a,o);if(u){if(u===m)continue;return u}}if("next"===o.method)o.sent=o._sent=o.arg;else if("throw"===o.method){if("suspendedStart"===r)throw r="completed",o.arg;o.dispatchException(o.arg)}else"return"===o.method&&o.abrupt("return",o.arg);r="executing";var c=f(t,e,o);if("normal"===c.type){if(r=o.done?"completed":"suspendedYield",c.arg===m)continue;return{value:c.arg,done:o.done}}"throw"===c.type&&(r="completed",o.method="throw",o.arg=c.arg)}}}function S(t,e){var o=e.method,r=t.iterator[o];if(void 0===r)return e.delegate=null,"throw"===o&&t.iterator.return&&(e.method="return",e.arg=void 0,S(t,e),"throw"===e.method)||"return"!==o&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+o+"' method")),m;var n=f(r,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 L(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 P(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function C(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(L,this),this.reset(!0)}function j(t){if(t){var e=t[u];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,r=function e(){for(;++o=0;--r){var i=this.tryEntries[r],a=i.completion;if("root"===i.tryLoc)return o("end");if(i.tryLoc<=this.prev){var u=n.call(i,"catchLoc"),c=n.call(i,"finallyLoc");if(u&&c){if(this.prev=0;--o){var r=this.tryEntries[o];if(r.tryLoc<=this.prev&&n.call(r,"finallyLoc")&&this.prev=0;--e){var o=this.tryEntries[e];if(o.finallyLoc===t)return this.complete(o.completion,o.afterLoc),P(o),m}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var o=this.tryEntries[e];if(o.tryLoc===t){var r=o.completion;if("throw"===r.type){var n=r.arg;P(o)}return n}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,o){return this.delegate={iterator:j(t),resultName:e,nextLoc:o},"next"===this.method&&(this.arg=void 0),m}},o}function o(t,e,o,r,n,i,a){try{var u=t[i](a),c=u.value}catch(s){return void o(s)}u.done?e(c):Promise.resolve(c).then(r,n)}function r(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var o=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=o){var r,n,i,a,u=[],c=!0,s=!1;try{if(i=(o=o.call(t)).next,0===e){if(Object(o)!==o)return;c=!1}else for(;!(c=(r=i.call(o)).done)&&(u.push(r.value),u.length!==e);c=!0);}catch(l){s=!0,n=l}finally{try{if(!c&&null!=o.return&&(a=o.return(),Object(a)!==a))return}finally{if(s)throw n}}return u}}(t,e)||function(t,e){if(!t)return;if("string"==typeof t)return n(t,e);var o=Object.prototype.toString.call(t).slice(8,-1);"Object"===o&&t.constructor&&(o=t.constructor.name);if("Map"===o||"Set"===o)return Array.from(t);if("Arguments"===o||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o))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 o=0,r=new Array(e);oo})),P=f((function(){var t=x.scale,e=x.moveX,o=x.moveY,r=x.moving,n={transitionDuration:x.zooming||r?"0s":".3s"};if(1!==t){var i=e/t,a=o/t;n.transform="scale(".concat(t,", ").concat(t,") translate(").concat(i,"px, ").concat(a,"px)")}return n})),C=f((function(){if(x.imageRatio){var e=t.rootWidth,o=t.rootHeight,r=L.value?o/x.imageRatio:e;return Math.max(0,(x.scale*r-e)/2)}return 0})),j=f((function(){if(x.imageRatio){var e=t.rootWidth,o=t.rootHeight,r=L.value?o:e*x.imageRatio;return Math.max(0,(x.scale*r-o)/2)}return 0})),z=function(e){(e=v(e,+t.minZoom,+t.maxZoom+1))!==x.scale&&(x.scale=e,y("scale",{scale:e,index:t.active}))},I=function(){z(1),x.moveX=0,x.moveY=0},T=!1,O=function(e){var u=e.touches;if(2!==(o=u.length)||!t.disableZoom){var s=k.offsetX;k.start(e),r=x.moveX,n=x.moveY,c=Date.now(),T=!1,x.moving=1===o&&1!==x.scale,x.zooming=2===o&&!s.value,x.zooming&&(i=x.scale,a=ct(e.touches))}},E=function(){if(!(o>1)){var t,e=k.offsetX,r=k.offsetY,n=Date.now()-c;e.value<5&&r.value<5&&(n<250?u?(clearTimeout(u),u=null,t=x.scale>1?1:2,z(t),x.moveX=0,x.moveY=0):u=setTimeout((function(){y("close"),u=null}),250):n>_&&y("longPress"))}},W=function(e){var o=!1;if((x.moving||x.zooming)&&(o=!0,x.moving&&r===x.moveX&&n===x.moveY&&(o=!1),!e.touches.length)){x.zooming&&(x.moveX=v(x.moveX,-C.value,C.value),x.moveY=v(x.moveY,-j.value,j.value),x.zooming=!1),x.moving=!1,r=0,n=0,i=1,x.scale<1&&I();var a=+t.maxZoom;x.scale>a&&(x.scale=a)}g(e,o),E(),k.reset()},G=function(t){var e=t.target,o=e.naturalWidth,r=e.naturalHeight;x.imageRatio=r/o};return m((function(){return t.active}),I),m((function(){return t.show}),(function(t){t||I()})),p("touchmove",(function(t){var e=t.touches;if(k.move(t),x.moving){var o=k.deltaX,u=k.deltaY,c=o.value+r,s=u.value+n;if((c>C.value||c<-C.value)&&!T&&k.isHorizontal())return void(x.moving=!1);T=!0,g(t,!0),x.moveX=v(c,-C.value,C.value),x.moveY=v(s,-j.value,j.value)}if(x.zooming&&(g(t,!0),2===e.length)){var l=ct(e);z(i*l/a)}}),{target:f((function(){var t;return null==(t=S.value)?void 0:t.$el}))}),function(){var e={loading:function(){return h(b,{type:"spinner"},null)}};return h(K,{ref:S,class:st("swipe-item"),onTouchstartPassive:O,onTouchend:W,onTouchcancel:W},{default:function(){return[w.image?h("div",{class:st("image-wrap")},[w.image({src:t.src})]):h(tt,{src:t.src,fit:"contain",class:st("image",{vertical:L.value}),style:P.value,onLoad:G},e)]}})}}}),dt=r(i("image-preview"),2),ft=dt[0],mt=dt[1],pt=["show","teleport","transition","overlayStyle","closeOnPopstate"],ht={show:Boolean,loop:y,images:w(),minZoom:x(1/3),maxZoom:x(3),overlay:y,closeable:Boolean,showIndex:y,className:k,closeIcon:S("clear"),transition:String,beforeClose:Function,overlayClass:k,overlayStyle:Object,swipeDuration:x(300),startPosition:x(0),showIndicators:Boolean,closeOnPopstate:y,closeIconPosition:S("top-right"),teleport:[String,Object]},gt=a({name:ft,props:ht,emits:["scale","close","closed","change","longPress","update:show"],setup:function(t,e){var o=e.emit,r=e.slots,n=d(),i=s({active:0,rootWidth:0,rootHeight:0,disableZoom:!1}),a=function(){if(n.value){var t=E(n.value.$el);i.rootWidth=t.width,i.rootHeight=t.height,n.value.resize()}},u=function(t){return o("scale",t)},c=function(t){return o("update:show",t)},l=function(){N(t.beforeClose,{args:[i.active],done:function(){return c(!1)}})},f=function(t){t!==i.active&&(i.active=t,o("change",t))},p=function(){if(t.showIndex)return h("div",{class:mt("index")},[r.index?r.index({index:i.active}):"".concat(i.active+1," / ").concat(t.images.length)])},g=function(){if(r.cover)return h("div",{class:mt("cover")},[r.cover()])},v=function(){i.disableZoom=!0},b=function(){i.disableZoom=!1},_=function(){if(t.closeable)return h(G,{role:"button",name:t.closeIcon,class:[mt("close-icon",t.closeIconPosition),W],onClick:l},null)},y=function(){return o("closed")},w=function(t,e){var o;return null==(o=n.value)?void 0:o.swipeTo(t,e)};return L({swipeTo:w}),P(a),m([C,j],a),m((function(){return t.startPosition}),(function(t){return f(+t)})),m((function(){return t.show}),(function(e){var r=t.images,n=t.startPosition;e?(f(+n),z((function(){a(),w(+n,{immediate:!0})}))):o("close",{index:i.active,url:r[i.active]})})),function(){return h(O,I({class:[mt(),t.className],overlayClass:[mt("overlay"),t.overlayClass],onClosed:y,"onUpdate:show":c},T(t,pt)),{default:function(){return[_(),h(Q,{ref:n,lazyRender:!0,loop:t.loop,class:mt("swipe"),duration:t.swipeDuration,initialSwipe:t.startPosition,showIndicators:t.showIndicators,indicatorColor:"white",onChange:f,onDragEnd:b,onDragStart:v},{default:function(){return[t.images.map((function(e,n){return h(lt,{src:e,show:t.show,active:i.active,maxZoom:t.maxZoom,minZoom:t.minZoom,rootWidth:i.rootWidth,rootHeight:i.rootHeight,disableZoom:i.disableZoom,onScale:u,onClose:l,onLongPress:function(){return o("longPress",{index:n})}},{image:r.image})}))]}}),p(),g()]}})}}}),vt={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 bt=function(t){var e,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(A)return n||(e=H({setup:function(){var t=B(),e=t.state,o=t.toggle,r=function(){e.images=[]};return function(){return h(gt,I(e,{onClosed:r,"onUpdate:show":o}),null)}}}),n=e.instance),t=Array.isArray(t)?{images:t,startPosition:o}:t,n.open(D({},vt,t)),n};Z(gt);var _t=r(i("submit-bar"),3),yt=_t[0],wt=_t[1],xt=_t[2],kt={tip:String,label:String,price:Number,tipIcon:String,loading:Boolean,currency:S("¥"),disabled:Boolean,textAlign:String,buttonText:String,buttonType:S("danger"),buttonColor:String,suffixLabel:String,placeholder:Boolean,decimalLength:x(2),safeAreaInsetBottom:y},St=a({name:yt,props:kt,emits:["submit"],setup:function(t,e){var o=e.emit,r=e.slots,n=d(),i=F(n,wt),a=function(){var e=t.price,o=t.label,r=t.currency,n=t.textAlign,i=t.suffixLabel,a=t.decimalLength;if("number"==typeof e){var u=(e/100).toFixed(+a).split("."),c=a?".".concat(u[1]):"";return h("div",{class:wt("text"),style:{textAlign:n}},[h("span",null,[o||xt("label")]),h("span",{class:wt("price")},[r,h("span",{class:wt("price-integer")},[u[0]]),c]),i&&h("span",{class:wt("suffix-label")},[i])])}},u=function(){var e,o=t.tip,n=t.tipIcon;if(r.tip||o)return h("div",{class:wt("tip")},[n&&h(G,{class:wt("tip-icon"),name:n},null),o&&h("span",{class:wt("tip-text")},[o]),null==(e=r.tip)?void 0:e.call(r)])},c=function(){return o("submit")},s=function(){var e,o;return h("div",{ref:n,class:[wt(),{"van-safe-area-bottom":t.safeAreaInsetBottom}]},[null==(e=r.top)?void 0:e.call(r),u(),h("div",{class:wt("bar")},[null==(o=r.default)?void 0:o.call(r),a(),r.button?r.button():h(X,{round:!0,type:t.buttonType,text:t.buttonText,class:wt("button",t.buttonType),color:t.buttonColor,loading:t.loading,disabled:t.disabled,onClick:c},null)])])};return function(){return t.placeholder?i(s):s()}}}),Lt=Z(St),Pt="_arrowLeft_ub7u2_1",Ct="_swipeItemImg_ub7u2_12",jt="_swipe_ub7u2_12",zt="_custom-indicator_ub7u2_18",It="_goodsHead_ub7u2_28",Tt="_priceGroup_ub7u2_35",Ot="_price_ub7u2_35",Et="_goodsName_ub7u2_58",Wt="_row_ub7u2_64",Gt="_col_ub7u2_68",Nt="_radio-group_ub7u2_72",At="_radio_ub7u2_72",Dt="_badge_ub7u2_113",Ht="_section_ub7u2_117",Bt="_detail_ub7u2_121",Zt="_photoDetail_ub7u2_146",Ft="_goodsDetail_ub7u2_150",Xt="_actionBar_ub7u2_153",Yt="_addCertBtn_ub7u2_180",Rt="_buyGroup_ub7u2_190",Mt="_selectWrap_ub7u2_196",$t="_imagesOverlayWrap_ub7u2_260";t("default",a({name:"goods-detail",data:function(){return{id:this.$route.query.id,albumPics:[],product:{},radio:0,skuStockListTemp:[],detailMobileHtml:"",loading:!1,addGoodsShow:!1,selectGoodsItem:{},cartCount:0}},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,r=this;return(t=e().mark((function t(){var o,n,i,a,u;return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,r.loading=!0,t.next=4,Y.get("/edu-app/open/mall/product/detail/".concat(r.id),{noAuthorization:!0});case 4:if(o=t.sent,r.loading=!1,n=o.data||{},r.albumPics=[n.product.pic].concat(n.product.albumPics.split(",")).filter((function(t){return t})),r.product=n.product,r.skuStockListTemp=n.skuStockList||[],!r.skuStockListTemp.length){t.next=21;break}i=r.skuStockListTemp.length,a=0;case 13:if(!(a=0)){t.next=18;break}return r.radio=u.id,t.abrupt("break",21);case 18:a++,t.next=13;break;case 21:r.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,r=arguments;return new Promise((function(n,i){var a=t.apply(e,r);function u(t){o(a,n,i,u,c,"next",t)}function c(t){o(a,n,i,u,c,"throw",t)}u(void 0)}))})()},methods:{onPreview:function(t){bt({images:this.albumPics,startPosition:t,closeable:!0,className:$t})},onShowImg:function(t){if("img"===t.srcElement.localName){var e=0,o=document.querySelectorAll(".msgWrap img"),r=Array.from(o).map((function(o,r){return t.srcElement==o&&(e=r),o.src}));bt({images:r,startPosition:e,closeable:!0,className:$t})}},onShowCart:function(){this.selectGoodsItem={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,id:this.product.id},this.addGoodsShow=!0}},render:function(){var t,e=this,o=this.product,r=this.skuStockList.find((function(t){return t.id===e.radio}));return h("div",{class:Ft},[h(G,{class:Pt,name:"arrow-left",onClick:function(t){t.stopPropagation(),e.$router.back()}},null),h(Q,{class:jt,lazyRender:!0},{default:function(){return[e.albumPics.map((function(t,o){return h(K,null,{default:function(){return[h(tt,{class:Ct,src:t,onClick:function(){return e.onPreview(o)},fit:"cover"},null)]}})}))]},indicator:function(t){return t.total>1&&h("div",{class:zt},[(t.active||0)+1,R(" / "),t.total])}}),h(et,{border:!1,class:[It,"mb12"]},{default:function(){return[h(ot,{center:!0,border:!1},{title:function(){return h("div",{class:Tt},[h("span",{class:Ot},[h("i",null,[R("¥")]),M(e.getPrice)])])}}),h(ot,{center:!0,border:!1,title:o.name,titleClass:[Et,"van-ellipsis"]},null)]}}),h(rt,{class:[Wt,"mb12"]},{default:function(){return[h(nt,{span:4,class:Gt},{default:function(){return[R("规格")]}}),h(nt,{span:20},{default:function(){return[r?h("div",{class:Mt},[r.stock<=0?"当前款式暂时缺货":"已选择 ".concat(r.spDataJson)]):h("div",null,[R("请选择 规格")]),h(it,{class:Nt,modelValue:e.radio,"onUpdate:modelValue":function(t){return e.radio=t}},(o=t=e.skuStockList.map((function(t){var o=t.id===e.radio,r=o?"primary":"default";return h($,{position:"top-right",content:t.stock<=0?"缺货":"",color:"#999999",class:Dt,offset:[-20,0]},{default:function(){return[h(at,{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:o,type:r},{default:function(){return[t.spDataJson]}})]}})]}})})),"function"==typeof o||"[object Object]"===Object.prototype.toString.call(o)&&!V(o)?t:{default:function(){return[t]}}))];var o}})]}}),this.detailMobileHtml&&h("div",{class:[Ht]},[h("div",{class:Bt},[h("span",null,[R("图文详情")])]),h("div",{class:[Zt,"msgWrap"],onClick:this.onShowImg,innerHTML:this.detailMobileHtml},null)]),!this.loading&&h(J,null,[h(Lt,{class:Xt,"safe-area-inset-bottom":!0},{button:function(){return h("div",{class:Rt},[h(U,{type:"primary",class:Yt,text:"添加购买",onClick:function(){return e.onShowCart()}},null)])}})]),h(O,{show:this.addGoodsShow,closeable:!0,position:"bottom",round:!0,onClose:function(){e.addGoodsShow=!1}},{default:function(){return[h(q,{show:e.addGoodsShow,item:e.selectGoodsItem,onClose:function(){e.addGoodsShow=!1},defaultRadio:e.radio,showType:"cart"},null)]}})])}}))}}}))}();