<template>
    <div>
        <lj-win-common title="订单详情">
            <template slot="body">
                <lj-detail-status-header :value="mainObject.flagStr">
                    {{mainObject.outwarecode}}
                </lj-detail-status-header>
                <div class="lj-detail-content">
                    <div class="lj-card-item lj-detail-content-top">
                        <div class="lj-card-secondary-title" style="text-align: left;">
                            <i class="iconfont icon-account lj-card-summary-icon"></i>
                            {{isShowCusname(mainObject)}}
                        </div>
                        <template v-if="mainObject.rel_rep || mainObject.cus_tele">
                            <div class="lj-card-secondary-title" style="text-align: left;">
                                <i class="iconfont icon-location lj-card-summary-icon"></i>
                                <span v-if="mainObject.rel_rep">{{mainObject.rel_rep}}&nbsp;&nbsp;&nbsp;&nbsp;</span>{{mainObject.cus_tele}}
                            </div>
                        </template>
                        <template v-if="mainObject.cus_address">
                            <div class="lj-card-quaternary-content" style="margin-left: 20px;">
                                地址：{{mainObject.cus_address}}
                            </div>
                        </template>
                    </div>
                    <div class="lj-card-item">
                        <mu-row style="padding:5px 0 0 0;">
                            <mu-col>
                                <span class="lj-taskinfo-title">业务员：</span>
                                <span class="lj-taskinfo-content">{{mainObject.outrep}}</span>
                            </mu-col>
                            <mu-col>
                                <span class="lj-taskinfo-title">发货日期：</span>
                                <span class="lj-taskinfo-content">{{mainObject.outdate | dateFilter}}</span>
                            </mu-col>
                        </mu-row>
                        <mu-row style="padding:5px 0 0 0;">
                            <mu-col>
                                <span class="lj-taskinfo-title">订单分类：</span>
                                <span class="lj-taskinfo-content">{{mainObject.typename ? mainObject.typename : '无'}}</span>
                            </mu-col>
                            <mu-col>
                                <span class="lj-taskinfo-title">币种：</span>
                                <span class="lj-taskinfo-content">{{mainObject.moneyname}}</span>
                            </mu-col>
                        </mu-row>
                        <mu-row style="padding:5px 0 0 0;">
                            <mu-col>
                                <span class="lj-taskinfo-title">结算方式：</span>
                                <span class="lj-taskinfo-content">{{mainObject.banktypename}}</span>
                            </mu-col>
                        </mu-row>
                        <mu-row style="padding:5px 0 0 0;">
                            <mu-col>
                                <span class="lj-taskinfo-title">汇率：</span>
                                <span class="lj-taskinfo-content">{{mainObject.mrate}}</span>
                            </mu-col>
                            <mu-col v-if="userFunids.indexOf(122) < 0">
                                <span class="lj-taskinfo-title">发货金额：</span>
                                <span class="lj-sharp-red-text">{{mainObject.moneysign}}{{mainObject.planamt}}</span>
                            </mu-col>
                        </mu-row>
                        <mu-row style="padding:5px 0 0 0;" v-if="userFunids.indexOf(122) < 0">
                            <mu-col>
                                <span class="lj-taskinfo-title">订金：</span>
                                <span class="lj-sharp-red-text">{{mainObject.moneysign}}{{mainObject.damt}}</span>
                            </mu-col>
                            <mu-col>
                                <span class="lj-taskinfo-title">优惠金额：</span>
                                <span class="lj-sharp-red-text">{{mainObject.moneysign}}{{mainObject.otheramt}}</span>
                            </mu-col>
                        </mu-row>
                        <mu-row style="padding:5px 0 0 0;">
                            <mu-col>
                                <span class="lj-taskinfo-title">货运部：</span>
                                <span class="lj-taskinfo-content">{{mainObject.relstr_1}}</span>
                            </mu-col>
                            <mu-col>
                                <span class="lj-taskinfo-title">货运电话：</span>
                                <span class="lj-taskinfo-content">{{mainObject.relstr_2}}</span>
                            </mu-col>
                        </mu-row>
                        <mu-row style="padding:5px 0 0 0;">
                            <mu-col>
                                <span class="lj-taskinfo-title">货运地址：</span>
                                <span class="lj-taskinfo-content">{{mainObject.station_address}}</span>
                            </mu-col>
                        </mu-row>


                        <template v-if="mainObject.freight ||mainObject.freight_tele ||mainObject.station_address">
                            <template v-if="mainObject.freight ||mainObject.freight_tele">
                                <mu-row style="margin-top: 10px;">
                                    <template v-if="mainObject.freight">
                                        <mu-col span="3" class="lj-card-secondary-title">货运部：</mu-col>
                                        <mu-col span="9" class="lj-card-secondary-content">{{mainObject.freight}}</mu-col>
                                    </template>
                                    <template v-if="mainObject.freight_tele">
                                        <mu-col span="3" class="lj-card-secondary-title">货运电话：</mu-col>
                                        <mu-col span="9" class="lj-card-secondary-content">{{mainObject.freight_tele}}
                                        </mu-col>
                                    </template>
                                </mu-row>
                            </template>
                            <template v-if="mainObject.station_address">
                                <div class="lj-card-tag-text lj-card-summary-light-text" style="margin-left: 5px;">
                                    货运部地址：{{mainObject.station_address}}
                                </div>
                            </template>
                        </template>
                        <!-- 备注 -->
                        <div v-if="mainObject.dscrp" class="lj-card-summary lj-card-summary-light-text">
                            <i class="iconfont icon-edit lj-card-summary-icon"></i>
                            <span class="lj-card-tertiary-content">
                                 {{mainObject.dscrp}}
                            </span>
                        </div>

                        <div class="lj-card-item">
                            <div>
                                <span class="taskedit_pzbtn" style="color:red;" @click="ClickAddFile">
                                    <i class="iconfont icon-fujian" style="font-size: 14px;"></i>
                                    添加附件[{{filedatasList.length}}]
                                </span>
                            </div>
                        </div>

                        <div class="lj-card-item" v-if="filedatasList.length > 0">
                            <div style="padding: 2px; color: gray; font-size: 14px;">
                                单据附件
                            </div>
                            <van-cell class="lj-file-show_and_update" v-if="picFjFilter(filedatasList).length > 0">
                                <template v-for="(file, index) in picFjFilter(filedatasList)">
                                    <lj-img-pro
                                        :key="file.fileid"
                                        class="file-rel-item"
                                        v-if="file.filemd5"
                                        :md5="file.filemd5"
                                        @image-click="photoBrowser(index, picFjFilter(filedatasList))"
                                    />
                                </template>
                            </van-cell>
                            <div class="lj-card-item" v-for="(file, index) in docFjFilter(filedatasList)" :key="index">
                                <lj-fj :fileName="file.fileName" :fileType="file.fileType" :fileSize = file.filekb  :md5="file.filemd5"  :fileid="file.fileid"/>
                            </div>
                        </div>
                    </div>

                    
                    <div class="lj-card-item">
                        <div class="lj-detail-are-title">
                            订单明细
                        </div>
                        <div class="lj-detail-mx-list-content">
                            <div v-for="item in mxList">
                                <mu-row style="margin-left:-10px">
                                    <mu-col span="1" style="text-align: right;">
                                        <li></li>
                                    </mu-col>
                                    <mu-col>
                                        <div class="lj-taskinfo-content">
                                            {{item.mtrlname}}{{item.mtrlmode !== "" ? ","+item.mtrlmode : ""}}
                                            <template v-if="item.status_config"><br/>{{item.status_config}}</template>
                                            <template v-if="item.woodcode_config"><br/>{{item.woodcode_config}}</template>
                                            <template v-if="item.pcode_config"><br/>{{item.pcode_config}}</template>
                                            <template v-if="item.status"><br/>{{item.status}}</template>
                                            <template v-if="item.woodcode"><br/>{{item.woodcode}}</template>
                                            <template v-if="item.pcode"><br/>{{item.pcode}}</template>
                                            <span class="taskedit_pzbtn" style="color:red;" @click="ClickAddFileMx(item)">
                                                <i class="iconfont icon-fujian" style="font-size: 14px;"></i>
                                                [{{item.filedatas ? item.filedatas.length : 0}}]
                                            </span>
                                        </div>
                                        <div class="lj-card-secondary-content lj-card-summary-light-text">
                                            数量：{{item.saleqty}}, <template v-if="userFunids.indexOf(122) < 0"> 单价：￥{{item.enacprice | moneyFilter}}<br/>
                                            金额：￥{{item.enacprice * item.saleqty | moneyFilter}}, </template>
                                            折扣：{{item.rebate}}<br/>
                                            计划发货数：{{item.planqty}}

                                        </div>
                                    </mu-col> 
                                </mu-row>
                                <van-cell class="lj-file-show_and_update" v-if="picFjFilter(item.filedatas).length > 0">
                                    <template v-for="(file, index) in picFjFilter(item.filedatas)">
                                        <lj-img-pro
                                            :key="file.fileid"
                                            class="file-rel-item"
                                            v-if="file.filemd5"
                                            :md5="file.filemd5"
                                            :downloadbtn="true"
                                            fileType="jpg"
                                            @image-click="photoMxBrowser(item,index)"
                                        />
                                    </template>
                                </van-cell>
                                <div class="lj-card-item" v-for="(file, index) in docFjFilter(item.filedatas)" :key="index">
                                    <lj-fj :fileName="file.fileName" :fileType="file.fileType" :fileSize = file.filekb  :md5="file.filemd5"  :fileid="file.fileid"/>
                                </div>
                                <div class="lj-divider"></div>
                            </div>
                        </div>
                    </div>

                    <div class="lj-card-item">
                        <div class="lj-detail-are-title">
                            订单进度跟踪
                        </div>
                        <div class="lj-detail-mx-list-content" style="padding-left:10px">
                            <template v-for="item in jdmxList">
                                <div class="lj-detail-mx-item">
                                    <template v-if="item.value">
                                        <i v-if="item.value.indexOf('%')>0"
                                           class="icon-progress-running iconfont lj-card-summary-icon"></i>
                                        <i v-else class="icon-progress-done iconfont lj-card-summary-icon"></i>
                                    </template>
                                    <i v-else class="icon-progress-not-started iconfont lj-card-summary-icon"></i>
                                    {{item.lable}}：{{item.value}}
                                </div>
                            </template>
                        </div>
                    </div>
                </div>
            </template>
            <template slot="footer">
                <mu-row v-if="mainObject.flag == 0">
                    <mu-col v-if="showAffirmButton">
                        <mu-button full-width color="primary" @click="handleClickConfirm(1)" v-if="isShowAffirmButton(0)">确认</mu-button>
                        <mu-button full-width color="primary" @click="handleClickConfirm(0)" v-if="isShowAffirmButton(1)">初确认</mu-button>
                        <mu-button full-width color="primary" @click="handleClickConfirm(1)" v-if="isShowAffirmButton(2)">终确认</mu-button>
                    </mu-col>
                    <mu-col v-if="showCancelButton">
                        <mu-button full-width color="success" @click="handleClickConfirm(3)" v-if="isShowCancelButton(0)">反确认</mu-button>
                        <mu-button full-width color="success" @click="handleClickConfirm(2)" v-if="isShowCancelButton(1)">反初确认</mu-button>
                        <mu-button full-width color="success" @click="handleClickConfirm(3)" v-if="isShowCancelButton(2)">反终确认</mu-button>
                    </mu-col>
                    <mu-col v-if="showAudit">
                        <mu-button full-width color="primary" @click="handleClickAudit">审核</mu-button>
                    </mu-col>
                </mu-row>
            </template>
        </lj-win-common>
    </div>
