Files
zyt/server/public/admin/assets/index-B0cpXUij.js
T
2026-06-01 10:01:59 +08:00

2 lines
11 KiB
JavaScript

import{D as he,B as we,G as Ce,F as Ee,R as Ve,Z as xe,i as Se,J as je,M as Re,N as De,r as Oe,L as We,E as Fe}from"./element-plus-lurTijPg.js";import{_ as Ne}from"./index.vue_vue_type_script_setup_true_lang-CB1JgtXC.js";import{c as Te,k as Ye,i as $e,_ as Me}from"./index-DU3c9-Jb.js";import{d as Be,e as Ie}from"./self_input_stats-DKX-gOp1.js";import{d as Pe}from"./department-BAsYUeHV.js";import{u as Ae}from"./usePaging-VsbTxSU0.js";import{_ as Le}from"./MediaSourceSelect.vue_vue_type_script_setup_true_lang-BOQUTiLN.js";import{_ as Ue}from"./yeji-edit.vue_vue_type_script_setup_true_lang-CqGT7978.js";import{u as ze}from"./useMediaSourceOptions-DtPF9rK4.js";import{a as Ge}from"./vue-router-QlpZ4wdW.js";import{f as J,b as A,as as qe,ak as i,I as v,a as n,aN as o,O as p,G as c,H as W,J as m,F as L,ap as U,aP as w,A as C,n as z}from"./@vue/runtime-core-C6bnekPw.js";import{y as l,a as G,q as Je,n as F,r as q}from"./@vue/reactivity-DiY1c2vO.js";import{Q as g,o as Qe}from"./@vue/shared-mAAVTE9n.js";import"./@vue/runtime-dom-DDAG46FW.js";import"./lodash-D3kF6u-c.js";import"./@element-plus/icons-vue-HOEUG8sr.js";import"./lodash-es-C2A-Pj28.js";import"./@popperjs/core-C5az9QE8.js";import"./dayjs-DG77mNTn.js";import"./@ctrl/tinycolor-BuyEbX8F.js";import"./async-validator-CFA_igpM.js";import"./normalize-wheel-es-BQoi3Ox2.js";import"./jspdf-BsthCvR5.js";import"./@babel/runtime-BanGtE2-.js";import"./fflate-_ayOYiT1.js";import"./pinia-B8cvXbiZ.js";import"./axios-C80V62Fs.js";import"./@vueuse/core-1S4fJlii.js";import"./@vueuse/shared-Cl3lVqjz.js";import"./css-color-function-DI01JAaZ.js";import"./balanced-match-BdS7OldZ.js";import"./color-B2zxaWkI.js";import"./clone-DBZ6_OiU.js";import"./color-convert-OrFsTA_V.js";import"./color-name-Dju3oUBS.js";import"./color-string-pUQDDJII.js";import"./ms-CzQ2E3wO.js";import"./vue-clipboard3-DByT_rEQ.js";import"./clipboard-CHgxszqY.js";import"./echarts-CNLwa9wG.js";import"./tslib-BDyQ-Jie.js";import"./zrender-DRNXw7y3.js";import"./highlight.js-Bxt7hFFy.js";import"./@highlightjs/vue-plugin-C4onkBvW.js";import"./index-D5h1pDU3.js";const He={class:"self-input-stats-page"},Ke={class:"stats-kpi-grid"},Ze={class:"stats-kpi-label"},Xe={class:"card-header"},et={class:"card-header-main"},tt={class:"card-hint"},at={class:"card-header-actions"},ot={class:"dept-cell"},nt={key:1},lt={key:2,class:"text-gray-400"},it={class:"flex justify-end mt-4"},st=J({name:"selfInputStats"}),rt=J({...st,setup(pt){const Q=Ge(),E=Je(),V=F(!1),u=F([]),S=F([]),{mediaSourceOptions:N,mediaSourceLoading:T,loadMediaSourceOptions:H,refreshMediaSourceOptions:j}=ze(),K={value:"id",label:"name",children:"children"},f=q({date_range:[],summary:{},can_view_finance:!1}),Y=new Set(["account_cost","cash_cost","roi"]),$=C(()=>!!f.can_view_finance),s=q({media_source:"",dept_id:void 0,time_type:"today",start_date:"",end_date:""}),R=C(()=>Ye("stats.personal_account_cost/lists")||""),Z=()=>{R.value&&Q.push(R.value)},X=async t=>{s.time_type==="custom"&&(t.start_date=u.value[0]||"",t.end_date=u.value[1]||"");const e=await Be(t);return Object.assign(f,(e==null?void 0:e.extend)||{}),e},ee=async()=>{try{const t=await Pe({apply_data_scope:1});Array.isArray(t)&&(S.value=t)}catch{S.value=[]}},te=t=>{t&&j()},ae=async()=>{await j(),await _()};A(()=>{ee(),H()});const{pager:d,getLists:oe}=Ae({fetchFun:X,params:s,firstLoading:!0}),M=[{key:"add_fans_count",label:"加粉数",type:"count"},{key:"total_open_count",label:"总开口",type:"count"},{key:"unreplied_count",label:"未回复",type:"count"},{key:"paid_appointment_count",label:"付费挂号",type:"count"},{key:"free_appointment_count",label:"免费挂号",type:"count"},{key:"interview_count",label:"面诊",type:"count"},{key:"order_amount",label:"订单金额",type:"money"},{key:"account_cost",label:"账户消耗",type:"money"},{key:"total_open_rate",label:"总开口率",type:"percent"},{key:"paid_appointment_rate",label:"付费挂号率",type:"percent"},{key:"open_appointment_rate",label:"开口挂号率",type:"percent"},{key:"interview_rate",label:"面诊率",type:"percent"},{key:"receive_rate",label:"接诊率",type:"percent"},{key:"open_receive_rate",label:"开口接诊率",type:"percent"},{key:"interview_receive_rate",label:"面诊接诊率",type:"percent"},{key:"avg_unit_price",label:"平均单价",type:"money"},{key:"cash_cost",label:"现金成本",type:"money"},{key:"roi",label:"ROI",type:"ratio"}],B=[{key:"add_fans_count",label:"加粉数",type:"count"},{key:"total_open_count",label:"总开口",type:"count"},{key:"unreplied_count",label:"未回复",type:"count"},{key:"paid_appointment_count",label:"付费挂号",type:"count"},{key:"free_appointment_count",label:"免费挂号",type:"count"},{key:"appointment_total_count",label:"挂号总数",type:"count"},{key:"interview_count",label:"面诊",type:"count"},{key:"completed_order_count",label:"接诊诊单",type:"count"},{key:"order_amount",label:"订单金额",type:"money",minWidth:110},{key:"account_cost",label:"账户消耗",type:"money",minWidth:110},{key:"total_open_rate",label:"总开口率",type:"percent",minWidth:100},{key:"paid_appointment_rate",label:"付费挂号率",type:"percent",minWidth:110},{key:"open_appointment_rate",label:"开口挂号率",type:"percent",minWidth:110},{key:"interview_rate",label:"面诊率",type:"percent",minWidth:100},{key:"receive_rate",label:"接诊率",type:"percent",minWidth:100},{key:"interview_receive_rate",label:"面诊接诊率",type:"percent",minWidth:120},{key:"open_receive_rate",label:"开口接诊率",type:"percent",minWidth:110},{key:"avg_unit_price",label:"平均单价",type:"money",minWidth:100},{key:"cash_cost",label:"现金成本",type:"money",minWidth:100},{key:"roi",label:"ROI",type:"ratio",minWidth:80}],ne=C(()=>$.value?M:M.filter(t=>!Y.has(t.key))),le=C(()=>$.value?B:B.filter(t=>!Y.has(t.key))),ie=C(()=>{var t;return(t=f.date_range)!=null&&t.length?`${f.date_range[0]}${f.date_range[1]}`:"未选择"}),_=async()=>{try{await oe()}catch(t){console.error("获取自录转化统计失败:",t),Fe.error((t==null?void 0:t.msg)||"获取统计数据失败")}},se=()=>{s.time_type!=="custom"&&(u.value=[],d.page=1,_())},re=()=>{u.value.length===2&&(d.page=1,_())},D=()=>{d.page=1,_()},pe=()=>{s.media_source="",s.dept_id=void 0,s.time_type="today",u.value=[],d.page=1,d.size=15,_()},I=(t,e,r="count")=>{const b=(e==null?void 0:e[t])??0;return r==="money"?${Number(b||0).toFixed(2)}`:r==="percent"?`${Number(b||0).toFixed(2)}%`:r==="ratio"?Number(b||0).toFixed(2):String(b??0)},de=async()=>{var t;await j(),V.value=!0,await z(),(t=E.value)==null||t.open("add")},me=async t=>{var e,r;V.value=!0,await z(),(e=E.value)==null||e.open("edit"),(r=E.value)==null||r.setFormData(t)},ce=async t=>{await $e.confirm("确定删除该业绩记录?"),await Ie({id:t}),_()};return A(async()=>{await _()}),(t,e)=>{const r=Ee,b=Ce,h=we,ue=Ve,_e=xe,k=Se,ye=he,P=je,fe=Te,y=De,be=Oe,ke=Re,ve=Ne,x=qe("perms"),ge=We;return i(),v("div",He,[n(P,{class:"!border-none",shadow:"never"},{default:o(()=>[n(ye,{inline:!0,model:l(s),class:"stats-filter-form"},{default:o(()=>[n(h,{label:"时间范围"},{default:o(()=>[n(b,{modelValue:l(s).time_type,"onUpdate:modelValue":e[0]||(e[0]=a=>l(s).time_type=a),onChange:se},{default:o(()=>[n(r,{label:"today"},{default:o(()=>[...e[6]||(e[6]=[p("今天",-1)])]),_:1}),n(r,{label:"yesterday"},{default:o(()=>[...e[7]||(e[7]=[p("昨天",-1)])]),_:1}),n(r,{label:"week"},{default:o(()=>[...e[8]||(e[8]=[p("最近7天",-1)])]),_:1}),n(r,{label:"month"},{default:o(()=>[...e[9]||(e[9]=[p("最近30天",-1)])]),_:1}),n(r,{label:"custom"},{default:o(()=>[...e[10]||(e[10]=[p("自定义",-1)])]),_:1})]),_:1},8,["modelValue"])]),_:1}),l(s).time_type==="custom"?(i(),c(h,{key:0},{default:o(()=>[n(ue,{modelValue:l(u),"onUpdate:modelValue":e[1]||(e[1]=a=>G(u)?u.value=a:null),type:"daterange","value-format":"YYYY-MM-DD","range-separator":"至","start-placeholder":"开始日期","end-placeholder":"结束日期",style:{width:"260px"},onChange:re},null,8,["modelValue"])]),_:1})):W("",!0),n(h,{label:"部门"},{default:o(()=>[n(_e,{modelValue:l(s).dept_id,"onUpdate:modelValue":e[2]||(e[2]=a=>l(s).dept_id=a),data:l(S),"node-key":"id",props:K,"default-expand-all":!0,"check-strictly":"",placeholder:"全部部门",clearable:"",filterable:"",style:{width:"220px"},onChange:D},null,8,["modelValue","data"])]),_:1}),n(h,{label:"自媒体来源"},{default:o(()=>[n(Le,{modelValue:l(s).media_source,"onUpdate:modelValue":e[3]||(e[3]=a=>l(s).media_source=a),options:l(N),loading:l(T),placeholder:"全部来源","allow-create":!1,"select-style":"width: 220px",onChange:D,onVisibleChange:te},null,8,["modelValue","options","loading"])]),_:1}),n(h,null,{default:o(()=>[n(k,{type:"primary",loading:l(d).loading,onClick:D},{default:o(()=>[...e[11]||(e[11]=[p("查询",-1)])]),_:1},8,["loading"]),n(k,{onClick:pe},{default:o(()=>[...e[12]||(e[12]=[p("重置",-1)])]),_:1})]),_:1})]),_:1},8,["model"])]),_:1}),m("div",Ke,[(i(!0),v(L,null,U(l(ne),a=>(i(),v("div",{key:a.key,class:"stats-kpi-card"},[m("div",Ze,g(a.label),1),m("div",{class:Qe(["stats-kpi-value",{"is-money":a.type==="money"}])},g(I(a.key,l(f).summary,a.type)),3)]))),128))]),n(P,{class:"!border-none mt-4 stats-detail-card",shadow:"never"},{header:o(()=>[m("div",Xe,[m("div",et,[e[13]||(e[13]=m("span",{class:"card-title"},"业绩明细",-1)),m("span",tt,g(l(ie)),1)]),m("div",at,[w((i(),c(k,{type:"primary",onClick:de},{icon:o(()=>[n(fe,{name:"el-icon-Plus"})]),default:o(()=>[e[14]||(e[14]=p(" 新增业绩 ",-1))]),_:1})),[[x,["stats.personal_yeji/add"]]]),l(R)?w((i(),c(k,{key:0,onClick:Z},{default:o(()=>[...e[15]||(e[15]=[p(" 账户消耗录入 ",-1)])]),_:1})),[[x,["stats.personal_account_cost/lists"]]]):W("",!0)])])]),default:o(()=>[w((i(),c(ke,{data:l(d).lists,border:"",size:"large","max-height":"640"},{default:o(()=>[n(y,{label:"日期",prop:"yeji_date","min-width":"110",fixed:"left"}),n(y,{label:"自媒体来源",prop:"media_source","min-width":"140","show-overflow-tooltip":""}),n(y,{label:"录入人",prop:"creator_name","min-width":"100"}),n(y,{label:"部门",prop:"dept_name","min-width":"140"},{default:o(({row:a})=>[a.dept_path?(i(),c(be,{key:0,content:a.dept_path,placement:"top",effect:"dark"},{default:o(()=>[m("span",ot,g(a.dept_name||"未分配"),1)]),_:2},1032,["content"])):a.dept_name?(i(),v("span",nt,g(a.dept_name),1)):(i(),v("span",lt,"未分配"))]),_:1}),(i(!0),v(L,null,U(l(le),a=>(i(),c(y,{key:a.key,label:a.label,"min-width":a.minWidth||100,align:"right"},{default:o(({row:O})=>[p(g(I(a.key,O,a.type)),1)]),_:2},1032,["label","min-width"]))),128)),n(y,{label:"备注",prop:"remark","min-width":"160","show-overflow-tooltip":""}),n(y,{label:"操作",width:"140",fixed:"right"},{default:o(({row:a})=>[w((i(),c(k,{type:"primary",link:"",onClick:O=>me(a)},{default:o(()=>[...e[16]||(e[16]=[p(" 编辑 ",-1)])]),_:1},8,["onClick"])),[[x,["stats.personal_yeji/edit"]]]),w((i(),c(k,{type:"danger",link:"",onClick:O=>ce(a.id)},{default:o(()=>[...e[17]||(e[17]=[p(" 删除 ",-1)])]),_:1},8,["onClick"])),[[x,["stats.personal_yeji/delete"]]])]),_:1})]),_:1},8,["data"])),[[ge,l(d).loading]]),m("div",it,[n(ve,{modelValue:l(d),"onUpdate:modelValue":e[4]||(e[4]=a=>G(d)?d.value=a:null),onChange:_},null,8,["modelValue"])])]),_:1}),l(V)?(i(),c(Ue,{key:0,ref_key:"yejiEditRef",ref:E,"media-source-options":l(N),"media-source-loading":l(T),onSuccess:ae,onClose:e[5]||(e[5]=a=>V.value=!1)},null,8,["media-source-options","media-source-loading"])):W("",!0)])}}}),ta=Me(rt,[["__scopeId","data-v-47b76778"]]);export{ta as default};