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 lines
7.4 KiB
1 lines
7.4 KiB
(global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["pages/cart/cart"],{"4bf1":function(t,s,i){"use strict";i.r(s);var e=i("87cc"),o=i("9c87");for(var n in o)"default"!==n&&function(t){i.d(s,t,(function(){return o[t]}))}(n);i("b980");var c,l=i("f0c5"),h=Object(l["a"])(o["default"],e["b"],e["c"],!1,null,null,null,!1,e["a"],c);s["default"]=h.exports},8773:function(t,s,e){"use strict";(function(t){Object.defineProperty(s,"__esModule",{value:!0}),s.default=void 0;var o=n(e("a34a"));function n(t){return t&&t.__esModule?t:{default:t}}function c(t,s,i,e,o,n,c){try{var l=t[n](c),h=l.value}catch(d){return void i(d)}l.done?s(h):Promise.resolve(h).then(e,o)}function l(t){return function(){var s=this,i=arguments;return new Promise((function(e,o){var n=t.apply(s,i);function l(t){c(n,e,o,l,h,"next",t)}function h(t){c(n,e,o,l,h,"throw",t)}l(void 0)}))}}var h=function(){e.e("components/empty").then(function(){return resolve(e("9467"))}.bind(null,e)).catch(e.oe)},d={components:{empty:h},data:function(){return{sumPrice:"0.00",headerPosition:"fixed",headerTop:null,statusTop:null,selectedList:[],isAllselected:!1,goodsList:[],theIndex:null,oldIndex:null,isStop:!1,startingPrice:0}},onShow:function(){this.goodsList=t.getStorageSync("cartlist");var s=this.goodsList.length,i=[];if(s<=0)this.isAllselected=!1,this.sumPrice=0;else{for(var e=[],o=0;o<s;o++)this.goodsList[o].num<=0?e.push(this.goodsList[o].id):1==this.goodsList[o].selected&&i.push(this.goodsList[o].id);if(e.length>0){for(var n=0;n<e.length;n++)this.deleteGoods(e[n]);this.goodsList.length<=0&&(this.isAllselected=!1)}else this.selectedList=i,this.isAllselected=this.selectedList.length==this.goodsList.length,console.log(i,"选中数据")}console.log(this.goodsList,"购物车商品"),this.sum(),this.baseinfo("lessmoney")},onPageScroll:function(t){this.headerPosition=t.scrollTop>=0?"fixed":"absolute",this.headerTop=t.scrollTop>=0?null:0,this.statusTop=t.scrollTop>=0?null:-this.statusHeight+"px"},onPullDownRefresh:function(){setTimeout((function(){t.stopPullDownRefresh()}),1e3)},filters:{toFixed:function(t){return parseFloat(t).toFixed(2)}},onLoad:function(){this.goodsList=t.getStorageSync("cartlist");for(var s="",i=0;i<this.goodsList.length;i++){if(this.goodsList[i].num<=0){this.goodsList.splice(i,1),t.setStorageSync("cartlist",this.goodsList);break}s=s+","+this.goodsList[i].id}s=s.substr(1)},methods:{checkkc:function(t){var s=this;return l(o.default.mark((function i(){var e,n,c,l,h;return o.default.wrap((function(i){while(1)switch(i.prev=i.next){case 0:return i.next=2,s.$api.checkkc({action:"checkkc",gids:t});case 2:if(e=i.sent,n=e.data,c=s.goodsList,n)for(l=0;l<n.length;l++)for(h=0;h<c.length;h++)n[l].id==c[h].id&&s.$set(s.goodsList[h],"kucun",n[l].kucun);case 6:case"end":return i.stop()}}),i)})))()},baseinfo:function(t){var s=this;return l(o.default.mark((function i(){var e;return o.default.wrap((function(i){while(1)switch(i.prev=i.next){case 0:return i.next=2,s.$api.baseinfo({action:"baseinfo",key:t});case 2:e=i.sent,s.startingPrice=parseInt(e.data.info).toFixed(2),console.log(s.startingPrice);case 5:case"end":return i.stop()}}),i)})))()},joinGoods:function(t){for(var s=this.goodsList.length,e=!1,o=0;o<s;o++){var n=this.goodsList[o];if(n.id==t.id){this.goodsList[o].num++,e=!0;break}}e||this.goodsList[i].unshift(t)},touchStart:function(t,s){s.touches.length>1?this.isStop=!0:(this.oldIndex=this.theIndex,this.theIndex=null,this.initXY=[s.touches[0].pageX,s.touches[0].pageY])},touchMove:function(t,s){var i=this;if(s.touches.length>1)this.isStop=!0;else{var e=s.touches[0].pageX-this.initXY[0],o=s.touches[0].pageY-this.initXY[1];this.isStop||Math.abs(e)<5||(Math.abs(o)>Math.abs(e)?this.isStop=!0:e<0?(this.theIndex=t,this.isStop=!0):e>0&&null!=this.theIndex&&this.oldIndex==this.theIndex&&(this.oldIndex=t,this.theIndex=null,this.isStop=!0,setTimeout((function(){i.oldIndex=null}),150)))}},touchEnd:function(t,s){this.isStop=!1},toGoods:function(t){},toConfirmation:function(){var s=t.getStorageSync("userinfo");if(""==s.uid||void 0==s.uid)t.showModal({title:"温馨提示",content:"您还没登录,请登录",success:function(s){s.confirm?t.navigateTo({url:"/pages/user/checklogin"}):s.cancel&&console.log("用户点击取消")}});else{wx.requestSubscribeMessage({tmplIds:["xrga_0YidesSMMfOxNaLmzvpfu42RdOYaA85D8ru88k"],success:function(t){console.log(t,"返回什么")}});for(var i=[],e=this.goodsList.length,o=0;o<e;o++)this.goodsList[o].selected&&this.goodsList[o].kucun&&i.push(this.goodsList[o]);if(i.length<1)return void t.showToast({title:"请选择商品结算",icon:"none"});t.setStorage({key:"buylist",data:i,success:function(){t.navigateTo({url:"../orderconfirmation/orderconfirmation"})}})}},deleteGoods:function(s){for(var i=this.goodsList.length,e=0;e<i;e++)if(s==this.goodsList[e].id){this.goodsList.splice(e,1);break}this.selectedList.splice(this.selectedList.indexOf(s),1),t.setStorageSync("cartlist",this.goodsList),this.sum(),this.oldIndex=null,this.theIndex=null},deleteList:function(){this.selectedList.length;while(this.selectedList.length>0)this.deleteGoods(this.selectedList[0]);this.selectedList=[],this.isAllselected=this.selectedList.length==this.goodsList.length&&this.goodsList.length>0,this.sum()},selected:function(t){this.goodsList[t].selected=!this.goodsList[t].selected;var s=this.selectedList.indexOf(this.goodsList[t].id);s>-1?this.selectedList.splice(s,1):this.selectedList.push(this.goodsList[t].id),this.isAllselected=this.selectedList.length==this.goodsList.length,this.sum()},allSelect:function(){for(var t=this.goodsList.length,s=[],i=0;i<t;i++)this.goodsList[i].selected=!this.isAllselected,this.goodsList[i].kucun>0&&s.push(this.goodsList[i].id),console.log(s,"选择");this.selectedList=this.isAllselected?[]:s,this.isAllselected=!this.isAllselected&&0!=this.goodsList.length,this.sum()},sub:function(s){this.goodsList[s].num<=1||(this.goodsList[s].num--,this.goodsList[s].total=this.goodsList[s].num*this.goodsList[s].price,t.setStorageSync("cartlist",this.goodsList),this.sum())},add:function(s){this.goodsList[s].num++,this.goodsList[s].total=this.goodsList[s].num*this.goodsList[s].price,t.setStorageSync("cartlist",this.goodsList),this.sum()},sum:function(t,s){this.sumPrice=0;for(var i=this.goodsList.length,e="",o=0;o<i;o++)e=e+","+this.goodsList[o].id,this.goodsList[o].selected&&this.goodsList[o].kucun>0&&(this.sumPrice=t&&o==s?this.sumPrice+t.detail.value*this.goodsList[o].price:this.sumPrice+this.goodsList[o].num*this.goodsList[o].price);e=e.substr(1),this.checkkc(e),this.sumPrice=this.sumPrice.toFixed(2),console.log(this.sumPrice,"总额")},discard:function(){}}};s.default=d}).call(this,e("543d")["default"])},"87cc":function(t,s,i){"use strict";var e;i.d(s,"b",(function(){return o})),i.d(s,"c",(function(){return n})),i.d(s,"a",(function(){return e}));var o=function(){var t=this,s=t.$createElement,i=(t._self._c,!(t.sumPrice>0&&t.sumPrice-t.startingPrice>=0)&&t.startingPrice>=0?t._f("toFixed")(-(t.sumPrice-t.startingPrice)):null);t.$mp.data=Object.assign({},{$root:{f0:i}})},n=[]},"9c87":function(t,s,i){"use strict";i.r(s);var e=i("8773"),o=i.n(e);for(var n in e)"default"!==n&&function(t){i.d(s,t,(function(){return e[t]}))}(n);s["default"]=o.a},b980:function(t,s,i){"use strict";var e=i("c798"),o=i.n(e);o.a},c798:function(t,s,i){},fa0e:function(t,s,i){"use strict";(function(t){i("8d0c");e(i("66fd"));var s=e(i("4bf1"));function e(t){return t&&t.__esModule?t:{default:t}}wx.__webpack_require_UNI_MP_PLUGIN__=i,t(s.default)}).call(this,i("543d")["createPage"])}},[["fa0e","common/runtime","common/vendor"]]]);
|