daShangDao_psiWebApp/dist/assets/salesInfoList.ecc67a18.js
97694731 44ba8a631c
Some checks failed
CI / build (20.x) (push) Waiting to run
CI / lint (push) Waiting to run
CI / test (push) Waiting to run
CI / deploy-preview (push) Blocked by required conditions
CI / security (push) Waiting to run
CI / build (18.x) (push) Has been cancelled
1
2026-06-15 18:09:39 +08:00

2 lines
16 KiB
JavaScript

import{_ as Be,a8 as Se,b as f,a0 as ke,o as _,y as L,w as o,r as m,a as X,n as Oe,$ as Ve,x as ze,a5 as qe,az as Le,a4 as Me,U as Ie,av as Pe,aC as Re,aL as Ye,d as p,e as u,g as se,c as H,ad as Z,F as x,h as c,a1 as re,B as i,aM as ie,A as Te,aA as ee,E as M,C as Ue}from"./index.887c1a2d.js";import{b as Ne,r as Ke,f as de}from"./salesOrder.fc7cf1ab.js";import{e as $e}from"./outbound.8072fc75.js";import{createWaveOutbound as We,createWaveOutboundRelease as je}from"./waveTask.d1acf765.js";import{g as Ge}from"./barcode.2f7b4cc5.js";import{a as He}from"./warehouse.41a1bb2f.js";import"./request.92d2eb68.js";import"./axios.e318b91e.js";const ae={1:{label:"\u8349\u7A3F",type:"info"},2:{label:"\u5DF2\u786E\u8BA4",type:"info"},3:{label:"\u5DF2\u5206\u914D\u5E93\u5B58",type:"info"},4:{label:"\u62E3\u8D27\u4E2D",type:"warning"},5:{label:"\u5DF2\u53D1\u8D27",type:"success"},6:{label:"\u5DF2\u53D6\u6D88",type:"danger"}},Je=Se({name:"SalesOrder",setup(){const a=m(!1),l=m(!1),J=m([]),te=Object.entries(ae).map(([t,{label:d}])=>({value:Number(t),label:d})),F=X({keyword:"",status:null,warehouse_id:null,customer_id:null}),D=X({current:1,pageSize:20,total:0}),T=m(!1),U=m("\u65B0\u5EFA\u9500\u552E\u8BA2\u5355"),I=m(null),v=X({id:null,so_no:"",customer_id:null,warehouse_id:null,order_date:"",required_delivery_date:"",sales_person:"",remark:"",items:[]}),P={so_no:[{required:!0,message:"\u9500\u552E\u8BA2\u5355\u53F7\u4E0D\u80FD\u4E3A\u7A7A",trigger:"blur"}],customer_id:[{required:!0,message:"\u8BF7\u9009\u62E9\u5E73\u53F0",trigger:"change"}],warehouse_id:[{required:!0,message:"\u8BF7\u9009\u62E9\u4ED3\u5E93",trigger:"change"}],order_date:[{required:!0,message:"\u8BF7\u9009\u62E9\u8BA2\u5355\u65E5\u671F",trigger:"change"}]},E=m([]),r=m(!1),N=m([]),K=m({}),$=m({}),R=m(!1),C=m(!1),Y=m(!1),O=m([]),e=m(""),n=m([]),s=m(null),g=m(""),h=m(""),w=Oe(()=>v.items.reduce((t,d)=>t+d.amount_yuan,0)),y=t=>{var d;return((d=ae[t])==null?void 0:d.label)||"\u672A\u77E5"},A=t=>{var d;return((d=ae[t])==null?void 0:d.type)||"info"},B=t=>!t&&t!==0?"-":ee.unix(Number(t)).format("YYYY-MM-DD HH:mm"),S=t=>t?typeof t=="number"&&t<1e10?ee.unix(t).format("YYYY-MM-DD"):ee(t).format("YYYY-MM-DD"):"-",ce=t=>!t&&t!==0?"\xA50.00":"\xA5"+(Number(t)/100).toFixed(2),me=t=>{t.amount_yuan=t.unit_price_yuan*t.quantity},pe=(t,d)=>{},ue=async(t="")=>{r.value=!0;try{const d=await He({keyword:t,page:1,pageSize:9999});E.value=d.list||[];const b={};for(const k of d.list)b[String(k.id)]=k.name||k.code||String(k.id);K.value=b}catch{}finally{r.value=!1}},V=async()=>{a.value=!0;try{const t=await Ne({page:D.current,pageSize:D.pageSize});J.value=t.list||[],D.total=t.total||0}catch{M.error({message:"\u52A0\u8F7D\u9500\u552E\u8BA2\u5355\u5217\u8868\u5931\u8D25",customClass:"scan-error-message"})}finally{a.value=!1}},ge=()=>{D.current=1,V()},fe=()=>{F.keyword="",F.status=null,F.warehouse_id=null,F.customer_id=null,D.current=1,V()},he=t=>{D.pageSize=t,V()},be=t=>{D.current=t,V()},we=()=>{v.items.push({product_id:null,unit_price_yuan:0,quantity:1,amount_yuan:0})},ye=t=>{v.items.splice(t,1)},_e=async(t,d)=>{try{const{value:b}=await Ue.prompt("\u8BF7\u8F93\u5165\u9000\u8D27\u5907\u6CE8\uFF08\u9009\u586B\uFF09","\u9000\u8D27\u786E\u8BA4",{confirmButtonText:"\u786E\u5B9A\u9000\u8D27",cancelButtonText:"\u53D6\u6D88",inputType:"textarea",inputPlaceholder:"\u9000\u8D27\u5907\u6CE8"}).catch(()=>({value:""}));await Ke({sales_order_id:t.id,sales_order_item_id:d.id,remark:b||""}),M.success({message:"\u9000\u8D27\u6210\u529F",customClass:"scan-success-message"}),V()}catch(b){if(b==="cancel")return;M.error({message:(b==null?void 0:b.message)||"\u9000\u8D27\u5931\u8D25",customClass:"scan-error-message"})}},De=async()=>{R.value=!0,e.value="",n.value=[],C.value=!0;try{const t=await de({keyword:"",status:3,page:1,pageSize:100});O.value=t.list||[]}catch{M.error({message:"\u52A0\u8F7D\u9500\u552E\u8BA2\u5355\u5931\u8D25",customClass:"scan-error-message"})}finally{C.value=!1}},ve=async()=>{C.value=!0;try{const t=await de({keyword:e.value,status:3,page:1,pageSize:100});O.value=t.list||[]}catch{}finally{C.value=!1}},Ee=t=>{n.value=t},Fe=t=>{var d;(d=s.value)==null||d.toggleRowSelection(t)},Ce=async()=>{var t,d,b,k;if(n.value.length!==0){Y.value=!0;try{const z=n.value.map(q=>q.id),Ae=z.length,W=await $e(z,Ae,g.value);console.log("\u521B\u5EFA\u51FA\u5E93\u5355\u54CD\u5E94:",W);const Q=(t=W==null?void 0:W.data)==null?void 0:t.outbound_order_id;if(Q){const q=await We(Q);console.log("\u521B\u5EFA\u6CE2\u6B21\u51FA\u5E93\u54CD\u5E94:",q);const oe=(d=q==null?void 0:q.data)==null?void 0:d.wave_id;if(oe){const j=await je(Q,oe);console.log("\u91CA\u653E\u6CE2\u6B21\u51FA\u5E93\u54CD\u5E94:",j);const le=(b=j==null?void 0:j.data)==null?void 0:b.wave_no;if(le){const G=await Ge(le);console.log("\u751F\u6210\u6761\u7801\u54CD\u5E94:",G);const ne=(k=G==null?void 0:G.data)==null?void 0:k.image_base64;ne&&(h.value=`data:image/jpeg;base64,${ne}`)}}}M.success({message:"\u6210\u529F\u751F\u6210\u51FA\u5E93\u5355",customClass:"scan-success-message"}),g.value="",h.value||(R.value=!1)}catch(z){M.error({message:(z==null?void 0:z.message)||"\u751F\u6210\u51FA\u5E93\u5355\u5931\u8D25",customClass:"scan-error-message"})}finally{Y.value=!1}}};return Ve(()=>{const t=ze();t.query.keyword&&(F.keyword=t.query.keyword),ue(""),V()}),{loading:a,submitLoading:l,tableData:J,statusOptions:te,searchParams:F,pagination:D,dialogVisible:T,dialogTitle:U,formRef:I,formData:v,formRules:P,warehouseOptions:E,warehouseLoading:r,loadWarehouses:ue,customerOptions:N,warehouseMap:K,customerMap:$,totalAmountYuan:w,statusLabel:y,statusTagType:A,formatTimestamp:B,formatDate:S,formatAmount:ce,calculateAmount:me,onProductChange:pe,handleSearch:ge,resetSearch:fe,handleSizeChange:he,handleCurrentChange:be,addItem:we,removeItem:ye,refundGoods:_e,openOutboundDialog:De,outboundDialogVisible:R,outboundLoading:C,outboundOrderList:O,outboundSearchKeyword:e,selectedOutboundOrders:n,outboundTableRef:s,outboundRemark:g,barcodeImage:h,handleOutboundSelectionChange:Ee,handleRowClick:Fe,handleOutboundSearch:ve,handleGenerateOutbound:Ce,generateLoading:Y,Search:qe,Refresh:Le,Plus:Me,Edit:Ie,Delete:Pe,View:Re,Check:Ye}}}),Qe={class:"filter-bar"},Xe={style:{color:"#e6a23c"}},Ze={style:{color:"#409eff","font-weight":"600"}},xe={style:{color:"#f56c6c","font-weight":"600"}},ea={style:{color:"#e6a23c","font-weight":"600"}},aa={class:"pagination-wrapper"},ta={class:"outbound-search-bar"},ua={class:"selected-tip"},oa={style:{color:"#e6a23c","font-weight":"600"}},la={style:{"margin-top":"16px"}},na={key:0,style:{"margin-top":"16px","text-align":"center"}},sa=["src"];function ra(a,l,J,te,F,D){const T=f("Search"),U=f("el-icon"),I=f("el-input"),v=f("el-option"),P=f("el-select"),E=f("el-button"),r=f("el-table-column"),N=f("el-tag"),K=f("el-link"),$=f("el-table"),R=f("el-pagination"),C=f("el-dialog"),Y=f("el-card"),O=ke("loading");return _(),L(Y,{class:"sales-order-manager"},{header:o(()=>[...l[10]||(l[10]=[p("div",{class:"card-header"},"\u8BA2\u5355\u5217\u8868",-1)])]),default:o(()=>[p("div",Qe,[u(I,{modelValue:a.searchParams.keyword,"onUpdate:modelValue":l[0]||(l[0]=e=>a.searchParams.keyword=e),placeholder:"\u9500\u552E\u8BA2\u5355\u53F7",clearable:"",style:{width:"220px"},onKeyup:se(a.handleSearch,["enter"])},{prefix:o(()=>[u(U,null,{default:o(()=>[u(T)]),_:1})]),_:1},8,["modelValue","onKeyup"]),u(P,{modelValue:a.searchParams.status,"onUpdate:modelValue":l[1]||(l[1]=e=>a.searchParams.status=e),placeholder:"\u72B6\u6001",clearable:"",style:{width:"140px"}},{default:o(()=>[(_(!0),H(x,null,Z(a.statusOptions,e=>(_(),L(v,{key:e.value,label:e.label,value:e.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"]),u(P,{modelValue:a.searchParams.warehouse_id,"onUpdate:modelValue":l[2]||(l[2]=e=>a.searchParams.warehouse_id=e),placeholder:"\u4ED3\u5E93",clearable:"",filterable:"",remote:"","reserve-keyword":"","remote-method":a.loadWarehouses,loading:a.warehouseLoading,style:{width:"160px"}},{default:o(()=>[(_(!0),H(x,null,Z(a.warehouseOptions,e=>(_(),L(v,{key:e.id,label:e.name,value:e.id},null,8,["label","value"]))),128))]),_:1},8,["modelValue","remote-method","loading"]),u(P,{modelValue:a.searchParams.customer_id,"onUpdate:modelValue":l[3]||(l[3]=e=>a.searchParams.customer_id=e),placeholder:"\u5E73\u53F0",clearable:"",filterable:"",style:{width:"180px"}},{default:o(()=>[(_(!0),H(x,null,Z(a.customerOptions,e=>(_(),L(v,{key:e.id,label:e.name,value:e.id},null,8,["label","value"]))),128))]),_:1},8,["modelValue"]),u(E,{type:"primary",icon:a.Search,onClick:a.handleSearch},{default:o(()=>[...l[11]||(l[11]=[c("\u641C\u7D22",-1)])]),_:1},8,["icon","onClick"]),u(E,{icon:a.Refresh,onClick:a.resetSearch},{default:o(()=>[...l[12]||(l[12]=[c("\u91CD\u7F6E",-1)])]),_:1},8,["icon","onClick"]),l[14]||(l[14]=p("div",{style:{flex:"1"}},null,-1)),u(E,{type:"success",icon:a.Plus,onClick:a.openOutboundDialog},{default:o(()=>[...l[13]||(l[13]=[c("\u751F\u6210\u51FA\u5E93\u5355",-1)])]),_:1},8,["icon","onClick"])]),re((_(),L($,{data:a.tableData,border:"",stripe:"",style:{width:"100%"}},{default:o(()=>[u(r,{prop:"so_no",label:"\u9500\u552E\u8BA2\u5355\u53F7","min-width":"170","show-overflow-tooltip":"",align:"center"}),u(r,{label:"\u5546\u54C1\u540D\u79F0","min-width":"150","show-overflow-tooltip":"",align:"center"},{default:o(({row:e})=>{var n,s;return[c(i(((s=(n=e.items)==null?void 0:n[0])==null?void 0:s.product_name)||"-"),1)]}),_:1}),u(r,{label:"ISBN/\u6761\u7801",width:"130","show-overflow-tooltip":"",align:"center"},{default:o(({row:e})=>{var n,s;return[c(i(((s=(n=e.items)==null?void 0:n[0])==null?void 0:s.product_code)||"-"),1)]}),_:1}),u(r,{label:"\u5E73\u53F0","min-width":"120",align:"center"},{default:o(({row:e})=>[c(i(e.sales_person||"-"),1)]),_:1}),u(r,{label:"\u5355\u4EF7",width:"90",align:"center"},{default:o(({row:e})=>{var n,s;return[p("span",Xe,i(a.formatAmount((s=(n=e.items)==null?void 0:n[0])==null?void 0:s.unit_price)),1)]}),_:1}),u(r,{label:"\u8BA2\u8D2D\u6570\u91CF",width:"80",align:"center"},{default:o(({row:e})=>{var n,s,g;return[p("span",Ze,i((g=(s=(n=e.items)==null?void 0:n[0])==null?void 0:s.quantity)!=null?g:"-"),1)]}),_:1}),u(r,{label:"\u5DF2\u5206\u914D",width:"75",align:"center"},{default:o(({row:e})=>{var n,s,g,h,w,y,A,B,S;return[p("span",{style:ie({color:((g=(s=(n=e.items)==null?void 0:n[0])==null?void 0:s.allocated_quantity)!=null?g:0)>=((y=(w=(h=e.items)==null?void 0:h[0])==null?void 0:w.quantity)!=null?y:0)?"#67c23a":"#e6a23c"})},i((S=(B=(A=e.items)==null?void 0:A[0])==null?void 0:B.allocated_quantity)!=null?S:0),5)]}),_:1}),u(r,{label:"\u5DF2\u53D1\u8D27",width:"75",align:"center"},{default:o(({row:e})=>{var n,s,g,h,w,y,A,B,S;return[p("span",{style:ie({color:((g=(s=(n=e.items)==null?void 0:n[0])==null?void 0:s.shipped_quantity)!=null?g:0)>=((y=(w=(h=e.items)==null?void 0:h[0])==null?void 0:w.quantity)!=null?y:0)?"#67c23a":"#909399"})},i((S=(B=(A=e.items)==null?void 0:A[0])==null?void 0:B.shipped_quantity)!=null?S:0),5)]}),_:1}),u(r,{label:"\u5F85\u53D1\u8D27",width:"75",align:"center"},{default:o(({row:e})=>{var n,s,g,h,w,y;return[p("span",xe,i(((g=(s=(n=e.items)==null?void 0:n[0])==null?void 0:s.quantity)!=null?g:0)-((y=(w=(h=e.items)==null?void 0:h[0])==null?void 0:w.shipped_quantity)!=null?y:0)),1)]}),_:1}),u(r,{label:"\u6536\u8D27\u4EBA",width:"120","show-overflow-tooltip":"",align:"center"},{default:o(({row:e})=>{var n,s;return[c(i(((s=(n=e.items)==null?void 0:n[0])==null?void 0:s.receiver_name)||"-"),1)]}),_:1}),u(r,{label:"\u6536\u8D27\u4EBA\u7535\u8BDD",width:"130","show-overflow-tooltip":"",align:"center"},{default:o(({row:e})=>{var n,s;return[c(i(((s=(n=e.items)==null?void 0:n[0])==null?void 0:s.receiver_phone)||"-"),1)]}),_:1}),u(r,{label:"\u6536\u8D27\u5730\u5740","min-width":"160","show-overflow-tooltip":"",align:"center"},{default:o(({row:e})=>{var n,s;return[c(i(((s=(n=e.items)==null?void 0:n[0])==null?void 0:s.receiver_address)||"-"),1)]}),_:1}),u(r,{label:"\u4ED3\u5E93","min-width":"100",align:"center"},{default:o(({row:e})=>{var n,s;return[c(i(((s=(n=e.items)==null?void 0:n[0])==null?void 0:s.location_code)||"-"),1)]}),_:1}),u(r,{label:"\u5E97\u94FA/\u7C7B\u578B","min-width":"140",align:"center"},{default:o(({row:e})=>[p("span",null,i(e.shop_type_text||"-"),1)]),_:1}),u(r,{label:"\u8BA2\u5355\u65E5\u671F","min-width":"100",align:"center"},{default:o(({row:e})=>[c(i(a.formatDate(e.order_date)),1)]),_:1}),u(r,{prop:"status_text",label:"\u72B6\u6001",width:"90",align:"center"},{default:o(({row:e})=>[u(N,{size:"small","disable-transitions":""},{default:o(()=>[c(i(e.status_text),1)]),_:2},1024)]),_:1}),u(r,{label:"\u8BA2\u5355\u91D1\u989D","min-width":"100",align:"center"},{default:o(({row:e})=>[p("span",ea,i(a.formatAmount(e.total_amount)),1)]),_:1}),u(r,{label:"\u64CD\u4F5C",width:"70",fixed:"right",align:"center"},{default:o(({row:e})=>[u(K,{type:"danger",size:"small",onClick:n=>{var s;return a.refundGoods(e,(s=e.items)==null?void 0:s[0])}},{default:o(()=>[...l[15]||(l[15]=[c("\u7F3A\u8D27",-1)])]),_:1},8,["onClick"])]),_:1}),u(r,{prop:"remark",label:"\u5907\u6CE8","min-width":"120",fixed:"right","show-overflow-tooltip":"",align:"center"},{default:o(({row:e})=>[c(i(e.remark||"-"),1)]),_:1})]),_:1},8,["data"])),[[O,a.loading]]),p("div",aa,[u(R,{"current-page":a.pagination.current,"onUpdate:currentPage":l[4]||(l[4]=e=>a.pagination.current=e),"page-size":a.pagination.pageSize,"onUpdate:pageSize":l[5]||(l[5]=e=>a.pagination.pageSize=e),"page-sizes":[10,20,50,100],total:a.pagination.total,layout:"total, sizes, prev, pager, next, jumper",onSizeChange:a.handleSizeChange,onCurrentChange:a.handleCurrentChange},null,8,["current-page","page-size","total","onSizeChange","onCurrentChange"])]),u(C,{modelValue:a.outboundDialogVisible,"onUpdate:modelValue":l[9]||(l[9]=e=>a.outboundDialogVisible=e),title:"\u751F\u6210\u51FA\u5E93\u5355",width:"880px","destroy-on-close":""},{footer:o(()=>[u(E,{onClick:l[8]||(l[8]=e=>a.outboundDialogVisible=!1)},{default:o(()=>[...l[19]||(l[19]=[c("\u53D6\u6D88",-1)])]),_:1}),u(E,{type:"success",loading:a.generateLoading,disabled:a.selectedOutboundOrders.length===0,onClick:a.handleGenerateOutbound},{default:o(()=>[c(" \u786E\u8BA4\u751F\u6210\u51FA\u5E93\u5355 ("+i(a.selectedOutboundOrders.length)+") ",1)]),_:1},8,["loading","disabled","onClick"])]),default:o(()=>[p("div",ta,[u(I,{modelValue:a.outboundSearchKeyword,"onUpdate:modelValue":l[6]||(l[6]=e=>a.outboundSearchKeyword=e),placeholder:"\u641C\u7D22\u9500\u552E\u8BA2\u5355\u53F7 / \u5E73\u53F0 / \u4ED3\u5E93",clearable:"",style:{width:"320px"},onInput:a.handleOutboundSearch,onKeyup:se(a.handleOutboundSearch,["enter"])},{prefix:o(()=>[u(U,null,{default:o(()=>[u(T)]),_:1})]),_:1},8,["modelValue","onInput","onKeyup"]),p("span",ua,[l[16]||(l[16]=c("\u5DF2\u9009 ",-1)),p("strong",null,i(a.selectedOutboundOrders.length),1),l[17]||(l[17]=c(" \u5F20",-1))])]),re((_(),L($,{ref:"outboundTableRef",data:a.outboundOrderList,border:"",stripe:"",onSelectionChange:a.handleOutboundSelectionChange,onRowClick:a.handleRowClick},{default:o(()=>[u(r,{type:"selection",width:"55",align:"center"}),u(r,{prop:"so_no",label:"\u9500\u552E\u8BA2\u5355\u53F7","min-width":"180","show-overflow-tooltip":"",align:"center"}),u(r,{label:"\u5E73\u53F0","min-width":"150",align:"center"},{default:o(({row:e})=>[c(i(a.customerMap[e.customer_id]||"-"),1)]),_:1}),u(r,{label:"\u4ED3\u5E93","min-width":"120",align:"center"},{default:o(({row:e})=>[c(i(a.warehouseMap[e.warehouse_id]||"-"),1)]),_:1}),u(r,{label:"\u8BA2\u5355\u65E5\u671F","min-width":"110",align:"center"},{default:o(({row:e})=>[c(i(a.formatDate(e.order_date)),1)]),_:1}),u(r,{label:"\u8BA2\u5355\u91D1\u989D","min-width":"120",align:"center"},{default:o(({row:e})=>[p("span",oa,i(a.formatAmount(e.total_amount)),1)]),_:1}),u(r,{prop:"status_text",label:"\u72B6\u6001",width:"100",align:"center"},{default:o(({row:e})=>[u(N,{size:"small"},{default:o(()=>[c(i(e.status_text),1)]),_:2},1024)]),_:1})]),_:1},8,["data","onSelectionChange","onRowClick"])),[[O,a.outboundLoading]]),p("div",la,[u(I,{modelValue:a.outboundRemark,"onUpdate:modelValue":l[7]||(l[7]=e=>a.outboundRemark=e),type:"textarea",rows:2,placeholder:"\u8BF7\u8F93\u5165\u5907\u6CE8\uFF08\u9009\u586B\uFF09",maxlength:"200","show-word-limit":""},null,8,["modelValue"])]),a.barcodeImage?(_(),H("div",na,[l[18]||(l[18]=p("p",{style:{"margin-bottom":"8px",color:"#606266","font-size":"14px"}},"\u51FA\u5E93\u6761\u7801",-1)),p("img",{src:a.barcodeImage,alt:"\u6761\u7801",style:{"max-width":"400px",height:"auto"}},null,8,sa)])):Te("",!0)]),_:1},8,["modelValue"])]),_:1})}var ba=Be(Je,[["render",ra],["__scopeId","data-v-5297dbf6"]]);export{ba as default};