</template>

<script>
    import LjWinCommon from "components/lj-win-common";
    import LjDetailStatusHeader from "components/lj-detail-status-header";
    import LjFj from "components/lj-fj";
    import LjImgPro from "components/lj-img-pro";

    export default {
        name: "saletask-detail",
        components: {LjDetailStatusHeader, LjWinCommon, LjFj, LjImgPro},
        data() {
            return {
                mainObject: {},
                userFunids: [],
                mxList: [],
                jdmxList: [],
                currentFlowsort: "",
                showUrgeButton: false,
                durationTime: null,
                shwoProcess: false,
                base64Temp:"",
                fileDatas: [],
                fileClassList: [],
                fileClassListmx: [],
                fileClassid:0,
                fileClassidmx:0,
                relidPrintid:0,
                Listroadmodel:0,
                loadindex: 0,
                loadClassid: 0,
                filedatasList: []
            }
        },
        created() {
            this.userFunids = $lj.getStorage('user').rsltFunids;
            let pageParam = $lj.getPageParam();
            if (pageParam.mainObject) {
                this.mainObject = pageParam.mainObject;
            }
            this.reloadData();
        },
        methods: {
            reloadData() {
                if (!this.mainObject.outwareid) {
                    return;
                }
                this.fillData();
                this.getFileClass();
            },
            fillData() {
                let self = this;
                let requestBody = {
                    token: $lj.getStorage("token"),
                    scid: this.mainObject.scid,
                    outwareid: this.mainObject.outwareid
                };
                $lj.postLJRequest('GetL1SaletaskOutwareMx', requestBody, function (ret) {
                    if (ret) {
                        if(ret.outware) {
                            var outware = self.mainObject;
                            var outware_temp = ret.outware;
                            Object.keys(outware_temp).forEach(key=>{outware[key]=outware_temp[key]})
                        }

                        self.filedatasList = ret.filedatasList || [];
                        self.mxList = ret.outwareMxList;
                        self.jdmxList = ret.outwareJdMxList;
                    }
                })
            },
            handleClickConfirm(type) {
                if(!this.checkConfirmPower(type)) return;
                let self = this;
                let requestBody = {
                    token: $lj.getStorage("token"),
                    scid: this.mainObject.scid,
                    outwareid: this.mainObject.outwareid,
                    type: type
                };
                $lj.postLJRequest('UpdateOutwarePriceflag', requestBody, function (ret) {
                    if (ret) {
                        self.showAffirmToast(type);
                        self.fillData();
                        $lj.sendEvent("saletask_outware_refresh");
                    }
                })
            },
            checkConfirmPower(type){
                switch(type) {
                    case 0:
                    case 1:
                        if (this.mainObject.billtype == 1 && !$lj.checkPower(5753)) {
                            alert("没有[销售发货单-确认]的权限");
                            return false;
                        }else if(this.mainObject.billtype == 2 && !$lj.checkPower(7077)) {
                            alert("没有[出口销售出仓单-确认]的权限");
                            return false;
                        }
                        return true;
                    case 2:
                    case 3:
                        if (this.mainObject.billtype == 1 && !$lj.checkPower(7076)) {
                            alert("没有[销售发货单-反确认]的权限");
                            return false;
                        }else if(this.mainObject.billtype == 2 && !$lj.checkPower(7078)) {
                            alert("没有[出口销售出仓单-反确认]的权限");
                            return false;
                        }
                        return true;
                    default:
                        alert("没有[销售发货单-确认]的权限");
                        return false;
                }
            },
            handleClickAudit(){
                let self = this;
                // 检查仓审日期不能早于销售日期
                if (this.userFunids.indexOf(4200) >= 0){
                    if(new Date(this.mainObject.outdate) > new Date()){
                        alert("仓审日期不能早于销售日期");
                        return;
                    }
                }
                // 检测包件明细计划发货数与实际发货数是否相等
                let cntFlag = false;
                for (let i = 0;i < this.mxList.length; i++){
                    let item = this.mxList[i];
                    if (item.planqty != item.qty){
                        cntFlag = true;
                        break;
                    }
                }
                if (cntFlag){
                    $lj.selectDialog("操作提示", "包件计划发货数与实际发货数不相等,是否继续审核", ["否", "是"], function (btnIndex) {
                        if (btnIndex > 1) {
                            self.saleTaskAudit();
                        }
                    })
                }else{
                    this.saleTaskAudit();
                }

            },
            saleTaskAudit(){
                if (this.mainObject.billtype == 1 && !$lj.checkPower(7051)) {
                    alert("没有[销售发货单-审核]的权限");
                    return;
                }else if(this.mainObject.billtype == 2 && !$lj.checkPower(7079)) {
                    alert("没有[出口销售出仓单-审核]的权限");
                    return;
                }
                let requestBody = {
					token: $lj.getStorage("token"),
					outwareid:this.mainObject.outwareid,
					scid:this.mainObject.scid,
				};
				$lj.postLJRequest('UpdateOutWareSaleFlag2', requestBody, function (ret) {
					if (ret) {
						$lj.toast('审核成功', 2000);
                        self.fillData();
                        $lj.sendEvent("saletask_outware_refresh");
					}
				})
            },
            handleModify(){
                let self = this;
                let requestBody = {
                    token: $lj.getStorage("token"),
                    userid: $lj.getStorage('user').empid,
                    opempname: this.mainObject.opemp
                };
                $lj.postLJRequest('GetCheckIfOpemp', requestBody, function (ret) {
                    if (ret) {
                        if(ret.ifopemp){
                            $lj.openWin('saletask-outware-new', {mainObject: self.mainObject, winType: 1,mxList:self.mxList})
                        }
                        $lj.toast('审核成功', 2000);
                        $lj.closeWin();
                    }
                })
            },
            docFjFilter(data) {
                if (!data || !data.length) return []
                let picArr = ["jpg","jpeg","png","gif","bmp"]
                return data.filter((item) => {
                    return picArr.indexOf(item.fileType.trim().toLowerCase()) == -1
                })
            },
            picFjFilter(data) {
                if (!data || !data.length) return []
                let picArr = ["jpg","jpeg","png","gif","bmp"]
                return data.filter((item) => {
                    return picArr.indexOf(item.fileType.trim().toLowerCase()) > -1
                })
            },
            ClickAddFile(){
                this.Listroadmodel = 0;
                this.relidPrintid = 0;
                this.loadClassid = this.fileClassid;
                this.handleAddFile();
            },
            ClickAddFileMx(item){
                this.Listroadmodel = 1;
                this.relidPrintid = item.printid;
                this.loadClassid = this.fileClassidmx;
                this.handleAddFile();          
                this.loadindex = this.mxList.indexOf(item);
            },
            handleAddFile(){
                let self = this;
                var UIAlbumBrowser = api.require('UIAlbumBrowser');
                UIAlbumBrowser.imagePicker({
                    max: 9,
                    showCamera: true,
                    animation: true,
                    styles: {
                        bg: '#000000',
                        mark: {
                            icon: '',
                            position: 'top_right',
                            size: 20
                        },
                        nav: {
                            bg: '#000000',
                            cancelColor: '#fff',
                            cancelSize: 16,
                            nextStepColor: '#fff',
                            nextStepSize: 16,
                            finishText: '确定'
                        },
                        thumbnail: { //（可选项）返回的缩略图配置，**建议本图片不要设置过大** 若已有缩略图，则使用已有的缩略图。若要重新生成缩略图，可先调用清除缓存接口api.clearCache()。  
                            w: 100, //（可选项）数字类型；返回的缩略图的宽；默认：原图的宽度
                            h: 100 //（可选项）数字类型；返回的缩略图的宽；默认：原图的高度
                        }
                    },
                }, function (ret) {
                    if (ret.eventType == 'nextStep') {
                        var UIAlbumBrowser = api.require('UIAlbumBrowser');
                        UIAlbumBrowser.closePicker();
                        if (ret.list.length > 0) {
                            self.DealImg(ret.list)
                        }
                    } else if (ret.eventType == 'clickCamera' || ret.eventType == "") {
                        let List = [];
                        List.push({
                            path: ret.originalPath
                        })
                        self.DealImg(List);                      
                    }
                });
            },
            DealImg(List){
                let self = this;
                api.showProgress({
                    title: '处理图片中',
                    text: '请稍候...',
                    modal: false
                });
                List.forEach(el => {
                    let path = el.path
                    
                    self.base64Temp = '';
                    var trans = api.require('trans');
                    var UIAlbumBrowser = api.require('UIAlbumBrowser');
                    UIAlbumBrowser.transPath({
                        path: path
                    }, function(ret, err) {
                        if (ret) {
                            let name = ret.path.substring(ret.path.lastIndexOf("\/") + 1, ret.path.length);
                            trans.decodeImgToBase64({
                                imgPath: ret.path
                            }, function (ret, err) {
                                if (ret.status) {
                                    let self2 = self;
                                    $lj.compressBase64('data:image/jpeg;base64,' + ret.base64Str, {quality:0.8}, function (ret) {                            
                                        if (ret) {

                                            var List = [];
                                            List.push({
                                                base64: ret,
                                                fileType: name.substring(name.lastIndexOf("\.") + 1, name.length),
                                                fileName: name,
                                                billtype: self2.Listroadmodel > 0 ? self2.fjmxbilltype : self2.fjbilltype,
                                                ClassID: self2.loadClassid,
                                                relid: self2.mainObject.outwareid,
                                                relidmx: self2.relidPrintid,
                                                relcode: self2.mainObject.outwarecode
                                            }); 

                                            $lj.postLJRequest("UploadL1File", {
                                                token: $lj.getStorage("token"),
                                                fileList: List
                                            }, function (ret) {
                                                if (ret) {
                                                    if(self2.Listroadmodel == 0){
                                                        self2.mainObject.fjcnt += 1
                                                    }
                                                    else{
                                                        self2.mxList[self2.loadindex].fjcnt += 1
                                                    }
                                                    //$lj.toast("上传成功!");
                                                }
                                            });                                       
                                            api.hideProgress();                                                                                
                                        }                                                                             
                                    });
                                } else {
                                    alert(JSON.stringify(err));
                                    api.hideProgress();
                                    return;
                                }
                            });
                        } else {
                            alert(JSON.stringify(err));
                            return;
                        }
                    });
                });

            },
            getFileClass() {
                let self = this;
                $lj.postLJRequest("GetFileClass", {
                    token: $lj.getStorage("token"),
                    billtype: this.fjbilltype
                }, function (ret) {
                    if (ret) {
                        self.fileClassList = ret.list;
                        if (ret.list.length > 0) {
                            self.fileClassid = ret.list[0].classId;
                        }
                    }
                });
                $lj.postLJRequest("GetFileClass", {
                    token: $lj.getStorage("token"),
                    billtype: this.fjmxbilltype
                }, function (ret) {
                    if (ret) {
                        self.fileClassListmx = ret.list;
                        if (ret.list.length > 0) {
                            self.fileClassidmx = ret.list[0].classId;
                        }
                    }
                });
            },
            handleSaleTaskAudit(type) {
                let self = this;
                $lj.postLJRequest("AuditL1APPSaleOut", {
                    token: $lj.getStorage("token"),
                    scid: this.mainObject.scid,
                    taskid: this.mainObject.taskid,
                    type: type
                }, function (ret) {
                    if (ret) {
                        var toastText = type == 1 ? "审核" : "撤审";
                        toastText += "成功";
                        $lj.toast(toastText);
                        self.reloadData();
                    }
                });
            },
            photoBrowser(index) {
                var images = [];
                let md5list = [];
                for (const picture of this.filedatasList) {
                    var url = $lj.constant.cacheDir + "/" + picture.filemd5;
                    images.push(url);
                    md5list.push(picture.filemd5);
                }
                $lj.photoBrowser(images, index);
            },
            photoMxBrowser(item,index) {
                var images = [];
                let md5list = [];
                for (const picture of item.filedatas) {
                    var url = $lj.constant.cacheDir + "/" + picture.filemd5;
                    images.push(url);
                    md5list.push(picture.filemd5);
                }
                $lj.photoBrowser(images, index);
            },
            isShowAffirmButton(type) {
                if(type == 0 && $lj.getOptionValue(552) == 0) return true;
                if($lj.getOptionValue(552) == 1 && this.mainObject.priceflag == 0 && this.mainObject.flag == 0 && type == 1) return true;
                if($lj.getOptionValue(552) == 1 && this.mainObject.priceflag == 2 && this.mainObject.flag == 0 && type == 2) return true;
                return false;
            },
            isShowCancelButton(type) {
                if($lj.getOptionValue(552) == 0 && type == 0) return true;
                if($lj.getOptionValue(552) == 1 && this.mainObject.priceflag == 2 && this.mainObject.flag == 0 && type == 1) return true;
                if($lj.getOptionValue(552) == 1 && this.mainObject.priceflag == 1 && this.mainObject.flag == 0 && type == 2) return true;
                return false;
            },
            showAffirmToast(type) {
                $lj.toast('确认成功', 2000);
                switch(type){
                    case 0:
                        $lj.toast('初确认成功', 2000);
                        break;
                    case 1:
                        if($lj.getOptionValue(552) == 0) {
                            $lj.toast('确认成功', 2000);
                        } else {
                            $lj.toast('终确认成功', 2000);
                        }
                        break;
                    case 2:
                        $lj.toast('反初确认成功', 2000);
                        break;
                    case 3:
                        if($lj.getOptionValue(552) == 0) {
                            $lj.toast('反确认成功', 2000);
                        } else {
                            $lj.toast('反终确认成功', 2000);
                        }
                        break;
                }
            }
        },
        computed: {
            fjbilltype() {
                switch(this.mainObject.billtype) {
                    case 1:
                        // 销售发货单
                        return 104;
                    case 2:
                        // 出口销售出仓单
                        return 5578;
                    default:
                        return 104;
                }
            },
            fjmxbilltype() {
                switch(this.mainObject.billtype) {
                    case 1:
                        // 销售发货单
                        return 9104;
                    case 2:
                        // 出口销售出仓单
                        return 95578;
                    default:
                        return 9104;
                }
            },
            showAffirmButton() {
                return this.mainObject.flag == 0 && (this.mainObject.priceflag == 0 || $lj.getOptionValue(552) == 1 && this.mainObject.priceflag == 2);
            },
            showCancelButton() {
                return this.mainObject.flag == 0 && (($lj.getOptionValue(552) == 0 && this.mainObject.priceflag == 1) || 
                ($lj.getOptionValue(552) == 1 && this.mainObject.priceflag > 0))
            },
            showAudit() {
                return ($lj.getOptionValue(25) == 0) || ($lj.getOptionValue(25) == 1 && this.mainObject.flag == 0 && this.mainObject.priceflag == 1);
            },
            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>

<style scoped>
    
</style>