import request from '@/utils/request'

//  获取所有选品数据
export function getlLibraryList(data) {
    return request({
      url: '/banziSelect/getApiLocalityList',
      method: 'POST',
      data
    })
  }

  // 加入购物车
  export function addShopCar(data) {
    return request({
      url: '/banziSelect/addShopCart',
      method: 'POST',
      data
    })
  }  

  //  获取购物车列表
  export function getShopCarList(params) {
    return request({
      url: '/banziSelect/getShopCart',
      method: 'GET',
      params
    })
  }

  // 修改购物车商品数量
  export function updateShopCar(data) {
    return request({
      url: '/banziSelect/updateNumber',
      method: 'POST',
      data
    })
  }

  //  删除所选商品
  export function deleteShopCar(data) {
    return request({
      url: '/banziSelect/deleteCart',
      method: 'POST',
      data
    })
  }

  // 清空购物车
  export function clearShopCar(data) {
    return request({
      url: '/banziSelect/deleteAll',
      method: 'POST',
      data
    })
  }

  // 结算商品
  export function getSettlement(data) {
    return request({
      url: '/banziSelect/getSettlement',
      method: 'POST',
      data
    })
  }

  // 代金券支付
  export function voucherPay(data) {
    return request({
      url: '/banziSelect/submit',
      method: 'POST',
      data
    })
  }

  //  商家代金券数量
export function requertVoucher(params) {
  return request({
    url: '/banziSelect/getVoucher',
    method: 'GET',
    params
  })
}

//  请求店铺信息
export function shopSysGetById(data) {
  return request({
    url: '/shop/getById',
    method: 'post',
    data
  })
}

//  获取商家自己的采购单
export function getPurchaseOrder(data) {
  return request({
    url: '/banziSelect/getApiShopOrderList',
    method: 'post',
    data
  })
}

//  确认收货
export function getConfirm(data) {
  return request({
    url: '/banziSelect/confirm',
    method: 'post',
    data
  })
}


//  获取地址列表
export function getAddress(params) {
  return request({
    url: '/receive/getAll',
    method: 'get',
    params
  })
}

//  根据地区 id 查询地址
export function searchParentId(params){
  return request({
    url: '/cityManageArea/getTreeOne',
    method: 'get',
    params
  })
}

// 添加地址
export function addAddress(data) {
  return request({
    url: '/receive/save',
    method: 'post',
    data
  })
}
//  编辑地址
export function editAddress(data) {
  return request({
    url: '/receive/update',
    method: 'post',
    data
  })
}

//  删除地址
export function deleteAddress(data) {
  return request({
    url: '/receive/delete',
    method: 'post',
    data
  })
}