DiscountActivityForm-8414fda6.js 12 KB

12345
  1. <<<<<<<< HEAD:dist/assets/DiscountActivityForm-bc52b9fb.js
  2. import{e as O,aq as v,d as K,h as Q,r as c,o as R,c as W,f as i,w as u,a as r,n as k,x as X,v as Z,O as tt,F as et,a_ as at,an as ot,C as st,bb as rt,G as lt,I as it,_ as ct,__tla as ut}from"./index-d75b4e4d.js";import{_ as nt,__tla as dt}from"./Dialog-386bf3a6.js";import{_ as pt,__tla as mt}from"./Form-feb2dd56.js";import _t,{__tla as ft}from"./SpuSelect-6e67f28c.js";import yt,{__tla as vt}from"./SpuAndSkuList-b06b30f0.js";import{b as U,__tla as ht}from"./formatTime-35abe1bb.js";import{r as h,__tla as wt}from"./formRules-8d09b686.js";import{D as bt,__tla as gt}from"./dict-f4d7ebb6.js";import{u as Pt,__tla as kt}from"./useCrudSchemas-f0bd7247.js";import{e as St,__tla as Ct}from"./spu-03655398.js";import{g as Dt,__tla as Tt}from"./index-c7783742.js";import{u as It,__tla as Vt}from"./useMessage-ba892ac2.js";let S,A,E,z,j,Ft=Promise.all([(()=>{try{return ut}catch{}})(),(()=>{try{return dt}catch{}})(),(()=>{try{return mt}catch{}})(),(()=>{try{return ft}catch{}})(),(()=>{try{return vt}catch{}})(),(()=>{try{return ht}catch{}})(),(()=>{try{return wt}catch{}})(),(()=>{try{return gt}catch{}})(),(()=>{try{return kt}catch{}})(),(()=>{try{return Ct}catch{}})(),(()=>{try{return Tt}catch{}})(),(()=>{try{return Vt}catch{}})()]).then(async()=>{let C,D,T;C=O({spuId:[h],name:[h],startTime:[h],endTime:[h],discountType:[h]}),D=O([{label:"\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:U,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:U,isSearch:!0,search:{component:"DatePicker",componentProps:{valueFormat:"YYYY-MM-DD",type:"daterange"}},form:{component:"DatePicker",componentProps:{type:"date",valueFormat:"x"}},table:{width:120}},{label:"\u4F18\u60E0\u7C7B\u578B",field:"discountType",dictType:bt.PROMOTION_DISCOUNT_TYPE,dictClass:"number",isSearch:!0,form:{component:"Radio",value:1}},{label:"\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:T}=Pt(D),j=async m=>await v.get({url:"/promotion/discount-activity/page",params:m}),E=async m=>await v.put({url:"/promotion/discount-activity/close?id="+m}),z=async m=>await v.delete({url:"/promotion/discount-activity/delete?id="+m}),S=ct(K({name:"PromotionDiscountActivityForm",__name:"DiscountActivityForm",emits:["success"],setup(m,{expose:L,emit:N}){const{t:g}=Q(),I=It(),_=c(!1),V=c(""),f=c(!1),F=c(""),n=c(),Y=c(),x=c(),q=[],w=c([]),P=c([]),G=(s,e)=>{n.value.setValues({spuId:s}),M(s,e)},M=async(s,e,a)=>{var b;const l=[],d=await St([s]);if(d.length==0)return;w.value=[];const t=d[0],y=e===void 0?t==null?void 0:t.skus:(b=t==null?void 0:t.skus)==null?void 0:b.filter(o=>e.includes(o.id));y==null||y.forEach(o=>{let p={skuId:o.id,spuId:t.id,discountType:1,discountPercent:0,discountPrice:0};a!==void 0&&(p=a.find(J=>J.skuId===o.id)||p),o.productConfig=p}),t.skus=y,l.push({spuId:t.id,spuDetail:t,propertyList:Dt(t)}),w.value.push(t),P.value=l};L({open:async(s,e)=>{var a;if(_.value=!0,V.value=g("action."+s),F.value=s,await $(),e){f.value=!0;try{const l=await(async t=>await v.get({url:"/promotion/discount-activity/get?id="+t}))(e),d=l.products[0].spuId;await M(d,(a=l.products)==null?void 0:a.map(t=>t.skuId),l.products),n.value.setValues(l)}finally{f.value=!1}}}});const B=N,H=async()=>{if(n&&await n.value.getElFormRef().validate()){f.value=!0;try{const s=n.value.formModel,e=at(x.value.getSkuConfigs("productConfig"));e.forEach(a=>{a.discountType=s.discountType}),s.products=e,F.value==="create"?(await(async a=>await v.post({url:"/promotion/discount-activity/create",data:a}))(s),I.success(g("common.createSuccess"))):(await(async a=>await v.put({url:"/promotion/discount-activity/update",data:a}))(s),I.success(g("common.updateSuccess"))),_.value=!1,B("success")}finally{f.value=!1}}},$=async()=>{w.value=[],P.value=[],await ot(),n.value.getElFormRef().resetFields()};return(s,e)=>{const a=st,l=rt,d=lt,t=pt,y=nt,b=it;return R(),W(et,null,[i(y,{modelValue:r(_),"onUpdate:modelValue":e[2]||(e[2]=o=>tt(_)?_.value=o:null),title:r(V),width:"65%"},{footer:u(()=>[i(a,{disabled:r(f),type:"primary",onClick:H},{default:u(()=>[k("\u786E \u5B9A")]),_:1},8,["disabled"]),i(a,{onClick:e[1]||(e[1]=o=>_.value=!1)},{default:u(()=>[k("\u53D6 \u6D88")]),_:1})]),default:u(()=>[X((R(),Z(t,{ref_key:"formRef",ref:n,isCol:!0,rules:r(C),schema:r(T).formSchema},{spuId:u(()=>[i(a,{onClick:e[0]||(e[0]=o=>r(Y).open())},{default:u(()=>[k("\u9009\u62E9\u5546\u54C1")]),_:1}),i(r(yt),{ref_key:"spuAndSkuListRef",ref:x,"rule-config":q,"spu-list":r(w),"spu-property-list-p":r(P)},{default:u(()=>[i(d,{align:"center",label:"\u4F18\u60E0\u91D1\u989D","min-width":"168"},{default:u(({row:o})=>[i(l,{modelValue:o.productConfig.discountPrice,"onUpdate:modelValue":p=>o.productConfig.discountPrice=p,min:0,class:"w-100%"},null,8,["modelValue","onUpdate:modelValue"])]),_:1}),i(d,{align:"center",label:"\u6298\u6263\u767E\u5206\u6BD4(%)","min-width":"168"},{default:u(({row:o})=>[i(l,{modelValue:o.productConfig.discountPercent,"onUpdate:modelValue":p=>o.productConfig.discountPercent=p,class:"w-100%"},null,8,["modelValue","onUpdate:modelValue"])]),_:1})]),_:1},8,["spu-list","spu-property-list-p"])]),_:1},8,["rules","schema"])),[[b,r(f)]])]),_:1},8,["modelValue","title"]),i(r(_t),{ref_key:"spuSelectRef",ref:Y,isSelectSku:!0,onConfirm:G},null,512)],64)}}}),[["__file","D:/zx/mall-newfeifan-zx-admin/src/views/mall/promotion/discountActivity/DiscountActivityForm.vue"]]),A=Object.freeze(Object.defineProperty({__proto__:null,default:S},Symbol.toStringTag,{value:"Module"}))});export{S as D,Ft as __tla,A as a,E as c,z as d,j as g};
  3. ========
  4. import{e as O,aq as v,d as Q,h as W,r as c,o as R,c as X,f as i,w as u,a as r,n as k,x as Z,v as $,O as tt,F as et,a_ as at,an as ot,C as st,bb as rt,G as lt,I as it,_ as ct,__tla as ut}from"./index-c9fff140.js";import{_ as nt,__tla as dt}from"./Dialog-f1f78bbe.js";import{_ as pt,__tla as mt}from"./Form-86ccced7.js";import _t,{__tla as ft}from"./SpuSelect-a9dae05d.js";import yt,{__tla as vt}from"./SpuAndSkuList-112bc5e7.js";import{b as U,__tla as ht}from"./formatTime-928d70c3.js";import{r as h,__tla as wt}from"./formRules-3c737673.js";import{D as bt,__tla as gt}from"./dict-d4a12fea.js";import{u as Pt,__tla as kt}from"./useCrudSchemas-bdf87178.js";import{e as St,__tla as Ct}from"./spu-f9e35797.js";import{g as Dt,__tla as Tt}from"./index-384c7095.js";import{u as It,__tla as Vt}from"./useMessage-5d45d53a.js";let S,A,E,z,j,Ft=Promise.all([(()=>{try{return ut}catch{}})(),(()=>{try{return dt}catch{}})(),(()=>{try{return mt}catch{}})(),(()=>{try{return ft}catch{}})(),(()=>{try{return vt}catch{}})(),(()=>{try{return ht}catch{}})(),(()=>{try{return wt}catch{}})(),(()=>{try{return gt}catch{}})(),(()=>{try{return kt}catch{}})(),(()=>{try{return Ct}catch{}})(),(()=>{try{return Tt}catch{}})(),(()=>{try{return Vt}catch{}})()]).then(async()=>{let C,D,T;C=O({spuId:[h],name:[h],startTime:[h],endTime:[h],discountType:[h]}),D=O([{label:"\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:U,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:U,isSearch:!0,search:{component:"DatePicker",componentProps:{valueFormat:"YYYY-MM-DD",type:"daterange"}},form:{component:"DatePicker",componentProps:{type:"date",valueFormat:"x"}},table:{width:120}},{label:"\u4F18\u60E0\u7C7B\u578B",field:"discountType",dictType:bt.PROMOTION_DISCOUNT_TYPE,dictClass:"number",isSearch:!0,form:{component:"Radio",value:1}},{label:"\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:T}=Pt(D),j=async m=>await v.get({url:"/promotion/discount-activity/page",params:m}),E=async m=>await v.put({url:"/promotion/discount-activity/close?id="+m}),z=async m=>await v.delete({url:"/promotion/discount-activity/delete?id="+m}),S=ct(Q({name:"PromotionDiscountActivityForm",__name:"DiscountActivityForm",emits:["success"],setup(m,{expose:L,emit:N}){const{t:g}=W(),I=It(),_=c(!1),V=c(""),f=c(!1),F=c(""),n=c(),Y=c(),x=c(),q=[],w=c([]),P=c([]),G=(s,e)=>{n.value.setValues({spuId:s}),M(s,e)},M=async(s,e,a)=>{var b;const l=[],d=await St([s]);if(d.length==0)return;w.value=[];const t=d[0],y=e===void 0?t==null?void 0:t.skus:(b=t==null?void 0:t.skus)==null?void 0:b.filter(o=>e.includes(o.id));y==null||y.forEach(o=>{let p={skuId:o.id,spuId:t.id,discountType:1,discountPercent:0,discountPrice:0};a!==void 0&&(p=a.find(K=>K.skuId===o.id)||p),o.productConfig=p}),t.skus=y,l.push({spuId:t.id,spuDetail:t,propertyList:Dt(t)}),w.value.push(t),P.value=l};L({open:async(s,e)=>{var a;if(_.value=!0,V.value=g("action."+s),F.value=s,await J(),e){f.value=!0;try{const l=await(async t=>await v.get({url:"/promotion/discount-activity/get?id="+t}))(e),d=l.products[0].spuId;await M(d,(a=l.products)==null?void 0:a.map(t=>t.skuId),l.products),n.value.setValues(l)}finally{f.value=!1}}}});const B=N,H=async()=>{if(n&&await n.value.getElFormRef().validate()){f.value=!0;try{const s=n.value.formModel,e=at(x.value.getSkuConfigs("productConfig"));e.forEach(a=>{a.discountType=s.discountType}),s.products=e,F.value==="create"?(await(async a=>await v.post({url:"/promotion/discount-activity/create",data:a}))(s),I.success(g("common.createSuccess"))):(await(async a=>await v.put({url:"/promotion/discount-activity/update",data:a}))(s),I.success(g("common.updateSuccess"))),_.value=!1,B("success")}finally{f.value=!1}}},J=async()=>{w.value=[],P.value=[],await ot(),n.value.getElFormRef().resetFields()};return(s,e)=>{const a=st,l=rt,d=lt,t=pt,y=nt,b=it;return R(),X(et,null,[i(y,{modelValue:r(_),"onUpdate:modelValue":e[2]||(e[2]=o=>tt(_)?_.value=o:null),title:r(V),width:"65%"},{footer:u(()=>[i(a,{disabled:r(f),type:"primary",onClick:H},{default:u(()=>[k("\u786E \u5B9A")]),_:1},8,["disabled"]),i(a,{onClick:e[1]||(e[1]=o=>_.value=!1)},{default:u(()=>[k("\u53D6 \u6D88")]),_:1})]),default:u(()=>[Z((R(),$(t,{ref_key:"formRef",ref:n,isCol:!0,rules:r(C),schema:r(T).formSchema},{spuId:u(()=>[i(a,{onClick:e[0]||(e[0]=o=>r(Y).open())},{default:u(()=>[k("\u9009\u62E9\u5546\u54C1")]),_:1}),i(r(yt),{ref_key:"spuAndSkuListRef",ref:x,"rule-config":q,"spu-list":r(w),"spu-property-list-p":r(P)},{default:u(()=>[i(d,{align:"center",label:"\u4F18\u60E0\u91D1\u989D","min-width":"168"},{default:u(({row:o})=>[i(l,{modelValue:o.productConfig.discountPrice,"onUpdate:modelValue":p=>o.productConfig.discountPrice=p,min:0,class:"w-100%"},null,8,["modelValue","onUpdate:modelValue"])]),_:1}),i(d,{align:"center",label:"\u6298\u6263\u767E\u5206\u6BD4(%)","min-width":"168"},{default:u(({row:o})=>[i(l,{modelValue:o.productConfig.discountPercent,"onUpdate:modelValue":p=>o.productConfig.discountPercent=p,class:"w-100%"},null,8,["modelValue","onUpdate:modelValue"])]),_:1})]),_:1},8,["spu-list","spu-property-list-p"])]),_:1},8,["rules","schema"])),[[b,r(f)]])]),_:1},8,["modelValue","title"]),i(r(_t),{ref_key:"spuSelectRef",ref:Y,isSelectSku:!0,onConfirm:G},null,512)],64)}}}),[["__file","D:/zx/mall-newfeifan-zx-admin/src/views/mall/promotion/discountActivity/DiscountActivityForm.vue"]]),A=Object.freeze(Object.defineProperty({__proto__:null,default:S},Symbol.toStringTag,{value:"Module"}))});export{S as D,Ft as __tla,A as a,E as c,z as d,j as g};
  5. >>>>>>>> 2589804fb89eb98fd6498c1ee41a354dcce32af3:dist/assets/DiscountActivityForm-8414fda6.js