import request from '@/utils/request'

/**
 * 首页接口
 * @returns {*}
 */
export function dataBoard() {
  return request({
    url: 'basic/dataBoard/list',
    method: 'post'
  })
}
//##################################骑手管理#######################################

/**
 * 文件上传
 * @param {*} data
 * @returns
 */
export function fileupload(data) {
    return request({
        url: '/oss/fileuploadd',
        method: 'post',
        data: data
    })
}


//##################################店铺主营品类信息和商品类目树级数据#######################################

/**
 * 查询店铺主营品类信息树级数据
 * @returns
 */
export function getShopCategory() {
    return request({
        url: '/shop/category/getShopCategory',
        method: 'get'
    })
}

/**
 * 查询商品类目信息树级数据
 * @returns
 */
export function getGoodsCategory() {
  return request({
    url: '/shop/category/getGoodsCategory',
    method: 'get'
  })
}
//##################################骑手管理#######################################

/**
 * 骑手审核列表
 */
export function riderReviewPage(data) {
    return request({
        url: '/deliver/rider-review/riderReviewPage',
        method: 'post',
        data: data
    })
}

/**
 * 已加入的骑手列表
 * @param {*} data
 * @returns
 */
export function riderPage(data) {
    return request({
        url: '/deliver/rider/riderPage',
        method: 'post',
        data: data
    })
}

/**
 * 查询骑手详情
 * @param {*} riderId
 * @returns
 */
export function findRiderUser(riderId) {
    return request({
        url: '/deliver/rider-review/findRiderUser?riderId=' + riderId,
        method: 'get'
    })
}

/**
 * 骑手审核
 * @param {*} riderId
 * @returns
 */
export function riderAudit(data) {
    return request({
        url: '/deliver/rider-review/review',
        method: 'put',
        data: data
    })
}

/**
 * 骑手关闭/开启
 * @param {*} data
 * @returns
 */
export function updateIsDisabled(data) {
    return request({
        url: '/deliver/rider/updateIsDisabled?riderId=' + data.riderId + "&disabledReason=" + data.disabledReason,
        method: 'put',
        data: data
    })
}

//骑手新增
export function addRider(data) {
    return request({
        url: '/deliver/rider/add',
        method: 'post',
        data: data
    })
}

//################################## 骑手管理end #######################################

// 店铺活动列表
export function shopActivityList(data) {
    return request({
        url: '/shop/activity/list',
        method: 'post',
        data: data
    })
}

// 获取会员列表
export function getMemberList(data) {
    return request({
        url: '/member/member/list',
        method: 'post',
        data: data
    })
}

// 会员开启
export function updateStateByMember(memberId) {
    return request({
        url: '/member/member/updateState?memberId=' + memberId,
        method: 'put'
    })
}

// 会员关闭
export function updateState2ByMember(data) {
    return request({
        url: '/member/member/updateState2',
        method: 'put',
        data: data
    })
}

// 会员详情
export function getMemberInfo(memberId) {
    return request({
        url: '/member/member/' + memberId,
        method: 'get'
    })
}

// 获取订单列表
export function getOrderList(data) {
    return request({
        url: '/order/order/list',
        method: 'post',
        data: data
    })
}

// 订单申请信息
export function getMemberRefundMessage(data) {
    return request({
        url: '/order/order/getMemberRefundMessage',
        method: 'post',
        data: data,
        headers: {
            'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8'
        }
    })
}

// 订单同意退款
export function orderAgreeRefund(data) {
    return request({
        url: '/order/order/updateOrderState',
        method: 'put',
        data: data
    })
}

// 订单拒绝退款
export function orderRefusedRefund(data) {
    return request({
        url: '/order/order/updateOrderState2',
        method: 'put',
        data: data
    })
}

// 订单详情
export function getOrderInfo(orderId) {
    return request({
        url: '/order/order/getInfo?orderId=' + orderId,
        method: 'get'
    })
}

// 店铺评价列表
export function getShopCommentList(data) {
    return request({
        url: '/shop/shopComment/list',
        method: 'post',
        data: data
    })
}

// 商品评价列表
export function getGoodsCommentList(data) {
    return request({
        url: '/shop/comment/list',
        method: 'post',
        data: data
    })
}

// 删除商品评价
export function deleteGoodsComment(commontIds) {
    return request({
        url: '/shop/comment/delete?commontIds=' + commontIds,
        method: 'delete'
    })
}

