1 line
5.1 KiB
JavaScript
1 line
5.1 KiB
JavaScript
(global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["pages/shopCart/shopCart"],{"0d5d":function(t,n,o){"use strict";(function(t){var n=o("4ea4");o("0178");n(o("66fd"));var e=n(o("193f"));wx.__webpack_require_UNI_MP_PLUGIN__=o,t(e.default)}).call(this,o("543d")["createPage"])},1532:function(t,n,o){"use strict";o.r(n);var e=o("542c"),i=o.n(e);for(var s in e)["default"].indexOf(s)<0&&function(t){o.d(n,t,(function(){return e[t]}))}(s);n["default"]=i.a},"193f":function(t,n,o){"use strict";o.r(n);var e=o("bbe1"),i=o("1532");for(var s in i)["default"].indexOf(s)<0&&function(t){o.d(n,t,(function(){return i[t]}))}(s);o("c9c7");var r=o("f0c5"),c=Object(r["a"])(i["default"],e["b"],e["c"],!1,null,null,null,!1,e["a"],void 0);n["default"]=c.exports},"542c":function(t,n,o){"use strict";var e=o("4ea4");Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var i=e(o("448a")),s=getApp().globalData,r={data:function(){return{type:1,shopList:[],userInfo:{},token:"",collectList:[]}},onShow:function(){this.getUserCart(),this.getCollectList()},onLoad:function(){},methods:{goInfoDet:function(t,n){var o=this;this.axiosFromToken("POST","index/hours",{business_id:n},"加载中").then((function(e){1==e.data.do?o.$tools.goNext("/pages/index/pagesOne/mall/mallDet/mallDet?id=".concat(n,"&name=").concat(t,"&type=").concat(o.type)):o.showtt("该店已打烊")}))},swtichType:function(t){this.type=t,this.getUserCart()},getCollectList:function(){var t=this;this.axiosFromToken("POST","user/my_coll",{lat:this.app.location.latitude,lng:this.app.location.longitude,token:this.app.token},"加载中").then((function(n){t.collectList=n.data}))},payTap:function(){if(this.shopList[0]){var t=[];this.shopList.forEach((function(n){var o=n.goods.filter((function(t){return 1==t.onindex}));o.length>=1&&(n.goods=o,t.push(n))})),0!==t.length?(s.onGoodCart=t,this.$tools.goNext("confirmOrder?type=".concat(this.type))):this.$tools.showtt("请先选择商品")}else this.$tools.showtt("购物车无商品")},deleTap:function(){var t=this,n=[],o="";this.shopList.forEach((function(t){t.forEach((function(t){1===t.onindex&&n.push(t)}))})),n.forEach((function(t){o+=t.cart_id+=","})),console.log(o),0!==n.length?this.$tools.axiosFromToken("POST","cart/delCart",{ids:o}).then((function(n){t.getUserCart(),t.$tools.showtt("删除成功","succec")})):this.$tools.showtt("请选择商品,再进行操作")},numChange:function(t,n,o){var e=this;this.$tools.axiosFromToken("POST","order/editShoopCat",{id:this.shopList[n].goods[o].cart_id,type:t}).then((function(i){e.shopList[n].goods[o].number=t}))},getUserCart:function(){var t=this;this.axiosFromToken("POST","user/car",{type:this.type},"加载中").then((function(n){n.data[0]&&n.data.forEach((function(t){t.onindex=0,t.goods.forEach((function(t){return t.onindex=0}))})),t.shopList=n.data}))},select:function(t,n){var o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;if(null==o)console.log("全选"),"1"==n?(console.log("商铺全选"),console.log(this.shopList),this.shopList.forEach((function(n){n.goods[0]&&(n.onindex=t,n.goods.forEach((function(n){n.onindex=t})))}))):(this.shopList[n].onindex=t,this.shopList[n].goods.forEach((function(n){n.onindex=t})));else if("1"===o)this.shopList[n].onindex=t,this.shopList[n].goods.forEach((function(n){return n.onindex=t}));else{this.shopList[n].goods[o].onindex=t;var e=this.shopList[n].goods.every((function(t){return 1==t.onindex}));this.shopList[n].onindex=e?1:0}this.$forceUpdate()}},computed:{totol:function(){var t=[];return this.shopList.forEach((function(n){t.push.apply(t,(0,i.default)(n.goods.filter((function(t){return 1===t.onindex}))))})),t.length},totalSum:function(){if(this.shopList.length>=1){var t=[];this.shopList.forEach((function(n){t.push.apply(t,(0,i.default)(n.goods.filter((function(t){return 1===t.onindex}))))}));for(var n=0,o=0;o<t.length;o++)console.log(t[o].num,t[o].price,n),n+=t[o].num*t[o].price;return n}return 0},iconShow:function(){var t=this.shopList.every((function(t){return 1===t.onindex}));return t}}};n.default=r},8502:function(t,n,o){},bbe1:function(t,n,o){"use strict";o.d(n,"b",(function(){return i})),o.d(n,"c",(function(){return s})),o.d(n,"a",(function(){return e}));var e={uniStatusBar:function(){return o.e("components/uni-status-bar/uni-status-bar").then(o.bind(null,"7acd"))},uniIcons:function(){return Promise.all([o.e("common/vendor"),o.e("uni_modules/uni-icons/components/uni-icons/uni-icons")]).then(o.bind(null,"aed4"))},lxcCountStyle:function(){return o.e("components/lxc-count-style/lxc-count-style").then(o.bind(null,"1638"))}},i=function(){var t=this,n=t.$createElement,o=(t._self._c,t.collectList&&t.collectList[0]?t.__map(t.collectList,(function(n,o){var e=t.__get_orig(n),i=n.distance.toFixed(2);return{$orig:e,g0:i}})):null);t._isMounted||(t.e0=function(n,o,e,i){var s=arguments[arguments.length-1].currentTarget.dataset,r=s.eventParams||s["event-params"];o=r.item,e=r.type,i=r.index;return n.stopPropagation(),function(n){return t.numChange(o.num,e,i)}()}),t.$mp.data=Object.assign({},{$root:{l0:o}})},s=[]},c9c7:function(t,n,o){"use strict";var e=o("8502"),i=o.n(e);i.a}},[["0d5d","common/runtime","common/vendor"]]]); |