index.177da998.js 8.6 KB

1
  1. import{_ as M}from"./page-search.vue_vue_type_script_setup_true_lang.e284bf07.js";import{u as q}from"./use-page-search.da34a19a.js";import{aJ as d,aK as R,bu as I,b as O,p as h,k as $,o as N,c as S,j as o,f as r,A as c,aM as V,a as P,l as j,F as L,aN as f,b4 as U}from"./index.4d3e3847.js";import{r as T,t as W}from"./column-helper.adef10ea.js";import{u as H,c as J,_ as K,t as X}from"./use-page-modal.6d6e7705.js";import{P as z}from"./page-content.1fdb6363.js";import"./basic-form.vue_vue_type_style_index_0_scoped_d6f0d2ed_lang.3165143d.js";import{_ as G,a as Q}from"./Card.vue_vue_type_script_setup_true_lang.d0a041b7.js";import{B as Z}from"./basic-form.114da3ff.js";import{u as ee}from"./useAsync.24db85a6.js";import"./hooks.428ba1c3.js";import"./useNav.afbe69e0.js";import"./validate.93ab4ac7.js";import"./index.a5d44002.js";import"./responseHandle.db1518c7.js";import"./xlsx.ed122d16.js";import"./remoteSelect.9c029262.js";import"./image.7849d972.js";const ue={formItems:[{field:"title",type:"input",placeholder:"\u4F01\u4E1A\u540D\u79F0"},{field:"company_title",type:"input",placeholder:"\u4F01\u4E1A\u540D\u79F0"},{field:"card_title",type:"input",placeholder:"\u5361\u7C7B\u578B\u540D\u79F0"}]},C=ue,{VITE_PROXY_DOMAIN_REAL:s}=R();async function te(u={}){return d.request("post",`${s}admin/serviceAdd`,{data:u})}async function re(u={}){return d.request("post",`${s}admin/serviceList`,{data:u})}async function ae(u={}){return d.request("post",`${s}admin/serviceRead`,{data:u})}async function ie(u={}){return d.request("post",`${s}admin/serviceEdit`,{data:u})}async function ne(u={}){return d.request("post",`${s}admin/serviceStatus`,{data:u})}async function oe(u={}){return d.request("post",`${s}admin/serviceDelete`,{data:u})}const le=[{type:"selection",width:55,hide:({checkList:u})=>!u.includes("\u52FE\u9009\u5217")},{prop:"id",label:"ID",width:"90px"},{prop:"title",label:"\u670D\u52A1\u540D\u79F0",minWidth:"180px"},{prop:"status",label:"\u72B6\u6001",...T(I),width:"100px"},{prop:"company_title",label:"\u516C\u53F8\u540D\u79F0",minWidth:"150px"},{prop:"card_title",label:"\u5361\u7C7B\u578B",width:"120px"},{prop:"original_price",label:"\u539F\u4EF7",width:"110px"},{prop:"activity_price",label:"\u6D3B\u52A8\u4EF7",width:"110px"},{prop:"starttime",label:"\u6D3B\u52A8\u65F6\u95F4",...W(["starttime","endtime"],"~"),width:"200px"},{prop:"addtime",label:"\u521B\u5EFA\u65F6\u95F4",sortable:!0,width:"160px"},{label:"\u64CD\u4F5C",fixed:"right",width:160,slot:"operation"}],pe={title:"\u670D\u52A1\u7BA1\u7406",columns:le,apis:{httpList:re,httpAdd:te,httpUpdate:ie,httpStatus:ne,httpDelete:oe}},de=pe,se={title:"\u670D\u52A1",colLayout:{span:24},itemStyle:{},contact:"setService",labelWidth:"100px",width:"700px",formItems:[{field:"company_title",type:"input",label:"\u516C\u53F8",placeholder:"\u516C\u53F8"},{field:"card_title",type:"input",label:"\u5361\u7C7B\u578B",placeholder:"\u5361\u7C7B\u578B"},{field:"title",type:"input",label:"\u670D\u52A1\u540D\u79F0",placeholder:"\u670D\u52A1\u540D\u79F0"},{field:"original_price",type:"number",label:"\u539F\u4EF7",placeholder:"\u539F\u4EF7"},{field:"activity_price",type:"number",label:"\u6D3B\u52A8\u4EF7",placeholder:"\u6D3B\u52A8\u4EF7"},{field:"starttime",type:"date_picker",label:"\u6D3B\u52A8\u5F00\u59CB\u65E5\u671F",placeholder:"\u6D3B\u52A8\u5F00\u59CB\u65E5\u671F",span:24},{field:"endtime",type:"date_picker",label:"\u6D3B\u52A8\u7ED3\u675F\u65E5\u671F",placeholder:"\u6D3B\u52A8\u7ED3\u675F\u65E5\u671F",span:24},{field:"expiretime",type:"date_picker",label:"\u670D\u52A1\u5230\u671F\u65E5\u671F",placeholder:"\u670D\u52A1\u5230\u671F\u65E5\u671F",span:24},{field:"content",type:"textarea",label:"\u670D\u52A1\u4ECB\u7ECD",placeholder:"\u670D\u52A1\u4ECB\u7ECD",span:24},{field:"remark",type:"textarea",label:"\u5907\u6CE8",placeholder:"\u5907\u6CE8",span:24},{field:"addtime",type:"input",label:"\u521B\u5EFA\u65F6\u95F4",placeholder:"\u521B\u5EFA\u65F6\u95F4"}]},ce=se,_={formItems:[{label:"\u516C\u53F8",field:"company_id",placeholder:"\u516C\u53F8",span:24,slot:"company_id"},{label:"\u5361\u7C7B\u578B",field:"card_id",placeholder:"\u5361\u7C7B\u578B",span:24,slot:"card_id"},{label:"\u670D\u52A1\u540D\u79F0",field:"title",type:"input",placeholder:"\u670D\u52A1\u540D\u79F0",span:24},{label:"\u539F\u4EF7",field:"original_price",type:"number",placeholder:"\u539F\u4EF7",otherOptions:{precision:2,step:1,"controls-position":"right",min:0,max:99999999},span:12},{label:"\u6D3B\u52A8\u4EF7",field:"activity_price",type:"number",placeholder:"\u6D3B\u52A8\u4EF7",otherOptions:{precision:2,step:1,"controls-position":"right",min:0,max:99999999},span:12},{label:"\u6D3B\u52A8\u5F00\u59CB\u65E5\u671F",field:"starttime",type:"date_picker",otherOptions:{type:"date",format:"YYYY-MM-DD"},placeholder:"\u6D3B\u52A8\u5F00\u59CB\u65E5\u671F",span:12},{label:"\u6D3B\u52A8\u7ED3\u675F\u65E5\u671F",field:"endtime",type:"date_picker",otherOptions:{type:"date",format:"YYYY-MM-DD"},placeholder:"\u6D3B\u52A8\u7ED3\u675F\u65E5\u671F",span:12},{label:"\u670D\u52A1\u5230\u671F\u65E5\u671F",field:"expiretime",type:"date_picker",otherOptions:{type:"date",format:"YYYY-MM-DD"},placeholder:"\u670D\u52A1\u5230\u671F\u65E5\u671F",span:24},{label:"\u670D\u52A1\u4ECB\u7ECD",field:"content",type:"textarea",placeholder:"\u670D\u52A1\u4ECB\u7ECD",span:24},{label:"\u5907\u6CE8",field:"remark",type:"textarea",placeholder:"\u5907\u6CE8",span:24}]},me={company_id:{trigger:"change",required:!0,message:"\u8BF7\u9009\u62E9\u516C\u53F8"},card_id:{trigger:"change",required:!0,message:"\u8BF7\u9009\u62E9\u5361\u7C7B\u578B"},title:{trigger:"change",required:!0,message:"\u8BF7\u8F93\u5165\u670D\u52A1\u540D\u79F0"},original_price:{trigger:"change",required:!0,validator(u,e){return typeof e!="number"?new Error("\u8BF7\u8F93\u5165\u539F\u4EF7"):Number(e+"")<0?new Error("\u539F\u4EF7\u4E0D\u80FD\u4F4E\u4E8E0"):!0}},activity_price:{trigger:"change",required:!0,validator(u,e){return typeof e!="number"?new Error("\u8BF7\u8F93\u5165\u6D3B\u52A8\u4EF7"):Number(e+"")<0?new Error("\u539F\u4EF7\u4E0D\u80FD\u4F4E\u4E8E0"):!0}},starttime:{trigger:"change",required:!0,validator(u,e){return(e!=null?e:"")===""?new Error("\u8BF7\u9009\u62E9\u6D3B\u52A8\u5F00\u59CB\u65E5\u671F"):!0}},endtime:{trigger:"change",required:!0,validator(u,e){return(e!=null?e:"")===""?new Error("\u8BF7\u9009\u62E9\u6D3B\u52A8\u7ED3\u675F\u65E5\u671F"):!0}},expiretime:{trigger:"change",required:!0,validator(u,e){return(e!=null?e:"")===""?new Error("\u8BF7\u9009\u62E9\u670D\u52A1\u5230\u671F\u65E5\u671F"):!0}},content:{trigger:"change",required:!0,validator(u,e){return(e!=null?e:"")===""?new Error("\u8BF7\u8F93\u5165\u670D\u52A1\u4ECB\u7ECD"):!0}}},fe={class:"w-full flex justify-end"},Re=O({__name:"index",setup(u){const e=ee(),{pageContentRef:i,handleResetClick:g,handleSearchClick:y}=q(void 0,void 0,C),{pageModalRef:b,handleUpdateData:A,handleCreateData:x,handlePreviewData:w,handleConfrim:F,defaultInfo:k}=H({pageContentRef:i}),{formItems:D}=_,E=h(null),n=h(J(D));function v(){E.value.validate(m=>{if(!m)return;const t=r(n),{starttime:l,endtime:a,expiretime:p}=t;if(t.starttime=l?f(l).format("YYYY-MM-DD"):"",t.endtime=a?f(a).format("YYYY-MM-DD"):"",t.expiretime=p?f(p).format("YYYY-MM-DD"):"",new Date(t.starttime).valueOf()>=new Date(t.endtime).valueOf()){U.warning("\u6D3B\u52A8\u5F00\u59CB\u65E5\u671F\u4E0D\u80FD\u5927\u4E8E\u6D3B\u52A8\u7ED3\u675F\u65E5\u671F\uFF01");return}F("create",t)})}async function B(m,t){const{id:l}=m,{code:a,data:p,message:Y}=await ae({id:l});e({code:a,message:Y,handler:()=>{t==="preview"&&w(p),t==="update"&&(n.value=X(D,p,{}),A(p))}})}return(m,t)=>{const l=$("ElButton");return N(),S(L,null,[o(r(M),{"form-config":r(C),onSearchBtnClick:r(y),onResetBtnClick:r(g)},null,8,["form-config","onSearchBtnClick","onResetBtnClick"]),o(r(z),{ref_key:"pageContentRef",ref:i,"content-config":r(de),onCreateBtnClick:r(x),onPreviewBtnClick:t[0]||(t[0]=a=>B(a,"preview")),onUpdateBtnClick:t[1]||(t[1]=a=>B(a,"update"))},null,8,["content-config","onCreateBtnClick"]),o(r(K),{ref_key:"pageModalRef",ref:b,"modal-config":r(ce),"default-info":r(k),onConfirmBtnClick:r(F)},{default:c(()=>[o(r(Z),V({ref_key:"basicFormRef",ref:E},r(_),{"form-data":n.value,rules:r(me),disabled:!1,"label-width":"120px"}),{company_id:c(()=>[o(r(G),{modelValue:n.value.company_id,"onUpdate:modelValue":t[2]||(t[2]=a=>n.value.company_id=a),placeholder:"\u516C\u53F8"},null,8,["modelValue"])]),card_id:c(()=>[o(r(Q),{modelValue:n.value.card_id,"onUpdate:modelValue":t[3]||(t[3]=a=>n.value.card_id=a),placeholder:"\u5361\u7C7B\u578B"},null,8,["modelValue"])]),footer:c(()=>[P("div",fe,[o(l,{type:"primary",onClick:v},{default:c(()=>[j("\u4FDD\u5B58")]),_:1})])]),_:1},16,["form-data","rules"])]),_:1},8,["modal-config","default-info","onConfirmBtnClick"])],64)}}});export{Re as default};