index.js 3.46 KB
import timeFormat from 'filters/time-format';

export default function() {
    return {
        selectBrand: {
            brandId: 0,
            brandName: ''
        },
        category: [],
        query: {
            productSkn: '',
            sknFactoryCode: '',
            skuFactoryCode: '',
            productName: '',
            brandId: '',
            stockStatus: ''
        },
        pageData: {
            total: 0,
            pageNo: 1,
            pageSize: 20
        },
        tableData: [],
        tableCols: [{
            type: 'selection',
            width: 60,
            align: 'center'
        }, {
            title: '商品图片',
            width: 120,
            align: 'center',
            render: (h, params) => {
                return (
                    <img v-prod-img={params.row.productSkn}/>
                );
            }
        }, {
            title: '商品信息',
            align: 'center',
            width: '15%',
            render: (h, params) => {
                return (
                    <cell-info items={[
                        {
                            label: 'SKN',
                            value: params.row.productSkn
                        }, {
                            label: '名称',
                            value: params.row.productName
                        }, {
                            label: '品牌',
                            value: params.row.brandName
                        }, {
                            label: '品类',
                            value: `${params.row.maxSortName}/${params.row.middleSortName}/${params.row.smallSortName}`
                        }
                    ]}></cell-info>
                );
            }
        }, {
            title: '价格(元)',
            align: 'center',
            width: '13%',
            render: (h, params) => {
                return (
                    <cell-info items={[
                        {
                            label: '吊牌价',
                            value: params.row.retailPrice
                        }, {
                            label: '销售价',
                            value: params.row.salePrice
                        }
                    ]}></cell-info>
                );
            }
        }, {
            title: '颜色尺码',
            render: (h, params) => {
                return (
                    <span>{params.row.colorName}/{params.row.size}</span>
                );
            }
        }, {
            title: '仓库库存',
            key: 'stock'
        }, {
            title: '库存可售天数',
            key: 'saleDays'
        }, {
            title: '建议补货数',
            key: 'supplementNums'
        }, {
            title: '最近一次补货时间',
            width: 150,
            render: (h, params) => {
                return (
                    <span>{timeFormat(params.row.lastTime)}</span>
                );
            }
        }, {
            title: '补货数',
            render: (h, params) => {
                return (
                    <Input-number
                        max={999}
                        min={0}
                        value={params.row.num}
                        style={{width: '60px'}}
                        onInput={val => (params.row.num = val)}
                        onOn-change={val => (this.numChange(params.row, val))}></Input-number>
                );
            }
        }]
    };
}