1 |
- !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",u=a.asyncIterator||"@@asyncIterator",s=a.toStringTag||"@@toStringTag";function l(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{l({},"")}catch(P){l=function(t,e,r){return t[e]=r}}function d(t,e,r,o){var n=e&&e.prototype instanceof h?e:h,a=Object.create(n.prototype),c=new O(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(P){return{type:"throw",arg:P}}}r.wrap=d;var p={};function h(){}function m(){}function g(){}var y={};l(y,c,(function(){return this}));var v=Object.getPrototypeOf,_=v&&v(v(I([])));_&&_!==o&&n.call(_,c)&&(y=_);var b=g.prototype=h.prototype=Object.create(y);function x(t){["next","throw","return"].forEach((function(e){l(t,e,(function(t){return this._invoke(e,t)}))}))}function w(e,r){function o(i,a,c,u){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")?r.resolve(d.__await).then((function(t){o("next",t,c,u)}),(function(t){o("throw",t,c,u)})):r.resolve(d).then((function(t){l.value=t,c(l)}),(function(t){return o("throw",t,c,u)}))}u(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 E()}for(r.method=n,r.arg=i;;){var a=r.delegate;if(a){var c=k(a,r);if(c){if(c===p)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 u=f(t,e,r);if("normal"===u.type){if(o=r.done?"completed":"suspendedYield",u.arg===p)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(o="completed",r.method="throw",r.arg=u.arg)}}}function k(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,k(t,e),"throw"===e.method)||"return"!==r&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+r+"' method")),p;var n=f(o,t.iterator,e.arg);if("throw"===n.type)return e.method="throw",e.arg=n.arg,e.delegate=null,p;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,p):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,p)}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 O(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(S,this),this.reset(!0)}function I(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<t.length;)if(n.call(t,r))return e.value=t[r],e.done=!1,e;return e.value=void 0,e.done=!0,e};return o.next=o}}return{next:E}}function E(){return{value:void 0,done:!0}}return m.prototype=g,i(b,"constructor",{value:g,configurable:!0}),i(g,"constructor",{value:m,configurable:!0}),m.displayName=l(g,s,"GeneratorFunction"),r.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===m||"GeneratorFunction"===(e.displayName||e.name))},r.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,g):(t.__proto__=g,l(t,s,"GeneratorFunction")),t.prototype=Object.create(b),t},r.awrap=function(t){return{__await:t}},x(w.prototype),l(w.prototype,u,(function(){return this})),r.AsyncIterator=w,r.async=function(t,e,o,n,i){void 0===i&&(i=Promise);var a=new w(d(t,e,o,n),i);return r.isGeneratorFunction(e)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},x(b),l(b,s,"Generator"),l(b,c,(function(){return this})),l(b,"toString",(function(){return"[object Generator]"})),r.keys=function(t){var e=Object(t),r=[];for(var o in e)r.push(o);return r.reverse(),function t(){for(;r.length;){var o=r.pop();if(o in e)return t.value=o,t.done=!1,t}return t.done=!0,t}},r.values=I,O.prototype={constructor:O,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(L),!t)for(var e in this)"t"===e.charAt(0)&&n.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function r(r,o){return a.type="throw",a.arg=t,e.next=r,o&&(e.method="next",e.arg=void 0),!!o}for(var o=this.tryEntries.length-1;o>=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"),u=n.call(i,"finallyLoc");if(c&&u){if(this.prev<i.catchLoc)return r(i.catchLoc,!0);if(this.prev<i.finallyLoc)return r(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return r(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return r(i.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,p):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),p},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),L(r),p}},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:I(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),p}},r}function r(t,e,r,o,n,i,a){try{var c=t[i](a),u=c.value}catch(s){return void r(s)}c.done?e(u):Promise.resolve(u).then(o,n)}function o(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,o)}return r}function n(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?o(Object(r),!0).forEach((function(e){i(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):o(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function i(e,r,o){return(r=function(e){var r=function(e,r){if("object"!==t(e)||null===e)return e;var o=e[Symbol.toPrimitive];if(void 0!==o){var n=o.call(e,r||"default");if("object"!==t(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(e)}(e,"string");return"symbol"===t(r)?r:String(r)}(r))in e?Object.defineProperty(e,r,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[r]=o,e}System.register(["./index-legacy-fff8b745.js","./student-register-store-legacy-68aa4861.js","./index-legacy-b004455a.js","./index-legacy-f6b7c75c.js","./index-legacy-c55612ee.js","./index-legacy-32789c37.js"],(function(t,o){"use strict";var i,a,c,u,s,l,d,f,p,h,m,g,y,v;return{setters:[function(t){i=t.d,a=t.bh,c=t.a,u=t.A,s=t.P,l=t.C,d=t.a1},function(t){f=t.u,p=t.S},function(t){h=t.R,m=t.a},function(t){g=t.C},function(t){y=t.I},function(t){v=t.T}],execute:function(){var _=document.createElement("style");_.textContent="._addGoodsCart_1x0mj_1{padding-top:.32rem;--k-font-primary: #FFCB75;--van-primary: var(--k-font-primary);--van-stepper-button-round-theme-color: var(--van-primary)}._addGoodsCart_1x0mj_1 .van-stepper__input{background:#f7f8f9!important;border-radius:.16rem;margin:0 .21333rem}._addGoodsCart_1x0mj_1 .van-stepper__minus--disabled{opacity:.6!important;color:#333!important;background:#f7f8f9!important;border-color:#f7f8f9!important}._addGoodsCart_1x0mj_1 ._addCartBtn_1x0mj_18{background:linear-gradient(121deg,#FFD892 0%,#FFCB75 100%);border-radius:.32rem;font-size:.42667rem;font-weight:600;color:#5b2c03;border:0}._goodsSection_1x0mj_26{position:relative;width:2.66667rem;height:2.66667rem;border-radius:.21333rem;overflow:hidden}._goodsSection_1x0mj_26 ._sellOut_1x0mj_33{display:flex;align-items:center;justify-content:center;position:absolute;top:0;left:0;right:0;bottom:0;background:rgba(0,0,0,.2);padding:.53333rem}._goodsImg_1x0mj_45{width:2.66667rem;height:2.66667rem;background:linear-gradient(180deg,#f0f0f0 0%,#d7d7d7 100%);overflow:hidden}._goodsPrice_1x0mj_51{padding-top:.21333rem;font-size:.48rem;color:#ff4e19;line-height:.58667rem}._goodsPrice_1x0mj_51 span{font-size:.42667rem}._goodsStore_1x0mj_60{font-size:.37333rem;color:#999;line-height:.53333rem}._title_1x0mj_65{font-size:.42667rem;color:#333;line-height:.58667rem}._radio-group_1x0mj_70{display:flex;flex-wrap:wrap;margin-top:.37333rem}._radio_1x0mj_70{margin-right:.26667rem;margin-bottom:.21333rem;min-width:1.6rem}._radio_1x0mj_70 .van-radio__icon{display:none}._radio_1x0mj_70 .van-tag--large{height:.85333rem;font-size:.42667rem;text-align:center;display:flex;align-items:center;justify-content:center}._radio_1x0mj_70 .van-tag{box-sizing:border-box}._radio_1x0mj_70 .van-tag--default{color:#999;background-color:#f7f8f9}._radio_1x0mj_70 .van-tag--primary{background-color:#fffaf4;background:#FFFAF4;border-radius:.16rem;border:.02667rem solid #FFCF7C;color:#f39f11}._radio_1x0mj_70 .van-radio__label{margin-left:0;width:100%}\n",document.head.appendChild(_);var b=t("i",""+new URL("icon-sell-out-437e8d6c.png",o.meta.url).href),x={addGoodsCart:"_addGoodsCart_1x0mj_1",addCartBtn:"_addCartBtn_1x0mj_18",goodsSection:"_goodsSection_1x0mj_26",sellOut:"_sellOut_1x0mj_33",goodsImg:"_goodsImg_1x0mj_45",goodsPrice:"_goodsPrice_1x0mj_51",goodsStore:"_goodsStore_1x0mj_60",title:"_title_1x0mj_65","radio-group":"_radio-group_1x0mj_70",radio:"_radio_1x0mj_70"};var w=f();t("A",i({name:"add-goods-cart",props:{show:{type:Boolean,default:!1},item:{type:Object,default:{}},defaultRadio:{type:Number,default:0},showType:{type:String,default:"cart"},onClose:{type:Function,default:function(){}}},watch:{show:function(t){t&&(this.totalData={},this.total=1,this.radio="",this.setList())}},data:function(){return{radio:"",total:1,totalData:{},skuStockList:[]}},computed:{selectItem:function(){var t=this.radio,e=this.skuStockList.find((function(e){return e.id==t}));if(e){var r=e.stock-e.lockStock;return n(n({},e),{},{stock:r})}return{stock:0}}},mounted:function(){this.setList()},methods:{setList:function(){var t=this,e=[],r=JSON.parse(JSON.stringify(this.item));if(Array.isArray(r.skuStockList)&&(e=r.skuStockList.map((function(t){if(t.pic=t.pic||r.pic,t.cartNum=0,t.spData){var e=JSON.parse(t.spData),o="";e.forEach((function(t){o+="".concat(t.value)})),t.spDataJson=o}else t.spDataJson="默认";return t.lockStock=t.lockStock>0?t.lockStock:0,n({},t)}))),!e.length)return e;var o=0;if(this.defaultRadio){var i=e.findIndex((function(e){return e.id==t.defaultRadio}));o=i>-1?i:0}this.radio=e[o].id,this.skuStockList=e},onAddCart:function(){var t,o=this;return(t=e().mark((function t(){var r,n,i,c;return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:r=o.selectItem,n=o.item,i={pic:n.pic,name:n.name,brandName:n.brandName,productSn:n.productSn,price:r.price,originalPrice:n.originalPrice,productSkuId:r.id,stock:r.stock,quantity:o.total,productId:n.id,spDataJson:r.spDataJson,hidden:"cart"===o.showType?0:1,promoterId:o.$route.query.promoterId?o.$route.query.promoterId:void 0};try{c=!1,w.getGoods.forEach((function(t){t.productId===i.productId&&t.productSkuId===i.productSkuId&&(c=!0,t.quantity+=i.quantity)})),c||w.setGoods(i),a("添加成功"),o.onClose()}catch(e){}case 4:case"end":return t.stop()}}),t)})),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,u,"next",t)}function u(t){r(a,n,i,c,u,"throw",t)}c(void 0)}))})()},setProductStock:function(t){for(var e=0;e<this.skuStockList.length;e++)this.skuStockList[e].id===this.radio&&(this.skuStockList[e].cartNum=t)}},render:function(){var t=this;return c("div",{class:x.addGoodsCart},[c(g,{titleStyle:{paddingLeft:"12px"}},{icon:function(){return c("div",{class:x.goodsSection},[c(y,{src:t.selectItem.pic,class:x.goodsImg,fit:"cover"},null),t.selectItem.stock<=0&&c("div",{class:x.sellOut},[c(y,{src:b,fit:"cover",class:x.sellOutImg},null)])])},title:function(){return c("div",{class:x.goodsInfo},[c("p",{class:x.goodsPrice},[c("span",null,[u("¥")]),s(t.selectItem.price)]),c("p",{class:x.goodsStore},[u("库存:"),t.selectItem.stock])])}}),c(g,null,{title:function(){return c("div",{class:x.title},[u("规格")])},label:function(){var e,r;return c(h,{class:x["radio-group"],modelValue:t.radio},"function"==typeof(r=e=t.skuStockList.map((function(e){var r=e.id===t.radio,o=r?"primary":"default";return c(m,{class:x.radio,name:e.id,onClick:function(){t.radio!=e.id&&(t.radio=e.id)}},{default:function(){return[c(v,{size:"large",plain:r,type:o},{default:function(){return[e.spDataJson]}})]}})})))||"[object Object]"===Object.prototype.toString.call(r)&&!d(r)?e:{default:function(){return[e]}})}}),c(g,{title:"购买数量",style:{margin:"12px 0"},border:!1,titleClass:x.title,center:!0},{default:function(){return[c(p,{modelValue:t.total,"onUpdate:modelValue":function(e){return t.total=e},inputWidth:"50px",theme:"round",buttonSize:"24px",max:t.selectItem.stock>200?200:t.selectItem.stock,min:1,disabled:t.selectItem.stock<=0,integer:!0},null)]}}),c("div",{class:["btnGroup"],style:{marginBottom:"8px"}},[c(l,{block:!0,type:"primary",text:"确定",class:x.addCartBtn,disabled:this.selectItem.stock<=0,onClick:function(){return t.onAddCart()}},null)])])}}))}}}))}();
|