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


class storeGoods extends request {

  /**
   * 获取分类店铺门店
   */
  static getExhibit(storeId) {
    return this.postRequest(`${this.BASE_GROUP_URL}open/goods/exhibit`, {
      storeId
    });
  }

  /**
   * 获取购物车数据
   */
  static getCartData(storeId, mobile, tableId, couponSn, orderMode) {
    return this.postRequest(`${this.BASE_GROUP_URL}open/order/cart-detail`, {
      storeId,
      mobile,
      tableId,
      couponSn,
      orderMode
    }, true)

    // 加入购物车


  }


  static comBoaddToCart(params) {

    return this.postRequest(`${this.BASE_GROUP_URL}open/order/add-to-cart`, {
      storeId: params.storeId,
      mobile: params.mobile,
      skuId: params.skuId,
      num: params.num,
      comboSkuList: params.comboSkuList,
    }, true)

  }

  /**
   * 创建订单
   */
  static createOrder(params) {
    return this.postRequest(`${this.BASE_GROUP_URL}open/order/create`, {
      storeId: params.storeId,
      mobile: params.mobile,
      couponSn: params.couponSn,
    })
  }

  /**
   * 获取支付卡券
   */
  static orderCouponForSelect(params) {
    return this.postRequest(`${this.BASE_GROUP_URL}open/coupon/coupon-sn-list-for-select`, {
      storeId: params.storeId,
      mobile: params.mobile,
      // tableId: params.tableId,
    })
  }

  /**
   * 订单拉起
   */
  static creatOrder(params) {
    return this.postRequest(`${this.BASE_GROUP_URL}open/order/create`, {
      mobile: params.mobile,
      storeId: params.storeId,
      couponSn: params.couponSn,
      dinnerType: params.dinnerType,
      addressId: params.addressId,
      invoiceId: params.invoiceId,
      phone: params.phone,
      remark: params.remark,
    })
  }


  /**
   * 订单支付
   */
  static getPayParams(params) {
    return this.postRequest(`${this.BASE_GROUP_URL}open/order/get-pay-params`, {
      orderSn: params.orderSn,
      payCode: params.payCode,
      openId: params.openId,
      isOrderPayment: true,
      orderInfoPath: params.orderInfoPath,
      productDetailPath: params.productDetailPath,
    })
  }



  
        //主动获取订单状态
        static getPayStatus(orderSn) {
          let params={
            orderSn:orderSn
          }
          return this.postRequest(`${this.BASE_GROUP_URL}open/call/getPayStatus`, params);
        }
}

export default storeGoods