create-688d9bb4.js 6.1 KB

1
  1. /* empty css *//* empty css *//* empty css */import{_ as e}from"./index-e9ebea94.js";/* empty css *//* empty css *//* empty css *//* empty css *//* empty css */import"./el-tooltip-4ed993c7.js";/* empty css *//* empty css *//* empty css */import{_ as a}from"./add.vue_vue_type_script_setup_true_lang-526da52d.js";/* empty css */import{d as l,ar as s,m as t,p as i,x as r,o as u,l as o,w as p,e as n,t as d,Z as m,a as c,b as v,az as f,c as y,F as _,y as b,G as j,ay as g,f as h,z as x,aA as w,a7 as k,a5 as C,a6 as V,aa as N,W as O,ab as q,as as z,a0 as R,Q as S,a2 as T,R as I,S as U,_ as A}from"./index-a465c001.js";import{_ as F}from"./pay-config-bg-9b53e063.js";import{c as G,a as Q,b as B,d as E}from"./index-f689f8ba.js";import Y from"./createGears-d346a13b.js";import"./http-aca42192.js";/* empty css *//* empty css *//* empty css */import"./index-06789939.js";/* empty css *//* empty css */const $=e=>(I("data-v-109bbbc0"),e=e(),U(),e),H={class:"card-header"},J={class:"flex justify-start w-full",shadow:"never"},M={class:"mr-6",style:{"min-width":"400px"}},P={class:"pt-5 pl-2"},W={class:"device-wrap"},X={class:"md-iphone-5 md-white-device"},Z={class:"md-body"},D=$((()=>n("div",{class:"md-buttons"},null,-1))),K=$((()=>n("div",{class:"md-front-camera"},null,-1))),L=$((()=>n("div",{class:"md-top-speaker"},null,-1))),ee={class:"md-screen"},ae=$((()=>n("img",{src:F,alt:""},null,-1))),le={class:"preview-list"},se={class:"tipss"},te=$((()=>n("button",{class:"md-home-button"},null,-1))),ie={class:"flex justify-start ml-9"},re=A(l({__name:"create",props:{primary:String|Number|Object,api:String},emits:["close"],setup(l,{emit:I}){const U=l,A=s("rolesIdentify"),F=t(!1);t(!0);const $=t(!1),re=t(),ue=t([]),oe=t(),pe=t({status:1,type:1}),ne=i((()=>re.value?"编辑充值档位":"添加充值档位")),de=t({FIRST_COIN:"首充",COIN:"普通充值",YEAR:"包年",QUARTER:"包季",MONTH:"包月"}),me=t([]),ce=()=>{F.value=!1},ve=(e,a)=>{if(a)re.value=a,re.value.index=e,F.value=!0;else{if(ue.value.length>=6)return w.alert("当前充值档位位置已满");re.value=null,F.value=!0}},fe=e=>{const a={...e,...e.typeObj,...e.sequenceObj};null!=e.index?ue.value[e.index]=a:ue.value.push(a)},ye=()=>{I("close")};return U.primary&&(U.primary,G(U.primary).then((e=>{pe.value=e.data.template_info,ue.value=e.data.template_item_list}))),r((()=>{Q().then((e=>{me.value=e.data}))})),(l,s)=>{const t=C,i=V,r=a,G=N,Q=O,me=q,_e=z,be=R,je=e,ge=S,he=T;return u(),o(ge,{shadow:"always",style:{overflow:"auto"},"body-style":{padding:"10px"}},{header:p((()=>[n("div",H,[n("span",null,d(U.primary?"编辑":"添加")+"首充模板",1)])])),default:p((()=>[m((u(),o(be,{model:pe.value,"label-width":"130px",ref_key:"form",ref:oe,class:"pr-6"},{default:p((()=>[c(i,{label:"模板名称",prop:"name",rules:[{required:!0,message:"模板名称必须填写"},{max:20,message:"至多输入20个字符",trigger:"blur"}]},{default:p((()=>[c(t,{class:"item",modelValue:pe.value.name,"onUpdate:modelValue":s[0]||(s[0]=e=>pe.value.name=e),clearable:""},null,8,["modelValue"])])),_:1}),c(i,{label:"充值档位",prop:"options",rules:[{required:!0,message:"请添加充值档位"}]},{default:p((()=>[n("div",J,[n("div",M,[n("div",P,[c(r,{onClick:s[1]||(s[1]=e=>ve(null,null))})]),m((u(),o(me,{data:ue.value,class:"w-full mt-3"},{default:p((()=>[c(G,{prop:"price",label:"价格"},{default:p((e=>[n("span",null,d(e.row.price)+"元",1)])),_:1}),c(G,{prop:"sequence_text",label:"位置"}),c(G,{prop:"type_name",label:"挡位类型"}),c(G,{prop:"default_text",label:"默认项"},{default:p((e=>[n("span",null,d(e.row.is_default?"默认项":"非默认项"),1)])),_:1}),c(G,{label:"操作",width:"200"},{default:p((e=>[c(Q,{link:"",type:"primary",size:"small",onClick:a=>ve(e.$index,e.row)},{default:p((()=>[v("编辑")])),_:2},1032,["onClick"]),c(Q,{link:"",type:"danger",size:"small",onClick:f((a=>{return l=e.$index,void w.confirm("确定要删除此条充值档位吗?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then((()=>{ue.value.splice(l,1)})).catch((()=>{}));var l}),["prevent"])},{default:p((()=>[v("删除")])),_:2},1032,["onClick"])])),_:1})])),_:1},8,["data"])),[[he,$.value]])]),n("div",W,[n("div",X,[n("div",Z,[D,K,L,n("div",ee,[ae,n("div",le,[(u(!0),y(_,null,b(ue.value,((e,a)=>(u(),y("div",{class:j(["pay-item",[1==e.is_default?"defalut":""]]),key:a},[n("p",null,d(e.price)+"元",1),m(n("p",null,"多送"+d(e.given)+"看币",513),[[g,e.given]]),n("div",se,d(de.value[e.type]),1)],2)))),128))])]),te])])])])])),_:1}),h(A).includes("optimizer")?x("",!0):(u(),o(i,{key:0,label:"是否为默认模板",prop:"status",rules:[{required:!0,message:"请设置是否为默认模板"}]},{default:p((()=>[c(_e,{modelValue:pe.value.status,"onUpdate:modelValue":s[2]||(s[2]=e=>pe.value.status=e),"active-value":1,"inactive-value":0},null,8,["modelValue"])])),_:1})),n("div",ie,[c(Q,{type:"primary",size:"default",onClick:ye},{default:p((()=>[v("取消")])),_:1}),c(Q,{type:"primary",onClick:s[3]||(s[3]=e=>{var a;(a=oe.value)&&(pe.value.options=ue.value.map((e=>({price:Number(e.price),type:e.type,given:Number(e.given),sequence:e.sequence,is_default:e.is_default}))),$.value=!0,a.validate((e=>{if(e){const e={name:pe.value.name,status:pe.value.status,options:JSON.stringify(pe.value.options),type:pe.value.type};U.primary?B(pe.value.id,e).then((e=>{$.value=!1,k.success(e.message),I("close")})).catch((e=>{$.value=!1})):E(e).then((e=>{$.value=!1,k.success(e.message),I("close")})).catch((e=>{$.value=!1}))}else $.value=!1})).then((()=>{})))})},{default:p((()=>[v("确认")])),_:1})])])),_:1},8,["model"])),[[he,$.value]]),c(je,{modelValue:F.value,"onUpdate:modelValue":s[4]||(s[4]=e=>F.value=e),title:h(ne),width:"40%","destroy-on-close":""},{default:p((()=>[c(Y,{onClose:ce,onSuccess:fe,data:ue.value,primary:re.value},null,8,["data","primary"])])),_:1},8,["modelValue","title"])])),_:1})}}}),[["__scopeId","data-v-109bbbc0"]]);export{re as default};