11 lines
6.1 KiB
JavaScript
11 lines
6.1 KiB
JavaScript
(global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["components/spec-popup/spec-popup"],{1030:function(e,t,o){"use strict";o.r(t);var s=o("9d4a"),i=o("c5ca");for(var n in i)["default"].indexOf(n)<0&&function(e){o.d(t,e,(function(){return i[e]}))}(n);o("dcb6");var c=o("828b"),u=Object(c["a"])(i["default"],s["b"],s["c"],!1,null,"5b4cfe84",null,!1,s["a"],void 0);t["default"]=u.exports},"638a":function(e,t,o){},"9d4a":function(e,t,o){"use strict";o.d(t,"b",(function(){return i})),o.d(t,"c",(function(){return n})),o.d(t,"a",(function(){return s}));var s={uPopup:function(){return o.e("components/uview-ui/components/u-popup/u-popup").then(o.bind(null,"b12c"))},uImage:function(){return o.e("components/uview-ui/components/u-image/u-image").then(o.bind(null,"28a8"))},priceFormat:function(){return o.e("components/price-format/price-format").then(o.bind(null,"1738"))},uNumberBox:function(){return o.e("components/uview-ui/components/u-number-box/u-number-box").then(o.bind(null,"e5e8"))}},i=function(){var e=this,t=e.$createElement,o=(e._self._c,e.__map(e.specList,(function(t,o){var s=e.__get_orig(t),i=e.__map(t.spec_value,(function(t,s){var i=e.__get_orig(t),n=e.checkedGoods.spec_value_ids_arr[o]!=t.id&&e.isDisable(t.id),c=e.isDisable(t.id);return{$orig:i,m0:n,m1:c}}));return{$orig:s,l0:i}}))),s=e.shop.is_pay?e.specValueText.indexOf("请选择"):null,i=e.showComfirm?e.specValueText.indexOf("请选择"):null;e.$mp.data=Object.assign({},{$root:{l1:o,g0:s,g1:i}})},n=[]},c5ca:function(e,t,o){"use strict";o.r(t);var s=o("d241"),i=o.n(s);for(var n in s)["default"].indexOf(n)<0&&function(e){o.d(t,e,(function(){return s[e]}))}(n);t["default"]=i.a},d241:function(e,t,o){"use strict";(function(e){var s=o("47a9");Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i=s(o("af34")),n={data:function(){return{shop:{},checkedGoods:{stock:0},outOfStock:[],specList:[],disable:[],goodsNum:1,showPop:!1}},props:{show:{type:Boolean},goods:{type:Object},showAdd:{type:Boolean,default:!0},showBuy:{type:Boolean,default:!0},showConfirm:{type:Boolean,default:!1},redBtnText:{type:String,default:"立即购买"},yellowBtnText:{type:String,default:"加入购物车"},showStock:{type:Boolean,default:!0},group:{type:Boolean,default:!1},isSeckill:{type:Boolean,default:!1},type:{type:Number,default:1},showComfirm:{type:Boolean,default:!1}},computed:{specValueText:function(){var e,t,o,s=this,i=null===(e=this.checkedGoods.spec_value_ids)||void 0===e?void 0:e.split(","),n="";return i&&i.forEach((function(e,t){""==e&&(n+=s.specList[t].name+",")})),0!=(null===(t=this.checkedGoods)||void 0===t?void 0:t.stock)&&""==n?"已选择 ".concat(this.checkedGoods.spec_value_str," ").concat(this.goodsNum," 件"):0!=(null===(o=this.checkedGoods)||void 0===o?void 0:o.stock)&&n.length?"请选择 ".concat(n.slice(0,n.length-1)):"库存不足"}},watch:{goods:function(e){console.log(e,12345),this.specList=e.goods_spec||[];var t=e.goods_item||[];this.shop=e.shop||{},this.outOfStock=t.filter((function(e){return 0==e.stock}));var o=t.filter((function(e){return 0!=e.stock}));0!=o.length?(o[0].spec_value_ids_arr=o[0].spec_value_ids.split(","),this.checkedGoods=o[0]):(t[0].spec_value_ids_arr=[],this.disable=t.map((function(e){return e.spec_value_ids.split(",")})),this.checkedGoods=t[0])},specList:function(e){var t=this,o=this.goods.goods_item.filter((function(e){return t.checkedGoods.spec_value_ids===e.spec_value_ids}));if(0!=o.length){var s=JSON.parse(JSON.stringify(o[0]));s.spec_value_ids_arr=s.spec_value_ids.split(","),this.checkedGoods=s,this.checkedGoods.stock<this.goodsNum&&(this.goodsNum=this.checkedGoods.stock),this.$emit("change",{detail:this.checkedGoods})}var i=this.checkedGoods.spec_value_ids_arr,n=this.outOfStock,c=this.getArrResult(i,n);this.disable=this.getOutOfStockArr(c,i)},show:function(e){this.showPop=e}},created:function(){console.log("spec")},methods:{isDisable:function(e){if(this.disable.includes(e))return!0;var t=this.checkedGoods,o=this.goods.goods_item.filter((function(e){return 0==t.stock&&t.spec_value_ids===e.spec_value_ids}));return o.length?t.spec_value_ids_arr.includes(e+""):void 0},onClose:function(){this.$emit("close")},onClick:function(e){var t=this.checkedGoods,o=this.goodsNum;return-1!=this.specValueText.indexOf("请选择")?this.$toast({title:this.specValueText}):0==t.stock?this.$toast({title:"当前选择库存不足"}):(t.goodsNum=o,t.type=this.type,console.log("checkedGoods",t),void this.$emit(e,{detail:t}))},choseSpecItem:function(e,t){var o=this.specList[e].spec_value[t].id,s=this.checkedGoods.spec_value_ids_arr;o==s[e]?s[e]="":s[e]=o,this.checkedGoods.spec_value_ids_arr=s,this.checkedGoods.spec_value_ids=s.join(","),console.log(this.checkedGoods),this.specList=(0,i.default)(this.specList)},getOutOfStockArr:function(e,t){var o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];return e.forEach((function(e){e.num>=t.length-1&&o.push.apply(o,(0,i.default)(e.different))})),o},getArrIdentical:function(e,t){var o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;return e.forEach((function(e){t.forEach((function(t){e==t&&(s+=1,o.push(e))}))})),{num:s,different:this.getArrDifference((0,i.default)(new Set(o)).map(Number),t.map(Number)),identical:(0,i.default)(new Set(o))}},getArrResult:function(e,t){var o=this,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];return t.forEach((function(t){var i=o.getArrIdentical(e,t.spec_value_ids.split(","));void 0!=i&&0!=i.length&&s.push(i)})),s},getArrDifference:function(e,t){return e.concat(t).filter((function(e,t,o){return o.indexOf(e)==o.lastIndexOf(e)}))},previewImage:function(t){e.previewImage({current:t,urls:[t]})}}};t.default=n}).call(this,o("df3c")["default"])},dcb6:function(e,t,o){"use strict";var s=o("638a"),i=o.n(s);i.a}}]);
|
|
;(global["webpackJsonp"] = global["webpackJsonp"] || []).push([
|
|
'components/spec-popup/spec-popup-create-component',
|
|
{
|
|
'components/spec-popup/spec-popup-create-component':(function(module, exports, __webpack_require__){
|
|
__webpack_require__('df3c')['createComponent'](__webpack_require__("1030"))
|
|
})
|
|
},
|
|
[['components/spec-popup/spec-popup-create-component']]
|
|
]);
|