refundGoods.vue 6.65 KB
<template>
    <div id="exportStock" class="contentpanel shopsReport" style="display1: none">
        <div class="panel">
            <div class="panel-heading"><h1>退货管理</h1></div>
            <div class="panel-body">
                <div class="row">
                    <uc-filter :params.sync="params"></uc-filter>
                    <div class="panel-col">
                        <a href="javascript:;" class="btn btn-info" @click="submit">搜索</a>
                    </div>
                </div>

                <uc-card :rows="cards"></uc-card>
            </div>
        </div>

        <div class="panel">
            <div class="panel-heading"><h2>——退货报表——</h2></div>

            <div class="panel-body nopadding">
                <com-grid :columns="grid.columns" :url="grid.url">
                </com-grid>
            </div>
        </div>
    </div>
</template>


<script>
    import grid from '../../../../components/grid/index';
    import card from './card';
    import filer from './filter';
    import util from 'util';

    export default {
        components: {
            comGrid: grid,
            ucCard: card,
            ucFilter: filer
        },
        props: {
            refundData: {type: Object, default: {}}
        },
        data() {
            let date=new Date();
            date.setDate(date.getDate()-1);
            return {
                cards: [
                    {name: "退货总数", value: "0", name1: "环比", value1: "0"},
                    {name: "退货总金额(元)", value: "0", name1: "环比", value1: "0"},
                    {name: "退货率", value: "0", name1: "环比", value1: "0"}
                ],
                params: {
                    type: 1,
                    reqTime: util.dateFormat(date, "YYYY-MM-dd"),
                    beginTime: "",
                    endTime: "",
                    productSkn: "",
                    productSkc: "",
                    productSku: "",
                    factoryCode: "",
                    sortId: "",
                    sortList: []
                },
                grid: {
                    url: '/oldshops/report/getReturnGoodsRptList',
                    columns: [
                        {
                            name: 'imageUrl', display: '图片', render: function (item) {
                            return item.imageUrl ? '<img src="' + item.imageUrl + '?imageView/0/w/78/h/78">' : "";
                        }
                        },
                        {
                            name: '', display: 'SKN/SKC/SKU', render: function (item) {
                            var htmlArr = [];
                            htmlArr.push('<p>SKN:<a class="productSkn" style="cursor:pointer">' + item.productSkn + '</a></p>');
                            htmlArr.push('<p>SKC:' + item.productSkc + '</p>');
                            htmlArr.push('<p>SKU:' + item.productSku + '</p>');
                            return htmlArr.join("");
                        }
                        },
                        {name: 'factoryCode', display: '厂家编号'},
                        {name: 'goodsName', display: '商品名称'},
                        {
                            name: 'price', display: '价格', render: function (item) {
                            var htmlArr = [];
                            htmlArr.push('<p>吊牌价:' + item.retailPrice + '</p>');
                            htmlArr.push('<p>销售价:' + item.salesPrice + '</p>');
                            return htmlArr.join("");
                        }
                        },
                        {
                            name: '', display: '颜色/尺码', render: function (item) {
                            return '<p>' + item.colorName + '/' + item.sizeName + '</p>';
                        }
                        },
                        {
                            name: '', display: '商品分类', render: function (item) {
                            return [item.maxSortName, item.middleSortName, item.smallSortName].join('-');
                        }
                        },
                        {name: 'buyNumber', display: '数量'},
                        {name: 'orderAmount', display: '金额'}
                    ]
                }
            }
        },
        ready() {
            var that = this;
            that.submit();
            $(document).on("click", ".productSkn", function () {
                var skn = $(this).html();
                that.params.productSkn = skn;
                that.submit();
            })
        },
        methods: {
            submit() {
                if (this.params.sortList.length > 0) {
                    this.params.sortId = this.params.sortList[0].id;
                }else{
                    this.params.sortId = '';
                }
                var data = {
                    type: this.params.type,
                    reqTime: this.getTime(this.params.reqTime),
                    beginTime: this.getTime(this.params.beginTime),
                    endTime: this.getTime(this.params.endTime),
                    productSkn: this.params.productSkn,
                    productSkc: this.params.productSkc,
                    productSku: this.params.productSku,
                    factoryCode: this.params.factoryCode,
                    sortId: this.params.sortId
                };
                this.$broadcast('grid-reload', data);
            },
            getTime(time){
                if (time !== "") {
                    time = time.split('-').join("")
                }
                return time;
            },
            checkRate(rate,value){
                if (rate) {
                    value =rate
                } else if (rate == 0) {
                    value = 0;
                } else {
                    value = 'no';
                }
                return value;
            }
        },
        events: {
            complete(data){
                let result = data.additionInfo;
                if (result) {
                    this.cards[0].value = result.allNumber ? result.allNumber : 0;
                    this.cards[0].value1=this.checkRate(result.allNumberRate,this.cards[0].value1);
                    this.cards[1].value = result.allAmount ? result.allAmount : 0;
                    this.cards[1].value1=this.checkRate(result.allAmountRate,this.cards[1].value1);
                    this.cards[2].value = result.returnAmountRate ? result.returnAmountRate + "%" : 0;
                    this.cards[2].value1=this.checkRate(result.returnRingRate,this.cards[2].value1);
                }

            }
        }
    }


</script>