1 |
- !function(){function t(t,e,o,r,i,d,a){try{var s=t[d](a),n=s.value}catch(c){return void o(c)}s.done?e(n):Promise.resolve(n).then(r,i)}function e(t,e){var o=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),o.push.apply(o,r)}return o}function o(t){for(var o=1;o<arguments.length;o++){var i=null!=arguments[o]?arguments[o]:{};o%2?e(Object(i),!0).forEach((function(e){r(t,e,i[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):e(Object(i)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}))}return t}function r(t,e,o){return(e=function(t){var e=function(t,e){if("object"!=typeof t||null===t)return t;var o=t[Symbol.toPrimitive];if(void 0!==o){var r=o.call(t,e||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:String(e)}(e))in t?Object.defineProperty(t,e,{value:o,enumerable:!0,configurable:!0,writable:!0}):t[e]=o,t}System.register(["./index-legacy-a314c7dd.js","./student-register-store-legacy-5e7da7c2.js","./index-legacy-dff5e6e7.js","./index-legacy-72dfb7ed.js","./index-legacy-701fd443.js","./index-legacy-59282c70.js","./index-legacy-81977747.js"],(function(e,r){"use strict";var i,d,a,s,n,c,l,u,p,_,m,f,g,h;return{setters:[t=>{i=t.d,d=t.aW,a=t.a,s=t.A,n=t.U,c=t.C,l=t.a3},t=>{u=t.u},t=>{p=t.C},t=>{_=t.I},t=>{m=t.R,f=t.a},t=>{g=t.T},t=>{h=t.S}],execute:function(){var y=document.createElement("style");y.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(y);const b=e("i",""+new URL("icon-sell-out-437e8d6c.png",r.meta.url).href),v={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 k=u();e("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:()=>{}}},watch:{show(t){t&&(this.totalData={},this.total=1,this.radio="",this.setList())}},data:()=>({radio:"",total:1,totalData:{},skuStockList:[]}),computed:{selectItem(){const t=this.radio,e=this.skuStockList.find((e=>e.id==t));if(e){let t=e.stock-e.lockStock;return o(o({},e),{},{stock:t})}return{stock:0}}},mounted(){this.setList()},methods:{setList(){let t=[];const e=JSON.parse(JSON.stringify(this.item));if(Array.isArray(e.skuStockList)&&(t=e.skuStockList.map((t=>{if(t.pic=t.pic||e.pic,t.cartNum=0,t.spData){const e=JSON.parse(t.spData);let o="";e.forEach((t=>{o+=`${t.value}`})),t.spDataJson=o}else t.spDataJson="默认";return t.lockStock=t.lockStock>0?t.lockStock:0,o({},t)}))),!t.length)return t;let r=0;if(this.defaultRadio){let e=t.findIndex((t=>t.id==this.defaultRadio));r=e>-1?e:0}this.radio=t[r].id,this.skuStockList=t},onAddCart(){var e,o=this;return(e=function*(){const t=o.selectItem,e=o.item,r={pic:e.pic,name:e.name,brandName:e.brandName,productSn:e.productSn,price:t.price,originalPrice:e.originalPrice,productSkuId:t.id,stock:t.stock,quantity:o.total,productId:e.id,spDataJson:t.spDataJson,hidden:"cart"===o.showType?0:1,promoterId:o.$route.query.promoterId?o.$route.query.promoterId:void 0};try{let t=!1;k.getGoods.forEach((e=>{e.productId===r.productId&&e.productSkuId===r.productSkuId&&(t=!0,e.quantity+=r.quantity)})),t||k.setGoods(r),d("添加成功"),o.onClose()}catch(i){}},function(){var o=this,r=arguments;return new Promise((function(i,d){var a=e.apply(o,r);function s(e){t(a,i,d,s,n,"next",e)}function n(e){t(a,i,d,s,n,"throw",e)}s(void 0)}))})()},setProductStock(t){for(let e=0;e<this.skuStockList.length;e++)this.skuStockList[e].id===this.radio&&(this.skuStockList[e].cartNum=t)}},render(){return a("div",{class:v.addGoodsCart},[a(p,{titleStyle:{paddingLeft:"12px"}},{icon:()=>a("div",{class:v.goodsSection},[a(_,{src:this.selectItem.pic,class:v.goodsImg,fit:"cover"},null),this.selectItem.stock<=0&&a("div",{class:v.sellOut},[a(_,{src:b,fit:"cover",class:v.sellOutImg},null)])]),title:()=>a("div",{class:v.goodsInfo},[a("p",{class:v.goodsPrice},[a("span",null,[s("¥")]),n(this.selectItem.price)]),a("p",{class:v.goodsStore},[s("库存:"),this.selectItem.stock])])}),a(p,null,{title:()=>a("div",{class:v.title},[s("规格")]),label:()=>{let t;return a(m,{class:v["radio-group"],modelValue:this.radio},"function"==typeof(e=t=this.skuStockList.map((t=>{const e=t.id===this.radio,o=e?"primary":"default";return a(f,{class:v.radio,name:t.id,onClick:()=>{this.radio!=t.id&&(this.radio=t.id)}},{default:()=>[a(g,{size:"large",plain:e,type:o},{default:()=>[t.spDataJson]})]})})))||"[object Object]"===Object.prototype.toString.call(e)&&!l(e)?t:{default:()=>[t]});var e}}),a(p,{title:"购买数量",style:{margin:"12px 0"},border:!1,titleClass:v.title,center:!0},{default:()=>[a(h,{modelValue:this.total,"onUpdate:modelValue":t=>this.total=t,max:this.selectItem.stock>200?200:this.selectItem.stock,min:1,disabled:this.selectItem.stock<=0,integer:!0},null)]}),a("div",{class:["btnGroup"],style:{marginBottom:"8px"}},[a(c,{block:!0,type:"primary",text:"确定",class:v.addCartBtn,disabled:this.selectItem.stock<=0,onClick:()=>this.onAddCart()},null)])])}}))}}}))}();
|