CombinationActivityForm-3d82fd76.js 7.9 KB

1
  1. import{e as V,d as K,h as q,r as _,o as Y,c as H,f as s,w as c,a as l,y as S,z as J,x as Q,l as W,F as X,bo as Z,aj as $,aR as L,bp as tt,G as at,bC as rt,I as et,K as ot,_ as lt,__tla as it}from"./index-f7cc944f.js";import{_ as _t,__tla as st}from"./Dialog-45f8d011.js";import{_ as ct,__tla as mt}from"./Form-4bae3836.js";import{g as nt,c as ut,u as pt,__tla as ft}from"./combinationActivity-28a611e8.js";import{b as M,__tla as dt}from"./formatTime-d04e6fef.js";import{r as m,__tla as ht}from"./formRules-74911b24.js";import{D as yt,__tla as bt}from"./dict-53c02d35.js";import{u as vt,__tla as gt}from"./useCrudSchemas-faf8d51d.js";import Pt,{__tla as St}from"./SpuSelect-e6a86b1a.js";import kt,{__tla as Ct}from"./SpuAndSkuList-737a2ed1.js";import{g as wt,__tla as It}from"./index-961747bd.js";import{e as Dt,__tla as Ft}from"./spu-30f96215.js";import{u as Tt,__tla as xt}from"./useMessage-05f5efb9.js";import{__tla as Rt}from"./el-virtual-list-307cb327.js";import{__tla as Vt}from"./el-tree-select-35f6c624.js";import{__tla as Yt}from"./el-time-select-5feb9680.js";import{__tla as Lt}from"./InputPassword-30f854ea.js";import{__tla as Mt}from"./Editor-4f6c76fb.js";import{__tla as Nt}from"./SPuUploadImg.vue_vue_type_style_index_0_scoped_ba706063_lang-0e9f1f59.js";import{__tla as zt}from"./index-3edc08b6.js";import{__tla as At}from"./el-image-viewer-fa28466e.js";import{__tla as Et}from"./UploadImg-e3ab29b0.js";import{__tla as Gt}from"./UploadImgs-af5d1113.js";import{__tla as Ut}from"./UploadImgs.vue_vue_type_style_index_0_scoped_9d666400_lang-dc318d54.js";import{__tla as Ot}from"./UploadFile-7132780c.js";import{__tla as jt}from"./UploadFile.vue_vue_type_style_index_0_scoped_436eca1b_lang-ab631b5d.js";import{__tla as Bt}from"./fixed-size-list-86714ffc.js";import"./tree-0af4953a.js";import{__tla as Kt}from"./DictTag-f6da0857.js";import"./color-6e929987.js";import{__tla as qt}from"./ContentWrap-245d9641.js";import{__tla as Ht}from"./el-card-ce8bdc39.js";import{__tla as Jt}from"./index-5ec60295.js";import{__tla as Qt}from"./index-21037cf1.js";import{__tla as Wt}from"./el-image-33443d81.js";import{__tla as Xt}from"./category-8121625e.js";import{__tla as Zt}from"./SkuList-49042dea.js";let N,$t=Promise.all([(()=>{try{return it}catch{}})(),(()=>{try{return st}catch{}})(),(()=>{try{return mt}catch{}})(),(()=>{try{return ft}catch{}})(),(()=>{try{return dt}catch{}})(),(()=>{try{return ht}catch{}})(),(()=>{try{return bt}catch{}})(),(()=>{try{return gt}catch{}})(),(()=>{try{return St}catch{}})(),(()=>{try{return Ct}catch{}})(),(()=>{try{return It}catch{}})(),(()=>{try{return Ft}catch{}})(),(()=>{try{return xt}catch{}})(),(()=>{try{return Rt}catch{}})(),(()=>{try{return Vt}catch{}})(),(()=>{try{return Yt}catch{}})(),(()=>{try{return Lt}catch{}})(),(()=>{try{return Mt}catch{}})(),(()=>{try{return Nt}catch{}})(),(()=>{try{return zt}catch{}})(),(()=>{try{return At}catch{}})(),(()=>{try{return Et}catch{}})(),(()=>{try{return Gt}catch{}})(),(()=>{try{return Ut}catch{}})(),(()=>{try{return Ot}catch{}})(),(()=>{try{return jt}catch{}})(),(()=>{try{return Bt}catch{}})(),(()=>{try{return Kt}catch{}})(),(()=>{try{return qt}catch{}})(),(()=>{try{return Ht}catch{}})(),(()=>{try{return Jt}catch{}})(),(()=>{try{return Qt}catch{}})(),(()=>{try{return Wt}catch{}})(),(()=>{try{return Xt}catch{}})(),(()=>{try{return Zt}catch{}})()]).then(async()=>{let k,C,w;k=V({name:[m],totalLimitCount:[m],singleLimitCount:[m],startTime:[m],endTime:[m],userSize:[m],limitDuration:[m],virtualGroup:[m]}),C=V([{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:M,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:M,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}=vt(C),N=lt(K({name:"PromotionCombinationActivityForm",__name:"CombinationActivityForm",emits:["success"],setup(ta,{expose:z,emit:A}){const{t:g}=q(),I=Tt(),u=_(!1),D=_(""),p=_(!1),F=_(""),n=_(),T=_(),x=_(),y=_([]),P=_([]),E=[{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)=>{n.value.setValues({spuId:r}),R(r,t)},R=async(r,t,e)=>{var b;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:(b=a==null?void 0:a.skus)==null?void 0:b.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 v=e.find(B=>B.skuId===o.id);v&&(v.combinationPrice=Z(v.combinationPrice)),h=v||h}o.productConfig=h}),a.skus=d,i.push({spuId:a.id,spuDetail:a,propertyList:wt(a)}),y.value.push(a),P.value=i};z({open:async(r,t)=>{var e;if(u.value=!0,D.value=g("action."+r),F.value=r,await U(),t){p.value=!0;try{const i=await nt(t);await R(i.spuId,(e=i.products)==null?void 0:e.map(f=>f.skuId),i.products),n.value.setValues(i)}finally{p.value=!1}}}});const U=async()=>{y.value=[],P.value=[],await $(),n.value.getElFormRef().resetFields()},O=A,j=async()=>{if(n&&await n.value.getElFormRef().validate()){p.value=!0;try{const r=L(x.value.getSkuConfigs("productConfig"));r.forEach(e=>{e.combinationPrice=tt(e.combinationPrice)});const t=L(n.value.formModel);t.products=r,F.value==="create"?(await ut(t),I.success(g("common.createSuccess"))):(await pt(t),I.success(g("common.updateSuccess"))),u.value=!1,O("success")}finally{p.value=!1}}};return(r,t)=>{const e=at,i=rt,f=et,a=ct,d=_t,b=ot;return Y(),H(X,null,[s(d,{modelValue:l(u),"onUpdate:modelValue":t[2]||(t[2]=o=>W(u)?u.value=o:null),title:l(D),width:"65%"},{footer:c(()=>[s(e,{disabled:l(p),type:"primary",onClick:j},{default:c(()=>[S("\u786E \u5B9A")]),_:1},8,["disabled"]),s(e,{onClick:t[1]||(t[1]=o=>u.value=!1)},{default:c(()=>[S("\u53D6 \u6D88")]),_:1})]),default:c(()=>[J((Y(),Q(a,{ref_key:"formRef",ref:n,"is-col":!0,rules:l(k),schema:l(w).formSchema,class:"mt-10px"},{spuId:c(()=>[s(e,{onClick:t[0]||(t[0]=o=>l(T).open())},{default:c(()=>[S("\u9009\u62E9\u5546\u54C1")]),_:1}),s(l(kt),{ref_key:"spuAndSkuListRef",ref:x,"rule-config":E,"spu-list":l(y),"spu-property-list-p":l(P)},{default:c(()=>[s(f,{align:"center",label:"\u62FC\u56E2\u4EF7\u683C(\u5143)","min-width":"168"},{default:c(({row:o})=>[s(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"])),[[b,l(p)]])]),_:1},8,["modelValue","title"]),s(l(Pt),{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,N as default};