优惠券 PC管理端 项目

204.b384efc1.js 8.1KB

1
  1. "use strict";(self["webpackChunkcoupon"]=self["webpackChunkcoupon"]||[]).push([[204],{6798:function(e,a,t){t.d(a,{Yl:function(){return i},r1:function(){return c},uH:function(){return n}});const l=e=>{var a=parseFloat(e);if(isNaN(a))return!1;a=Math.round(100*e)/100;var t=a.toString(),l=t.indexOf(".");l<0&&(l=t.length,t+=".");while(t.length<=l+2)t+="0";return t},i=e=>{var a=e;a=.01*e,a+="";var t=a.indexOf(".")>-1?/(d{1,3})(?=(?:d{3})+.)/g:/(d{1,3})(?=(?:d{3})+$)/g;return a=a.replace(t,"$1"),a=l(a),a},n=e=>String(e).replace(/[^\d]/g,""),c=(e,a)=>{let t=new Date(new Date(e).getTime()+288e5),l=t.toJSON();return l=1===a?l.substring(0,10):l.substring(0,19).replace("T"," "),l}},7204:function(e,a,t){t.r(a),t.d(a,{default:function(){return O}});var l=t(212),i=(t(3163),t(8061)),n=(t(6905),t(5791)),c=(t(6809),t(9007),t(3396)),s=t(4870),o=t(7139),r=t(2710),d=(t(9910),t(9866)),u=(t(172),t(6629)),m=(t(7228),t(1423)),p=t(6573),g=t(6798);const b=e=>((0,c.dD)("data-v-73b64a6c"),e=e(),(0,c.Cn)(),e),f={class:"header"},v={class:"title"},_={class:"content"},I={class:"form-item"},w=b((()=>(0,c._)("div",{class:"item-label"},[(0,c._)("i",{class:"required"}),(0,c._)("span",{class:"label-text"},"淘宝联盟昵称")],-1))),y={class:"form-item"},h=b((()=>(0,c._)("div",{class:"item-label"},[(0,c._)("i",{class:"required"}),(0,c._)("span",{class:"label-text"},"淘宝账号ID")],-1))),k={class:"form-item"},N=b((()=>(0,c._)("div",{class:"item-label"},[(0,c._)("i",{class:"required"}),(0,c._)("span",{class:"label-text"},"媒体名称")],-1))),V={class:"form-item"},W=b((()=>(0,c._)("div",{class:"item-label"},[(0,c._)("i",{class:"required"}),(0,c._)("span",{class:"label-text"},"媒体ID")],-1))),D={class:"form-item"},x=b((()=>(0,c._)("div",{class:"item-label"},[(0,c._)("i",{class:"required"}),(0,c._)("span",{class:"label-text"},"应用ID")],-1))),z={class:"form-item"},C=b((()=>(0,c._)("div",{class:"item-label"},[(0,c._)("i",{class:"required"}),(0,c._)("span",{class:"label-text"},"应用密钥")],-1)));var U=(0,c.aZ)({__name:"accountDialog",props:{dialogVisible:{type:Boolean,default:()=>!1},accountInfo:{type:Object,default:()=>({})}},emits:["confirm","cancel"],setup(e,{emit:a}){const t=e,i=(0,c.Fl)((()=>!!t.accountInfo?.id)),n=(0,c.Fl)((()=>""+(i.value?"编辑账号":"添加账号"))),b=(0,s.iH)(!1),U=(0,s.qj)({tbNickname:"",accountId:"",siteName:"",siteId:"",appKey:"",secret:""});(0,c.YP)((()=>t.dialogVisible),(e=>{e&&A()}));const A=()=>{if(i.value){const{tbNickname:e,accountId:a,siteName:l,siteId:i,appKey:n,secret:c}=t.accountInfo;U.tbNickname=e??"",U.accountId=a??"",U.siteName=l??"",U.siteId=i??"",U.appKey=n??"",U.secret=""}else U.tbNickname="",U.accountId="",U.siteName="",U.siteId="",U.appKey="",U.secret=""},K=e=>{U.accountId=(0,g.uH)(e)},T=e=>{U.siteId=(0,g.uH)(e)},Z=()=>{a("cancel")},q=async()=>{try{await H(),await M(),a("confirm")}catch(e){}},H=()=>new Promise(((e,a)=>{const{tbNickname:t,accountId:l,siteName:i,siteId:n,appKey:c,secret:s}=U;""===t?(u.z8.warning("请添加淘宝联盟昵称"),a("校验未通过")):""===l?(u.z8.warning("请添加淘宝账号ID"),a("校验未通过")):""===i?(u.z8.warning("请添加媒体名称"),a("校验未通过")):""===n?(u.z8.warning("请添加媒体ID"),a("校验未通过")):""===c?(u.z8.warning("请添加应用ID"),a("校验未通过")):""===s?(u.z8.warning("请添加应用密钥"),a("校验未通过")):e("校验通过")})),M=async()=>{try{b.value=!0;let e=p.W.tbAccount_addTbAccount;const a={accountId:U.accountId,tbNickname:U.tbNickname,siteId:U.siteId,siteName:U.siteName,appKey:U.appKey,secret:U.secret};i.value&&(e=p.W.tbAccount_editTbAccount,a.id=t.accountInfo.id);const{code:l,data:n,msg:c}=await m.Z.post(e,a);return 0===l?(u.z8.success(c||"操作成功"),Promise.resolve()):(u.z8.error(c||"操作失败"),Promise.reject(c||"操作失败"))}catch(e){return Promise.reject(e)}finally{b.value=!1}};return(e,a)=>{const i=d.EZ,u=r.d0,m=l.t;return(0,c.wg)(),(0,c.iD)("div",null,[(0,c.Wm)(u,{"model-value":t.dialogVisible,"before-close":Z,"show-close":!0,width:"573px","close-on-click-modal":!1},{default:(0,c.w5)((()=>[(0,c._)("div",f,[(0,c._)("span",v,(0,o.zw)((0,s.SU)(n)),1)]),(0,c.wy)(((0,c.wg)(),(0,c.iD)("div",null,[(0,c._)("div",_,[(0,c._)("div",I,[w,(0,c.Wm)(i,{modelValue:U.tbNickname,"onUpdate:modelValue":a[0]||(a[0]=e=>U.tbNickname=e),modelModifiers:{trim:!0},placeholder:"请添加淘宝联盟昵称"},null,8,["modelValue"])]),(0,c._)("div",y,[h,(0,c.Wm)(i,{modelValue:U.accountId,"onUpdate:modelValue":a[1]||(a[1]=e=>U.accountId=e),modelModifiers:{trim:!0},placeholder:"请添加淘宝账号ID",onInput:K},null,8,["modelValue"])]),(0,c._)("div",k,[N,(0,c.Wm)(i,{modelValue:U.siteName,"onUpdate:modelValue":a[2]||(a[2]=e=>U.siteName=e),modelModifiers:{trim:!0},placeholder:"请添加媒体名称"},null,8,["modelValue"])]),(0,c._)("div",V,[W,(0,c.Wm)(i,{modelValue:U.siteId,"onUpdate:modelValue":a[3]||(a[3]=e=>U.siteId=e),modelModifiers:{trim:!0},placeholder:"请添加媒体ID",onInput:T},null,8,["modelValue"])]),(0,c._)("div",D,[x,(0,c.Wm)(i,{modelValue:U.appKey,"onUpdate:modelValue":a[4]||(a[4]=e=>U.appKey=e),modelModifiers:{trim:!0},placeholder:"请添加应用ID"},null,8,["modelValue"])]),(0,c._)("div",z,[C,(0,c.Wm)(i,{modelValue:U.secret,"onUpdate:modelValue":a[5]||(a[5]=e=>U.secret=e),modelModifiers:{trim:!0},placeholder:"请添加应用密钥"},null,8,["modelValue"])])]),(0,c._)("div",{class:"footer"},[(0,c._)("div",{class:"btn",onClick:Z},"取消"),(0,c._)("div",{class:"btn btn-confirm ml-14",onClick:q},"确定")])])),[[m,b.value]])])),_:1},8,["model-value"])])}}}),A=t(89);const K=(0,A.Z)(U,[["__scopeId","data-v-73b64a6c"]]);var T=K,Z=t(864),q=t(2655),H=(t(3970),t(3218));const M={class:"page-wrap"},S={class:"content-wrap"},P=(0,c.Uk)("编辑"),j=(0,c.Uk)("删除");var B=(0,c.aZ)({__name:"index",setup(e){const a=(0,c.f3)("handleReloadPage"),t=(0,s.qj)({list:[],totalNum:0,loading:!1,height:300}),r=()=>{t.height=document.documentElement.clientHeight-100},d=async()=>{try{t.loading=!0;const{code:e,data:a,msg:l}=await m.Z.get(p.W.tbAccount_listTbAccount);0===e&&Array.isArray(a)?t.list=a:(t.list=[],u.z8.error(l||"操作失败"))}catch(e){}finally{t.loading=!1}},g=(0,s.iH)(!1),b=(0,s.iH)({}),f=()=>{b.value={},g.value=!0},v=e=>{b.value={...e},g.value=!0},_=()=>{g.value=!1,a()},I=()=>{g.value=!1},w=async e=>{try{await q.T.confirm("确定删除当前账号吗","提示",{confirmButtonText:"确定",confirmButtonClass:"account-ElMessageBox-confirm-cls",cancelButtonText:"取消",type:"warning"}),t.loading=!0;const l=p.W.tbAccount_deleteTbAccount,i={id:e.id},{code:n,data:c,msg:s}=await m.Z.postQuery(l,i);0===n?u.z8.success(s||"操作成功"):u.z8.error(s||"操作失败"),a()}catch(l){}finally{t.loading=!1}},{getIsLogin:y}=(0,H.Z)();return(0,c.bv)((async()=>{try{await y(),d(),r()}catch(e){}})),(e,a)=>{const r=i.$Y,d=n.mi,u=i.eI,m=l.t;return(0,c.wy)(((0,c.wg)(),(0,c.iD)("div",M,[(0,c._)("div",{class:"header-wrap"},[(0,c._)("div",{class:"btn",onClick:f},"添加账号")]),(0,c._)("div",S,[(0,c.Wm)(u,{data:t.list,"max-height":t.height,"header-cell-style":(0,s.SU)(Z.gw),"cell-style":(0,s.SU)(Z.HE),"row-style":(0,s.SU)(Z.T)},{default:(0,c.w5)((()=>[(0,c.Wm)(r,{prop:"tbNickname",label:"淘宝联盟昵称",align:"center"}),(0,c.Wm)(r,{prop:"accountId",label:"淘宝账号ID",align:"center"}),(0,c.Wm)(r,{prop:"siteName",label:"媒体名称",align:"center"},{default:(0,c.w5)((({row:e})=>[(0,c._)("span",null,(0,o.zw)(e.siteName||"-"),1)])),_:1}),(0,c.Wm)(r,{prop:"siteId",label:"媒体ID",align:"center"}),(0,c.Wm)(r,{prop:"appKey",label:"应用ID",align:"center"}),(0,c.Wm)(r,{prop:"secret",label:"应用密钥",align:"center"}),(0,c.Wm)(r,{label:"操作",width:"120",fixed:"right",align:"center"},{default:(0,c.w5)((({row:e})=>[(0,c.Wm)(d,{link:"",type:"primary",onClick:a=>v(e)},{default:(0,c.w5)((()=>[P])),_:2},1032,["onClick"]),(0,c.Wm)(d,{link:"",type:"danger",onClick:a=>w(e)},{default:(0,c.w5)((()=>[j])),_:2},1032,["onClick"])])),_:1})])),_:1},8,["data","max-height","header-cell-style","cell-style","row-style"])]),(0,c.Wm)(T,{dialogVisible:g.value,accountInfo:b.value,onConfirm:_,onCancel:I},null,8,["dialogVisible","accountInfo"])])),[[m,t.loading]])}}});const E=(0,A.Z)(B,[["__scopeId","data-v-743553be"]]);var O=E}}]);