12345678910 |
- (global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["pages/goods_cate/goods_cate2"],{"19aa":function(t,e,i){"use strict";(function(t){var r=i("4ea4");Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var a=r(i("9523")),s=i("f8b7"),c=i("bcf5"),n=i("26cb"),o=i("3e4f"),u=i("8e8a");function h(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),i.push.apply(i,r)}return i}function d(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?h(Object(i),!0).forEach((function(e){(0,a.default)(t,e,i[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):h(Object(i)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}))}return t}var l=t.getSystemInfoSync().statusBarHeight+"px",p={props:{isFooter:{type:Boolean,default:!1}},computed:d(d({},(0,n.mapState)({cartNum:function(t){return t.indexData.cartNum}})),(0,n.mapGetters)(["isLogin","uid","cartNum"])),components:{productWindow:function(){Promise.all([i.e("common/vendor"),i.e("components/productWindow/index")]).then(function(){return resolve(i("c8cb"))}.bind(null,i)).catch(i.oe)},goodList:function(){i.e("components/d_goodList/index").then(function(){return resolve(i("5370"))}.bind(null,i)).catch(i.oe)},cartList:function(){i.e("components/cartList/index").then(function(){return resolve(i("8e01"))}.bind(null,i)).catch(i.oe)}},data:function(){return{marTop:0,sysHeight:l,categoryList:[],navActive:0,categoryTitle:"",categoryErList:[],tabLeft:0,isWidth:0,tabClick:0,iSlong:!0,tempArr:[],loading:!1,loadend:!1,loadTitle:"加载更多",page:1,limit:10,cid:0,sid:0,isAuto:!1,isShowAuth:!1,attr:{cartAttr:!1,productAttr:[],productSelect:{}},productValue:[],attrValue:"",storeName:"",id:0,cartData:{cartList:[],iScart:!1},totalPrice:0,is_vip:0,cart_num:0,storeInfo:{}}},mounted:function(){var e=this,i=this;t.getSystemInfo({success:function(t){i.isWidth=t.windowWidth/5}}),t.$on("newAttrNum",(function(t){t.length&&e.tempArr.forEach((function(e){t.forEach((function(t){e.id==t.id&&(e.cart_num=t.num)}))}))})),t.$on("newCartNum",(function(t){t.length&&e.tempArr.forEach((function(e){t.forEach((function(t){e.id==t.product_id&&(e.cart_num=0)}))}))}))},methods:{getNoCart:function(){this.cartNum<=0&&(this.tempArr.forEach((function(t){t.cart_num=0})),this.totalPrice=0)},updateFun:function(t){t.cartNum&&this.tempArr.forEach((function(e){e.id==t.id&&(e.cart_num=t.cartNum)}))},getMarTop:function(){var e=this,i=this;setTimeout((function(){var r=t.createSelectorQuery().in(e).select(".mp-header");r.boundingClientRect((function(t){i.marTop=t.height})).exec()}),100)},subOrder:function(){var e=1,i=0,r=this.cartData.cartList,a=[];if(!r.length)return this.$util.Tips({title:"请选择产品"});r.forEach((function(t){t.attrStatus&&t.status&&a.push(t.id)}));var s=r[0].productInfo.delivery_type.sort((function(t,e){return t-e}));e=s[0],i=1==r[0].productInfo.type?r[0].productInfo.relation_id:0,t.navigateTo({url:"/pages/goods/order_confirm/index?cartId="+a.join(",")+"&delivery_type="+e+"&store_id="+i}),this.cartData.iScart=!1},getTotalPrice:function(){var t=this,e=t.cartData.cartList,i=0;e.forEach((function(e){e.attrStatus&&e.status&&(i=t.$util.$h.Add(i,t.$util.$h.Mul(e.cart_num,e.truePrice)))})),t.$set(t,"totalPrice",i)},ChangeSubDel:function(e){var i=this,r=i.cartData.cartList,a=[],s=t.getStorageSync("user_store_id");r.forEach((function(t){a.push(t.id)})),(0,c.cartDel)(a.join(","),s).then((function(t){i.$set(i.cartData,"cartList",[]),i.cartData.iScart=!1,i.totalPrice=0,i.page=1,i.loadend=!1,i.tempArr=[],i.productslist(),i.getCartNum()}))},ChangeOneDel:function(e,i){var r=this,a=r.cartData.cartList,s=t.getStorageSync("user_store_id");(0,c.cartDel)(e.toString(),s).then((function(t){a.splice(i,1),a.length||(r.cartData.iScart=!1,r.page=1,r.loadend=!1,r.tempArr=[],r.productslist()),r.getCartNum()}))},getCartList:function(t){var e=this,i=this;(0,c.vcartList)().then((function(r){i.$set(i.cartData,"cartList",r.data),r.data.length?i.$set(i.cartData,"iScart",!t&&!i.cartData.iScart):i.$set(i.cartData,"iScart",!1),r.data.length||(e.$store.commit("indexData/setCartNum",0),e.tempArr.forEach((function(t){t.cart_num=0}))),i.getTotalPrice()}))},closeList:function(t){this.$set(this.cartData,"iScart",t)},getCartNum:function(){var e=this,i=t.getStorageSync("user_store_id")||0;(0,c.getCartCounts)(0,i).then((function(t){e.$store.commit("indexData/setCartNum",t.data.count)}))},onMyEvent:function(){this.$set(this.attr,"cartAttr",!1)},DefaultSelect:function(){var t=this.attr.productAttr,e=[];for(var i in this.productValue)if(this.productValue[i].stock>0){e=this.attr.productAttr.length?i.split(","):[];break}for(var r=0;r<t.length;r++)this.$set(t[r],"index",e[r]);var a=this.productValue[e.join(",")];a&&t.length?(this.$set(this.attr.productSelect,"store_name",this.storeName),this.$set(this.attr.productSelect,"image",a.image),this.$set(this.attr.productSelect,"price",a.price),this.$set(this.attr.productSelect,"stock",a.stock),this.$set(this.attr.productSelect,"unique",a.unique),this.$set(this.attr.productSelect,"cart_num",1),this.$set(this.attr.productSelect,"vip_price",a.vip_price),this.$set(this,"attrValue",e.join(","))):!a&&t.length?(this.$set(this.attr.productSelect,"store_name",this.storeName),this.$set(this.attr.productSelect,"image",this.storeInfo.image),this.$set(this.attr.productSelect,"price",this.storeInfo.price),this.$set(this.attr.productSelect,"stock",0),this.$set(this.attr.productSelect,"unique",""),this.$set(this.attr.productSelect,"cart_num",0),this.$set(this.attr.productSelect,"vip_price",this.storeInfo.vip_price),this.$set(this,"attrValue","")):a||t.length||(this.$set(this.attr.productSelect,"store_name",this.storeName),this.$set(this.attr.productSelect,"image",this.storeInfo.image),this.$set(this.attr.productSelect,"price",this.storeInfo.price),this.$set(this.attr.productSelect,"stock",this.storeInfo.stock),this.$set(this.attr.productSelect,"unique",this.storeInfo.unique||""),this.$set(this.attr.productSelect,"cart_num",1),this.$set(this,"attrValue",""),this.$set(this.attr.productSelect,"vip_price",this.storeInfo.vip_price))},ChangeAttr:function(t){var e=this.productValue[t];e&&e.stock>0?(this.$set(this.attr.productSelect,"image",e.image),this.$set(this.attr.productSelect,"price",e.price),this.$set(this.attr.productSelect,"stock",e.stock),this.$set(this.attr.productSelect,"unique",e.unique),this.$set(this.attr.productSelect,"vip_price",e.vip_price),this.$set(this.attr.productSelect,"cart_num",1),this.$set(this,"attrValue",t)):e&&0==e.stock?(this.$set(this.attr.productSelect,"image",e.image),this.$set(this.attr.productSelect,"price",e.price),this.$set(this.attr.productSelect,"stock",0),this.$set(this.attr.productSelect,"unique",""),this.$set(this.attr.productSelect,"vip_price",e.vip_price),this.$set(this.attr.productSelect,"cart_num",0),this.$set(this,"attrValue","")):(this.$set(this.attr.productSelect,"image",this.storeInfo.image),this.$set(this.attr.productSelect,"price",this.storeInfo.price),this.$set(this.attr.productSelect,"stock",0),this.$set(this.attr.productSelect,"unique",""),this.$set(this.attr.productSelect,"vip_price",this.storeInfo.vip_price),this.$set(this.attr.productSelect,"cart_num",0),this.$set(this,"attrValue",""))},attrVal:function(t){this.$set(this.attr.productAttr[t.indexw],"index",this.attr.productAttr[t.indexw].attr_values[t.indexn])},iptCartNum:function(t){this.$set(this.attr.productSelect,"cart_num",t)},productslist:function(){var t=this;t.loadend||t.loading||(t.loading=!0,t.loadTitle="",(0,s.getProductslist)({page:t.page,limit:t.limit,type:1,cid:t.cid,sid:t.sid}).then((function(e){var i=e.data,r=i.length<t.limit;t.tempArr=t.$util.SplitArray(i,t.tempArr),t.$set(t,"tempArr",t.tempArr),t.loading=!1,t.loadend=r,t.loadTitle=r?"没有更多内容啦~":"加载更多",t.page=t.page+1})).catch((function(e){t.loading=!1,t.loadTitle="加载更多"})))},goCartDan:function(t,e){this.isLogin?(this.tempArr[e].cart_num=1,this.$set(this,"tempArr",this.tempArr),this.goCat(0,t.id,1)):this.getIsLogin()},ChangeCartNumDan:function(t,e,i){var r=this.tempArr[e],a=this.tempArr[e].stock;this.ChangeCartNum(t,r,a,0,i.id)},ChangeCartNumDuo:function(t){var e=this.productValue[this.attrValue];if(void 0!==e||this.attr.productAttr.length||(e=this.attr.productSelect),void 0!==e){var i=e.stock||0,r=this.attr.productSelect;this.ChangeCartNum(t,r,i,1)}},ChangeCartList:function(t,e){var i=this.cartData.cartList,r=i[e],a=i[e].trueStock;this.ChangeCartNum(t,r,a,0,r.product_id,e,1),i.length||(this.cartData.iScart=!1,this.page=1,this.loadend=!1,this.tempArr=[],this.productslist())},ChangeCartNum:function(t,e,i,r,a,s,c){if(t){if(e.cart_num++,e.cart_num>i)return r?(this.$set(this.attr.productSelect,"cart_num",i||1),this.$set(this,"cart_num",i||1)):(e.cart_num=i||0,this.$set(this,"tempArr",this.tempArr),this.$set(this.cartData,"cartList",this.cartData.cartList)),this.$util.Tips({title:"该产品没有更多库存了"});r||(c?(this.goCat(0,a,1,1,e.product_attr_unique),this.getTotalPrice()):this.goCat(0,a,1))}else e.cart_num--,0==e.cart_num&&this.cartData.cartList.splice(s,1),e.cart_num<0?r?(this.$set(this.attr.productSelect,"cart_num",1),this.$set(this,"cart_num",1)):(e.cart_num=0,this.$set(this,"tempArr",this.tempArr),this.$set(this.cartData,"cartList",this.cartData.cartList)):r||(c?(this.goCat(0,a,0,1,e.product_attr_unique),this.getTotalPrice()):this.goCat(0,a,0));this.tempArr.forEach((function(t){t.id==a&&(t.cart_num=e.cart_num)}))},goCatNum:function(){this.goCat(1,this.id,1)},goCat:function(t,e,i,r,a){var c=this;if(t){var n=c.productValue[this.attrValue];if(c.attr.productAttr.length&&void 0===n)return c.$util.Tips({title:"产品库存不足,请选择其它属性"})}var o={product_id:e,num:t?c.attr.productSelect.cart_num:1,type:i,unique:t?c.attr.productSelect.unique:r?a:""};(0,s.postCartNum)(o).then((function(e){t&&(c.attr.cartAttr=!1,c.$util.Tips({title:"添加购物车成功"}),c.tempArr.forEach((function(t,e){if(t.id==c.id){var i=c.attr.productSelect.stock,r=parseInt(t.cart_num)+parseInt(c.attr.productSelect.cart_num);t.cart_num=r>i?i:r}}))),c.getCartNum(),r||c.getCartList(1)})).catch((function(t){return c.$util.Tips({title:t})}))},goCartDuo:function(t){this.isLogin?(this.storeName=t.store_name,this.getAttrs(t.id),this.$set(this,"id",t.id),this.$set(this.attr,"cartAttr",!0)):this.getIsLogin()},getIsLogin:function(){(0,u.toLogin)()},getAttrs:function(t){var e=this;(0,s.getAttr)(t,0).then((function(t){e.$set(e.attr,"productAttr",t.data.productAttr),e.$set(e,"productValue",t.data.productValue),e.$set(e,"is_vip",t.data.storeInfo.is_vip),e.$set(e,"storeInfo",t.data.storeInfo),e.DefaultSelect()}))},goDetail:function(e){(0,o.goShopDetail)(e,this.uid).then((function(i){t.navigateTo({url:"/pages/goods_details/index?id=".concat(e.id,"&fromType=1")})}))},openTap:function(){this.iSlong=!1},closeTap:function(){this.iSlong=!0},getAllCategory:function(){var t=this;(0,s.getCategoryList)().then((function(e){var i=e.data;i.forEach((function(t){t.children.unshift({id:0,cate_name:"全部"})})),t.categoryTitle=i[0].cate_name,t.cid=i[0].id,t.sid=0,t.navActive=0,t.tabClick=0,t.categoryList=i,t.categoryErList=e.data[0].children?e.data[0].children:[],t.page=1,t.loadend=!1,t.tempArr=[],t.productslist()}))},tapNav:function(e,i){t.pageScrollTo({duration:0,scrollTop:0});var r=this.categoryList[e];this.navActive=e,this.categoryTitle=r.cate_name,this.categoryErList=i.children?i.children:[],this.tabClick=0,this.tabLeft=0,this.cid=r.id,this.sid=0,this.page=1,this.loadend=!1,this.tempArr=[],this.productslist()},longClick:function(t){this.categoryErList.length>3&&(this.tabLeft=(t-1)*(this.isWidth+6)),this.tabClick=t,this.iSlong=!0,this.sid=this.categoryErList[t].id,this.page=1,this.loadend=!1,this.tempArr=[],this.productslist()}}};e.default=p}).call(this,i("543d")["default"])},"8d1b":function(t,e,i){},ac22:function(t,e,i){"use strict";i.r(e);var r=i("19aa"),a=i.n(r);for(var s in r)["default"].indexOf(s)<0&&function(t){i.d(e,t,(function(){return r[t]}))}(s);e["default"]=a.a},b48b:function(t,e,i){"use strict";var r=i("8d1b"),a=i.n(r);a.a},bf19:function(t,e,i){"use strict";i.r(e);var r=i("d7d2"),a=i("ac22");for(var s in a)["default"].indexOf(s)<0&&function(t){i.d(e,t,(function(){return a[t]}))}(s);i("b48b");var c=i("f0c5"),n=Object(c["a"])(a["default"],r["b"],r["c"],!1,null,null,null,!1,r["a"],void 0);e["default"]=n.exports},d7d2:function(t,e,i){"use strict";i.d(e,"b",(function(){return a})),i.d(e,"c",(function(){return s})),i.d(e,"a",(function(){return r}));var r={uniBadge:function(){return i.e("uni_modules/uni-badge/components/uni-badge/uni-badge").then(i.bind(null,"f8f0"))}},a=function(){var t=this.$createElement;this._self._c},s=[]}}]);
- ;(global["webpackJsonp"] = global["webpackJsonp"] || []).push([
- 'pages/goods_cate/goods_cate2-create-component',
- {
- 'pages/goods_cate/goods_cate2-create-component':(function(module, exports, __webpack_require__){
- __webpack_require__('543d')['createComponent'](__webpack_require__("bf19"))
- })
- },
- [['pages/goods_cate/goods_cate2-create-component']]
- ]);
|