// 删除店铺评价
export function deleteShopComment(commontIds) {
    return request({
        url: '/shop/shopComment/delete?commontIds=' + commontIds,
        method: 'delete'
    })
}

/**
 * 骑手评价列表
 * @param {*} data
 * @returns
 */
export function getRiderCommentList(data) {
    return request({
        url: '/deliver/riderComment/list',
        method: 'post',
        data: data
    })
}

/**
 * 删除骑手评价
 * @param {*} ids
 * @returns
 */
export function deleteRiderComment(ids) {
  return request({
    url: '/deliver/riderComment/delete?ids=' + ids,
    method: 'put'
  })
}

// 5元无门槛红包
export function firstCredit() {
  return request({
    url: '/member/activity/firstCredit',
    method: 'post'
  })
}

// 8元无门槛红包
export function secondCredit() {
  return request({
    url: '/member/activity/secondCredit',
    method: 'post'
  })
}

// 信任卡编辑
export function creditEdit(data) {
  return request({
    url: '/member/activity/creditEdit',
    method: 'put',
    data: data
  })
}

// 拼手气红包列表
export function awardList(data) {
  return request({
    url: '/member/activity/awardList',
    method: 'post',
    data: data
  })
}

// 拼手气红包状态编辑
export function awardStateEdit(awardId, state) {
  return request({
    url: '/member/activity/awardStateEdit?awardId=' + awardId + "&state=" + state,
    method: 'put'
  })
}

// 拼手气红包编辑
export function awardEdit(data) {
  return request({
    url: '/member/activity/awardEdit',
    method: 'put',
    data: data
  })
}

// 优惠券列表
export function couponList(data) {
  return request({
    url: '/member/activity/couponList',
    method: 'post',
    data: data
  })
}

// 优惠券编辑
export function couponEdit(data) {
  return request({
    url: '/member/activity/couponEdit',
    method: 'put',
    data: data
  })
}

// 优惠券发放编辑
export function couponStateEdit(couponId, state) {
  return request({
    url: '/member/activity/couponStateEdit?couponId=' + couponId + "&state=" + state,
    method: 'put'
  })
}

// 新人红包
export function getNewer() {
  return request({
    url: '/member/activity/getNewer',
    method: 'post'
  })
}

// 新人红包编辑
export function awardNewerEdit(data) {
  return request({
    url: '/member/activity/awardNewerEdit',
    method: 'put',
    data: data
  })
}

// 拼手气红包活动发布
export function saveAward(data) {
  return request({
    url: '/member/activity/saveAward',
    method: 'put',
    data: data
  })
}

// 优惠券活动发布
export function saveCoupon(data) {
  return request({
    url: '/member/activity/saveCoupon',
    method: 'put',
    data: data
  })
}

//获取指定用户名单 
export function getassignUserList(couponId) {
  return request({
    url: '/member/activity/assignUserList?couponId=' +couponId,
    method: 'get'
  })
}


//################################## 数据统计start #######################################

// 店铺数据列表
export function shopSalesDataList(data) {
  return request({
    url: '/platform/shopData/salesList',
    method: 'post',
    data: data
  })
}

// 店铺数据列表
export function shopCommentsDataList(data) {
  return request({
    url: '/platform/shopData/commentsList',
    method: 'post',
    data: data
  })
}
//################################## 基础设置 #######################################

/**
 * 获取应用管理
 * @returns
 */
export function getAppConfiguration() {
  return request({
    url: '/basic/appConfiguration/list',
    method: 'post'
  })
}

/**
 * 应用编辑
 * @param {*} data
 * @returns
 */
export function editAppConfiguration(data) {
  return request({
    url: '/basic/appConfiguration/edit',
    method: 'post',
    data: data
  })
}

/**
 * 添加应用
 * @param {*} data
 * @returns
 */
export function addAppConfiguration(data) {
  return request({
    url: '/basic/appConfiguration/add',
    method: 'post',
    data: data
  })
}

/**
 * 删除应用
 * @param {*} data
 * @returns
 */
export function delAppConfiguration(categoryId) {
  return request({
    url: '/basic/appConfiguration/delete?categoryId=' + categoryId,
    method: 'post'
  })
}

/**
 * 应用排序
 * @param {*} data
 * @returns
 */
export function updateSortingAppConfiguration(data) {
  return request({
    url: '/basic/appConfiguration/updateSorting',
    method: 'put',
    data: data
  })
}

