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
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.clearInvalid.apply(void 0,arguments)}}},[t._v("购物车")]),i("v-uni-view",{staticClass:"cart_box"},[t._l(t.cartList,(function(e,n){return i("v-uni-view",{key:n,staticClass:"cart_list",on:{longpress:function(i){i.stopPropagation(),arguments[0]=i=t.$handleEvent(i),t.onshowDel(e,n)},touchend:function(e){arguments[0]=e=t.$handleEvent(e),t.ontouchend.apply(void 0,arguments)}}},[i("v-uni-view",{staticClass:"checkbox-box",on:{click:function(i){arguments[0]=i=t.$handleEvent(i),t.setCurrent(e,n)}}},[1!==e.status?i("v-uni-view",{staticClass:"checkbox text-xxl",staticStyle:{border:"0px"}},[i("v-uni-text",{staticClass:"cuIcon-roundcheckfill ",class:1==e.current?"text-green":"text-gray"})],1):i("v-uni-view",{staticClass:"checkbox",staticStyle:{"border-color":"#ccc"}},[i("v-uni-view")],1)],1),i("v-uni-view",{staticClass:"cover",on:{click:function(i){arguments[0]=i=t.$handleEvent(i),t.jumpDetails(e,n)}}},[e.selectSku?i("v-uni-image",{attrs:{src:e.selectSku.img,mode:"aspectFill"}}):i("v-uni-image",{attrs:{src:e.img,mode:"aspectFill"}}),i("v-uni-text",{staticClass:"masks"}),1==e.status?i("v-uni-text",{staticClass:"mask"},[t._v("已失效")]):t._e()],1),i("v-uni-view",{staticClass:"right"},[i("v-uni-view",{staticClass:"goods_name",on:{click:function(i){arguments[0]=i=t.$handleEvent(i),t.jumpDetails(e,n)}}},[t._v(t._s(e.title))]),i("v-uni-view",{staticClass:"sku"},[e.selectSku?[i("v-uni-text",{staticStyle:{"margin-left":"10upx"}},[t._v(t._s(e.selectSku.goods_sku_text))])]:[i("v-uni-text",[t._v("暂无规格")])]],2),i("v-uni-view",{staticClass:"numbers"},[e.selectSku?i("v-uni-text",{staticClass:"price"},[t._v("¥"+t._s((Number(e.selectSku.money)*e.number).toFixed(2)))]):i("v-uni-text",{staticClass:"price"},[t._v("¥"+t._s((Number(e.money)*e.number).toFixed(2)))]),i("v-uni-view",{staticClass:"right_btn"},[i("v-uni-view",{staticClass:"sub",style:"color:"+(1==e.num?"#ccc":""),on:{click:function(i){arguments[0]=i=t.$handleEvent(i),t.onsub(e,n)}}},[t._v("-")]),i("v-uni-view",{staticClass:"input"},[i("v-uni-input",{attrs:{value:e.number,maxlength:"2",disabled:!0}})],1),i("v-uni-view",{staticClass:"add",on:{click:function(i){arguments[0]=i=t.$handleEvent(i),t.onadd(e,n)}}},[t._v("+")])],1)],1)],1),t.current==n?i("v-uni-view",{staticClass:"del_mask",style:"z-index:"+(t.current==n?"99":"-21"),on:{click:function(e){arguments[0]=e=t.$handleEvent(e),t.oncencal.apply(void 0,arguments)}}}):t._e(),i("v-uni-view",{staticClass:"dask_del",style:"opacity:"+(t.current==n?"1":"0")+";z-index:"+(t.current==n?"100":"-20")+";left:"+(t.current==n?"0":"-100%")},[i("v-uni-text",{staticClass:"del",on:{click:function(i){arguments[0]=i=t.$handleEvent(i),t.delItem(e,n)}}},[t._v("删除")]),i("v-uni-text",{staticClass:"cencal",on:{click:function(e){arguments[0]=e=t.$handleEvent(e),t.oncencal.apply(void 0,arguments)}}},[t._v("取消")])],1)],1)})),t.cartList.length>=5?i("v-uni-view",{staticClass:"daodi"},[t._v("—— 到底啦 ——")]):t._e()],2),i("v-uni-view",{staticClass:"bottom_all",style:{marginBottom:t.bottomShow}},[i("v-uni-view",{staticClass:"left"},[i("v-uni-view",{staticClass:"checkbox-box",on:{click:function(e){arguments[0]=e=t.$handleEvent(e),t.setAllCurrent.apply(void 0,arguments)}}},[i("v-uni-view",{staticClass:"checkbox",style:"border-color:"+t.colors},[i("v-uni-view",{class:1==t.allCurrent?"on":"",style:"background-color:"+t.colors})],1),i("v-uni-view",{staticClass:"text"},[t._v("全选")])],1),1==t.allCurrent?i("v-uni-view",{staticClass:"delAll",style:"border-color:"+t.colors+";color:"+t.colors,on:{click:function(e){arguments[0]=e=t.$handleEvent(e),t.delectAll.apply(void 0,arguments)}}},[t._v("删除")]):t._e()],1),i("v-uni-view",{staticClass:"rights"},[i("v-uni-view",{staticClass:"jiesuan",style:"background-color:"+t.colors,on:{click:function(e){arguments[0]=e=t.$handleEvent(e),t.settlement.apply(void 0,arguments)}}},[t._v("结算("+t._s(t.sum)+")")]),i("v-uni-view",{staticClass:"sum"},[t._v("合计:"),i("v-uni-text",{staticStyle:{"font-size":"30upx"}},[t._v("¥"+t._s(t.sumPrice||0))])],1)],1)],1)]:t._e(),0==t.cartList.length?i("v-uni-view",{staticClass:"nocart"},[i("v-uni-text",{staticClass:"iconfont icon-gouwuche1",style:"color:"+t.colors}),i("v-uni-view",[t._v("空空如也,"),i("v-uni-text",{style:"color:"+t.colors,on:{click:function(e){arguments[0]=e=t.$handleEvent(e),t.onStroll.apply(void 0,arguments)}}},[t._v("随便逛逛 >")])],1)],1):t._e()],2)},o=[]},"7d8c":function(t,e,i){var n=i("24fb");e=n(!1),e.push([t.i,'@charset "UTF-8";.cart[data-v-47d048c6]{padding:%?10?% 4%;background-color:#f5f6f7}.clearCart[data-v-47d048c6]{height:%?80?%;font-size:%?40?%;text-align:left;line-height:%?80?%;position:fixed;left:0;width:100vw;padding:0 4%;background-color:#fff;z-index:100;letter-spacing:1px}.cart_box[data-v-47d048c6]{margin-top:%?80?%;padding-bottom:%?100?%}.cart_list[data-v-47d048c6]{width:92vw;height:calc(22vw + %?34?%);border-radius:%?12?%;box-shadow:0 %?4?% %?16?% rgba(0,0,0,.1);overflow:hidden;border:0;display:-webkit-box;display:-webkit-flex;display:flex;-webkit-box-align:center;-webkit-align-items:center;align-items:center;position:relative;margin-bottom:%?20?%;background-color:#fff}.cart_list .checkbox-box[data-v-47d048c6]{padding-left:%?16?%;-webkit-flex-shrink:0;flex-shrink:0;height:22vw;margin-right:%?16?%;-webkit-box-align:center;-webkit-align-items:center;align-items:center;position:relative;width:%?50?%}.cart_list .checkbox-box .checkbox[data-v-47d048c6]{width:%?28?%;height:%?28?%;border-radius:100%;border:solid %?1?%;position:absolute;top:50%;left:%?20?%;display:-webkit-box;display:-webkit-flex;display:flex;-webkit-box-align:center;-webkit-align-items:center;align-items:center;-webkit-box-pack:center;-webkit-justify-content:center;justify-content:center;-webkit-transform:translateY(-50%);transform:translateY(-50%)}.cart_list .checkbox-box .checkbox .on[data-v-47d048c6]{width:%?20?%;height:%?20?%;border-radius:100%;-webkit-box-align:center;-webkit-align-items:center;align-items:center}.cart_list .cover[data-v-47d048c6]{width:22vw;height:22vw;-webkit-flex-shrink:0;flex-shrink:0;margin-left:%?10?%;border-radius:%?8?%;overflow:hidden;margin-right:%?10?%;position:relative}.cart_list .cover .mask[data-v-47d048c6]{width:100%;height:100%;background-color:rgba(0,0,0,.6);position:absolute;top:0;left:0;text-align:center;color:#ddd;font-size:%?24?%;line-height:22vw}.cart_list .cover .masks[data-v-47d048c6]{width:100%;height:100%;position:absolute;top:0;left:0}.cart_list .cover uni-image[data-v-47d048c6]{width:100%;height:100%;display:block}.daodi[data-v-47d048c6]{text-align:center;font-size:%?24?%;color:#ccc;margin-top:%?30?%}.right[data-v-47d048c6]{height:22vw;width:100%;\n /* overflow: hidden; */display:-webkit-box;display:-webkit-flex;display:flex;-webkit-flex-wrap:wrap;flex-wrap:wrap;padding-right:%?15?%;position:relative}.right .goods_name[data-v-47d048c6]{width:100%;font-size:%?24?%;line-height:%?34?%;max-height:%?68?%;color:#333;overflow:hidden;text-overflow:ellipsis;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical}.sku[data-v-47d048c6]{font-size:%?22?%;background-color:#f3f3f3;border-radius:%?10?%;height:%?40?%;line-height:%?40?%;padding:0 %?10?%;color:#a7a7a7;margin-bottom:%?40?%}.numbers[data-v-47d048c6]{position:absolute;width:100%;overflow:hidden;display:-webkit-box;display:-webkit-flex;display:flex;-webkit-box-pack:justify;-webkit-justify-content:space-between;justify-content:space-between;-webkit-box-align:end;-webkit-align-items:flex-end;align-items:flex-end;height:%?50?%;bottom:%?-5?%}.numbers .price[data-v-47d048c6]{font-size:%?30?%;line-height:%?50?%;color:#ff1929}.numbers .right_btn[data-v-47d048c6]{display:-webkit-box;display:-webkit-flex;display:flex;-webkit-box-pack:center;-webkit-justify-content:center;justify-content:center;-webkit-box-align:end;-webkit-align-items:flex-end;align-items:flex-end;margin-right:%?20?%}.right_btn .sub[data-v-47d048c6]{width:%?40?%;height:%?40?%;font-size:%?40?%;background-color:#f3f3f3;border-radius:%?4?%;text-align:center;line-height:%?40?%}.right_btn .sub[data-v-47d048c6]:active{background-color:#f8f8f8}.right_btn .input[data-v-47d048c6]{width:%?50?%;height:%?50?%;margin:0 %?8?%;background-color:#f3f3f3}.right_btn .input uni-input[data-v-47d048c6]{width:%?50?%;height:%?50?%;display:-webkit-box;display:-webkit-flex;display:flex;font-size:%?22?%;text-align:center;-webkit-box-align:center;-webkit-align-items:center;align-items:center;-webkit-box-pack:center;-webkit-justify-content:center;justify-content:center;color:#ff1929}.right_btn .add[data-v-47d048c6]{width:%?40?%;height:%?40?%;font-size:%?40?%;background-color:#f3f3f3;border-radius:%?4?%;text-align:center;line-height:%?40?%}.right_btn .add[data-v-47d048c6]:active{background-color:#f8f8f8}.del_mask[data-v-47d048c6]{width:100%;height:100%;position:fixed;top:0;left:0;z-index:-21}.dask_del[data-v-47d048c6]{width:100%;height:100%;position:absolute;top:0;left:0;background-color:rgba(0,0,0,.5);z-index:-20;display:-webkit-box;display:-webkit-flex;display:flex;-webkit-box-align:center;-webkit-align-items:center;align-items:center;opacity:0;-webkit-transition:all .3s;transition:all .3s}.dask_del .del[data-v-47d048c6],\n.cencal[data-v-47d048c6]{width:%?100?%;height:%?100?%;display:-webkit-box;display:-webkit-flex;display:flex;-webkit-box-pack:center;-webkit-justify-content:center;justify-content:center;line-height:%?100?%;border-radius:100%;text-align:center;font-size:%?24?%;background:-webkit-linear-gradient(#ff5d39,#ffaf48);background:linear-gradient(#ff5d39,#ffaf48);color:#fff;font-weight:500;margin:0 auto}.dask_del uni-text[data-v-47d048c6]:active{opacity:.9}.cencal[data-v-47d048c6]{background:-webkit-linear-gradient(#ffe846,#ffcd43);background:linear-gradient(#ffe846,#ffcd43)}.bottom_all[data-v-47d048c6]{height:%?100?%;width:100%;padding:0 2%;-webkit-box-align:center;-webkit-align-items:center;align-items:center;-webkit-box-pack:center;-webkit-justify-content:center;justify-content:center;position:fixed;bottom:0;left:0;background-color:#fdfdfd;z-index:11;border-top:%?1?% solid #f8f8f8}.bottom_all .left[data-v-47d048c6]{float:left;width:40vw;font-size:%?24?%;position:relative}.bottom_all .left .delAll[data-v-47d048c6]{height:%?40?%;border-radius:%?20?%;font-size:%?22?%;line-height:%?38?%;border:solid %?1?%;text-align:center;width:%?92?%;position:absolute;right:%?50?%;top:50%;-webkit-transform:translateY(-50%);transform:translateY(-50%)}.bottom_all .left .text[data-v-47d048c6]{position:absolute;left:%?60?%;top:50%;-webkit-transform:translateY(-52%);transform:translateY(-52%)}.bottom_all .checkbox-box[data-v-47d048c6]{padding-left:%?16?%;-webkit-flex-shrink:0;flex-shrink:0;height:%?100?%;margin-right:%?16?%;-webkit-box-align:center;-webkit-align-items:center;align-items:center;position:relative}.bottom_all .checkbox-box .checkbox[data-v-47d048c6]{width:%?40?%;height:%?40?%;border-radius:100%;border:solid %?1?%;position:absolute;top:50%;left:%?20?%;display:-webkit-box;display:-webkit-flex;display:flex;-webkit-box-align:center;-webkit-align-items:center;align-items:center;-webkit-box-pack:center;-webkit-justify-content:center;justify-content:center;-webkit-transform:translateY(-50%);transform:translateY(-50%)}.bottom_all .checkbox-box .checkbox .on[data-v-47d048c6]{border-radius:100%;-webkit-box-align:center;-webkit-align-items:center;align-items:center}.bottom_all .rights[data-v-47d048c6]{float:right;width:56vw;line-height:%?100?%;font-size:%?24?%}.bottom_all .rights uni-view[data-v-47d048c6]{float:right}.bottom_all .rights .sum[data-v-47d048c6]{font-weight:700;margin-right:%?20?%}.bottom_all .rights .jiesuan[data-v-47d048c6]{padding:0 %?22?%;border-radius:%?24?%;background-color:pink;height:%?50?%;line-height:%?50?%;color:#fff;font-size:%?24?%;margin-top:%?28?%;margin-left:%?40?%}\n/* 购物车为空的样式} */.nocart[data-v-47d048c6]{text-align:center;margin-top:30vh}.nocart .iconfont[data-v-47d048c6]{font-size:%?80?%;text-align:center}.nocart uni-view[data-v-47d048c6]{height:%?40?%;line-height:%?40?%;font-size:%?24?%;color:#999;margin-top:%?20?%}',""]),t.exports=e},94261:function(t,e,i){"use strict";var n=i("273b"),a=i.n(n);a.a},"9e92":function(t,e,i){"use strict";i.r(e);var n=i("66bb"),a=i("c577");for(var o in a)"default"!==o&&function(t){i.d(e,t,(function(){return a[t]}))}(o);i("94261");var s,c=i("f0c5"),r=Object(c["a"])(a["default"],n["b"],n["c"],!1,null,"47d048c6",null,!1,n["a"],s);e["default"]=r.exports},c577:function(t,e,i){"use strict";i.r(e);var n=i("17b1"),a=i.n(n);for(var o in n)"default"!==o&&function(t){i.d(e,t,(function(){return n[t]}))}(o);e["default"]=a.a}}]); |