You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1 line
16 KiB

(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["pages-views-tabBar-cart"],{"17b1":function(t,e,i){"use strict";var n=i("4ea4");i("4160"),i("a434"),i("a9e3"),i("b680"),i("159b"),Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var a=n(i("ade3")),o=i("a8b2"),s=getApp(),c={data:function(){return{colors:"",statusBarHeight:20,cartList:[],current:99999,allCurrent:!1,sum:0,sumPrice:0,lock:!1,bottomShow:"",showHeader:!1}},components:{},props:{},onLoad:function(t){this.bottomShow="100upx"},onReady:function(){},onShow:function(){var t=(0,o.getCart)()||[];console.log(t),this.setData({colors:s.globalData.newColor,current:"99999",cartList:t,allCurrent:!1,sum:0,sumPrice:0}),console.log(this.cartList);var e=(0,o.getCartNumber)()||0;uni.setTabBarBadge({index:2,text:String(e)})},onHide:function(){},onUnload:function(){},onPullDownRefresh:function(){},onReachBottom:function(){},onShareAppMessage:function(){},methods:{setCurrent:function(t,e){var i;if(1!=t.status){var n=this.cartList,o=this.cartList[e];o.current=!o.current;var s="cartList["+e+"]",c=!1,r=[];n.forEach((function(t){1==t.current&&r.push(t)})),r.length==n.length&&(c=!0),this.setData((i={},(0,a.default)(i,s,o),(0,a.default)(i,"allCurrent",c),i)),this.getSumprice()}},onshowDel:function(t,e){this.setData({current:e,lock:!0})},delItem:function(t,e){this.cartList.splice(e,1),this.setData({current:"9999",lock:!1}),uni.showToast({title:"删除成功",icon:"none"}),this.setTabBarBadge()},oncencal:function(){this.setData({current:"99999"})},onsub:function(t,e){if(!(1==t.status||t.number<=1)){var i=t.number-1;this.$set(t,"number",i),this.getSumprice()}},onadd:function(t,e){if(1!=t.status){var i=t.number+1;this.$set(t,"number",i),this.getSumprice()}},setAllCurrent:function(){var t=this,e=t.cartList,i=t.allCurrent,n=!0;e.forEach((function(t){1==t.status&&(uni.showToast({title:"存在失效商品",icon:"none"}),n=!1)})),0!=n&&(e.forEach((function(t){t.current=!i})),i=!i,t.setData({cartList:e,allCurrent:i}),t.getSumprice())},getSumprice:function(){var t=this,e=t.cartList,i="",n=[];e.forEach((function(t){1==t.current&&n.push(t)}));for(var a=n.length,o=0;o<a;o++){var s=n[o];i=s.selectSku?(Number(i)+Number(s.selectSku.money*s.number)).toFixed(2):(Number(i)+Number(s.money*s.number)).toFixed(2)}t.sum=a,t.sumPrice=i},ontouchend:function(){var t=this;console.log("触发了touch"),this.lock&&setTimeout((function(){t.setData({lock:!1})}),100)},clearInvalid:function(){var t=this;this.cartList.forEach((function(e,i){1==e.status&&t.cartList.splice(i,1),e.current=!1})),uni.showToast({title:"清空成功~",icon:"none"}),this.setTabBarBadge()},delectAll:function(){this.cartList=[],(0,o.removeCart)(),this.setTabBarBadge()},setTabBarBadge:function(){var t=String(this.cartList.length);0!=t?uni.setTabBarBadge({index:2,text:t}):uni.removeTabBarBadge({index:2})},jumpDetails:function(t,e){if(1!=t.status&&!this.lock){var i=(0,o.getCartDetails_goods_id)(t.goods_id);console.log(i),(0,o.setGoodsDetails)(i),uni.navigateTo({url:"/pages/views/goods/goodsDetails"})}},settlement:function(){if(0!=this.sum){uni.showLoading({title:"提交中..."});var t=[];this.cartList.forEach((function(e){1==e.current&&t.push(e)})),(0,o.setGoodsData)(t),setTimeout((function(){uni.hideLoading(),uni.navigateTo({url:"/pages/views/order/confirmOrder"})}),1e3)}},onStroll:function(){uni.switchTab({url:"/pages/views/tabBar/category"})}}};e.default=c},"273b":function(t,e,i){var n=i("7d8c");"string"===typeof n&&(n=[[t.i,n,""]]),n.locals&&(t.exports=n.locals);var a=i("4f06").default;a("8422f056",n,!0,{sourceMap:!1,shadowMode:!1})},"66bb":function(t,e,i){"use strict";var n;i.d(e,"b",(function(){return a})),i.d(e,"c",(function(){return o})),i.d(e,"a",(function(){return n}));var a=function(){var t=this,e=t.$createElement,i=t._self._c||e;return i("v-uni-view",{staticClass:"cart",staticStyle:{"background-color":"#5f6f7","min-height":"100vh"}},[0!==t.cartList.length?[i("v-uni-view",{staticClass:"clearCart",style:{top:1==t.showHeader?t.statusBarHeight+"px":"0upx"},on:{click:function(e){arguments[0]=e=t.$handleEvent(e),t.clearI