import{f as F,E as S}from"./base-a9e1396c.js";import{a as A,E as N}from"./el-form-item-f65c5879.js";import{E as L}from"./el-button-4f2e1711.js";import{E as D}from"./el-input-03ddc19a.js";import{E as H,a as M}from"./el-radio-1bab0451.js";import{E as R}from"./el-page-header-98396acf.js";import{a as z,E as G}from"./el-breadcrumb-item-594a11b8.js";import{a as J,s as K}from"./affiliate-441a0eff.js";/* empty css                   */import{_ as P}from"./_plugin-vue_export-helper-c27b6911.js";import{E as c}from"./index-bd490e64.js";import{m as T,s as $,v as f,y as l,w as e,o as _,z as n,J as E,a as j,x as a,K as q,I as h,B as O,C as Q,A as W,e as X}from"./normalize-8daa80b1.js";import"./config-provider-ecb8405d.js";import"./aria-fbed35f0.js";import"./request-95a85134.js";import"./axios-4a70c6fc.js";const b=u=>(O("data-v-280a3de6"),u=u(),Q(),u),Y={class:"main"},Z=b(()=>a("span",{class:"text-large font-600 mr-3"}," 推薦設置 ",-1)),ee=b(()=>a("hr",null,null,-1)),le={class:"list-div"},oe={class:"level-op-btn"},ae={class:"table table-borderd"},te=b(()=>a("tr",null,[a("th",null,"級別"),a("th",null,"現金分成(%)"),a("th",null,"積分分成(%)"),a("th",null,"操作")],-1)),ne={__name:"Info",setup(u){const o=T({on:"1",config:{separator_type:"1",expire:"24",expire_unit:"hour",level_money_all:"0",level_point_all:"0",level_register_all:"0",level_register_up:"0"},item:[]});$(async()=>{let s=await J();s.code===200?o.value=s.data:c.error("讀取推薦設定失敗")});const I=()=>{o.value.item.push({level_money:"0",level_point:"0"})},x=s=>{o.value.item.splice(s,1),c.success("刪除成功")},k=async()=>{(await K(o.value)).code===200?c.success("設定成功"):c.error("設定失敗")};return(s,r)=>{const V=z,B=G,C=R,m=H,y=M,d=N,p=D,g=L,U=S,w=A;return _(),f("div",Y,[l(C,{icon:null,title:" ",onBack:s.onBack},{breadcrumb:e(()=>[l(B,{separator:"/"},{default:e(()=>[l(V,null,{default:e(()=>[n(" 電商管理中心 ")]),_:1}),l(V,null,{default:e(()=>[n("推薦設置")]),_:1})]),_:1})]),content:e(()=>[Z]),_:1},8,["onBack"]),ee,l(w,{model:o.value,"label-width":"120px"},{default:e(()=>[l(d,{label:"是否開啟推薦"},{default:e(()=>[l(y,{modelValue:o.value.on,"onUpdate:modelValue":r[0]||(r[0]=t=>o.value.on=t)},{default:e(()=>[l(m,{label:"1"},{default:e(()=>[n("開啟")]),_:1}),l(m,{label:"0"},{default:e(()=>[n("關閉")]),_:1})]),_:1},8,["modelValue"])]),_:1}),o.value.on==="1"?(_(),f(E,{key:0},[l(d,{label:"分成方式"},{default:e(()=>[l(y,{modelValue:o.value.config.separator_type,"onUpdate:modelValue":r[1]||(r[1]=t=>o.value.config.separator_type=t)},{default:e(()=>[l(m,{label:"1"},{default:e(()=>[n("推薦註冊分成")]),_:1}),l(m,{label:"2"},{default:e(()=>[n("推薦訂單分成")]),_:1})]),_:1},8,["modelValue"])]),_:1}),l(d,{label:"推薦時效"},{default:e(()=>[l(p,{modelValue:o.value.config.expire,"onUpdate:modelValue":r[2]||(r[2]=t=>o.value.config.expire=t),placeholder:""},{append:e(()=>[n("Hour")]),_:1},8,["modelValue"])]),_:1}),l(d,{label:"推薦分成"},{default:e(()=>[l(p,{modelValue:o.value.config.level_money_all,"onUpdate:modelValue":r[3]||(r[3]=t=>o.value.config.level_money_all=t),placeholder:""},{append:e(()=>[n("%")]),_:1},8,["modelValue"])]),_:1}),o.value.config.separator_type==="1"?(_(),j(d,{key:0},{default:e(()=>[a("div",le,[a("div",oe,[l(g,{type:"primary",onClick:I},{default:e(()=>[n("增加層級")]),_:1})]),a("table",ae,[te,(_(!0),f(E,null,q(o.value.item,(t,v)=>(_(),f("tr",{key:v},[a("td",null,W(v+1),1),a("td",null,[l(p,{modelValue:t.level_money,"onUpdate:modelValue":i=>t.level_money=i,placeholder:""},{append:e(()=>[n("%")]),_:2},1032,["modelValue","onUpdate:modelValue"])]),a("td",null,[l(p,{modelValue:t.level_point,"onUpdate:modelValue":i=>t.level_point=i,placeholder:""},{append:e(()=>[n("%")]),_:2},1032,["modelValue","onUpdate:modelValue"])]),a("td",null,[l(U,{onClick:i=>x(v)},{default:e(()=>[l(X(F))]),_:2},1032,["onClick"])])]))),128))])])]),_:1})):h("",!0)],64)):h("",!0),l(d,null,{default:e(()=>[l(g,{type:"primary",onClick:k},{default:e(()=>[n("確定")]),_:1})]),_:1})]),_:1},8,["model"])])}}},Ie=P(ne,[["__scopeId","data-v-280a3de6"]]);export{Ie as default};
