index.js 5.8 KB

1
  1. (global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["pages/cart/index"],{1685:function(t,e,n){"use strict";n.r(e);var o=n("eab9"),i=n.n(o);for(var a in o)["default"].indexOf(a)<0&&function(t){n.d(e,t,(function(){return o[t]}))}(a);e["default"]=i.a},"422c3":function(t,e,n){},"62fd":function(t,e,n){"use strict";(function(t,e){var o=n("4ea4");n("dc53");o(n("66fd"));var i=o(n("b42a"));t.__webpack_require_UNI_MP_PLUGIN__=n,e(i.default)}).call(this,n("bc2e")["default"],n("543d")["createPage"])},"780b":function(t,e,n){"use strict";n.d(e,"b",(function(){return i})),n.d(e,"c",(function(){return a})),n.d(e,"a",(function(){return o}));var o={navbar:function(){return Promise.all([n.e("common/vendor"),n.e("components/navbar/navbar")]).then(n.bind(null,"2445"))},mescrollBody:function(){return Promise.all([n.e("common/vendor"),n.e("uni_modules/mescroll-uni/components/mescroll-body/mescroll-body")]).then(n.bind(null,"adc6"))},uniNumberBox:function(){return n.e("components/uni-number-box/uni-number-box").then(n.bind(null,"590d"))},authorize:function(){return n.e("components/authorize/authorize").then(n.bind(null,"5841"))}},i=function(){var t=this,e=t.$createElement,n=(t._self._c,t.goods.length);t._isMounted||(t.e0=function(e,n){var o=arguments[arguments.length-1].currentTarget.dataset,i=o.eventParams||o["event-params"];n=i.item;return t.$utils.navigateTo("goods/view",{id:n.goods_id})},t.e1=function(e,n){var o=arguments[arguments.length-1].currentTarget.dataset,i=o.eventParams||o["event-params"];n=i.item;return t.$utils.navigateTo("goods/view",{id:n.goods_id})},t.e2=function(e,n){var o=arguments[arguments.length-1].currentTarget.dataset,i=o.eventParams||o["event-params"];n=i.item;return t.$utils.navigateTo("goods/view",{id:n.goods_id})}),t.$mp.data=Object.assign({},{$root:{g0:n}})},a=[]},b42a:function(t,e,n){"use strict";n.r(e);var o=n("780b"),i=n("1685");for(var a in i)["default"].indexOf(a)<0&&function(t){n.d(e,t,(function(){return i[t]}))}(a);n("d99c");var s=n("f0c5"),r=Object(s["a"])(i["default"],o["b"],o["c"],!1,null,null,null,!1,o["a"],void 0);e["default"]=r.exports},d99c:function(t,e,n){"use strict";var o=n("422c3"),i=n.n(o);i.a},eab9:function(t,e,n){"use strict";(function(t){var o=n("4ea4");Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var i=o(n("d220")),a={mixins:[i.default],components:{navbar:function(){Promise.all([n.e("common/vendor"),n.e("components/navbar/navbar")]).then(function(){return resolve(n("2445"))}.bind(null,n)).catch(n.oe)},authorize:function(){n.e("components/authorize/authorize").then(function(){return resolve(n("5841"))}.bind(null,n)).catch(n.oe)}},data:function(){return{screenHeight:0,isAuthShow:!1,isDeleteBtn:!1,isChecked:!1,goods:[],array:[],total:0,downOption:{auto:!1},upOption:{use:!0,auto:!1,isLock:!1,isBoth:!0,page:{num:0,size:10,time:null},noMoreSize:3,offset:80,bgColor:"transparent",textColor:"gray",textLoading:"加载中 ...",textNoMore:"-- END --",empty:{use:!0,icon:this.$http.domain()+"static/images/cart-empty.png",tip:"购物车为空",btnText:"",fixed:!1,top:"100rpx",zIndex:99}}}},onShow:function(){var t=this;this.$store.dispatch("usersStatus").then((function(){t.isAuthShow=!1,t.downCallback()})).catch((function(){t.isAuthShow=!0,t.mescroll.showEmpty()}))},watch:{goods:{handler:function(t,e){var n=0;this.goods.forEach((function(t,e){t.checked&&(n+=parseFloat(t.price)*t.goods_nums)})),this.isDeleteBtn=n>0,this.total=n},deep:!0}},methods:{deleteGoods:function(){var e=this,n=[];if(this.goods=this.goods.filter((function(t){return t.checked&&n.push(t),!t.checked})),n.length<=0)return 0;var o=[];return n.forEach((function(t){o.push(t.id)})),this.$http.deleteCart({id:o.join(",")}).then((function(n){n.data>0?t.setTabBarBadge({index:2,text:n.data.toString()}):(t.removeTabBarBadge({index:2}),e.mescroll.showEmpty()),e.$store.commit("UPDATECART",n.data)})).catch((function(t){})),this.isChecked=!1,n.length},onSubmit:function(){var t=[];for(var e in this.goods)this.goods[e].checked&&t.push(this.goods[e].id);if(t.length<=0)return this.$utils.msg("请选择需要结算的商品"),!1;this.$utils.navigateTo("cart/confirm",{id:t.join(","),type:"cart"})},checkboxChange:function(t){for(var e=this.goods,n=t.detail.value,o=0,i=e.length;o<i;++o){var a=e[o];n.includes(a.id+"")?this.$set(this.goods[o],"checked",!0):this.$set(this.goods[o],"checked",!1)}for(var s=0;s<this.goods.length;s++){if(this.goods[s].checked){this.isChecked=!0;break}this.isChecked=!1}},checkboxAll:function(t){this.isChecked=!this.isChecked,this.setAllCheckbox(this.isChecked)},setAllCheckbox:function(t){for(var e in this.array=[],this.goods)this.goods[e].checked=t},downCallback:function(){var t=this;setTimeout((function(){t.mescroll.resetUpScroll()}),200)},triggerDownScroll:function(){this.mescroll.triggerDownScroll()},upCallback:function(t){var e=this;this.$http.getCartList({page:t.num}).then((function(n){e.mescroll.endByPage(n.data.list.length,n.data.total),1==n.status?(1==t.num&&(e.goods=[]),n.data.list.forEach((function(t,e){n.data.list[e]["checked"]=!1,n.data.list[e]["disabled"]=!1})),e.goods=e.goods.concat(n.data.list)):-1==n.status&&e.mescroll.endErr()})).catch((function(t){e.mescroll.endErr()}))},emptyClick:function(){this.$utils.switchTab("index/index")},stepperNum:function(e,n){var o=this,i=function(i){if(o.goods[i].id==n.id)return o.goods[i].goods_nums!=e&&o.$http.updateCartGoods({id:o.goods[i].goods_id,sku_id:o.goods[i].product_id,num:e}).then((function(n){n.status?(o.goods[i].goods_nums=e,o.$store.commit("UPDATECART",n.data.count),n.data.count>0?t.setTabBarBadge({index:3,text:n.data.count.toString()}):t.removeTabBarBadge({index:3})):o.goods[i].disabled=!0})).catch((function(t){o.goods[i].disabled=!0})),"break"};for(var a in this.goods){var s=i(a);if("break"===s)break}return!1}}};e.default=a}).call(this,n("543d")["default"])}},[["62fd","common/runtime","common/vendor"]]]);