import request from '../utils/request.js'

class order extends request {

  static cancelOrder(params) {
    return this.postRequest(`${this.BASE_GROUP_URL}open/order/cancel`, {
        orderSn: params.orderSn,
        mobile: params.mobile,
    })
}
  /**
   * 获取订单列表
   */
  static getOrderList(params) {
    return this.postRequest(`${this.BASE_GROUP_URL}open/order/user-order-list`, {
      mobile: params.mobile,
      page: params.page || 1,
      pageSize: params.pageSize || 10,
      keyword: params.keyword || ''
    });
  }
    /**
     * 清空购物车
     */
    static emptyCart(params) {
      return this.postRequest(`${this.BASE_GROUP_URL}open/order/empty-cart`, {
          storeId: params.storeId,
          mobile: params.mobile,
          tableId: params.tableId,
          orderMode:params.orderMode
      })
  }
     /**
     * 订单详情
     */
    static getOrderDetail(params) {
      return this.postRequest(`${this.BASE_GROUP_URL}open/order/detail`, {
          orderSn: params.orderSn,
          mobile: params.mobile,        
      })
  }
       /**
     * 订单退款
     */
    static refund(params) {
      return this.postRequest(`${this.BASE_GROUP_URL}open/order/refund`, {
          mobile: params.mobile,
          orderSn: params.orderSn,
          reason: params.reason,
          photoList:params.photoList     
      })
  }
}

export default order