import { Service } from '@/Service/Service';
export class OrderService {
	/**
	 * 获取微信openId
	 * GET /api/Order/GetOpenId
	 */
	static async GetOpenId(code : string) {
		return await Service.Request("/api/Order/GetOpenId", 'GET', { code });
	}

	/**
	 * 下单接口
	 * POST /api/Order/AddUserOrder
	 */
	static async AddUserOrder(detail:string,isCustoms:number) {
		return await Service.Request("/api/Order/AddUserOrder", 'POST', {detail,isCustoms });
	}

	/**
	 * 修改订单地址
	 * POST /api/Order/UpdateOrderAddress
	 */
	static async UpdateOrderAddress(data : Record<string, any>) {
		return await Service.Request("/api/Order/UpdateOrderAddress", 'POST', data);
	}

	/**
	 * 取消订单
	 * POST /api/Order/CancelOrder
	 */
	static async CancelOrder(data : Record<string, any>) {
		return await Service.Request("/api/Order/CancelOrder", 'POST', data);
	}

	/**
	 * 订单支付
	 * POST /api/Order/PayOrder
	 */
	static async PayOrder(data : Record<string, any>) {
		return await Service.Request("/api/Order/PayOrder", 'POST', data);
	}

	/**
	 * 用户订单接口
	 * GET /api/Order/GetUserOrderList
	 * @param state 空全部/0待付款 1已付款 2已发货 3待评价 4已完成
	 */
	static async GetUserOrderList(state : string, page : number) {
		return await Service.Request("/api/Order/GetUserOrderList", 'GET', { state, page });
	}

	/**
	 * 订单详情接口
	 * GET /api/Order/GetOrderInfo
	 */
	static async GetOrderInfo(orderId : string) {
		return await Service.Request("/api/Order/GetOrderInfo", 'GET', { orderId });
	}

	/**
	 * 确认收货
	 * POST /api/Order/UserOkOrder
	 */
	static async UserOkOrder(data : Record<string, any>) {
		return await Service.Request("/api/Order/UserOkOrder", 'POST', data);
	}

	/**
	 * 订单评价
	 * POST /api/Order/EvaluateOrder
	 */
	static async EvaluateOrder(data : Record<string, any>) {
		return await Service.Request("/api/Order/EvaluateOrder", 'POST', data);
	}
}