SeckillActivityForm-05ff5c90.js 8.3 KB

1
  1. import{x as A,d as Z,P as j,r as c,o as L,c as q,f as _,A as i,a as o,D as w,k as B,C as G,a2 as H,F as O,aC as W,cT as K,dI as $,n as tt,J as at,bQ as et,X as rt,Z as lt,_ as ot,__tla as st}from"./index-54aa57d8.js";import{_ as _t,__tla as ct}from"./Dialog-7bb778a5.js";import{_ as it,__tla as mt}from"./Form-0974edc5.js";import nt,{__tla as ut}from"./SpuSelect-40d90390.js";import pt,{__tla as ft}from"./SpuAndSkuList-fbec723c.js";import{b as R,__tla as dt}from"./formatTime-e6197688.js";import{g as ht,__tla as yt}from"./seckillConfig-7f9914c5.js";import{r as m,__tla as vt}from"./formRules-de58d92d.js";import{u as kt,__tla as bt}from"./useCrudSchemas-648c24f2.js";import{g as gt,c as wt,u as Pt,__tla as Ct}from"./seckillActivity-a3181da0.js";import{h as St,__tla as It}from"./spu-b4744276.js";import{g as Ft,__tla as Vt}from"./index-e0572f5f.js";import{u as Dt,__tla as xt}from"./useMessage-f56cafbb.js";import{__tla as Yt}from"./el-virtual-list-2aa5bb0f.js";import{__tla as At}from"./el-tree-select-20b2a9f3.js";import{__tla as Lt}from"./el-time-select-12ab7196.js";import{__tla as Rt}from"./InputPassword-1510c64c.js";import{__tla as Tt}from"./InputPassword.vue_vue_type_style_index_0_scoped_3f07eb1d_lang-7c504881.js";import{__tla as Mt}from"./Editor-2839cd89.js";import{__tla as Ut}from"./SPuUploadImg.vue_vue_type_style_index_0_scoped_ba706063_lang-03e554d4.js";import{__tla as Et}from"./index-1a846221.js";import{__tla as Nt}from"./el-image-viewer-ec0edec4.js";import{__tla as zt}from"./UploadImg-46306ddf.js";import{__tla as Jt}from"./UploadImgs-1c3a9b0d.js";import{__tla as Qt}from"./UploadImgs.vue_vue_type_style_index_0_scoped_9d666400_lang-6e3f8f3f.js";import{__tla as Xt}from"./UploadFile-8f304498.js";import{__tla as Zt}from"./UploadFile.vue_vue_type_style_index_0_scoped_436eca1b_lang-ebe3d168.js";import{__tla as jt}from"./ContentWrap-260746ab.js";import{__tla as qt}from"./el-card-e7d6628c.js";import{__tla as Bt}from"./index-e6a7fd1e.js";import{__tla as Gt}from"./index-254a9b5e.js";import{__tla as Ht}from"./el-image-94dad5a7.js";import"./tree-0af4953a.js";import{__tla as Ot}from"./category-25a5e37a.js";import{__tla as Wt}from"./SkuList-6694cde5.js";import{__tla as Kt}from"./dict-573b3b04.js";import{__tla as $t}from"./DictTag-638f5ebc.js";import"./color-6e929987.js";let T,ta=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 Vt}catch{}})(),(()=>{try{return xt}catch{}})(),(()=>{try{return Yt}catch{}})(),(()=>{try{return At}catch{}})(),(()=>{try{return Lt}catch{}})(),(()=>{try{return Rt}catch{}})(),(()=>{try{return Tt}catch{}})(),(()=>{try{return Mt}catch{}})(),(()=>{try{return Ut}catch{}})(),(()=>{try{return Et}catch{}})(),(()=>{try{return Nt}catch{}})(),(()=>{try{return zt}catch{}})(),(()=>{try{return Jt}catch{}})(),(()=>{try{return Qt}catch{}})(),(()=>{try{return Xt}catch{}})(),(()=>{try{return Zt}catch{}})(),(()=>{try{return jt}catch{}})(),(()=>{try{return qt}catch{}})(),(()=>{try{return Bt}catch{}})(),(()=>{try{return Gt}catch{}})(),(()=>{try{return Ht}catch{}})(),(()=>{try{return Ot}catch{}})(),(()=>{try{return Wt}catch{}})(),(()=>{try{return Kt}catch{}})(),(()=>{try{return $t}catch{}})()]).then(async()=>{let P,C,S;P=A({spuId:[m],name:[m],startTime:[m],endTime:[m],sort:[m],configIds:[m],totalLimitCount:[m],singleLimitCount:[m],totalStock:[m]}),C=A([{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:R,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:R,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),T=ot(Z({name:"PromotionSeckillActivityForm",__name:"SeckillActivityForm",emits:["success"],setup(aa,{expose:M,emit:U}){const{t:b}=j(),I=Dt(),f=c(!1),F=c(""),d=c(!1),V=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([]),g=c([]),N=(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(X=>X.skuId===e.id);k&&(k.seckillPrice=W(k.seckillPrice)),p=k||p}e.productConfig=p}),r.skus=h,s.push({spuId:r.id,spuDetail:r,propertyList:Ft(r)}),y.value.push(r),g.value=s};M({open:async(a,t)=>{var l;if(f.value=!0,F.value=b("action."+a),V.value=a,await Q(),t){d.value=!0;try{const s=await gt(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 z=U,J=async()=>{if(n&&await n.value.getElFormRef().validate()){d.value=!0;try{const a=K(x.value.getSkuConfigs("productConfig"));a.forEach(l=>{l.seckillPrice=$(l.seckillPrice)});const t=n.value.formModel;t.products=a,V.value==="create"?(await wt(t),I.success(b("common.createSuccess"))):(await Pt(t),I.success(b("common.updateSuccess"))),f.value=!1,z("success")}finally{d.value=!1}}},Q=async()=>{y.value=[],g.value=[],await tt(),n.value.getElFormRef().resetFields()};return(a,t)=>{const l=at,s=et,u=rt,r=it,h=_t,v=lt;return L(),q(O,null,[_(h,{modelValue:o(f),"onUpdate:modelValue":t[2]||(t[2]=e=>H(f)?f.value=e:null),title:o(F),width:"65%"},{footer:i(()=>[_(l,{disabled:o(d),type:"primary",onClick:J},{default:i(()=>[w("\u786E \u5B9A")]),_:1},8,["disabled"]),_(l,{onClick:t[1]||(t[1]=e=>f.value=!1)},{default:i(()=>[w("\u53D6 \u6D88")]),_:1})]),default:i(()=>[B((L(),G(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(()=>[w("\u9009\u62E9\u5546\u54C1")]),_:1}),_(o(pt),{ref_key:"spuAndSkuListRef",ref:x,"rule-config":E,"spu-list":o(y),"spu-property-list-p":o(g)},{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:N},null,512)],64)}}}),[["__file","D:/zx/mall-newfeifan-zx-admin/src/views/mall/promotion/seckill/activity/SeckillActivityForm.vue"]])});export{ta as __tla,T as default};