import request from '@/utils/request'
import { Upload } from 'element-ui'

export default {
  index:{
    Search(operator) {
      return request({
        url: '/customer/info',
        method: 'get',
        params: operator
      })
    },
    userAdd(operator){
      return request({
        url:"/customer/add",
        method:"post",
        data: operator
      })
    },
    update(operator){
      return request({
        url:'/customer/update',
        method:'put',
        data: operator
      })
    },
    customerDelect(customerId){
      return request({
        url:"/customer/del/" + customerId,
        method:"put",
      })
    },
    customerValid(customerId,status){
      return request({
        url:"/customer/valid/" + customerId  + '/'  + status,
        method:"put",
      })
    },
    //产品详情
    paroductDetails(param){
      return request({
        url:"/customer/product/info",
        method:"get",
        params:param
      })
    } ,
    //用户获取所有产品
    userProduct(customerId){
      return request({
        url:"/product/all/" + customerId,
        method:"get"
      })
    },
    //添加产品
    AddCustomer(param){
      return request({
        url:"/customer/product/add",
        method:"post",
        data:param
      })
    },
    //删除产品
    delectCustomer(customerProductId){
      return request({
        url:"/customer/product/" + customerProductId,
        method:"DELETE",
      })
    },
      //删除银行卡
  supplierDelete: function(id){
    return request({
      // url: '/supplier/bankcard/' + supplierDelete + "/" + id,
      url: '/bankcard/delete/' + id,
      method: 'delete',
      // data:data
    })
  },
      //合作伙伴
  userLlist: function(type){
    return request({
      // url: '/supplier/bankcard/' + supplierDelete + "/" + id,
      url: '/user/' + type,
      method: 'get',
      // data:data
    })
  },
  userDel:function(data){
    return request({
      url:"/partner/user/del",
      method: "post",
      data:data
    })
  }

  },

  access:{
    Search(operator){
      return request({
        url:'/customer/app/info',
        method:'GET',
        params: operator
      })
    },
    update(operator){
      return request({
        url: '/customer/app',
        method:'PUT',
        data: operator
      })
    },
    //关联通道组
    channelGroup(data){
      return request({
        url:"/channelGroup/allChannelGroup",
        method:"get",
        data:data
      })
    }
  },

  account:{
    //列表
    Search(operator){
      return request({
        url:'/payment/info',
        method:'post',
        data: operator
      })
    },
   //获取所有客户
   userList(data){
     return request({
       url:"customer/customerName",
       method:"get",
      //  data:data
     })
    //  return request({
    //    url:"/customer/" + data,
    //    method:"get",
    //    data:data
    //  })
   } ,
   //上传凭证
   Upload(data){
      return request({
        url:"/picture/upload",
        method:"post",
        data:data
      })
   },
   //加款新增
   paymentAdd(data){
      return request({
        url:"/payment/add",
        method:"post",
        data:data
      })
   },
   //加款编辑
   paymentUpdate(data){
      return request({
        url:"/payment/update",
        method:"post",
        data:data
      })
   },
   //银行卡
   bankcard(data){
      return request({
        url:"/bankcard/list",
        method:"get",
        params:data
      })
   },
   //撤销
   revocation(data){
      return request({
        url:"/payment/cancel",
        method:"post",
        data:data
      })
   },
   //授信
   creditAmount(customerId,creditAmount){
      return request({
        url:"/customer/credit/" + customerId + "/" + creditAmount,
        method:"put",
        // data:data
      })
   }
  }
 
}