/**
 * 合同附件相关
 */
import http from '../http'

export default {
  page: data =>
    http.post('/env/v1/sales_attachment/page', data).then(res => res),
  // 删除
  deleteByIds: data => {
    if (data.flag === undefined) {
      // 删除全部
      http.delete('/env/v1/sales_attachment/?ids=' + data.id).then(res => res)
    } else {
      // 只能删除自己
      http
        .delete(
          '/env/v1/sales_attachment/?ids=' + data.id + '&flag=' + data.flag
        )
        .then(res => res)
    }
  },
  getBySalesId: id =>
    http
      .post('/env/v1/sales_attachment/list_picture_by_sales_id?salesId=' + id)
      .then(res => res)
}
