index-48696857.js 7.7 KB

1
  1. import{j as s,a as v,U as g,u as y,V as l,W as m,X as _,G as h,R as V,a5 as u,c as j,o as H,$ as b,a4 as f,aa as E,a3 as F,F as P}from"./vue-15ee4564.js";import{a as T,s as K,A as R,M,E as Q,b as x,m as G}from"./index-0877f322.js";import{_ as W}from"./index-0c151144.js";import{u as X}from"./base-3803c3f3.js";import{u as J}from"./vue-router-0190217c.js";import{_ as L}from"./_plugin-vue_export-helper-c27b6911.js";var Y={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M688 312v-48c0-4.4-3.6-8-8-8H296c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h384c4.4 0 8-3.6 8-8zm-392 88c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h184c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8H296zm376 116c-119.3 0-216 96.7-216 216s96.7 216 216 216 216-96.7 216-216-96.7-216-216-216zm107.5 323.5C750.8 868.2 712.6 884 672 884s-78.8-15.8-107.5-44.5C535.8 810.8 520 772.6 520 732s15.8-78.8 44.5-107.5C593.2 595.8 631.4 580 672 580s78.8 15.8 107.5 44.5C808.2 653.2 824 691.4 824 732s-15.8 78.8-44.5 107.5zM761 656h-44.3c-2.6 0-5 1.2-6.5 3.3l-63.5 87.8-23.1-31.9a7.92 7.92 0 00-6.5-3.3H573c-6.5 0-10.3 7.4-6.5 12.7l73.8 102.1c3.2 4.4 9.7 4.4 12.9 0l114.2-158c3.9-5.3.1-12.7-6.4-12.7zM440 852H208V148h560v344c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8V108c0-17.7-14.3-32-32-32H168c-17.7 0-32 14.3-32 32v784c0 17.7 14.3 32 32 32h272c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8z"}}]},name:"file-done",theme:"outlined"};const Z=Y;function U(c){for(var t=1;t<arguments.length;t++){var o=arguments[t]!=null?Object(arguments[t]):{},d=Object.keys(o);typeof Object.getOwnPropertySymbols=="function"&&(d=d.concat(Object.getOwnPropertySymbols(o).filter(function(i){return Object.getOwnPropertyDescriptor(o,i).enumerable}))),d.forEach(function(i){ee(c,i,o[i])})}return c}function ee(c,t,o){return t in c?Object.defineProperty(c,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):c[t]=o,c}var z=function(t,o){var d=U({},t,o.attrs);return s(T,U({},d,{icon:Z}),null)};z.displayName="FileDoneOutlined";z.inheritAttrs=!1;const te=z,ne={key:0},oe={__name:"index",props:{columns:Array},emits:["onConfirm"],setup(c,{emit:t}){const o=c,d=X(),i=v(!1);let{tableRecord:a}=K(d);const q=()=>{i.value=!1},k=()=>{i.value=!1,t("onConfirm",a.value)};return(S,C)=>{const $=g("a-badge"),O=g("a-button"),D=g("a-table"),A=g("a-drawer");return y(a).length>0?(l(),m("div",ne,[s($,{count:y(a).length,onClick:C[0]||(C[0]=w=>i.value=!0)},{default:_(()=>[s(y(te),{style:{"font-size":"1.5rem"}})]),_:1},8,["count"]),s(A,{title:"选中的产品",placement:"bottom",visible:i.value,height:"70%",onClose:q},{extra:_(()=>[s(O,{style:{"margin-right":"8px"},onClick:q},{default:_(()=>[h("关闭")]),_:1}),s(O,{type:"primary",onClick:k},{default:_(()=>[h("保存")]),_:1})]),default:_(()=>[s(D,{class:"ant-table-striped","keep-selection":!0,columns:o.columns,"data-source":y(a),scroll:{x:"max-content"},"row-class-name":(w,n)=>n%2===1?"table-striped":null},{bodyCell:_(({column:w,record:n})=>[V(S.$slots,"tb_cell",{data:{column:w,record:n}})]),_:3},8,["columns","data-source","row-class-name"])]),_:3},8,["visible"])])):u("",!0)}}};const re={class:"y-container"},se={key:0,class:"image-panel"},ie={key:4,class:"color-red"},ae={key:5},le={key:6},ce={class:"submit-panel"},de={key:0,class:"image-panel"},ue={key:1},me={style:{"margin-right":"20px"}},pe={class:"color-red"},_e={class:"color-red sumAmount"},ye={__name:"index",setup(c){const t=J(),o=v();v({});const d=v(""),i=v({id:20230116094803,content:{sa_promotionid:t.currentRoute.value.query.id,pageNumber:1,pageSize:20,where:{condition:d}}}),a=v([]),q=v([]),k=[{title:"图片",dataIndex:"image",width:100,ellipsis:!0},{title:"领域",dataIndex:"tradefield",width:180,ellipsis:!0},{title:"产品名称",dataIndex:"itemname",width:180,ellipsis:!0},{title:"产品编号",dataIndex:"itemno",width:180,ellipsis:!0},{title:"型号",dataIndex:"model",width:180,ellipsis:!0},{title:"规格",dataIndex:"spec",width:180,ellipsis:!0},{title:"特征码",dataIndex:"signaturecode",width:180,ellipsis:!0},{title:"原价",dataIndex:"oldprice",width:180,ellipsis:!0},{title:"促销价",dataIndex:"price",width:180,ellipsis:!0},{title:"数量",dataIndex:"qty",width:120,ellipsis:!0},{title:"单位",dataIndex:"unitname",width:90,ellipsis:!0},{title:"金额",dataIndex:"amount",width:180,ellipsis:!0},{title:"限购数量",dataIndex:"groupqty",width:180,ellipsis:!0,fixed:"right"}],S=j(()=>a.value.reduce((r,p)=>r+p.oldprice*p.qty,0)),C=async()=>{await R.requested({id:20221230144703,content:{sa_promotionid:t.currentRoute.value.query.id}})},$=async n=>{a.value=n,q.value=[...a.value,...q.value]},O=n=>{let r=n.filter(p=>p.groupqty>0).find((p,B,N)=>p.groupqty==p.saledqty);return r==null?!0:(G.error(`${r.itemname}已售罄`),!1)},D=n=>{x.validateInputNumber(n.orderminqty,n.qty,n.orderaddqty).then(r=>{n.qty=r})},A=()=>{if(console.log(),O(a.value))return M.confirm({title:"生成订单",content:`当前选中${a.value.length}个产品`,icon:s(Q),async onOk(){const n=await R.requested({id:20221128183202,content:{type:"促销订单",tradefield:"",sa_promotionid:t.currentRoute.value.query.id,items:a.value.map(r=>({sa_orderitemsid:0,itemid:r.itemid,sa_promotion_itemsid:r.sa_promotion_itemsid,sa_brandid:r.sa_brandid,qty:r.qty,signaturecode:r.signaturecode}))}});x.message(n,"提交成功",()=>{o.value.listData(),t.push({path:"/agent_orderDetails",query:{id:n.data.sa_orderid}})})},cancelText:"取消",onCancel(){M.destroyAll()}})},w=()=>{i.value.content.pageNumber=1,o.value.listData()};return H(()=>{C()}),(n,r)=>{const p=g("a-input"),B=g("a-image"),N=g("a-input-number");return l(),m("div",re,[s(W,{ref_key:"prod",ref:o,rowKey:"sa_promotion_itemsid",columns:k,param:i.value,hideBorder:!0,onOnSelect:$},{operation:_(()=>[s(p,{class:"search-input",value:d.value,"onUpdate:value":r[0]||(r[0]=e=>d.value=e),onKeyup:E(w,["enter"]),placeholder:"搜索产品"},null,8,["value","onKeyup"])]),tb_cell:_(({data:e})=>[e.column.dataIndex=="image"?(l(),m("div",se,[s(B,{width:80,src:e.record.attinfos[0]?e.record.attinfos[0].url:""},null,8,["src"])])):u("",!0),e.column.dataIndex=="qty"?(l(),F(N,{key:1,style:{width:"100%"},id:"inputNumber",value:e.record.qty,"onUpdate:value":I=>e.record.qty=I,min:e.record.orderminqty,step:e.record.orderaddqty,onBlur:I=>D(e.record)},null,8,["value","onUpdate:value","min","step","onBlur"])):u("",!0),e.column.dataIndex=="price"?(l(),m(P,{key:2},[h(" ¥ "+f(y(x).formatAmount(e.record.price)),1)],64)):u("",!0),e.column.dataIndex=="oldprice"?(l(),m(P,{key:3},[h(" ¥ "+f(y(x).formatAmount(e.record.oldprice)),1)],64)):u("",!0),e.column.dataIndex=="amount"?(l(),m("span",ie,"¥ "+f(y(x).formatAmount(e.record.qty*e.record.price)),1)):u("",!0),e.column.dataIndex=="tradefield"?(l(),m("span",ae,f(e.record.tradefield[0]?e.record.tradefield[0].tradefield:"--"),1)):u("",!0),e.column.dataIndex=="groupqty"?(l(),m("span",le,f(e.record.groupqty=="0"?"不限购":e.record.groupqty-e.record.saledqty<=0?"已售罄":e.record.groupqty-e.record.saledqty),1)):u("",!0)]),_:1},8,["param"]),b("div",ce,[s(oe,{columns:k},{tb_cell:_(({data:e})=>[e.column.dataIndex=="image"?(l(),m("div",de,[s(B,{width:80,src:e.record.attinfos[0]?e.record.attinfos[0].url:""},null,8,["src"])])):u("",!0),e.column.dataIndex=="tradefield"?(l(),m("span",ue,f(e.record.tradefield[0].tradefield),1)):u("",!0),e.column.dataIndex=="qty"?(l(),F(N,{key:2,style:{width:"100%"},id:"inputNumber",value:e.record.qty,"onUpdate:value":I=>e.record.qty=I,min:e.record.orderminqty,step:e.record.orderaddqty,onBlur:I=>D(e.record)},null,8,["value","onUpdate:value","min","step","onBlur"])):u("",!0)]),_:1}),b("p",null,[b("span",me,[h("当前选中了"),b("b",pe," "+f(a.value.length)+" ",1),h("条产品")]),h("合计:"),b("b",_e,f(y(x).formatAmount(y(S))),1)]),b("div",{class:"submit-btn",onClick:A},"创建订单")])])}}},qe=L(ye,[["__scopeId","data-v-9abe483c"]]);export{qe as default};