Files
aiot-platform-ui/apps/web-antd/dist/js/index-PgY2GUuv.js

2 lines
10 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

var v=(u,m,t)=>new Promise((C,w)=>{var p=a=>{try{g(t.next(a))}catch(d){w(d)}},S=a=>{try{g(t.throw(a))}catch(d){w(d)}},g=a=>a.done?C(a.value):Promise.resolve(a.value).then(p,S);g((t=t.apply(u,m)).next())});import{at as Q,ae as Z,ar as y,au as ee,am as b,ay as _,a9 as re,ac as oe}from"./bootstrap-DsjPfOC_.js";import{u as ae,d as le,a as te}from"./index-duX8p7Nq.js";import{g as q}from"./property-util-BkB1DfhS.js";import{_ as A}from"./sku-list.vue_vue_type_script_setup_true_lang-BI-WjtJ0.js";import"./vxe-table-C9eY8pUC.js";import{d8 as se,m as ie,b9 as f,w as ne,v as ue,ad as ce,b2 as B,j as s,u as l,bJ as c,bL as h,ae as pe,ai as x,ab as E,dG as k,dE as P}from"../jse/index-index-CO0ZsLf2.js";import{b as me}from"./index-hZZNH7Om.js";import{g as de}from"./index-C3CJmym7.js";import{g as fe}from"./index-NrY_rhK6.js";import{D as ge}from"./biz-mall-enum-CJxJyQZ4.js";import{D as ve}from"./dict-enum-DRf9W45H.js";import{_ as ye}from"./product-attributes.vue_vue_type_script_setup_true_lang-CC5H1HQY.js";import{_ as be}from"./product-property-add-form.vue_vue_type_script_setup_true_lang-Sn-EIZmL.js";import{_ as he}from"./page.vue_vue_type_script_setup_true_lang-BL-xU9lB.js";import{u as ke}from"./use-tabs-CyNGChRD.js";import{u as Pe}from"./use-modal-BStO3Sdo.js";import"./dict-tag.vue_vue_type_script_setup_true_lang-BZwqGgTH.js";import"./index-D56J2paf.js";import"./tabbar-BxiNE9JJ.js";import"./x--itLcJVB.js";function we(){return[{fieldName:"id",component:"Input",dependencies:{triggerFields:[""],show:()=>!1}},{fieldName:"name",label:"商品名称",component:"Input",componentProps:{allowClear:!0,placeholder:"请输入商品名称"},rules:"required"},{fieldName:"categoryId",label:"分类名称",component:"ApiTreeSelect",componentProps:{api:()=>v(null,null,function*(){const u=yield de({});return se(u)}),fieldNames:{label:"name",value:"id",children:"children"},placeholder:"请选择商品分类"},rules:"required"},{fieldName:"brandId",label:"商品品牌",component:"ApiSelect",componentProps:{api:me,labelField:"name",valueField:"id",allowClear:!0,placeholder:"请选择商品品牌"},rules:"required"},{fieldName:"keyword",label:"商品关键字",component:"Input",componentProps:{placeholder:"请输入商品关键字"},rules:"required"},{fieldName:"introduction",label:"商品简介",component:"Textarea",componentProps:{placeholder:"请输入商品简介",autoSize:{minRows:2,maxRows:2},showCount:!0,maxlength:128,allowClear:!0},rules:"required"},{fieldName:"picUrl",label:"商品封面图",component:"ImageUpload",componentProps:{maxSize:30},rules:"required"},{fieldName:"sliderPicUrls",label:"商品轮播图",component:"ImageUpload",componentProps:{maxNumber:10,multiple:!0,maxSize:30},rules:"required"}]}function R(u=[],m=!1){return[{fieldName:"id",component:"Input",dependencies:{triggerFields:[""],show:()=>!1}},{fieldName:"subCommissionType",label:"分销类型",component:"RadioGroup",componentProps:{allowClear:!0,options:[{label:"默认设置",value:!1},{label:"单独设置",value:!0}]},rules:"required"},{fieldName:"specType",label:"商品规格",component:"RadioGroup",componentProps:{allowClear:!0,options:[{label:"单规格",value:!1},{label:"多规格",value:!0}]},rules:"required"},{fieldName:"singleSkuList",label:"",component:"Input",dependencies:{triggerFields:["specType"],show:t=>t.specType===!1}},{fieldName:"productAttributes",label:"商品属性",component:"Input",dependencies:{triggerFields:["specType"],show:t=>t.specType===!0}},{fieldName:"batchSkuList",label:"批量设置",component:"Input",dependencies:{triggerFields:["specType"],show:t=>t.specType===!0&&u.length>0&&!m}},{fieldName:"multiSkuList",label:"规格列表",component:"Input",dependencies:{triggerFields:["specType"],show:t=>t.specType===!0&&u.length>0}}]}function Te(){return[{fieldName:"id",component:"Input",dependencies:{triggerFields:[""],show:()=>!1}},{fieldName:"deliveryTypes",label:"配送方式",component:"CheckboxGroup",componentProps:{options:Q(ve.TRADE_DELIVERY_TYPE,"number")},rules:"required"},{fieldName:"deliveryTemplateId",label:"运费模板",component:"ApiSelect",componentProps:{api:fe,labelField:"name",valueField:"id"},dependencies:{triggerFields:["deliveryTypes"],show:u=>!!u.deliveryTypes&&u.deliveryTypes.includes(ge.EXPRESS.type)},rules:"required"}]}function Ce(){return[{fieldName:"id",component:"Input",dependencies:{triggerFields:[""],show:()=>!1}},{fieldName:"description",label:"商品详情",component:"RichTextarea",componentProps:{placeholder:"请输入商品详情",height:1e3},rules:"required"}]}function Se(){return[{fieldName:"id",component:"Input",dependencies:{triggerFields:[""],show:()=>!1}},{fieldName:"sort",label:"商品排序",component:"InputNumber",componentProps:{min:0},rules:"required"},{fieldName:"giveIntegral",label:"赠送积分",component:"InputNumber",componentProps:{min:0},rules:"required"},{fieldName:"virtualSalesCount",label:"虚拟销量",component:"InputNumber",componentProps:{min:0},rules:"required"}]}const Fe=ie({__name:"index",setup(u){const m=f(),{params:t,name:C}=Z(),{closeCurrentTab:w}=ke(),p=f("info"),S=f([{key:"info",tab:"基础设置"},{key:"sku",tab:"价格库存"},{key:"delivery",tab:"物流设置"},{key:"description",tab:"商品详情"},{key:"other",tab:"其它设置"}]),g=f(!1),a=f(C==="ProductSpuDetail"),d=f(),i=f({name:"",categoryId:void 0,keyword:"",picUrl:"",sliderPicUrls:[],introduction:"",deliveryTypes:[],deliveryTemplateId:void 0,brandId:void 0,specType:!1,subCommissionType:!1,skus:[{price:0,marketPrice:0,costPrice:0,barCode:"",picUrl:"",stock:0,weight:0,volume:0,firstBrokeragePrice:0,secondBrokeragePrice:0}],description:"",sort:0,giveIntegral:0,virtualSalesCount:0}),n=f([]),L=[{name:"stock",rule:e=>e>=0,message:"商品库存必须大于等于 1 "},{name:"price",rule:e=>e>=.01,message:"商品销售价格必须大于等于 0.01 元!!!"},{name:"marketPrice",rule:e=>e>=.01,message:"商品市场价格必须大于等于 0.01 元!!!"},{name:"costPrice",rule:e=>e>=.01,message:"商品成本价格必须大于等于 0.00 元!!!"}],[V,F]=y({commonConfig:{componentProps:{class:"w-full"},formItemClass:"col-span-2",labelWidth:120},layout:"horizontal",schema:we(),showDefaultActions:!1}),[U,T]=y({commonConfig:{labelWidth:120},layout:"horizontal",schema:R(n.value,a.value),showDefaultActions:!1,handleValuesChange:(e,o)=>{o.includes("subCommissionType")&&(i.value.subCommissionType=e.subCommissionType,H()),o.includes("specType")&&(i.value.specType=e.specType,K())}}),[z,W]=Pe({connectedComponent:be,destroyOnClose:!0}),[G,I]=y({commonConfig:{componentProps:{class:"w-full"},formItemClass:"col-span-2",labelWidth:120},layout:"horizontal",schema:Te(),showDefaultActions:!1}),[O,N]=y({commonConfig:{componentProps:{class:"w-full"},formItemClass:"col-span-2",labelWidth:120},layout:"vertical",schema:Ce(),showDefaultActions:!1}),[$,D]=y({commonConfig:{componentProps:{class:"w-full"},formItemClass:"col-span-2",labelWidth:120},layout:"horizontal",schema:Se(),showDefaultActions:!1});function M(e){p.value=e}function Y(){return v(this,null,function*(){const e=yield F.merge(T).merge(I).merge(N).merge(D).submitAllForm(!0);if(e.skus=i.value.skus,e.skus){try{d.value.validateSku()}catch(r){re.error("【库存价格】不完善,请填写相关信息");return}e.skus.forEach(r=>{r.price=k(r.price),r.marketPrice=k(r.marketPrice),r.costPrice=k(r.costPrice),r.firstBrokeragePrice=k(r.firstBrokeragePrice),r.secondBrokeragePrice=k(r.secondBrokeragePrice)})}const o=[];e.sliderPicUrls.forEach(r=>{typeof r=="object"?o.push(r.url):o.push(r)}),e.sliderPicUrls=o,yield m.value?ae(e):le(e)})}function j(){return v(this,null,function*(){var e;a.value&&(a.value=!0,F.setDisabled(!0),T.setDisabled(!0),I.setDisabled(!0),N.setDisabled(!0),D.setDisabled(!0)),n.value=q(i.value),g.value=!0;try{const o=yield te(m.value);(e=o.skus)==null||e.forEach(r=>{r.price=P(r.price),r.marketPrice=P(r.marketPrice),r.costPrice=P(r.costPrice),r.firstBrokeragePrice=P(r.firstBrokeragePrice),r.secondBrokeragePrice=P(r.secondBrokeragePrice)}),i.value=o,F.setValues(o).then(),T.setValues(o).then(),I.setValues(o).then(),N.setValues(o).then(),D.setValues(o).then(),n.value=q(i.value)}finally{g.value=!1}})}function J(){W.open()}function X(e){d.value.generateTableData(e)}function H(){for(const e of i.value.skus)e.firstBrokeragePrice=0,e.secondBrokeragePrice=0}function K(){n.value=[],i.value.skus=[{price:0,marketPrice:0,costPrice:0,barCode:"",picUrl:"",stock:0,weight:0,volume:0,firstBrokeragePrice:0,secondBrokeragePrice:0}]}return ne(n,()=>{T.updateSchema(R(n.value,a.value))},{deep:!0}),ue(()=>v(null,null,function*(){m.value=t.id,m.value&&(yield j())})),(e,o)=>(B(),ce("div",null,[s(l(z),{"property-list":n.value},null,8,["property-list"]),s(l(he),{"auto-content-height":""},{default:c(()=>[s(l(ee),{class:"h-full w-full",loading:g.value,"tab-list":S.value,"active-key":p.value,onTabChange:M},{tabBarExtraContent:c(()=>[a.value?(B(),E(l(_),{key:1,type:"default",onClick:o[0]||(o[0]=()=>l(w)())},{default:c(()=>[...o[2]||(o[2]=[x(" 返回列表 ",-1)])]),_:1})):(B(),E(l(_),{key:0,type:"primary",onClick:Y},{default:c(()=>[...o[1]||(o[1]=[x(" 保存 ",-1)])]),_:1}))]),default:c(()=>[h(s(l(V),{class:"w-3/5"},null,512),[[b,p.value==="info"]]),h(s(l(U),{class:"w-full"},{singleSkuList:c(()=>[s(l(A),{ref_key:"skuListRef",ref:d,class:"w-full","is-detail":a.value,"prop-form-data":i.value,"property-list":n.value,"rule-config":L},null,8,["is-detail","prop-form-data","property-list"])]),productAttributes:c(()=>[pe("div",null,[s(l(_),{class:"mb-10px mr-15px",onClick:J},{default:c(()=>[...o[3]||(o[3]=[x(" 添加属性 ",-1)])]),_:1}),s(ye,{"is-detail":a.value,"property-list":n.value,onSuccess:X},null,8,["is-detail","property-list"])])]),batchSkuList:c(()=>[s(l(A),{"is-batch":!0,"is-detail":a.value,"prop-form-data":i.value,"property-list":n.value},null,8,["is-detail","prop-form-data","property-list"])]),multiSkuList:c(()=>[s(l(A),{ref_key:"skuListRef",ref:d,"is-detail":a.value,"prop-form-data":i.value,"property-list":n.value,"rule-config":L},null,8,["is-detail","prop-form-data","property-list"])]),_:1},512),[[b,p.value==="sku"]]),h(s(l(G),{class:"w-3/5"},null,512),[[b,p.value==="delivery"]]),h(s(l(O),{class:"w-3/5"},null,512),[[b,p.value==="description"]]),h(s(l($),{class:"w-3/5"},null,512),[[b,p.value==="other"]])]),_:1},8,["loading","tab-list","active-key"])]),_:1})]))}}),Je=oe(Fe,[["__scopeId","data-v-edf3a67b"]]);export{Je as default};