SeckillActivityForm-6da771db.js 8.0 KB

1
  1. import{f as L,d as X,n as q,r as _,o as M,c as B,i as c,w as i,a as o,j as w,C as O,l as Q,y as W,F as Z,ar as $,as as G,at as K,am as tt,J as at,c0 as et,L as rt,N as lt,_ as ot,__tla as st}from"./index-af173888.js";import{_ as ct,__tla as _t}from"./Dialog-987c90a1.js";import{_ as it,__tla as mt}from"./Form-1c876ba3.js";import ut,{__tla as nt}from"./SpuSelect-fff8b892.js";import pt,{__tla as ft}from"./SpuAndSkuList-c67f3250.js";import{b as R,__tla as dt}from"./formatTime-8a6f6c49.js";import{g as ht,__tla as yt}from"./seckillConfig-ca3be4fb.js";import{r as m,__tla as vt}from"./formRules-515a78c5.js";import{u as kt,__tla as bt}from"./useCrudSchemas-e2a05839.js";import{g as gt,c as wt,u as Pt,__tla as Ct}from"./seckillActivity-625683f4.js";import{b as St,__tla as It}from"./spu-41f2bf16.js";import{g as Ft,__tla as Vt}from"./index-0994e210.js";import{u as Dt,__tla as Yt}from"./useMessage-170c1b43.js";import{__tla as xt}from"./el-virtual-list-de299d42.js";import{__tla as Lt}from"./el-tree-select-cd58540b.js";import{__tla as Mt}from"./el-time-select-6302a345.js";import{__tla as Rt}from"./InputPassword-dc4d37fb.js";import{__tla as Ut}from"./Editor-c9f3a63b.js";import{__tla as At}from"./UploadImg-adf73e38.js";import{__tla as Nt}from"./index-4db4ba8b.js";import{__tla as Tt}from"./el-image-viewer-0d82b94c.js";import{__tla as Et}from"./UploadImgs-8cdc0566.js";import{__tla as jt}from"./UploadImgs.vue_vue_type_style_index_0_scoped_9d666400_lang-9154d28f.js";import{__tla as zt}from"./UploadFile-be0ca317.js";import{__tla as Ht}from"./UploadFile.vue_vue_type_style_index_0_scoped_436eca1b_lang-d9f75960.js";import{__tla as Jt}from"./ContentWrap-b959c1be.js";import{__tla as Xt}from"./el-card-178b9654.js";import{__tla as qt}from"./index-a33d7937.js";import{__tla as Bt}from"./index-54b8f773.js";import{__tla as Ot}from"./el-image-fdde0035.js";import"./tree-02f455f9.js";import{__tla as Qt}from"./category-8ca28490.js";import{__tla as Wt}from"./SkuList-d8139bf9.js";import{__tla as Zt}from"./dict-093d1dfa.js";import{__tla as $t}from"./DictTag-4a35e2b7.js";import"./color-6e929987.js";let U,Gt=Promise.all([(()=>{try{return st}catch{}})(),(()=>{try{return _t}catch{}})(),(()=>{try{return mt}catch{}})(),(()=>{try{return nt}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 Yt}catch{}})(),(()=>{try{return xt}catch{}})(),(()=>{try{return Lt}catch{}})(),(()=>{try{return Mt}catch{}})(),(()=>{try{return Rt}catch{}})(),(()=>{try{return Ut}catch{}})(),(()=>{try{return At}catch{}})(),(()=>{try{return Nt}catch{}})(),(()=>{try{return Tt}catch{}})(),(()=>{try{return Et}catch{}})(),(()=>{try{return jt}catch{}})(),(()=>{try{return zt}catch{}})(),(()=>{try{return Ht}catch{}})(),(()=>{try{return Jt}catch{}})(),(()=>{try{return Xt}catch{}})(),(()=>{try{return qt}catch{}})(),(()=>{try{return Bt}catch{}})(),(()=>{try{return Ot}catch{}})(),(()=>{try{return Qt}catch{}})(),(()=>{try{return Wt}catch{}})(),(()=>{try{return Zt}catch{}})(),(()=>{try{return $t}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: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),U=ot(X({name:"PromotionSeckillActivityForm",__name:"SeckillActivityForm",emits:["success"],setup(Kt,{expose:A,emit:N}){const{t:b}=q(),I=Dt(),f=_(!1),F=_(""),d=_(!1),V=_(""),u=_(),D=_(),Y=_(),T=[{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=_([]),g=_([]),E=(a,t)=>{u.value.setValues({spuId:a}),x(a,t)},x=async(a,t,l)=>{var v;const s=[],n=await St([a]);if(n.length==0)return;y.value=[];const r=n[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:Ft(r)}),y.value.push(r),g.value=s};A({open:async(a,t)=>{var l;if(f.value=!0,F.value=b("action."+a),V.value=a,await H(),t){d.value=!0;try{const s=await gt(t);await x(s.spuId,(l=s.products)==null?void 0:l.map(n=>n.skuId),s.products),u.value.setValues(s)}finally{d.value=!1}}}});const j=N,z=async()=>{if(u&&await u.value.getElFormRef().validate()){d.value=!0;try{const a=G(Y.value.getSkuConfigs("productConfig"));a.forEach(l=>{l.seckillPrice=K(l.seckillPrice)});const t=u.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,j("success")}finally{d.value=!1}}},H=async()=>{y.value=[],g.value=[],await tt(),u.value.getElFormRef().resetFields()};return(a,t)=>{const l=at,s=et,n=rt,r=it,h=ct,v=lt;return M(),B(Z,null,[c(h,{modelValue:o(f),"onUpdate:modelValue":t[2]||(t[2]=e=>W(f)?f.value=e:null),title:o(F),width:"65%"},{footer:i(()=>[c(l,{disabled:o(d),type:"primary",onClick:z},{default:i(()=>[w("\u786E \u5B9A")]),_:1},8,["disabled"]),c(l,{onClick:t[1]||(t[1]=e=>f.value=!1)},{default:i(()=>[w("\u53D6 \u6D88")]),_:1})]),default:i(()=>[O((M(),Q(r,{ref_key:"formRef",ref:u,isCol:!0,rules:o(P),schema:o(S).formSchema},{spuId:i(()=>[c(l,{onClick:t[0]||(t[0]=e=>o(D).open())},{default:i(()=>[w("\u9009\u62E9\u5546\u54C1")]),_:1}),c(o(pt),{ref_key:"spuAndSkuListRef",ref:Y,"rule-config":T,"spu-list":o(y),"spu-property-list-p":o(g)},{default:i(()=>[c(n,{align:"center",label:"\u79D2\u6740\u5E93\u5B58","min-width":"168"},{default:i(({row:e})=>[c(s,{modelValue:e.productConfig.stock,"onUpdate:modelValue":p=>e.productConfig.stock=p,min:0,class:"w-100%"},null,8,["modelValue","onUpdate:modelValue"])]),_:1}),c(n,{align:"center",label:"\u79D2\u6740\u4EF7\u683C(\u5143)","min-width":"168"},{default:i(({row:e})=>[c(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"]),c(o(ut),{ref_key:"spuSelectRef",ref:D,isSelectSku:!0,onConfirm:E},null,512)],64)}}}),[["__file","/Users/RuHu.Xu/Desktop/mall-newfeifan-zx-admin/src/views/mall/promotion/seckill/activity/SeckillActivityForm.vue"]])});export{Gt as __tla,U as default};