2 lines
16 KiB
JavaScript
2 lines
16 KiB
JavaScript
import{_ as O,a8 as Q,b as f,a0 as W,o as m,y as v,w as n,r as R,a as U,n as X,$ as Z,a5 as x,az as ee,d as S,e as o,h as i,c as Y,ad as K,F as H,aA as te,E as I,B as h,a1 as ae,A as se}from"./index.173459ae.js";import{g as ne}from"./shop.4514b209.js";import{fetchShopProducts as G}from"./product.9843f944.js";import"./request.431ecd42.js";import"./axios.e318b91e.js";const oe=[{id:1,shop_name:"\u535A\u77E5\u4E66\u793E",shop_alias_name:"\u535A\u77E5\u4E66\u793E(\u62FC\u591A\u591A)",shop_type:1,shop_type_name:"\u62FC\u591A\u591A",created_at:17e8,updated_at:1705e6,products:[{id:101,name:"\u4E09\u4F53\u5168\u96C6",barcode:"9787536692930",live_image:["https://img.pddpic.com/open-gw/2025-12-01/181c6be7-c781-45ec-a2cc-397c5bbdd09e.jpeg"],price:8800,sale_price:8800,quantity:20,warehouse_name:"\u4E00\u53F7\u4ED3\u5E93",location_code:"A-01-01",is_batch_managed:0,is_shelf_life_managed:0,out_task_log_id:12345,status_in_shop:1,msg:"\u53D1\u5E03\u6210\u529F",created_at:1701e6,updated_at:1702e6},{id:102,name:"\u6D3B\u7740",barcode:"9787506365437",live_image:[],price:3500,sale_price:3500,quantity:15,warehouse_name:"\u4E00\u53F7\u4ED3\u5E93",location_code:"A-01-02",is_batch_managed:1,is_shelf_life_managed:0,out_task_log_id:0,status_in_shop:0,msg:"\u4EFB\u52A1\u5DF2\u521B\u5EFA\u672A\u53D1\u9001\u5230\u5E97\u94FA",created_at:17015e5,updated_at:17025e5},{id:103,name:"\u767E\u5E74\u5B64\u72EC",barcode:"9787544253994",live_image:["https://img.pddpic.com/open-gw/2025-12-01/181c6be7-c781-45ec-a2cc-397c5bbdd09e.jpeg"],price:5500,sale_price:5500,quantity:8,warehouse_name:"\u4E00\u53F7\u4ED3\u5E93",location_code:"A-01-03",is_batch_managed:0,is_shelf_life_managed:0,out_task_log_id:12346,status_in_shop:1,msg:"\u53D1\u5E03\u6210\u529F",created_at:17012e5,updated_at:17022e5}]},{id:2,shop_name:"\u5B54\u592B\u5B50\u65E7\u4E66\u7F51",shop_alias_name:"\u5B54\u592B\u5B50\u65E7\u4E66\u7F51(\u5B54\u592B\u5B50)",shop_type:2,shop_type_name:"\u5B54\u592B\u5B50",created_at:1699e6,updated_at:1704e6,products:[{id:201,name:"\u7EA2\u697C\u68A6",barcode:"9787020002207",live_image:["https://img.pddpic.com/open-gw/2025-12-01/181c6be7-c781-45ec-a2cc-397c5bbdd09e.jpeg"],price:6800,sale_price:6800,quantity:5,warehouse_name:"\u4E8C\u53F7\u4ED3\u5E93",location_code:"B-02-01",is_batch_managed:0,is_shelf_life_managed:0,out_task_log_id:23456,status_in_shop:0,msg:"\u53D1\u9001\u5230\u5E97\u94FA\u5931\u8D25",created_at:17008e5,updated_at:17018e5},{id:202,name:"\u897F\u6E38\u8BB0",barcode:"9787020002208",live_image:[],price:7200,sale_price:7200,quantity:3,warehouse_name:"\u4E8C\u53F7\u4ED3\u5E93",location_code:"B-02-02",is_batch_managed:0,is_shelf_life_managed:0,out_task_log_id:0,status_in_shop:0,msg:"\u4EFB\u52A1\u5DF2\u521B\u5EFA\u672A\u53D1\u9001\u5230\u5E97\u94FA",created_at:17009e5,updated_at:17019e5}]},{id:3,shop_name:"\u95F2\u9C7C\u4F18\u9009",shop_alias_name:"\u95F2\u9C7C\u4F18\u9009(\u95F2\u9C7C)",shop_type:5,shop_type_name:"\u95F2\u9C7C",created_at:1698e6,updated_at:1703e6,products:[]},{id:4,shop_name:"\u65B0\u77E5\u56FE\u4E66",shop_alias_name:"\u65B0\u77E5\u56FE\u4E66(\u62FC\u591A\u591A)",shop_type:1,shop_type_name:"\u62FC\u591A\u591A",created_at:1702e6,updated_at:1706e6,products:[{id:401,name:"\u56F4\u57CE",barcode:"9787020024759",live_image:["https://img.pddpic.com/open-gw/2025-12-01/181c6be7-c781-45ec-a2cc-397c5bbdd09e.jpeg"],price:2900,sale_price:2900,quantity:12,warehouse_name:"\u4E00\u53F7\u4ED3\u5E93",location_code:"A-03-01",is_batch_managed:0,is_shelf_life_managed:0,out_task_log_id:34567,status_in_shop:1,msg:"\u53D1\u5E03\u6210\u529F",created_at:17025e5,updated_at:17035e5},{id:402,name:"\u5E73\u51E1\u7684\u4E16\u754C",barcode:"9787530210135",live_image:[],price:8800,sale_price:8800,quantity:7,warehouse_name:"\u4E00\u53F7\u4ED3\u5E93",location_code:"A-03-02",is_batch_managed:1,is_shelf_life_managed:0,out_task_log_id:34568,status_in_shop:1,msg:"\u53D1\u5E03\u6210\u529F",created_at:17026e5,updated_at:17036e5},{id:403,name:"\u4EBA\u7C7B\u7B80\u53F2",barcode:"9787508688361",live_image:["https://img.pddpic.com/open-gw/2025-12-01/181c6be7-c781-45ec-a2cc-397c5bbdd09e.jpeg"],price:4200,sale_price:4200,quantity:10,warehouse_name:"\u4E00\u53F7\u4ED3\u5E93",location_code:"A-03-03",is_batch_managed:0,is_shelf_life_managed:1,out_task_log_id:34569,status_in_shop:0,msg:"\u53D1\u9001\u5230\u5E97\u94FA\u5931\u8D25",created_at:17027e5,updated_at:17037e5}]}],J=(a=300)=>new Promise(e=>setTimeout(e,a)),le=async({keyword:a,shop_type:e,status:g,page:A=1,pageSize:_=10})=>{await J();let C=[...oe];if(a){const b=a.toLowerCase();C=C.map(u=>{const r=(u.products||[]).filter(B=>B.name.toLowerCase().includes(b)||B.barcode.toLowerCase().includes(b));return{...u,products:r}}).filter(u=>u.shop_name.toLowerCase().includes(b)||u.shop_alias_name.toLowerCase().includes(b)||u.products&&u.products.length>0)}if(e&&(C=C.filter(b=>b.shop_type===Number(e))),g!=null&&g!==""){const b=Number(g);C=C.map(u=>{const r=(u.products||[]).filter(B=>B.status_in_shop===b);return{...u,products:r}}).filter(u=>u.products&&u.products.length>0)}const y=C.length,k=(A-1)*_;return{list:C.slice(k,k+_),total:y}},ue=async(a,e,g)=>(await J(500),{code:200,msg:"\u91CD\u8BD5\u6210\u529F"});const ie={1:"success",2:"warning",5:"info"},re=Q({name:"ReleaseRecord",setup(){const a=R(!1),e=R([]),g=R(""),A=U({shop_type:2,status:null}),_=U({current:1,pageSize:10,total:0}),C=X(()=>Number(g.value)),y=R(0),k=s=>ie[s]||"info",D=s=>!s&&s!==0?"-":te.unix(Number(s)).format("YYYY-MM-DD HH:mm:ss"),b=s=>{if(!s)return[];if(Array.isArray(s)){const l=[];for(const c of s)typeof c=="string"&&(c.includes(",")?l.push(...c.split(",").map(w=>w.trim()).filter(Boolean)):l.push(c));return l}return typeof s=="string"?s.includes(",")?s.split(",").map(l=>l.trim()).filter(Boolean):[s]:[]},u=s=>{if(!s)return"";if(Array.isArray(s)&&s.length>0){const l=String(s[0]);return l.includes(",")?l.split(",")[0].trim():l}return typeof s=="string"?s.includes(",")?s.split(",")[0].trim():s:""},r=async()=>{var s;if(!A.shop_type){e.value=[];return}a.value=!0;try{const[l,c]=await Promise.all([ne({shop_type:A.shop_type}),le({shop_type:A.shop_type||void 0,status:(s=A.status)!=null?s:void 0,page:1,pageSize:9999})]),w=new Map((c.list||[]).map(F=>[F.id,F.products||[]])),E=(l.list||[]).map(F=>({...F,products:w.get(F.id)||[]}));e.value=E,E.length>0&&!g.value&&(g.value=String(E[0].id)),g.value&&await P()}catch{I.error({message:"\u83B7\u53D6\u53D1\u5E03\u8BB0\u5F55\u5931\u8D25",customClass:"scan-error-message"})}finally{a.value=!1}},B=()=>{r()},T=()=>{g.value="",r()},V=()=>{A.shop_type=null,A.status=null,B()},q=(s,l)=>{const c=e.value.find(w=>w.id===s);!c||ue(c.id,l.id,c.shop_type).then(()=>{I.success({message:"\u91CD\u8BD5\u6210\u529F",customClass:"scan-success-message"}),r()}).catch(()=>{I.error({message:"\u91CD\u8BD5\u5931\u8D25",customClass:"scan-error-message"})})},N=async s=>{if(!!s){_.current=1;try{const{products:l,total:c,success_count:w,not_sent_count:E,failed_count:F}=await G(s,_.current,_.pageSize),p=e.value.find(M=>String(M.id)===s);p&&(p.products=l,p.success_count=w,p.not_sent_count=E,p.failed_count=F,_.total=c),y.value++}catch(l){console.error("[ReleaseRecord] \u83B7\u53D6\u5E97\u94FA\u5546\u54C1\u5931\u8D25:",l)}}},P=async()=>{const s=g.value;if(!!s)try{const{products:l,total:c,success_count:w,not_sent_count:E,failed_count:F}=await G(s,_.current,_.pageSize),p=e.value.find(M=>String(M.id)===s);p&&(p.products=l,p.success_count=w,p.not_sent_count=E,p.failed_count=F,_.total=c),y.value++}catch(l){console.error("[ReleaseRecord] \u83B7\u53D6\u5E97\u94FA\u5546\u54C1\u5931\u8D25:",l)}},j=s=>{_.current=s,P()},$=s=>{_.pageSize=s,_.current=1,P()},z=U({}),d=(s,l)=>{l&&(z[s]=l)},t=s=>{const l=z[s];!l||l.toggleAllSelection()},L=s=>{const l=e.value.find(p=>p.id===s);if(!l)return;const c=z[s];if(!c)return;const w=l.products||[],E=c.getSelectionRows(),F=new Set(E.map(p=>p.id));c.clearSelection(),w.forEach(p=>{F.has(p.id)||c.toggleRowSelection(p,!0)})};return Z(()=>{r()}),{loading:a,tableData:e,activeTab:g,activeShopId:C,searchParams:A,productPagination:_,productsLoadKey:y,Search:x,Refresh:ee,shopTypeTag:k,formatTimestamp:D,getFirstImage:u,getImageList:b,handleSearch:T,resetSearch:V,handleTabChange:N,handleProductCurrentChange:j,handleProductSizeChange:$,handleRetry:q,handleSelectAll:t,handleSelectInverse:L,setTableRef:d}}}),de={class:"filter-bar"},ce={style:{"margin-bottom":"10px"},class:"tab-header"},pe={class:"popover-image-gallery"},_e={class:"popover-gallery-title"},me={class:"popover-gallery-list"},ge={key:1,style:{color:"#c0c4cc"}};function fe(a,e,g,A,_,C){const y=f("el-option"),k=f("el-select"),D=f("el-button"),b=f("el-empty"),u=f("el-tag"),r=f("el-table-column"),B=f("el-image"),T=f("el-popover"),V=f("el-table"),q=f("el-pagination"),N=f("el-tab-pane"),P=f("el-tabs"),j=f("el-card"),$=W("loading");return m(),v(j,{class:"release-record-manager"},{header:n(()=>[...e[5]||(e[5]=[S("div",{class:"card-header"},"\u53D1\u5E03\u8BB0\u5F55",-1)])]),default:n(()=>{var z;return[S("div",de,[o(k,{modelValue:a.searchParams.shop_type,"onUpdate:modelValue":e[0]||(e[0]=d=>a.searchParams.shop_type=d),placeholder:"\u5E97\u94FA\u7C7B\u578B",clearable:"",style:{width:"140px"},onChange:a.handleSearch},{default:n(()=>[o(y,{label:"\u62FC\u591A\u591A",value:1}),o(y,{label:"\u5B54\u592B\u5B50",value:2}),o(y,{label:"\u95F2\u9C7C",value:5})]),_:1},8,["modelValue","onChange"]),o(k,{modelValue:a.searchParams.status,"onUpdate:modelValue":e[1]||(e[1]=d=>a.searchParams.status=d),placeholder:"\u53D1\u5E03\u72B6\u6001",clearable:"",style:{width:"140px"}},{default:n(()=>[o(y,{label:"\u53D1\u5E03\u6210\u529F",value:0}),o(y,{label:"\u4EFB\u52A1\u5DF2\u521B\u5EFA\u672A\u53D1\u9001\u5230\u5E97\u94FA",value:1}),o(y,{label:"\u53D1\u9001\u5230\u5E97\u94FA\u5931\u8D25",value:2})]),_:1},8,["modelValue"]),o(D,{type:"primary",icon:a.Search,onClick:a.handleSearch},{default:n(()=>[...e[6]||(e[6]=[i("\u641C\u7D22",-1)])]),_:1},8,["icon","onClick"]),o(D,{icon:a.Refresh,onClick:a.resetSearch},{default:n(()=>[...e[7]||(e[7]=[i("\u91CD\u7F6E",-1)])]),_:1},8,["icon","onClick"])]),a.searchParams.shop_type?(m(),v(P,{modelValue:a.activeTab,"onUpdate:modelValue":e[4]||(e[4]=d=>a.activeTab=d),type:"border-card",onTabChange:a.handleTabChange,key:(z=a.searchParams.shop_type)!=null?z:"none"},{default:n(()=>[(m(!0),Y(H,null,K(a.tableData,d=>(m(),v(N,{key:"pane-"+d.id+"-"+a.productsLoadKey,label:d.shop_alias_name,name:String(d.id)},{default:n(()=>[S("div",ce,[S("span",null,[o(D,{type:"primary",size:"small",onClick:t=>a.handleSelectAll(d.id)},{default:n(()=>[...e[8]||(e[8]=[i("\u5168\u9009",-1)])]),_:1},8,["onClick"]),o(D,{type:"success",size:"small",onClick:t=>a.handleSelectInverse(d.id)},{default:n(()=>[...e[9]||(e[9]=[i("\u53CD\u9009",-1)])]),_:1},8,["onClick"]),o(D,{type:"warning",size:"small"},{default:n(()=>[...e[10]||(e[10]=[i("\u91CD\u8BD5",-1)])]),_:1}),o(D,{type:"danger",size:"small"},{default:n(()=>[...e[11]||(e[11]=[i("\u53D1\u5E03",-1)])]),_:1})]),S("span",null,[o(u,{type:"primary",size:"small",style:{"margin-left":"5px"}},{default:n(()=>[i("\u53D1\u5E03\u5546\u54C1 "+h(a.productPagination.total)+" \u4E2A",1)]),_:1}),o(u,{type:"success",size:"small",style:{"margin-left":"5px"}},{default:n(()=>{var t;return[i("\u6210\u529F "+h((t=d.success_count)!=null?t:"-"),1)]}),_:2},1024),o(u,{type:"warning",size:"small",style:{"margin-left":"5px"}},{default:n(()=>{var t;return[i("\u4EFB\u52A1\u5DF2\u521B\u5EFA\u672A\u53D1\u9001\u5230\u5E97\u94FA "+h((t=d.not_sent_count)!=null?t:"-"),1)]}),_:2},1024),o(u,{type:"danger",size:"small",style:{"margin-left":"5px"}},{default:n(()=>{var t;return[i("\u53D1\u9001\u5230\u5E97\u94FA\u5931\u8D25 "+h((t=d.failed_count)!=null?t:"-"),1)]}),_:2},1024)])]),ae((m(),v(V,{data:d.products||[],border:"",stripe:"",style:{width:"100%"},key:"table-"+d.id+"-"+a.productsLoadKey,ref_for:!0,ref:t=>a.setTableRef(d.id,t)},{default:n(()=>[o(r,{type:"selection","reserve-selection":!0,align:"center"}),o(r,{label:"\u5546\u54C1\u540D\u79F0","min-width":"120","show-overflow-tooltip":"",align:"center"},{default:n(({row:t})=>[i(h(t.name||"-"),1)]),_:1}),o(r,{label:"\u5B9E\u62CD\u56FE",width:"100",align:"center"},{default:n(({row:t})=>[a.getImageList(t.live_image).length>0?(m(),v(T,{key:0,placement:"right",width:360,trigger:"hover","open-delay":300,"close-delay":100,disabled:!1,teleported:!0},{reference:n(()=>[o(B,{src:a.getImageList(t.live_image)[0],"preview-src-list":a.getImageList(t.live_image),"initial-index":0,class:"image-thumb-single",fit:"cover","preview-teleported":""},null,8,["src","preview-src-list"])]),default:n(()=>[S("div",pe,[S("div",_e," \u5171"+h(a.getImageList(t.live_image).length)+"\u5F20\u56FE\u7247 ",1),S("div",me,[(m(!0),Y(H,null,K(a.getImageList(t.live_image),(L,s)=>(m(),v(B,{key:s,src:L,"preview-src-list":a.getImageList(t.live_image),"initial-index":s,class:"popover-gallery-item",fit:"cover","preview-teleported":""},null,8,["src","preview-src-list","initial-index"]))),128))])])]),_:2},1024)):(m(),Y("span",ge,"\u6682\u65E0"))]),_:1}),o(r,{label:"ISBN","min-width":"130","show-overflow-tooltip":"",align:"center"},{default:n(({row:t})=>[i(h(t.barcode||"--"),1)]),_:1}),o(r,{prop:"quantity",label:"\u5E93\u5B58",width:"80",align:"center"}),o(r,{label:"\u4EF7\u683C(\u5143)",width:"100",align:"center"},{default:n(({row:t})=>[i(h((t.sale_price/100).toFixed(2)),1)]),_:1}),o(r,{label:"\u4ED3\u5E93-\u5E93\u4F4D","min-width":"120",align:"center","show-overflow-tooltip":""},{default:n(({row:t})=>[o(u,{size:"small",type:"danger"},{default:n(()=>[i(h(t.warehouse_name||"\u672A\u843D\u4F4D"),1)]),_:2},1024),e[12]||(e[12]=i(" - ",-1)),o(u,{size:"small"},{default:n(()=>[i(h(t.location_code||"\u672A\u843D\u4F4D"),1)]),_:2},1024)]),_:1}),o(r,{label:"\u6279\u6B21\u7BA1\u7406",width:"90",align:"center"},{default:n(({row:t})=>[o(u,{type:t.is_batch_managed===1?"success":"info",size:"small"},{default:n(()=>[i(h(t.is_batch_managed===1?"\u662F":"\u5426"),1)]),_:2},1032,["type"])]),_:1}),o(r,{label:"\u6548\u671F\u7BA1\u7406",width:"90",align:"center"},{default:n(({row:t})=>[o(u,{type:t.is_shelf_life_managed===1?"success":"info",size:"small"},{default:n(()=>[i(h(t.is_shelf_life_managed===1?"\u662F":"\u5426"),1)]),_:2},1032,["type"])]),_:1}),o(r,{label:"\u53D1\u5E03\u72B6\u6001",width:"190",align:"center"},{default:n(({row:t})=>[t.out_task_log_id==0&&t.status_in_shop==0?(m(),v(u,{key:0,type:"warning",effect:"plain",size:"small"},{default:n(()=>[...e[13]||(e[13]=[i("\u4EFB\u52A1\u5DF2\u521B\u5EFA\u672A\u53D1\u9001\u5230\u5E97\u94FA",-1)])]),_:1})):t.out_task_log_id>0&&t.status_in_shop==0?(m(),v(u,{key:1,type:"danger",effect:"plain",size:"small"},{default:n(()=>[...e[14]||(e[14]=[i("\u53D1\u9001\u5230\u5E97\u94FA\u5931\u8D25",-1)])]),_:1})):t.out_task_log_id>0&&t.status_in_shop==1?(m(),v(u,{key:2,type:"success",effect:"plain",size:"small"},{default:n(()=>[...e[15]||(e[15]=[i("\u53D1\u5E03\u6210\u529F",-1)])]),_:1})):(m(),v(u,{key:3,effect:"plain",size:"small"},{default:n(()=>[...e[16]||(e[16]=[i("\u672A\u77E5\u72B6\u6001",-1)])]),_:1}))]),_:1}),o(r,{label:"\u53D1\u5E03\u6D88\u606F","min-width":"120","show-overflow-tooltip":"",align:"center"},{default:n(({row:t})=>[i(h(t.msg||"-"),1)]),_:1}),o(r,{label:"\u64CD\u4F5C",width:"160",align:"center"},{default:n(({row:t})=>[o(D,{type:"primary",link:"",size:"small",onClick:L=>a.handleRetry(a.activeShopId,t)},{default:n(()=>[...e[17]||(e[17]=[i("\u91CD\u8BD5",-1)])]),_:1},8,["onClick"]),o(D,{type:"danger",link:"",size:"small"},{default:n(()=>[...e[18]||(e[18]=[i("\u5220\u9664",-1)])]),_:1})]),_:1})]),_:1},8,["data"])),[[$,a.loading]]),a.productPagination.total>a.productPagination.pageSize?(m(),v(q,{key:0,"current-page":a.productPagination.current,"onUpdate:currentPage":e[2]||(e[2]=t=>a.productPagination.current=t),"page-size":a.productPagination.pageSize,"onUpdate:pageSize":e[3]||(e[3]=t=>a.productPagination.pageSize=t),"page-sizes":[10,20,50,100],total:a.productPagination.total,layout:"total, sizes, prev, pager, next, jumper",onSizeChange:a.handleProductSizeChange,onCurrentChange:a.handleProductCurrentChange,style:{"margin-top":"10px","justify-content":"flex-end"}},null,8,["current-page","page-size","total","onSizeChange","onCurrentChange"])):se("",!0)]),_:2},1032,["label","name"]))),128))]),_:1},8,["modelValue","onTabChange"])):(m(),v(b,{key:0,description:"\u8BF7\u5148\u9009\u62E9\u5E97\u94FA\u7C7B\u578B","image-size":200}))]}),_:1})}var De=O(re,[["render",fe],["__scopeId","data-v-27f98f4e"]]);export{De as default};
|