import{_ as e}from"./index.vue_vue_type_script_setup_true_lang-a66505b9.js";import{_ as a}from"./search.vue_vue_type_script_setup_true_lang-bbdf4bb9.js";import{u as t}from"./useGetList-4b13a7ea.js";import{h as l}from"./moment-b265113e.js";import{e as n,s as o,a as s,b as r}from"./index-62ecbd0d.js";import{e as p}from"./exportExcel-331c8441.js";import{d as m,u as i,m as u,k as c,p as d,r as _,K as f,o as b,c as v,a as h,w as y,f as g,j as k,F as Y,q as j,s as x,b as M,e as C,J as D,O as w,Y as V}from"./index-018fb6dd.js";/* empty css             *//* empty css                   */import"./index-765bf96c.js";import"./http-338d117f.js";const H={class:"table-default"},S=C("br",null,null,-1),z=m({__name:"index",setup(m){const z=i(),$=u((()=>{var e;return z.getRoles,null==(e=z.getRoles)?void 0:e.some((e=>"cp"==(null==e?void 0:e.identify)))})),q=()=>{let e=c([]);o({is_export:1,...I.value}).then((a=>{e.value=a.data,e.value;const t={"月份":"month",cpid:"cp_id","cp名称":"cp_name","所属公司":"cp_company","结算书本量":"book_num","结算金额":"final_amount","结算情况":"final_state_str","结算日期":"final_time"};U.value.length>0?p(e.value,`cp结算${l().format("YYYY-MM-DD HH:mm:ss")}`,t,"cp结算"):w.warning("暂无数据")}))},E=e=>{if(I.value.time){const a=V(e);I.value.start_month=a[0],I.value.end_month=a[1]}else delete I.value.start_month,delete I.value.end_month},{data:F,query:I,search:J,reset:L,loading:R}=t("cpManage/cp/subscribeStatisticData/monthList",!0);let T=c([]);const U=u((()=>{var e;return null==(e=F.value)?void 0:e.data})),G=e=>{K(e?{cp_name:e}:{})},K=e=>{r(e).then((e=>{T.value=e.data}))};return d((()=>{K({}),J()})),(t,o)=>{const r=_("el-option"),m=_("el-select"),i=_("el-form-item"),u=_("el-date-picker"),d=_("el-button"),V=a,z=_("el-table-column"),F=_("el-tag"),K=_("el-table"),O=e,P=f("action"),A=f("loading");return b(),v("div",null,[h(V,{search:g(J),reset:g(L)},{body:y((()=>[g($)?x("",!0):(b(),k(i,{key:0,label:"cp名称",prop:"cp"},{default:y((()=>[h(m,{modelValue:g(I).cp_name,"onUpdate:modelValue":o[0]||(o[0]=e=>g(I).cp_name=e),filterable:"",remote:"",clearable:"","remote-method":G,placeholder:"选择版权方"},{default:y((()=>[(b(!0),v(Y,null,j(g(T),(e=>(b(),k(r,{key:e.cp_id,label:e.cp_name,value:e.cp_name},null,8,["label","value"])))),128))])),_:1},8,["modelValue"])])),_:1})),h(i,{label:"日期",prop:"cp_company"},{default:y((()=>[h(u,{"unlink-panels":"",clearable:"",onChange:E,format:"YYYY/MM","value-format":"YYYY-MM",modelValue:g(I).time,"onUpdate:modelValue":o[1]||(o[1]=e=>g(I).time=e),type:"monthrange","range-separator":"To","start-placeholder":"开始时间","end-placeholder":"结束时间"},null,8,["modelValue"])])),_:1})])),extra_button:y((()=>[h(d,{type:"primary",onClick:q,size:"default"},{default:y((()=>[M(" 导出 ")])),_:1})])),_:1},8,["search","reset"]),C("div",H,[D((b(),k(K,{data:g(U),class:"mt-3"},{default:y((()=>[h(z,{prop:"month",label:"月份"}),h(z,{prop:"cp_id",label:"cpid"}),h(z,{prop:"cp_name",label:"cp名称"}),h(z,{prop:"cp_company",label:"所属公司"}),h(z,{prop:"book_num",label:"结算短剧量"}),h(z,{prop:"final_amount",label:"结算金额"}),D((b(),k(z,{label:"结算情况"},{default:y((e=>["notCheck"==e.row.final_state?(b(),k(d,{key:0,type:"primary",size:"default",onClick:a=>{return t=e.row,s({id:t.id,final_state:"done"}).then((e=>{const a=e.data,t=a.code,l=a.message;if(1e4===t)return w.success(l||"设置成功"),a})),J(),void L();var t}},{default:y((()=>[M("点击结算")])),_:2},1032,["onClick"])):(b(),k(F,{key:1,type:"success",size:"default",effect:"dark"},{default:y((()=>[M("已结算")])),_:1}))])),_:1})),[[P,"cpManage.CpSubscribeStatisticData.saveFinalState"]]),h(z,{prop:"final_time",label:"结算日期"}),h(z,{label:"操作"},{default:y((e=>[h(d,{link:"",type:"primary",size:"small",onClick:a=>(e=>{const a={cp_name:e.cp_name,month:e.month};n(a).then((a=>{const t=c(),n={"书籍ID":"bid","书籍名称":"book_name","应结算金额":"final_amount","CP名称":"cp_name","月份":"month"};t.value=a.data,t.value.length>0?p(t.value,`(${e.cp_name})cp结算(月份)${l().format("YYYY-MM-DD HH:mm:ss")}`,n,"cp结算(月份)"):w.warning("暂无数据")}))})(e.row)},{default:y((()=>[M("导出")])),_:2},1032,["onClick"]),S])),_:1})])),_:1},8,["data"])),[[A,g(R)]]),h(O)])])}}});export{z as default};
