{
    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 {
                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: "",
                    order_appendinfo: {
                        level: "",
                        area_list: [],
                        department_list: [],
                        type_list: []
                    },
                    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() {

    },
    methods: {
        goOrder(){
            let that = this;
            this.params.tm.totalSum = this.tableData[0].countPrice;
            this.params.tm.salesNum = Number(this.$route.query.num);
            this.apply.orderType = "zzdd";
            this.params.apply = this.apply;
            this.params.itemCode = this.tableData[0].code;
            this.$root.postReq("/web/orderCtl/createOtherOrder", this.params).then((d) => {
                console.log("---------submitOrder-------");
                if (this.$store.state.currentUser == null) {
                    this.$message.warning("未登录");
                    return
                }
                if (d.code == 1) {
                    this.$root.pushx({
                        title: "订单支付",
                        name: "/orderpay",
                        params: { orderNum: d.data.code }
                    });
                } else {
                    this.$message.warning(d.msg);
                }
            }).catch((e) => {
                console.log(e);
            })
        },
        getProduct(){
            var sdsId = window.location.href.split("sdsId=")[1];
            var that = this;
            this.$root.getReq("/web/serviceitemCtl/findOneById", { id: sdsId }).then(function (d) {
                if (d.code == 1) {
                    var data = d.data;
                    console.log(d.data);
                    d.data.num = that.$route.query.num;
                    d.data.countPrice = (d.data.serviceCharge + d.data.publicExpense) * Number(that.$route.query.num);
                    that.tableData.push(d.data);
                    console.log("返回信息", that.tableData);
                    that.serviceName = d.data.name;
                }
            });
        },
        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"
}
