import{_ as e}from"./s-empty.74111684.js";import{s,v as t,c as l,e as o,f as a,w as c,l as d,g as i,j as n,p as r,t as u,k as p,r as f,F as _,A as m,B as g,m as k,C as x,i as b,D as h,E as y,G as v,H as C,u as M}from"./index-9880b451.js";import{_ as S}from"./su-number-box.8b58381a.js";import{_ as j}from"./s-goods-item.f5d79fd7.js";import{a as I,_ as w}from"./s-layout.dfc5b0b5.js";import{_ as G}from"./_plugin-vue_export-helper.1b428a4d.js";/* empty css                                                                */import"./useGoods.bdd1c2ea.js";import"./index.df38848e.js";/* empty css                                                                     */const A=G({__name:"cart",setup(G){g((e=>({ca290914:M(A)})));const A=s.$platform.navbar,B=s.$store("cart"),T=t({editMode:!1,list:l((()=>B.list)),selectedList:[],selectedIds:l((()=>B.selectedIds)),isAllSelected:l((()=>B.isAllSelected)),totalPriceSelected:l((()=>B.totalPriceSelected))});function $(e){console.log("单选"),B.selectSingle(e)}function N(){B.selectAll(!T.isAllSelected)}function V(){let e=[],t=[];T.selectedList=T.list.filter((e=>T.selectedIds.includes(e.id))),T.selectedList.map((s=>{console.log(s,"便利"),e.push({skuId:s.sku.id,count:s.count,cartId:s.id}),t.push({goods_id:s.spu.id,goods_num:s.count})})),0!==t.length?s.$router.go("/pages/order/confirm",{data:JSON.stringify({items:e,deliveryType:1,pointStatus:!1})}):s.$helper.toast("请选择商品")}async function F(){B.delete(T.selectedIds)}return(s,t)=>{const l=d(k("s-empty"),e),g=x,M=b,G=h,A=y,L=v,P=d(k("su-number-box"),S),U=d(k("s-goods-item"),j),D=d(k("su-fixed"),I),E=d(k("s-layout"),w);return o(),a(E,{title:"购物车",tabbar:"/pages/index/cart",bgStyle:{color:"#fff"}},{default:c((()=>[0===T.list.length?(o(),a(l,{key:0,text:"购物车空空如也,快去逛逛吧~",icon:"/static/cart-empty.png"})):i("",!0),T.list.length?(o(),a(M,{key:1,class:"cart-box ss-flex ss-flex-col ss-row-between"},{default:c((()=>[n(M,{class:"cart-header ss-flex ss-col-center ss-row-between ss-p-x-30"},{default:c((()=>[n(M,{class:"header-left ss-flex ss-col-center ss-font-26"},{default:c((()=>[r(" 共 "),n(g,{class:"goods-number ui-TC-Main ss-flex"},{default:c((()=>[r(u(T.list.length),1)])),_:1}),r(" 件商品 ")])),_:1}),n(M,{class:"header-right"},{default:c((()=>[T.editMode?(o(),a(G,{key:0,class:"ss-reset-button",onClick:t[0]||(t[0]=e=>T.editMode=!1)},{default:c((()=>[r(" 取消 ")])),_:1})):(o(),a(G,{key:1,class:"ss-reset-button ui-TC-Main",onClick:t[1]||(t[1]=e=>T.editMode=!0)},{default:c((()=>[r(" 编辑 ")])),_:1}))])),_:1})])),_:1}),n(M,{class:"cart-content ss-flex-1 ss-p-x-30 ss-m-b-40"},{default:c((()=>[(o(!0),p(_,null,f(T.list,(e=>(o(),a(M,{class:"goods-box ss-r-10 ss-m-b-14",key:e.id},{default:c((()=>[n(M,{class:"ss-flex ss-col-center"},{default:c((()=>[n(L,{class:"check-box ss-flex ss-col-center ss-p-l-10",onClick:s=>$(e.id)},{default:c((()=>[n(A,{checked:T.selectedIds.includes(e.id),color:"var(--ui-BG-Main)",style:{transform:"scale(0.8)"},onClick:m((s=>$(e.id)),["stop"])},null,8,["checked","onClick"])])),_:2},1032,["onClick"]),n(U,{title:e.spu.name,img:e.spu.picUrl||e.goods.image,price:e.sku.price/100,skuText:e.sku.properties.length>1?e.sku.properties.reduce(((e,s)=>e.valueName+" "+s.valueName)):e.sku.properties[0].valueName,priceColor:"#FF3000",titleWidth:400},C({_:2},[T.editMode?void 0:{name:"tool",fn:c((()=>[n(P,{min:0,max:e.sku.stock,step:1,modelValue:e.count,"onUpdate:modelValue":s=>e.count=s,onChange:s=>{return l=e,void(0!==(t=s)?l.goods_num!==t&&(l.goods_num=t,B.update({goods_id:l.id,goods_num:t,goods_sku_price_id:l.goods_sku_price_id})):B.delete(l.id));var t,l}},null,8,["max","modelValue","onUpdate:modelValue","onChange"])])),key:"0"}]),1032,["title","img","price","skuText"])])),_:2},1024)])),_:2},1024)))),128))])),_:1}),T.list.length>0?(o(),a(D,{key:0,bottom:"",val:48,placeholder:"",isInset:!1},{default:c((()=>[n(M,{class:"cart-footer ss-flex ss-col-center ss-row-between ss-p-x-30 border-bottom"},{default:c((()=>[n(M,{class:"footer-left ss-flex ss-col-center"},{default:c((()=>[n(L,{class:"check-box ss-flex ss-col-center ss-p-r-30",onClick:N},{default:c((()=>[n(A,{checked:T.isAllSelected,color:"var(--ui-BG-Main)",style:{transform:"scale(0.8)"},onClick:m(N,["stop"])},null,8,["checked","onClick"]),n(M,{class:"ss-m-l-8"},{default:c((()=>[r(" 全选 ")])),_:1})])),_:1}),n(g,null,{default:c((()=>[r("合计：")])),_:1}),n(M,{class:"text-price price-text"},{default:c((()=>[r(u(T.totalPriceSelected),1)])),_:1})])),_:1}),n(M,{class:"footer-right"},{default:c((()=>[T.editMode?(o(),a(G,{key:0,class:"ss-reset-button ui-BG-Main-Gradient pay-btn ui-Shadow-Main",onClick:F},{default:c((()=>[r(" 删除 ")])),_:1})):(o(),a(G,{key:1,class:"ss-reset-button ui-BG-Main-Gradient pay-btn ui-Shadow-Main",onClick:V},{default:c((()=>{var e;return[r(" 去结算 "+u((null==(e=T.selectedIds)?void 0:e.length)?`(${T.selectedIds.length})`:""),1)]})),_:1}))])),_:1})])),_:1})])),_:1})):i("",!0)])),_:1})):i("",!0)])),_:1})}}},[["__scopeId","data-v-d034177b"]]);export{A as default};
