1 line
4.9 KiB
JavaScript
1 line
4.9 KiB
JavaScript
import{i as e}from"./rolldown-runtime-BgaNhQyE.js";import{Dr as t,t as n}from"./jsx-runtime-CRBytmvs.js";import{t as r}from"./typography-DRFhazK9.js";import{t as i}from"./button-BILozH6U.js";import{r as a}from"./DoubleRightOutlined-Blfli1UU.js";import{n as o}from"./LockOutlined-B8eRH1x4.js";import{u as s}from"./XinForm-BPDYdeax.js";import{t as c}from"./modal-g8Q5gNCx.js";import{t as l}from"./form-B3R3kIqp.js";import{t as u}from"./DownloadOutlined-DJY9Mu8c.js";import{t as d}from"./XinTable-DOLiJ5rL.js";import{t as f}from"./AuthButton-DvrpreK4.js";import{t as p}from"./download-DC9wDwqQ.js";import{t as m}from"./store-JDnJsv44.js";var h=e(t(),1),g=e(o(),1);async function _(e,t,n){return p(`/recon/container-return/export`,{start_date:e,end_date:t,...n.length>0?{store_ids:n.join(`,`)}:{}},`回筐记录.xlsx`)}var v=n(),{Title:y,Text:b}=r,{RangePicker:x}=s,S=({value:e})=>{let t=Number(e??0);return t>0?(0,v.jsxs)(b,{strong:!0,type:`warning`,children:[`+`,t]}):t<0?(0,v.jsx)(b,{strong:!0,type:`success`,children:t}):(0,v.jsx)(b,{type:`secondary`,children:`0`})},C=({value:e})=>{let t=Number(e??0);return t>0?(0,v.jsxs)(b,{strong:!0,type:`warning`,children:[`+¥`,t.toFixed(2)]}):t<0?(0,v.jsxs)(b,{strong:!0,type:`success`,children:[`-¥`,Math.abs(t).toFixed(2)]}):(0,v.jsx)(b,{type:`secondary`,children:`¥0.00`})},w=()=>{let[e,t]=(0,h.useState)([]),[n,r]=(0,h.useState)(!1),[o,s]=(0,h.useState)(!1),[p]=l.useForm();(0,h.useEffect)(()=>{m().then(e=>t(e.data.data??[]))},[]);let w=async e=>{let[t,n]=e.date_range;s(!0);try{await _(t.format(`YYYY-MM-DD`),n.format(`YYYY-MM-DD`),e.store_ids??[]),r(!1)}finally{s(!1)}},T={api:`/recon/container-return`,columns:[{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,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(b,{copyable:{text:t.bill.bill_no},children:t.bill.bill_no}),(0,v.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,v.jsx)(S,{value:t.box_num})},{title:`压(回)托盘数量`,dataIndex:`tray_num`,hideInForm:!0,hideInSearch:!0,align:`center`,render:(e,t)=>(0,v.jsx)(S,{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,v.jsx)(C,{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`}],rowKey:`id`,accessName:`recon.containerReturn`,addShow:!1,editShow:!1,deleteShow:!1,formProps:!1,toolBarRender:e=>[(0,v.jsx)(f,{auth:`recon.containerReturn.export`,children:(0,v.jsx)(i,{icon:(0,v.jsx)(u,{}),onClick:()=>r(!0),children:`导出`})},`export`),e.columnSetting,e.hideBorder,e.reload,e.columnHeight]};return(0,v.jsxs)(v.Fragment,{children:[(0,v.jsxs)(`div`,{className:`mb-5`,children:[(0,v.jsx)(y,{level:3,children:`回筐记录`}),(0,v.jsx)(b,{type:`secondary`,children:`周转筐/托盘跟账单走:生成账单时按填写数量自动写入;正数=压筐(附加金额),负数=回筐(抵扣金额),数量为 0 不生成记录; 可按日期区间与门店汇总导出(行=日期,列=门店,含行列合计)。`})]}),(0,v.jsx)(d,{...T}),(0,v.jsxs)(c,{title:`导出回筐记录`,open:n,onCancel:()=>r(!1),onOk:()=>p.submit(),confirmLoading:o,okText:`导出`,destroyOnHidden:!0,children:[(0,v.jsx)(`div`,{className:`py-2 text-gray-500`,children:`按日期区间与门店导出抵扣(附加)金额汇总表:行=日期(同日记录合并),列=门店, 当天门店无记录填 0,含行合计与列合计。门店不选默认导出全部门店。`}),(0,v.jsxs)(l,{form:p,layout:`vertical`,onFinish:w,initialValues:{date_range:[(0,g.default)().startOf(`month`),(0,g.default)()],store_ids:[]},children:[(0,v.jsx)(l.Item,{label:`日期区间`,name:`date_range`,rules:[{required:!0,message:`请选择日期区间`}],children:(0,v.jsx)(x,{className:`w-full`,allowClear:!1})}),(0,v.jsx)(l.Item,{label:`门店`,name:`store_ids`,children:(0,v.jsx)(a,{mode:`multiple`,allowClear:!0,maxTagCount:`responsive`,placeholder:`全部门店`,showSearch:!0,optionFilterProp:`label`,options:e.map(e=>({label:e.name,value:e.id}))})})]})]})]})};export{w as default}; |