index-e25ed876.js 13 KB

1
  1. import{a as b,c as E,P as re,o as ne,W as x,X as r,Y as u,m as _,Z as c,u as I,a2 as m,E as v,a0 as p,aa as ae,a5 as g,$ as d,F as w,a6 as $,a3 as ie,a4 as ce}from"./vue-74beb2f3.js";import{n as ue}from"./index-04429713.js";import{_ as de,c as me,A as S,m as z,d as U,M as N,E as M}from"./index-3887ab05.js";import{u as he}from"./vue-router-d228e26b.js";import{P as ve}from"./Product-1f626b80.js";import"./fullScreen-9123d61a.js";import"./settingColumns.vue_vue_type_style_index_0_scoped_176f68a0_lang-a848e312.js";import"./SettingOutlined-04c21aec.js";/* empty css */const T=D=>(ie("data-v-7aed77be"),D=D(),ce(),D),pe={class:"y-container"},fe={key:0,class:"image-panel"},_e={key:2,class:"color-red"},ge={class:"submit-panel"},ye={style:{"margin-right":"20px"}},we={class:"color-red"},ke={class:"color-red sumAmount"},xe={class:"mt-10",style:{display:"flex","justify-content":"space-evenly","margin-top":"20px"}},be={style:{display:"flex","align-items":"center",color:"red"}},Ce={class:"label"},qe={class:"label ellipsis",style:{"max-width":"220px","margin-left":"10px"}},$e={key:0,class:"mt-10"},Ue=T(()=>m("span",{class:"label"},"工艺",-1)),ze={key:1,class:"mt-10"},Be=T(()=>m("span",{class:"label"},"颜色",-1)),Ie={key:2,class:"mt-10"},Se=T(()=>m("span",{class:"label"},"选项",-1)),Te={key:3,class:"mt-10"},De=T(()=>m("span",{class:"label"},"长度",-1)),Ae={key:4,class:"mt-10"},Ne=T(()=>m("span",{class:"label"},"宽度",-1)),Pe={__name:"index",setup(D){const j=me(),Q=he(),C=b(),P=b(""),f=b([]),F=b({id:20231121145103,content:{istool:0,pageNumber:1,pageSize:20,where:{condition:P}}}),O=b(null),R=E(()=>f.value.reduce((s,i)=>s+i.gradeprice*i.favoritesqty,0)),W=E(()=>{let t=f.value.some(s=>s.tradefield_shoppingcart!==f.value[0].tradefield_shoppingcart);return t&&z.error("存在不同领域的商品")}),X=t=>{f.value=t},Y=async t=>{const s=await S.requested({id:20231122102803,content:{itemids:f.value.map(i=>i.itemid),iscollection:!1}});U.message(s,"成功",()=>{C.value.listData(),C.value.reloadSelect()})},K=async t=>{const s=l=>{if(l.iscustomsize==1){if(console.log(!l.length||!l.width),!l.length||!l.width)throw z.error(l.itemname+"定制信息有误,请检查!"),"打断";if(l.cheekschemeid>0&&!l.customcheek)throw z.error(l.itemname+"工艺定制信息有误,请检查!"),"打断";if(l.colorschemeid>0&&!l.customcolors)throw z.error(l.itemname+"颜色定制信息有误,请检查!"),"打断";if(l.materialschemeid>0&&!l.custommaterial)throw z.error(l.itemname+"选项定制信息有误,请检查!"),"打断";return{sa_orderitemsid:0,itemid:l.itemid,itemno:l.itemno,qty:l.favoritesqty,length:l.length?l.length:0,width:l.width?l.width:0,customcolors:l.customcolors?l.customcolors:0,customcheek:l.customcheek?l.customcheek:0,custommaterial:l.custommaterial?l.custommaterial:0,sa_brandid:l.brand[0].sa_brandid,sa_shoppingcartid:l.sa_shoppingcartid,tradefield:l.tradefield[0].tradefield}}else return{sa_orderitemsid:0,itemid:l.itemid,qty:l.favoritesqty,itemno:l.itemno,length:0,width:0,sa_brandid:l.brand[0].sa_brandid,sa_shoppingcartid:l.sa_shoppingcartid,tradefield:l.tradefield[0].tradefield}};console.log(f.value);let i=f.value.map(l=>(console.log(l),s(l)));t=="order"?i.filter(l=>l!==void 0).length>0&&Z(i.filter(l=>l!==void 0)):i.filter(l=>l!==void 0).length>0&&H(i.filter(l=>l!==void 0))},Z=t=>{if(W.value)return!1;if(f.value.length==0)return z.error("未选择商品无法创建订单");N.confirm({title:"生成订单",content:`当前选中${f.value.length}个商品`,icon:_(M),okText:"确认",cancelText:"取消",async onOk(){const s=await S.requested({id:20221128183202,content:{type:"标准订单",tradefield:f.value[0].tradefield[0].tradefield,items:t}});U.message(s,"提交成功",()=>{j.shopCartNum(),C.value.listData(),N.confirm({title:"创建成功",content:"订单创建成功,是否跳转至该订单!",icon:_(M),okText:"确认",cancelText:"取消",onOk(){Q.push({path:"/agent_orderDetails",query:{id:s.data.sa_orderid}})},cancelText:"取消",onCancel(){N.destroyAll()}})})},cancelText:"取消",onCancel(){N.destroyAll()}})},G=()=>{F.value.content.pageNumber=1,C.value.listData()},B=(t,s,i,l)=>{const k=new ve(t);let y={min:t.lengthmin,max:t.lengthmax},h={min:t.widthmin,max:t.widthmax};return!!k.checkDimension({width:h,length:y},t)},V=(t,s)=>{O.value!==null&&clearTimeout(O.value),O.value=setTimeout(()=>{const i=async()=>{await S.requested({id:20231121143403,version:1,content:{itemid:t.itemid,length:t.favoriteslength,qty:t.favoritesqty,width:t.favoriteswidth,iscollection:!0}})};U.validateInputNumber(t.orderminqty,t.favoritesqty,t.orderaddqty).then(l=>{t.favoritesqty=l,i()})},500)},H=async t=>{let s=await S.requested({id:20231024110003,content:{items:t}});U.message(s,"添加成功",()=>{})},A=b(!1),o=b({}),J=t=>{console.log(t),A.value=!0,o.value=t},ee=()=>{if(!B(o.value.record))return!1;o.value.record.isselect=!0,C.value.data.some(t=>{t.itemid==o.value.itemid&&(t=o.value)}),A.value=!1},te=t=>{t.isselect=!1,t.customcheek=null,t.customcolors=null,t.custommaterial=null,t.length=null,t.width=null},le=E(()=>t=>{let s="",i="",l="",k="",y="";t.cheekschemeid>0&&(s=t.cheekschemedetails.filter(n=>n.num==t.customcheek).length?t.cheekschemedetails.filter(n=>n.num==t.customcheek)[0].num:""),t.colorschemeid>0&&(i=t.colorsschemedetails.filter(n=>n.num==t.customcolors).length?t.colorsschemedetails.filter(n=>n.num==t.customcolors)[0].num:""),t.materialschemeid>0&&(l=t.materialschemedetails.filter(n=>n.num==t.custommaterial).length?t.materialschemedetails.filter(n=>n.num==t.custommaterial)[0].num:""),(t.spec=="自定义"||t.spec=="custom")&&(k=t.lengthschemedetails.filter(n=>n.num==t.length).length?t.lengthschemedetails.filter(n=>n.num==t.length)[0].num:"",y=t.widthschemedetails.filter(n=>n.num==t.width).length?t.widthschemedetails.filter(n=>n.num==t.width)[0].num:"",y||(y=t.width),k||(k=t.length));let h="";return s&&(h=h+s+","),i&&(h=h+i+","),l&&(h=h+l+","),k&&(h=h+k+"x"),y&&(h=h+y),h});re(()=>{C.value.listData()});let L=b([]);return ne(async()=>{const t=await S.optionstype("domainrelatedaccounts");L.value=t.data,console.log(L.value,"领域")}),(t,s)=>{const i=x("a-input"),l=x("a-image"),k=x("a-input-number"),y=x("a-button"),h=x("a-tag"),n=x("a-select-option"),q=x("a-select"),oe=x("a-tooltip"),se=x("a-modal");return r(),u("div",pe,[_(ue,{ref_key:"prod",ref:C,noQuery:!0,rowKey:"itemid",size:"small",columns:I(U).TBLayout("exportTable"),param:F.value,hideBorder:!0,onOnSelect:X},{operation:c(()=>[_(i,{class:"search-input",value:P.value,"onUpdate:value":s[0]||(s[0]=e=>P.value=e),onKeyup:ae(G,["enter"]),placeholder:"搜索商品"},null,8,["value","onKeyup"])]),tb_cell:c(({data:e})=>[e.column.dataIndex=="image"?(r(),u("div",fe,[_(l,{width:80,src:e.record.attinfos[0]?e.record.attinfos[0].url:""},null,8,["src"])])):g("",!0),e.column.dataIndex=="qty"?(r(),d(k,{key:1,style:{width:"100px"},id:"inputNumber",value:e.record.favoritesqty,"onUpdate:value":a=>e.record.favoritesqty=a,min:e.record.orderminqty,step:e.record.orderaddqty,onChange:a=>V(e.record)},null,8,["value","onUpdate:value","min","step","onChange"])):g("",!0),e.column.dataIndex=="amount"?(r(),u("span",_e,"¥ "+p(I(U).formatAmount(e.record.favoritesqty*e.record.gradeprice)),1)):g("",!0),e.column.dataIndex==="iscustom"&&e.record.iscustomsize==1?(r(),u(w,{key:3},[e.record.isselect?(r(),d(h,{key:1,closable:"",onClose:a=>te(e.record)},{default:c(()=>[v(p(I(le)(e.record)),1)]),_:2},1032,["onClose"])):(r(),d(y,{key:0,type:"link",onClick:a=>J(e)},{default:c(()=>[v("定制信息")]),_:2},1032,["onClick"]))],64)):g("",!0),e.column.dataIndex==="length"&&e.record.iscustomsize==1?(r(),u(w,{key:4},[e.record.lengthschemedetails.length>0?(r(),d(q,{key:0,value:e.record.favoriteslength,"onUpdate:value":a=>e.record.favoriteslength=a,style:{width:"150px"},placeholder:"选择长度",onChange:a=>V(e.record)},{default:c(()=>[(r(!0),u(w,null,$(e.record.lengthschemedetails,a=>(r(),d(n,{key:a.sa_sizeschemedetailid,value:a.num},{default:c(()=>[v(p(a.num),1)]),_:2},1032,["value"]))),128))]),_:2},1032,["value","onUpdate:value","onChange"])):(r(),d(i,{key:1,style:{width:"200px"},value:e.record.favoriteslength,"onUpdate:value":a=>e.record.favoriteslength=a,placeholder:`${e.record.lengthmin}-${e.record.lengthmax}`,onBlur:a=>B(e.record,e.record.lengthmin,e.record.lengthmax,"length")},null,8,["value","onUpdate:value","placeholder","onBlur"]))],64)):g("",!0),e.column.dataIndex==="width"&&e.record.iscustomsize==1?(r(),u(w,{key:5},[e.record.widthschemedetails.length>0?(r(),d(q,{key:0,value:e.record.favoriteswidth,"onUpdate:value":a=>e.record.favoriteswidth=a,style:{width:"150px"},placeholder:"选择宽度",onChange:a=>V(e.record)},{default:c(()=>[(r(!0),u(w,null,$(e.record.widthschemedetails,a=>(r(),d(n,{key:a.sa_sizeschemedetailid,value:a.num},{default:c(()=>[v(p(a.num),1)]),_:2},1032,["value"]))),128))]),_:2},1032,["value","onUpdate:value","onChange"])):(r(),d(i,{key:1,style:{width:"200px"},value:e.record.favoriteswidth,"onUpdate:value":a=>e.record.favoriteswidth=a,placeholder:`${e.record.widthmin}-${e.record.widthmax}`,onBlur:a=>B(e.record,e.record.widthmin,e.record.widthmax,"width")},null,8,["value","onUpdate:value","placeholder","onBlur"]))],64)):g("",!0)]),_:1},8,["columns","param"]),m("div",ge,[_(y,{style:{"margin-left":"10px"},type:"default",disabled:f.value.length===0,onClick:Y},{default:c(()=>[v("取消收藏当前选中商品")]),_:1},8,["disabled"]),m("p",null,[m("span",ye,[v("当前选中了"),m("b",we," "+p(f.value.length)+" ",1),v("条商品")]),v("合计:"),m("b",ke,p(I(U).formatAmount(I(R),{name:"list",key:"amount"})),1)]),m("div",{class:"submit-btn",onClick:s[1]||(s[1]=e=>K("order"))},"创建订单"),m("div",{class:"shopcart-btn",onClick:s[2]||(s[2]=e=>K("shopcart"))},"加入购物车")]),_(se,{open:A.value,"onUpdate:open":s[12]||(s[12]=e=>A.value=e),wrapClassName:"oder-modal",title:"定制信息",onOk:ee,style:{"text-align":"left"},closable:!1},{default:c(()=>[m("div",xe,[m("div",be,[m("span",Ce,"品号:"+p(o.value.record.itemno),1),m("span",qe,[v("品名: "),_(oe,{placement:"topLeft",title:o.value.record.itemname,"arrow-point-at-center":""},{default:c(()=>[v(p(o.value.record.itemname),1)]),_:1},8,["title"])])])]),o.value.record.cheekschemeid>0?(r(),u("div",$e,[Ue,_(q,{value:o.value.record.customcheek,"onUpdate:value":s[3]||(s[3]=e=>o.value.record.customcheek=e),style:{width:"400px"},placeholder:"选择工艺"},{default:c(()=>[(r(!0),u(w,null,$(o.value.record.cheekschemedetails,e=>(r(),d(n,{key:e.sa_sizeschemedetailid,value:e.num},{default:c(()=>[v(p(e.num),1)]),_:2},1032,["value"]))),128))]),_:1},8,["value"])])):g("",!0),o.value.record.colorschemeid>0?(r(),u("div",ze,[Be,_(q,{value:o.value.record.customcolors,"onUpdate:value":s[4]||(s[4]=e=>o.value.record.customcolors=e),style:{width:"400px"},placeholder:"选择颜色"},{default:c(()=>[(r(!0),u(w,null,$(o.value.record.colorsschemedetails,e=>(r(),d(n,{key:e.sa_sizeschemedetailid,value:e.num},{default:c(()=>[v(p(e.num),1)]),_:2},1032,["value"]))),128))]),_:1},8,["value"])])):g("",!0),o.value.record.materialschemeid>0?(r(),u("div",Ie,[Se,_(q,{value:o.value.record.custommaterial,"onUpdate:value":s[5]||(s[5]=e=>o.value.record.custommaterial=e),style:{width:"400px"},placeholder:"选择选项"},{default:c(()=>[(r(!0),u(w,null,$(o.value.record.materialschemedetails,e=>(r(),d(n,{key:e.sa_sizeschemedetailid,value:e.num},{default:c(()=>[v(p(e.num),1)]),_:2},1032,["value"]))),128))]),_:1},8,["value"])])):g("",!0),o.value.record.spec=="自定义"||o.value.record.spec=="custom"?(r(),u("div",Te,[De,o.value.record.lengthschemedetails.length>0?(r(),d(q,{key:0,value:o.value.record.length,"onUpdate:value":s[6]||(s[6]=e=>o.value.record.length=e),style:{width:"400px"},placeholder:"选择长度"},{default:c(()=>[(r(!0),u(w,null,$(o.value.record.lengthschemedetails,e=>(r(),d(n,{key:e.sa_sizeschemedetailid,value:e.num},{default:c(()=>[v(p(e.num),1)]),_:2},1032,["value"]))),128))]),_:1},8,["value"])):(r(),d(i,{key:1,style:{width:"400px"},value:o.value.record.length,"onUpdate:value":s[7]||(s[7]=e=>o.value.record.length=e),placeholder:`输入${o.value.record.lengthmin}到${o.value.record.lengthmax}毫米`,onBlur:s[8]||(s[8]=e=>B(o.value.record,o.value.record.lengthmin,o.value.record.lengthmax,"length"))},null,8,["value","placeholder"]))])):g("",!0),o.value.record.spec=="自定义"||o.value.record.spec=="custom"?(r(),u("div",Ae,[Ne,o.value.record.widthschemedetails.length>0?(r(),d(q,{key:0,value:o.value.record.width,"onUpdate:value":s[9]||(s[9]=e=>o.value.record.width=e),style:{width:"400px"},placeholder:"选择宽度"},{default:c(()=>[(r(!0),u(w,null,$(o.value.record.widthschemedetails,e=>(r(),d(n,{key:e.sa_sizeschemedetailid,value:e.num},{default:c(()=>[v(p(e.num),1)]),_:2},1032,["value"]))),128))]),_:1},8,["value"])):(r(),d(i,{key:1,style:{width:"400px"},value:o.value.record.width,"onUpdate:value":s[10]||(s[10]=e=>o.value.record.width=e),placeholder:`输入${o.value.record.widthmin}到${o.value.record.widthmax}毫米`,onBlur:s[11]||(s[11]=e=>B(o.value.record,o.value.record.widthmin,o.value.record.widthmax,"width"))},null,8,["value","placeholder"]))])):g("",!0)]),_:1},8,["open"])])}}},Re=de(Pe,[["__scopeId","data-v-7aed77be"]]);export{Re as default};