SeckillActivityForm-e8bc9b1b.js 8.4 KB

1
  1. import{e as L,d as q,h as B,r as c,o as R,c as H,f as _,w as i,a as o,n as g,x as J,v as K,O as Q,F as W,as as $,aL as X,dC as Z,an as tt,C as at,aV as et,G as rt,I as lt,_ as ot,__tla as st}from"./index-297c97b3.js";import{_ as _t,__tla as ct}from"./Dialog-6d866407.js";import{_ as it,__tla as mt}from"./Form-b5a9a948.js";import nt,{__tla as ut}from"./SpuSelect-2d21e62d.js";import pt,{__tla as ft}from"./SpuAndSkuList-0e651ded.js";import{b as A,__tla as dt}from"./formatTime-43b819e0.js";import{g as ht,__tla as yt}from"./seckillConfig-532c6819.js";import{r as m,__tla as vt}from"./formRules-b4d34ddc.js";import{u as kt,__tla as bt}from"./useCrudSchemas-0ea96a7e.js";import{g as wt,c as gt,u as Pt,__tla as Ct}from"./seckillActivity-268ac8df.js";import{c as St,__tla as It}from"./spu-d00e1e27.js";import{g as Vt,__tla as Ft}from"./index-7d8d1352.js";import{u as Dt,__tla as xt}from"./useMessage-8a849e40.js";import{__tla as Yt}from"./el-virtual-list-12eeb9bf.js";import{__tla as Lt}from"./el-tree-select-4c70bd2d.js";import{__tla as Rt}from"./el-time-select-4e640a84.js";import{__tla as At}from"./InputPassword-24eb4972.js";import{__tla as Mt}from"./InputPassword.vue_vue_type_style_index_0_scoped_3f07eb1d_lang-886471fb.js";import{__tla as Tt}from"./Editor-5eae0fc5.js";import{__tla as Ut}from"./SPuUploadImg.vue_vue_type_style_index_0_scoped_ba706063_lang-ae102e4a.js";import{__tla as Et}from"./index-ef616a81.js";import{__tla as zt}from"./el-image-viewer-3c943bf5.js";import{__tla as Nt}from"./UploadImg-76828272.js";import{__tla as Gt}from"./UploadImgs-2eb5bd0c.js";import{__tla as Ot}from"./UploadImgs.vue_vue_type_style_index_0_scoped_9d666400_lang-22dc46a8.js";import{__tla as jt}from"./UploadFile-a8905d67.js";import{__tla as qt}from"./UploadFile.vue_vue_type_style_index_0_scoped_436eca1b_lang-f12c4225.js";import{__tla as Bt}from"./fixed-size-list-2259ab06.js";import{__tla as Ht}from"./ContentWrap-2a772ce5.js";import{__tla as Jt}from"./el-card-22a26825.js";import{__tla as Kt}from"./index-eead3ef4.js";import{__tla as Qt}from"./index-97931d72.js";import{__tla as Wt}from"./el-image-82bf40c6.js";import"./tree-0af4953a.js";import{__tla as $t}from"./category-d1509c57.js";import{__tla as Xt}from"./SkuList-8ab676f5.js";import{__tla as Zt}from"./dict-299f12fd.js";import{__tla as ta}from"./DictTag-c4e6f16f.js";import"./color-6e929987.js";let M,aa=Promise.all([(()=>{try{return st}catch{}})(),(()=>{try{return ct}catch{}})(),(()=>{try{return mt}catch{}})(),(()=>{try{return ut}catch{}})(),(()=>{try{return ft}catch{}})(),(()=>{try{return dt}catch{}})(),(()=>{try{return yt}catch{}})(),(()=>{try{return vt}catch{}})(),(()=>{try{return bt}catch{}})(),(()=>{try{return Ct}catch{}})(),(()=>{try{return It}catch{}})(),(()=>{try{return Ft}catch{}})(),(()=>{try{return xt}catch{}})(),(()=>{try{return Yt}catch{}})(),(()=>{try{return Lt}catch{}})(),(()=>{try{return Rt}catch{}})(),(()=>{try{return At}catch{}})(),(()=>{try{return Mt}catch{}})(),(()=>{try{return Tt}catch{}})(),(()=>{try{return Ut}catch{}})(),(()=>{try{return Et}catch{}})(),(()=>{try{return zt}catch{}})(),(()=>{try{return Nt}catch{}})(),(()=>{try{return Gt}catch{}})(),(()=>{try{return Ot}catch{}})(),(()=>{try{return jt}catch{}})(),(()=>{try{return qt}catch{}})(),(()=>{try{return Bt}catch{}})(),(()=>{try{return Ht}catch{}})(),(()=>{try{return Jt}catch{}})(),(()=>{try{return Kt}catch{}})(),(()=>{try{return Qt}catch{}})(),(()=>{try{return Wt}catch{}})(),(()=>{try{return $t}catch{}})(),(()=>{try{return Xt}catch{}})(),(()=>{try{return Zt}catch{}})(),(()=>{try{return ta}catch{}})()]).then(async()=>{let P,C,S;P=L({spuId:[m],name:[m],startTime:[m],endTime:[m],sort:[m],configIds:[m],totalLimitCount:[m],singleLimitCount:[m],totalStock:[m]}),C=L([{label:"\u79D2\u6740\u6D3B\u52A8\u540D\u79F0",field:"name",isSearch:!0,form:{colProps:{span:24}},table:{width:120}},{label:"\u6D3B\u52A8\u5F00\u59CB\u65F6\u95F4",field:"startTime",formatter:A,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:A,isSearch:!0,search:{component:"DatePicker",componentProps:{valueFormat:"YYYY-MM-DD",type:"daterange"}},form:{component:"DatePicker",componentProps:{type:"date",valueFormat:"x"}},table:{width:120}},{label:"\u79D2\u6740\u65F6\u6BB5",field:"configIds",form:{component:"Select",componentProps:{multiple:!0,optionsAlias:{labelField:"name",valueField:"id"}},api:ht},table:{width:300}},{label:"\u603B\u9650\u8D2D\u6570\u91CF",field:"totalLimitCount",form:{component:"InputNumber",value:0},table:{width:120}},{label:"\u5355\u6B21\u9650\u591F\u6570\u91CF",field:"singleLimitCount",form:{component:"InputNumber",value:0},table:{width:120}},{label:"\u6392\u5E8F",field:"sort",form:{component:"InputNumber",value:0},table:{width:80}},{label:"\u79D2\u6740\u6D3B\u52A8\u5546\u54C1",field:"spuId",isTable:!0,isSearch:!1,form:{colProps:{span:24}},table:{width:300}},{label:"\u5907\u6CE8",field:"remark",isSearch:!1,form:{component:"Input",componentProps:{type:"textarea",rows:4},colProps:{span:24}},table:{width:300}}]),{allSchemas:S}=kt(C),M=ot(q({name:"PromotionSeckillActivityForm",__name:"SeckillActivityForm",emits:["success"],setup(ea,{expose:T,emit:U}){const{t:b}=B(),I=Dt(),f=c(!1),V=c(""),d=c(!1),F=c(""),n=c(),D=c(),x=c(),E=[{name:"productConfig.stock",rule:a=>a>=1,message:"\u5546\u54C1\u79D2\u6740\u5E93\u5B58\u5FC5\u987B\u5927\u4E8E\u7B49\u4E8E 1 \uFF01\uFF01\uFF01"},{name:"productConfig.seckillPrice",rule:a=>a>=.01,message:"\u5546\u54C1\u79D2\u6740\u4EF7\u683C\u5FC5\u987B\u5927\u4E8E\u7B49\u4E8E 0.01 \uFF01\uFF01\uFF01"}],y=c([]),w=c([]),z=(a,t)=>{n.value.setValues({spuId:a}),Y(a,t)},Y=async(a,t,l)=>{var v;const s=[],u=await St([a]);if(u.length==0)return;y.value=[];const r=u[0],h=t===void 0?r==null?void 0:r.skus:(v=r==null?void 0:r.skus)==null?void 0:v.filter(e=>t.includes(e.id));h==null||h.forEach(e=>{let p={skuId:e.id,stock:0,seckillPrice:0};if(l!==void 0){const k=l.find(j=>j.skuId===e.id);k&&(k.seckillPrice=$(k.seckillPrice)),p=k||p}e.productConfig=p}),r.skus=h,s.push({spuId:r.id,spuDetail:r,propertyList:Vt(r)}),y.value.push(r),w.value=s};T({open:async(a,t)=>{var l;if(f.value=!0,V.value=b("action."+a),F.value=a,await O(),t){d.value=!0;try{const s=await wt(t);await Y(s.spuId,(l=s.products)==null?void 0:l.map(u=>u.skuId),s.products),n.value.setValues(s)}finally{d.value=!1}}}});const N=U,G=async()=>{if(n&&await n.value.getElFormRef().validate()){d.value=!0;try{const a=X(x.value.getSkuConfigs("productConfig"));a.forEach(l=>{l.seckillPrice=Z(l.seckillPrice)});const t=n.value.formModel;t.products=a,F.value==="create"?(await gt(t),I.success(b("common.createSuccess"))):(await Pt(t),I.success(b("common.updateSuccess"))),f.value=!1,N("success")}finally{d.value=!1}}},O=async()=>{y.value=[],w.value=[],await tt(),n.value.getElFormRef().resetFields()};return(a,t)=>{const l=at,s=et,u=rt,r=it,h=_t,v=lt;return R(),H(W,null,[_(h,{modelValue:o(f),"onUpdate:modelValue":t[2]||(t[2]=e=>Q(f)?f.value=e:null),title:o(V),width:"65%"},{footer:i(()=>[_(l,{disabled:o(d),type:"primary",onClick:G},{default:i(()=>[g("\u786E \u5B9A")]),_:1},8,["disabled"]),_(l,{onClick:t[1]||(t[1]=e=>f.value=!1)},{default:i(()=>[g("\u53D6 \u6D88")]),_:1})]),default:i(()=>[J((R(),K(r,{ref_key:"formRef",ref:n,isCol:!0,rules:o(P),schema:o(S).formSchema},{spuId:i(()=>[_(l,{onClick:t[0]||(t[0]=e=>o(D).open())},{default:i(()=>[g("\u9009\u62E9\u5546\u54C1")]),_:1}),_(o(pt),{ref_key:"spuAndSkuListRef",ref:x,"rule-config":E,"spu-list":o(y),"spu-property-list-p":o(w)},{default:i(()=>[_(u,{align:"center",label:"\u79D2\u6740\u5E93\u5B58","min-width":"168"},{default:i(({row:e})=>[_(s,{modelValue:e.productConfig.stock,"onUpdate:modelValue":p=>e.productConfig.stock=p,min:0,class:"w-100%"},null,8,["modelValue","onUpdate:modelValue"])]),_:1}),_(u,{align:"center",label:"\u79D2\u6740\u4EF7\u683C(\u5143)","min-width":"168"},{default:i(({row:e})=>[_(s,{modelValue:e.productConfig.seckillPrice,"onUpdate:modelValue":p=>e.productConfig.seckillPrice=p,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,o(d)]])]),_:1},8,["modelValue","title"]),_(o(nt),{ref_key:"spuSelectRef",ref:D,isSelectSku:!0,onConfirm:z},null,512)],64)}}}),[["__file","D:/zx/mall-newfeifan-zx-admin/src/views/mall/promotion/seckill/activity/SeckillActivityForm.vue"]])});export{aa as __tla,M as default};