"use strict";const e=require("../../common/vendor.js"),s=require("../../sheep/index.js"),t=require("../../sheep/hooks/useGoods.js");if(require("../../sheep/url/index.js"),require("../../sheep/store/index.js"),require("../../sheep/store/app.js"),require("../../sheep/api/promotion/diy.js"),require("../../sheep/request/index.js"),require("../../sheep/config/index.js"),require("../../sheep/platform/index.js"),require("../../sheep/platform/provider/wechat/index.js"),require("../../sheep/platform/provider/wechat/miniProgram.js"),require("../../sheep/api/member/auth.js"),require("../../sheep/api/member/social.js"),require("../../sheep/api/member/user.js"),require("../../sheep/platform/provider/apple/index.js"),require("../../sheep/platform/share.js"),require("../../sheep/router/index.js"),require("../../sheep/hooks/useModal.js"),require("../../sheep/helper/index.js"),require("../../sheep/helper/test.js"),require("../../sheep/helper/digit.js"),require("../../sheep/api/member/signin.js"),require("../../sheep/helper/throttle.js"),require("../../sheep/platform/pay.js"),require("../../sheep/api/pay/order.js"),require("../../sheep/store/user.js"),require("../../sheep/store/cart.js"),require("../../sheep/api/trade/cart.js"),require("../../sheep/api/pay/wallet.js"),require("../../sheep/api/trade/order.js"),require("../../sheep/api/promotion/coupon.js"),require("../../sheep/store/sys.js"),require("../../sheep/store/modal.js"),require("../../sheep/config/zIndex.js"),require("../../sheep/util/index.js"),!Array){(e.resolveComponent("s-empty")+e.resolveComponent("su-number-box")+e.resolveComponent("s-goods-item")+e.resolveComponent("su-fixed")+e.resolveComponent("s-layout"))()}Math||((()=>"../../sheep/components/s-empty/s-empty.js")+(()=>"../../sheep/ui/su-number-box/su-number-box.js")+(()=>"../../sheep/components/s-goods-item/s-goods-item.js")+(()=>"../../sheep/ui/su-fixed/su-fixed.js")+(()=>"../../sheep/components/s-layout/s-layout.js"))();const r={__name:"cart",setup(r){e.useCssVars((s=>({13408786:e.unref(i)})));const i=s.sheep.$platform.navbar,o=s.sheep.$store("cart"),p=e.reactive({editMode:!1,list:e.computed((()=>o.list)),shopList:e.computed((()=>o.shopNameMap)),skuList:e.computed((()=>o.shopSkuMap)),selectedList:[],selectedIds:e.computed((()=>o.selectedIds)),isAllSelected:e.computed((()=>o.isAllSelected)),totalPriceSelected:e.computed((()=>o.totalPriceSelected))}),d=e.computed((()=>{const e={};return p.list.forEach((s=>{const t=Object.keys(p.skuList).find((e=>p.skuList[e].includes(s.sku.id))),r=p.shopList[t]||"未知店铺";e[r]||(e[r]=[]),e[r].push(s)})),e}));function u(e){console.log("单选"),o.selectSingle(e)}function l(){o.selectAll(!p.isAllSelected)}function n(){let e=[],t=[];p.selectedList=p.list.filter((e=>p.selectedIds.includes(e.id))),p.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.sheep.$router.go("/pages/order/confirm",{data:JSON.stringify({items:e,deliveryType:1,pointStatus:!1})}):s.sheep.$helper.toast("请选择商品")}async function a(){o.delete(p.selectedIds)}return(s,r)=>{var i;return e.e({a:0===p.list.length},0===p.list.length?{b:e.p({text:"购物车空空如也,快去逛逛吧~",icon:"/static/cart-empty.png"})}:{},{c:p.list.length},p.list.length?e.e({d:e.t(p.list.length),e:p.editMode},p.editMode?{f:e.o((e=>p.editMode=!1))}:{g:e.o((e=>p.editMode=!0))},{h:e.f(d.value,((s,t,r)=>({a:e.t(t),b:e.f(s,((s,t,i)=>e.e({a:p.selectedIds.includes(s.id),b:e.o((e=>u(s.id)),s.id),c:e.o((e=>u(s.id)),s.id)},p.editMode?{}:{d:e.o((e=>{return r=s,void(0!==(t=e)?r.goods_num!==t&&(r.goods_num=t,o.update({goods_id:r.id,goods_num:t,goods_sku_price_id:r.goods_sku_price_id})):o.delete(r.id));var t,r}),s.id),e:"abe88574-3-"+r+"-"+i+",abe88574-2-"+r+"-"+i,f:e.o((e=>s.count=e),s.id),g:e.p({min:0,max:s.sku.stock,step:1,modelValue:s.count})},{h:"abe88574-2-"+r+"-"+i+",abe88574-0",i:e.p({title:s.spu.name,img:s.spu.picUrl||s.goods.image,price:s.sku.price,skuText:s.sku.properties.length>1?s.sku.properties.reduce(((e,s)=>e.valueName+" "+s.valueName)):s.sku.properties[0].valueName,priceColor:"#FF3000",titleWidth:400}),j:s.id}))),c:t}))),i:!p.editMode,j:p.list.length>0},p.list.length>0?e.e({k:p.isAllSelected,l:e.o(l),m:e.o(l),n:e.t(e.unref(t.fen2yuan)(p.totalPriceSelected)),o:p.editMode},p.editMode?{p:e.o(a)}:{q:e.t((null==(i=p.selectedIds)?void 0:i.length)?`(${p.selectedIds.length})`:""),r:e.o(n)},{s:e.p({bottom:!0,val:48,placeholder:!0,isInset:!1})}):{}):{},{t:e.s(s.__cssVars()),v:e.p({title:"购物车",tabbar:"/pages/index/cart",bgStyle:{color:"#fff"}})})}}},i=e._export_sfc(r,[["__scopeId","data-v-abe88574"]]);wx.createPage(i);