/**
 * 获取版本更新管理
 * @returns
 */
 export function getSysCodeList() {
  return request({
    url: '/basic/release/list',
    method: 'post'
  })
}
/**
 * 版本编辑
 * @param {*} data
 * @returns
 */
 export function editSysCode(data) {
  return request({
    url: '/basic/release/edit',
    method: 'post',
    data: data
  })
}


/**
 * 商家类型管理列表
 * @returns
 */
export function shopCategoryList() {
  return request({
    url: '/basic/category/shopCategoryList',
    method: 'post'
  })
}

/**
 * 商品类目管理列表
 * @returns
 */
export function goodsCategoryList() {
  return request({
    url: '/basic/category/goodsCategoryList',
    method: 'post'
  })
}

/**
 * 商家类型和商品类目添加类型
 * @param {*} data
 * @returns
 */
export function addMainCategory(data) {
  return request({
    url: '/basic/category/addMain',
    method: 'post',
    data: data
  })
}

/**
 * 商家类型和商品类目添加子类型
 * @param {*} data
 * @returns
 */
export function addCategory(data) {
  return request({
    url: '/basic/category/add',
    method: 'post',
    data: data
  })
}
/**
 * 商家类型和商品类目编辑类型
 * @param {*} data
 * @returns
 */
export function eidtMainCategory(data) {
  return request({
    url: '/basic/category/editMain',
    method: 'put',
    data: data
  })
}

/**
 * 商家类型和商品类目编辑子类型
 * @param {*} data
 * @returns
 */
export function editCategory(data) {
  return request({
    url: '/basic/category/edit',
    method: 'put',
    data: data
  })
}

/**
 * 商家类型和商品类目开启和关闭
 * @param {*} data
 * @returns
 */
export function updateCategoryEnable(data) {
  return request({
    url: '/basic/category/updateEnable?categoryId=' + data.categoryId + "&isEnable=" + data.isEnable,
    method: 'put'
  })
}

/**
 * 商家类型和商品类目排序
 * @param {*} data
 * @returns
 */
export function updateCategorySorting(data) {
  return request({
    url: '/basic/category/updateSorting',
    method: 'put',
    data: data
  })
}

/**
 *
 * @returns 配送费列表
 */
export function freightRuleList() {
  return request({
    url: '/basic/freightRule/freightRuleList',
    method: 'post'
  })
}

/**
 * 配送费保存
 * @param {*} data
 * @returns
 */
export function freightRuleSave(data) {
  return request({
    url: '/basic/freightRule/add',
    method: 'post',
    data: data
  })
}

/**
 * 服务中心
 * @returns
 */
export function serviceCenter() {
  return request({
    url: '/basic/serviceCenter/list',
    method: 'post'
  })
}

/**
 * 服务中心编辑
 * @param {*} data
 * @returns
 */
export function serviceCenterEdit(data) {
  return request({
    url: '/basic/serviceCenter/edit',
    method: 'put',
    data: data
  })
}

/**
 * 退款原因列表
 * @returns
 */
export function refundReasonList() {
  return request({
    url: '/basic/refundReason/list',
    method: 'post'
  })
}

/**
 * 退款原因编辑
 * @returns
 */
export function refundReasonEdit(data) {
  return request({
    url: '/basic/refundReason/edit',
    method: 'post',
    data: data
  })
}

/**
 * 获取屏蔽关键字
 * @returns
 */
export function getKeywords() {
  return request({
    url: '/basic/Keyword/list',
    method: 'post'
  })
}

/**
 * 屏蔽关键字保存
 * @param {*} content
 * @returns
 */
export function keywordsEdit(content) {
  return request({
    url: '/basic/Keyword/edit?content=' + content,
    method: 'post'
  })
}

/**
 * 获取协议
 * @returns
 */
export function getProtocol() {
  return request({
    url: '/basic/protocol/list',
    method: 'post'
  })
}

/**
 * 协议编辑
 * @param {*} data
 * @returns
 */
export function protocolEdit(data) {
  return request({
    url: '/basic/protocol/edit',
    method: 'post',
    data: data
  })
}

//骑手订单审核通过
export function updateSettleStatus(data) {
  return request({
    url: '/riderBill/updateSettleStatus',
    method: 'post',
    data: data
  })
}

//骑手订单审核不通过
export function updateSettleStatus2(data) {
  return request({
    url: '/riderBill/updateSettleStatus2',
    method: 'put',
    data: data
  })
}

