index.js 3.55 KB
import {CellImage, CellInfo, CellPrice} from 'components/cell'; // eslint-disable-line
import timeFormat from 'filters/time-format';

export default function() {
    return {
        selectBrand: {
            brandId: 0,
            brandName: ''
        },
        stockStatusOptions: [
            {
                value: 1,
                label: '有库存'
            },
            {
                value: 2,
                label: '无库存'
            }
        ],
        category: [],
        query: {
            productSkn: '',
            sknFactoryCode: '',
            skuFactoryCode: '',
            prodName: '',
            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 (
                    <CellInfo 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}`
                        }
                    ]}></CellInfo>
                );
            }
        }, {
            title: '价格(元)',
            align: 'center',
            width: '13%',
            render: (h, params) => {
                return (
                    <CellInfo items={[
                        {
                            label: '吊牌价',
                            value: params.row.retailPrice
                        }, {
                            label: '销售价',
                            value: params.row.salePrice
                        }
                    ]}></CellInfo>
                );
            }
        }, {
            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>
                );
            }
        }]
    };
}