| 12 |
- ;(function(){function asyncGeneratorStep(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg);var value=info.value;}catch(error){reject(error);return;}if(info.done){resolve(value);}else{Promise.resolve(value).then(_next,_throw);}}function _asyncToGenerator(fn){return function(){var self=this,args=arguments;return new Promise(function(resolve,reject){var gen=fn.apply(self,args);function _next(value){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"next",value);}function _throw(err){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"throw",err);}_next(undefined);});};}System.register(['./index-legacy.37fa206e.js','./cart-legacy.91fdaf99.js','./vendor-legacy.ef66db0e.js','./index-legacy.f25f109a13.js','./index-legacy.f25f109a14.js','./index-legacy.f25f109a4.js','./index-legacy.f25f109a9.js','./index-legacy.f25f109a19.js','./index-legacy.f25f109a12.js','./index-legacy.0f68c9ec.js'],function(exports){'use strict';var ColHeader,carts,styles,defineComponent,createVNode,CheckboxGroup,Checkbox,Card,Stepper,isVNode,SubmitBar,createTextVNode,Fragment,request;return{setters:[function(module){ColHeader=module.C;},function(module){carts=module.c;styles=module.s;},function(module){defineComponent=module.d;createVNode=module.a;CheckboxGroup=module.a0;Checkbox=module.a1;Card=module.an;Stepper=module.O;isVNode=module.x;SubmitBar=module.ao;createTextVNode=module.b;Fragment=module.F;},function(){},function(){},function(){},function(){},function(){},function(){},function(module){request=module.r;}],execute:function execute(){function _isSlot(s){return typeof s==='function'||Object.prototype.toString.call(s)==='[object Object]'&&!isVNode(s);}var index=exports('default',defineComponent({name:'cart',data:function data(){return{isManage:false,cartList:[],selectItems:[]};},computed:{checkAll:function checkAll(){var selectLen=this.selectItems.length;var cartLen=this.cartList.length;return selectLen===cartLen;},len:function len(){var n=this.selectItems.length;return n;},totalPrice:function totalPrice(){var price=0;var items=this.selectItems;this.cartList.forEach(function(n){if(items.includes(n.id)&&typeof n.price==='number'){price+=n.price*n.quantity;}});return price*100;}},mounted:function mounted(){this.getCartList();},methods:{getCartList:function getCartList(){var _this=this;return _asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee(){var _yield$request$get,code,data;return regeneratorRuntime.wrap(function _callee$(_context){while(1){switch(_context.prev=_context.next){case 0:_this.cartList=[];_context.prev=1;_context.next=4;return request.get('/api-mall-portal/cart/list');case 4:_yield$request$get=_context.sent;code=_yield$request$get.code;data=_yield$request$get.data;code===200&&(_this.cartList=data);_context.next=12;break;case 10:_context.prev=10;_context.t0=_context["catch"](1);case 12:case"end":return _context.stop();}}},_callee,null,[[1,10]]);}))();},setCheckAll:function setCheckAll(){var selectItems=[];if(!this.checkAll){this.cartList.forEach(function(n){selectItems.push(n.id);});}this.selectItems=selectItems;},setCartItem:function setCartItem(item){return _asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee2(){var _yield$request$get2,code,data;return regeneratorRuntime.wrap(function _callee2$(_context2){while(1){switch(_context2.prev=_context2.next){case 0:_context2.prev=0;_context2.next=3;return request.get('/api-mall-portal/cart/update/quantity',{params:{id:item.id,quantity:item.quantity}});case 3:_yield$request$get2=_context2.sent;code=_yield$request$get2.code;data=_yield$request$get2.data;_context2.next=10;break;case 8:_context2.prev=8;_context2.t0=_context2["catch"](0);case 10:case"end":return _context2.stop();}}},_callee2,null,[[0,8]]);}))();},onDeleteCartItem:function onDeleteCartItem(){var _this2=this;return _asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee3(){var ids,_yield$request$post,code,data;return regeneratorRuntime.wrap(function _callee3$(_context3){while(1){switch(_context3.prev=_context3.next){case 0:ids=_this2.selectItems.join(',');_context3.prev=1;_context3.next=4;return request.post('/api-mall-portal/cart/delete?ids='+ids);case 4:_yield$request$post=_context3.sent;code=_yield$request$post.code;data=_yield$request$post.data;if(code===200){_this2.getCartList();_this2.selectItems=[];_this2.isManage=false;}_context3.next=12;break;case 10:_context3.prev=10;_context3.t0=_context3["catch"](1);case 12:case"end":return _context3.stop();}}},_callee3,null,[[1,10]]);}))();},// 结算
- settlement:function settlement(){var selectItem=this.selectItems;var list=[];this.cartList.forEach(function(item){if(selectItem.includes(item.id)){list.push(item);}});carts.list=list;this.$router.push({path:'/cartConfirm'});}},render:function render(){var _this3=this;var _slot;return createVNode(Fragment,null,[createVNode(ColHeader,{"isBack":true,"onClickRight":function onClickRight(){return _this3.isManage=!_this3.isManage;}},{right:function right(){return createVNode("span",{"style":{color:'#333',fontSize:'14px'}},[_this3.isManage?'完成':'管理']);}}),createVNode("div",{"class":styles.cartBox},[createVNode(CheckboxGroup,{"modelValue":this.selectItems,"onUpdate:modelValue":function onUpdateModelValue($event){return _this3.selectItems=$event;}},_isSlot(_slot=this.cartList.map(function(item){return createVNode("div",{"class":styles.cartItem},[createVNode(Checkbox,{"name":item.id},null),createVNode(Card,{"price":(item.price*item.quantity*100/100).toFixed(2),"desc":item.productAttr,"title":item.productName,"thumb":item.productPic},{num:function num(){return createVNode(Stepper,{"modelValue":item.quantity,"onUpdate:modelValue":function onUpdateModelValue($event){return item.quantity=$event;},"onChange":function onChange(){return _this3.setCartItem(item);},"inputWidth":"50px","buttonSize":"24px","min":1},null);}})]);}))?_slot:{default:function _default(){return[_slot];}}),this.isManage?createVNode("div",{"class":styles.delete},[createVNode(SubmitBar,{"buttonText":"删除","buttonColor":"var(--van-primary)","disabled":this.totalPrice===0,"onSubmit":function onSubmit(){return _this3.onDeleteCartItem();}},{default:function _default(){return[createVNode(Checkbox,{"modelValue":_this3.checkAll,"onClick":function onClick(value){return _this3.setCheckAll();}},{default:function _default(){return[createTextVNode("\u5168\u9009")];}})];}})]):createVNode("div",{"class":styles.submit},[createVNode(SubmitBar,{"price":this.totalPrice,"buttonText":"\u7ED3\u7B97(".concat(this.len,")"),"buttonColor":"var(--van-primary)","disabled":this.totalPrice===0,"onSubmit":function onSubmit(){return _this3.settlement();}},{default:function _default(){return[createVNode(Checkbox,{"modelValue":_this3.checkAll,"onClick":function onClick(value){return _this3.setCheckAll();}},{default:function _default(){return[createTextVNode("\u5168\u9009")];}})];}})])]),createVNode("div",{"style":{height:'var(--van-submit-bar-height)'}},null)]);}}));}};});})();
|