//后台骑手提现分页list
export function getRiderWithDrawList(data) {
  return request({
    url: '/riderBill/riderSettleRecordPage',
    method: 'post',
    data: data
  })
}

//后台骑手账单分页list
export function getRiderBillList(data) {
  return request({
    url: '/riderBill/riderBillPage',
    method: 'post',
    data: data
  })
}

//骑手提现总金额
export function getSettleAmountTotal(data) {
  return request({
    url: '/riderBill/getSettleAmountTotal',
    method: 'post',
    data: data
  })
}

//后台订单账单分页list
export function getOrderBillList(data) {
  return request({
    url: '/bill/order/list',
    method: 'post',
    data: data
  })
}

//获取订单账单统计金额
export function getOrderBillTotalAmount(data) {
  return request({
    url: '/bill/order/totalAmount',
    method: 'post',
    data: data
  })
}

//获取保证金账单列表
export function getBondRecordList(data) {
  return request({
    url: '/bill/bond/list',
    method: 'post',
    data: data
  })
}

//获取保证金账单总额
export function getBondBillTotalAmount(data) {
  return request({
    url: '/bill/bond/totalAmount',
    method: 'post',
    data: data
  })
}

//获取保证金记录详情
export function getBondBillInfo(recordId) {
  return request({
    url: '/bill/bond/getInfo?recordId=' + recordId,
    method: 'get'
  })
}

export function getCoinOrderList(data) {
  return request({
    url: '/bill/coin/list',
    method: 'post',
    data: data
  })
}

//获取保证金账单总额
export function getCoinOrderTotalAmount(data) {
  return request({
    url: '/bill/coin/totalAmount',
    method: 'post',
    data: data
  })
}

//购买信任卡账单
export function getCreditRecordList(data) {
  return request({
    url: '/bill/couponBill/creditRecordList',
    method: 'post',
    data: data
  })
}

//获取优金豆用户数据
export function getCoinDataList(data) {
  return request({
    url: '/platform/coinData/list',
    method: 'post',
    data: data
  })
}

//根据手机号获取家庭信息
export function getFamilyList(phone) {
  return request({
    url: '/platform/coinData/familyList?phone=' + phone,
    method: 'get'
  })
}

//券包使用记录账单
export function getCouponUsageRecordList(data) {
  return request({
    url: '/bill/couponBill/couponUsageRecordList',
    method: 'post',
    data:data
  })
}

//获取商品销售数据
export function goodsSalesList(data) {
  return request({
    url: '/platform/goodsData/goodsSales',
    method: 'post',
    data: data
  })
}

//获取商品评论数据
export function goodsCommentList(data) {
  return request({
    url: '/platform/goodsData/goodsComment',
    method: 'post',
    data: data
  })
}

//券包使用张数和总面额
export function getCouponUsageTotalList(data) {
  return request({
    url: '/bill/couponBill/couponUsageTotal',
    method: 'post',
    data:data
  })
}

//骑手账单总金额
export function getTotalDeliverFee(data) {
  return request({
    url: '/riderBill/totalDeliverFee',
    method: 'post',
    data:data
  })
}

//信任卡购买账单统计
export function getCreditRecordTotal(data) {
  return request({
    url: '/bill/couponBill/creditRecordTotal',
    method: 'post',
    data:data
  })
}

//骑手数据统计
export function riderDataList(data) {
  return request({
    url: '/deliver/riderData/list',
    method: 'post',
    data: data
  })
}

//骑手评论数据统计
export function riderCommentDataList(data) {
  return request({
    url: '/deliver/riderData/commentList',
    method: 'post',
    data: data
  })
}

//券包数据--信任卡数据
export function couponDataCreditList(data) {
  return request({
    url: '/data/coupon/creditList',
    method: 'post',
    data: data
  })
}

//券包数据--拼手气红包数据
export function couponDataAwardList(data) {
  return request({
    url: '/data/coupon/awardList',
    method: 'post',
    data: data
  })
}

//券包数据--优惠券数据
export function couponDataCouponList(data) {
  return request({
    url: '/data/coupon/couponList',
    method: 'post',
    data: data
  })
}

//券包数据--新用户统计数据
export function couponDataNewerList(data) {
  return request({
    url: '/data/coupon/newerList',
    method: 'post',
    data: data
  })
}

//用户数据
export function userDataList(data) {
  return request({
    url: '/data/user/list',
    method: 'post',
    data: data
  })
}
