1 |
- import{x as M,d as J,P as Q,r as s,o as N,c as X,f as _,A as c,a as l,D as S,k as Z,C as j,a2 as K,F as W,aC as q,n as $,cT as R,dH as tt,J as at,bQ as rt,X as et,Z as ot,_ as lt,__tla as it}from"./index-286756b9.js";import{_ as st,__tla as _t}from"./Dialog-4c2de357.js";import{_ as ct,__tla as nt}from"./Form-75bb2af4.js";import{g as mt,c as ut,u as pt,__tla as ft}from"./combinationActivity-de33e1f5.js";import{b as Y,__tla as dt}from"./formatTime-83e416ef.js";import{r as n,__tla as ht}from"./formRules-b40a428a.js";import{D as yt,__tla as vt}from"./dict-82dca549.js";import{u as bt,__tla as Pt}from"./useCrudSchemas-2fd8541b.js";import gt,{__tla as St}from"./SpuSelect-ad7305a3.js";import kt,{__tla as Ct}from"./SpuAndSkuList-725f625f.js";import{g as wt,__tla as It}from"./index-99c3aa61.js";import{c as Dt,__tla as Ft}from"./spu-c6e01563.js";import{u as Tt,__tla as xt}from"./useMessage-084b1e70.js";import{__tla as Vt}from"./el-virtual-list-76825854.js";import{__tla as Mt}from"./el-tree-select-7a83bfa8.js";import{__tla as Nt}from"./el-time-select-7234e78f.js";import{__tla as Rt}from"./InputPassword-57bce014.js";import{__tla as Yt}from"./InputPassword.vue_vue_type_style_index_0_scoped_3f07eb1d_lang-058d317a.js";import{__tla as At}from"./Editor-514f76f8.js";import{__tla as Lt}from"./SPuUploadImg.vue_vue_type_style_index_0_scoped_ba706063_lang-6643271d.js";import{__tla as Et}from"./index-5a40c383.js";import{__tla as zt}from"./el-image-viewer-e0e5d3be.js";import{__tla as Gt}from"./UploadImg-d2713eac.js";import{__tla as Ut}from"./UploadImgs-b8116d2f.js";import{__tla as Ot}from"./UploadImgs.vue_vue_type_style_index_0_scoped_9d666400_lang-a65d467a.js";import{__tla as Bt}from"./UploadFile-e148930d.js";import{__tla as Ht}from"./UploadFile.vue_vue_type_style_index_0_scoped_436eca1b_lang-3e346ba0.js";import"./tree-0af4953a.js";import{__tla as Jt}from"./DictTag-f72b04ca.js";import"./color-6e929987.js";import{__tla as Qt}from"./ContentWrap-83998678.js";import{__tla as Xt}from"./el-card-d3d5a654.js";import{__tla as Zt}from"./index-ed6c67a8.js";import{__tla as jt}from"./index-fb47c94c.js";import{__tla as Kt}from"./el-image-73c105b7.js";import{__tla as Wt}from"./category-2d544841.js";import{__tla as qt}from"./SkuList-7139770f.js";let A,$t=Promise.all([(()=>{try{return it}catch{}})(),(()=>{try{return _t}catch{}})(),(()=>{try{return nt}catch{}})(),(()=>{try{return ft}catch{}})(),(()=>{try{return dt}catch{}})(),(()=>{try{return ht}catch{}})(),(()=>{try{return vt}catch{}})(),(()=>{try{return Pt}catch{}})(),(()=>{try{return St}catch{}})(),(()=>{try{return Ct}catch{}})(),(()=>{try{return It}catch{}})(),(()=>{try{return Ft}catch{}})(),(()=>{try{return xt}catch{}})(),(()=>{try{return Vt}catch{}})(),(()=>{try{return Mt}catch{}})(),(()=>{try{return Nt}catch{}})(),(()=>{try{return Rt}catch{}})(),(()=>{try{return Yt}catch{}})(),(()=>{try{return At}catch{}})(),(()=>{try{return Lt}catch{}})(),(()=>{try{return Et}catch{}})(),(()=>{try{return zt}catch{}})(),(()=>{try{return Gt}catch{}})(),(()=>{try{return Ut}catch{}})(),(()=>{try{return Ot}catch{}})(),(()=>{try{return Bt}catch{}})(),(()=>{try{return Ht}catch{}})(),(()=>{try{return Jt}catch{}})(),(()=>{try{return Qt}catch{}})(),(()=>{try{return Xt}catch{}})(),(()=>{try{return Zt}catch{}})(),(()=>{try{return jt}catch{}})(),(()=>{try{return Kt}catch{}})(),(()=>{try{return Wt}catch{}})(),(()=>{try{return qt}catch{}})()]).then(async()=>{let k,C,w;k=M({name:[n],totalLimitCount:[n],singleLimitCount:[n],startTime:[n],endTime:[n],userSize:[n],limitDuration:[n],virtualGroup:[n]}),C=M([{label:"\u62FC\u56E2\u540D\u79F0",field:"name",isSearch:!0,isTable:!1,form:{colProps:{span:24}}},{label:"\u6D3B\u52A8\u5F00\u59CB\u65F6\u95F4",field:"startTime",formatter:Y,isSearch:!0,search:{component:"DatePicker",componentProps:{valueFormat:"YYYY-MM-DD",type:"daterange"}},form:{component:"DatePicker",componentProps:{type:"date",valueFormat:"x"}},table:{width:120}},{label:"\u6D3B\u52A8\u7ED3\u675F\u65F6\u95F4",field:"endTime",formatter:Y,isSearch:!0,search:{component:"DatePicker",componentProps:{valueFormat:"YYYY-MM-DD",type:"daterange"}},form:{component:"DatePicker",componentProps:{type:"date",valueFormat:"x"}},table:{width:120}},{label:"\u53C2\u4E0E\u4EBA\u6570",field:"userSize",isSearch:!1,form:{component:"InputNumber",labelMessage:"\u53C2\u4E0E\u4EBA\u6570\u4E0D\u80FD\u5C11\u4E8E\u4E24\u4EBA",value:2}},{label:"\u9650\u5236\u65F6\u957F",field:"limitDuration",isSearch:!1,isTable:!1,form:{component:"InputNumber",labelMessage:"\u9650\u5236\u65F6\u957F(\u5C0F\u65F6)",componentProps:{placeholder:"\u8BF7\u8F93\u5165\u9650\u5236\u65F6\u957F(\u5C0F\u65F6)"}}},{label:"\u603B\u9650\u8D2D\u6570\u91CF",field:"totalLimitCount",isSearch:!1,isTable:!1,form:{component:"InputNumber",value:0}},{label:"\u5355\u6B21\u9650\u8D2D\u6570\u91CF",field:"singleLimitCount",isSearch:!1,isTable:!1,form:{component:"InputNumber",value:0}},{label:"\u865A\u62DF\u6210\u56E2",field:"virtualGroup",dictType:yt.INFRA_BOOLEAN_STRING,dictClass:"boolean",isSearch:!0,form:{component:"Radio",value:!1}},{label:"\u62FC\u56E2\u5546\u54C1",field:"spuId",isSearch:!1,form:{colProps:{span:24}}}]),{allSchemas:w}=bt(C),A=lt(J({name:"PromotionCombinationActivityForm",__name:"CombinationActivityForm",emits:["success"],setup(ta,{expose:L,emit:E}){const{t:P}=Q(),I=Tt(),u=s(!1),D=s(""),p=s(!1),F=s(""),m=s(),T=s(),x=s(),y=s([]),g=s([]),z=[{name:"productConfig.combinationPrice",rule:r=>r>=.01,message:"\u5546\u54C1\u62FC\u56E2\u4EF7\u683C\u4E0D\u80FD\u5C0F\u4E8E0.01 \uFF01\uFF01\uFF01"}],G=(r,t)=>{m.value.setValues({spuId:r}),V(r,t)},V=async(r,t,e)=>{var v;const i=[],f=await Dt([r]);if(f.length==0)return;y.value=[];const a=f[0],d=t===void 0?a==null?void 0:a.skus:(v=a==null?void 0:a.skus)==null?void 0:v.filter(o=>t.includes(o.id));d==null||d.forEach(o=>{let h={spuId:a.id,skuId:o.id,combinationPrice:0};if(e!==void 0){const b=e.find(H=>H.skuId===o.id);b&&(b.combinationPrice=q(b.combinationPrice)),h=b||h}o.productConfig=h}),a.skus=d,i.push({spuId:a.id,spuDetail:a,propertyList:wt(a)}),y.value.push(a),g.value=i};L({open:async(r,t)=>{var e;if(u.value=!0,D.value=P("action."+r),F.value=r,await U(),t){p.value=!0;try{const i=await mt(t);await V(i.spuId,(e=i.products)==null?void 0:e.map(f=>f.skuId),i.products),m.value.setValues(i)}finally{p.value=!1}}}});const U=async()=>{y.value=[],g.value=[],await $(),m.value.getElFormRef().resetFields()},O=E,B=async()=>{if(m&&await m.value.getElFormRef().validate()){p.value=!0;try{const r=R(x.value.getSkuConfigs("productConfig"));r.forEach(e=>{e.combinationPrice=tt(e.combinationPrice)});const t=R(m.value.formModel);t.products=r,F.value==="create"?(await ut(t),I.success(P("common.createSuccess"))):(await pt(t),I.success(P("common.updateSuccess"))),u.value=!1,O("success")}finally{p.value=!1}}};return(r,t)=>{const e=at,i=rt,f=et,a=ct,d=st,v=ot;return N(),X(W,null,[_(d,{modelValue:l(u),"onUpdate:modelValue":t[2]||(t[2]=o=>K(u)?u.value=o:null),title:l(D),width:"65%"},{footer:c(()=>[_(e,{disabled:l(p),type:"primary",onClick:B},{default:c(()=>[S("\u786E \u5B9A")]),_:1},8,["disabled"]),_(e,{onClick:t[1]||(t[1]=o=>u.value=!1)},{default:c(()=>[S("\u53D6 \u6D88")]),_:1})]),default:c(()=>[Z((N(),j(a,{ref_key:"formRef",ref:m,"is-col":!0,rules:l(k),schema:l(w).formSchema,class:"mt-10px"},{spuId:c(()=>[_(e,{onClick:t[0]||(t[0]=o=>l(T).open())},{default:c(()=>[S("\u9009\u62E9\u5546\u54C1")]),_:1}),_(l(kt),{ref_key:"spuAndSkuListRef",ref:x,"rule-config":z,"spu-list":l(y),"spu-property-list-p":l(g)},{default:c(()=>[_(f,{align:"center",label:"\u62FC\u56E2\u4EF7\u683C(\u5143)","min-width":"168"},{default:c(({row:o})=>[_(i,{modelValue:o.productConfig.combinationPrice,"onUpdate:modelValue":h=>o.productConfig.combinationPrice=h,min:0,precision:2,step:.1,class:"w-100%"},null,8,["modelValue","onUpdate:modelValue"])]),_:1})]),_:1},8,["spu-list","spu-property-list-p"])]),_:1},8,["rules","schema"])),[[v,l(p)]])]),_:1},8,["modelValue","title"]),_(l(gt),{ref_key:"spuSelectRef",ref:T,isSelectSku:!0,onConfirm:G},null,512)],64)}}}),[["__file","D:/zx/mall-newfeifan-zx-admin/src/views/mall/promotion/combination/activity/CombinationActivityForm.vue"]])});export{$t as __tla,A as default};
|