
/**
 * Web唐明明
 * 匆匆数载恍如梦，岁月迢迢华发增。
 * 碌碌无为枉半生，一朝惊醒万事空。
 * moduleName: 企业工具
 */

import { request } from '../index'

// 企业首页
const index = () => {
	return request({
		url: 'companies/index'
	})
}

// 成交客户
const orderUsers = data => {
	return request({
		url: 'manages/order_users',
		data
	})
}

// 访客记录
const visitors = data => {
	return request({
		url: 'companies/visitors/lists',
		data
	})
}

// 基础信息模块
const basicsConfig = () => {
	return request({
		url: 'companies/info/create'
	})
}

// 企业基础信息 编辑
const basicsInfo = (method, data) => {
	return request({
		url: 'companies/info',
		method,
		data
	})
}

// 营销推广码
const companiesCode = () => {
	return request({
		url: 'companies/code'
	})
}

// 退货单列表
const storeReturn = (state) => {
	return request({
		url: 'manages/refunds',
        data: {
            state
        }
	})
}

// 退货单详情
const orderDetails = (refund_id) => {
	return request({
		url: 'manages/refunds/' + refund_id
	})
}

// 退货单-操作日志
const orderJournal = (refund_id) => {
	return request({
		url: 'mall/refunds/' + refund_id + '/logs'
	})
}

// 退货单签收
const storeSign = (refund_id) => {
	return request({
		url: 'manages/refunds/' + refund_id + '/sign'
	})
}

// 退货单-退货
const storeToken = (refund_id) => {
	return request({
		url: 'manages/refunds/' + refund_id + '/retoken'
	})
}

// 退货单-审核
const storeAudit = (refund_id, data) => {
	return request({
		url: 'manages/refunds/' + refund_id + '/audit',
        method: 'POST',
        data: data
	})
}

// 提货单列表
const storeDeliver = (state) => {
	return request({
		url: 'manages/shipments',
        data: {
            state
        }
	})
}

// 提货单详情
const deliverDetails = (shipment__no) => {
	return request({
		url: 'manages/shipments/' + shipment__no
	})
}

// 提货单发货前置
const deliverFront = (shipment__no) => {
	return request({
		url: 'manages/shipments/' + shipment__no + '/deliver'
	})
}

// 提货单发货
const deliverForm = (shipment__no, data) => {
	return request({
		url: 'manages/shipments/' + shipment__no + '/deliver',
        method: 'POST',
        data: data
	})
}

// 提货单物流
const deliverLogistic = (shipment__no) => {
	return request({
		url: 'manages/shipments/' + shipment__no + '/logistic'
	})
}

export {
	index,
	orderUsers,
	visitors,
	basicsConfig,
	basicsInfo,
    companiesCode,
    storeReturn,
    orderDetails,
    orderJournal,
    storeSign,
    storeToken,
    storeAudit,
    storeDeliver,
    deliverDetails,
    deliverFront,
    deliverForm,
    deliverLogistic
}
