12345678910 |
- (global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["pages/store/group_cart/cart"],{"0f52":function(t,e,i){},"379a":function(t,e,i){"use strict";var r=i("0f52"),s=i.n(r);s.a},9035:function(t,e,i){"use strict";i.r(e);var r=i("ffd0"),s=i.n(r);for(var a in r)["default"].indexOf(a)<0&&function(t){i.d(e,t,(function(){return r[t]}))}(a);e["default"]=s.a},be3b:function(t,e,i){"use strict";i.d(e,"b",(function(){return s})),i.d(e,"c",(function(){return a})),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"))}},s=function(){var t=this.$createElement;this._self._c},a=[]},eec4:function(t,e,i){"use strict";i.r(e);var r=i("be3b"),s=i("9035");for(var a in s)["default"].indexOf(a)<0&&function(t){i.d(e,t,(function(){return s[t]}))}(a);i("379a");var c=i("f0c5"),n=Object(c["a"])(s["default"],r["b"],r["c"],!1,null,null,null,!1,r["a"],void 0);e["default"]=n.exports},ffd0:function(t,e,i){"use strict";(function(t){var r=i("4ea4");Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var s=r(i("9523")),a=i("bcf5"),c=i("f8b7"),n=i("8bb5"),o=i("26cb"),u=i("3e4f"),h=i("8e8a");function d(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}var l=t.getSystemInfoSync().statusBarHeight+"px",p={computed:function(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?d(Object(i),!0).forEach((function(e){(0,s.default)(t,e,i[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):d(Object(i)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}))}return t}({},(0,o.mapGetters)(["isLogin","uid"])),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)},goodClass:function(){i.e("components/goodClass/index").then(function(){return resolve(i("90d2"))}.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)}},props:{isFooter:{type:Boolean,default:!1},info:{type:Object,default:{}}},data:function(){return{deliveryList:[{name:"自提",key:2},{name:"配送",key:1}],marTop:0,switchNum:1,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,delivery_type:3,isAuto:!1,isShowAuth:!1,attr:{cartAttr:!1,productAttr:[],productSelect:{}},productValue:[],attrValue:"",storeName:"",id:0,cartData:{cartList:[],iScart:!1},totalPrice:0,lengthCart:0,is_vip:0,cart_num:0,storeInfo:{},address:{address:!1},cartNum:0}},watch:{info:function(t,e){this.switchNum=3==t.delivery_type?1:t.delivery_type}},mounted:function(){var e=this;t.getSystemInfo({success:function(t){e.isWidth=t.windowWidth/5}}),this.$nextTick(this.getMarTop)},methods:{onLoadFun:function(){setTimeout((function(){this.isShowAuth=!1}),10)},authColse:function(t){this.isShowAuth=t},updateFun:function(t){t.cartNum&&this.tempArr.forEach((function(e){e.id==t.id&&(e.cart_num=t.cartNum)}))},getProducts:function(){var t=this;t.loadend||t.loading||(t.loading=!0,(0,n.getProducts)({page:t.page,limit:t.limit,type:1,cid:t.cid,sid:t.sid,store_id:t.info.id,delivery_type:t.info.delivery_type,collate_code_id:t.info.collage_id}).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="加载更多"})))},swithFn:function(t){switch(t){case 1:this.switchNum=1,this.delivery_type="3";break;case 2:this.switchNum=2,this.delivery_type="2";break}this.page=1,this.loadend=!1,this.tempArr=[],this.getProducts()},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(){t.navigateBack()},getTotalPrice:function(){var t=this,e=t.cartData.cartList,i=0;e.forEach((function(e){i=t.$util.$h.Add(i,t.$util.$h.Mul(e.cart_num,e.truePrice))})),t.$set(t,"totalPrice",i)},ChangeSubDel:function(t){var e=this;(0,c.emptyCollagePartake)({collage_id:this.info.collage_id}).then((function(t){e.$util.Tips({title:"清空成功",success:function(){e.cartData.iScart=!1,e.getCartNum();for(var t=0;t<e.tempArr.length;t++)e.tempArr[t].cart_num&&(e.tempArr[t].cart_num=0)}})}))},ChangeOneDel:function(e,i){var r=this,s=r.cartData.cartList,c=t.getStorageSync("user_store_id");(0,a.cartDel)(e.toString(),c).then((function(t){s.splice(i,1),s.length||(r.cartData.iScart=!1,r.page=1,r.loadend=!1,r.tempArr=[],r.getProducts()),r.getCartNum()}))},getCartList:function(t){var e=this,i={store_id:e.info.id,collage_id:e.info.collage_id};(0,c.getCollageCart)(i).then((function(i){e.$set(e.cartData,"cartList",i.data),i.data.length?e.$set(e.cartData,"iScart",!t&&!e.cartData.iScart):e.$set(e.cartData,"iScart",!1),e.getTotalPrice()}))},closeList:function(t){this.$set(this.cartData,"iScart",t)},getCartNum:function(){var t=this;(0,c.getCollageCount)({store_id:this.info.id,collage_id:this.info.collage_id}).then((function(e){t.cartNum=e.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 s=this.productValue[e.join(",")];s&&t.length?(this.$set(this.attr.productSelect,"store_name",this.storeName),this.$set(this.attr.productSelect,"image",s.image),this.$set(this.attr.productSelect,"price",s.price),this.$set(this.attr.productSelect,"stock",s.stock),this.$set(this.attr.productSelect,"unique",s.unique),this.$set(this.attr.productSelect,"cart_num",1),this.$set(this.attr.productSelect,"vip_price",s.vip_price),this.$set(this,"attrValue",e.join(","))):!s&&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,"attrValue",""),this.$set(this.attr.productSelect,"vip_price",this.storeInfo.vip_price)):s||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)},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],s=this.tempArr[e].stock;this.ChangeCartNum(t,r,s,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,this.id)}},ChangeCartList:function(t,e){var i=this.cartData.cartList,r=i[e],s=i[e].trueStock;this.ChangeCartNum(t,r,s,0,r.product_id,e,1),i.length||(this.cartData.iScart=!1,this.page=1,this.loadend=!1,this.tempArr=[],this.getProducts())},ChangeCartNum:function(t,e,i,r,s,a,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?this.tempArr.forEach((function(t){t.id==s&&t.cart_num++})):c?(this.goCat(0,s,1,1,e.product_attr_unique),this.getTotalPrice(),this.tempArr.forEach((function(t){t.id==s&&t.cart_num++}))):this.goCat(0,s,1)}else e.cart_num--,0==e.cart_num&&(this.cartData.cartList.splice(a,1),r&&(this.$set(this.attr.productSelect,"cart_num",1),this.$set(this,"cart_num",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?this.tempArr.forEach((function(t){t.id==s&&t.cart_num--})):c?(this.goCat(0,s,0,1,e.product_attr_unique),this.getTotalPrice(),this.tempArr.forEach((function(t){t.id==s&&t.cart_num--}))):this.goCat(0,s,0)},goCatNum:function(){this.goCat(1,this.id,1)},goCat:function(t,e,i,r,s){var a=this;if(t){var n=a.productValue[this.attrValue];if(a.attr.productAttr.length&&void 0===n)return a.$util.Tips({title:"产品库存不足,请选择其它属性"})}var o={productId:e,cartNum:t?a.attr.productSelect.cart_num:1,collageId:this.info.collage_id,storeId:this.info.id,uniqueId:t?a.attr.productSelect.unique:r?s:"",isAdd:i};(0,c.addCollageCart)(o).then((function(e){t&&(a.attr.cartAttr=!1,a.$util.Tips({title:"添加购物车成功"}),a.tempArr.forEach((function(t,e){if(t.id==a.id){var i=a.attr.productSelect.stock,r=parseInt(t.cart_num)+parseInt(a.attr.productSelect.cart_num);t.cart_num=r>i?i:r}}))),a.getCartNum(),r||a.getCartList(1)})).catch((function(t){a.$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,h.toLogin)()},getAttrs:function(t){var e=this;(0,c.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,u.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,n.getStoreCategory)().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.getProducts()}))},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.getProducts()},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.getProducts()}},onReachBottom:function(){this.getProducts()}};e.default=p}).call(this,i("543d")["default"])}}]);
- ;(global["webpackJsonp"] = global["webpackJsonp"] || []).push([
- 'pages/store/group_cart/cart-create-component',
- {
- 'pages/store/group_cart/cart-create-component':(function(module, exports, __webpack_require__){
- __webpack_require__('543d')['createComponent'](__webpack_require__("eec4"))
- })
- },
- [['pages/store/group_cart/cart-create-component']]
- ]);
|