tg_web_dist/js/merchant-balance-details.CFFc8yco.js
2025-07-01 19:19:40 +08:00

2 lines
3.6 KiB
JavaScript

import{_ as e}from"./index.BDoRN0N8.js";import{y as t}from"./index.vnxWwO7O.js";/* empty css */import{$ as a,D as n}from"./element-plus.RkKozuVi.js";import{c as l,V as o,a0 as i,x as s,y as r,M as p,K as c,a2 as u,P as d,u as _,n as h}from"./editor-vue.DJDELE42.js";/* empty css *//* empty css */import"./lodash.lGe4XDVY.js";const m={__name:"merchant-balance-details",props:{getTypeList:{type:Function,required:!0},getList:{type:Function,required:!0},getMerchantTypeList:{type:Function,required:!1},showMerchantFilter:{type:Boolean,required:!1,default:!0}},setup(m){const g=m,y=l((()=>{const e=[{label:"交易号",prop:"transaction_no",type:"input",value:""},{label:"类型",type:"select",prop:"type",value:"",options:b},{label:"收支",type:"select",prop:"in_out",value:"",options:F},{prop:"transaction_at",label:"交易时间",type:"date",dateType:"datetimerange",value:[]}];return g.showMerchantFilter&&e.unshift({label:"商户",prop:"merchant_id",type:"select",options:v,value:""}),e}));let b=[],v=[];const F=[{label:"收",value:1},{label:"支",value:2}],f=o({columns:[{prop:"merchant_id",label:"商户编号",width:80,align:"center"},{prop:"merchant_name",label:"商户名称",align:"center"},{prop:"transaction_no",label:"交易号",align:"center"},{prop:"type_name",label:"类型",align:"center"},{prop:"in_out_name",label:"收/支",align:"center",slot:"in_out_slot"},{prop:"change_amount",label:"交易金额",align:"center",slot:"amount_slot"},{prop:"after_balance",label:"佣金余额",align:"center"},{prop:"transaction_time",label:"交易时间",align:"center"},{prop:"remark",label:"备注",align:"center"}],tableData:[],searchFields:y.value,total:0,page:1,limit:10,loading:!1}),j=()=>{f.searchFields.forEach((e=>{"datetimerange"==e.dateType?e.value=[]:e.value=""})),w()};const w=()=>{var e;f.loading=!0;let a={limit:f.limit,page:f.page},n=function(e){const t={};return e.forEach((e=>{e.prop&&void 0!==e.value&&(t[e.prop]=e.value)})),t}(f.searchFields);(null==(e=n.transaction_at)?void 0:e.length)>0&&(n.transaction_time_start=n.transaction_at[0]?t(n.transaction_at[0]):"",n.transaction_time_end=n.transaction_at[1]?t(n.transaction_at[1]):""),g.getList(Object.assign(a,n)).then((e=>{f.tableData=e.data,f.total=e.total,f.loading=!1})).catch((()=>{f.loading=!1}))};return i((()=>{f.searchFields=y.value,g.getTypeList({}).then((e=>{b=[],Object.entries(e).forEach((([e,t])=>{b.push({label:t,value:e})})),h((()=>{f.searchFields.forEach((e=>{"type"==e.prop&&(e.options=b)}))}))})),g.getMerchantTypeList&&g.showMerchantFilter&&g.getMerchantTypeList({}).then((e=>{v=[],e.forEach((e=>{v.push({label:e.name,value:e.id})})),h((()=>{f.searchFields.forEach((e=>{"merchant_id"==e.prop&&(e.options=v)}))}))})),w()})),(t,l)=>{const o=n,i=a,h=e;return r(),s("div",null,[p(h,{type:"export",columns:_(f).columns,searchFields:_(f).searchFields,"onUpdate:searchFields":l[0]||(l[0]=e=>_(f).searchFields=e),data:_(f).tableData,limit:_(f).limit,"onUpdate:limit":l[1]||(l[1]=e=>_(f).limit=e),page:_(f).page,"onUpdate:page":l[2]||(l[2]=e=>_(f).page=e),total:_(f).total,onGetTableData:w,onResetForm:j,loading:_(f).loading,showSelection:!1,showRightRefreshSlot:!1},{in_out_slot:c((({row:e})=>[p(o,{type:1===e.in_out?"danger":"success"},{default:c((()=>[u(d(1===e.in_out?"收":"支"),1)])),_:2},1032,["type"])])),amount_slot:c((({row:e})=>[p(i,{type:1===e.in_out?"danger":"success"},{default:c((()=>[u(d(1===e.in_out?"+"+e.change_amount:"-"+e.change_amount),1)])),_:2},1032,["type"])])),_:1},8,["columns","searchFields","data","limit","page","total","loading"])])}}};export{m as default};