<template>
    <div class="lj-card-item" @click="$emit('callFuntion',item)">
        <div>
            <mu-row>
                <mu-col span="3" class="lj-card-secondary-title">订单号码：</mu-col>
                <mu-col span="5" class="lj-card-secondary-content">{{item.outwarecode}}</mu-col>
                <mu-col span="2">
                    <lj-status-badge :value="item.priceflagStr"/>
                </mu-col>
                <mu-col span="2">
                    <lj-status-badge :value="item.flagStr"/>
                </mu-col>
                <mu-col span="3" class="lj-card-secondary-title">客户名称：</mu-col>
                <mu-col span="9" class="lj-card-secondary-content">{{ isShowCusname(item) }}</mu-col>
                <mu-col span="3" class="lj-card-secondary-title">业务员：</mu-col>
                <mu-col span="9" class="lj-card-secondary-content">{{item.outrep}}</mu-col>
                <mu-col span="3" class="lj-card-secondary-title">发货日期：</mu-col>
                <mu-col span="9" class="lj-card-secondary-content">{{item.outdate | dateFilter}}</mu-col>
            </mu-row>
            <div class="lj-card-summary">
                <div class="lj-card-summary-light-text">
                    <i class="iconfont icon-cart lj-card-summary-icon"></i>
                    <span class="lj-card-tertiary-content">共{{item.sumqty}}件商品，其中包括</span>
                </div>
                <template v-if="item.mtrlstr_1">
                    <div class="lj-divider"></div>
                    <mu-row>
                        <mu-col span="1" style="text-align: right;">
                            <li></li>
                        </mu-col>
                        <mu-col>
                            <div class="lj-card-tertiary-content lj-card-summary-heavy-text"> 
                                {{item.mtrlstr_1}}
                            </div>
                            <div class="lj-card-quaternary-content lj-card-summary-light-text" v-if="!hasPower122">
                                {{item.qtystr_1}}
                            </div>
                        </mu-col>
                    </mu-row>
                </template>
                <template v-if="item.mtrlstr_2">
                    <mu-row>
                        <mu-col span="1" style="text-align: right;">
                            <li></li>
                        </mu-col>
                        <mu-col>
                            <div class="lj-card-tertiary-content lj-card-summary-heavy-text">
                                {{item.mtrlstr_2}}
                            </div>
                            <div class="lj-card-quaternary-content lj-card-summary-light-text" v-if="!hasPower122">
                                {{item.qtystr_2}}
                            </div>
                        </mu-col>
                    </mu-row>
                </template>

            </div>
            <div style="display:flex;" class="lj-card-tag-text lj-card-summary-light-text">
                <div class="lj-card-tag">
                    <i class="iconfont icon-grid lj-card-summary-icon"></i>
                    {{item.typename}}
                </div>
                <div class="lj-card-tag">
                    <i class="iconfont icon-cash lj-card-summary-icon"></i>
                    {{item.banktypename}}
                </div>
                <div class="lj-card-detail-button">
                    <i class="iconfont icon-preview lj-card-summary-icon"></i>
                    查看详情
                </div>
            </div>
        </div>
    </div>
</template>

<script>
    import LjStatusBadge from "components/lj-status-badge";

    export default {
        name: "saletask-outware-item",
        components: {
            LjStatusBadge
        },
        props: {
            item: {
                // 传入数据
                type: Object
            }
        },
        data() {
            return {
                hasPower122: $lj.checkPower(122)
            }
        },
        computed: {
            isShowCusname(data) {
                let empid = $lj.getStorage("userInfo").empid;
                return function (data) {
                    let msg = "";
                    if (empid != 0 && $lj.checkPower(1210)) {
                        msg = data.cuscode;
                    } else {
                        msg = data.cusname;
                    }
                    return msg;
                }
            },
        }
    }
</script>