(global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["components/page-component/app-attr/app-attr"],{"1a13":function(t,e,r){"use strict";r.r(e);var i=r("4f65"),o=r.n(i);for(var s in i)"default"!==s&&function(t){r.d(e,t,(function(){return i[t]}))}(s);e["default"]=o.a},"4f65":function(t,e,r){"use strict";(function(t){Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var i=r("2f62");function o(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,i)}return r}function s(t){for(var e=1;e=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,n=!0,a=!1;return{s:function(){r=t[Symbol.iterator]()},n:function(){var t=r.next();return n=t.done,t},e:function(t){a=!0,s=t},f:function(){try{n||null==r.return||r.return()}finally{if(a)throw s}}}}function u(t,e){if(t){if("string"===typeof t)return l(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?l(t,e):void 0}}function l(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,i=new Array(e);r0?(1===e.length&&(t[0].attr_list[o].checked=!0),t[0].attr_list[o].attr_num_0=!1,this.pic_url=t[0].attr_list[o].pic_url):(this.number=0,t[0].attr_list[o].checked=!1,t[0].attr_list[o].attr_num_0=!0));1===e.length&&(r=e[0],this.$emit("attrtap",r))}this.newAttrGroupList=t,this.goods.selectAttr?this.selectAttr=this.goods.selectAttr:this.selectAttr=r}this.display="block"}},scrollGet:function(t,e){this.goods.attr_groups[e].scrollLeft=t.detail.scrollLeft,this.$forceUpdate()},toBottom:function(t){var e=this;this.$nextTick().then((function(){e.goods.attr_groups[t].scrollLeft=99999,e.$forceUpdate()}))},chooseAttr:function(t,e){var r,i=this,o=a(i.goods.attr_groups[t].attr_list);try{for(o.s();!(r=o.n()).done;){var s=r.value;s.active=!1,s.attr_id==e.attr_id&&s.attr_name==e.attr_name&&(s.active=!0)}}catch(p){o.e(p)}finally{o.f()}0==t&&(i.pic_url=e.pic_url),i.activeAttr[t].attr_id=e.attr_id,i.activeAttr[t].attr_name=e.attr_name,i.goodsAttr=[];var n,u=a(i.goods.attr);try{for(u.s();!(n=u.n()).done;){for(var l=n.value,c=!0,h=0;hthis.goodsAttr[t].stock||this.goodsAttr[t].number==this.goodsAttr[t].stock)return!1;this.goodsAttr[t].number++,1==this.goods.attr_groups.length&&(this.pic_url=this.goodsAttr[t].pic_url),this.count(t)},wholesaleNumberBlur:function(t){+this.goodsAttr[t].number>+this.goodsAttr[t].stock&&(this.goodsAttr[t].number=this.goodsAttr[t].stock),1==this.goods.attr_groups.length&&(this.pic_url=this.goodsAttr[t].pic_url),this.count(t)},count:function(t){var e=this;this.$emit("attrtap",e.goods,e.goodsAttr),setTimeout((function(){e.selectAttr=e.goodsAttr[t]}))},close:function(){this.display="none",this.$emit("close",!1)},preventD:function(){},storeAttrClick:function(e,r){var i=JSON.parse(JSON.stringify(this.newAttrGroupList)),o=this.goods.attr,s=[],n=this.attrCart;for(var a in i)for(var u in i[a].attr_list){var l=i[a].attr_list[u];if(parseInt(i[a].attr_group_id)==parseInt(r))if(parseInt(l.attr_id)===parseInt(e)){if(l.checked?l.checked=!1:l.checked=!0,l.attr_num_0)return}else l.checked=!1;l.checked&&(0==a&&(this.pic_url=i[0].attr_list[u].pic_url),s.push(i[a].attr_group_id+"-"+l.attr_id))}function c(t,e){return e.some((function(e){return t==e}))}var h=[],d=null,p=1;for(var m in o){var f=[],g=0;for(var _ in o[m].attr_list){var b=o[m].attr_list[_].attr_group_id+"-"+o[m].attr_list[_].attr_id;c(b,s)||(g+=1,f.push(b))}if(0==o[m].stock&&g<=1&&(h=h.concat(f)),0==g){if(d||(d={}),d=o[m],n.forEach((function(t){t.attr_id==d.id&&(p=t.num)})),d.stock<=0)return void t.showToast({title:"库存不足",icon:"none"});d.stock<=p&&(p=d.stock)}}for(var v in 0==s.length&&(d=null),i)for(var y in i[v].attr_list){var A=i[v].attr_list[y],w=i[v].attr_group_id+"-"+A.attr_id;c(w,h)&&!c(w,s)?A.attr_num_0=!0:A.attr_num_0=!1}this.newAttrGroupList=i,this.selectAttr=d,this.number=p,this.$emit("attrtap",this.selectAttr)},numberBlur:function(e){return e=parseInt(e.value),e>this.attrNum&&(t.showToast({title:"库存不足",icon:"none"}),e=this.attrNum),this.$emit("attrtap",this.selectAttr),this.number=e},numberSub:function(){var t=this.number;if(t<=1)return!0;t--,this.number=t,this.$emit("attrtap",this.selectAttr)},numberAdd:function(){var e=this.number;if(e++,e>this.attrNum)return t.showToast({title:"库存不足",icon:"none"}),void(this.number=this.attrNum);this.number=e,this.$emit("attrtap",this.selectAttr)},cart:function(){var e=this;if(!this.submit())return!1;var r=this.selectAttr;if("pick"!==this.goods.sign&&"community"!==this.goods.sign)if("goods"===this.goods.type)if("miaosha"===this.goods.sign)this.$request({url:this.$api.miaosha.add_cart,data:{miaosha_goods_id:r.goods_id,attr_id:r.id,num:this.number},method:"post"}).then((function(r){t.showToast({title:r.msg,type:"success"}),e.display="none",e.selectAttr.number=e.number,e.$emit("selectNumber",e.selectAttr)})).catch((function(){e.display="none"}));else if("flash_sale"===this.goods.sign)this.$request({url:this.$api.flash_sale.add_cart,data:{flash_goods_id:r.goods_id,attr_id:r.id,num:this.number},method:"post"}).then((function(r){t.showToast({title:r.msg,type:"success"}),e.display="none",e.selectAttr.number=e.number,e.$emit("selectNumber",e.selectAttr)})).catch((function(){e.display="none"}));else if("wholesale"==this.goods.sign){if(this.totalNumber0&&o.push(n)}}catch(u){s.e(u)}finally{s.f()}this.$request({url:this.$api.wholesale.cart,data:{attr:JSON.stringify(o)},method:"post"}).then((function(r){if(e.display="none",0===r.code){var i,o=a(e.goods.attr);try{for(o.s();!(i=o.n()).done;){var s=i.value;s.number="0"}}catch(u){o.e(u)}finally{o.f()}var n,l=a(e.goodsAttr);try{for(l.s();!(n=l.n()).done;){var c=n.value;c.number="0"}}catch(u){l.e(u)}finally{l.f()}e.count(),t.hideLoading(),t.showToast({title:"添加成功",duration:1e3})}})).catch((function(t){e.display="none"}))}else this.$request({url:this.$api.cart.add,data:{goods_id:r.goods_id,attr:r.id,num:this.number},method:"post"}).then((function(r){0===r.code?(t.showToast({title:r.msg,type:"success"}),e.display="none",e.selectAttr.number=e.number,e.$emit("selectNumber",e.selectAttr)):(t.showToast({title:r.msg,icon:"none",duration:2500}),e.display="none")})).catch((function(){e.display="none"}));else"ecard"===this.goods.type&&t.showToast({title:"虚拟商品不允许加入购物车",icon:"none"});else this.$emit("add",r,this.number)},buy:function(){var e=this;if(this.$user.isLogin()&&this.$store.state.user.info){var r=this.$store.state.user.info.identity.member_level;if(r0){o={id:u.goods_id,attr:[],num:u.number,cat_id:0,goods_attr_id:u.id};var l,c=a(u.attr_list);try{for(c.s();!(l=c.n()).done;){var h=l.value,d={attr_id:h.attr_id,attr_group_id:h.attr_group_id};o.attr.push(d)}}catch(w){c.e(w)}finally{c.f()}s[0].goods_list.push(o)}}}catch(w){n.e(w)}finally{n.f()}var p="/pages/order-submit/order-submit?mch_list=".concat(JSON.stringify(s));this.submitUrl&&this.previewUrl&&(p+="&preview_url=".concat(encodeURIComponent(this.previewUrl),"&submit_url=").concat(encodeURIComponent(this.submitUrl),"&plugin=").concat(this.plugin)),t.navigateTo({url:p})}else{var m=this.goods,f=this.number,g=this.selectAttr,_=g.id,b=[];for(var v in g.attr_list)b.push({attr_id:g.attr_list[v].attr_id,attr_group_id:g.attr_list[v].attr_group_id});var y=[{mch_id:m.mch_id?m.mch_id:0,goods_list:[{id:this.goodsId?this.goodsId:m.id,attr:b,num:f,cat_id:0,goods_attr_id:_}]}],A="/pages/order-submit/order-submit?mch_list=".concat(JSON.stringify(y));this.submitUrl&&this.previewUrl&&(A+="&preview_url=".concat(encodeURIComponent(this.previewUrl),"&submit_url=").concat(encodeURIComponent(this.submitUrl),"&plugin=").concat(this.plugin)),t.navigateTo({url:A})}}},submit:function(){var e=this.selectAttr;return"wholesale"===this.goods.sign||(e?e.stock<=0?(t.showToast({title:"库存不足",icon:"none"}),!1):this.number<=0?(t.showToast({title:"数量不能为0",icon:"none"}),!1):!!this.goods:(t.showToast({title:"请先选规格",icon:"none"}),!1))},clickImg:function(e){t.previewImage({current:0,urls:[e]})}},computed:s(s({},(0,i.mapState)({gConfig:function(t){return t.gConfig}})),{},{attrPic:function(){return this.pic_url?this.pic_url:this.goods?this.goods.cover_pic:""},priceColor:function(){return this.goods&&1===this.goods.level_show?"member":this.theme+"-color"},attrNum:function(){return this.selectAttr?this.selectAttr.stock:this.goods?this.goods.goods_num:0},attrPrice:function(){var t;return this.selectAttr?(t=1===this.goods.level_show?this.selectAttr.price_member:this.selectAttr.price,"wholesale"==this.sign?0==this.selectAttr.number?"undefined":0==this.wholesaleType?(t=(t*(this.discount/10)).toFixed(2),t):(t=(t-this.discount).toFixed(2),t):t):"wholesale"==this.sign?"undefined":this.goods?this.goods.hasOwnProperty("price_min")?this.goods.price_min:this.goods.price:0},newData:function(){var t=this.number,e=this.display,r=this.selectAttr;return{number:t,display:e,selectAttr:r}},themeObject:function(){return{back:this.theme+"-m-back "+this.theme,theme:this.theme,color:this.theme+"-m-text "+this.theme,sBack:this.theme+"-s-back "+this.theme}}},(0,i.mapGetters)("iPhoneX",{boolEmpty:"getBoolEmpty"}))};e.default=p}).call(this,r("543d")["default"])},"51d1":function(t,e,r){},"8bc3":function(t,e,r){"use strict";var i;r.d(e,"b",(function(){return o})),r.d(e,"c",(function(){return s})),r.d(e,"a",(function(){return i}));var o=function(){var t=this,e=t.$createElement;t._self._c},s=[]},b3e8:function(t,e,r){"use strict";r.r(e);var i=r("8bc3"),o=r("1a13");for(var s in o)"default"!==s&&function(t){r.d(e,t,(function(){return o[t]}))}(s);r("d91e");var n,a=r("f0c5"),u=Object(a["a"])(o["default"],i["b"],i["c"],!1,null,"674095fa",null,!1,i["a"],n);e["default"]=u.exports},d91e:function(t,e,r){"use strict";var i=r("51d1"),o=r.n(i);o.a}}]); ;(global["webpackJsonp"] = global["webpackJsonp"] || []).push([ 'components/page-component/app-attr/app-attr-create-component', { 'components/page-component/app-attr/app-attr-create-component':(function(module, exports, __webpack_require__){ __webpack_require__('543d')['createComponent'](__webpack_require__("b3e8")) }) }, [['components/page-component/app-attr/app-attr-create-component']] ]);