/* empty css             *//* empty css                   *//* empty css                     *//* empty css                  *//* empty css                 *//* empty css               *//* empty css                  *//* empty css                     *//* empty css                  */import{a as e}from"./index-403f799c.js";import{a}from"./index-df416b18.js";import{f as l}from"./index-24473529.js";import{d as r,Q as t,m as s,x as i,W as m,f as o,o as d,l as n,w as u,a as p,c,F as _,y as f,e as h,b as g,t as v,a4 as b,a2 as y,a3 as x,A as j,B as V,S as k,Y as C,$ as w}from"./index-2b50ecca.js";/* empty css                 *//* empty css                   */const q=h("div",{class:"flex items-center"},[h("span",{class:"mr-1 text-red-600"},"*"),g("充值模板配置 ")],-1),F={class:"flex flex-col"},U={class:"flex items-center"},S=h("div",{style:{width:"80px","text-align":"end"},class:"mb-3 mr-2"},"首充模板:",-1),N={class:"flex items-center"},J=h("div",{style:{width:"80px","text-align":"end"},class:"mr-2"},"非首充模板:",-1),O={class:"flex justify-end"},Y=r({__name:"create",props:{primary:String|Number},emits:["close"],setup(r,{emit:Y}){const $=r,A=t(),B=s(!1),M=s(),Q=s([]),T=s([]),W=s([]),X=s({});$.primary&&(X.value=JSON.parse(JSON.stringify($.primary)),$.primary);const Z=(e,a)=>{switch(a){case"firstCharge":D("firstCharge",{name:e});break;case"notFirstCharge":D("notFirstCharge",{name:e})}},z=()=>{A.push({path:"/chargeManage/charge"})},D=(e,a)=>{switch(e){case"firstCharge":l({limit:999,type:1,...a}).then((e=>{Q.value=e.data}));break;case"notFirstCharge":l({limit:999,type:2,...a}).then((e=>{T.value=e.data}))}};return i((()=>{var a;D("firstCharge"),D("notFirstCharge"),e({video_id:$.primary.video_id,limit:999,...a}).then((e=>{W.value=e.data}))})),(e,l)=>{const r=y,t=x,s=j,i=V,A=k,D=C,E=w;return m((d(),n(D,{model:o(X),"label-width":"120px",ref_key:"form",ref:M,class:"pr-4"},{default:u((()=>[p(t,{label:"推广名称",prop:"name",rules:[{required:!1,message:"推广名称必须填写"}]},{default:u((()=>[p(r,{disabled:"",modelValue:$.primary.name,"onUpdate:modelValue":l[0]||(l[0]=e=>$.primary.name=e),clearable:""},null,8,["modelValue"])])),_:1}),p(t,{label:"入口章节",prop:"series_sequence",rules:[{required:!0,message:"入口章节必须填写",trigger:"change"}]},{default:u((()=>[p(i,{modelValue:o(X).series_sequence,"onUpdate:modelValue":l[1]||(l[1]=e=>o(X).series_sequence=e),filterable:"",clearable:"",placeholder:"选择入口章节"},{default:u((()=>[(d(!0),c(_,null,f(o(W),((e,a)=>(d(),n(s,{key:a,label:e.series_name,value:e.series_sequence},null,8,["label","value"])))),128))])),_:1},8,["modelValue"])])),_:1}),p(t,{label:"充值模板配置"},{label:u((()=>[q])),default:u((()=>[h("div",{class:"items-center w-full withdraw-popup-warn"},[h("div",null,[g("如果没有目标充值模板，请前往"),h("span",{class:"text-lg font-bold text-blue-400 cursor-pointer",onClick:z},"充值管理"),g("进行添加 ")])]),h("div",F,[h("div",U,[S,p(i,{modelValue:o(X).first_charge_template_id,"onUpdate:modelValue":l[2]||(l[2]=e=>o(X).first_charge_template_id=e),filterable:"",remote:"",clearable:"","remote-method":e=>{Z(e,"firstCharge")},placeholder:"请选择首充模板"},{default:u((()=>[(d(!0),c(_,null,f(o(Q),((e,a)=>(d(),n(s,{key:a,label:e.name,value:e.id},null,8,["label","value"])))),128))])),_:1},8,["modelValue","remote-method"])]),h("div",N,[J,p(i,{modelValue:o(X).not_first_charge_template_id,"onUpdate:modelValue":l[3]||(l[3]=e=>o(X).not_first_charge_template_id=e),filterable:"",remote:"",clearable:"","remote-method":e=>{Z(e,"notFirstCharge")},placeholder:"请选择非首充模板"},{default:u((()=>[(d(!0),c(_,null,f(o(T),((e,a)=>(d(),n(s,{key:a,label:e.name,value:e.id},null,8,["label","value"])))),128))])),_:1},8,["modelValue","remote-method"])])])])),_:1}),p(t,{label:"备注",prop:"name",rules:[{required:!1,message:"备注必须填写"}]},{default:u((()=>[p(r,{modelValue:o(X).remark,"onUpdate:modelValue":l[4]||(l[4]=e=>o(X).remark=e),clearable:""},null,8,["modelValue"])])),_:1}),h("div",O,[p(A,{type:"primary",onClick:l[5]||(l[5]=e=>{return l=o(M),X.value.first_charge_template_id?X.value.not_first_charge_template_id?(B.value=!0,void(l&&l.validate((e=>{if(e){const e={id:X.value.id,series_sequence:X.value.series_sequence,remark:X.value.remark,first_charge_template_id:X.value.first_charge_template_id,not_first_charge_template_id:X.value.not_first_charge_template_id};a(e).then((e=>{b.success(e.message),Y("close"),B.value=!1})).catch((e=>{B.value=!1}))}else B.value=!1})).then((()=>{})))):b.error("请选择非首充模板"):b.error("请选择首充模板");var l})},{default:u((()=>[g(v(e.$t("system.confirm")),1)])),_:1})])])),_:1},8,["model"])),[[E,o(B)]])}}});export{Y as _};
