daShangDao_psiWebApp/dist/assets/product.9843f944.js
97694731 1fa4f33695
Some checks failed
CI / build (18.x) (push) Failing after 37m26s
CI / build (20.x) (push) Failing after 15s
CI / deploy-preview (push) Has been skipped
CI / lint (push) Failing after 16m50s
CI / test (push) Successful in 40m41s
CI / security (push) Successful in 29m36s
多拍
2026-06-25 14:37:30 +08:00

2 lines
4.9 KiB
JavaScript

import{r}from"./request.431ecd42.js";import"./axios.e318b91e.js";import"./index.173459ae.js";const u="/product",d=e=>{var s,o,a,n;const t=e==null?void 0:e.data;return t?Array.isArray(t)?{list:t,total:t.length,located_count:0,unlocated_count:0,enabled_count:0,disabled_count:0}:{list:Array.isArray(t.list)?t.list:[],total:typeof t.total=="number"?t.total:Array.isArray(t.list)?t.list.length:0,located_count:(s=t.located_count)!=null?s:0,unlocated_count:(o=t.unlocated_count)!=null?o:0,enabled_count:(a=t.enabled_count)!=null?a:0,disabled_count:(n=t.disabled_count)!=null?n:0}:{list:[],total:0,located_count:0,unlocated_count:0,enabled_count:0,disabled_count:0}},i=async({keyword:e,status:t,shop_id:s,page:o,pageSize:a})=>{const n={keyword:e||void 0,status:t,shop_id:s,page:o,page_size:a},c=await r.get(`${u}/list`,{params:n});return d(c)},y=async({shop_id:e,page:t=1,pageSize:s=10})=>i({shop_id:e,page:t,pageSize:s}),m=async e=>{const t=await r.get(`${u}/detail`,{params:{id:e}});return(t==null?void 0:t.data)||null},g=async e=>r.post(`${u}/save`,e),f=async e=>r.post(`${u}/save`,e),h=async e=>r.post(`${u}/save`,e),b=async({id:e,name:t,live_image:s,product_id:o})=>r.post(`${u}/updateNameAndImages`,{id:e,name:t,product_id:o,live_image:Array.isArray(s)?s.join(","):s}),A=async e=>r.post(`${u}/delete`,e),P=async(e,t,s={})=>{const{barcode:o,name:a,price:n,appearance:c}=s;return r.post("/product/save",{id:e,category_id:1,standard_product_id:1,is_batch_managed:0,is_shelf_life_managed:0,status:1,barcode:o,name:a,appearance:c!=null?c:85,price:n,live_image:[`https://shxy.image.yushutx.com/living-picture/${t}`]})},w=async(e,t,s={})=>{const{barcode:o,name:a,price:n,appearance:c}=s;return r.post("/product/save",{id:e,category_id:1,standard_product_id:1,is_batch_managed:0,is_shelf_life_managed:0,status:1,barcode:o,name:a,appearance:c!=null?c:85,price:n,live_image:[t]})},$=async(e,t,s={})=>{const{barcode:o,name:a,price:n,appearance:c}=s;return r.post("/product/save",{id:e,category_id:1,standard_product_id:1,is_batch_managed:0,is_shelf_life_managed:0,status:1,barcode:o,name:a,appearance:c!=null?c:85,price:n,live_image:["https://img.pddpic.com/open-gw/2025-12-01/181c6be7-c781-45ec-a2cc-397c5bbdd09e.jpeg"]})},v=async e=>r.get("/getSuitBook",{params:{isbn:e}}),D=async({book_name:e,author:t,publisher:s})=>{const o=await r.get("/getProCode",{params:{book_name:e,author:t,publisher:s}});return(o==null?void 0:o.data)||""},I=async e=>{const t=new FormData;return t.append("image",e,"capture.jpg"),r.post("/ocr",t,{headers:{"X-Need-Sign":"false"}})},L=async(e,t,s)=>{const o=new FormData;return o.append("product_id",e),o.append("shop_id",t),o.append("shop_type",s),r.post(`${u}/retry-out-task`,o)},S=async(e=20,t,s)=>{const o=await r.get(`${u}/list`,{params:{page:1,page_size:e,start_created_at:t,end_created_at:s}}),a=o==null?void 0:o.data;return Array.isArray(a)?a:Array.isArray(a==null?void 0:a.list)?a.list:[]},k=async(e,t,s=10)=>{const o=await r.get(`${u}/shop-detail`,{params:{shop_id:String(e),page:t,page_size:s}}),a=o==null?void 0:o.data;let n=[];return Array.isArray(a)?n=a:Array.isArray(a==null?void 0:a.list)?n=a.list:Array.isArray(a==null?void 0:a.products)&&(n=a.products),{products:n,total:typeof(a==null?void 0:a.total)=="number"?a.total:n.length,success_count:typeof(a==null?void 0:a.success_count)=="number"?a.success_count:0,not_sent_count:typeof(a==null?void 0:a.not_sent_count)=="number"?a.not_sent_count:0,failed_count:typeof(a==null?void 0:a.failed_count)=="number"?a.failed_count:0}},B=async e=>{const t=await r.get("/product/detail",{params:{id:e}});return(t==null?void 0:t.data)||null},x=async({userId:e,warehouse_id:t,file:s})=>{const o=new FormData;return o.append("user_id",e),o.append("warehouse_id",t),o.append("file",s),r.post("/goods/import-from-excel",o)},z=async e=>{var a,n;const t=new FormData;t.append("file",e);const s=await r.post("/upload/image",t),o=((a=s==null?void 0:s.data)==null?void 0:a.url)||((n=s==null?void 0:s.data)==null?void 0:n.file_path)||(s==null?void 0:s.data);if(o&&typeof o=="string")return o;throw new Error("\u4E0A\u4F20\u5931\u8D25\uFF0C\u672A\u83B7\u53D6\u5230\u56FE\u7247\u5730\u5740")},F=async({product_id:e})=>(await r.post(`${u}/destroy`,{product_id:e})).data,N=async({keyword:e,page:t,pageSize:s})=>{const o={keyword:e||void 0,page:t,page_size:s},a=await r.get(`${u}/destroy-log/list`,{params:o});return d(a)},j=async({destroy_log_id:e})=>(await r.post(`${u}/restore`,{destroy_log_id:e})).data;export{g as createProduct,A as deleteProduct,F as destroyProduct,N as fetchDestroyLog,S as fetchLatestProducts,m as fetchProductDetail,i as fetchProductList,y as fetchProductListByShop,k as fetchShopProducts,B as getBookDetails,D as getProCode,v as getSuitBook,x as importProductsByExcel,I as ocrImage,j as restoreProduct,L as retryProductPublish,f as saveProduct,b as updateNameAndImages,h as updateProduct,P as updateProductLiveImage,w as updateProductLiveImageAsPddUrl,$ as updateProductLiveImageForTest,z as uploadProductImage};