import{_ as e}from"./index.DiwcnuvH.js";import{ag as t,b6 as a,c as l,e as o,N as s,w as n,bd as r,l as i,t as p,g as c}from"./index.DjGThAdz.js";import{f as d,h as u,i as _}from"./account.CuTixaZ8.js";import{g as h,a as g,b as m,c as v}from"./commonOptions.CpODg7Hg.js";import"./el-col.BuQveV1c.js";import"./deposit.DUFaTeNT.js";import"./service.BCmiTIe4.js";import"./merchant.BuDP7swB.js";const b={style:{color:"red"}},w={__name:"channel-taobao-receipt-account-list-template",props:{channel_id:{type:[Number,String],default:""}},setup(w){let f=[],y=[],F=[],j=[];const x=w,V=t({columns:[{label:"ID",prop:"id",width:90,align:"center"},{label:"服务商编号",prop:"service_code",align:"center",width:140},{label:"服务商名称",prop:"service_name",align:"center",width:110},{label:"通道",prop:"channel_name",align:"center",width:90},{label:"收款码信息",prop:"qrcode_info",align:"center",width:250,slot:"qrcode_info_slot"},{label:"今日收款笔数",prop:"today_success_count",align:"center",width:100},{label:"今日总跑量",prop:"today_success_amount",align:"center",width:90},{label:"昨日收款笔数",prop:"yesterday_success_count",align:"center",width:100},{label:"昨日总跑量",prop:"yesterday_success_amount",align:"center",width:100},{label:"每日限数",prop:"limit_count",align:"center",width:100},{label:"每日限额",prop:"limit_amount",align:"center",width:100},{label:"总笔数",prop:"total_count",align:"center",width:80},{label:"成功笔数",prop:"success_count",align:"center",width:80},{label:"总跑量",prop:"total_amount",align:"center",width:100},{prop:"total_revenue",label:"总收益",width:100,align:"center"},{label:"成功率",prop:"success_rate",align:"center",width:80,slot:"success_rate_slot"},{label:"接单状态",prop:"order_status",align:"center",width:140,slot:"order_status_slot"},{label:"有效状态",prop:"status",align:"center",width:140,slot:"status_slot"},{label:"创建时间",prop:"created_at",align:"center"}],tableData:[],searchFields:[{label:"服务商编号",prop:"service_code",type:"input",value:""},{label:"服务商名称",prop:"service_name",type:"select",value:"",options:f},{label:"收款码账号",prop:"shop_name",type:"input",value:""},{label:"接单状态",prop:"order_status",type:"select",value:"",options:F},{label:"有效状态",prop:"status",type:"select",value:"",options:y},{label:"排序",prop:"sort_field",type:"select",value:"",options:j}],total:0,page:1,per_page:10,loading:!1}),D=(e,t)=>{let a="status"===t?u:_;V.loading=!0;const l={channel_id:x.channel_id};l[t]=e[t],a(e.id,l).then(e=>{V.loading=!1}).catch(()=>{const a=V.tableData.findIndex(t=>t.id==e.id);-1!==a&&(V.tableData[a][t]=1==e[t]?0:1),V.loading=!1})},U=()=>{V.searchFields.forEach(e=>{"datetimerange"==e.dateType?e.value=[]:e.value=""}),C()};const C=()=>{var e,t;V.loading=!0;let a={per_page:V.per_page,page:V.page,channel_id:x.channel_id},l=function(e){const t={};return e.forEach(e=>{e.prop&&void 0!==e.value&&(t[e.prop]=e.value)}),t}(V.searchFields);if(l.sort_field){const a=j.find(e=>e.label===l.sort_field);a&&(l.sort_type=null==(e=null==a?void 0:a.data)?void 0:e.type,l.sort_field=null==(t=null==a?void 0:a.data)?void 0:t.field)}d(Object.assign(a,l)).then(e=>{Array.isArray(e.data)||(e.data=[]),V.tableData=e.data,V.total=e.total,V.loading=!1}).catch(()=>{V.loading=!1})};return a(()=>{V.searchFields.forEach(e=>{"service_name"===e.prop&&h(!0).then(t=>{e.options=f=t}).catch(()=>{e.options=f=[]}),"order_status"===e.prop&&(e.options=F=g()),"status"===e.prop&&(e.options=y=m()),"sort_field"===e.prop&&v().then(t=>{e.options=j=t}).catch(()=>{e.options=j=[]})}),C()}),(t,a)=>{const d=r,u=e;return o(),l("div",null,[s(u,{type:"export",columns:c(V).columns,searchFields:c(V).searchFields,"onUpdate:searchFields":a[0]||(a[0]=e=>c(V).searchFields=e),data:c(V).tableData,per_page:c(V).per_page,"onUpdate:per_page":a[1]||(a[1]=e=>c(V).per_page=e),page:c(V).page,"onUpdate:page":a[2]||(a[2]=e=>c(V).page=e),total:c(V).total,onGetTableData:C,onResetForm:U,loading:c(V).loading,showSelection:!1,showRightRefreshSlot:!1},{qrcode_info_slot:n(({row:e})=>[i("div",null," 标识:"+p(e.shop_id),1),i("div",null," 账号:"+p(e.shop_name),1)]),success_rate_slot:n(({row:e})=>[i("div",b,p(e.success_rate),1)]),order_status_slot:n(({row:e})=>[s(d,{modelValue:e.order_status,"onUpdate:modelValue":t=>e.order_status=t,style:{"--el-switch-on-color":"#337ecc"},"active-value":1,"inactive-value":0,"active-text":"正常","inactive-text":"禁用",onChange:t=>D(e,"order_status")},null,8,["modelValue","onUpdate:modelValue","onChange"])]),status_slot:n(({row:e})=>[s(d,{modelValue:e.status,"onUpdate:modelValue":t=>e.status=t,style:{"--el-switch-on-color":"#337ecc"},"active-value":1,"inactive-value":0,"active-text":"有效","inactive-text":"无效",onChange:t=>D(e,"status")},null,8,["modelValue","onUpdate:modelValue","onChange"])]),_:1},8,["columns","searchFields","data","per_page","page","total","loading"])])}}};export{w as default};