import requestData from "@/utils/requestData" ; import { ILiProductInfo , IProductDetail } from "@/interfaces/product" ; import { IOrderDetail } from "@/interfaces/order" ; import { ISalesData , ISalesType } from "@/interfaces/dashborad" ; /**
 * 对应后端商家端相关 API
 */ class ShopService { /**
     * 获取产品列表
     */ fetchProductList ( params ) { return requestData < { count : number ; lists : ILiProductInfo [ ] ; } > ( { method : "GET" , api : "product/lists" , params } ) ; } /**
     * 获取产品详情
     */ fetchProductDetail ( params ) { return requestData < IProductDetail > ( { method : "GET" , api : "product/item" , params } ) ; } param params fetchProductDesc ( params ) { return requestData < { product_id : number ; /** 富文本描诉 HTML */ content : string ; } > ( { method : "GET" , api : "product/get_content_detail" , params } ) ; } /**
     * 上下架产品
     */ setProductStatus ( params ) { return requestData ( { method : "POST" , api : "product/set_status" , params } ) ; } /**
     * 获取实时订单列表
     */ fetchOrderList ( params ) { return requestData < { count : number ; lists : IOrderDetail [ ] ; } > ( { method : "GET" , api : "order/my_lists" , params } ) ; } /**
     * 获取历史订单列表
     */ fetchHisOrderList ( params ) { return requestData < { count : number ; lists : IOrderDetail [ ] ; } > ( { method : "GET" , api : "order/history_lists" , params } ) ; } /**
     * 取消订单
     */ fetchCancelOrder ( params ) { return requestData ( { method : "POST" , api : "order/cancel_payment_order" , params } ) ; } /**
     * 接单
     */ fetchConfirmOrder ( params ) { return requestData ( { method : "POST" , api : "order/receipt_order" , params } ) ; } /**
     * 打印订单回调
     */ fetchPrintOrderCb ( params ) { return requestData ( { method : "POST" , api : "order/complete_order" , params } ) ; } param params param { 1 | 2 | 3 | 4 } params . type fetchSalesDataList ( params ) { return requestData < ISalesData > ( { method : "GET" , api : "order/statistics_lists" , params } ) ; } /**
     * 修改库存
     */ fetchUpdateSkuStock ( params ) { return requestData ( { method : "POST" , api : "product/set_stock" , params } ) ; } } export default new ShopService ( ) ;