| 12345678910 |
- (global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["components/goods-spec/goods-spec"],{"42ed":function(t,e,n){"use strict";n.r(e);var o=n("d411"),i=n.n(o);for(var s in o)["default"].indexOf(s)<0&&function(t){n.d(e,t,(function(){return o[t]}))}(s);e["default"]=i.a},"968b":function(t,e,n){},add9:function(t,e,n){"use strict";n.d(e,"b",(function(){return i})),n.d(e,"c",(function(){return s})),n.d(e,"a",(function(){return o}));var o={uPopup:function(){return n.e("components/uview-ui/components/u-popup/u-popup").then(n.bind(null,"002f"))},uImage:function(){return n.e("components/uview-ui/components/u-image/u-image").then(n.bind(null,"566d"))},price:function(){return n.e("components/price/price").then(n.bind(null,"1266"))},uNumberBox:function(){return n.e("components/uview-ui/components/u-number-box/u-number-box").then(n.bind(null,"0662"))},uModal:function(){return n.e("components/uview-ui/components/u-modal/u-modal").then(n.bind(null,"e709"))}},i=function(){var t=this,e=t.$createElement,n=(t._self._c,t.__map(t.specList,(function(e,n){var o=t.__get_orig(e),i=t.__map(e.spec_list,(function(e,n){var o=t.__get_orig(e),i=t.specDisabeld(e.id);return{$orig:o,m0:i}}));return{$orig:o,l0:i}}))),o=0!=t.goodsOptionsSpec.stock?t.__map(t.buttons,(function(e,n){var o=t.__get_orig(e),i=t.__get_style([e.style]);return{$orig:o,s0:i}})):null;t._isMounted||(t.e0=function(e){t.showModal=!1}),t.$mp.data=Object.assign({},{$root:{l1:n,l2:o}})},s=[]},b12d:function(t,e,n){"use strict";n.r(e);var o=n("add9"),i=n("42ed");for(var s in i)["default"].indexOf(s)<0&&function(t){n.d(e,t,(function(){return i[t]}))}(s);n("b1f3");var c=n("828b"),u=Object(c["a"])(i["default"],o["b"],o["c"],!1,null,"4d843153",null,!1,o["a"],void 0);e["default"]=u.exports},b1f3:function(t,e,n){"use strict";var o=n("968b"),i=n.n(o);i.a},d411:function(t,e,n){"use strict";(function(t){var o=n("47a9");Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var i=o(n("7eb4")),s=o(n("af34")),c=o(n("ee10")),u=o(n("7ca3")),r=n("30a0"),a=n("8f59"),d=n("dc70");function l(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,o)}return n}function p(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?l(Object(n),!0).forEach((function(e){(0,u.default)(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):l(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}var f={name:"GoodsSpec",props:{isNoMarking:{type:Boolean,default:!1},value:{type:Boolean,default:!1},mode:{type:String,default:"normal"},buttons:{type:Array,default:function(){return[{text:"立即购买",style:{},event:"buy"}]}},specList:{type:Array,default:function(){return[]}},specMap:{type:Array,default:function(){return[]}},priceKey:{type:String,default:"sell_price"},defaultInfo:{type:Object,default:function(){return{}}},isBargain:{type:Boolean,default:!1},reCheck:{type:Number,default:0},cartId:{type:Number,default:0},stock_show:{type:Boolean,default:!0}},data:function(){return{specMapTable:new Map,specCheckedList:[],goodsTotal:1,goodsOptionsSpec:{},nullSpec:[],showModal:!1}},computed:p(p({},(0,a.mapGetters)(["isLogin"])),{},{show:{get:function(){return this.value},set:function(t){this.$emit("input",t)}},specCheckedIds:function(){return this.specCheckedList.map((function(t){return t.id})).filter((function(t){return t})).join(",")},specDisabeld:function(){var t=this;return function(e){return t.nullSpec.find((function(t){return t==e}))}},addGoodsMax:function(){var t=1;return 1===this.defaultInfo.limit_type?t=this.goodsOptionsSpec.stock:2!=this.defaultInfo.limit_type&&3!=this.defaultInfo.limit_type||(t=this.goodsOptionsSpec.stock<=this.defaultInfo.limit_value?this.goodsOptionsSpec.stock:this.defaultInfo.limit_value),t}},a.mapGetters["isLogin"]),methods:{handlereCheck:function(){var e=this;return(0,c.default)(i.default.mark((function n(){return i.default.wrap((function(n){while(1)switch(n.prev=n.next){case 0:return n.prev=0,n.next=3,(0,d.apieditgoodsitem)({cart_id:e.cartId,item_id:e.goodsOptionsSpec.id,goods_num:e.goodsTotal});case 3:t.switchTab({url:"/pages/shop_cart/shop_cart"}),n.next=9;break;case 6:n.prev=6,n.t0=n["catch"](0),console.log(n.t0);case 9:case"end":return n.stop()}}),n,null,[[0,6]])})))()},changeSpecOption:function(t,e){var n=this.specCheckedList[t].id;n==e&&(e=""),this.$set(this.specCheckedList[t],"id",e)},onButtonHandle:function(t){var e=this;(0,r.apicheckCanBuy)({item_id:this.goodsOptionsSpec.id,num:this.goodsTotal}).then((function(n){var o=e.checkGoodsLimit(t);if(o)return e.$toast({title:"当前商品限购".concat(e.defaultInfo.limit_value,"件,已超出!")});var i=e.specCheckedList.find((function(t){return!t.id}));i?e.$toast({title:"请选择".concat(i.name)}):(e.show=!1,e.throwSpecEmit(t))}),(function(t){if(!e.isLogin)return e.$Router.push("/pages/login/login");e.showModal=!0}))},throwSpecEmit:function(t){this.$emit(t,{spec:this.goodsOptionsSpec,number:this.goodsTotal})},previewGoodsImage:function(){var e=this.goodsOptionsSpec.image||this.defaultInfo.image;t.previewImage({urls:[e]}),this.$emit("closer")},checkStock:function(){var t=this,e=this.specMap.filter((function(t){return 0==t.stock}));this.nullSpec=e.reduce((function(e,n){var o=n.spec_value_ids.split(","),i=t.specCheckedIds.split(","),c=o.filter((function(e){return t.specCheckedIds.includes(e)}));return t.specCheckedIds?n.spec_value_ids==t.specCheckedIds?e.concat.apply(e,(0,s.default)(i)):c.length&&c.length==t.specCheckedList.length-1?e.concat(o.filter((function(e){return!t.specCheckedIds.includes(e)}))):e:e}),[])},checkGoodsLimit:function(t){if(1===this.defaultInfo.limit_type)return!1;switch(t){case"cart":if(this.defaultInfo.cart_goods_num+this.goodsTotal>this.defaultInfo.limit_value)return!0;break;case"buy":if(2===this.defaultInfo.limit_type&&this.defaultInfo.buy_num+this.goodsTotal>this.defaultInfo.limit_value)return!0;break}}},watch:{specCheckedList:{handler:function(t){var e=this.specMapTable.get(this.specCheckedIds);console.log(e,1111),this.checkStock(),this.goodsTotal>(null===e||void 0===e?void 0:e.stock)&&(this.goodsTotal=e.stock),0==(null===e||void 0===e?void 0:e.stock)&&(this.goodsTotal=1),this.goodsOptionsSpec=e||{},this.throwSpecEmit("change")},deep:!0},specMap:{handler:function(t){var e=this;t.map((function(t){return e.specMapTable.set(t.spec_value_ids,t)}));var n=t.find((function(t){return t.stock})),o=n?n.spec_value_ids.split(","):"";this.specCheckedList=this.specList.map((function(t,e){return{name:t.name,id:o[e]||t.spec_list[0].id}}))},immediate:!0}}};e.default=f}).call(this,n("df3c")["default"])}}]);
- ;(global["webpackJsonp"] = global["webpackJsonp"] || []).push([
- 'components/goods-spec/goods-spec-create-component',
- {
- 'components/goods-spec/goods-spec-create-component':(function(module, exports, __webpack_require__){
- __webpack_require__('df3c')['createComponent'](__webpack_require__("b12d"))
- })
- },
- [['components/goods-spec/goods-spec-create-component']]
- ]);
|