1 line
5.5 KiB
JavaScript
1 line
5.5 KiB
JavaScript
import{o as e}from"./request-DWqS4XYU.js";import{Pr as t,t as n}from"./jsx-runtime-Dk2XcqH2.js";import{t as r}from"./typography-DvDsdb2f.js";import{t as i}from"./table-koANj7dJ.js";import{t as a}from"./button-CdrnzceP.js";import{n as o}from"./LockOutlined-CXWTaKH6.js";import{u as s}from"./XinForm-BVjxA6JJ.js";import{t as c}from"./form-DhDb91Ug.js";import{Kt as l,at as u,wt as d}from"./index-kOY0oRfZ.js";import{t as f}from"./XinTable-Ckq4e_EB.js";import{t as p}from"./AuthButton-Cb72D8wi.js";import{t as m}from"./download-2nlDzZA-.js";import{t as h}from"./store-CFnl3o8P.js";var g=e(t(),1),_=e(o(),1);async function v(e,t,n){return m(`/recon/container-return/export`,{start_date:e,end_date:t,...n.length>0?{store_ids:n.join(`,`)}:{}},`回筐记录.xlsx`)}var y=n(),{Title:b,Text:x}=r,{RangePicker:S}=s,C=({value:e})=>{let t=Number(e??0);return t>0?(0,y.jsxs)(x,{strong:!0,type:`warning`,children:[`+`,t]}):t<0?(0,y.jsx)(x,{strong:!0,type:`success`,children:t}):(0,y.jsx)(x,{type:`secondary`,children:`0`})},w=({value:e})=>{let t=Number(e??0);return t>0?(0,y.jsxs)(x,{strong:!0,type:`warning`,children:[`+¥`,t.toFixed(2)]}):t<0?(0,y.jsxs)(x,{strong:!0,type:`success`,children:[`-¥`,Math.abs(t).toFixed(2)]}):(0,y.jsx)(x,{type:`secondary`,children:`¥0.00`})},T=()=>{let[e,t]=(0,g.useState)([]),[n,r]=(0,g.useState)(!1),[o,s]=(0,g.useState)(!1),[m]=c.useForm();(0,g.useEffect)(()=>{h().then(e=>t(e.data.data??[]))},[]);let T=async e=>{let[t,n]=e.date_range;s(!0);try{await v(t.format(`YYYY-MM-DD`),n.format(`YYYY-MM-DD`),e.store_ids??[]),r(!1)}finally{s(!1)}},E=[{title:`门店`,dataIndex:`store_id`,valueType:`select`,hideInForm:!0,fieldProps:{options:e.map(e=>({label:e.name,value:e.id})),showSearch:!0,optionFilterProp:`label`},render:(e,t)=>t.store?.name??`门店#${t.store_id}`},{title:`关联账单`,dataIndex:`bill_id`,hideInForm:!0,hideInSearch:!0,render:(e,t)=>t.bill?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(x,{copyable:{text:t.bill.bill_no},children:t.bill.bill_no}),(0,y.jsx)(`div`,{className:`text-[12px] text-[#999]`,children:t.bill.bill_date})]}):`-`},{title:`压(回)筐数量`,dataIndex:`box_num`,hideInForm:!0,hideInSearch:!0,align:`center`,render:(e,t)=>(0,y.jsx)(C,{value:t.box_num})},{title:`压(回)托盘数量`,dataIndex:`tray_num`,hideInForm:!0,hideInSearch:!0,align:`center`,render:(e,t)=>(0,y.jsx)(C,{value:t.tray_num})},{title:`筐单价`,dataIndex:`box_price`,hideInForm:!0,hideInSearch:!0,align:`center`,render:(e,t)=>`¥${Number(t.box_price??0).toFixed(2)}`},{title:`托盘单价`,dataIndex:`tray_price`,hideInForm:!0,hideInSearch:!0,align:`center`,render:(e,t)=>`¥${Number(t.tray_price??0).toFixed(2)}`},{title:`抵扣(附加)金额`,dataIndex:`amount`,hideInForm:!0,hideInSearch:!0,align:`center`,render:(e,t)=>(0,y.jsx)(w,{value:t.amount})},{title:`操作人`,dataIndex:`operator`,hideInForm:!0,hideInSearch:!0,align:`center`,render:(e,t)=>t.operator?.nickname??`-`},{title:`记录时间`,dataIndex:`created_at`,valueType:`dateRange`,hideInForm:!0,hideInTable:!0,align:`center`},{title:`记录时间`,dataIndex:`created_at`,hideInForm:!0,hideInSearch:!0,align:`center`}];return(0,y.jsxs)(y.Fragment,{children:[(0,y.jsxs)(`div`,{className:`mb-5`,children:[(0,y.jsx)(b,{level:3,children:`回筐记录`}),(0,y.jsx)(x,{type:`secondary`,children:`周转筐/托盘跟账单走:生成账单时按填写数量自动写入;正数=压筐(附加金额),负数=回筐(抵扣金额),数量为 0 不生成记录; 可按日期区间与门店汇总导出(行=日期,列=门店,含行列合计)。`})]}),(0,y.jsx)(f,{api:`/recon/container-return`,columns:E,rowKey:`id`,accessName:`recon.containerReturn`,addShow:!1,editShow:!1,deleteShow:!1,formProps:!1,summary:e=>{let t=e.reduce((e,t)=>({box_num:e.box_num+Number(t.box_num??0),tray_num:e.tray_num+Number(t.tray_num??0),amount:e.amount+Number(t.amount??0)}),{box_num:0,tray_num:0,amount:0});return(0,y.jsxs)(i.Summary.Row,{children:[(0,y.jsx)(i.Summary.Cell,{index:0,colSpan:2,align:`center`,children:(0,y.jsx)(x,{strong:!0,children:`本页合计`})}),(0,y.jsx)(i.Summary.Cell,{index:2,align:`center`,children:(0,y.jsx)(C,{value:t.box_num})}),(0,y.jsx)(i.Summary.Cell,{index:3,align:`center`,children:(0,y.jsx)(C,{value:t.tray_num})}),(0,y.jsx)(i.Summary.Cell,{index:4,colSpan:2}),(0,y.jsx)(i.Summary.Cell,{index:6,align:`center`,children:(0,y.jsx)(w,{value:t.amount.toFixed(2)})}),(0,y.jsx)(i.Summary.Cell,{index:7,colSpan:3})]})},toolBarRender:e=>[(0,y.jsx)(p,{auth:`recon.containerReturn.export`,children:(0,y.jsx)(a,{icon:(0,y.jsx)(u,{}),onClick:()=>r(!0),children:`导出`})},`export`),e.columnSetting,e.hideBorder,e.reload,e.columnHeight]}),(0,y.jsxs)(d,{title:`导出回筐记录`,open:n,onCancel:()=>r(!1),onOk:()=>m.submit(),confirmLoading:o,okText:`导出`,destroyOnHidden:!0,children:[(0,y.jsx)(`div`,{className:`py-2 text-gray-500`,children:`按日期区间与门店导出抵扣(附加)金额汇总表:行=日期(同日记录合并),列=门店, 当天门店无记录填 0,含行合计与列合计。门店不选默认导出全部门店。`}),(0,y.jsxs)(c,{form:m,layout:`vertical`,onFinish:T,initialValues:{date_range:[(0,_.default)().startOf(`month`),(0,_.default)()],store_ids:[]},children:[(0,y.jsx)(c.Item,{label:`日期区间`,name:`date_range`,rules:[{required:!0,message:`请选择日期区间`}],children:(0,y.jsx)(S,{className:`w-full`,allowClear:!1})}),(0,y.jsx)(c.Item,{label:`门店`,name:`store_ids`,children:(0,y.jsx)(l,{mode:`multiple`,allowClear:!0,maxTagCount:`responsive`,placeholder:`全部门店`,showSearch:!0,optionFilterProp:`label`,options:e.map(e=>({label:e.name,value:e.id}))})})]})]})]})};export{T as default}; |