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