import{d as ce,f as L,aq as M,r as o,o as d,j as P,aL as me,a as e,w as f,k as l,m as N,t as W,l as v,i as s,_ as ne,aM as pe,B as g,P as X,a4 as _,c as R,z as de,at as G,ar as b,as as F,au as w,aN as ue,W as ve,X as Pe,q as fe,ax as he,K as ye}from"./index-6d906b8a.js";import{_ as ke}from"./ContentWrap.vue_vue_type_script_setup_true_lang-3e2a4d47.js";import{_ as ge}from"./SPuUploadImg-f3405bee.js";import{g as be,a as Fe,c as we,u as _e}from"./spu-8c99daaf.js";import Be from"./InfoForm-db4e1b6a.js";import Se from"./DescriptionForm-0d18fbff.js";import De from"./OtherForm-c259e9f2.js";import Te from"./SkuForm-e6a6d317.js";import Ue from"./DeliveryForm-52eda26e.js";import Ce from"./Service-1a27d100.js";import{A as Ie}from"./AfterSale-03dd5f8a.js";import xe from"./Comment-0f855bc3.js";import Ve from"./Apply-e2b14f94.js";import{u as Re}from"./useMessage-cb0d0c75.js";import{_ as je}from"./_plugin-vue_export-helper-1b428a4d.js";import"./el-card-dcb0121c.js";import"./SPuUploadImg.vue_vue_type_style_index_0_scoped_5dfa4534_lang-b3a6b66a.js";import"./index-6b24d3ee.js";import"./el-image-viewer-3eb20b9c.js";import"./UploadImgs-7833db09.js";import"./UploadImgs.vue_vue_type_style_index_0_scoped_bad238b9_lang-1b8df76e.js";import"./tree-fd3a041e.js";import"./category-f41ddfc2.js";import"./brand-34f3822b.js";import"./formRules-da14bc95.js";import"./style.css_vue_type_style_index_0_src_true_lang-d62b46a5.js";import"./index-d8896af4.js";import"./SkuList.vue_vue_type_script_setup_true_lang-dac01c62.js";import"./el-image-9aeecfea.js";import"./UploadImg-6255f1e4.js";import"./UploadFile.vue_vue_type_style_index_0_scoped_a9e67aa2_lang-e3ef4000.js";import"./PcComponents.css_vue_type_style_index_0_src_5455114c_scoped_5455114c_lang-b15165a7.js";import"./ProductAttributes.vue_vue_type_script_setup_true_lang-691bede5.js";import"./el-text-7d7615f3.js";import"./property-96fc02ff.js";import"./ProductPropertyAddForm.vue_vue_type_script_setup_true_lang-17fca322.js";import"./Dialog-7d76582a.js";import"./MobileSkuList-f2432ba7.js";import"./index-0eb1526f.js";import"./dict-1d5b7a74.js";import"./constants-e43f22dd.js";import"./index-69b80eed.js";import"./index.vue_vue_type_script_setup_true_lang-7766ce4b.js";import"./index-06db4b5a.js";import"./index-64283c35.js";import"./formatTime-b48ce278.js";const ze={class:"my-header"},Ae={class:"my-header-left"},Ee={class:"my-header-right"},qe=["onClick"],$e={class:"left"},Ke={class:"right"},Le={key:0},Me={key:1},Ne={key:2},We={class:"dialog-footer"},Xe=je(ce({name:"ProductSpuForm",__name:"index",emits:["success"],setup(Ge,{expose:H,emit:J}){const O=L({value:0});M("spuTypeChange",O);const Q=L({value:!1});M("highPrecisionChange",Q);const{t:x}=de(),U=Re(),h=o(!1),n=o("info"),t=o(!1),j=o(),z=o(),A=o(),E=o(),Y=o(),p=o({name:"",categoryId:void 0,keyword:"",picUrl:"",producerArea:"",spuType:void 0,spuPayType:void 0,sliderPicUrls:[],introduction:"",deliveryTypes:[],deliveryTemplateId:void 0,brandId:void 0,specType:!1,subCommissionType:!1,highPrecision:!1,skus:[{price:0,marketPrice:0,costPrice:0,settlementPrice:0,barCode:"",picUrl:"",stock:0,weight:0,volume:0,promotionFee:0,mark:"",highPrecisionPrice:0,highPrecisionSettlementPrice:0,firstBrokeragePrice:0,secondBrokeragePrice:0}],description:"",sort:0,giveIntegral:0,virtualSalesCount:0}),Z=o({name:"",categoryId:void 0,keyword:"",picUrl:"",producerArea:"",spuType:void 0,spuPayType:void 0,sliderPicUrls:[],introduction:"",deliveryTypes:[],deliveryTemplateId:void 0,brandId:void 0,specType:!1,subCommissionType:!1,skus:[{price:0,marketPrice:0,costPrice:0,settlementPrice:0,barCode:"",picUrl:"",stock:0,weight:0,volume:0,promotionFee:0,mark:"",highPrecisionPrice:0,highPrecisionSettlementPrice:0,firstBrokeragePrice:0,secondBrokeragePrice:0}],description:"",sort:0,giveIntegral:0,virtualSalesCount:0}),B=o(!1),C=o(""),q=o(0),S=o(),ee=o(""),y=o(),V=o(""),re=o(0),D=o(!1);H({open:async(c,a,u,r)=>{q.value=r,y.value=a,re.value=u,B.value=!0,S.value=a.id,ee.value=a.picUrl,D.value=!1,await ae(),n.value="info",V.value=c,C.value=x("action."+c),c=="view"?C.value="\u67E5\u770B":c=="create"&&(p.value=G(Z.value)),V.value=="view"?t.value=!0:t.value=!1}});const ie=()=>{D.value=!D.value},ae=async()=>{var a;const c=S.value;if(c){h.value=!0;try{const u=await be(c);(a=u.skus)==null||a.forEach(r=>{t.value?(r.price=b(r.price),r.settlementPrice=b(r.settlementPrice),r.highPrecisionPrice=r.highPrecisionPrice/100,r.highPrecisionSettlementPrice=r.highPrecisionSettlementPrice/100,r.marketPrice=b(r.marketPrice),r.costPrice=b(r.costPrice),r.promotionFee=b(r.promotionFee),r.firstBrokeragePrice=b(r.firstBrokeragePrice),r.secondBrokeragePrice=b(r.secondBrokeragePrice)):(r.highPrecisionPrice=r.highPrecisionPrice/100,r.price=F(r.price),r.settlementPrice=F(r.settlementPrice),r.highPrecisionSettlementPrice=r.highPrecisionSettlementPrice/100,r.marketPrice=F(r.marketPrice),r.costPrice=F(r.costPrice),r.promotionFee=F(r.promotionFee),r.firstBrokeragePrice=F(r.firstBrokeragePrice),r.secondBrokeragePrice=F(r.secondBrokeragePrice))}),p.value=u}finally{h.value=!1}}},$=J,oe=async()=>{try{const c=y.value.status?"\u4E0B\u67B6":"\u4E0A\u67B6",a=y.value.status?0:1;await U.confirm(`\u786E\u8BA4\u8981${c}"${y.value.name}"\u5417\uFF1F`),await Fe({id:y.value.id,status:a}),U.success(c+"\u6210\u529F"),K(),$("success")}catch{}},te=async()=>{var c,a,u,r;h.value=!0;try{await((c=e(j))==null?void 0:c.validate()),await((a=e(z))==null?void 0:a.validate()),await((u=e(A))==null?void 0:u.validate()),await((r=e(E))==null?void 0:r.validate());const m=G(e(p.value));m.skus.forEach(i=>{i.name=m.name,i.price=w(i.price),i.marketPrice=w(i.marketPrice),i.promotionFee=w(i.promotionFee),i.costPrice=w(i.costPrice),i.settlementPrice=w(i.settlementPrice),i.highPrecisionPrice=i.highPrecisionPrice?(100*i.highPrecisionPrice).toFixed(6):0,i.highPrecisionSettlementPrice=i.highPrecisionSettlementPrice?(100*i.highPrecisionSettlementPrice).toFixed(6):0,i.firstBrokeragePrice=w(i.firstBrokeragePrice),i.secondBrokeragePrice=w(i.secondBrokeragePrice)});const T=[];m.sliderPicUrls.forEach(i=>{typeof i=="object"?T.push(i.url):T.push(i)}),m.sliderPicUrls=T;const I=m;S.value?(await _e(I),U.success(x("common.updateSuccess"))):(await we(I),U.success(x("common.createSuccess"))),K(),$("success")}finally{h.value=!1}},K=()=>{B.value=!1};return(c,a)=>{const u=ue,r=ge,m=ve,T=Pe,I=ke,i=fe,se=he,le=ye;return d(),P(se,{modelValue:e(B),"onUpdate:modelValue":a[2]||(a[2]=k=>X(B)?B.value=k:null),title:e(C),"close-on-click-modal":!1,fullscreen:e(D),"show-close":!1,width:"70%",draggable:"",class:"dialog"},me({header:f(({close:k})=>[l("div",ze,[l("div",Ae,W(e(C)),1),l("div",Ee,[l("span",{onClick:ie},[s(e(ne),{icon:e(D)?"zmdi:fullscreen-exit":"zmdi:fullscreen"},null,8,["icon"])]),l("span",{onClick:k},[s(u,null,{default:f(()=>[s(e(pe))]),_:1})],8,qe)])])]),default:f(()=>[g((d(),P(I,{style:{"max-height":"560px","min-height":"560px","overflow-y":"auto","border-bottom":"none"}},{default:f(()=>[l("div",$e,[s(r,{modelValue:e(p).picUrl,"onUpdate:modelValue":a[0]||(a[0]=k=>e(p).picUrl=k),disabled:e(t),fileSize:.3},null,8,["modelValue","disabled"]),s(T,{modelValue:e(n),"onUpdate:modelValue":a[1]||(a[1]=k=>X(n)?n.value=k:null),"tab-position":"left",class:"child-tabs"},{default:f(()=>[s(m,{label:"\u57FA\u672C\u4FE1\u606F",name:"info"}),s(m,{label:"\u4EF7\u683C/\u89C4\u683C/\u578B\u53F7",name:"sku"}),s(m,{label:"\u8BE6\u60C5",name:"description"}),e(t)?(d(),P(m,{key:0,label:"\u8BC4\u4EF7",name:"comment"})):v("",!0),e(t)?(d(),P(m,{key:1,label:"\u5BA2\u670D",name:"service"})):v("",!0),e(t)?(d(),P(m,{key:2,label:"\u552E\u540E",name:"aftersale"})):v("",!0),s(m,{label:"\u7269\u6D41\u8BBE\u7F6E",name:"delivery"}),e(t)?(d(),P(m,{key:3,label:"\u7533\u8BF7\u8BB0\u5F55",name:"apply"})):v("",!0)]),_:1},8,["modelValue"])]),l("div",Ke,[g(l("div",null,[s(Be,{ref_key:"infoRef",ref:j,"is-detail":e(t),propFormData:e(p)},null,8,["is-detail","propFormData"])],512),[[_,e(n)=="info"]]),g(l("div",null,[s(Te,{ref_key:"skuRef",ref:z,"is-detail":e(t),propFormData:e(p)},null,8,["is-detail","propFormData"])],512),[[_,e(n)=="sku"]]),g(l("div",null,[s(Ue,{ref_key:"deliveryRef",ref:A,"is-detail":e(t),propFormData:e(p)},null,8,["is-detail","propFormData"])],512),[[_,e(n)=="delivery"]]),g(l("div",null,[s(Se,{ref_key:"descriptionRef",ref:E,"is-detail":e(t),propFormData:e(p)},null,8,["is-detail","propFormData"])],512),[[_,e(n)=="description"]]),g(l("div",null,[s(De,{ref_key:"otherRef",ref:Y,"is-detail":e(t),propFormData:e(p)},null,8,["is-detail","propFormData"])],512),[[_,e(n)=="other"]]),e(n)=="comment"?(d(),R("div",Le,[s(xe,{"is-detail":e(t),propFormData:e(p)},null,8,["is-detail","propFormData"])])):v("",!0),g(l("div",null,[s(Ce,{"is-detail":e(t),propFormData:e(p)},null,8,["is-detail","propFormData"])],512),[[_,e(n)=="service"]]),e(n)=="aftersale"?(d(),R("div",Me,[s(Ie,{productId:e(S),openSource:"Spu"},null,8,["productId"])])):v("",!0),e(n)=="apply"?(d(),R("div",Ne,[s(Ve,{productId:e(S),propFormData:e(p)},null,8,["productId","propFormData"])])):v("",!0)]),a[3]||(a[3]=l("div",{style:{clear:"both"}},null,-1))]),_:1})),[[le,e(h)]])]),_:2},[e(t)?void 0:{name:"footer",fn:f(()=>[l("div",We,[e(t)||e(V)=="create"||e(q)==4||e(y).status==-1?v("",!0):(d(),P(i,{key:0,loading:e(h),type:"primary",onClick:oe},{default:f(()=>[N(W(e(y).status==0?"\u4E0A\u67B6":"\u4E0B\u67B6"),1)]),_:1},8,["loading"])),e(t)?v("",!0):(d(),P(i,{key:1,loading:e(h),type:"primary",onClick:te},{default:f(()=>a[4]||(a[4]=[N(" \u4FDD\u5B58 ")])),_:1},8,["loading"]))])]),key:"0"}]),1032,["modelValue","title","fullscreen"])}}}),[["__scopeId","data-v-4bbbab6a"]]);export{Xe as default};