index-legacy-2ac0d79a.js 11 KB

1
  1. !function(){function e(e,t,o,r,a,i,n){try{var s=e[i](n),d=s.value}catch(l){return void o(l)}s.done?t(d):Promise.resolve(d).then(r,a)}function t(e,t){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),o.push.apply(o,r)}return o}function o(e){for(var o=1;o<arguments.length;o++){var a=null!=arguments[o]?arguments[o]:{};o%2?t(Object(a),!0).forEach((function(t){r(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):t(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}function r(e,t,o){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var o=e[Symbol.toPrimitive];if(void 0!==o){var r=o.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}System.register(["./index-legacy-e6be1dcb.js","./student-register-store-legacy-9e94918b.js","./index-legacy-72ad1f03.js","./index-legacy-d3534fc9.js","./index-legacy-b6d273d9.js","./index-legacy-f9bb7174.js"],(function(t,r){"use strict";var a,i,n,s,d,l,c,u,p,m,g,_,f,h,v,b,y,k,S,w,C,I,x,P,O,j,L,F,G,B,D,V,z,N,T,E;return{setters:[e=>{a=e.c,i=e.b,n=e.t,s=e.n,d=e.d,l=e.r,c=e.e,u=e.o,p=e.aC,m=e.w,g=e.a5,_=e.a,f=e.g,h=e.v,v=e.h,b=e.H,y=e.br,k=e.Y,S=e.z,w=e.bs,C=e.p,I=e.a1,x=e.bP,P=e.bR,O=e.k,j=e.b0,L=e.A,F=e.W,G=e.C,B=e.a3},e=>{D=e.u},e=>{V=e.C},e=>{z=e.I},e=>{N=e.R,T=e.a},e=>{E=e.T}],execute:function(){var J=document.createElement("style");J.textContent="._addGoodsCart_16cde_1{padding-top:.32rem;--k-font-primary: #FFCB75;--van-primary: var(--k-font-primary);--van-stepper-button-round-theme-color: var(--van-primary)}._addGoodsCart_16cde_1 .van-stepper__minus,._addGoodsCart_16cde_1 .van-stepper__plus,._addGoodsCart_16cde_1 .van-stepper__input{background-color:#fff4e7}._addGoodsCart_16cde_1 .van-stepper__minus,._addGoodsCart_16cde_1 .van-stepper__plus{color:#bf7434}._addGoodsCart_16cde_1 .van-stepper__input{color:#8c6142}._addGoodsCart_16cde_1 .van-stepper__minus{border-radius:2.66667rem 0 0 2.66667rem}._addGoodsCart_16cde_1 .van-stepper__plus{border-radius:0 2.66667rem 2.66667rem 0}._addGoodsCart_16cde_1 ._addCartBtn_16cde_25{background:linear-gradient(121deg,#FFD892 0%,#FFCB75 100%);border-radius:.32rem;font-size:.42667rem;font-weight:600;color:#5b2c03;border:0}._goodsSection_16cde_33{position:relative;width:2.66667rem;height:2.66667rem;border-radius:.21333rem;overflow:hidden}._goodsSection_16cde_33 ._sellOut_16cde_40{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_16cde_52{width:2.66667rem;height:2.66667rem;background:linear-gradient(180deg,#f0f0f0 0%,#d7d7d7 100%);overflow:hidden}._goodsPrice_16cde_58{padding-top:.21333rem;font-size:.48rem;color:#ff4e19;line-height:.58667rem}._goodsPrice_16cde_58 span{font-size:.42667rem}._goodsStore_16cde_67{font-size:.37333rem;color:#999;line-height:.53333rem}._title_16cde_72{font-size:.42667rem;color:#333;line-height:.58667rem}._radio-group_16cde_77{display:flex;flex-wrap:wrap;margin-top:.37333rem}._radio_16cde_77{margin-right:.26667rem;margin-bottom:.21333rem;min-width:1.6rem}._radio_16cde_77 .van-radio__icon{display:none}._radio_16cde_77 .van-tag--large{height:.85333rem;font-size:.42667rem;text-align:center;display:flex;align-items:center;justify-content:center}._radio_16cde_77 .van-tag{box-sizing:border-box}._radio_16cde_77 .van-tag--default{color:#999;background-color:#f7f8f9}._radio_16cde_77 .van-tag--primary{background-color:#fffaf4;background:#FFFAF4;border-radius:.16rem;color:#f39f11}._radio_16cde_77 .van-radio__label{margin-left:0;width:100%}\n",document.head.appendChild(J);const[A,M]=a("stepper"),R=(e,t)=>String(e)===String(t),q={min:i(1),max:i(1/0),name:i(""),step:i(1),theme:String,integer:Boolean,disabled:Boolean,showPlus:n,showMinus:n,showInput:n,longPress:n,autoFixed:n,allowEmpty:Boolean,modelValue:s,inputWidth:s,buttonSize:s,placeholder:String,disablePlus:Boolean,disableMinus:Boolean,disableInput:Boolean,beforeChange:Function,defaultValue:i(1),decimalLength:s};var $=d({name:A,props:q,emits:["plus","blur","minus","focus","change","overlimit","update:modelValue"],setup(e,{emit:t}){const o=(t,o=!0)=>{const{min:r,max:a,allowEmpty:i,decimalLength:n}=e;return i&&""===t||(t=""===(t=y(String(t),!e.integer))?0:+t,t=Number.isNaN(t)?+r:t,t=o?Math.max(Math.min(+a,t),+r):t,k(n)&&(t=t.toFixed(+n))),t};let r;const a=l(),i=l((()=>{var r;const a=null!=(r=e.modelValue)?r:e.defaultValue,i=o(a);return R(i,e.modelValue)||t("update:modelValue",i),i})()),n=c((()=>e.disabled||e.disableMinus||+i.value<=+e.min)),s=c((()=>e.disabled||e.disablePlus||+i.value>=+e.max)),d=c((()=>({width:u(e.inputWidth),height:u(e.buttonSize)}))),O=c((()=>p(e.buttonSize))),j=t=>{e.beforeChange?I(e.beforeChange,{args:[t],done(){i.value=t}}):i.value=t},L=()=>{if("plus"===r&&s.value||"minus"===r&&n.value)return void t("overlimit",r);const a="minus"===r?-e.step:+e.step,d=o(x(+i.value,a));j(d),t(r)},F=t=>{const o=t.target,{value:r}=o,{decimalLength:a}=e;let n=y(String(r),!e.integer);if(k(a)&&n.includes(".")){const e=n.split(".");n=`${e[0]}.${e[1].slice(0,+a)}`}e.beforeChange?o.value=String(i.value):R(r,n)||(o.value=n);const s=n===String(+n);j(s?+n:n)},G=o=>{var r;e.disableInput?null==(r=a.value)||r.blur():t("focus",o)},B=r=>{const a=r.target,n=o(a.value,e.autoFixed);a.value=String(n),i.value=n,S((()=>{t("blur",r),w()}))};let D,V;const z=()=>{V=setTimeout((()=>{L(),z()}),200)},N=t=>{e.longPress&&(clearTimeout(V),D&&C(t))},T=t=>{e.disableInput&&C(t)},E=t=>({onClick:e=>{C(e),r=t,L()},onTouchstartPassive:()=>{r=t,e.longPress&&(D=!1,clearTimeout(V),V=setTimeout((()=>{D=!0,L(),z()}),P))},onTouchend:N,onTouchcancel:N});return m((()=>[e.max,e.min,e.integer,e.decimalLength]),(()=>{const e=o(i.value);R(e,i.value)||(i.value=e)})),m((()=>e.modelValue),(e=>{R(e,i.value)||(i.value=o(e))})),m(i,(o=>{t("update:modelValue",o),t("change",o,{name:e.name})})),g((()=>e.modelValue)),()=>_("div",{role:"group",class:M([e.theme])},[f(_("button",v({type:"button",style:O.value,class:[M("minus",{disabled:n.value}),{[b]:!n.value}],"aria-disabled":n.value||void 0},E("minus")),null),[[h,e.showMinus]]),f(_("input",{ref:a,type:e.integer?"tel":"text",role:"spinbutton",class:M("input"),value:i.value,style:d.value,disabled:e.disabled,readonly:e.disableInput,inputmode:e.integer?"numeric":"decimal",placeholder:e.placeholder,"aria-valuemax":e.max,"aria-valuemin":e.min,"aria-valuenow":i.value,onBlur:B,onInput:F,onFocus:G,onMousedown:T},null),[[h,e.showInput]]),f(_("button",v({type:"button",style:O.value,class:[M("plus",{disabled:s.value}),{[b]:!s.value}],"aria-disabled":s.value||void 0},E("plus")),null),[[h,e.showPlus]])])}});const U=O($),W=t("i",""+new URL("icon-sell-out-437e8d6c.png",r.meta.url).href),H={addGoodsCart:"_addGoodsCart_16cde_1",addCartBtn:"_addCartBtn_16cde_25",goodsSection:"_goodsSection_16cde_33",sellOut:"_sellOut_16cde_40",goodsImg:"_goodsImg_16cde_52",goodsPrice:"_goodsPrice_16cde_58",goodsStore:"_goodsStore_16cde_67",title:"_title_16cde_72","radio-group":"_radio-group_16cde_77",radio:"_radio_16cde_77"};const Y=D();t("A",d({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:()=>{}}},watch:{show(e){e&&(this.totalData={},this.total=1,this.radio="",this.setList())}},data:()=>({radio:"",total:1,totalData:{},skuStockList:[]}),computed:{selectItem(){const e=this.radio,t=this.skuStockList.find((t=>t.id==e));if(t){let e=t.stock-t.lockStock;return o(o({},t),{},{stock:e})}return{stock:0}}},mounted(){this.setList()},methods:{setList(){let e=[];const t=JSON.parse(JSON.stringify(this.item));if(Array.isArray(t.skuStockList)&&(e=t.skuStockList.map((e=>{if(e.pic=e.pic||t.pic,e.cartNum=0,e.spData){const t=JSON.parse(e.spData);let o="";t.forEach((e=>{o+=`${e.value}`})),e.spDataJson=o}else e.spDataJson="默认";return e.lockStock=e.lockStock>0?e.lockStock:0,o({},e)}))),!e.length)return e;let r=0;if(this.defaultRadio){let t=e.findIndex((e=>e.id==this.defaultRadio));r=t>-1?t:0}this.radio=e[r].id,this.skuStockList=e},onAddCart(){var t,o=this;return(t=function*(){const e=o.selectItem,t=o.item,r={pic:t.pic,name:t.name,brandName:t.brandName,productSn:t.productSn,price:e.price,originalPrice:t.originalPrice,productSkuId:e.id,stock:e.stock,quantity:o.total,productId:t.id,spDataJson:e.spDataJson,hidden:"cart"===o.showType?0:1,promoterId:o.$route.query.promoterId?o.$route.query.promoterId:void 0};try{let e=!1;Y.getGoods.forEach((t=>{t.productId===r.productId&&t.productSkuId===r.productSkuId&&(e=!0,t.quantity+=r.quantity)})),e||Y.setGoods(r),j("添加成功"),o.onClose()}catch(a){}},function(){var o=this,r=arguments;return new Promise((function(a,i){var n=t.apply(o,r);function s(t){e(n,a,i,s,d,"next",t)}function d(t){e(n,a,i,s,d,"throw",t)}s(void 0)}))})()},setProductStock(e){for(let t=0;t<this.skuStockList.length;t++)this.skuStockList[t].id===this.radio&&(this.skuStockList[t].cartNum=e)}},render(){return _("div",{class:H.addGoodsCart},[_(V,{titleStyle:{paddingLeft:"12px"}},{icon:()=>_("div",{class:H.goodsSection},[_(z,{src:this.selectItem.pic,class:H.goodsImg,fit:"cover"},null),this.selectItem.stock<=0&&_("div",{class:H.sellOut},[_(z,{src:W,fit:"cover",class:H.sellOutImg},null)])]),title:()=>_("div",{class:H.goodsInfo},[_("p",{class:H.goodsPrice},[_("span",null,[L("¥")]),F(this.selectItem.price)]),_("p",{class:H.goodsStore},[L("库存:"),this.selectItem.stock])])}),_(V,null,{title:()=>_("div",{class:H.title},[L("规格")]),label:()=>{let e;return _(N,{class:H["radio-group"],modelValue:this.radio},"function"==typeof(t=e=this.skuStockList.map((e=>{const t=e.id===this.radio,o=t?"primary":"default";return _(T,{class:H.radio,name:e.id,onClick:()=>{this.radio!=e.id&&(this.radio=e.id)}},{default:()=>[_(E,{size:"large",plain:t,type:o},{default:()=>[e.spDataJson]})]})})))||"[object Object]"===Object.prototype.toString.call(t)&&!B(t)?e:{default:()=>[e]});var t}}),_(V,{title:"购买数量",style:{margin:"12px 0"},border:!1,titleClass:H.title,center:!0},{default:()=>[_(U,{modelValue:this.total,"onUpdate:modelValue":e=>this.total=e,max:this.selectItem.stock>200?200:this.selectItem.stock,min:1,disabled:this.selectItem.stock<=0,integer:!0},null)]}),_("div",{class:["btnGroup"],style:{marginBottom:"8px"}},[_(G,{block:!0,type:"primary",text:"确定",class:H.addCartBtn,disabled:this.selectItem.stock<=0,onClick:()=>this.onAddCart()},null)])])}}))}}}))}();