SeckillActivityForm-c520d675.js 8.5 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 w,x as J,v as K,O as Q,F as W,as as X,aL as Z,dC as $,an as tt,C as at,aT as et,G as rt,I as lt,_ as ot,__tla as st}from"./index-e1bb590d.js";import{_ as _t,__tla as ct}from"./Dialog-36839ea0.js";import{_ as it,__tla as mt}from"./Form-5e7ebe15.js";import nt,{__tla as ut}from"./SpuSelect-76f12270.js";import pt,{__tla as ft}from"./SpuAndSkuList-f050b0e5.js";import{b as T,__tla as dt}from"./formatTime-f6897acb.js";import{g as ht,__tla as yt}from"./seckillConfig-7c6d3c5b.js";import{r as m,__tla as vt}from"./formRules-b6aa23de.js";import{u as kt,__tla as bt}from"./useCrudSchemas-f2e53e48.js";import{g as gt,c as wt,u as Pt,__tla as Ct}from"./seckillActivity-3e8ccedf.js";import{c as St,__tla as It}from"./spu-a2e0eb38.js";import{g as Ft,__tla as Vt}from"./index-376f22c4.js";import{u as Dt,__tla as xt}from"./useMessage-042ce74c.js";import{__tla as Yt}from"./el-virtual-list-7aec0b9d.js";import{__tla as Lt}from"./el-tree-select-5cb56fe1.js";import{__tla as Rt}from"./el-time-select-e0c85e63.js";import{__tla as Tt}from"./InputPassword-65450654.js";import{__tla as At}from"./InputPassword.vue_vue_type_style_index_0_scoped_3f07eb1d_lang-0000b6d1.js";import{__tla as Mt}from"./Editor-aff63998.js";import{__tla as Ut}from"./SPuUploadImg.vue_vue_type_style_index_0_scoped_ba706063_lang-f02bfd7e.js";import{__tla as Et}from"./index-b64c5a02.js";import{__tla as zt}from"./el-image-viewer-705d587b.js";import{__tla as Nt}from"./UploadImg-5329b041.js";import{__tla as Gt}from"./UploadImgs-2313e742.js";import{__tla as Ot}from"./UploadImgs.vue_vue_type_style_index_0_scoped_9d666400_lang-cbf662a7.js";import{__tla as jt}from"./UploadFile-bd2254c7.js";import{__tla as qt}from"./UploadFile.vue_vue_type_style_index_0_scoped_436eca1b_lang-c51cd1c5.js";import{__tla as Bt}from"./fixed-size-list-80cfa5b8.js";import{__tla as Ht}from"./ContentWrap-ce906d83.js";import{__tla as Jt}from"./ContentWrap.vue_vue_type_script_setup_true_lang-329456e3.js";import{__tla as Kt}from"./el-card-535d49a1.js";import{__tla as Qt}from"./index-80479ade.js";import{__tla as Wt}from"./index-07faecb5.js";import{__tla as Xt}from"./el-image-be54051b.js";import"./tree-0af4953a.js";import{__tla as Zt}from"./category-8e3893c8.js";import{__tla as $t}from"./SkuList-556b01d2.js";import{__tla as ta}from"./dict-644a065b.js";import{__tla as aa}from"./DictTag-bfc7a0a9.js";import"./color-6e929987.js";let A,ea=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 Lt}catch{}})(),(()=>{try{return Rt}catch{}})(),(()=>{try{return Tt}catch{}})(),(()=>{try{return At}catch{}})(),(()=>{try{return Mt}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 Xt}catch{}})(),(()=>{try{return Zt}catch{}})(),(()=>{try{return $t}catch{}})(),(()=>{try{return ta}catch{}})(),(()=>{try{return aa}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:T,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:T,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),A=ot(q({name:"PromotionSeckillActivityForm",__name:"SeckillActivityForm",emits:["success"],setup(ra,{expose:M,emit:U}){const{t:b}=B(),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([]),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=X(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 O(),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 N=U,G=async()=>{if(n&&await n.value.getElFormRef().validate()){d.value=!0;try{const a=Z(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,N("success")}finally{d.value=!1}}},O=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 R(),H(W,null,[_(h,{modelValue:o(f),"onUpdate:modelValue":t[2]||(t[2]=e=>Q(f)?f.value=e:null),title:o(F),width:"65%"},{footer:i(()=>[_(l,{disabled:o(d),type:"primary",onClick:G},{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(()=>[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(()=>[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:z},null,512)],64)}}}),[["__file","D:/zx/mall-newfeifan-zx-admin/src/views/mall/promotion/seckill/activity/SeckillActivityForm.vue"]])});export{ea as __tla,A as default};