Files
xin-procurement/public/assets/payment-m5LFx4J0.js
T
2026-08-31 22:21:59 +08:00

1 line
7.8 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
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"./request--UCyt0wo.js";import{t as i}from"./typography-DRFhazK9.js";import{L as a,a as o}from"./lodash-DzOfPy0f.js";import{t as s}from"./table-BXi9q3AE.js";import{t as c}from"./space-Cu4QVMgQ.js";import{t as l}from"./button-BILozH6U.js";import{t as u}from"./radio-CxFl70_7.js";import{t as d}from"./modal-g8Q5gNCx.js";import{t as f}from"./descriptions-BLF6MKiu.js";import{t as p}from"./form-B3R3kIqp.js";import{t as m}from"./image-CTRBNpBE.js";import{t as h}from"./input-CHcsaDtX.js";import{r as g}from"./PictureOutlined-CB8Pr7jP.js";import{t as _}from"./tag-DBV1bHre.js";import{t as v}from"./XinTable-DOLiJ5rL.js";import{t as y}from"./AuthButton-DvrpreK4.js";import{t as b}from"./store-JDnJsv44.js";import{t as x}from"./iPurchaseOrder-Dn-laOqY.js";var S=e(t(),1),C={1:{text:`微信支付`,color:`green`},2:{text:`支付宝`,color:`blue`},3:{text:`对公汇款`,color:`purple`}},w={0:{text:`待审核`,color:`warning`},1:{text:`已通过`,color:`success`},2:{text:`已拒绝`,color:`error`}};async function T(e){return r({url:`/recon/payment/${e}`,method:`get`})}async function E(e,t){return r({url:`/recon/payment/${e}/audit`,method:`put`,data:t})}var D=n(),{Title:O,Text:k}=i,A=()=>{let e=(0,S.useRef)(null),[t,n]=(0,S.useState)([]),[r,i]=(0,S.useState)(!1),[A,j]=(0,S.useState)(null),[M,N]=(0,S.useState)(!1),[P,F]=(0,S.useState)(null),[I,L]=(0,S.useState)(!1),[R]=p.useForm(),z=p.useWatch(`result`,R);(0,S.useEffect)(()=>{b().then(e=>n(e.data.data??[]))},[]);let B=async e=>{i(!0),N(!0);try{let t=await T(e);j(t.data.data??null)}finally{N(!1)}},V=e=>{F(e),R.setFieldsValue({result:`pass`,audit_remark:``})},H=async t=>{if(P?.id){L(!0);try{let n=await E(P.id,t);g.success(n.data.msg??`审核完成`),F(null),await e.current?.reload(),A&&A.payment.id===P.id&&await B(P.id)}finally{L(!1)}}},U=[{title:`账单号`,dataIndex:`bill_no`,align:`center`,render:e=>(0,D.jsx)(k,{copyable:{text:e},children:e})},{title:`账单日期`,dataIndex:`bill_date`,align:`center`},{title:`商品金额`,dataIndex:`product_amount`,align:`center`,render:e=>${Number(e).toFixed(2)}`},{title:`配送费`,dataIndex:`delivery_fee`,align:`center`,render:e=>${Number(e).toFixed(2)}`},{title:`附加金额`,dataIndex:`added_amount`,align:`center`,render:e=>${Number(e).toFixed(2)}`},{title:`账单总金额`,dataIndex:`total_amount`,align:`center`,render:e=>(0,D.jsxs)(k,{strong:!0,children:[`¥`,Number(e).toFixed(2)]})},{title:`支付状态`,dataIndex:`status`,align:`center`,render:e=>{let t=x[Number(e??0)];return(0,D.jsx)(_,{color:t?.color,children:t?.text})}}],W=[{title:`支付单号`,dataIndex:`payment_no`,valueType:`text`,hideInForm:!0,width:210,render:(e,t)=>(0,D.jsx)(k,{copyable:{text:t.payment_no},children:t.payment_no})},{title:`门店`,dataIndex:`store_id`,valueType:`select`,hideInForm:!0,fieldProps:{options:t.map(e=>({label:e.name,value:e.id})),showSearch:!0,optionFilterProp:`label`},render:(e,t)=>t.store?.name??`门店#${t.store_id}`},{title:`支付金额`,dataIndex:`amount`,hideInForm:!0,hideInSearch:!0,align:`center`,render:(e,t)=>(0,D.jsxs)(k,{strong:!0,type:`danger`,children:[`¥`,t.amount]})},{title:`支付方式`,dataIndex:`pay_method`,valueType:`select`,hideInForm:!0,align:`center`,fieldProps:{options:Object.entries(C).map(([e,t])=>({value:Number(e),label:t.text}))},render:(e,t)=>{let n=C[t.pay_method??0];return(0,D.jsx)(_,{color:n?.color,children:n?.text??`-`})}},{title:`合并账单`,dataIndex:`bills_count`,hideInForm:!0,hideInSearch:!0,align:`center`,render:(e,t)=>`${t.bills_count??0} 张`},{title:`状态`,dataIndex:`status`,valueType:`select`,hideInForm:!0,align:`center`,fieldProps:{options:Object.entries(w).map(([e,t])=>({value:Number(e),label:t.text}))},render:(e,t)=>{let n=w[t.status??0];return(0,D.jsx)(_,{color:n?.color,children:n?.text})}},{title:`提交时间`,dataIndex:`created_at`,hideInForm:!0,hideInSearch:!0,align:`center`},{title:`审核人`,dataIndex:`auditor`,hideInForm:!0,hideInSearch:!0,align:`center`,render:(e,t)=>t.auditor?.nickname??`-`}];return(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)(`div`,{className:`mb-5`,children:[(0,D.jsx)(O,{level:3,children:`支付记录`}),(0,D.jsx)(k,{type:`secondary`,children:`门店在小程序端选择账单合并付款并上传汇款凭证;审核通过后关联账单全部置为已支付,拒绝则释放账单可重新付款。`})]}),(0,D.jsx)(v,{api:`/recon/payment`,columns:W,rowKey:`id`,accessName:`recon.payment`,tableRef:e,operateRender:e=>[(0,D.jsx)(l,{size:`small`,type:`primary`,icon:(0,D.jsx)(o,{}),onClick:()=>B(e.id)},`detail`),e.status===0?(0,D.jsx)(y,{auth:`recon.payment.audit`,children:(0,D.jsx)(l,{size:`small`,variant:`solid`,color:`orange`,onClick:()=>V(e),children:`审核`})},`audit`):null],formProps:!1,actionBarRender:e=>[e.search,e.keywordSearch]}),(0,D.jsx)(a,{title:A?`支付单 ${A.payment.payment_no}`:`支付记录详情`,open:r,onClose:()=>i(!1),size:1e3,loading:M,footer:A&&A.payment.status===0?(0,D.jsx)(c,{className:`flex justify-end`,children:(0,D.jsx)(y,{auth:`recon.payment.audit`,children:(0,D.jsx)(l,{type:`primary`,onClick:()=>V(A.payment),children:`审核`})})}):null,children:A?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)(f,{column:3,size:`small`,bordered:!0,children:[(0,D.jsx)(f.Item,{label:`门店`,children:A.payment.store?.name??`门店#${A.payment.store_id}`}),(0,D.jsx)(f.Item,{label:`支付金额`,children:(0,D.jsxs)(k,{strong:!0,type:`danger`,children:[`¥`,A.payment.amount]})}),(0,D.jsx)(f.Item,{label:`支付方式`,children:(0,D.jsx)(_,{color:C[A.payment.pay_method??0]?.color,children:C[A.payment.pay_method??0]?.text??`-`})}),(0,D.jsx)(f.Item,{label:`状态`,children:(0,D.jsx)(_,{color:w[A.payment.status??0]?.color,children:w[A.payment.status??0]?.text})}),(0,D.jsx)(f.Item,{label:`提交时间`,children:A.payment.created_at}),(0,D.jsx)(f.Item,{label:`审核人`,children:A.payment.auditor?.nickname??`-`}),(0,D.jsx)(f.Item,{label:`审核时间`,children:A.payment.audited_at??`-`}),(0,D.jsx)(f.Item,{label:`审核备注`,children:A.payment.audit_remark||`-`}),A.payment.remark?(0,D.jsx)(f.Item,{label:`门店备注`,span:3,children:A.payment.remark}):null]}),(0,D.jsx)(O,{level:5,className:`mt-6! mb-3!`,children:`汇款凭证`}),(A.payment.voucher_urls??[]).length>0?(0,D.jsx)(m.PreviewGroup,{children:(0,D.jsx)(c,{wrap:!0,size:12,children:(A.payment.voucher_urls??[]).map((e,t)=>(0,D.jsx)(m,{src:e,width:120,height:120,style:{objectFit:`cover`,borderRadius:4}},t))})}):(0,D.jsx)(k,{type:`secondary`,children:`无凭证`}),(0,D.jsxs)(O,{level:5,className:`mt-6! mb-3!`,children:[`合并付款账单(`,A.bills.length,` 张)`]}),(0,D.jsx)(s,{rowKey:`id`,size:`small`,bordered:!0,columns:U,dataSource:A.bills,pagination:!1,scroll:{x:`max-content`}})]}):null}),(0,D.jsxs)(d,{title:P?`审核支付单 ${P.payment_no}`:`审核`,open:P!==null,onCancel:()=>F(null),onOk:()=>R.submit(),confirmLoading:I,okText:`提交审核`,destroyOnHidden:!0,children:[(0,D.jsxs)(`div`,{className:`py-2 text-gray-500`,children:[`支付金额 `,(0,D.jsxs)(k,{strong:!0,type:`danger`,children:[`¥`,P?.amount??`0.00`]}),``,P?.bills_count??0,` 张账单); 通过后关联账单全部置为「已支付」,拒绝则释放账单,门店可重新发起付款。`]}),(0,D.jsxs)(p,{form:R,layout:`vertical`,onFinish:H,children:[(0,D.jsx)(p.Item,{label:`审核结果`,name:`result`,rules:[{required:!0,message:`请选择审核结果`}],children:(0,D.jsx)(u.Group,{options:[{value:`pass`,label:`通过(账单置为已支付)`},{value:`reject`,label:`拒绝(释放账单)`}]})}),(0,D.jsx)(p.Item,{label:z===`reject`?`拒绝原因`:`审核备注`,name:`audit_remark`,rules:[{required:z===`reject`,message:`拒绝时请填写原因`},{max:255}],children:(0,D.jsx)(h.TextArea,{rows:2,maxLength:255,placeholder:`审核备注(拒绝时必填)`})})]})]})]})};export{A as default};