/* empty css             *//* empty css                   *//* empty css                     *//* empty css                  *//* empty css                 *//* empty css               *//* empty css                  *//* empty css                     *//* empty css                  */import{a as e}from"./index-f69c28c3.js";import{a}from"./index-078354a1.js";import{f as l}from"./index-b48852d6.js";import{d as r,V as t,m as s,x as i,Z 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,a7 as b,a5 as y,a6 as x,A as V,B as j,W as k,a0 as C,a2 as w}from"./index-41bf27b7.js";/* 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),J={class:"flex items-center"},N=h("div",{style:{width:"80px","text-align":"end"},class:"mr-2"},"非首充模板:",-1),O={class:"flex justify-end"},W=r({__name:"create",props:{primary:String|Number},emits:["close"],setup(r,{emit:W}){const X=r,A=t(),B=s(!1),M=s(),Q=s([]),R=s([]),T=s([]),Y=s({});X.primary&&(Y.value=JSON.parse(JSON.stringify(X.primary)),X.primary);const Z=(e,a)=>{switch(a){case"firstCharge":z("firstCharge",{name:e});break;case"notFirstCharge":z("notFirstCharge",{name:e})}},$=()=>{A.push({path:"/chargeManage/charge"})},z=(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=>{R.value=e.data}))}};return i((()=>{var a;z("firstCharge"),z("notFirstCharge"),e({video_id:X.primary.video_id,limit:999,...a}).then((e=>{T.value=e.data}))})),(e,l)=>{const r=y,t=x,s=V,i=j,A=k,z=C,D=w;return m((d(),n(z,{model:o(Y),"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:X.primary.name,"onUpdate:modelValue":l[0]||(l[0]=e=>X.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(Y).series_sequence,"onUpdate:modelValue":l[1]||(l[1]=e=>o(Y).series_sequence=e),filterable:"",clearable:"",placeholder:"选择入口章节"},{default:u((()=>[(d(!0),c(_,null,f(o(T),((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:$},"充值管理"),g("进行添加 ")])]),h("div",F,[h("div",U,[S,p(i,{modelValue:o(Y).first_charge_template_id,"onUpdate:modelValue":l[2]||(l[2]=e=>o(Y).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",J,[N,p(i,{modelValue:o(Y).not_first_charge_template_id,"onUpdate:modelValue":l[3]||(l[3]=e=>o(Y).not_first_charge_template_id=e),filterable:"",remote:"",clearable:"","remote-method":e=>{Z(e,"notFirstCharge")},placeholder:"请选择非首充模板"},{default:u((()=>[(d(!0),c(_,null,f(o(R),((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(Y).remark,"onUpdate:modelValue":l[4]||(l[4]=e=>o(Y).remark=e),clearable:""},null,8,["modelValue"])])),_:1}),h("div",O,[p(A,{type:"primary",onClick:l[5]||(l[5]=e=>{return l=o(M),Y.value.first_charge_template_id?Y.value.not_first_charge_template_id?(B.value=!0,void(l&&l.validate((e=>{if(e){const e={id:Y.value.id,series_sequence:Y.value.series_sequence,remark:Y.value.remark,first_charge_template_id:Y.value.first_charge_template_id,not_first_charge_template_id:Y.value.not_first_charge_template_id};a(e).then((e=>{b.success(e.message),W("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"])),[[D,o(B)]])}}});export{W as _};
