{
    template: '${tmpl}',
        data: function() {
            var that = this;
            var validateMethod = function (rule, value, callback) {

                if (rule.field == "mobile") {
                    if (/^1[23456789]\d{9}$/.test(value) == false) {
                        return callback(new Error("请输入正确格式的手机号"));
                    } else {
                        return callback();
                    }
                }
                return callback();
            };
            return {
                input: "",
                businessType: [
                    {
                        value: '选项1',
                        label: '自主注册'
                    },
                    {
                        value: '选项2',
                        label: '专家辅助注册'
                    },

                ],
                DeliveryStatus: [
                    {
                        value: '选项1',
                        label: '提交订单'
                    },
                    {
                        value: '选项2',
                        label: '待上传材料'
                    },
                    {
                        value: '选项3',
                        label: '已审核'
                    },
                    {
                        value: '选项4',
                        label: '审核不同过'
                    },
                    {
                        value: '选项5',
                        label: '已递交'
                    },
                    {
                        value: '选项6',
                        label: '已完成'
                    },
                    {
                        value: '选项6',
                        label: '已关闭'
                    }
                ],
                indentInfo: {
                    "channelServiceNo": "",
                    "deliveryOrderNo": "",
                    "itemCode": "",
                    "deliveryStatus": "",
                    "payStatus": "",
                    "tmName": "",
                    "name": "",
                    "startTime": "",
                    "entTime": "",
                    "pageIndex": 1,
                    "pageSize": 10
                },
                pickerOptions: {
                    shortcuts: [{
                        text: '最近一周',
                        onClick(picker) {
                            console.log(picker);
                            const end = new Date();
                            const start = new Date();
                            start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
                            picker.$emit('pick', [start, end]);
                        }
                    }, {
                        text: '最近一个月',
                        onClick(picker) {
                            const end = new Date();
                            const start = new Date();
                            start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
                            picker.$emit('pick', [start, end]);
                        }
                    }, {
                        text: '最近三个月',
                        onClick(picker) {
                            const end = new Date();
                            const start = new Date();
                            start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
                            picker.$emit('pick', [start, end]);
                        }
                    }]
                },

                /*input绑定值 */
                channelServiceNo: null,
                deliveryOrderNo: null,
                tmName: null,
                name: null,
                itemName: null,
                inputDate: null,
                startTime: null,
                entTime: null,
                deliveryStatusName: null,
                /**$ */
                CreateDate: null,
                tableData: [],
                currentPage: 1,
                countPage: "",
                pageSize: null,
                /* 上传资料弹框 */

                loading: false,
                loading1: false,
                loading2: false,
                loading3: false,
                loadingKey: 0,
                sumparams: ["totalSum", "nclOneCodesNum"],
                multipleSelection: [],
                isSingleSelect: false,
                bizCode: "",
                centerDialogVisible: false,
                activeIndex: "1",
                totalSum: 0,
                sfs: [
                    { field: 'totalSum', label: '订单金额' },
                ],
                form: {
                    tmFormType: 3,
                    name: "",
                    picUrl: "",
                    colorizedPicUrl: "",
                    selecttype: "自主选择",
                    totalPublicExpense: 0,
                    totalTaxes: 0,
                    totalSum: 0,
                    totalDiscounts: 0,
                    totalServiceCharge: 0,
                    totalProfitSum: 0,
                    remark: "",
                    sveItemRateConfig: "",
                },
                form1: {
                    title: "",
                    taxNum: "",
                    email: "",
                },
                form2: {
                    title: "",
                    taxNum: "",
                    companyAddress: "",
                    companyMobile: "",
                    companyBank: "",
                    bankNum: "",
                    picUrl: "",
                    recipient: "",
                    mobile: "",
                    city: "",
                    address: "",
                },
                rules1: {
                    title: [
                        { required: true, message: '请输入发票抬头', trigger: 'blur' },
                    ],
                    taxNum: [
                        { required: true, message: '请输入纳税号', trigger: 'blur' },
                    ],
                    email: [
                        { required: true, message: '请输入发票接收邮箱', trigger: 'blur' },
                        { type: 'email', message: '请输入正确的邮箱地址', trigger: ['blur', 'change'] }
                    ]
                },
                rules2: {
                    title: [
                        { required: true, message: '请输入发票抬头', trigger: 'blur' },
                    ],
                    taxNum: [
                        { required: true, message: '请输入纳税号', trigger: 'blur' },
                    ],
                    companyAddress: [
                        { required: true, message: '请输入备案地址', trigger: 'blur' },
                    ],
                    companyMobile: [
                        { required: true, message: '请输入备案电话', trigger: 'blur' },
                    ],
                    companyBank: [
                        { required: true, message: '请输入开户银行', trigger: 'blur' },
                    ],
                    bankNum: [
                        { required: true, message: '请输入银行账户', trigger: 'blur' },
                    ],
                    fileUrl: [
                        { required: true, message: '请上传纳税资格证明', trigger: 'blur' },
                    ],
                    recipient: [
                        { required: true, message: '请输入收件人', trigger: 'blur' },
                    ],
                    mobile: [
                        { required: true, message: '请输入手机号', trigger: 'blur' },
                        { validator: validateMethod, trigger: 'blur' },
                    ],
                    address: [
                        { required: true, message: '请输入详细地址', trigger: 'blur' },
                    ],
                },
                d: {},
                action: "",
                addressInfo: [],
                index: 0,
                orderId: "",
                stuff: {},
                showUploadStuff: false,

            }
        },
    mounted: function() {
        var that = this;
        var obj = this.$root.copyParams("", "getOssConfig", "/action/tmTools/springBoard");
        this.$root.postReq("/web/trademark/tmqueryCtl/doPost", obj).then(function (d) {
            console.log(d, `mmmmmmmmmmmmmmmmmmmmmmm`);
            that.d["key"] = "key";
            that.d["Bucket"] = d.data.Bucket;
            that.d["OSSAccessKeyId"] = d.data.OSSAccessKeyId;
            that.d["Signature"] = d.data.Signature;
            that.d["policy"] = d.data.policy;
            that.d["success_action_status"] = d.data.success_action_status;
            that.action = d.data.url;
            console.log(that.action, `oooooooooooooooooooooooooooo`);
        });
        this.handleSizeChange();
    },
    created: function() {
        console.log(new Date(), new Date().toLocaleString('chinese', { hour12: false }));
    },
    methods: {
        tableRowClassName({ row, rowIndex }) {
            if (rowIndex === 1) {
                return 'warning-row';
            } else if (rowIndex === 3) {
                return 'success-row';
            }
            return '';
        },
        viewDetails(index, row) {
            console.log(index, row);
            this.$router.push({ path: "/1688/jdindentdetail", query: { deliveryOrderNo: row.deliveryOrderNo } });
        },
        showBtn(index, row){
            if (row.deliveryStatusName == "待上传材料") {
                return true;
            } else {
                return false;
            }
        },
        handleSizeChange(){
            console.log(this.currentPage);
            if (this.currentPage) {
                this.indentInfo.pageIndex = this.currentPage;
            }
            var obj = this.$root.copyParams(this.indentInfo, "getTmOrderList", "/action/tmOrder/springBoard");
            this.$root.loading = true;
            this.$root.postReq("/web/trademark/tmqueryCtl/doPost", obj).then((d) => {
                this.$root.loading = false;
                if (d.status == 0 && d.data) {
                    this.tableData = d.data;
                    this.countPage = d.data.length;
                    d.data.map((item, index) => {
                        item.CreateDate = new Date(item.CreateDate).toLocaleDateString('chinese', { hour12: false });
                        item.submitTime = new Date(item.submitTime).toLocaleString('chinese', { hour12: false });
                    });
                }
            });
        },
        reset(){
            this.channelServiceNo = null;
            this.deliveryOrderNo = null;
            this.name = null;
            this.itemName = null;
            this.tmName = null;
            this.CreateDate = null;
            this.deliveryStatusName = null;
        },
        find(){
            this.indentInfo.channelServiceNo = this.channelServiceNo;
            this.indentInfo.deliveryOrderNo = this.deliveryOrderNo;
            this.indentInfo.name = this.name;
            this.indentInfo.itemName = this.itemName;
            this.indentInfo.tmName = this.tmName;
            this.indentInfo.CreateDate = this.CreateDate;
            this.indentInfo.deliveryStatusName = this.deliveryStatusName;
            this.indentInfo.startTime = this.startTime || "";
            this.indentInfo.entTime = this.entTime || "";
            this.handleSizeChange();
        },
        dateChecked(v){
            this.startTime = new Date(v[0]).toLocaleDateString('chinese', { hour12: false }).replace(/\//g, '-');
            this.entTime = new Date(v[1]).toLocaleDateString('chinese', { hour12: false }).replace(/\//g, '-');
            console.log(this.startTime, this.entTime);
        },
        /**上传资料弹窗 */
        setKey(name, flag){
            name = name.substring(name.length - 5);
            var myDate = new Date();
            var key = "zc_" + Math.round(Math.random() * 500) + myDate.getMonth() + myDate.getTime() + myDate.getFullYear() + myDate.getDate() + myDate.getHours() + myDate.getMinutes() + myDate.getSeconds() + myDate.getMilliseconds() + name.replace(" ", "");
            this.$refs[flag].d.key = key;
        },
        uploadsuccess(obj){
            var that = this;
            if (this.loadingKey == 1) {
                that.loading1 = true;
            } else if (this.loadingKey == 2) {
                that.loading2 = true;
            } else if (this.loadingKey == 3) {
                that.loading3 = true;
            } else if (this.loadingKey == 0) {
                that.loading = true;
            }

            if (obj.flag == "yyzz") {
                this.$root.getReq("/web/toolCtl/pic2pdf", { "key": obj.key }).then(function (d) {
                    that.loading1 = false;
                    that.loading2 = false;
                    that.loading3 = false;
                    that.loading = false;
                    if (d.status == 0) {
                        that.stuff.businessLicensePic = d.data.url;
                    } else {
                        that.stuff.businessLicensePic = "";

                        that.$message.warning(`上传失败请重新上传`);
                        return false;
                    }
                }).catch(function (e) {
                    that.stuff.businessLicensePic = "";
                    that.loading1 = false;
                    that.loading2 = false;
                    that.loading3 = false;
                    that.loading = false;
                    that.$message.warning(`上传失败请重新上传`);
                    return false;
                })
            }
            if (obj.flag == "sfz") {

                this.$root.getReq("/web/toolCtl/pic2pdf", { "key": obj.key }).then(function (d) {
                    that.loading1 = false;
                    that.loading2 = false;
                    that.loading3 = false;
                    that.loading = false;
                    if (d.status == 0) {
                        that.stuff.identityCardPic = d.data.url;
                    } else {
                        that.stuff.identityCardPic = "";
                        that.$message.warning(`上传失败请重新上传`);
                        return false;
                    }
                }).catch(function (e) {
                    that.stuff.identityCardPic = "";
                    that.loading1 = false;
                    that.loading2 = false;
                    that.loading3 = false;
                    that.loading = false;
                    that.$message.warning(`上传失败请重新上传`);
                    return false;
                })
            }
            if (obj.flag == "wts") {
                this.$root.getReq("/web/toolCtl/adjustWTSSize", { "key": obj.key }).then(function (d) {
                    that.loading1 = false;
                    that.loading2 = false;
                    that.loading3 = false;
                    that.loading = false;
                    if (d.status == 0) {
                        that.stuff.sealAuthorizeStuff = d.data.url;
                        console.log(d.data.url);
                    } else {
                        that.$refs[obj.flag][0].result = "";

                        that.$message.warning(`上传失败请重新上传`);
                        return false;
                    }

                }).catch(function () {
                    that.$refs[obj.flag][0].result = "";
                    that.loading1 = false;
                    that.loading2 = false;
                    that.loading3 = false;
                    that.loading = false;
                    that.$message.warning(`上传失败请重新上传`);
                    return false;
                });
            }
            if (obj.flag == "yxq") {
                that.loading1 = false;
                that.loading2 = false;
                that.loading3 = false;
                that.loading = false;
                that.stuff.descUrl = obj.result
            }
        },
        setKey(name, flag){

            name = name.substring(name.length - 5);
            var myDate = new Date();
            var key = "zc_" + flag + Math.round(Math.random() * 10000) + myDate.getTime() + myDate.getFullYear() + myDate.getMonth() + myDate.getDate() + ".jpg";

            this.$refs[flag].d.key = key;
        },
        btnvisbleMethod(row, btn){
            if (btn.key == "invoiceapply") {
                if (row.orderPayStatus == "yfk" && row.invoiceApplyStatus == "1" && row.isIinvoice == 1) {
                    return true;
                } else {
                    return false;
                }
            }
            if (btn.key == "mydetail") {
                if (row.sveItemCode == "zzsbzc" || row.sveItemCode == "dlrfzzc" || row.sveItemCode == "dbsbzc") {
                    return true;
                } else {
                    return false;
                }
            }
            if (btn.key == "myicpdetail") {
                if (row.sveItemCode == "CP201910231025EaQM0b") {
                    return true;
                } else {
                    return false;
                }
            }
            if (btn.key == "myedit") {
                if (row.orderPayStatus == "ddqx" || row.orderPayStatus == "tkclz" || row.orderPayStatus == "ytk") {
                    return false;
                } else if (row.sveItemCode == "dlrfzzc" && (row.orderStatus == "1" || row.orderStatus == "2" || row.orderStatus == "3" || row.orderStatus == "4" || row.orderStatus == "6")) {
                    return true;
                } else if (row.sveItemCode == "zzsbzc" && (row.orderStatus == "1" || row.orderStatus == "2" || row.orderStatus == "3" || row.orderStatus == "4" || row.orderStatus == "6")) {
                    return true;
                } else if (row.sveItemCode == "dbsbzc" && (row.orderStatus == "1" || row.orderStatus == "2" || row.orderStatus == "3" || row.orderStatus == "4" || row.orderStatus == "6")) {
                    return true;
                } else {
                    return false;
                }
            }
            if (btn.key == "ptsjedit") {
                if (row.orderSource == "ptsj" && row.orderPayStatus == "dfk" && this.currentUser && row.createuser_id == this.currentUser.id) {
                    return true;
                } else {
                    return false;
                }
            }
            if (btn.key == "topay") {
                if (row.orderPayStatus == "dfk") {
                    return true;
                } else {
                    return false;
                }
            }
            if (btn.key == "cancelorder") {
                if ((row.sveItemCode == "dlrfzzc" || row.sveItemCode == "zzsbzc" || row.sveItemCode == "dbsbzc") && row.orderPayStatus == "dfk") {
                    return true;
                } else {
                    return false;
                }
            }

            if (btn.key == "uploadstuff") {
                if (row.orderPayStatus == "ddqx" || row.orderPayStatus == "tkclz" || row.orderPayStatus == "ytk") {
                    return false;
                } else if ((row.sveItemCode == "dlrfzzc" || row.sveItemCode == "zzsbzc" || row.sveItemCode == "dbsbzc") && (row.orderStatus == "1" || row.orderStatus == "2" || row.orderStatus == "3" || row.orderStatus == "4" || row.orderStatus == "6")) {
                    return true;
                } else {
                    return false;
                }
            }
            if (btn.key == "mydelete") {
                if (row.orderPayStatus == "dfk" && row.createuser_id == this.currentUser.id) {
                    return true;
                } else {
                    return false;
                }
            }
            return true;
        },
        onColFormater(row, column, cellvalue, index){
            if (column.property == "created_at") {
                var date = new Date(row["created_at"]);
                var time = date.toLocaleDateString();

                return time;
            }
            if (column.property == "customerinfo.name") {
                if (!row.customerinfo) {
                    return "---";
                } else {
                    return row.customerinfo.name;
                }
            }
            if (column.property == "name") {
                if (!row["name"]) {
                    return "---";
                } else {
                    return row.name;
                }
            }
            if (column.property == "nclOneCodesNum") {
                if (!row["nclOneCodesNum"]) {
                    return "---";
                } else {
                    return row.nclOneCodesNum;
                }
            }
            return cellvalue;
        },

        error(err){
            this.$message.warning(`上传失败，请重新上传`);
        },
        hideUploadStuff(){
            this.stuff = {};
            this.showUploadStuff = false;
        },
        uploadStuffs(){
            var obj = this.stuff;
            var that = this;
            this.$root.postReq("/web/orderCtl/uploadStuffs", obj).then(function (d) {

                if (d && d.code == 1) {
                    that.hideUploadStuff();
                    that.$refs.grid.fetchData();
                } else {
                    that.$message.warning(d.msg);
                }
            })
        },
    },
    vname: "gsb-jdindentlist"
}
