daShangDao_psiWebApp/dist/assets/product.325529fe.js
2026-06-03 10:53:47 +08:00

2 lines
2.7 KiB
JavaScript

import{r as c}from"./request.3edc855e.js";import"./axios.e318b91e.js";import"./index.a99ea9b6.js";const n="/product",d=t=>{const e=t==null?void 0:t.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}},u=async({keyword:t,status:e,shop_id:r,page:a,pageSize:s})=>{const i={keyword:t||void 0,status:e,shop_id:r,page:a,page_size:s},o=await c.get(`${n}/list`,{params:i});return d(o)},l=async({shop_id:t,page:e=1,pageSize:r=10})=>u({shop_id:t,page:e,pageSize:r}),_=async t=>{const e=await c.get(`${n}/detail`,{params:{id:t}});return(e==null?void 0:e.data)||null},y=async t=>c.post(`${n}/save`,t),h=async t=>c.post(`${n}/save`,t),f=async t=>c.post(`${n}/save`,t),P=async t=>c.post(`${n}/delete`,t),v=async(t,e,r={})=>{const{barcode:a,name:s,price:i,appearance:o}=r;return c.post("/product/save",{id:t,category_id:1,standard_product_id:1,is_batch_managed:0,is_shelf_life_managed:0,status:1,barcode:a,name:s,appearance:o!=null?o:85,price:i,live_image:[`https://shxy.image.yushutx.com/living-picture/${e}`]})},A=async(t,e,r={})=>{const{barcode:a,name:s,price:i,appearance:o}=r;return c.post("/product/save",{id:t,category_id:1,standard_product_id:1,is_batch_managed:0,is_shelf_life_managed:0,status:1,barcode:a,name:s,appearance:o!=null?o:85,price:i,live_image:[e]})},b=async(t,e,r={})=>{const{barcode:a,name:s,price:i,appearance:o}=r;return c.post("/product/save",{id:t,category_id:1,standard_product_id:1,is_batch_managed:0,is_shelf_life_managed:0,status:1,barcode:a,name:s,appearance:o!=null?o:85,price:i,live_image:["https://img.pddpic.com/open-gw/2025-12-01/181c6be7-c781-45ec-a2cc-397c5bbdd09e.jpeg"]})},$=async t=>c.get("/getSuitBook",{params:{isbn:t}}),w=async({book_name:t,author:e,publisher:r})=>{const a=await c.get("/getProCode",{params:{book_name:t,author:e,publisher:r}});return(a==null?void 0:a.data)||""},L=async t=>{const e=new FormData;return e.append("image",t,"capture.jpg"),c.post("/ocr",e,{headers:{"X-Need-Sign":"false"}})},D=async(t,e,r)=>{const a=new FormData;return a.append("product_id",t),a.append("shop_id",e),a.append("shop_type",r),c.post(`${n}/retry-out-task`,a)},I=async(t=20,e,r)=>{const a=await c.get(`${n}/list`,{params:{page:1,page_size:t,start_created_at:e,end_created_at:r}}),s=a==null?void 0:a.data;return Array.isArray(s)?s:Array.isArray(s==null?void 0:s.list)?s.list:[]};export{y as createProduct,P as deleteProduct,I as fetchLatestProducts,_ as fetchProductDetail,u as fetchProductList,l as fetchProductListByShop,w as getProCode,$ as getSuitBook,L as ocrImage,D as retryProductPublish,h as saveProduct,f as updateProduct,v as updateProductLiveImage,A as updateProductLiveImageAsPddUrl,b as updateProductLiveImageForTest};