daShangDao_psiWebApp/dist/assets/product.f8323858.js
凌尛 e3e3204354
Some checks failed
CI / build (18.x) (push) Failing after 16m52s
CI / build (20.x) (push) Failing after 13m36s
CI / deploy-preview (push) Has been skipped
CI / lint (push) Failing after 1m34s
CI / test (push) Failing after 34s
CI / security (push) Failing after 1m35s
提交代码
2026-06-22 10:25:21 +08:00

2 lines
3.6 KiB
JavaScript

import{r as o}from"./request.eff82867.js";import"./axios.06b5038b.js";import"./index.05bb0cbe.js";const i="/product",u=r=>{const e=r==null?void 0:r.data;return e?Array.isArray(e)?{list:e,total:e.length}:{list:Array.isArray(e.list)?e.list:[],total:typeof e.total=="number"?e.total:Array.isArray(e.list)?e.list.length:0}:{list:[],total:0}},d=async({keyword:r,status:e,shop_id:a,page:s,pageSize:t})=>{const c={keyword:r||void 0,status:e,shop_id:a,page:s,page_size:t},n=await o.get(`${i}/list`,{params:c});return u(n)},m=async({shop_id:r,page:e=1,pageSize:a=10})=>d({shop_id:r,page:e,pageSize:a}),y=async r=>{const e=await o.get(`${i}/detail`,{params:{id:r}});return(e==null?void 0:e.data)||null},g=async r=>o.post(`${i}/save`,r),f=async r=>o.post(`${i}/save`,r),h=async r=>o.post(`${i}/save`,r),A=async r=>o.post(`${i}/delete`,r),P=async(r,e,a={})=>{const{barcode:s,name:t,price:c,appearance:n}=a;return o.post("/product/save",{id:r,category_id:1,standard_product_id:1,is_batch_managed:0,is_shelf_life_managed:0,status:1,barcode:s,name:t,appearance:n!=null?n:85,price:c,live_image:[`https://shxy.image.yushutx.com/living-picture/${e}`]})},b=async(r,e,a={})=>{const{barcode:s,name:t,price:c,appearance:n}=a;return o.post("/product/save",{id:r,category_id:1,standard_product_id:1,is_batch_managed:0,is_shelf_life_managed:0,status:1,barcode:s,name:t,appearance:n!=null?n:85,price:c,live_image:[e]})},v=async(r,e,a={})=>{const{barcode:s,name:t,price:c,appearance:n}=a;return o.post("/product/save",{id:r,category_id:1,standard_product_id:1,is_batch_managed:0,is_shelf_life_managed:0,status:1,barcode:s,name:t,appearance:n!=null?n:85,price:c,live_image:["https://img.pddpic.com/open-gw/2025-12-01/181c6be7-c781-45ec-a2cc-397c5bbdd09e.jpeg"]})},w=async r=>o.get("/getSuitBook",{params:{isbn:r}}),$=async({book_name:r,author:e,publisher:a})=>{const s=await o.get("/getProCode",{params:{book_name:r,author:e,publisher:a}});return(s==null?void 0:s.data)||""},D=async r=>{const e=new FormData;return e.append("image",r,"capture.jpg"),o.post("/ocr",e,{headers:{"X-Need-Sign":"false"}})},L=async(r,e,a)=>{const s=new FormData;return s.append("product_id",r),s.append("shop_id",e),s.append("shop_type",a),o.post(`${i}/retry-out-task`,s)},S=async(r=20,e,a)=>{const s=await o.get(`${i}/list`,{params:{page:1,page_size:r,start_created_at:e,end_created_at:a}}),t=s==null?void 0:s.data;return Array.isArray(t)?t:Array.isArray(t==null?void 0:t.list)?t.list:[]},B=async(r,e,a=10)=>{const s=await o.get(`${i}/shop-detail`,{params:{shop_id:String(r),page:e,page_size:a}}),t=s==null?void 0:s.data;let c=[];return Array.isArray(t)?c=t:Array.isArray(t==null?void 0:t.list)?c=t.list:Array.isArray(t==null?void 0:t.products)&&(c=t.products),{products:c,total:typeof(t==null?void 0:t.total)=="number"?t.total:c.length,success_count:typeof(t==null?void 0:t.success_count)=="number"?t.success_count:0,not_sent_count:typeof(t==null?void 0:t.not_sent_count)=="number"?t.not_sent_count:0,failed_count:typeof(t==null?void 0:t.failed_count)=="number"?t.failed_count:0}},k=async r=>{const e=await o.get("/product/detail",{params:{id:r}});return(e==null?void 0:e.data)||null},x=async({userId:r,warehouse_id:e,file:a})=>{const s=new FormData;return s.append("user_id",r),s.append("warehouse_id",e),s.append("file",a),o.post("/goods/import-from-excel",s)};export{g as createProduct,A as deleteProduct,S as fetchLatestProducts,y as fetchProductDetail,d as fetchProductList,m as fetchProductListByShop,B as fetchShopProducts,k as getBookDetails,$ as getProCode,w as getSuitBook,x as importProductsByExcel,D as ocrImage,L as retryProductPublish,f as saveProduct,h as updateProduct,P as updateProductLiveImage,b as updateProductLiveImageAsPddUrl,v as updateProductLiveImageForTest};