daShangDao_psiWebApp/dist/assets/releaseRecord.39e42534.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
15 KiB
JavaScript

import{_ as G,a8 as J,b as y,a0 as O,o as g,y as D,w as n,r as R,a as $,n as Q,$ as W,a5 as X,az as Z,d as z,e as o,h as l,c as I,ad as x,F as ee,aA as te,E as M,B as b,a1 as ae,A as se}from"./index.887c1a2d.js";import{g as ne}from"./shop.e55bece3.js";import{fetchShopProducts as Y}from"./product.ce626cf8.js";import"./request.92d2eb68.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}]}],K=(a=300)=>new Promise(e=>setTimeout(e,a)),ue=async({keyword:a,shop_type:e,status:_,page:w=1,pageSize:p=10})=>{await K();let v=[...oe];if(a){const h=a.toLowerCase();v=v.map(u=>{const r=(u.products||[]).filter(E=>E.name.toLowerCase().includes(h)||E.barcode.toLowerCase().includes(h));return{...u,products:r}}).filter(u=>u.shop_name.toLowerCase().includes(h)||u.shop_alias_name.toLowerCase().includes(h)||u.products&&u.products.length>0)}if(e&&(v=v.filter(h=>h.shop_type===Number(e))),_!=null&&_!==""){const h=Number(_);v=v.map(u=>{const r=(u.products||[]).filter(E=>E.status_in_shop===h);return{...u,products:r}}).filter(u=>u.products&&u.products.length>0)}const f=v.length,S=(w-1)*p;return{list:v.slice(S,S+p),total:f}},le=async(a,e,_)=>(await K(500),{code:200,msg:"\u91CD\u8BD5\u6210\u529F"});const ie={1:"success",2:"warning",5:"info"},re=J({name:"ReleaseRecord",setup(){const a=R(!1),e=R([]),_=R(""),w=$({shop_type:2,status:null}),p=$({current:1,pageSize:10,total:0}),v=Q(()=>Number(_.value)),f=R(0),S=s=>ie[s]||"info",F=s=>!s&&s!==0?"-":te.unix(Number(s)).format("YYYY-MM-DD HH:mm:ss"),h=s=>s?Array.isArray(s)&&s.length>0?s[0]:typeof s=="string"?s:"":"",u=s=>s?Array.isArray(s)?s.filter(i=>typeof i=="string"):typeof s=="string"?[s]:[]:[],r=async()=>{var s;if(!w.shop_type){e.value=[];return}a.value=!0;try{const[i,m]=await Promise.all([ne({shop_type:w.shop_type}),ue({shop_type:w.shop_type||void 0,status:(s=w.status)!=null?s:void 0,page:1,pageSize:9999})]),A=new Map((m.list||[]).map(C=>[C.id,C.products||[]])),B=(i.list||[]).map(C=>({...C,products:A.get(C.id)||[]}));e.value=B,B.length>0&&!_.value&&(_.value=String(B[0].id)),_.value&&await k()}catch{M.error({message:"\u83B7\u53D6\u53D1\u5E03\u8BB0\u5F55\u5931\u8D25",customClass:"scan-error-message"})}finally{a.value=!1}},E=()=>{r()},L=()=>{_.value="",r()},T=()=>{w.shop_type=null,w.status=null,E()},V=(s,i)=>{const m=e.value.find(A=>A.id===s);!m||le(m.id,i.id,m.shop_type).then(()=>{M.success({message:"\u91CD\u8BD5\u6210\u529F",customClass:"scan-success-message"}),r()}).catch(()=>{M.error({message:"\u91CD\u8BD5\u5931\u8D25",customClass:"scan-error-message"})})},j=async s=>{if(!!s){p.current=1;try{const{products:i,total:m,success_count:A,not_sent_count:B,failed_count:C}=await Y(s,p.current,p.pageSize),c=e.value.find(N=>String(N.id)===s);c&&(c.products=i,c.success_count=A,c.not_sent_count=B,c.failed_count=C,p.total=m),f.value++}catch(i){console.error("[ReleaseRecord] \u83B7\u53D6\u5E97\u94FA\u5546\u54C1\u5931\u8D25:",i)}}},k=async()=>{const s=_.value;if(!!s)try{const{products:i,total:m,success_count:A,not_sent_count:B,failed_count:C}=await Y(s,p.current,p.pageSize),c=e.value.find(N=>String(N.id)===s);c&&(c.products=i,c.success_count=A,c.not_sent_count=B,c.failed_count=C,p.total=m),f.value++}catch(i){console.error("[ReleaseRecord] \u83B7\u53D6\u5E97\u94FA\u5546\u54C1\u5931\u8D25:",i)}},q=s=>{p.current=s,k()},P=s=>{p.pageSize=s,p.current=1,k()},d=$({}),t=(s,i)=>{i&&(d[s]=i)},U=s=>{const i=d[s];!i||i.toggleAllSelection()},H=s=>{const i=e.value.find(c=>c.id===s);if(!i)return;const m=d[s];if(!m)return;const A=i.products||[],B=m.getSelectionRows(),C=new Set(B.map(c=>c.id));m.clearSelection(),A.forEach(c=>{C.has(c.id)||m.toggleRowSelection(c,!0)})};return W(()=>{r()}),{loading:a,tableData:e,activeTab:_,activeShopId:v,searchParams:w,productPagination:p,productsLoadKey:f,Search:X,Refresh:Z,shopTypeTag:S,formatTimestamp:F,getFirstImage:h,getImageList:u,handleSearch:L,resetSearch:T,handleTabChange:j,handleProductCurrentChange:q,handleProductSizeChange:P,handleRetry:V,handleSelectAll:U,handleSelectInverse:H,setTableRef:t}}}),de={class:"filter-bar"},ce={style:{"margin-bottom":"10px"},class:"tab-header"},pe={key:1,style:{width:"40px",height:"40px",display:"inline-flex","align-items":"center","justify-content":"center",color:"#c0c4cc","font-size":"12px"}};function _e(a,e,_,w,p,v){const f=y("el-option"),S=y("el-select"),F=y("el-button"),h=y("el-empty"),u=y("el-tag"),r=y("el-table-column"),E=y("el-image"),L=y("el-table"),T=y("el-pagination"),V=y("el-tab-pane"),j=y("el-tabs"),k=y("el-card"),q=O("loading");return g(),D(k,{class:"release-record-manager"},{header:n(()=>[...e[5]||(e[5]=[z("div",{class:"card-header"},"\u53D1\u5E03\u8BB0\u5F55",-1)])]),default:n(()=>{var P;return[z("div",de,[o(S,{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(f,{label:"\u62FC\u591A\u591A",value:1}),o(f,{label:"\u5B54\u592B\u5B50",value:2}),o(f,{label:"\u95F2\u9C7C",value:5})]),_:1},8,["modelValue","onChange"]),o(S,{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(f,{label:"\u53D1\u5E03\u6210\u529F",value:0}),o(f,{label:"\u4EFB\u52A1\u5DF2\u521B\u5EFA\u672A\u53D1\u9001\u5230\u5E97\u94FA",value:1}),o(f,{label:"\u53D1\u9001\u5230\u5E97\u94FA\u5931\u8D25",value:2})]),_:1},8,["modelValue"]),o(F,{type:"primary",icon:a.Search,onClick:a.handleSearch},{default:n(()=>[...e[6]||(e[6]=[l("\u641C\u7D22",-1)])]),_:1},8,["icon","onClick"]),o(F,{icon:a.Refresh,onClick:a.resetSearch},{default:n(()=>[...e[7]||(e[7]=[l("\u91CD\u7F6E",-1)])]),_:1},8,["icon","onClick"])]),a.searchParams.shop_type?(g(),D(j,{modelValue:a.activeTab,"onUpdate:modelValue":e[4]||(e[4]=d=>a.activeTab=d),type:"border-card",onTabChange:a.handleTabChange,key:(P=a.searchParams.shop_type)!=null?P:"none"},{default:n(()=>[(g(!0),I(ee,null,x(a.tableData,d=>(g(),D(V,{key:"pane-"+d.id+"-"+a.productsLoadKey,label:d.shop_alias_name,name:String(d.id)},{default:n(()=>[z("div",ce,[z("span",null,[o(F,{type:"primary",size:"small",onClick:t=>a.handleSelectAll(d.id)},{default:n(()=>[...e[8]||(e[8]=[l("\u5168\u9009",-1)])]),_:1},8,["onClick"]),o(F,{type:"success",size:"small",onClick:t=>a.handleSelectInverse(d.id)},{default:n(()=>[...e[9]||(e[9]=[l("\u53CD\u9009",-1)])]),_:1},8,["onClick"]),o(F,{type:"warning",size:"small"},{default:n(()=>[...e[10]||(e[10]=[l("\u91CD\u8BD5",-1)])]),_:1}),o(F,{type:"danger",size:"small"},{default:n(()=>[...e[11]||(e[11]=[l("\u53D1\u5E03",-1)])]),_:1})]),z("span",null,[o(u,{type:"primary",size:"small",style:{"margin-left":"5px"}},{default:n(()=>[l("\u53D1\u5E03\u5546\u54C1 "+b(a.productPagination.total)+" \u4E2A",1)]),_:1}),o(u,{type:"success",size:"small",style:{"margin-left":"5px"}},{default:n(()=>{var t;return[l("\u6210\u529F "+b((t=d.success_count)!=null?t:"-"),1)]}),_:2},1024),o(u,{type:"warning",size:"small",style:{"margin-left":"5px"}},{default:n(()=>{var t;return[l("\u4EFB\u52A1\u5DF2\u521B\u5EFA\u672A\u53D1\u9001\u5230\u5E97\u94FA "+b((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[l("\u53D1\u9001\u5230\u5E97\u94FA\u5931\u8D25 "+b((t=d.failed_count)!=null?t:"-"),1)]}),_:2},1024)])]),ae((g(),D(L,{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})=>[l(b(t.name||"-"),1)]),_:1}),o(r,{label:"\u5B9E\u62CD\u56FE",width:"80",align:"center"},{default:n(({row:t})=>[a.getFirstImage(t.live_image)?(g(),D(E,{key:0,src:a.getFirstImage(t.live_image),"preview-src-list":a.getImageList(t.live_image),style:{width:"40px",height:"40px","border-radius":"4px"},fit:"cover","preview-teleported":""},null,8,["src","preview-src-list"])):(g(),I("span",pe,"\u6682\u65E0"))]),_:1}),o(r,{label:"ISBN","min-width":"130","show-overflow-tooltip":"",align:"center"},{default:n(({row:t})=>[l(b(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})=>[l(b((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(()=>[l(b(t.warehouse_name||"\u672A\u843D\u4F4D"),1)]),_:2},1024),e[12]||(e[12]=l(" - ",-1)),o(u,{size:"small"},{default:n(()=>[l(b(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(()=>[l(b(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(()=>[l(b(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?(g(),D(u,{key:0,type:"warning",effect:"plain",size:"small"},{default:n(()=>[...e[13]||(e[13]=[l("\u4EFB\u52A1\u5DF2\u521B\u5EFA\u672A\u53D1\u9001\u5230\u5E97\u94FA",-1)])]),_:1})):t.out_task_log_id>0&&t.status_in_shop==0?(g(),D(u,{key:1,type:"danger",effect:"plain",size:"small"},{default:n(()=>[...e[14]||(e[14]=[l("\u53D1\u9001\u5230\u5E97\u94FA\u5931\u8D25",-1)])]),_:1})):t.out_task_log_id>0&&t.status_in_shop==1?(g(),D(u,{key:2,type:"success",effect:"plain",size:"small"},{default:n(()=>[...e[15]||(e[15]=[l("\u53D1\u5E03\u6210\u529F",-1)])]),_:1})):(g(),D(u,{key:3,effect:"plain",size:"small"},{default:n(()=>[...e[16]||(e[16]=[l("\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})=>[l(b(t.msg||"-"),1)]),_:1}),o(r,{label:"\u64CD\u4F5C",width:"80",align:"center"},{default:n(({row:t})=>[o(F,{type:"primary",link:"",size:"small",onClick:U=>a.handleRetry(a.activeShopId,t)},{default:n(()=>[...e[17]||(e[17]=[l("\u91CD\u8BD5",-1)])]),_:1},8,["onClick"])]),_:1})]),_:1},8,["data"])),[[q,a.loading]]),a.productPagination.total>a.productPagination.pageSize?(g(),D(T,{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"])):(g(),D(h,{key:0,description:"\u8BF7\u5148\u9009\u62E9\u5E97\u94FA\u7C7B\u578B","image-size":200}))]}),_:1})}var be=G(re,[["render",_e],["__scopeId","data-v-c39dbd1e"]]);export{be as default};