{
    template: '${tmpl}',
        data: function() {

            var name = (rule, value, callback) => {
                console.log(rule, value, callback);
                if (value == '') {
                    callback(new Error('请输入姓名'));
                } else {
                    callback();
                }
            };
            var phoneNum = (rule, value, callback) => {
                var x = /((\d{11})|^((\d{7,8})|(\d{4}|\d{3})-(\d{7,8})|(\d{4}|\d{3})-(\d{7,8})-(\d{4}|\d{3}|\d{2}|\d{1})|(\d{7,8})-(\d{4}|\d{3}|\d{2}|\d{1}))$)/g.test(value);
                if (!x) {
                    callback(new Error('联系电话格式错误！'));
                } else {
                    callback();
                }
            };
            return {
                primary: 'info',
                tableData: [

                ],
                labelPosition: 'right',
                apply: {
                    orderType: "zzdd",
                    contacts: '',
                    mobile: '',
                    email: '',
                    notes: ''
                },
                applyRules: {
                    contacts: [
                        { required: true, message: '请输入姓名', trigger: 'blur', validator: name },
                    ],
                    mobile: [
                        { required: true, message: '请输入正确电话号码', trigger: 'change', validator: phoneNum }
                    ],
                },
                checkImg: false,
                num: null,
                params: {
                    itemCode: "",
                    apply: {
                        orderType: "zzdd",
                        contacts: "",
                        mobile: "",
                        email: "",
                        notes: ""
                    },
                    tm: {
                        totalSum: null,
                    },
                },
                serviceName: "",

            }
        },
    mounted: function() {
        console.log(Number(this.$route.query.sdsId), `llllllkkkkkkkkkkkkkkkkkkkkkk`);
        this.num = Number(this.$route.query.num);
        this.getProduct();
        console.log(this.$route.query);
        /** 
         * 
        $("#app-header").hide();
         * 
        */
    },
    created: function() {
        let { OtherOrderParams } = localStorage;
        if (OtherOrderParams) {
            this.apply = JSON.parse(OtherOrderParams).apply;
        }
    },
    methods: {
        agreeContract(){
            this.checkImg = !this.checkImg;
            if (this.checkImg) {
                this.primary = 'primary';
            } else {
                this.primary = 'info';
            }
        },
        goOrder(){

            this.$refs.apply.validate((v) => {
                console.log(v);
                if (v) {
                    this.params.tm.totalSum = this.tableData[0].countPrice;
                    this.params.tm.quantity = Number(this.$route.query.num);
                    this.apply.orderType = "zzdd";
                    this.params.apply = this.apply;
                    this.params.itemCode = this.tableData[0].sdsId;
                    if (this.$root.channelUserId && this.$root.channelUserId != "") {
                        this.params.channelUser = {
                            "channelUserId": this.$root.channelUserId
                        };
                    }
                    var obj = this.$root.copyParams(this.params, "subOtherOrder", "/action/tmOrder/springBoard", 'yes', 'yes');
                    this.$root.postReq("/web/trademark/tmqueryCtl/doPost", obj).then((d) => {
                        console.log("---------submitOrder-------");
                        if (d.status == '-99') {
                            localStorage.OtherOrderParams = JSON.stringify(this.params);
                            this.$message.warning("未登录");
                            this.$router.push({ path: `/${this.$root.channelName}/login`, });
                            return
                        }
                        if (d.status == 0) {
                            console.log(d);
                            this.$router.push({
                                path: `/${this.$root.channelName}/orderpay`,
                                query: {
                                    orderNo: d.data.orderNo
                                }
                            })
                        } else {
                            this.$message.warning(d.msg);
                        }
                    }).catch((e) => {
                        console.log(e);
                    })
                }
            })

        },
        getProduct(){
            var data = { ...this.$route.query };
            this.tableData.push(data);
            console.log(data, '!!!!!!!!!!!!!!!1');

        },
        tiaozhuan(code) {
            switch (code) {
                case 1:
                    this.$router.push({
                        path: `/${this.$root.channelName}/jdtrademark?`
                    });
                    break;
                case 2:
                    this.$router.push({
                        path: `/${this.$root.channelName}/servicedetails`
                    });
                    break;
                default:
                    break;
            }

        },
    },
    computed: {

    },
    vname: "gsb-nowbuy"
}
