"use strict";(self.webpackChunkdami=self.webpackChunkdami||[]).push([[7914],{72824:(e,t,a)=>{a.d(t,{Z:()=>u});var n=a(66252);const o={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M696 480H328c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h368c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8z"}},{tag:"path",attrs:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z"}}]},name:"minus-circle",theme:"outlined"};var l=a(51349);function s(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?Object(arguments[t]):{},n=Object.keys(a);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(a).filter((function(e){return Object.getOwnPropertyDescriptor(a,e).enumerable})))),n.forEach((function(t){r(e,t,a[t])}))}return e}function r(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}var c=function(e,t){var a=s({},e,t.attrs);return(0,n.Wm)(l.Z,s({},a,{icon:o}),null)};c.displayName="MinusCircleOutlined",c.inheritAttrs=!1;const u=c},8984:(e,t,a)=>{a.r(t),a.d(t,{default:()=>p});var n=a(66252),o=a(2262),l=a(7043),s=a(8492),r=a(61446),c=a(96486),u=a(22201),i=a(93666),d=a(98280);const v={key:0,class:"edit-online-message"},p={__name:"EditOnlineMessage",setup(e){const t=(0,u.tv)(),{t:a}=(0,l.QT)(),p=(0,o.iH)(!1),m=(0,o.iH)({}),h=(0,o.iH)([1]),g=(0,o.iH)(""),f=(0,o.iH)(""),b=(0,o.iH)(""),y={SELECT_METHOD:a("dashboard.errorTips.selectMessageMethod"),NO_CONTENT:a("dashboard.errorTips.noContent"),NO_IMAGE:a("dashboard.errorTips.noImage")},S=[{key:1,label:a("dashboard.form.sendText"),colSpan:7},{key:2,label:a("dashboard.form.sendImage"),colSpan:7},{key:3,label:a("dashboard.form.sendTextAndImage"),colSpan:10}],O=(0,n.Fl)((()=>h.value.some((e=>1===e||3===e)))),T=(0,n.Fl)((()=>h.value.some((e=>2===e||3===e))));const k=(0,c.debounce)((()=>{!async function(){try{if(function(){let e=!0,t="";return h.value.length<=0&&(t=y.SELECT_METHOD,e=!1),T.value&&(!b.value||b.value.length<=0)&&(t=y.NO_IMAGE,e=!1),O.value&&g.value.length<=0&&(t=y.NO_CONTENT,e=!1),!1===e&&r.ZP.warning({key:"validateErrorMessage",content:t}),e}()){const e=h.value[0],n={type:{1:3,2:4,3:5}[e]};n.content=g.value;const o=(0,i.WI)();if(200===o.code&&o.data){const e={phone:"",areaCode:"",email:"",second:1,repeatDay:1,skipChat:1,isFixed:0,isPercent:0,freeSample:"",productId:f.value,imgName:b.value},l=o.data,s={...n,...e,...l};1e5===(await d.sT.onSaveScriptSetting(s)).code&&(r.ZP.success(a("dashboard.successTips.scriptSettingSave")),t.push("/"))}}}catch(e){console.error(e)}}()}),300);async function w(){try{p.value=!1;const e=(0,i.WI)();if(200===e.code&&e.data){const t=e.data,a=await d.sT.onGetScriptSetting({shopId:t?.shopId});1e5===a.code&&(m.value=a.data),function(){const e=m.value;(0,c.isEmpty)(e)||(5===e.type?h.value=[3]:4===e.type?h.value=[2]:h.value=[1],g.value=e.content,f.value=e.productId,b.value=e.imgName)}()}p.value=!0}catch(e){console.log(e),p.value=!0}}return(0,n.bv)((()=>{w()})),(e,t)=>p.value?((0,n.wg)(),(0,n.iD)("div",v,[(0,n.Wm)((0,o.SU)(s.Mt),{value:h.value,"onUpdate:value":t[0]||(t[0]=e=>h.value=e),title:(0,o.SU)(a)("dashboard.form.messageMethod"),options:S,"is-multiple":!1},null,8,["value","title"]),(0,o.SU)(O)?((0,n.wg)(),(0,n.j4)((0,o.SU)(s.P4),{key:0,content:g.value,"onUpdate:content":t[1]||(t[1]=e=>g.value=e),options:{rows:6,maxlength:2e3}},null,8,["content"])):(0,n.kq)("",!0),(0,o.SU)(T)?((0,n.wg)(),(0,n.j4)((0,o.SU)(s.yW),{key:1,path:b.value,"onUpdate:path":t[2]||(t[2]=e=>b.value=e),class:"mt-2"},null,8,["path"])):(0,n.kq)("",!0),(0,n.Wm)((0,o.SU)(s.e6),{onSave:(0,o.SU)(k)},null,8,["onSave"])])):(0,n.kq)("",!0)}}}}]);