import React from 'react';
import './index.less';
import Page from '@src/containers/Page';
import { asyncSMessage } from '@src/services/AsyncTools';
import { getMap, formatMoney, formatDate } from '@src/services/Tools';
import UserLayout from '../../../layouts/User';
import menu from '../index';
import UserTable from '../../../components/UserTable';
import { Order } from '../../../stores/order';
import { RecordSource, ServiceKey } from '../../../../Constant';
import More from '../../../components/More';
const RecordSourceMap = getMap(RecordSource, 'value', 'label');
const ServiceKeyMap = getMap(ServiceKey, 'value', 'label');
function formatTitle(record) {
if (record.productType === 'course-package') {
return (record.coursePackage || {}).title;
}
if (record.productType === 'course') {
return (record.course || {}).title;
}
if (record.productType === 'data') {
return (record.data || {}).title;
}
if (record.productType === 'service') {
return `${ServiceKeyMap[record.service]}`;
}
return '';
}
const columns = [
{ title: '订单编号', key: 'id' },
{
title: '服务',
key: 'title',
render: (text, record) => {
const actionList = [];
if (record.canInvoice && !record.hasInvoice) {
actionList.push({ key: 'invoice', label: '开发票' });
}
actionList.push({ key: 'detail', label: '订单详情' });
const onAction = (key) => {
switch (key) {
case 'invoice':
this.setState({ showInvoice: true, invoice: { orderId: record.id, money: record.invoiceMoney } });
break;
case 'detail':
openLink(`/order/detail/${record.id}`);
break;
default:
}
};
if (record.checkouts.length > 3) {
return {formatTitle(record.checkouts[0])}
等{record.checkouts.length}个商品