cart.js 8.2 KB

1
  1. (global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["pages/cart/cart"],{"2b66":function(t,o,e){"use strict";e.d(o,"b",(function(){return i})),e.d(o,"c",(function(){return s})),e.d(o,"a",(function(){return n}));var n={uNavbar:function(){return Promise.all([e.e("common/vendor"),e.e("uview-ui/components/u-navbar/u-navbar")]).then(e.bind(null,"b6bd"))},uCheckboxGroup:function(){return Promise.all([e.e("common/vendor"),e.e("uview-ui/components/u-checkbox-group/u-checkbox-group")]).then(e.bind(null,"72c8"))},uSwipeAction:function(){return Promise.all([e.e("common/vendor"),e.e("uview-ui/components/u-swipe-action/u-swipe-action")]).then(e.bind(null,"9ff1"))},uSwipeActionItem:function(){return Promise.all([e.e("common/vendor"),e.e("uview-ui/components/u-swipe-action-item/u-swipe-action-item")]).then(e.bind(null,"04b7"))},uCheckbox:function(){return Promise.all([e.e("common/vendor"),e.e("uview-ui/components/u-checkbox/u-checkbox")]).then(e.bind(null,"d2b4"))},uNumberBox:function(){return Promise.all([e.e("common/vendor"),e.e("uview-ui/components/u-number-box/u-number-box")]).then(e.bind(null,"02c9"))},uIcon:function(){return Promise.all([e.e("common/vendor"),e.e("uview-ui/components/u-icon/u-icon")]).then(e.bind(null,"01eb"))},uToast:function(){return e.e("uview-ui/components/u-toast/u-toast").then(e.bind(null,"36bd"))},kjTabbar:function(){return Promise.all([e.e("common/vendor"),e.e("components/kj-tabbar/kj-tabbar")]).then(e.bind(null,"c7a7"))}},i=function(){var t=this,o=t.$createElement,e=(t._self._c,t.__map(t.goodsList,(function(o,e){var n=t.__get_orig(o),i=t.shop(o.goods),s=t.__map(o.goods,(function(o,e){var n=t.__get_orig(o),i="down"==o.status||0==o.sku_item.length,s="down"==o.status||0==o.sku_item.length,c="down"==o.status||0==o.sku_item.length,u=o.sku_item.length,a=o.sku_item.length,r=a>0?o.sku_item[0].discount_price.split("."):null,l=a>0?o.sku_item[0].discount_price.split("."):null,d=t.num!=o.cart.id&&t.success&&"normal"==o.status&&0!=o.sku_item.length,h=t.success&&("down"==o.status||0==o.sku_item.length);return{$orig:n,g0:i,g1:s,g2:c,g3:u,g4:a,g5:r,g6:l,g7:d,g8:h}}));return{$orig:n,m0:i,l0:s}}))),n=String(t.goodsPrice.toFixed(2));t._isMounted||(t.e0=function(o){t.num=""},t.e1=function(o,e){var n=arguments[arguments.length-1].currentTarget.dataset,i=n.eventParams||n["event-params"];e=i.chid;o.stopPropagation(),t.num=e.cart.id}),t.$mp.data=Object.assign({},{$root:{l1:e,m1:n}})},s=[]},"3b09":function(t,o,e){"use strict";var n=e("6e67"),i=e.n(n);i.a},"511b":function(t,o,e){"use strict";e.r(o);var n=e("e238"),i=e.n(n);for(var s in n)["default"].indexOf(s)<0&&function(t){e.d(o,t,(function(){return n[t]}))}(s);o["default"]=i.a},"6e67":function(t,o,e){},"878a":function(t,o,e){"use strict";(function(t,o){var n=e("4ea4");e("f93b");n(e("66fd"));var i=n(e("9b06"));t.__webpack_require_UNI_MP_PLUGIN__=e,o(i.default)}).call(this,e("bc2e")["default"],e("543d")["createPage"])},"9b06":function(t,o,e){"use strict";e.r(o);var n=e("2b66"),i=e("511b");for(var s in i)["default"].indexOf(s)<0&&function(t){e.d(o,t,(function(){return i[t]}))}(s);e("3b09");var c,u=e("f0c5"),a=Object(u["a"])(i["default"],n["b"],n["c"],!1,null,"21262306",null,!1,n["a"],c);o["default"]=a.exports},e238:function(t,o,e){"use strict";(function(t,e){Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0;var n={data:function(){return{dele:!0,success:!0,shopitem:-1,checkboxValue1:[],value:0,all:[],goodsList:[],selectall:-1,goodsNum:0,num:!1,goodsWeight:0,goodsPrice:0,tabarheight:"",removeProducts:0}},watch:{},computed:{i18n:function(){return this.$t("index")},options2:function(){var t=[{text:this.i18n.Shiftfocus,style:{backgroundColor:"#FFB115"}},{text:this.i18n.delete,style:{backgroundColor:"#F83224"}}];return t}},onLoad:function(){var o=t.getSystemInfoSync(),e=o.screenHeight-o.safeArea.bottom+o.statusBarHeight;this.tabarheight=e},onShow:function(){this.goodsNum=0,this.goodsWeight=0,this.goodsPrice=0,this.checkboxValue1=[],this.getShopCarList()},methods:{backTop:function(){e.pageScrollTo({scrollTop:0,duration:300})},getFontColor:function(t){if("down"==t)return"color:rgba(51, 51, 51, .6)"},followOrdelete:function(t){var o=this;0==t.index?this.goodsList.map((function(n){n.goods.map((function(n){t.name==n.cart.id&&(console.log(n),e.$u.http.post("/api/interest/follow",{interest_type:0,interest_id:n.merchant_goods.id}).then((function(t){o.$refs.show.forEach((function(t){return t.closeHandler(!0)})),console.log(t),e.showToast({title:"关注成功",icon:"none"})})))}))})):this.goodsList.map((function(n){n.goods.map((function(n){t.name==n.cart.id&&e.$u.http.delete("/api/cart?ids=".concat(n.cart.id)).then((function(t){o.$refs.uToast.show({type:"default",title:o.i18n.defaultTheme,message:o.i18n.successfullydelete}),o.$refs.show.forEach((function(t){return t.closeHandler(!0)})),o.getShopCarList()}))}))}))},selectDelete:function(){var t=this,o=[];this.goodsList.map((function(e){e.goods.map((function(e){t.checkboxValue1.indexOf(e.cart.id)>=0&&o.push(e.cart.id)}))})),e.$u.http.delete("/api/cart",{ids:o.join(",")}).then((function(o){t.$refs.uToast.show({type:"default",title:t.i18n.defaultTheme,message:t.i18n.successfullydelete}),t.checkboxValue1=[],t.getShopCarList()}))},shop:function(t){var o=this,e=0;return t.map((function(t){o.checkboxValue1.indexOf(t.cart.id)>=0&&e++})),e},getNormalGoodsNum:function(t){var o=0;return t.map((function(t){"down"!=t.status&&o++})),o},addOrReduce:function(t){var o=this;console.log(t),e.$u.http.post("/api/cart/num/".concat(this.num),{goods_num:t.value,type:""}).then((function(t){o.goodsPrice=0,o.goodsWeight=0,o.goodsList.map((function(t){t.goods.map((function(t){-1!=o.checkboxValue1.indexOf(t.cart.id)&&"down"!=t.status&&(o.goodsWeight+=t.sku_item[0].weight*t.cart.goods_num,o.goodsPrice+=Number(t.sku_item[0].discount_price)*t.cart.goods_num)}))}))}))},shopSelectAll:function(t){var o=this;this.goodsPrice=0,this.goodsWeight=0,0==this.checkboxValue1.length?t.map((function(t){"down"!=t.status&&o.checkboxValue1.push(t.cart.id)})):this.shop(t)>0&&this.shop(t)==this.getNormalGoodsNum(t)?t.map((function(t){o.checkboxValue1.indexOf(t.cart.id)>=0&&o.checkboxValue1.splice(o.checkboxValue1.indexOf(t.cart.id),1)})):(this.shop(t)>0&&this.shop(t)!=this.getNormalGoodsNum(t)||0==this.shop(t))&&t.map((function(t){-1==o.checkboxValue1.indexOf(t.cart.id)&&"down"!=t.status&&o.checkboxValue1.push(t.cart.id)})),this.checkboxValue1.length==this.goodsNum-this.removeProducts?this.$refs.tabbar1.cancelAll():this.$refs.tabbar1.cancelAll(this.i18n.Cancel),this.goodsList.map((function(t){t.goods.map((function(t){o.checkboxValue1.indexOf(t.cart.id)>-1&&(o.goodsWeight+=t.sku_item[0].weight*t.cart.goods_num,o.goodsPrice+=Number(t.sku_item[0].discount_price)*t.cart.goods_num)}))})),this.shop(t)},admin:function(){console.log(this.checkboxValue1),this.success=!this.success},valChange:function(t){console.log("当前值为: "+t.value)},checkAll:function(t){console.log("all",t)},checkboxChange:function(t){var o=this;console.log(t),this.goodsWeight=0,this.goodsPrice=0,this.checkboxValue1=t,this.goodsList.map((function(e){e.goods.map((function(e){t.indexOf(e.cart.id)>-1&&(o.goodsWeight+=e.sku_item[0].weight*e.cart.goods_num,o.goodsPrice+=Number(e.sku_item[0].discount_price)*e.cart.goods_num)}))})),this.checkboxValue1.length==this.goodsNum-this.removeProducts&&0!=this.goodsNum?this.$refs.tabbar1.cancelAll():this.checkboxValue1.length<this.goodsNum-this.removeProducts&&this.$refs.tabbar1.cancelAll(this.i18n.Cancel)},allSelect:function(){var t=this,o=this.$refs.tabbar1.cancelAll(this.i18n.selectall);this.checkboxValue1.length==this.goodsNum-this.removeProducts&&0==o.length||(this.checkboxValue1.length==this.goodsNum-this.removeProducts?(this.checkboxValue1=[],this.goodsPrice=0,this.goodsWeight=0):this.goodsList.map((function(o){o.goods.map((function(o){-1==t.checkboxValue1.indexOf(o.cart.id)&&"down"!=o.status&&(t.checkboxValue1.push(o.cart.id),t.goodsWeight+=o.sku_item[0].weight*o.cart.goods_num,t.goodsPrice+=Number(o.sku_item[0].discount_price)*o.cart.goods_num)}))})))},getShopCarList:function(){var t=this;this.goodsNum=0,e.$u.http.get("/api/cart").then((function(o){t.goodsList=o.data,t.goodsList.map((function(o){t.goodsNum+=o.goods.length,o.goods.map((function(o){"down"==o.status&&t.removeProducts++}))}))}))}}};o.default=n}).call(this,e("bc2e")["default"],e("543d")["default"])}},[["878a","common/runtime","common/vendor"]]]);