deliver-table.js 4.24 KB
/**
 * Created by TaoHuang on 2017/5/25.
 */

let tableCols = function() {
    return [
        {
            type: 'selection',
            width: 60,
            align: 'center'
        },
        {
            title: 'SKN/SKC/SKU',
            key: 'productSkn',
            align: 'center',
            render: (h, params) => {
                return (
                    <div>{params.row.productSkn} / {params.row.productSkc} / {params.row.productSku} </div>
                );
            }
        },
        {
            title: '条码',
            key: 'skuFactoryCode',
            align: 'center',
        },
        {
            title: '货品年季',
            key: 'goodsYearSeason',
            align: 'center',
        },
        {
            title: '名称',
            key: 'productName',
            align: 'center',
        },
        {
            title: '色系/厂家颜色',
            align: 'center',
            render: (h, params) => {
                return (
                    <div>{params.row.goodsName} / {params.row.factoryGoodsName}</div>
                );
            }
        },
        {
            title: '性别/尺码',
            align: 'center',
            render: (h, params) => {
                return (
                    <div>{params.row.genderName} / {params.row.sizeName}</div>
                );
            }
        },
        {
            title: '吊牌/销售价/进货价',
            align: 'center',
            render: (h, params) => {
                return (
                    <div>{params.row.retailPrice} / {params.row.salesPrice}</div>
                );
            }
        },

        {
            title: '结算折扣',
            key: 'purchaseDiscount',
            align: 'center',
        },

        {
            title: '发货进度 已发数/需发总数',
            key: 'editTime',
            align: 'center',
            renderHeader() {
                return '发货进度<br/> 已发数/需发总数 ';
            },
            render: (h, params) => {
                let percent = 0;

                if (params.row.shipmentsNums && params.row.buyingNums) {
                    percent = params.row.shipmentsNums / params.row.buyingNums;

                    if (percent > 1) {
                        percent = 100;
                    } else {
                        percent *= 100;
                    }
                }

                return (
                    <div>
                        <div><i-progress percent={ percent} hide-info={true} ></i-progress></div>
                        <div>{params.row.shipmentsNums || 0} / {params.row.buyingNums || 0}</div>
                    </div>
                );
            },
        },

        {
            title: '入库进度 已入库数/需发总数',
            key: 'editTime',
            align: 'center',
            renderHeader() {
                return '入库进度<br/> 已入库数/需发总数';
            },
            render: (h, params) => {
                let percent = 0;

                if (params.row.inStoreNum && params.row.buyingNums) {
                    percent = params.row.inStoreNum / params.row.buyingNums;

                    if (percent > 1) {
                        percent = 100;
                    } else {
                        percent *= 100;
                    }
                }

                return (
                    <div>
                        <div><i-progress percent={ percent }
                                         hide-info={true}></i-progress></div>
                        <div>{ params.row.inStoreNum || 0} / {params.row.buyingNums || 0}</div>
                    </div>
                );
            },
        },
        {
            title: '填写发货数',
            key: 'action',
            align: 'center',
            render: (h, params) => {
                let disabled = params.row.shipmentsNums === params.row.buyingNums;

                return (
                    <i-input
                        value={params.row.num}
                        onInput={val => (params.row.num = val)}
                        disabled={disabled}
                    />
                );
            }
        }
    ];
};

let tableData = [];

export {
    tableCols,
    tableData,
};